/**
 * Support for other plugins
 *
 * Supported so far:
 * - WordPress Mobile Edition
 * - Media Tags
 */
function file_gallery_plugins_loaded()
{
    $file_gallery_abspath = WP_PLUGIN_DIR . '/' . basename(dirname(__FILE__));
    $file_gallery_abspath = str_replace('\\', '/', $file_gallery_abspath);
    $file_gallery_abspath = preg_replace('#/+#', '/', $file_gallery_abspath);
    if (!defined('FILE_GALLERY_URL')) {
        // file gallery directories and template names
        define('FILE_GALLERY_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
        define('FILE_GALLERY_ABSPATH', $file_gallery_abspath);
    }
    $mobile = false;
    $options = get_option('file_gallery');
    // WordPress Mobile Edition
    if (function_exists('cfmobi_check_mobile') && cfmobi_check_mobile()) {
        $mobile = true;
        if (!isset($options['disable_shortcode_handler']) || $options['disable_shortcode_handler'] != true) {
            add_filter('stylesheet_uri', 'file_gallery_mobile_css');
        }
    }
    if (!defined('FILE_GALLERY_MOBILE')) {
        define('FILE_GALLERY_MOBILE', $mobile);
    }
    file_gallery_media_tags_get_taxonomy_slug();
}
Example #2
0
        }
    }
    $browsers = array_merge($cfmobi_mobile_browsers, $cfmobi_touch_browsers);
    if (is_null($mobile) && count($browsers)) {
        foreach ($browsers as $browser) {
            if (!empty($browser) && strpos($_SERVER["HTTP_USER_AGENT"], trim($browser)) !== false) {
                $mobile = true;
            }
        }
    }
    if (is_null($mobile)) {
        $mobile = false;
    }
    return apply_filters('cfmobi_check_mobile', $mobile);
}
if (cfmobi_check_mobile()) {
    add_filter('template', 'cfmobi_template');
    add_filter('option_template', 'cfmobi_template');
    add_filter('option_stylesheet', 'cfmobi_template');
}
function cfmobi_template($theme)
{
    if (cfmobi_installed()) {
        return apply_filters('cfmobi_template', CF_MOBILE_THEME);
    } else {
        return $theme;
    }
}
function cfmobi_installed()
{
    return is_dir(ABSPATH . '/wp-content/themes/' . CF_MOBILE_THEME);