Changeset 1305017
- Timestamp:
- 12/10/2015 07:27:48 AM (10 years ago)
- Location:
- wpbase-cache/trunk
- Files:
-
- 1 added
- 2 edited
-
style.css (added)
-
wpbase-cache-admin.php (modified) (2 diffs)
-
wpbase-cache.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpbase-cache/trunk/wpbase-cache-admin.php
r1220845 r1305017 42 42 ); 43 43 44 add_settings_field( 45 'wpbase_cache_options_admin_bar_button', 'Show dashboard button in admin bar', array($this, 'admin_bar_button_input'), 'wpbasecache', 'wpbase_cache_section' 46 ); 44 47 45 48 46 49 add_settings_field( 47 50 'wpbase_cache_options_varnish_cache', 'Enable Varnish Cache', array($this, 'varnish_cache_input'), 'wpbasecache', 'wpbase_cache_section' … … 57 60 } 58 61 62 public function admin_bar_button_input(){ 63 $options = get_option('wpbase_cache_options'); 64 $checked = checked(1, $options['admin_bar_button'], FALSE); 65 if (!(defined('WPBASE_CACHE_SANDBOX') && WPBASE_CACHE_SANDBOX)) { 66 echo "<input id='wpbase_cache_admin_bar_button' name='wpbase_cache_options[admin_bar_button]' type='checkbox' value='1' $checked />"; 67 } else { 68 echo "<input id='wpbase_cache_admin_bar_button' disabled='disabled' name='wpbase_cache_options[admin_bar_button]' type='checkbox' value='1' $checked />"; 69 } 70 } 71 72 59 73 public function varnish_cache_input() { 60 74 $options = get_option('wpbase_cache_options'); -
wpbase-cache/trunk/wpbase-cache.php
r1298973 r1305017 4 4 Plugin URI: https://github.com/baseapp/wpbase-cache 5 5 Description: A wordpress plugin for using all caches on varnish, nginx, php-fpm stack with php-apc. This plugin includes db-cache-reloaded-fix for dbcache. 6 Version: 2.1. 56 Version: 2.1.6 7 7 Author: Vikrant Datta 8 8 Author URI: http://blog.wpoven.com … … 27 27 define('WPBASE_CACHE_DIR', WP_PLUGIN_DIR . '/wpbase-cache'); 28 28 define('WPBASE_CACHE_INC_DIR', WP_PLUGIN_DIR . '/wpbase-cache/inc'); 29 29 add_action( 'admin_enqueue_scripts', function() 30 { 31 wp_register_style('style', plugin_dir_url(__FILE__ ).'/style.css',false); 32 wp_enqueue_style( 'style'); 33 }); 30 34 //$path = dirname(dirname(dirname(__FILE__))); 31 35 //if(is_file($path.'/db.php')){ … … 38 42 } 39 43 } 44 function check_wpoven_site() { 45 $check_path = dirname(dirname(dirname(ABSPATH))); 46 if (is_file($check_path . '/bamon/key')) { 47 function custom_button_example($wp_admin_bar) { 48 $file = ABSPATH . 'wp-config.php'; 49 $content = file_get_contents($file); 50 $match = ''; 51 preg_match('/define.*DB_NAME.*\'(.*)\'/', $content, $match); 52 $dbname = $match[1]; 53 $sitename = substr($dbname, 2); 54 $ch = curl_init(); 55 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 56 curl_setopt($ch, CURLOPT_URL, "https://wpoven.com/sites/checksiteinfo/" . $sitename); 57 $content = curl_exec($ch); 58 curl_close($ch); 59 //$return_array = explode(",", $content); 60 $return_array = json_decode($content,true); 61 //var_dump($return_array); 62 if ($return_array['status'] == "true") { 63 $args = array( 64 'id' => 'Dashboard-button', 65 'title' => $return_array['panel_title'].' Dashboard', 66 'href' => $return_array['hostname'] . '/sites/view/' . $return_array['siteuid'], 67 'meta' => array( 68 'class' => 'dashboard-button-class' 69 ) 70 ); 71 $wp_admin_bar->add_node($args); 72 } 73 else{ 74 $args = array( 75 'id' => 'WPOven-button', 76 'title' => 'WPOven Site Dashboard', 77 'href' => 'https://wpoven.com/sites/edit/'.$sitename, 78 'meta' => array( 79 'class' => 'dashboard-button-class' 80 ) 81 ); 82 $wp_admin_bar->add_node($args); 83 } 84 } 85 86 add_action('admin_bar_menu', 'custom_button_example', 100); 87 } 88 } 89 $options = get_option('wpbase_cache_options'); 90 if(isset($options['admin_bar_button'])) 91 add_action('init', 'check_wpoven_site'); 40 92 41 93 register_activation_hook(__FILE__, 'upon_activation'); … … 64 116 'db_cache' => '0', 65 117 'varnish_cache' => '1', 66 'send_as' => 'noreply' 118 'send_as' => 'noreply', 119 'admin_bar_button' => '1' 67 120 //'reject_url' => '', 68 121 //'reject_cookie' => '', … … 80 133 'db_cache' => '0', 81 134 'varnish_cache' => '0', 82 'send_as' => '0' 135 'send_as' => '0', 136 'admin_bar_button' => '' 83 137 //'reject_url' => '', 84 138 //'reject_cookie' => '', … … 227 281 } 228 282 } 283
Note: See TracChangeset
for help on using the changeset viewer.