Determine whether the active plan supports a particular feature
public static active_plan_supports ( $feature ) : boolean | ||
return | boolean | True if plan supports feature, false if not |
/** * Fires on init */ public function on_init() { add_action('wp_enqueue_media', array($this, 'enqueue_admin_scripts')); add_filter('plupload_default_settings', array($this, 'videopress_pluploder_config')); add_filter('wp_get_attachment_url', array($this, 'update_attachment_url_for_videopress'), 10, 2); if (Jetpack::active_plan_supports('videopress')) { add_filter('upload_mimes', array($this, 'add_video_upload_mimes'), 999); } add_action('admin_print_footer_scripts', array($this, 'print_in_footer_open_media_add_new')); add_action('admin_menu', array($this, 'change_add_new_menu_location'), 999); add_action('admin_head', array($this, 'enqueue_admin_styles')); VideoPress_Scheduler::init(); VideoPress_XMLRPC::init(); }
/** * Get VideoPress options */ public static function get_options() { // Make sure we only get options from the database and services once per connection. if (count(self::$options) > 0) { return self::$options; } $defaults = array('meta' => array('max_upload_size' => 0)); self::$options = Jetpack_Options::get_option(self::$option_name, array()); self::$options = array_merge($defaults, self::$options); // Make sure that the shadow blog id never comes from the options, but instead uses the // associated shadow blog id, if videopress is enabled. self::$options['shadow_blog_id'] = 0; // Use the Jetpack ID for the shadow blog ID if we have a plan that supports VideoPress if (Jetpack::active_plan_supports('videopress')) { self::$options['shadow_blog_id'] = Jetpack_Options::get_option('id'); } return self::$options; }
/** * Get a list of activated modules as an array of module slugs. */ public static function get_active_modules() { $active = Jetpack_Options::get_option('active_modules'); if (!is_array($active)) { $active = array(); } if (class_exists('VaultPress') || function_exists('vaultpress_contact_service')) { $active[] = 'vaultpress'; } else { $active = array_diff($active, array('vaultpress')); } // If this plan supports videopress, force activate module if (Jetpack::active_plan_supports('videopress')) { $active[] = 'videopress'; } else { $active = array_diff($active, array('videopress')); } //If protect is active on the main site of a multisite, it should be active on all sites. if (!in_array('protect', $active) && is_multisite() && get_site_option('jetpack_protect_active')) { $active[] = 'protect'; } return array_unique($active); }