Exemplo n.º 1
0
 /**
  * Used to check whether SEO tools are enabled for given site.
  *
  * @param int $site_id Optional. Defaults to current blog id if not given.
  *
  * @return bool True if SEO tools are enabled, false otherwise.
  */
 public static function is_enabled_jetpack_seo($site_id = 0)
 {
     if (function_exists('has_blog_sticker')) {
         // For WPCOM sites
         if (empty($site_id)) {
             $site_id = get_current_blog_id();
         }
         return has_blog_sticker('unlimited-premium-themes', $site_id);
     }
     // For all Jetpack sites
     return true;
 }
Exemplo n.º 2
0
function comics_welcome_email( $welcome_email, $blog_id, $user_id, $password, $title, $meta ) {
	if ( ( isset( $meta['vertical'] ) && 'comics' == $meta['vertical'] ) || has_blog_sticker( 'vertical-comics', $blog_id ) ) {
		return __( "Welcome! Ready to publish your first strip?

Your webcomic's new site is ready to go. Get started by <a href=\"BLOG_URLwp-admin/customize.php#title\">setting your comic's title and tagline</a> so your readers know what it's all about.

Looking for more help with setting up your site? Check out the WordPress.com <a href=\"http://learn.wordpress.com/\">beginner's tutorial</a> and the <a href=\"http://en.support.wordpress.com/comics/\">guide to comics on WordPress.com</a>. Dive right in by <a href=\"BLOG_URLwp-admin/customize.php#title\">publishing your first strip!</a>

Lots of laughs,
The WordPress.com Team", 'jetpack' );
	}

	return $welcome_email;
}
 /**
  * Includes any active plugin files that are enabled via the UI/option.
  */
 public function include_active_plugins()
 {
     foreach ($this->get_active_plugins_option() as $plugin) {
         if (has_blog_sticker('vip-plugins-ui-rc-plugins')) {
             wpcom_vip_load_plugin($plugin, 'plugins', true);
         } else {
             wpcom_vip_load_plugin($plugin);
         }
     }
 }
/**
 * Loads a plugin out of our shared plugins directory.
 *
 * @link http://lobby.vip.wordpress.com/plugins/ VIP Shared Plugins
 * @param string $plugin Optional. Plugin folder name (and filename) of the plugin
 * @param string $folder Optional. Folder to include from; defaults to "plugins". Useful for when you have multiple themes and your own shared plugins folder.
 * @return bool True if the include was successful
 */
function wpcom_vip_load_plugin($plugin = false, $folder = 'plugins', $load_release_candidate = false)
{
    // Force release candidate loading if the site has the correct sticker
    if (defined('WPCOM_IS_VIP_ENV') && true === WPCOM_IS_VIP_ENV && has_blog_sticker('vip-plugins-ui-rc-plugins')) {
        $load_release_candidate = true;
    }
    // Make sure there's a plugin to load
    if (empty($plugin)) {
        // On WordPress.com, use an internal function to message VIP about a bad call to this function
        if (function_exists('wpcom_is_vip')) {
            if (function_exists('send_vip_team_debug_message')) {
                // Use an expiring cache value to avoid spamming messages
                if (!wp_cache_get('noplugin', 'wpcom_vip_load_plugin')) {
                    send_vip_team_debug_message('WARNING: wpcom_vip_load_plugin() is being called without a $plugin parameter', 1);
                    wp_cache_set('noplugin', 1, 'wpcom_vip_load_plugin', 3600);
                }
            }
            return false;
        } else {
            die('wpcom_vip_load_plugin() was called without a first parameter!');
        }
    }
    // Make sure $plugin and $folder are valid
    $plugin = _wpcom_vip_load_plugin_sanitizer($plugin);
    if ('plugins' !== $folder) {
        $folder = _wpcom_vip_load_plugin_sanitizer($folder);
    }
    // Shared plugins are located at /wp-content/themes/vip/plugins/example-plugin/
    // You should keep your local copies of the plugins in the same location
    $includepath = WP_CONTENT_DIR . "/themes/vip/{$folder}/{$plugin}/{$plugin}.php";
    $release_candidate_includepath = WP_CONTENT_DIR . "/themes/vip/{$folder}/release-candidates/{$plugin}/{$plugin}.php";
    if (true === $load_release_candidate && file_exists($release_candidate_includepath)) {
        $includepath = $release_candidate_includepath;
    }
    if (file_exists($includepath)) {
        wpcom_vip_add_loaded_plugin("{$folder}/{$plugin}");
        // Since we're going to be include()'ing inside of a function,
        // we need to do some hackery to get the variable scope we want.
        // See http://www.php.net/manual/en/language.variables.scope.php#91982
        // Start by marking down the currently defined variables (so we can exclude them later)
        $pre_include_variables = get_defined_vars();
        // Now include
        include_once $includepath;
        // If there's a wpcom-helper file for the plugin, load that too
        $helper_path = WP_CONTENT_DIR . "/themes/vip/{$folder}/{$plugin}/wpcom-helper.php";
        if (file_exists($helper_path)) {
            require_once $helper_path;
        }
        // Blacklist out some variables
        $blacklist = array('blacklist' => 0, 'pre_include_variables' => 0, 'new_variables' => 0);
        // Let's find out what's new by comparing the current variables to the previous ones
        $new_variables = array_diff_key(get_defined_vars(), $GLOBALS, $blacklist, $pre_include_variables);
        // global each new variable
        foreach ($new_variables as $new_variable => $devnull) {
            global ${$new_variable};
        }
        // Set the values again on those new globals
        extract($new_variables);
        return true;
    } else {
        // On WordPress.com, use an internal function to message VIP about the bad call to this function
        if (function_exists('wpcom_is_vip')) {
            if (function_exists('send_vip_team_debug_message')) {
                // Use an expiring cache value to avoid spamming messages
                $cachekey = md5($folder . '|' . $plugin);
                if (!wp_cache_get("notfound_{$cachekey}", 'wpcom_vip_load_plugin')) {
                    send_vip_team_debug_message("WARNING: wpcom_vip_load_plugin() is trying to load a non-existent file ( /{$folder}/{$plugin}/{$plugin}.php )", 1);
                    wp_cache_set("notfound_{$cachekey}", 1, 'wpcom_vip_load_plugin', 3600);
                }
            }
            return false;
            // die() in non-WordPress.com environments so you know you made a mistake
        } else {
            die("Unable to load {$plugin} ({$folder}) using wpcom_vip_load_plugin()!");
        }
    }
}
Exemplo n.º 5
0
/**
 * Whether or not to enable pjax loading of and navigation for comics.
 * This can result in fewer ad views, so users can disable it here.
 */
function panel_enable_pjax()
{
    $enabled = true;
    // Let self-hosted .org installs disable it if they like.
    if (defined('PANEL_DISABLE_PJAX') && PANEL_DISABLE_PJAX) {
        $enabled = false;
    }
    // If we're on WordPress.com, and the user gets ad revenue, turn this off.
    if (function_exists('has_blog_sticker') && has_blog_sticker('wordads')) {
        $enabled = false;
    }
    return apply_filters('panel_enable_pjax', $enabled);
}