{"payload":{"allShortcutsEnabled":false,"fileTree":{"jetpack-dependency-script":{"items":[{"name":"README.md","path":"jetpack-dependency-script/README.md","contentType":"file"},{"name":"plugin-enhancements.js","path":"jetpack-dependency-script/plugin-enhancements.js","contentType":"file"},{"name":"plugin-enhancements.php","path":"jetpack-dependency-script/plugin-enhancements.php","contentType":"file"},{"name":"plugin-enhancements.pot","path":"jetpack-dependency-script/plugin-enhancements.pot","contentType":"file"}],"totalCount":4},"":{"items":[{"name":"getselectors","path":"getselectors","contentType":"directory"},{"name":"gutenberg-stylesheets","path":"gutenberg-stylesheets","contentType":"directory"},{"name":"gutenberg-test-data","path":"gutenberg-test-data","contentType":"directory"},{"name":"gutenberg-tools-misc","path":"gutenberg-tools-misc","contentType":"directory"},{"name":"jetpack-dependency-script","path":"jetpack-dependency-script","contentType":"directory"},{"name":"org-submitter","path":"org-submitter","contentType":"directory"},{"name":"theme-name-changer","path":"theme-name-changer","contentType":"directory"},{"name":"theme-tags","path":"theme-tags","contentType":"directory"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":9}},"fileTreeProcessingTime":12.777844,"foldersToFetch":[],"repo":{"id":43092999,"defaultBranch":"master","name":"theme-tools","ownerLogin":"Automattic","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2015-09-24T21:04:35.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/887802?v=4","public":true,"private":false,"isOrgOwned":true},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"master","listCacheKey":"v0:1594325824.0","canEdit":false,"refType":"branch","currentOid":"3f72f6fab48717bbd9a0fd78c71dde19df3b16bb"},"path":"jetpack-dependency-script/plugin-enhancements.php","currentUser":null,"blob":{"rawLines":["base, array( 'dashboard', 'themes', 'plugins' ) ) ) {","\t\t\treturn;","\t\t}","","\t\t// Get the plugin enhancements information declared by the theme.","\t\t$this->dependencies = $this->get_theme_dependencies();","","\t\t// Return early if we have no plugin dependencies.","\t\tif ( empty( $this->dependencies ) )","\t\t\treturn;","","\t\t// Otherwise, build an array to list all the necessary dependencies and modules.","\t\t$dependency_list = '';","\t\t$this->modules = array();","","\t\t// Create a list of dependencies.","\t\tforeach ( $this->dependencies as $dependency ) :","","\t\t\t// Add to our list of recommended modules.","\t\t\tif ( 'none' !== $dependency['module'] ) :","\t\t\t\t$this->modules[ $dependency['name'] ] = $dependency['module'];","\t\t\tendif;","","\t\t\t// Build human-readable list.","\t\t\t$dependency_list .= $dependency['name'] . ' (' . $this->get_module_name( $dependency['module'] ) . '), ';","\t\tendforeach;","","\t\t// Define our Jetpack plugin as a necessary plugin.","\t\t$this->plugins = array(","\t\t\tarray(","\t\t\t\t'slug' => 'jetpack',","\t\t\t\t'name' => 'Jetpack by WordPress.com',","\t\t\t\t'message' => sprintf(","\t\t\t\t\tesc_html__( 'The %1$s is necessary to use some of this theme’s features, including: ', 'textdomain' ),","\t\t\t\t\t'' . esc_html__( 'Jetpack plugin', 'textdomain' ) . '' ),","\t\t\t\t'modules' => rtrim( $dependency_list, ', ' ) . '.',","\t\t\t),","\t\t);","","\t\t// Set the status of each of these enhancements and determine if a notice is necessary.","\t\t$this->set_plugin_status();","\t\t$this->set_module_status();","","\t\t// Output the corresponding notices in the admin.","\t\tif ( $this->display_notice && current_user_can( 'install_plugins' ) ) {","\t\t\tadd_action( 'admin_notices', array( $this, 'admin_notices' ) );","\t\t}","\t}","","\t/**","\t * Let's see which modules (if any!) this theme relies on.","\t */","\tfunction get_theme_dependencies() {","\t\t$dependencies = array();","","\t\tif ( current_theme_supports( 'site-logo' ) ) :","\t\t\t$dependencies['logo'] = array(","\t\t\t\t'name' => esc_html__( 'Site Logo', 'textdomain' ),","\t\t\t\t'slug' => 'site-logo',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'none',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'featured-content' ) ) :","\t\t\t$dependencies['featured-content'] = array(","\t\t\t\t'name' => esc_html__( 'Featured Content', 'textdomain' ),","\t\t\t\t'slug' => 'featured-content',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'none',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'jetpack-social-menu' ) ) :","\t\t\t$dependencies['social-menu'] = array(","\t\t\t\t'name' => esc_html__( 'Social Menu', 'textdomain' ),","\t\t\t\t'slug' => 'jetpack-social-menu',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'none',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'nova_menu_item' ) ) :","\t\t\t$dependencies['menus'] = array(","\t\t\t\t'name' => esc_html__( 'Menus', 'textdomain' ),","\t\t\t\t'slug' => 'nova_menu_item',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'custom-content-types',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'jetpack-comic' ) ) :","\t\t\t$dependencies['comics'] = array(","\t\t\t\t'name' => esc_html__( 'Comics', 'textdomain' ),","\t\t\t\t'slug' => 'jetpack-comic',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'custom-content-types',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'jetpack-testimonial' ) ) :","\t\t\t$dependencies['testimonials'] = array(","\t\t\t\t'name' => esc_html__( 'Testimonials', 'textdomain' ),","\t\t\t\t'slug' => 'jetpack-testimonial',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'custom-content-types',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'jetpack-portfolio' ) ) :","\t\t\t$dependencies['portfolios'] = array(","\t\t\t\t'name' => esc_html__( 'Portfolios', 'textdomain' ),","\t\t\t\t'slug' => 'jetpack-portfolio',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'custom-content-types',","\t\t\t);","\t\tendif;","","\t\tif ( current_theme_supports( 'jetpack-content-options' ) ) :","\t\t\t$dependencies['content-options'] = array(","\t\t\t\t'name' => esc_html__( 'Content Options', 'textdomain' ),","\t\t\t\t'slug' => 'jetpack-content-options',","\t\t\t\t'url' => '',","\t\t\t\t'module' => 'none',","\t\t\t);","\t\tendif;","","\t\treturn $dependencies;","\t}","","\t/**","\t * Set the name of our modules. This is just so we can easily refer to them in","\t * a nice, consistent, human-readable way.","\t *","\t * @param string $module The slug of the Jetpack module in question.","\t */","\tfunction get_module_name( $module ) {","\t\t$module_names = array(","\t\t\t'none' => esc_html__( 'no specific module needed', 'textdomain' ),","\t\t\t'custom-content-types' => esc_html__( 'Custom Content Types module', 'textdomain' ),","\t\t);","\t\treturn $module_names[ $module ];","\t}","","\t/**","\t * Determine the status of each of the plugins declared as a dependency","\t * by the theme and whether an admin notice is necessary or not.","\t */","\tfunction set_plugin_status() {","\t\t// Get the names of the installed plugins.","\t\t$installed_plugin_names = wp_list_pluck( get_plugins(), 'Name' );","","\t\tforeach ( $this->plugins as $key => $plugin ) {","","\t\t\t// Determine whether a plugin is installed.","\t\t\tif ( in_array( $plugin['name'], $installed_plugin_names ) ) {","","\t\t\t\t// Determine whether the plugin is active. If yes, remove if from","\t\t\t\t// the array containing the plugin enhancements.","\t\t\t\tif ( is_plugin_active( array_search( $plugin['name'], $installed_plugin_names ) ) ) {","\t\t\t\t\tunset( $this->plugins[ $key ] );","\t\t\t\t} // Set the plugin status as to-activate.","\t\t\t\telse {","\t\t\t\t\t$this->plugins[ $key ]['status'] = 'to-activate';","\t\t\t\t\t$this->display_notice = true;","\t\t\t\t}","","\t\t\t\t// Set the plugin status as to-install.","\t\t\t} else {","\t\t\t\t$this->plugins[ $key ]['status'] = 'to-install';","\t\t\t\t$this->display_notice = true;","\t\t\t}","\t\t}","\t}","","\t/**","\t * For Jetpack modules, we want to check and see if those modules are actually activated.","\t */","\tfunction set_module_status() {","\t\t$this->unactivated_modules = array();","\t\t// Loop through each module to check if it's active.","\t\tforeach ( $this->modules as $feature => $module ) :","\t\t\tif ( class_exists( 'Jetpack' ) && ! Jetpack::is_module_active( $module ) ) :","\t\t\t\t// Add this feature to our array.","\t\t\t\t$this->unactivated_modules[ $module ][] = $feature;","\t\t\t\t$this->display_notice = true;","","\t\t\tendif;","\t\tendforeach;","","\t}","\t/**","\t * Display the admin notice for the plugin enhancements.","\t */","\tfunction admin_notices() {","\t\t// Bail if the user has previously dismissed the notice (doesn't show the notice)","\t\tif ( get_user_meta( get_current_user_id(), 'textdomain_jetpack_admin_notice', true ) === 'dismissed' ) {","\t\t\treturn;","\t\t}","","\t\t$notice = '';","","\t\t// Loop through the plugins and print the message and the download or active links.","\t\tforeach ( $this->plugins as $key => $plugin ) {","\t\t\t$notice .= '
';","","\t\t\t// Custom message provided by the theme.","\t\t\tif ( isset( $plugin['message'] ) ) {","\t\t\t\t$notice .= $plugin['message'];","\t\t\t\t$notice .= esc_html( $plugin['modules'] );","\t\t\t}","","\t\t\t// Activation message.","\t\t\tif ( 'to-activate' === $plugin['status'] ) {","\t\t\t\t$activate_url = $this->plugin_activate_url( $plugin['slug'] );","\t\t\t\t$notice .= sprintf(","\t\t\t\t\tesc_html__( ' Please activate %1$s. %2$s', 'textdomain' ),","\t\t\t\t\tesc_html( $plugin['name'] ),","\t\t\t\t\t( $activate_url ) ? '' . esc_html__( 'Activate', 'textdomain' ) . '' : ''","\t\t\t\t);","\t\t\t}","","\t\t\t// Download message.","\t\t\tif ( 'to-install' === $plugin['status'] ) {","\t\t\t\t$install_url = $this->plugin_install_url( $plugin['slug'] );","\t\t\t\t$notice .= sprintf(","\t\t\t\t\tesc_html__( ' Please install %1$s. %2$s', 'textdomain' ),","\t\t\t\t\tesc_html( $plugin['name'] ),","\t\t\t\t\t( $install_url ) ? '' . esc_html__( 'Install', 'textdomain' ) . '' : ''","\t\t\t\t);","\t\t\t}","","\t\t\t$notice .= '
';","\t\t}","","\t\t// Output a notice if we're missing a module.","\t\tforeach ( $this->unactivated_modules as $module => $features ) :","\t\t\t$featurelist = array();","\t\t\tforeach ( $features as $feature ) {","\t\t\t\t$featurelist[] = $feature;","\t\t\t}","","\t\t\tif ( 2 === count( $featurelist) ) {","\t\t\t\t$featurelist = implode( ' or ', $featurelist );","\t\t\t} elseif ( 1 < count( $featurelist ) ) {","\t\t\t\t$last_feature = array_pop( $featurelist );","\t\t\t\t$featurelist = implode( ', ', $featurelist ) . ', or ' . $last_feature;","\t\t\t} else {","\t\t\t\t$featurelist = implode( ', ', $featurelist );","\t\t\t}","","\t\t\t$notice .= '';","\t\t\t$notice .= sprintf(","\t\t\t\tesc_html__( 'To use %1$s, please activate the Jetpack plugin’s %2$s.', 'textdomain' ),","\t\t\t\tesc_html( $featurelist ),","\t\t\t\t'' . esc_html( $this->get_module_name( $module ) ) . ''","\t\t\t);","\t\t\t$notice .= '
';","\t\tendforeach;","","\t\t// Output notice HTML.","\t\t$allowed = array(","\t\t\t'p' => array(),","\t\t\t'strong' => array(),","\t\t\t'em' => array(),","\t\t\t'b' => array(),","\t\t\t'i' => array(),","\t\t\t'a' => array( 'href' => array() ),","\t\t);","\t\tprintf(","\t\t\t'