/**
  * Enqueue small JS to disable blog_public checkbox on admin
  *
  * @action admin_enqueue_scripts
  *
  * @param string $hook
  */
 public function admin_enqueue_scripts($hook)
 {
     if ('options-reading.php' !== $hook) {
         return;
     }
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_script('gd_system_option_reading_temp_domain_js', GD_SYSTEM_PLUGIN_URL . "gd-system-plugin/js/option-reading-temp-domain{$suffix}.js", ['jquery']);
     if (gd_is_staging_site()) {
         $description = __('This setting is required on staging sites.', 'gd_system');
     } else {
         $description = __('This setting is required on temporary domains.', 'gd_system');
     }
     wp_localize_script('gd_system_option_reading_temp_domain_js', 'gd_system_option_reading_temp_domain_vars', ['description_blog_public' => esc_js($description)]);
 }
 /**
  * Enqueue small JS to disable blog_public checkbox on admin
  *
  * @action admin_enqueue_scripts
  *
  * @param string $hook
  */
 public function admin_enqueue_scripts($hook)
 {
     if ('options-reading.php' !== $hook) {
         return;
     }
     $suffix = SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_script('gd_system_option_reading_temp_domain_js', GD_SYSTEM_PLUGIN_URL . "gd-system-plugin/js/option-reading-temp-domain{$suffix}.js", ['jquery']);
     if (gd_is_staging_site()) {
         $notice = sprintf(__('%s This is your staging site and it cannot be indexed by search engines.', 'gd_system'), sprintf('<strong>%s</strong>', __('Note:', 'gd_system')));
     } else {
         $notice = sprintf(__('%s Your site is using a temporary domain that cannot be indexed by search engines.', 'gd_system'), sprintf('<strong>%s</strong>', __('Note:', 'gd_system')));
     }
     wp_localize_script('gd_system_option_reading_temp_domain_js', 'gd_system_option_reading_temp_domain_vars', ['blog_public_notice_text' => esc_js($notice)]);
 }
 /**
  * Constructor.
  * Hook any needed actions/filters
  */
 public function __construct()
 {
     // Enable sampling for WP Popular Posts, this makes it perform much better especially on high traffic sites
     add_filter('wpp_data_sampling', '__return_true');
     // Clean up limit login attempts
     $flag = mt_rand(0, 50) == 47;
     if (apply_filters('gd_system_clean_limit_login_attempts', $flag)) {
         add_action('muplugins_loaded', [$this, 'clean_limit_login_attempts']);
     }
     // Prevent jetpack from validating siteurl and home option on staging
     if (gd_is_staging_site()) {
         add_filter('jetpack_has_identity_crisis', '__return_false');
     }
     add_filter('option_jetpack_options', [$this, 'remove_jetpack_nag']);
 }
Ejemplo n.º 4
0
/**
 * Check if we are on a temporary domain
 */
function gd_is_temp_domain()
{
    if (gd_is_staging_site()) {
        return true;
    }
    global $gd_system_config;
    if (empty($gd_system_config) || $gd_system_config->missing_gd_config) {
        return false;
    }
    $config = $gd_system_config->get_config();
    if (!isset($config['cname_domains']) || !is_array($config['cname_domains'])) {
        return false;
    }
    foreach ($config['cname_domains'] as $domain) {
        if (0 === strcasecmp(substr($_SERVER['HTTP_HOST'], 0 - strlen($domain)), $domain)) {
            return true;
        }
    }
    return false;
}