예제 #1
0
 function parse_config()
 {
     $config_dir = ricUtil::slash(CONFIG_PATH . '/metaboxes');
     switch ($this->args['post_type']) {
         case 'page':
             // Config file same as template file
             $config_file = get_post_meta($this->args['post_id'], '_wp_page_template', true);
             break;
         default:
             $config_file = 'cpt-' . $this->args['post_type'] . '.php';
             break;
     }
     $config_file = $config_dir . $config_file;
     if (file_exists($config_file) and is_file($config_file)) {
         // Include the config file
         include_once $config_file;
         // And call the appropiate functions
         if (function_exists('metaboxes')) {
             $this->boxes = metaboxes($this->args['post_id']);
         }
         if (function_exists('sideboxes')) {
             $this->sideboxes = sideboxes($this->args['post_id']);
         }
     } else {
         return false;
     }
     return true;
 }
예제 #2
0
 static function walk_config_dir($base)
 {
     $subdirectories = opendir($base);
     while (($subdirectory = readdir($subdirectories)) !== false) {
         $path = $base . $subdirectory;
         if (is_file($path)) {
             if (strtolower(substr($path, -3)) == 'php') {
                 self::parse_config($path);
             }
         } else {
             if ($subdirectory != '.' && $subdirectory != '..') {
                 self::walk_config_dir(ricUtil::slash($path));
             }
         }
     }
 }