public function extension() { // Register Views Directory $vpfs = VP_FileSystem::instance(); $vpfs->add_directories('views', VP_PF_ADMIN_DIR . '/views'); // Register Classes to Vafpress Framework's Autoloader VP_AutoLoader::add_directories(VP_PF_ADMIN_DIR . '/classes', 'VP_'); // Filter Vafpress Framework Dependencies add_filter('vp_dependencies_array', array($this, 'extension_dependencies'), null, 1); add_action('wp_ajax_vp_pf_process_portfolio', array($this, 'ajax_process_portfolio')); add_action('vp_after_dependencies_loader_build', array($this, 'extension_localize_script')); }
<?php /** * Theme functions and definitions. */ if (!isset($content_width)) { $content_width = 700; } /** * Vafpress framework ----------------------------------------------------------------------------------------------------------------------- >>>>>>>>>>> */ // load framework require_once locate_template('/vafpress/bootstrap.php'); // custom classes location VP_AutoLoader::add_directories(get_template_directory() . '/admin/classes', 'VP_'); $vpfs = VP_FileSystem::instance(); $vpfs->add_directories('views', get_template_directory() . '/admin/views'); // load various data sources for metaboxes, theme options or shortcodes require_once locate_template('/admin/data_sources.php'); // metabox $tmpl_hompage = get_template_directory() . '/admin/metabox/hom_page.php'; // cpt hom page - metaboxes $tmpl_events = get_template_directory() . '/admin/metabox/events.php'; // cpt event - metaboxes $tmpl_courses = get_template_directory() . '/admin/metabox/courses.php'; // cpt courses - metaboxes $tmpl_sliders = get_template_directory() . '/admin/metabox/sliders.php'; // cpt sliders - metaboxes $tmpl_slid_sc = get_template_directory() . '/admin/metabox/slider-sc-maker.php'; // cpt sliders - sidebar metabox $tmpl_chunk_sc = get_template_directory() . '/admin/metabox/content_chunk-sc-maker.php';
/** * ====================================================================================== * Includes * ====================================================================================== */ /** * Include Vafpress Framework */ require_once 'vafpress-framework/bootstrap.php'; require_once 'admin/data-sources.php'; /** * Lovey Dovey Vafpress Framework Extension */ $vpfs = VP_FileSystem::instance(); $vpfs->add_directories('views', LD_ADMINDIR . 'views'); VP_AutoLoader::add_directories(LD_ADMINDIR . 'classes', 'VP_'); add_filter('vp_dependencies_array', 'ld_dt_add_resources', null, 1); function ld_dt_add_resources($dependencies) { $dependencies['scripts']['paths']['qualia-dt'] = array('path' => LD_ADMINURI . 'public/datetime.js', 'deps' => array('jquery-ui-timepicker-addon'), 'ver' => '1', 'override' => false); $dependencies['scripts']['paths']['jquery-ui-timepicker-addon'] = array('path' => LD_ADMINURI . 'public/jquery-ui-timepicker-addon.min.js', 'deps' => array('jquery-ui-slider', 'jquery-ui-datepicker'), 'ver' => '1', 'override' => false); $dependencies['styles']['paths']['jquery-ui-timepicker-addon'] = array('path' => LD_ADMINURI . 'public/jquery-ui-timepicker-addon.min.css', 'deps' => array('jqui')); $dependencies['rules']['datetime'] = array('js' => array('qualia-dt'), 'css' => array('jqui', 'jquery-ui-timepicker-addon')); return $dependencies; } /** * Abstract Function to access theme_options values */ if (!function_exists('ld_option')) { function ld_option($name) {
<?php /* |-------------------------------------------------------------------------- | Register AutoLoader |-------------------------------------------------------------------------- | Vafpress Framework has separated app and core directories, developers can | put their extension code and configuration at app folder, as everything | inside app will be loaded first and will override class with the same | name with core classes. */ VP_AutoLoader::add_namespaces(VP_NAMESPACE); VP_AutoLoader::add_directories(VP_CLASSES_DIR, VP_NAMESPACE); VP_AutoLoader::register(); class VP_AutoLoader { /** * Indicates if VP_AutoLoader has been registered. * * @var boolean */ protected static $registered = false; /** * The registered directories * * @var array */ protected static $directories = array(); /** * THe registered namespaces *
/** * * Add some extra fields class and fixes for VP * * @access private */ private function vpFix() { \VP_AutoLoader::remove_directories(VP_CLASSES_DIR, VP_NAMESPACE); $classes = SILVERWP_LIBS_PATH . 'ssvafpress/classes/'; \VP_AutoLoader::add_directories($classes, VP_NAMESPACE); \VP_AutoLoader::add_directories(VP_CLASSES_DIR, VP_NAMESPACE); \VP_AutoLoader::register(); $vp = \VP_FileSystem::instance(); $vp->remove_directories('views'); $views = SILVERWP_LIBS_PATH . 'ssvafpress/views'; $vp->add_directories('views', $views); $vp->add_directories('views', ABSPATH . 'Views'); $vp->add_directories('views', VP_VIEWS_DIR); FileSystem::getInstance()->addDirectory('ssvp_views', $views); }
<?php global $pagenow; // using core namespace VP_AutoLoader::add_directories(SH_TH_ROOT . 'includes/vp_new', 'VP_'); // using your own namespace VP_AutoLoader::add_namespaces('MY_'); VP_AutoLoader::add_directories(SH_TH_ROOT . 'includes/vp_new/classes', 'MY_'); add_filter('vp_field_type_from_class_prefix', 'MY_Class_Prefixes', null, 1); function MY_Class_Prefixes($prefixes) { $prefixes[] = 'MY_'; return $prefixes; } add_filter('vp_field_class_from_type_prefix', 'MY_Type_Prefixes', null, 2); function MY_Type_Prefixes($prefix, $type) { if ($type === 'builder') { return 'MY_'; } return $prefix; } $vpfs = VP_FileSystem::instance(); $vpfs->add_directories('views', SH_TH_ROOT . 'includes/vp_new/views'); add_filter('vp_alphabet_validatable', 'my_alphabet_validatable'); function my_alphabet_validatable($validatable) { // Use 'vp-' + your control name, not full class name. $validatable[] = 'vp-builder'; return $validatable; }
<?php global $pagenow; // using core namespace VP_AutoLoader::add_directories(get_template_directory() . '/includes/vp_new', 'VP_'); // using your own namespace VP_AutoLoader::add_namespaces('MY_'); VP_AutoLoader::add_directories(get_template_directory() . '/includes/vp_new/classes', 'MY_'); add_filter('vp_field_type_from_class_prefix', 'MY_Class_Prefixes', null, 1); function MY_Class_Prefixes($prefixes) { $prefixes[] = 'MY_'; return $prefixes; } add_filter('vp_field_class_from_type_prefix', 'MY_Type_Prefixes', null, 2); function MY_Type_Prefixes($prefix, $type) { if ($type === 'builder') { return 'MY_'; } return $prefix; } $vpfs = VP_FileSystem::instance(); $vpfs->add_directories('views', get_template_directory() . '/includes/vp_new/views'); add_filter('vp_alphabet_validatable', 'my_alphabet_validatable'); function my_alphabet_validatable($validatable) { // Use 'vp-' + your control name, not full class name. $validatable[] = 'vp-builder'; return $validatable; }