summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php')
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php50
1 files changed, 47 insertions, 3 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php
index 02de16cd..b007c695 100644
--- a/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-functions.php
@@ -9,6 +9,7 @@ namespace Automattic\Jetpack\Sync;
use Automattic\Jetpack\Connection\Urls;
use Automattic\Jetpack\Constants;
+use Automattic\Jetpack\Modules as Jetpack_Modules;
/**
* Utility functions to generate data synced to wpcom
@@ -72,7 +73,7 @@ class Functions {
$cloned_taxonomy = json_decode( wp_json_encode( $taxonomy ) );
// recursive taxonomies are no fun.
- if ( is_null( $cloned_taxonomy ) ) {
+ if ( $cloned_taxonomy === null ) {
return null;
}
// Remove any meta_box_cb if they are not the default wp ones.
@@ -82,7 +83,7 @@ class Functions {
}
// Remove update call back.
if ( isset( $cloned_taxonomy->update_count_callback ) &&
- ! is_null( $cloned_taxonomy->update_count_callback ) ) {
+ $cloned_taxonomy->update_count_callback !== null ) {
$cloned_taxonomy->update_count_callback = null;
}
// Remove rest_controller_class if it something other then the default.
@@ -466,7 +467,7 @@ class Functions {
}
$plugins_action_links = get_option( 'jetpack_plugin_api_action_links', array() );
if ( ! empty( $plugins_action_links ) ) {
- if ( is_null( $plugin_file_singular ) ) {
+ if ( $plugin_file_singular === null ) {
return $plugins_action_links;
}
return ( isset( $plugins_action_links[ $plugin_file_singular ] ) ? $plugins_action_links[ $plugin_file_singular ] : null );
@@ -628,4 +629,47 @@ class Functions {
return $any;
}
+
+ /**
+ * Return the list of installed themes
+ *
+ * @since 1.31.0
+ *
+ * @return array
+ */
+ public static function get_themes() {
+ $current_stylesheet = get_stylesheet();
+ $installed_themes = wp_get_themes();
+ $synced_headers = array( 'Name', 'ThemeURI', 'Author', 'Version', 'Template', 'Status', 'TextDomain', 'RequiresWP', 'RequiresPHP' );
+ $themes = array();
+ foreach ( $installed_themes as $stylesheet => $theme ) {
+ $themes[ $stylesheet ] = array();
+ foreach ( $synced_headers as $header ) {
+ $themes[ $stylesheet ][ $header ] = $theme->get( $header );
+ }
+ $themes[ $stylesheet ]['active'] = $stylesheet === $current_stylesheet;
+ if ( method_exists( $theme, 'is_block_theme' ) ) {
+ $themes[ $stylesheet ]['is_block_theme'] = $theme->is_block_theme();
+ }
+ }
+ /**
+ * Filters the output of Sync's get_theme callable
+ *
+ * @since 1.31.0
+ *
+ * @param array $themes The list of installed themes formatted in an array with a collection of information extracted from the Theme's headers
+ */
+ return apply_filters( 'jetpack_sync_get_themes_callable', $themes );
+ }
+
+ /**
+ * Return the list of active Jetpack modules.
+ *
+ * @since $$next_version$$
+ *
+ * @return array
+ */
+ public static function get_active_modules() {
+ return ( new Jetpack_Modules() )->get_active();
+ }
}