Ejemplo n.º 1
0
<?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
     * 
Ejemplo n.º 2
0
<?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;
}