Beispiel #1
0
function jwplayer_init()
{
    clearstatcache();
    load_plugin_textdomain("jw-player-plugin-for-wordpress", false, basename(dirname(__FILE__)));
    if (!@is_dir(JWPLAYER_FILES_DIR)) {
        if (!@mkdir(JWPLAYER_FILES_DIR, 0755, true)) {
            add_action('admin_notices', "jwplayer_directory_error");
            return;
        }
        chmod(JWPLAYER_FILES_DIR, 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/player", 0755)) {
            add_action('admin_notices', "jwplayer_player_error");
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/player", 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/configs", 0755)) {
            add_action('admin_notices', "jwplayer_configs_error");
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/configs", 0755);
        if (@is_dir(JWPLAYER_PLUGIN_DIR . "/configs")) {
            foreach (get_old_configs() as $config) {
                @rename(JWPLAYER_PLUGIN_DIR . "/configs/{$config}.xml", JWPLAYER_FILES_DIR . "/configs/{$config}.xml");
            }
        }
    }
    if (!@is_dir(JWPLAYER_FILES_DIR)) {
        add_action('admin_notices', "jwplayer_total_error");
    } else {
        if (!file_exists(LongTailFramework::getPlayerPath())) {
            // Error if the player doesn't exist
            add_action('admin_notices', "jwplayer_install_notices");
        }
    }
    if (file_exists(LongTailFramework::getEmbedderPath())) {
        if (get_option(LONGTAIL_KEY . "player_location_enable")) {
            wp_register_script("jw-embedder", get_option(LONGTAIL_KEY . "player_location") . "jwplayer.js", array(), false);
        } else {
            wp_register_script("jw-embedder", LongTailFramework::getEmbedderURL(), array(), false);
        }
        if (get_option(LONGTAIL_KEY . "use_head_js")) {
            wp_enqueue_script('jw-embedder');
        }
    } else {
        if (get_option(LONGTAIL_KEY . "use_head_js")) {
            wp_enqueue_script('swfobject');
        }
    }
    if (!get_option(LONGTAIL_KEY . "uninstalled")) {
        jwplayer_upgrade();
    }
    add_filter("the_content", "jwplayer_tag_callback", 11);
    add_filter("the_excerpt", "jwplayer_tag_excerpt_callback", 11);
    add_filter("widget_text", "jwplayer_tag_widget_callback", 11);
    // Parse the $_GET vars for callbacks
    add_filter('query_vars', 'jwplayer_queryvars');
    add_action('parse_request', 'jwplayer_parse_request', 9);
    add_action("wp_ajax_verify_player", "verify_player");
}
function jwplayer_init()
{
    global $pluginURL;
    clearstatcache();
    if (!@is_dir(JWPLAYER_FILES_DIR)) {
        if (!@mkdir(JWPLAYER_FILES_DIR, 0755, true)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress directory could not be created.  ' . 'Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR, 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/player", 0755)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress/player directory could not be created.  ' . 'Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/player", 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/configs", 0755)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress/configs directory could not be created.  ' . 'Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/configs", 0755);
        if (@is_dir(JWPLAYER_PLUGIN_DIR . "/configs")) {
            foreach (get_old_configs() as $config) {
                @rename(JWPLAYER_PLUGIN_DIR . "/configs/{$config}.xml", JWPLAYER_FILES_DIR . "/configs/{$config}.xml");
            }
        }
    }
    if (!@is_dir(JWPLAYER_FILES_DIR)) {
        add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('Activation of the JW Player Plugin for WordPress could not complete successfully.  The following directories could not be created automatically: </p><ul><li>- ' . JWPLAYER_FILES_DIR . '</li><li>- ' . JWPLAYER_FILES_DIR . '/configs</li><li>- ' . JWPLAYER_FILES_DIR . '/player</li></ul><p>Please ensure these directories are writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
    } else {
        if (!file_exists(LongTailFramework::getPlayerPath())) {
            // Error if the player doesn't exist
            add_action('admin_notices', "jwplayer_install_notices");
        }
    }
    if (file_exists(LongTailFramework::getEmbedderPath())) {
        if (get_option(LONGTAIL_KEY . "player_location_enable")) {
            wp_register_script("jw-embedder", get_option(LONGTAIL_KEY . "player_location") . "jwplayer.js", array(), false);
        } else {
            wp_register_script("jw-embedder", LongTailFramework::getEmbedderURL(), array(), false);
        }
        if (get_option(LONGTAIL_KEY . "use_head_js")) {
            wp_enqueue_script('jw-embedder');
        }
    } else {
        if (get_option(LONGTAIL_KEY . "use_head_js")) {
            wp_enqueue_script('swfobject');
        }
    }
    if (!get_option(LONGTAIL_KEY . "uninstalled")) {
        jwplayer_upgrade();
    }
    add_filter("the_content", "jwplayer_tag_callback", 11);
    add_filter("the_excerpt", "jwplayer_tag_excerpt_callback", 11);
    add_filter("widget_text", "jwplayer_tag_widget_callback", 11);
    // Player configuration and Media Management, limited to administrators.
    if (is_admin()) {
        wp_register_script('jquery-ui-jw', $pluginURL . '/' . plugin_basename(dirname(__FILE__)) . "/js/jquery.ui.jw.js");
    }
    // Parse the $_GET vars for callbacks
    add_filter('query_vars', 'jwplayer_queryvars');
    add_action('parse_request', 'jwplayer_parse_request', 9);
    add_action("wp_ajax_verify_player", "verify_player");
}
Beispiel #3
0
function jwplayer_activation()
{
    clearstatcache();
    if (!@is_dir(JWPLAYER_FILES_DIR)) {
        if (!@mkdir(JWPLAYER_FILES_DIR, 0755, true)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress directory could not be created.  Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR, 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/player", 0755)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress/player directory could not be created.  Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/player", 0755);
        if (!@mkdir(JWPLAYER_FILES_DIR . "/configs", 0755)) {
            add_action('admin_notices', create_function('', 'echo \'<div id="message" class="fade updated"><p><strong>' . __('There was a problem completing activation of the plugin.  The wp-content/uploads/jw-player-plugin-for-wordpress/configs directory could not be created.  Please ensure the WordPress uploads directory is writable.  ' . JW_FILE_PERMISSIONS) . '</strong></p></div>\';'));
            return;
        }
        chmod(JWPLAYER_FILES_DIR . "/configs", 0755);
        if (@is_dir(JWPLAYER_PLUGIN_DIR . "/configs")) {
            foreach (get_old_configs() as $config) {
                @rename(JWPLAYER_PLUGIN_DIR . "/configs/{$config}.xml", JWPLAYER_FILES_DIR . "/configs/{$config}.xml");
            }
        }
    }
}