Example #1
0
 * @var string $active_tab
 * @var string $extension
 * @var array $meta
 */
do_action("w3tc_extensions_page-{$extension}");
echo $this->postbox_header(htmlspecialchars($meta['author']) . ' - ' . htmlspecialchars($meta['name']), '', $extension);
?>
<p><span class="description"><?php 
echo esc_html($meta['description']);
?>
</span></p>
<?php 
do_action("w3tc_before_do_settings_sections_{$extension}");
w3tc_do_settings_sections("{$extension}");
do_action("w3tc_after_do_settings_sections_{$extension}");
?>
<p class="submit">
    <input type="hidden" name="redirect" value="<?php 
echo w3_admin_url('admin.php?page=w3tc_extensions&extension=' . $extension);
?>
" />
    <?php 
echo $this->nonce_field('w3tc');
?>
    <input type="submit" name="w3tc_save_options" class="w3tc-button-save button-primary" value="<?php 
_e('Save settings', 'w3-total-cache');
?>
" />
</p>
<?php 
echo $this->postbox_footer();
 /**
  * Creates add-in
  * @throws 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;
             }
         } elseif (!$this->db_check_old_add_in()) {
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/other.php');
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
             if (isset($_GET['page'])) {
                 $url = 'admin.php?page=' . $_GET['page'] . '&amp;';
             } else {
                 $url = basename(w3_remove_query($_SERVER['REQUEST_URI'])) . '?page=w3tc_dashboard&amp;';
             }
             $remove_url = w3_admin_url($url . 'w3tc_default_remove_add_in=dbcache');
             throw new 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'), w3tc_button_link(__('Remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc'))));
         }
     }
     w3_wp_copy_file($src, $dst);
 }
Example #3
0
        ?>
 ">
                            <?php 
        _e('Deactivate');
        ?>
                        </a>
                    </span>
                    <?php 
    } else {
        ?>
                        <span class="activate">
                        <?php 
        if ($meta['enabled']) {
            ?>
                        <a href="<?php 
            esc_attr_e(wp_nonce_url(w3_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 
        } else {
            ?>
                            <?php 
            _e('Disabled: Unsupported', 'w3-total-cache');
            ?>
 /**
  * Checks if addins in wp-content is available and correct version.
  * @throws SelfTestExceptions
  */
 private function create_required_files($config, $exs)
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/other.php');
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     $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 {
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/other.php');
             w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
             $remove_url = w3_admin_url('admin.php?page=w3tc_dashboard&amp;w3tc_default_remove_add_in=pgcache');
             $exs->push(new 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'), w3tc_button_link(__('Yes, remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc')))));
             return;
         }
     }
     try {
         w3_wp_copy_file($src, $dst);
     } catch (FilesystemOperationException $ex) {
         $exs->push($ex);
     }
 }
Example #5
0
 /**
  *  Display edge mode notification
  */
 public function notify_edge_mode()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
     $message = sprintf(__('<p>You can now keep W3 Total Cache up-to-date without having to worry about new features breaking your website. There will be more releases with bug fixes, security fixes and settings updates. </p>
     <p>Also, you can now try out our new features as soon as they\'re ready. %s to enable "edge mode" and unlock pre-release features. %s</p>', 'w3-total-cache'), '<a href="' . w3_admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=' . $this->_page . '&w3tc_edge_mode_enable') . '" class="button">' . __('Click Here', 'w3-total-cache') . '</a>', w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'edge_mode', '', true, '', 'w3tc_default_hide_note_custom'));
     w3_e_notification_box($message, 'edge-mode');
 }
/**
 * Returns a preview link with current state
 * @return string
 */
function w3tc_get_preview_link()
{
    w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
    return w3_is_preview_mode() ? w3_button_link(__('Stop Previewing', 'w3-total-cache'), wp_nonce_url(w3_admin_url('admin.php?page=w3tc_dashboard&w3tc_default_stop_previewing'), 'w3tc'), false) : w3_button_link(__('Preview', 'w3-total-cache'), wp_nonce_url(w3_admin_url('admin.php?page=w3tc_dashboard&w3tc_default_previewing'), 'w3tc'), true);
}
Example #7
0
    _e('Click the Create Pull Zone button above and create a pull zone manually for this site.', 'w3-total-cache');
    ?>
</span>
    </td>
</tr>
<?php 
} elseif (!$authorized) {
    ?>
<tr>
    <th style="width: 300px;"><label><?php 
    _e('Specify account credentials:', 'w3-total-cache');
    ?>
</label></th>
    <td>
        <a id="cdn_netdna_oauth" class="button-primary" href="<?php 
    echo wp_nonce_url(w3_admin_url('admin.php?page=w3tc_dashboard&w3tc_cdn_netdna_authorize'), 'w3tc');
    ?>
" target="_blank"><?php 
    _e('Authorize', 'w3-total-cache');
    ?>
</a>
        <br />
        <span class="description"><?php 
    _e('Click the Authorize button above, log in, paste the key below and save settings.', 'w3-total-cache');
    ?>
</span>
    </td>
</tr>
<?php 
}
?>
Example #8
0
                    <br /><span class="description"><?php 
    _e('Try this option if your hosting environment uses a network based file system for a possible performance improvement.', 'w3-total-cache');
    ?>
</span>
                </th>
            </tr>
            <?php 
    if (is_network_admin() || !w3_is_multisite()) {
        ?>
            <tr id="edge_mode">
                <th colspan="2">
                    <?php 
        if (!w3tc_edge_mode()) {
            echo '<a href="' . w3_admin_url('admin.php?page=' . $this->_page . '&w3tc_edge_mode_enable') . '"><strong>' . __('Enable Edge mode', 'w3-total-cache') . '</strong></a>';
        } else {
            echo '<a href="' . w3_admin_url('admin.php?page=' . $this->_page . '&w3tc_edge_mode_disable') . '"><strong>' . __('Disable Edge mode', 'w3-total-cache') . '</strong></a>';
        }
        ?>
                    <br /><span class="description"><?php 
        _e('Enable this to try out new functionality under development. Might cause issues on some sites. If you have issues and can\'t access wp-admin, remove "define(\'W3TC_EDGE_MODE\', true);" from your wp-config.php file and edge mode features will be disabled.', 'w3-total-cache');
        ?>
</span>
                </th>
            </tr>
            <?php 
    }
    ?>
        </table>

        <p class="submit">
            <?php 
/**
 * @param $extension_name
 * @param $extension_id
 */
function w3_e_extension_activation_notification($extension_name, $extension_id)
{
    w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
    $page = w3tc_get_current_page();
    printf(w3_get_notification_box('<p>' . __('It appears that activating the <a href="%s">%s</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') . '</p>', $extension_id), sprintf(w3_admin_url('admin.php?page=w3tc_extensions#%s'), $extension_id), $extension_name, sprintf(w3_admin_url('admin.php?page=' . $page . '&w3tc_extensions_activate=%s'), $extension_id), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'hide-extension-notification', '', true, '', 'w3tc_default_hide_note_custom=' . $extension_id));
}
Example #10
0
 function action_cdn_save_activate()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     try {
         $this->_config->set('cdn.enabled', true);
         $this->_config->save();
     } catch (Exception $ex) {
     }
     w3_redirect(w3_admin_url(sprintf('admin.php?page=w3tc_cdn#configuration')));
 }
 /**
  * Alters the active state of an extension
  */
 public function change_extension_status()
 {
     $action = W3_Request::get_string('action');
     if (in_array($action, array('activate', 'deactivate'))) {
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
         $extension = W3_Request::get_string('extension');
         $all_extensions = w3_get_extensions($this->_config);
         if ('activate' == $action) {
             $this->activate($extension, $all_extensions);
             wp_redirect(w3_admin_url(sprintf('admin.php?page=w3tc_extensions&activated=%s', $extension)));
         } elseif ('deactivate' == $action) {
             $this->deactivate($extension, $this->_config);
             wp_redirect(w3_admin_url(sprintf('admin.php?page=w3tc_extensions&deactivated=%s', $extension)));
         }
     }
 }
Example #12
0
 function extension_settings_link($links)
 {
     $links = array();
     $links[] = '<a class="edit" href="' . esc_attr(w3_admin_url('admin.php?page=w3tc_general#cloudflare')) . '">' . __('Settings') . '</a>';
     return $links;
 }
Example #13
0
 * @var string $active_tab
 * @var string $extension
 * @var array $meta
 */
do_action("w3tc_extensions_page-{$extension}");
echo $this->postbox_header(htmlspecialchars($meta['author']) . ' - ' . htmlspecialchars($meta['name']), '', $extension);
?>
<p><span class="description"><?php 
echo esc_html($meta['description']);
?>
</span></p>
<?php 
do_action("w3tc_before_do_settings_sections_{$extension}");
w3tc_do_settings_sections("{$extension}");
do_action("w3tc_after_do_settings_sections_{$extension}");
?>
<p class="submit">
    <input type="hidden" name="redirect" value="<?php 
echo w3_admin_url('admin.php?page=w3tc_extensions&extension=' . $extension . '&action=view');
?>
" />
    <?php 
echo $this->nonce_field('w3tc');
?>
    <input type="submit" name="w3tc_save_options" class="w3tc-button-save button-primary" value="<?php 
_e('Save settings', 'w3-total-cache');
?>
" />
</p>
<?php 
echo $this->postbox_footer();
Example #14
0
}
?>
<div id="w3tc-edge-mode">
    <div class="w3tc-overlay-logo"></div>
    <header>
    </header>
    <div class="content">
    <p><strong><?php 
_e('You can now keep up-to-date on all of the web performance optimization (WPO) techniques that will make your website as fast as possible without having to worry about new features breaking your website when you update!', 'w3-total-cache');
?>
</strong></p>
    <p><?php 
_e('Enable "edge mode" to opt-in to pre-release features or simply close this window to opt-in to bug fixes, security fixes and settings updates only.', 'w3-total-cache');
?>
</p>
    </div>
    <div class="footer">
        <?php 
$wp_url = w3_admin_url('admin.php?page=' . $page . '&w3tc_edge_mode_enable');
echo w3tc_action_button(__('Enable Edge Mode', 'w3-total-cache'), $wp_url, "btn w3tc-size image btn-default palette-turquoise");
?>
        <?php 
wp_nonce_field('w3tc');
?>
        <input type="button" class="button-cancel btn w3tc-size btn-default outset palette-light-grey" value="<?php 
_e('Cancel', 'w3-total-cache');
?>
">
    </div>
</div>
Example #15
0
 /**
  * Prints admin notices
  */
 public function admin_notices()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     /**
      * @var W3_ConfigCompatibility $config_comp
      */
     $config_comp = w3_instance('W3_ConfigCompatibility');
     $settings = $config_comp->get_new_settings();
     if (!$settings) {
         return;
     }
     $message = '<p>The following setting pages contain new options or configuration changes. Please take note of the following:</p>';
     $message .= '<p style="padding:0;margin:0;height:30px;text-align:right;">' . ' <input style="width:120px;" type="button" class="button" value="' . __('Apply all changes', 'w3-total-cache') . '" onclick="w3tc_change_setting(\'all\', \'dynamic\')" />' . '</p>';
     $message .= '<ul style="margin-top:0px;padding-top:0px;">';
     foreach ($settings as $module) {
         $page = $module['page'];
         $name = $module['name'];
         $message .= '<li>';
         if ($page) {
             $message .= '<a href="' . w3_admin_url('admin.php?page=' . $page) . '">' . $name . '</a>';
         } else {
             $message .= $name;
         }
         $message .= '<ul>';
         foreach ($module['data'] as $setting) {
             $meta = $setting['meta'];
             $text = 'new' == $meta['state'] ? __('Append') : ('changed' == $meta['state'] ? __('Replace') : __('Remove'));
             $message .= '<li style="line-height:24px;" class="setting_changes ' . str_replace('.', '_', $setting['key']) . '">' . trim(w3_config_label($setting['key'], ''), ':') . '<div style="float:right;">' . ' <input style="width:70px;margin-right:10px" type="button" class="button" value="' . $text . '" onclick="w3tc_change_setting(\'' . $setting['key'] . '\', \'' . $meta['state'] . '\', \'' . is_network_admin() . '\')" />' . ' <a href="#" style="margin-right:13px" onclick="w3tc_change_setting(\'' . $setting['key'] . '\', \'skip\', \'' . is_network_admin() . '\')">Skip</a>' . '</div>' . '</li>';
         }
         $message .= '</ul>';
         $message .= '</li>';
     }
     $message .= '</ul>';
     $message .= '<p style="padding:0;margin:0;margin-top:20px;height:30px;text-align:right;">' . ' <input style="width:120px;" type="button" class="button" value="' . __('Apply all changes', 'w3-total-cache') . '" onclick="w3tc_change_setting(\'all\', \'dynamic\', \'' . is_network_admin() . '\')" />' . '</p><p></p>';
     w3_e_notification_box($message, 'w3tc_new_settings');
 }
Example #16
0
            <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 w3_admin_url('admin.php?page=' . $this->_page);
?>
&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 at least 30 days, please help us improve WordPress:', 'w3-total-cache');
?>
</p>
            <ul>
                <li>