Пример #1
0
 /**
  * Register widgets
  *
  * @since    1.0
  * @version  1.1.3
  *
  * @access  public
  */
 public function register_widgets()
 {
     //Contact widget
     if (wma_supports_subfeature('widget-contact')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-contact.php';
     }
     //Content Module widget
     if (wma_supports_subfeature('widget-module')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-module.php';
     }
     //Posts widget
     if (wma_supports_subfeature('widget-posts')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-posts.php';
     }
     //Sub navigation widget
     if (wma_supports_subfeature('widget-subnav')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-subnav.php';
     }
     //Tabbed widgets widget
     if (wma_supports_subfeature('widget-tabbed-widgets')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-tabbed-widgets.php';
     }
     //Twitter widget
     if (wma_supports_subfeature('widget-twitter')) {
         include_once WMAMP_INCLUDES_DIR . 'widgets/w-twitter.php';
     }
 }
Пример #2
0
 /**
  * Add Visual Composer plugin support
  *
  * @link  texthttp://vc.wpbakery.com/
  *
  * @todo  Support for Frontend Editor (VC4+)
  *
  * @since    1.0
  * @version  1.2.3
  *
  * @access  public
  */
 public function visual_composer_support()
 {
     //VC 4+ disabling Frontend Editor
     if (function_exists('vc_disable_frontend')) {
         vc_disable_frontend();
     }
     //VC additional shortcodes admin interface
     $vc_shortcodes_admin_tweaks = apply_filters('wmhook_shortcode_' . 'vc_shortcodes_admin_tweaks_file', $this->page_builder_dir . 'visual-composer/visual-composer.php');
     require_once $vc_shortcodes_admin_tweaks;
     //VC setup screen modifications
     add_filter('vc_settings_tabs', array($this, 'visual_composer_setup'));
     delete_option('wpb_js_use_custom');
     //Disable VC Guide Tour
     if (function_exists('vc_editor_post_types')) {
         foreach (vc_editor_post_types() as $post_type) {
             add_filter('vc_ui-pointers-' . $post_type, '__return_empty_array', 999);
         }
     }
     //VC extending shortcode parameters
     add_shortcode_param('wm_radio', array($this, 'visual_composer_custom_field_wm_radio'));
     //Remove default VC elements (only if current theme supports this)
     if (function_exists('vc_remove_element') && (wma_supports_subfeature('remove_vc_shortcodes') || wma_supports_subfeature('remove-vc-shortcodes')) && class_exists('WPBMap')) {
         $vc_shortcodes_all = array_keys(WPBMap::getShortCodes());
         $vc_shortcodes_keep = array('vc_row', 'vc_row_inner', 'vc_column', 'vc_column_inner', 'vc_raw_html', 'vc_raw_js', 'contact-form-7', 'gravityform', 'layerslider_vc', 'rev_slider_vc');
         // Do not remove custom mapped shortcodes via WP admin
         if (class_exists('Vc_Automap_Model') && is_callable('Vc_Automap_Model::findAll')) {
             $vc_shortcodes_custom = Vc_Automap_Model::findAll();
             foreach ($vc_shortcodes_custom as $shortcode) {
                 $vc_shortcodes_keep[] = $shortcode->tag;
             }
         }
         $vc_shortcodes_keep = apply_filters('wmhook_shortcode_' . 'vc_keep', $vc_shortcodes_keep);
         $vc_shortcodes_remove = apply_filters('wmhook_shortcode_' . 'vc_remove', array_diff($vc_shortcodes_all, $vc_shortcodes_keep));
         //Array check required due to filter applied above
         if (is_array($vc_shortcodes_remove) && !empty($vc_shortcodes_remove)) {
             foreach ($vc_shortcodes_remove as $shortcode) {
                 vc_remove_element($shortcode);
             }
         }
     }
     //Add custom VC elements
     if (function_exists('vc_map') && !empty(self::$codes['vc_plugin'])) {
         ksort(self::$codes['vc_plugin']);
         foreach (self::$codes['vc_plugin'] as $shortcode) {
             //simple validation (as of http://kb.wpbakery.com/index.php?title=Vc_map, the below 2 parameters are required)
             if (!isset($shortcode['name']) || !isset($shortcode['base'])) {
                 continue;
             }
             //sort shortcode parameters array
             if (isset($shortcode['params'])) {
                 ksort($shortcode['params']);
             }
             // Fix required for Visual Composer 4.5.2+
             $shortcode['params'] = array_values($shortcode['params']);
             vc_map($shortcode);
         }
     }
 }
Пример #3
0
 function wma_is_active_vc()
 {
     // Requirements check
     if (wma_supports_subfeature('disable-visual-composer-support')) {
         return false;
     }
     // Output
     return apply_filters('wmhook_wmamp_wma_is_active_vc_output', class_exists('Vc_Manager') || class_exists('WPBakeryVisualComposer'));
 }