settings() {
$settings = ( new Settings() );
return array(
'socialImageGenerator' => $settings->get_image_generator_settings(),
'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(),
);
}
/**
* 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 && self::has_feature_flag( 'share-status' ) ) {
$share_status[ $post->ID ] = self::publicize()->get_post_share_status( $post->ID );
}
$should_have_connections = self::has_feature_flag( 'connections-management' ) || self::has_feature_flag( 'editor-preview' );
return array(
'connectionData' => array(
'connections' => $should_have_connections ? Connections::get_all_for_user() : array(),
),
'shareStatus' => $share_status,
);
}
/**
* Get the feature flags.
*
* @return array
*/
public static function get_feature_flags() {
$variable_to_feature_map = array(
'useAdminUiV1' => 'connections-management',
'useEditorPreview' => 'editor-preview',
'useShareStatus' => 'share-status',
);
$feature_flags = array();
foreach ( $variable_to_feature_map as $variable => $feature ) {
$feature_flags[ $variable ] = self::has_feature_flag( $feature );
}
return $feature_flags;
}
/**
* Whether the site has the feature flag enabled.
*
* @param string $feature The feature name to check for, without the "social-" prefix.
* @return bool
*/
public static function has_feature_flag( $feature ): bool {
$flag_name = str_replace( '-', '_', $feature );
// If the option is set, use it.
if ( get_option( 'jetpack_social_has_' . $flag_name, false ) ) {
return true;
}
$constant_name = 'JETPACK_SOCIAL_HAS_' . strtoupper( $flag_name );
// If the constant is set, use it.
if ( defined( $constant_name ) && constant( $constant_name ) ) {
return true;
}
return Current_Plan::supports( 'social-' . $feature );
}
/**
* Get the shares data.
*
* @return ?array
*/
public static function get_shares_data() {
return self::publicize()->get_publicize_shares_info( Jetpack_Options::get_option( 'id' ) ) ?? array();
}
/**
* Get the list of supported Publicize services.
*
* @return array List of external services and their settings.
*/
public static function get_supported_services() {
/**
* Disable caching for now to avoid nonce errors
* for secondary users trying to connect an account
*
* @link https://github.com/Automattic/jetpack/pull/41149
*/
return Publicize_Services::get_all( true /* Ignore cache */ );
}
/**
* Get the API paths.
*
* @return array
*/
public static function get_api_paths() {
$is_wpcom = ( new Host() )->is_wpcom_platform();
$commom_paths = array(
'refreshConnections' => '/wpcom/v2/publicize/connections?test_connections=1',
// The complete path will be like `/jetpack/v4/social/settings`.
'socialToggleBase' => class_exists( 'Jetpack' ) ? 'settings' : 'social/settings',
);
$specific_paths = array();
if ( $is_wpcom ) {
$specific_paths = array(
'resharePost' => '/wpcom/v2/posts/{postId}/publicize',
);
} else {
$specific_paths = array(
'resharePost' => '/jetpack/v4/publicize/{postId}',
);
}
return array_merge( $commom_paths, $specific_paths );
}
/**
* Get the URLs.
*
* @return array
*/
public static function get_urls() {
$urls = array(
'connectionsManagementPage' => self::publicize()->publicize_connections_url(
'jetpack-social-connections-admin-page'
),
);
// Escape the URLs.
array_walk( $urls, 'esc_url_raw' );
return $urls;
}
}
Fatal error: Uncaught Error: Class 'Automattic\Jetpack\Publicize\Publicize_Script_Data' not found in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-publicize/src/class-publicize-assets.php:19
Stack trace:
#0 /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-publicize/src/class-publicize-setup.php(39): Automattic\Jetpack\Publicize\Publicize_Assets::configure()
#1 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Publicize\Publicize_Setup::pre_initialization('')
#2 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /var/www/html/dportilho.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /var/www/html/dportilho.com.br/web/wp-settings.php(559): do_action('plugins_loaded')
#5 /var/www/html/dportilho.com.br/web/wp-config.php(126): require_once('/var/www/html/d...')
#6 /var/www/html/dportilho.com.br/web/wp-load.php(50) in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-publicize/src/class-publicize-assets.php on line 19