Ejemplo n.º 1
0
 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();
     }
 }
Ejemplo n.º 2
0
 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}";
         }
     }
 }
Ejemplo n.º 3
0
 public function save()
 {
     Mvc::log('saving', $this->key, $this->value);
     return Mvc::option($this->key, $this->value);
 }