ngs(), 'utmSettings' => $settings->get_utm_settings(), 'socialNotes' => array( 'enabled' => $settings->is_social_notes_enabled(), 'config' => $settings->get_social_notes_config(), ), 'showPricingPage' => $settings->should_show_pricing_page(), 'messageTemplate' => $settings->get_message_template(), ); } /** * Get the plugin info. * * @return array */ public static function get_plugin_info() { $social_version = null; $jetpack_version = null; if ( defined( 'JETPACK_SOCIAL_PLUGIN_ROOT_FILE' ) ) { $plugin_data = get_plugin_data( (string) constant( 'JETPACK_SOCIAL_PLUGIN_ROOT_FILE' ), false, false ); $social_version = $plugin_data['Version']; } if ( defined( 'JETPACK__VERSION' ) ) { $jetpack_version = constant( 'JETPACK__VERSION' ); } return array( 'social' => array( 'version' => $social_version, ), 'jetpack' => array( 'version' => $jetpack_version, ), ); } /** * Get the social store initial state. * * @return array */ public static function get_store_initial_state() { $post = get_post(); $share_status = array(); // get_post_share_status is not available on WPCOM yet. if ( Utils::should_block_editor_have_social() && $post ) { $share_status[ $post->ID ] = Share_Status::get_post_share_status( $post->ID ); } return array( 'connectionData' => array( 'connections' => Connections::get_all_for_user(), ), 'shareStatus' => $share_status, ); } /** * Whether the site has the feature flag enabled. * * @deprecated 0.69.1 Use Current_Plan::supports() directly instead. * * @todo Remove this method After March 2026. * * @param string $feature The feature name to check for, without the "social-" prefix. * @return bool */ public static function has_feature_flag( $feature ): bool { return Current_Plan::supports( 'social-' . $feature ); } /** * Get the list of supported Publicize services. * * @return array List of external services and their settings. */ public static function get_supported_services() { return Publicize_Services::get_all(); } /** * Get the API paths. * * @return array */ public static function get_api_paths() { return array( // The complete path will be like `/jetpack/v4/social/settings`. 'socialToggleBase' => Utils::should_use_jetpack_module_endpoint() ? 'settings' : 'social/settings', 'resharePost' => '/wpcom/v2/publicize/share-post/{postId}', ); } /** * Get the URLs. * * @return array */ public static function get_urls() { $urls = array( 'connectionsManagementPage' => self::publicize()->publicize_connections_url(), ); // Escape the URLs. array_walk( $urls, 'esc_url_raw' ); return $urls; } /** * Get nonces required by the Social admin UI. * * @return array */ private static function get_nonces() { return array( 'refresh_plan' => wp_create_nonce( Social_Admin_Page::REFRESH_PLAN_NONCE_ACTION ), ); } }