/** * Autoload shortcodes & sub shortcodes * @param string $path */ public static function autoload_shortcodes($path) { $items = substr_count($path, '/item'); $postfix = str_repeat('Item_', $items); // autoload shortcodes WR_Megamenu_Loader::register($path, 'WR_' . $postfix); }
* Search a file in registered paths. * * @param string $file Relative file path to search for. * * @return string */ public static function get_path($file) { // Generate alternative file name $slave = str_replace('_', '-', $file); // Filter paths to search for file self::$paths = apply_filters('wr_mm_loader_get_path', self::$paths); foreach (array_reverse(self::$paths) as $base => $prefixes) { if (@is_file($base . '/' . $slave)) { return $base . '/' . $slave; } elseif (@is_file($base . '/' . $file)) { return $base . '/' . $file; } } return null; } } // Register class autoloader with PHP spl_autoload_register(array('WR_Megamenu_Loader', 'load')); // Register base path to look for class file WR_Megamenu_Loader::register(dirname(__FILE__), 'WR_'); // Include plugin definition file if (@is_file(dirname(dirname(__FILE__)) . '/defines.php')) { include_once dirname(dirname(__FILE__)) . '/defines.php'; } }
/** * Register Path to extended Parameter type * * @param string $path */ public function register_extended_parameter_path($path) { WR_Megamenu_Loader::register($path, 'WR_Megamenu_Helpers_Html_'); }
* * Websites: http://www.woorockets.com * Technical Support: Feedback - http://www.woorockets.com */ define('WR_MEGAMENU_ROOT_PATH', plugin_dir_path(__FILE__)); define('WR_MEGAMENU_ROOT_URL', plugin_dir_url(__FILE__)); define('WR_MEGAMENU_MAIN_FILE', WR_MEGAMENU_ROOT_PATH . 'main.php'); define('WR_MEGAMENU_BUILDER_ENTRY_URL', admin_url('admin.php?page=wr-megamenu-builder')); define('WR_MEGAMENU_META_KEY', '_wr_megamenu_'); define('WR_MEGAMENU_OPTION_KEY', 'wr-megamenu-megaed-menus'); define('WR_MEGAMENU_TMP_WIDGET_OPTION', 'wr-megamenu-tmp-widget-settings'); // Text domain for WR MegaMenu plugin define('WR_MEGAMENU_TEXTDOMAIN', 'wr-megamenu'); // Define absolute path of shortcodes folder define('WR_MEGAMENU_LAYOUT_PATH', WR_MEGAMENU_ROOT_PATH . 'includes/shortcode/layout'); define('WR_MEGAMENU_ELEMENT_PATH', WR_MEGAMENU_ROOT_PATH . 'shortcodes'); define('WR_MEGAMENU_ELEMENT_URL', WR_MEGAMENU_ROOT_URL . 'shortcodes'); // Define nonce ID define('WR_MEGAMENU_NONCE', 'wr_nonce_check'); // Define product identified name define('WR_MEGAMENU_IDENTIFIED_NAME', 'wr_megamenu'); // Define URL to load element editor define('WR_MEGAMENU_URL', admin_url('admin.php?wr-mm-gadget=edit-element')); // Define Custom Post Type name define('WR_MEGAMENU_POST_TYPE_NAME', 'wr_megamenu_profile'); // Define absolute path of templates folder define('WR_MEGAMENU_TPL_PATH', WR_MEGAMENU_ROOT_PATH . 'templates'); //// Register extra path and class suffix with class auto-loader WR_Megamenu_Loader::register(WR_MEGAMENU_ROOT_PATH . 'includes', 'WR_Megamenu_'); WR_Megamenu_Loader::register(WR_MEGAMENU_ROOT_PATH . 'includes/plugin', 'WR_Megamenu_');