Exemple #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;
 }
Exemple #2
0
function add_parent_url_menu_class($classes = array(), $item = false)
{
    // Get current URL
    $current_url = ricUtil::current_url();
    // Get homepage URL
    $homepage_url = trailingslashit(get_bloginfo('url'));
    // Exclude 404 and homepage
    if (is_404() or $item->url == $homepage_url) {
        return $classes;
    }
    if (strstr($current_url, $item->url) or strstr($current_url, get_permalink($item->ID))) {
        // Add the 'parent_url' class
        $classes[] = 'parent_url';
    }
    return $classes;
}
Exemple #3
0
 function opt($name, $echo = false)
 {
     return ricUtil::opt($name, $echo);
 }
Exemple #4
0
 static function table($args = array())
 {
     $defaults = array('columns' => array('Column 1', 'Column 2'), 'data' => array(), 'table_class' => 'widefat page fixed', 'table_id' => false, 'echo' => true, 'footer' => true);
     // Parse the arguments and extract them for easy variable naming
     extract(wp_parse_args($args, $defaults));
     $r = '';
     // Table header and footer
     $head_columns = '';
     foreach ($columns as $column) {
         $slug = ricUtil::slugify($column);
         $head_columns .= '<th scope="col" id="' . $slug . '" class="manage-column" style="">' . $column . '</th>';
     }
     $r .= '<thead><tr>' . $head_columns . '</tr></thead>';
     if ($footer) {
         $r .= '<tfoot><tr>' . $head_columns . '</tr></tfoot>';
     }
     // Table data
     $i = 0;
     foreach ($data as $id => $columns) {
         $class = $i % 2 ? 'alternate iedit' : 'iedit';
         $r .= '<tr id="row-' . $id . '" class="' . $class . '">';
         foreach ($columns as $k => $v) {
             $r .= '<td class="column-' . $k . '">' . $v . '</td>';
         }
         $i++;
     }
     // Table class and ID
     $table_atts = array('class' => $table_class ? $table_class : '', 'id' => $table_id ? $table_id : '', 'cellspacing' => '0');
     $r = html('table', $table_atts, $r);
     if ($echo) {
         echo $r;
     }
     return $r;
 }
Exemple #5
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));
             }
         }
     }
 }
Exemple #6
0
css/reset.css" media="screen, projection">
<link rel="stylesheet" href="<?php 
echo PT_URL;
?>
css/global.css" media="screen, projection">
<!--<![endif]-->

<!--[if IE 6]>
<link rel="stylesheet" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" media="screen, projection">
<![endif]-->

<?php 
/**** JavaScript ****/
ricUtil::jquery();
ricUtil::js('js/assets/modernizr-1.5.min.js');
ricUtil::js('js/global.js', true);
/**** JavaScript Options ****/
$options = array();
if (count($options)) {
    wp_localize_script('ric-global-js', 'globalOptions', $options);
}
?>

<?php 
wp_head();
?>
</head>

<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <body class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <body class="ie8"> <![endif]-->