public function __construct() { self::$options = array_merge(self::$options, $this->getAllOpt()); if (!is_array(self::$options)) { self::reset_options(); } }
function plugin_setting() { !empty($_POST['googleapis']) ? MoeCDN::set('googleapis', '1') : MoeCDN::set('googleapis', '0'); !empty($_POST['gravatar']) ? MoeCDN::set('gravatar', '1') : MoeCDN::set('gravatar', '0'); !empty($_POST['worg']) ? MoeCDN::set('worg', '1') : MoeCDN::set('worg', '0'); $c = Cache::getInstance(); $c->updateCache('options'); return true; }
protected static function save_options() { self::$options = array('gravatar' => $_POST['gravatar'], 'googleapis' => $_POST['googleapis'], 'worg' => $_POST['worg'], 'wpcom' => $_POST['wpcom']); update_option('moecdn_options', self::$options); update_option('moecdn_collect', $_POST['collect']); }
<?php /* Plugin Name: MoeCDN Version: 1.0 Plugin URL: https://github.com/MoeNetwork/MoeCDN-EMLOG Description: 加速Gravatar/GoogleAPIs等由于众所周知的原因而在中国无法访问的资源 Author: Kenvix @ MoeNet Author URL: http://zhizhe8.net/ */ !defined('EMLOG_ROOT') && exit('access deined!'); require 'class.php'; $MoeCDN = new MoeCDN(); $MoeCDN->hook();