$some_users = $wpdb->get_var( "SELECT COUNT(*) FROM (SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '{$wpdb->prefix}capabilities' LIMIT 2) AS someusers" );
// Throw up a notice if using a development version and as for feedback.
if ( self::is_development_version() ) {
/* translators: %s is a URL */
$notice = sprintf( __( 'You are currently running a development version of Jetpack. <a href="%s" target="_blank">Submit your feedback</a>', 'jetpack' ), Redirect::get_url( 'jetpack-contact-support-beta-group' ) );
* The dynamic part of the hook, $module, is the module slug.
*
* @since 1.1.0
*/
do_action( 'jetpack_module_loaded_' . $module );
}
/**
* Fires when all the modules are loaded.
*
* @since 1.1.0
*/
do_action( 'jetpack_modules_loaded' );
// Load module-specific code that is needed even when a module isn't active. Loaded here because code contained therein may need actions such as setup_theme.
trigger_error( sprintf( __( 'Jetpack contains the most recent version of the old “%1$s” plugin.', 'jetpack' ), 'WordPress.com Stats' ), E_USER_ERROR );
function intercept_plugin_error_scrape( $action, $result ) {
if ( ! $result ) {
return;
}
foreach ( $this->plugins_to_deactivate as $deactivate_me ) {
if ( "plugin-activation-error_{$deactivate_me[0]}" == $action ) {
self::bail_on_activation( sprintf( __( 'Jetpack contains the most recent version of the old “%1$s” plugin.', 'jetpack' ), $deactivate_me[1] ), false );
}
}
}
/**
* Register the remote file upload request handlers, if needed.
*
* @access public
*/
public function add_remote_request_handlers() {
// Remote file uploads are allowed only via AJAX requests.
'<p>' . __( 'Jetpack supercharges your self-hosted WordPress site with the awesome cloud power of WordPress.com.', 'jetpack' ) . '</p>' .
'<p>' . __( 'On this page, you are able to view the modules available within Jetpack, learn more about them, and activate or deactivate them as needed.', 'jetpack' ) . '</p>',
'<p>' . __( 'You can activate or deactivate individual Jetpack modules to suit your needs.', 'jetpack' ) . '</p>' .
'<ol>' .
'<li>' . __( 'Each module has an Activate or Deactivate link so you can toggle one individually.', 'jetpack' ) . '</li>' .
'<li>' . __( 'Using the checkboxes next to each module, you can select multiple modules to toggle via the Bulk Actions menu at the top of the list.', 'jetpack' ) . '</li>' .
'</ol>' .
'<p>' . __( 'Using the tools on the right, you can search for specific modules, filter by module categories or which are active, or change the sorting order.', 'jetpack' ) . '</p>',
_doing_it_wrong( __METHOD__, 'The `page=jetpack&action=authorize` webhook is deprecated. Use `handler=jetpack-connection-webhooks&action=authorize` instead', 'Jetpack 9.5.0' );
( new Connection_Webhooks( $this->connection_manager ) )->handle_authorize();
// translators: %s is the URL to the "Sites" panel on wordpress.com.
$this->message = '<strong>' . sprintf( __( 'You are all set! Your site can now be managed from <a href="%s" target="_blank">wordpress.com/sites</a>.', 'jetpack' ), $sites_url ) . '</strong>';
if ( $activated_manage ) {
$this->message .= '<br /><strong>' . __( 'Manage has been activated for you!', 'jetpack' ) . '</strong>';
// If there was previously activated modules (a reconnection), re-activate them all including those that require a user, and do not re-activate those that have been deactivated.
<h2><?php _e( 'Outbound HTTPS not working', 'jetpack' ); ?></h2>
<p><?php _e( 'Your site could not connect to WordPress.com via HTTPS. This could be due to any number of reasons, including faulty SSL certificates, misconfigured or missing SSL libraries, or network issues.', 'jetpack' ); ?></p>
<p>
<?php _e( 'Jetpack will re-test for HTTPS support once a day, but you can click here to try again immediately: ', 'jetpack' ); ?>
$token = ( new Tokens() )->get_access_token( $env_user_id, $env_token );
if ( ! $token || empty( $token->secret ) ) {
wp_die( __( 'You must connect your Jetpack plugin to WordPress.com to use this feature.', 'jetpack' ) );
}
$die_error = __( 'Someone may be trying to trick you into giving them access to your site. Or it could be you just encountered a bug :). Either way, please close this window.', 'jetpack' );
// Host has encoded the request URL, probably as a result of a bad http => https redirect
if ( self::is_redirect_encoded( $_GET['redirect_to'] ) ) {
__( 'Your site is incorrectly double-encoding redirects from http to https. This is preventing Jetpack from authenticating your connection. Please visit our <a href="%s">support page</a> for details about how to resolve this.', 'jetpack' ),
// Default modules that don't require a user were already activated on site_register.
// This time let's activate only those that require a user, this assures we don't reactivate manually deactivated modules while the site was connected only at a site level.
if ( ! self::is_active() || ( new Status() )->is_offline_mode() ) {
return false;
}
return true;
}
/**
* Checks if a Jetpack site is both active and not in offline mode.
*
* This is a DRY function to avoid repeating `Jetpack::is_connection_ready && ! Automattic\Jetpack\Status->is_offline_mode`.
*
* @since 8.8.0
*
* @return bool True if Jetpack is active and not in offline mode.
*/
public static function is_active_and_not_offline_mode() {
if ( ! self::is_connection_ready() || ( new Status() )->is_offline_mode() ) {
return false;
}
return true;
}
/**
* Returns the list of products that we have available for purchase.
*/
public static function get_products_for_purchase() {
$products = array();
if ( ! is_multisite() ) {
$products[] = array(
'key' => 'backup',
'title' => __( 'Jetpack Backup', 'jetpack' ),
'short_description' => __( 'Always-on backups ensure you never lose your site.', 'jetpack' ),
'learn_more' => __( 'Which backup option is best for me?', 'jetpack' ),
'description' => __( 'Always-on backups ensure you never lose your site. Your changes are saved as you edit and you have unlimited backup archives.', 'jetpack' ),
'options_label' => __( 'Select a backup option:', 'jetpack' ),
'options' => array(
array(
'type' => 'daily',
'slug' => 'jetpack-backup-daily',
'key' => 'jetpack_backup_daily',
'name' => __( 'Daily Backups', 'jetpack' ),
'description' => __( 'Your data is being securely backed up daily.', 'jetpack' ),
),
array(
'type' => 'realtime',
'slug' => 'jetpack-backup-realtime',
'key' => 'jetpack_backup_realtime',
'name' => __( 'Real-Time Backups', 'jetpack' ),
'description' => __( 'Your data is being securely backed up as you edit.', 'jetpack' ),
'short_description' => __( 'Incredibly powerful and customizable, Jetpack Search helps your visitors instantly find the right content – right when they need it.', 'jetpack' ),
'learn_more' => __( 'Learn More', 'jetpack' ),
'description' => __( 'Incredibly powerful and customizable, Jetpack Search helps your visitors instantly find the right content – right when they need it.', 'jetpack' ),
'label_popup' => __( 'Records are all posts, pages, custom post types, and other types of content indexed by Jetpack Search.', 'jetpack' ),
'options' => array(
array(
'type' => 'search',
'slug' => 'jetpack-search',
'key' => 'jetpack_search',
'name' => __( 'Search', 'jetpack' ),
),
),
'tears' => array(),
'default_option' => 'search',
'show_promotion' => false,
'included_in_plans' => array( 'search-plan' ),
);
$products[] = array(
'key' => 'anti-spam',
'title' => __( 'Jetpack Anti-Spam', 'jetpack' ),
'short_description' => __( 'Automatically clear spam from comments and forms. Save time, get more responses, give your visitors a better experience – all without lifting a finger.', 'jetpack' ),
'learn_more' => __( 'Learn More', 'jetpack' ),
'description' => __( 'Automatically clear spam from comments and forms. Save time, get more responses, give your visitors a better experience – all without lifting a finger.', 'jetpack' ),