Example #1
0
 public static function parse_md($text)
 {
     if (!class_exists('Parsedown')) {
         $path = VP_FileSystem::instance()->resolve_path('includes', 'parsedown');
         require $path;
     }
     return Parsedown::instance()->parse($text);
 }
Example #2
0
 public static function parse_md($text)
 {
     if (!function_exists('Markdown')) {
         $path = VP_FileSystem::instance()->resolve_path('includes', 'markdown/parser');
         require $path;
         // require VP_INCLUDE_DIR . '/markdown/parser.php';
     }
     return Markdown($text);
 }
Example #3
0
 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'));
 }
Example #4
0
 /**
  * Load view file
  * @param  String $field_view_file Name of the view file
  * @param  Array $data Array of data to be binded on the view
  * @return String The result view
  */
 public function load($field_view_file, $data = array())
 {
     if (array_key_exists('field_view_file', $data)) {
         throw new Exception("Sorry 'field_view_file' variable name can't be used.");
     }
     $view_file = VP_FileSystem::instance()->resolve_path('views', $field_view_file);
     if ($view_file === false) {
         throw new Exception("View file not found.");
     }
     extract($data);
     ob_start();
     include $view_file;
     return ob_get_clean();
 }
Example #5
0
 /**
  * [taken from WPAlchemy Class by Dimas Begunoff]
  * Used to check for the current post type, works when creating or editing a
  * new post, page or custom post type.
  *
  * @static
  * @return	string [custom_post_type], page or post
  */
 public static function get_current_post_type()
 {
     if (!class_exists('WPAlchemy_MetaBox')) {
         require_once VP_FileSystem::instance()->resolve_path('includes', 'wpalchemy/MetaBox');
     }
     $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : NULL;
     if (isset($uri)) {
         $uri_parts = parse_url($uri);
         $file = basename($uri_parts['path']);
         if ($uri and in_array($file, array('post.php', 'post-new.php'))) {
             $post_id = WPAlchemy_MetaBox::_get_post_id();
             $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : NULL;
             $post_type = $post_id ? get_post_type($post_id) : $post_type;
             if (isset($post_type)) {
                 return $post_type;
             } else {
                 // because of the 'post.php' and 'post-new.php' checks above, we can default to 'post'
                 return 'post';
             }
         }
     }
     return NULL;
 }
Example #6
0
<?php

/**
 * Extended version of WPAlchemy Class
 * so that it can process metabox using an array specification
 * and compatible with all Vafpress Framework Option Controls.
 */
/////////////////////////////////////////
// Include original WPAlchemy Class    //
/////////////////////////////////////////
if (!class_exists('WPAlchemy_MetaBox')) {
    require_once VP_FileSystem::instance()->resolve_path('includes', 'wpalchemy/MetaBox');
}
class VP_Metabox extends WPAlchemy_MetaBox
{
    public static $pool = array();
    public $is_dev_mode = false;
    function __construct($arr)
    {
        if (!is_array($arr) and file_exists($arr)) {
            $arr = (include $arr);
        }
        parent::__construct($arr);
        // Modify title in dev mode
        if ($this->is_dev_mode) {
            $this->title = __('[Development Mode] ', 'vp_textdomain') . $this->title;
        }
        if ($this->can_output() and VP_WP_Admin::is_post_or_page()) {
            // make sure metabox template loaded
            if (!is_array($this->template) and file_exists($this->template)) {
                $this->template = (include $this->template);
Example #7
0
//////////////////////////
// Include Constants    //
//////////////////////////
require_once 'constant.php';
//////////////////////////
// Include Autoloader   //
//////////////////////////
require_once 'autoload.php';
//////////////////////////
// Load Languages       //
//////////////////////////
load_theme_textdomain('vp_textdomain', VP_DIR . '/lang');
//////////////////////////
// Setup FileSystem     //
//////////////////////////
$vpfs = VP_FileSystem::instance();
$vpfs->add_directories('views', VP_VIEWS_DIR);
$vpfs->add_directories('config', VP_CONFIG_DIR);
$vpfs->add_directories('data', VP_DATA_DIR);
$vpfs->add_directories('includes', VP_INCLUDE_DIR);
//////////////////////////
// Include Data Source  //
//////////////////////////
foreach (glob(VP_DATA_DIR . "/*.php") as $datasource) {
    require_once $datasource;
}
//////////////////////////
// TGMPA Unsetting      //
//////////////////////////
add_action('after_setup_theme', 'vp_tgm_ac_check');
if (!function_exists('vp_tgm_ac_check')) {
Example #8
0
 /**
  *
  * 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);
 }
Example #9
0
 /**
  * Add directory
  *
  * @param string $name directory namespace
  * @param string $path directory full path
  *
  * @access public
  */
 public function addDirectory($name, $path)
 {
     $vp = \VP_FileSystem::instance();
     $vp->add_directories($name, $path);
 }
Example #10
0
 /**
  * Add directories to the VP autoloader, loading process will be run in orderly fashion
  * of directory addition.
  *
  * @param string       $key
  * @param string|array $directories
  *
  * @access
  */
 protected function addVpDirectory($key, $directories)
 {
     if (class_exists('\\VP_FileSystem')) {
         $vp = \VP_FileSystem::instance();
         $vp->add_directories($key, $directories);
     }
 }