Example #1
0
 public function handle()
 {
     $priorityLast = WP_PEPVN_PRIORITY_LAST;
     $moduleBackend = $this->di->get('moduleBackend');
     $hook = $this->di->getShared('hook');
     $register_admin_page = array();
     if ($hook->has_filter('register_admin_page')) {
         $register_admin_page = $hook->apply_filters('register_admin_page', $register_admin_page);
     }
     $register_admin_page = (array) $register_admin_page;
     $page = '';
     if (isset($_GET['page']) && $_GET['page']) {
         $page = $_GET['page'];
         $page = str_replace(WP_OPTIMIZE_BY_XTRAFFIC_PLUGIN_NS_SHORT . '_', '', $page);
         $page = trim($page);
     }
     if ($page) {
         $page = Text::camelize($page);
         if (isset($register_admin_page[$page])) {
             echo $moduleBackend->router_handle($page, $register_admin_page[$page])->getContent();
         } else {
             echo $moduleBackend->router_handle($page)->getContent();
         }
     }
     unset($register_admin_page);
 }
Example #2
0
 /**
  * Gets a value from the internal related entity or from the default value
  *
  * @param string name
  * @return mixed
  */
 public function getValue($name)
 {
     $entity = $this->_entity;
     $data = $this->_data;
     /**
      * Check if form has a getter
      */
     if (method_exists($this, "getCustomValue")) {
         return $this->{"getCustomValue"}($name, $entity, $data);
     }
     if (is_object($entity)) {
         /**
          * Check if the entity has a getter
          */
         $method = "get" . Text::camelize($name);
         if (method_exists($entity, $method)) {
             return $entity->{$method}();
         }
         /**
          * Check if the entity has a public property
          */
         if (isset($entity->{$name})) {
             return $entity->{$name};
         }
     }
     if (is_array($data)) {
         /**
          * Check if the data is in the data array
          */
         if (isset($data[$name])) {
             return $value;
         }
     }
     /**
      * Check if form has a getter
      */
     $method = "get" . Text::camelize($name);
     if (method_exists($this, $method)) {
         return $this->{$method}();
     }
     return null;
 }
Example #3
0
 public function handle($uri = null)
 {
     if (null === $uri) {
         $uri = isset($_GET[$this->_get_uri_key]) ? $_GET[$this->_get_uri_key] : null;
     }
     if (null !== $uri) {
         $uri = rtrim($uri, '/');
         $uri = filter_var($uri, FILTER_SANITIZE_URL);
         $this->_uri = explode('/', $uri);
         $this->_requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
         $this->_requestMethod = strtoupper($this->_requestMethod);
         if (isset($this->_uri[0]) && !empty($this->_uri[0])) {
             $this->_activeControllerName = $this->_uri[0];
         } else {
             $this->_activeControllerName = $this->_defaultController;
         }
         $this->_activeControllerName = Text::camelize($this->_activeControllerName);
         if (isset($this->_uri[1]) && !empty($this->_uri[1])) {
             $this->_activeActionName = $this->_uri[1];
         } else {
             $this->_activeActionName = $this->_defaultAction;
         }
         $this->_activeActionName = Text::camelize($this->_activeActionName);
         if (isset($this->_uri[2])) {
             $this->_activeParams = $this->_uri;
             unset($this->_activeParams[0]);
             unset($this->_activeParams[1]);
             $this->_activeParams = array_values($this->_activeParams);
         }
         $this->run();
     }
 }