Esempio n. 1
0
 function requireDir($dir)
 {
     $dh = @opendir($dir);
     if (!$dh) {
         throw new Exception("Cannot open directory {$dir}");
     } else {
         while ($file = readdir($dh)) {
             $files[] = $file;
         }
         closedir($dh);
         sort($files);
         //ensure alpha order
         foreach ($files as $file) {
             if ($file != '.' && $file != '..') {
                 $requiredFile = $dir . DIRECTORY_SEPARATOR . $file;
                 if ('.php' === substr($file, strlen($file) - 4)) {
                     require_once $requiredFile;
                 } elseif (is_dir($requiredFile)) {
                     requireDir($requiredFile);
                 }
             }
         }
     }
     unset($dh, $dir, $file, $requiredFile);
 }
Esempio n. 2
0
 function requireDir($dir)
 {
     $dh = @opendir($dir);
     if (!$dh) {
         throw new Exception("Cannot open directory {$dir}");
     } else {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $requiredFile = $dir . DIRECTORY_SEPARATOR . $file;
                 if ('.php' === substr($file, strlen($file) - 4)) {
                     require_once $requiredFile;
                 } elseif (is_dir($requiredFile)) {
                     requireDir($requiredFile);
                 }
             }
         }
         closedir($dh);
     }
     unset($dh, $dir, $file, $requiredFile);
 }
Esempio n. 3
0
 /**
  * PHP 5 Constructor
  */
 function __construct()
 {
     //"Constants" setup
     $this->plugin_url = plugin_dir_url(__FILE__) . '/';
     $this->plugin_path = plugin_dir_path(__FILE__) . '/';
     //Initialize the options
     $this->get_options();
     //check requirements
     register_activation_hook(__FILE__, array(&$this, 'check_requirements'));
     //get sub-packages
     requireDir(plugin_dir_path(__FILE__) . '/lib/inc');
     //here are some examples to get started with
     if (class_exists('PageTemplater')) {
         add_action('plugins_loaded', array('PageTemplater', 'get_instance'));
     }
     if (class_exists('MSDSimpleSectionedPage')) {
         add_action('admin_print_footer_scripts', array('MSDSimpleSectionedPage', 'info_footer_hook'), 100);
         add_action('admin_enqueue_scripts', array('MSDSimpleSectionedPage', 'enqueue_admin'));
     }
     if (class_exists('MSDSectionedPage')) {
         add_action('admin_print_footer_scripts', array('MSDSectionedPage', 'info_footer_hook'), 100);
         add_action('admin_enqueue_scripts', array('MSDSectionedPage', 'enqueue_admin'));
         add_action('init', array('MSDSectionedPage', 'add_metaboxes'));
     }
 }
Esempio n. 4
0
 /**
  * PHP 5 Constructor
  */
 function __construct()
 {
     //"Constants" setup
     $this->plugin_url = plugin_dir_url(__FILE__) . '/';
     $this->plugin_path = plugin_dir_path(__FILE__) . '/';
     //Initialize the options
     $this->get_options();
     //check requirements
     register_activation_hook(__FILE__, array(&$this, 'check_requirements'));
     //get sub-packages
     requireDir(plugin_dir_path(__FILE__) . '/lib/inc');
     add_action('wp_enqueue_scripts', array(&$this, 'maybe_load_bootstrap'), 30);
     //here are some examples to get started with
     if (class_exists('MSDBootstrapShortcodes')) {
         add_action('plugins_loaded', array('MSDBootstrapShortcodes', 'get_instance'));
     }
 }
Esempio n. 5
0
 /**
  * PHP 5 Constructor
  */
 function __construct()
 {
     //"Constants" setup
     $this->plugin_url = plugin_dir_url(__FILE__) . '/';
     $this->plugin_path = plugin_dir_path(__FILE__) . '/';
     //Initialize the options
     $this->get_options();
     //check requirements
     register_activation_hook(__FILE__, array(&$this, 'check_requirements'));
     //get sub-packages
     requireDir(plugin_dir_path(__FILE__) . '/lib/inc');
     //here are some examples to get started with
     if (class_exists('MSDCountyCPT')) {
         $this->county_class = new MSDCountyCPT();
         register_activation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
         register_deactivation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
     }
     if (class_exists('MSDEventCPT')) {
         $this->event_class = new MSDEventCPT();
         register_activation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
         register_deactivation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
     }
     if (class_exists('MSDInvolvedCPT')) {
         $this->event_class = new MSDInvolvedCPT();
         register_activation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
         register_deactivation_hook(__FILE__, create_function('', 'flush_rewrite_rules();'));
     }
 }