public static function saveCache()
 {
     $loadData = PluginsMeta::get(array('cacheTime' => 1, 'where' => "where status='1'", 'orderby' => "order by zonename asc"));
     $resultData = array();
     // print_r($loadData);die();
     if (isset($loadData[0]['zonename'])) {
         $total = count($loadData);
         for ($i = 0; $i < $total; $i++) {
             $theZone = $loadData[$i]['zonename'];
             $resultData[$theZone][] = $loadData[$i];
         }
         Cache::saveKey('listZones', serialize($resultData));
         return $resultData;
     } else {
         Cache::removeKey('listZones');
     }
 }
Example #2
0
 public static function add($routeName = '', $functionName = '', $method = 'function')
 {
     if (self::$canAdd == 'no') {
         throw new Exception('You can not add route');
     }
     if (!isset($routeName[1]) || !isset($functionName[1])) {
         throw new Exception('Data not valid.');
     }
     $inputData = array();
     $data = debug_backtrace();
     $pluginPath = dirname($data[0]['file']) . '/';
     $foldername = basename($pluginPath);
     if (!isset($foldername[1])) {
         throw new Exception('Folder name not valid.');
     }
     $inputData['foldername'] = $foldername;
     $inputData['func'] = $functionName;
     $inputData['zonename'] = 'route';
     $inputData['layoutname'] = 'route';
     $inputData['content'] = $routeName;
     $inputData['status'] = 1;
     PluginsMeta::insert($inputData);
 }
 public static function add($scName, $funcName)
 {
     $data = debug_backtrace();
     $path = dirname($data[0]['file']) . '/';
     $post = array();
     $post['content'] = $scName;
     $post['func'] = $funcName;
     $pluginPath = $path;
     $folderName = basename($path);
     $post['foldername'] = $folderName;
     $post['zonename'] = 'shortcode';
     $post['type'] = 'shortcode';
     // Plugins::add('shortcode',$post);
     if (!PluginsMeta::insert($post)) {
         return false;
     }
     PluginsZone::addPlugin($post['zonename'], $post);
 }
Example #4
0
 public static function add($zoneName, $funcName)
 {
     $inputData = array();
     $data = debug_backtrace();
     $pluginPath = dirname($data[0]['file']) . '/';
     $foldername = basename($pluginPath);
     if (!isset($foldername[2])) {
         // throw new Exception("Plugin folder name must have to large than 2 character.");
         self::writeError("Plugin folder name must have to large than 2 character.");
         return false;
     }
     // $inputData['status']=1;
     self::$canAddZone = 'yes';
     $inputData['foldername'] = $foldername;
     $inputData['zonename'] = $zoneName;
     $inputData['func'] = $funcName;
     if (!PluginsMeta::insert($inputData)) {
         self::writeError("Error. " . Database::$error);
         return false;
     }
     PluginsZone::addPlugin($inputData['zonename'], $inputData);
 }