public function on_activation() { if (current_user_can('administrator')) { $data = get_plugin_data(Mvc::$pluginFile); Mvc::$pluginVersion = $data['Version']; Mvc::log($data); $version = Mvc::option('version', ''); if ($version != Mvc::$pluginVersion) { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $this->controller->on_upgrade($version, Mvc::$pluginVersion); Mvc::option('version', Mvc::$pluginVersion); } $this->controller->on_activation(); } }
public static function paramReplace($name, $value, $url = '') { $regex = "/({$name}=[^&\\?\\/]+)/"; Mvc::log($regex); $url = $url ? $url : $_SERVER['REQUEST_URI']; if ($value === '') { return preg_replace($regex, '', $url); } else { if (preg_match($regex, $url) == 1) { return preg_replace($regex, $name . '=' . $value, $url); } else { return $url . "{$name}={$value}"; } } }
public function save() { Mvc::log('saving', $this->key, $this->value); return Mvc::option($this->key, $this->value); }