Jake Vanderwerf
2026-04-26 5697a1c3af703f04902c0422c0536c88899ebb27
files/fileManagement.php
@@ -4,8 +4,8 @@
 * Custom upload directory structure for edmonton.ink
 * Recreates the original directory logic with shops, artists, partners, etc.
 */
add_filter('jvb_upload_directory', 'atat_upload_directory', 10, 4);
function atat_upload_directory($path, $post_type, $user_id, $term_id)
add_filter('jvb_upload_directory', 'aei_upload_directory', 10, 4);
function aei_upload_directory($path, $post_type, $user_id, $term_id)
{
    switch ($post_type) {
        case 'shop':
@@ -37,8 +37,8 @@
 * Custom filename generation for edmonton.ink
 * Recreates the original SEO-friendly filename logic
 */
add_filter('jvb_upload_filename', 'atat_filename', 10, 6);
function atat_filename($filename, $original_name, $user_data, $post_type, $user_id, $term_id)
add_filter('jvb_upload_filename', 'aei_filename', 10, 6);
function aei_filename($filename, $original_name, $user_data, $post_type, $user_id, $term_id)
{
    // Get artist/shop/partner details
    $post = (int)get_user_meta($user_id, BASE . 'link', true);
@@ -61,13 +61,13 @@
                '%s-best-tattoo-shop-%s-%s',
                sanitize_title($city),
                sanitize_title($shop_term->name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        case 'artist':
            // Profile images: {city}-best-{type}-{specialties}-{name}
            $type = jvbArtistType($post);
            $specialties = atat_get_artist_top_styles($post);
            $specialties = aei_get_artist_top_styles($post);
            return sprintf(
                '%s-best-%s-%s-%s-%s',
@@ -75,7 +75,7 @@
                sanitize_title($type),
                sanitize_title($specialties),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        case 'partner':
@@ -87,13 +87,13 @@
                sanitize_title($city),
                sanitize_title($service_type),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        case 'tattoo':
            // Get style and subject if available
            $style = atat_get_primary_taxonomy($post, BASE . 'style');
            $subject = atat_get_primary_taxonomy($post, BASE . 'theme');
            $style = aei_get_primary_taxonomy($post, BASE . 'style');
            $subject = aei_get_primary_taxonomy($post, BASE . 'theme');
            return sprintf(
                '%s-%s-%s-tattoo-by-%s-%s',
@@ -101,13 +101,13 @@
                sanitize_title($style),
                sanitize_title($subject),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        case 'artwork':
            // Get style and subject if available
            $style = atat_get_primary_taxonomy($post, BASE . 'artstyle');
            $subject = atat_get_primary_taxonomy($post, BASE . 'arttheme');
            $style = aei_get_primary_taxonomy($post, BASE . 'artstyle');
            $subject = aei_get_primary_taxonomy($post, BASE . 'arttheme');
            return sprintf(
                '%s-%s-%s-artwork-by-%s-%s',
@@ -115,19 +115,19 @@
                sanitize_title($style),
                sanitize_title($subject),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        case 'piercing':
            // Get style if available
            $style = atat_get_primary_taxonomy($post, BASE . 'pstyle');
            $style = aei_get_primary_taxonomy($post, BASE . 'pstyle');
            return sprintf(
                '%s-%s-piercing-by-%s-%s',
                sanitize_title($city),
                sanitize_title($style),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
        default:
@@ -139,7 +139,7 @@
                sanitize_title($city),
                sanitize_title($content_type),
                sanitize_title($user_data->display_name),
                atat_get_counter($user_id, $post_type)
                aei_get_counter($user_id, $post_type)
            );
    }
}
@@ -148,8 +148,8 @@
 * Custom alt text generation for edmonton.ink
 * Recreates the original detailed alt text logic
 */
add_filter('jvb_upload_alt_text', 'atat_alt_text', 10, 7);
function atat_alt_text($alt_text, $file, $user_data, $post_id, $post_type, $user_id, $term_id)
add_filter('jvb_upload_alt_text', 'aei_alt_text', 10, 7);
function aei_alt_text($alt_text, $file, $user_data, $post_id, $post_type, $user_id, $term_id)
{
    $post = get_user_meta($user_id, BASE . 'link', true);
@@ -174,7 +174,7 @@
            );
        case 'artist':
            $specialties = atat_get_artist_top_styles($post);
            $specialties = aei_get_artist_top_styles($post);
            return sprintf(
                'A photo of %s %s %s, specializing in %s tattoos',
@@ -237,8 +237,8 @@
 * Custom image title generation for edmonton.ink
 * Recreates the original SEO-friendly title logic
 */
add_filter('jvb_upload_image_title', 'atat_image_title', 10, 7);
function atat_image_title($title, $file, $user_data, $post_id, $post_type, $user_id, $term_id)
add_filter('jvb_upload_image_title', 'aei_image_title', 10, 7);
function aei_image_title($title, $file, $user_data, $post_id, $post_type, $user_id, $term_id)
{
    $post = get_user_meta($user_id, BASE . 'link', true);
@@ -342,7 +342,7 @@
/**
 * Get the next file counter for edmonton.ink style counters
 */
function atat_get_counter($user_id, $post_type)
function aei_get_counter($user_id, $post_type)
{
    // Get counter key for this post type
    $counter_key = BASE . str_replace(BASE, '', $post_type) . '_counter';
@@ -363,7 +363,7 @@
/**
 * Get artist's top styles for filename generation
 */
function atat_get_artist_top_styles($post_id)
function aei_get_artist_top_styles($post_id)
{
    if (!function_exists('JVBase\\meta\\MetaManager')) {
        // Fallback if MetaManager not available
@@ -403,7 +403,7 @@
/**
 * Get primary taxonomy term for content
 */
function atat_get_primary_taxonomy($post_id, $taxonomy)
function aei_get_primary_taxonomy($post_id, $taxonomy)
{
    $terms = wp_get_post_terms($post_id, $taxonomy, array('fields' => 'names'));
    if (is_wp_error($terms) || empty($terms)) {
@@ -416,7 +416,7 @@
 * Get partner type (placeholder - implement based on your edmonton.ink logic)
 * This function was referenced in the original but not provided
 */
function atat_partner_type($post_id)
function aei_partner_type($post_id)
{
    // Implement based on your edmonton.ink logic
    // This might look at a taxonomy or meta field