Commit e5a0010b authored by Jordan Michaels's avatar Jordan Michaels

initial (rqs function)

parent f7ba4b2f
File added
<?php
abstract class Vivio_Swift_Admin_Messages
{
function show_msg_settings_updated()
{
echo '<div id="message" class="updated fade"><p><strong>';
_e('Settings successfully updated.','all-in-one-wp-security-and-firewall');
echo '</strong></p></div>';
}
static function show_msg_record_deleted_st()
{
echo '<div id="message" class="updated fade"><p><strong>';
_e('The selected record(s) deleted successfully!','all-in-one-wp-security-and-firewall');
echo '</strong></p></div>';
}
function show_msg_updated($msg)
{
echo '<div id="message" class="updated fade"><p><strong>';
echo $msg;
echo '</strong></p></div>';
}
static function show_msg_updated_st($msg)
{
echo '<div id="message" class="updated fade"><p><strong>';
echo $msg;
echo '</strong></p></div>';
}
function show_msg_error($error_msg)
{
echo '<div id="message" class="error"><p><strong>';
echo $error_msg;
echo '</strong></p></div>';
}
static function show_msg_error_st($error_msg)
{
echo '<div id="message" class="error"><p><strong>';
echo $error_msg;
echo '</strong></p></div>';
}
function start_buffer()
{
ob_start();
}
function end_buffer_and_collect()
{
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}
\ No newline at end of file
<?php
class Vivio_Swift_Admin {
var $main_menu_page;
var $dashboard_menu;
var $cache_menu;
var $compress_menu;
public function __construct() {
require_once('vivio-swift-admin-messages.php');
//create admin menus
add_action('admin_menu', array(&$this, 'create_admin_menus'));
//init scripts/styles if user is on vivio_swift plugin pages
//if (isset($_GET['page']) && strpos($_GET['page'], VIVIO_SWIFT_MENU_SLUG_PREFIX) !== false) {
add_action('admin_print_scripts', array(&$this, 'admin_menu_page_scripts'));
add_action('admin_print_styles', array(&$this, 'admin_menu_page_styles'));
//}
}
function admin_menu_page_scripts()
{
wp_enqueue_script('jquery');
wp_enqueue_script('postbox');
wp_enqueue_script('dashboard');
wp_enqueue_script('thickbox');
wp_register_script('vivio-swift-admin-js', VIVIO_SWIFT_URL. '/js/vivio-swift-admin.js', array('jquery'));
wp_enqueue_script('vivio-swift-admin-js');
}
function admin_menu_page_styles()
{
wp_enqueue_style('dashboard');
wp_enqueue_style('thickbox');
wp_enqueue_style('global');
wp_enqueue_style('wp-admin');
wp_enqueue_style('vivio-swift-admin-css', VIVIO_SWIFT_URL. '/css/vivio-swift-admin.css');
}
function create_admin_menus()
{
$vivio_swift_icon = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiICAgd2lkdGg9IjMwMG1tIiAgIGhlaWdodD0iMzAwbW0iICAgdmlld0JveD0iMCAwIDMwMCAzMDAiICAgdmVyc2lvbj0iMS4xIiAgIGlkPSJzdmc0ODQ0IiAgIGlua3NjYXBlOnZlcnNpb249IjAuOTIuMSByMTUzNzEiICAgc29kaXBvZGk6ZG9jbmFtZT0icGx1Z2luLWljb24uc3ZnIj4gIDxkZWZzICAgICBpZD0iZGVmczQ4MzgiIC8+ICA8c29kaXBvZGk6bmFtZWR2aWV3ICAgICBpZD0iYmFzZSIgICAgIHBhZ2Vjb2xvcj0iIzAwMDAwMCIgICAgIGJv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menu_page = add_menu_page(__('Vivio Swift', 'vivio-swift'), __('Vivio Swift', 'vivio-swift'), VIVIO_SWIFT_CAPABILITY, VIVIO_SWIFT_MAIN_MENU_SLUG , array(&$this, 'handle_dashboard_menu_rendering'), $vivio_swift_icon);
add_submenu_page(VIVIO_SWIFT_MAIN_MENU_SLUG, __('Dashboard', 'vivio-swift'), __('Dashboard', 'vivio-swift') , VIVIO_SWIFT_CAPABILITY, VIVIO_SWIFT_MAIN_MENU_SLUG, array(&$this, 'handle_dashboard_menu_rendering'));
add_submenu_page(VIVIO_SWIFT_MAIN_MENU_SLUG, __('Cache', 'vivio-swift'), __('Cache', 'vivio-swift') , VIVIO_SWIFT_CAPABILITY, VIVIO_SWIFT_CACHE_MENU_SLUG, array(&$this, 'handle_cache_menu_rendering'));
add_submenu_page(VIVIO_SWIFT_MAIN_MENU_SLUG, __('Compression', 'vivio-swift'), __('Compression', 'vivio-swift') , VIVIO_SWIFT_CAPABILITY, VIVIO_SWIFT_COMPRESS_MENU_SLUG, array(&$this, 'handle_compress_menu_rendering'));
}
function handle_dashboard_menu_rendering()
{
include_once('vivio-swift-dashboard-menu.php');
$this->dashboard_menu = new Vivio_Swift_Dashboard_Menu();
}
function handle_cache_menu_rendering()
{
include_once('vivio-swift-cache-menu.php');
$this->cache_menu = new Vivio_Swift_Cache_Menu();
}
function handle_compress_menu_rendering()
{
include_once('vivio-swift-compress-menu.php');
$this->compress_menu = new Vivio_Swift_Compress_Menu();
}
}
<?php
class Vivio_Swift_Cache_Menu extends Vivio_Swift_Admin_Messages
{
var $cache_menu_page_slug = VIVIO_SWIFT_CACHE_MENU_SLUG;
var $menu_tabs;
var $menu_tabs_handler = array(
'tab1' => 'render_tab1',
'tab2' => 'render_tab2'
);
function __construct()
{
$this->render_menu_page();
}
function set_menu_tabs()
{
$this->menu_tabs = array(
'tab1' => __('Settings', 'vivio-swift'),
'tab2' => __('Reports', 'vivio-swift'),
);
}
function get_current_tab()
{
$tab_keys = array_keys($this->menu_tabs);
$tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : $tab_keys[0];
return $tab;
}
/*
* Renders our tabs of this menu as nav items
*/
function render_menu_tabs()
{
$current_tab = $this->get_current_tab();
echo '<h2 class="nav-tab-wrapper">';
foreach ($this->menu_tabs as $tab_key => $tab_caption) {
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->cache_menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
}
echo '</h2>';
}
/*
* The menu rendering goes here
*/
function render_menu_page()
{
echo '<div class="wrap">';
echo '<h2>' . __('Vivio Swift Cache', 'vivio-swift') . '</h2>';//Interface title
$this->set_menu_tabs();
$tab = $this->get_current_tab();
$this->render_menu_tabs();
?>
<div id="poststuff"><div id="post-body">
<?php
//$tab_keys = array_keys($this->menu_tabs);
call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
?>
</div></div>
</div><!-- end of wrap -->
<?php
}
function render_tab1()
{
echo '<div class="message_standard">';
echo '<p>' . __("By caching PHP to it's fully rendered HTML, you reduce processing load and help all supplimentary caching services like memcache, CDN's, and even browsers, run faster.", 'vivio-swift') . '</p>';
echo '</div>';
global $vivio_swift_global;
// process cache settings
if (isset($_POST['vivio_swift_save_cache_settings']))
{
$error = '';
// verify nonce
$nonce = $_REQUEST['_wpnonce'];
if (!wp_verify_nonce($nonce, 'vivio_swift_remove_query_strings_nonce')) {
$vivio_swift_global->debug_logger->log_debug("Nonce check failed on cache settings.", 4);
wp_die("Error: Nonce check failed on cache settings.");
}
// set and save debug settings
$vivio_swift_global->configs->set_value('vivio_swift_remove_query_strings',isset($_POST["vivio_swift_remove_query_strings"])?'1':'');
$vivio_swift_global->configs->save_config();
}
?>
<div id="vivio-swift-container">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Settings', 'vivio-swift');?></label>
</h3>
<div class="inside">
<form action="" method="POST">
<?php wp_nonce_field('vivio_swift_remove_query_strings_nonce'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Remove Query Strings', 'vivio-swift')?>:</th>
<td>
<input name="vivio_swift_remove_query_strings" type="checkbox"<?php if($vivio_swift_global->configs->get_value('vivio_swift_remove_query_strings')=='1') echo ' checked="checked"'; ?> value="1"/>
<span class="description"><?php _e('Check this to remove version number query strings from static assets so they can be cached by more systems.', 'vivio-swift'); ?></span>
</td>
</tr>
</table>
<input type="submit" name="vivio_swift_save_cache_settings" value="<?php _e('Save Settings', 'vivio-swift')?>" class="button-primary" />
</form>
</div>
</div>
</div><!-- End of Site Info -->
<?php
}
function render_tab2()
{
global $vivio_swift_global;
?>
<div id="vivio-swift-container">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Reports', 'vivio-swift');?></label>
</h3>
<div class="inside">
</div>
</div>
</div><!-- End of Site Info -->
<?php
}
} //end class
<?php
class Vivio_Swift_Compress_Menu extends Vivio_Swift_Admin_Messages
{
var $compress_menu_page_slug = VIVIO_SWIFT_COMPRESS_MENU_SLUG;
var $menu_tabs;
var $menu_tabs_handler = array(
'tab1' => 'render_tab1',
'tab2' => 'render_tab2'
);
function __construct()
{
$this->render_menu_page();
}
function set_menu_tabs()
{
$this->menu_tabs = array(
'tab1' => __('Settings', 'vivio-swift'),
'tab2' => __('Reports', 'vivio-swift'),
);
}
function get_current_tab()
{
$tab_keys = array_keys($this->menu_tabs);
$tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : $tab_keys[0];
return $tab;
}
/*
* Renders our tabs of this menu as nav items
*/
function render_menu_tabs()
{
$current_tab = $this->get_current_tab();
echo '<h2 class="nav-tab-wrapper">';
foreach ($this->menu_tabs as $tab_key => $tab_caption) {
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->compress_menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
}
echo '</h2>';
}
/*
* The menu rendering goes here
*/
function render_menu_page()
{
echo '<div class="wrap">';
echo '<h2>' . __('Vivio Swift Compression', 'vivio-swift') . '</h2>';//Interface title
$this->set_menu_tabs();
$tab = $this->get_current_tab();
$this->render_menu_tabs();
?>
<div id="poststuff"><div id="post-body">
<?php
//$tab_keys = array_keys($this->menu_tabs);
call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
?>
</div></div>
</div><!-- end of wrap -->
<?php
}
function render_tab1()
{
echo '<div class="message_standard">';
echo '<p>' . __('Vivio Swift Compression options reduce the size and number of requests needed by your visitors to access your site.', 'vivio-swift') . '</p>';
echo '</div>';
global $vivio_swift_global;
?>
<div id="vivio-swift-container">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Settings', 'vivio-swift');?></label>
</h3>
<div class="inside">
</div>
</div>
</div><!-- End of Site Info -->
<?php
}
function render_tab2()
{
global $vivio_swift_global;
?>
<div id="vivio-swift-container">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Reports', 'vivio-swift');?></label>
</h3>
<div class="inside">
</div>
</div>
</div><!-- End of Site Info -->
<?php
}
} //end class
<?php
class Vivio_Swift_Dashboard_Menu extends Vivio_Swift_Admin_Messages
{
var $dashboard_menu_page_slug = VIVIO_SWIFT_MAIN_MENU_SLUG;
var $menu_tabs;
var $menu_tabs_handler = array(
'tab1' => 'render_tab1',
'tab2' => 'render_tab2',
'tab3' => 'render_tab3',
);
function __construct()
{
$this->render_menu_page();
}
function set_menu_tabs()
{
$this->menu_tabs = array(
'tab1' => __('Dashboard', 'vivio-swift'),
'tab2' => __('System Info', 'vivio-swift'),
'tab3' => __('Log Viewer', 'vivio-swift'),
);
}
function get_current_tab()
{
$tab_keys = array_keys($this->menu_tabs);
$tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : $tab_keys[0];
return $tab;
}
/*
* Renders our tabs of this menu as nav items
*/
function render_menu_tabs()
{
$current_tab = $this->get_current_tab();
echo '<h2 class="nav-tab-wrapper">';
foreach ($this->menu_tabs as $tab_key => $tab_caption) {
$active = $current_tab == $tab_key ? 'nav-tab-active' : '';
echo '<a class="nav-tab ' . $active . '" href="?page=' . $this->dashboard_menu_page_slug . '&tab=' . $tab_key . '">' . $tab_caption . '</a>';
}
echo '</h2>';
}
/*
* The menu rendering goes here
*/
function render_menu_page()
{
echo '<div class="wrap">';
echo '<h2>' . __('Vivio Swift Dashboard', 'vivio-swift') . '</h2>';//Interface title
$this->set_menu_tabs();
$tab = $this->get_current_tab();
$this->render_menu_tabs();
?>
<div id="poststuff"><div id="post-body">
<?php
//$tab_keys = array_keys($this->menu_tabs);
call_user_func(array(&$this, $this->menu_tabs_handler[$tab]));
?>
</div></div>
</div><!-- end of wrap -->
<?php
}
function render_tab1()
{
echo '<div class="message_standard">';
echo '<p>' . __('Place holder for Vivio Swift information notification.', 'vivio-swift') . '</p>';
echo '<p><a href="https://twitter.com/viviotech/" target="_blank">' . __('Follow us on Twitter', 'vivio-swift') . '</a> ' . __('to stay up to date on new and improved features of this plugin.', 'vivio-swift') . '</p>';
echo '</div>';
global $vivio_swift_global;
?>
<div id="vivio-swift-container">
<div class="dashboard_box_small">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Spread the Word', 'vivio-swift');?></label>
</h3>
<div class="inside">
<p><?php _e('Has this plugin helped you? Pay it forward and let others know! Here is how you can help:', 'vivio-swift');?></p>
<p>
<a href="https://www.facebook.com/viviotech" target="_blank">Like us on Facebook</a>
</p>
<p>
<a href="http://twitter.com/intent/tweet?url=https://viviotech.net/&text=Using the Vivio Swift #Wordpress plugin from @viviotech has really helped speed up my site! Check it out!" target="_blank">Post to Twitter</a>
</p>
<p>
<a href="#" target="_blank">Give a Good Rating on Wordpress</a>
</p>
</div>
</div>
</div>
<div class="dashboard_box_small">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Caching', 'vivio-swift');?></label>
</h3>
<div class="inside">
<p><?php _e('Something about caching', 'vivio-swift');?></p>
</div>
</div>
</div>
<div class="dashboard_box_small">
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Compression', 'vivio-swift');?></label>
</h3>
<div class="inside">
<p><?php _e('Something about compression', 'vivio-swift');?></p>
</div>
</div>
</div>
</div>
<!-- Masonry stuff -->
<?php
echo '<script type="text/javascript" src="' . VIVIO_SWIFT_URL . '/js/masonry.pkgd.min.js"></script>';
?>
<script type="text/javascript">
window.onload = function () {
var container = document.querySelector('#vivio-swift-container');
var msnry = new Masonry(container, {
// options
columnWidth: 100,
itemSelector: '.dashboard_box_small'
});
}
</script>
<?php
}
function render_tab2()
{
echo '<div class="message_standard">';
echo '<p>' . __('The following information is useful when reporting bugs or issues regarding Vivio Swift.', 'vivio-swift') . '</p>';
echo '</div>';
global $wpdb;
global $vivio_swift_global;
?>
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('Environment', 'vivio-swift');?></label>
</h3>
<div class="inside">
<strong><?php _e('Plugin Version', 'vivio-swift');?>
: </strong><code><?php echo VIVIO_SWIFT_VERSION;?></code><br/>
<strong><?php _e('WP Version', 'vivio-swift');?>
: </strong><code><?php echo get_bloginfo("version"); ?></code><br/>
<strong>WPMU: </strong><code><?php echo (!defined('MULTISITE') || !MULTISITE) ? "No" : "Yes"; ?></code><br/>
<strong>MySQL <?php _e('Version', 'vivio-swift');?>
: </strong><code><?php echo $wpdb->db_version();?></code><br/>
<strong>WP <?php _e('Table Prefix', 'vivio-swift');?>
: </strong><code><?php echo $wpdb->prefix; ?></code><br/>
<strong>PHP <?php _e('Version', 'vivio-swift');?>
: </strong><code><?php echo phpversion(); ?></code><br/>
<strong><?php _e('Session Save Path', 'vivio-swift');?>
: </strong><code><?php echo ini_get("session.save_path"); ?></code><br/>
<strong>WP URL: </strong><code><?php echo get_bloginfo('wpurl'); ?></code><br/>
<strong><?php _e('Server Name', 'vivio-swift');?>
: </strong><code><?php echo $_SERVER['SERVER_NAME']; ?></code><br/>
<strong><?php _e('Cookie Domain', 'vivio-swift');?>
: </strong><code><?php $cookieDomain = parse_url(strtolower(get_bloginfo('wpurl')));
echo $cookieDomain['host']; ?></code><br/>
<strong>CURL <?php _e('Library Present', 'vivio-swift');?>
: </strong><code><?php echo (function_exists('curl_init')) ? "Yes" : "No"; ?></code><br/>
<strong><?php _e('Debug File Write Permissions', 'vivio-swift');?>
: </strong><code><?php echo (is_writable(VIVIO_SWIFT_PATH)) ? "Writable" : "Not Writable"; ?></code><br/>
</div>
</div><!-- End of Site Info -->
<div class="postbox">
<h3 class="hndle">
<label for="title"><?php _e('PHP Info', 'vivio-swift');?></label>
</h3>
<div class="inside">
<strong><?php _e('PHP Version', 'vivio-swift'); ?>
: </strong><code><?php echo PHP_VERSION; ?></code><br/>
<strong><?php _e('PHP Memory Usage', 'vivio-swift'); ?>:
</strong><code><?php echo round(memory_get_usage() / 1024 / 1024, 2) . __(' MB', 'vivio-swift'); ?></code>
<br/>
<?php
if (ini_get('memory_limit')) {
$memory_limit = filter_var(ini_get('memory_limit'), FILTER_SANITIZE_STRING);
} else {
$memory_limit = __('N/A', 'vivio-swift');
}
?>
<strong><?php _e('PHP Memory Limit', 'vivio-swift'); ?>
: </strong><code><?php echo $memory_limit; ?></code><br/>
<?php