Example #1
0
 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);
         }
         add_action('init', array($this, 'register_fields'));
     }
     self::$pool[$this->id] = $this;
 }
Example #2
0
 function vp_post_dummy_editor()
 {
     /**
      * If we're in post edit page, and the post type doesn't support `editor`
      * we need to echo out a dummy editor to load all necessary js and css
      * to be used in our own called wp editor.
      */
     $loader = VP_WP_Loader::instance();
     $types = $loader->get_types();
     $dummy = false;
     if (VP_WP_Admin::is_post_or_page()) {
         $types = array_unique(array_merge($types['metabox'], $types['shortcodegenerator']));
         if (in_array('wpeditor', $types)) {
             if (!VP_ShortcodeGenerator::pool_supports_editor() and !VP_Metabox::pool_supports_editor()) {
                 $dummy = true;
             }
         }
     } else {
         $types = $types['option'];
         if (in_array('wpeditor', $types)) {
             $dummy = true;
         }
     }
     if ($dummy) {
         echo '<div style="display: none">';
         add_filter('wp_default_editor', create_function('', 'return "tinymce";'));
         wp_editor('', 'vp_dummy_editor');
         echo '</div>';
     }
 }