Esempio n. 1
0
function include_files_in_dir($dir, $no_more = false, $f_name = null)
{
    $dir_init = $dir;
    $dir = dirname(__FILE__) . $dir;
    if (!file_exists($dir)) {
        throw new Exception("Folder {$dir} does not exist");
    }
    $files = array();
    if ($handle = opendir($dir)) {
        while (false !== ($file = @readdir($handle))) {
            if (is_dir($dir . $file) && !preg_match('/^\\./', $file) && !$no_more) {
                include_files_in_dir($dir_init . $file . "/", true, $f_name);
            } else {
                if ($f_name && $f_name == $file) {
                    $files[] = $dir . $file;
                } elseif (!$f_name && preg_match('/^[^~]{1}.*\\.php$/', $file)) {
                    $files[] = $dir . $file;
                }
            }
        }
        @closedir($handle);
    }
    sort($files);
    foreach ($files as $file) {
        include_once $file;
    }
}
Esempio n. 2
0
 /**
  * Module Loader 
  */
 function miss_load_modules()
 {
     include_files_in_dir("/../modules/", false, 'init.php');
 }
Esempio n. 3
0
// include core functions
require_once 'core-functions.php';
// include metabox functions
require_once 'includes/metabox-functions.php';
require_once 'includes/core-metaboxes.php';
// include menu functions
require_once 'menu/core-menu.php';
require_once 'includes/lib.php';
require_once 'includes/stylesheet-functions.php';
// set content width
global $content_width;
if (!isset($content_width)) {
    $content_width = 630;
}
// add modules
include_files_in_dir("/../modules/", false, 'init.php');
/* Set up theme defaults and registers support for various WordPress features. */
add_action('after_setup_theme', 'dt_init');
if (!function_exists('dt_init')) {
    function dt_init()
    {
        // for translate purpose
        if (function_exists('load_theme_textdomain')) {
            load_theme_textdomain(LANGUAGE_ZONE, get_template_directory() . '/languages');
        }
        /* menu slot */
        register_nav_menu('primary-menu', __('Primary Menu', LANGUAGE_ZONE));
        if (function_exists('add_theme_support')) {
            /* add theme support images */
            add_theme_support('post-thumbnails');
            /* add automatic feeds support */
Esempio n. 4
0
<?php

// add widgets
include_files_in_dir("/../../widgets/", false);
function dt_widgets_init()
{
    if (function_exists('of_get_option')) {
        $option = apply_filters('dt_setup_widgets_field', 'of_generatortest2');
        $w_areas = apply_filters('dt_setup_widgets_sidebars_list', of_get_option($option, false));
        $w_params_def = array('before_widget' => '<div class="widget-t"></div><div class="widget">', 'after_widget' => '</div><div class="widget-b"></div>', 'before_title' => '<div class="header">', 'after_title' => '</div>');
        $w_params = apply_filters('dt_setup_widgets_params', $w_params_def);
        if (is_array($w_areas)) {
            $prefix = 'sidebar_';
            foreach ($w_areas as $index => $sidebar) {
                //                $w_params = apply_filters( 'dt_setup_widgets_params_' . $prefix . $index, $w_params_def );
                //                $w_params = wp_parse_args( $w_params, $w_params_def );
                register_sidebar(array('name' => $sidebar['sidebar_name'], 'id' => $prefix . $index, 'description' => sprintf('%1$s', $sidebar['sidebar_desc'], $prefix . $index), 'before_widget' => $w_params['before_widget'], 'after_widget' => $w_params['after_widget'], 'before_title' => $w_params['before_title'], 'after_title' => $w_params['after_title']));
            }
        }
    }
}
add_action('widgets_init', 'dt_widgets_init');