/**
  * Checks if addins in wp-content is available and correct version.
  *
  * @param unknown $config
  * @param Util_Environment_Exceptions $exs
  */
 private function create_required_files($config, $exs)
 {
     $src = W3TC_INSTALL_FILE_ADVANCED_CACHE;
     $dst = W3TC_ADDIN_FILE_ADVANCED_CACHE;
     if ($this->advanced_cache_installed()) {
         if ($this->is_advanced_cache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_pgcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->advanced_cache_check_old_add_in()) {
                     $remove_url = Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_default_remove_add_in=pgcache');
                     $exs->push(new Util_WpFile_FilesystemOperationException(sprintf(__('The Page Cache add-in file advanced-cache.php is not a W3 Total Cache drop-in.
                 It should be removed. %s', 'w3-total-cache'), Util_Ui::button_link(__('Yes, remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc')))));
                     return;
                 }
             }
         }
     }
     try {
         Util_WpFile::copy_file($src, $dst);
     } catch (Util_WpFile_FilesystemOperationException $ex) {
         $exs->push($ex);
     }
 }
 public static function w3tc_notes_wordpress_seo($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wordpress-seo';
     $notes[$extension_id] = sprintf(__('It appears that activating the <a href="%s">Yoast SEO</a> extension for W3 Total Cache will be helpful for your site. <a class="button" href="%s">Click here</a> to try it. %s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)), Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wordpress_seo.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     $nerser = Dispatcher::component('Extension_NewRelic_Service');
     $view = '';
     $view_application = $nerser->get_effective_application_id();
     $new_relic_configured = $this->_config->get_string(array('newrelic', 'api_key')) && $view_application != 0;
     if ($new_relic_configured) {
         $view_vis = sprintf("https://rpm.newrelic.com/accounts/%d/applications/%d", $nerser->get_account_id(), $nerser->get_effective_application_id());
         $view = '<div class="w3tc-widget-text"><a href="' . $view_vis . '">' . __('view visualizations', 'w3-total-cache') . '</a></div>';
     }
     Util_Widget::add('w3tc_new_relic', '<div class="w3tc-widget-newrelic-logo"></div>' . $view, array($this, 'widget_new_relic'), Util_Ui::admin_url('admin.php?page=w3tc_general#monitoring'), 'normal');
 }
 public static function w3tc_notes_wpml($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wpml';
     $config = Dispatcher::config();
     if (!Util_Environment::is_w3tc_pro($config)) {
         $activate_text = 'Available after <a href="#" class="button-buy-plugin">upgrade</a>. ';
     } else {
         $activate_text = sprintf('<a class="button" href="%s">Click here</a> to try it. ', Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)));
     }
     $notes[$extension_id] = sprintf(__('Activating the <a href="%s">WPML</a> extension for W3 Total Cache may be helpful for your site. %s%s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), $activate_text, Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wpml.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
 }
Exemplo n.º 6
0
 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
     // values from widget
     $w3tc_support_form_hash = 'm5pom8z0qy59rm';
     $w3tc_support_field_name = '';
     $w3tc_support_field_value = '';
     if (isset($_GET['service_item'])) {
         $pos = (int) $_GET['service_item'];
         $v = get_site_option('w3tc_generic_widgetservices');
         try {
             $v = json_decode($v, true);
             if (isset($v['items']) && isset($v['items'][$pos])) {
                 $i = $v['items'][$pos];
                 $w3tc_support_form_hash = $i['form_hash'];
                 $w3tc_support_field_name = $i['parameter_name'];
                 $w3tc_support_field_value = $i['parameter_value'];
             }
         } catch (\Exception $e) {
         }
     }
     wp_localize_script('w3tc-options', 'w3tc_support_form_hash', $w3tc_support_form_hash);
     wp_localize_script('w3tc-options', 'w3tc_support_field_name', $w3tc_support_field_name);
     wp_localize_script('w3tc-options', 'w3tc_support_field_value', $w3tc_support_field_value);
 }
Exemplo n.º 7
0
</p>
    <?php 
if ($authorized && (!$have_zone || is_null($zone_info))) {
    ?>
        <button id="netdna-maxcdn-create-pull-zone" class="button-primary {type: 'netdna', nonce: '<?php 
    echo wp_create_nonce('w3tc');
    ?>
'}"><?php 
    _e('Create Pull Zone', 'w3-total-cache');
    ?>
</button>
    <?php 
} elseif (!$authorized) {
    ?>
        <a class="button-primary" href="<?php 
    echo wp_nonce_url(Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_cdn_netdna_authorize'), 'w3tc');
    ?>
" target="_blank"><?php 
    _e('Authorize', 'w3-total-cache');
    ?>
</a>
        <form action="admin.php?page=w3tc_dashboard" method="post">
            <p>
                <label for="cdn_netdna_authorization_key"><?php 
    _e('Authorization key', 'w3-total-cache');
    ?>
:</label>
                <input name="netdna" value="1" type="hidden" />
                <input id="cdn_netdna_authorization_key" class="w3tc-ignore-change" type="text" <?php 
    echo $is_sealed ? 'disabled="disabled"' : '';
    ?>
            <div style="display: inline-block; margin-left: 10px;">
                <!-- Place this tag where you want the widget to render. -->
                <div class="g-follow" data-annotation="bubble" data-height="20" data-href="https://plus.google.com/106009620651385224281" data-rel="author"></div>
                <!-- Place this tag after the last widget tag. -->
                <script type="text/javascript">
                    (function() {
                        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                        po.src = 'https://apis.google.com/js/plusone.js';
                        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
                    })();
                </script>
            </div>
        </div>
    </header>
    <form action="<?php 
echo Util_Ui::admin_url('admin.php?page=w3tc_general');
?>
&amp;w3tc_config_save_support_us" method="post">

    <div class="content">
            <h3 class="font-palette-dark-skies"><?php 
_e('Support Us, It\'s Free!', 'w3-total-cache');
?>
</h3>

            <p><?php 
_e('We noticed you\'ve been using W3 Total Cache for 30 days or more, please help us improve WordPress by:', 'w3-total-cache');
?>
</p>
            <ul>
                <li>
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', '<div class="w3tc-widget-w3tc-logo"></div>' . '<div class="w3tc-widget-text">' . __('Caching Statistics', 'w3-total-cache') . '</div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
Exemplo n.º 10
0
<?php

namespace W3TC;

if (!defined('W3TC')) {
    die;
}
Util_Ui::postbox_header(__('<acronym title="Content Delivery Network">CDN</acronym>', 'w3-total-cache'), '', 'cdn');
Util_Ui::config_overloading_button(array('key' => 'cdn.configuration_overloaded'));
?>
<p><?php 
_e('Host static files with your content delivery network provider to reduce page load time.', 'w3-total-cache');
if (!$cdn_enabled) {
    printf(__('If you do not have a <acronym title="Content Delivery Network">CDN</acronym> provider try MaxCDN. <a href="%s" target="_blank">Sign up and save 25&#37;</a>.', 'w3-total-cache'), wp_nonce_url(Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_cdn_maxcdn_signup'), 'w3tc'));
}
?>
</p>
<table class="form-table">
    <?php 
Util_Ui::config_item(array('key' => 'cdn.enabled', 'control' => 'checkbox', 'checkbox_label' => __('Enable', 'w3-total-cache'), 'description' => __('Theme files, media library attachments, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> files etc will appear to load instantly for site visitors.', 'w3-total-cache')));
Util_Ui::config_item(array('key' => 'cdn.engine', 'control' => 'selectbox', 'selectbox_values' => $engine_values, 'selectbox_optgroups' => $engine_optgroups, 'description' => __('Select the <acronym title="Content Delivery Network">CDN</acronym> type you wish to use.', 'w3-total-cache') . $cdn_engine_extra_description));
?>
</table>

<?php 
Util_Ui::button_config_save('general_cdn', '<input id="cdn_purge" type="button" value="' . __('Empty cache', 'w3-total-cache') . '" ' . ($cdn_enabled && Cdn_Util::can_purge_all($config->get_string('cdn.engine')) ? '' : ' disabled="disabled" ') . ' class="button {nonce: \'' . wp_create_nonce('w3tc') . '\'}" />');
Util_Ui::postbox_footer();
 public static function w3tc_notes_genesis_theme($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'genesis.theme';
     $notes[$extension_id] = sprintf(__('Activating the <a href="%s">Genesis Theme</a> extension for W3 Total Cache may be helpful for your site. <a href="%s">Click here</a> to try it. %s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)), Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'genesis.theme.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
Exemplo n.º 12
0
                        </span>
                    <?php 
        }
        ?>
                    <?php 
    } else {
        ?>
                        <span class="activate">
                        <?php 
        if ($meta['enabled']) {
            ?>
                            <?php 
            if (!$config->is_sealed('extensions.active')) {
                ?>
                            <a href="<?php 
                esc_attr_e(wp_nonce_url(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_extensions&action=activate&extension=%s&amp;extension_status=%s&amp;paged=%d', $extension, $extension_status, $page)), 'w3tc'));
                ?>
" title="<?php 
                esc_attr_e('Activate this extension', 'w3-total-cache');
                ?>
 ">
                                <?php 
                _e('Activate');
                ?>
                            </a>
                            <?php 
            }
            ?>
                        <?php 
        } else {
            ?>
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', __('Usage Statistics', 'w3-total-cache'), array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
Exemplo n.º 14
0
 /**
  * Creates add-in
  *
  * @throws Util_WpFile_FilesystemOperationException
  */
 private function create_addin()
 {
     $src = W3TC_INSTALL_FILE_DB;
     $dst = W3TC_ADDIN_FILE_DB;
     if ($this->db_installed()) {
         if ($this->is_dbcache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_dbcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->db_check_old_add_in()) {
                     if (isset($_GET['page'])) {
                         $url = 'admin.php?page=' . $_GET['page'] . '&amp;';
                     } else {
                         $url = basename(Util_Environment::remove_query($_SERVER['REQUEST_URI'])) . '?page=w3tc_dashboard&amp;';
                     }
                     $remove_url = Util_Ui::admin_url($url . 'w3tc_default_remove_add_in=dbcache');
                     throw new Util_WpFile_FilesystemOperationException(sprintf(__('The Database add-in file db.php is not a W3 Total Cache drop-in.
                 Remove it or disable Database Caching. %s', 'w3-total-cache'), Util_Ui::button_link(__('Remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc'))));
                 }
             }
         }
     }
     Util_WpFile::copy_file($src, $dst);
 }
Exemplo n.º 15
0
 public function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_highwinds', '<div class="w3tc-widget-highwinds-logo"></div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_cdn'), 'normal');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_cloudflare', '<div class="w3tc_cloudflare_widget_logo"></div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#cloudflare'), 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_netdna', '<div class="w3tc-widget-netdna-logo"></div>', array($this, 'widget_netdna'), Util_Ui::admin_url('admin.php?page=w3tc_cdn'), 'normal');
 }
 /**
  * Dashboard setup action
  *
  * @return void
  */
 public function wp_dashboard_setup()
 {
     Util_Widget::add('w3tc_pagespeed', '<div class="w3tc-widget-pagespeed-logo"></div>' . '<div class="w3tc-widget-text">' . __('Page Speed Report', 'w3-total-cache') . '</div>', array($this, 'widget_pagespeed'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
 public function w3tc_extension_plugin_links($links)
 {
     $links = array();
     $links[] = '<a class="edit" href="' . esc_attr(Util_Ui::admin_url('admin.php?page=w3tc_general#monitoring')) . '">' . __('Settings') . '</a>';
     return $links;
 }
Exemplo n.º 20
0
 function w3tc_cdn_save_activate()
 {
     try {
         $this->_config->set('cdn.enabled', true);
         $this->_config->save();
     } catch (\Exception $ex) {
     }
     Util_Environment::redirect(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_cdn#configuration')));
 }
 /**
  * Alters the active state of an extension
  */
 public function change_extension_status()
 {
     $action = Util_Request::get_string('action');
     if (in_array($action, array('activate', 'deactivate'))) {
         $extension = Util_Request::get_string('extension');
         if ('activate' == $action) {
             Extensions_Util::activate_extension($extension, $this->_config);
             wp_redirect(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_extensions&activated=%s', $extension)));
         } elseif ('deactivate' == $action) {
             Extensions_Util::deactivate_extension($extension, $this->_config);
             wp_redirect(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_extensions&deactivated=%s', $extension)));
         }
     }
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_cloudflare', __('CloudFlare', 'w3-total-cache'), array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#cloudflare'), 'normal');
 }