/** * Enqueuing required assets * * @since 1.1 * @version 1.2.2 */ function wma_ve_assets() { // Helper variables global $pagenow; $codes = is_callable('wma_shortcodes') ? wma_shortcodes()->get_definitions() : array('generator' => null); $admin_pages = apply_filters('wmhook_wmamp_' . 'generator_admin_pages', array('post.php', 'post-new.php')); // Requirements check if (empty($codes['generator']) || is_admin() && !in_array($pagenow, $admin_pages) || !is_admin() && (!class_exists('FLBuilderModel') || !FLBuilderModel::is_builder_active())) { return; } $post_type = get_post_type(); $supported_post_types = array('beaver-builder' => get_option('_fl_builder_post_types') ? (array) get_option('_fl_builder_post_types') : array('page'), 'visual-composer' => get_option('wpb_js_content_types') ? (array) get_option('wpb_js_content_types') : array('page')); /** * Enqueue */ /** * Shortcode generator: standard */ // Styles wp_enqueue_style('wm-shortcodes-generator', WMAMP_ASSETS_URL . 'css/shortcodes-generator.css', array(), WMAMP_VERSION, 'screen'); if (is_rtl()) { wp_enqueue_style('wm-shortcodes-generator-rtl', WMAMP_ASSETS_URL . 'css/rtl-shortcodes-generator.css', array(), WMAMP_VERSION, 'screen'); } // Scripts: inline wp_localize_script('jquery', 'wmShortcodesArray', array_values(wma_ksort((array) $codes['generator']))); /** * Shortcode generator: short * * Supported in page builders. */ if (!empty($codes['generator_short']) && (!is_admin() && in_array($post_type, $supported_post_types['beaver-builder']) || wma_is_active_vc() && in_array($post_type, $supported_post_types['visual-composer']))) { // Scripts: inline wp_localize_script('jquery', 'wmShortcodesArrayShort', array_values(wma_ksort((array) $codes['generator_short']))); } }
/** * Enqueue backend (admin) styles and scripts for Visual Composer * * @since 1.2.9 * @version 1.3.6 * * @access public */ public function assets_backend_vc() { // Requirements check if (!current_user_can($this->editor_capability)) { return; } // Helper variables global $pagenow, $post_type; $admin_pages = array('post.php', 'post-new.php'); $vc_backend_dependencies = defined('WPB_VC_VERSION') && version_compare(WPB_VC_VERSION, '4.9', '<') ? array('wpb_js_composer_js_atts', 'wpb_js_composer_js_custom_views') : array('vc-backend-min-js'); // Processing // Visual Composer plugin integration $vc_supported_post_types = get_option('wpb_js_content_types') ? (array) get_option('wpb_js_content_types') : array('page'); if (in_array($pagenow, apply_filters('wmhook_shortcode_' . 'vc_admin_pages', $admin_pages)) && wma_is_active_vc() && in_array($post_type, $vc_supported_post_types) && defined('WPB_VC_VERSION')) { // Styles wp_enqueue_style('wm-shortcodes-vc-addon', WMAMP_ASSETS_URL . 'css/shortcodes-vc-addons.css', array(), WMAMP_VERSION, 'screen'); wp_enqueue_style('wm-radio', WMAMP_ASSETS_URL . 'css/input-wm-radio.css', array(), WMAMP_VERSION, 'screen'); // Scripts wp_enqueue_script('wm-shortcodes-vc-addon', WMAMP_ASSETS_URL . 'js/shortcodes-vc-addons.js', (array) $vc_backend_dependencies, WMAMP_VERSION, true); /** * Yes, we need to set the whole `wp_enqueue_style/script()` function as Visual Composer loads * assets strangely and those handles are not registered yet. */ } // Allow hooking for dequeuing do_action('wmhook_shortcode_' . 'assets_backend_vc_enqueued'); }
function wma_is_active_page_builder() { //Output return apply_filters('wmhook_wmamp_' . 'wma_is_active_page_builder_output', wma_is_active_vc() || class_exists('FLBuilderModel') && FLBuilderModel::is_builder_enabled()); }
/** * Modifying page builder parameters * * @version 1.6 */ function wm_modify_shortcodes_definitions($definitions) { // Processing // Beaver Builder // Content Module unset($definitions['content_module']['bb_plugin']['form']['general']['sections']['multiple']['fields']['filter']); unset($definitions['content_module']['bb_plugin']['form']['general']['sections']['multiple']['fields']['pagination']); unset($definitions['content_module']['bb_plugin']['form']['description']); unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['no_margin']); unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['image_size']); unset($definitions['content_module']['bb_plugin']['form']['others']['sections']['general']['fields']['layout']); // Posts unset($definitions['posts']['bb_plugin']['form']['description']); unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['filter_layout']); unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['related']); unset($definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['image_size']); // Adding "layout" parameter $definitions['posts']['bb_plugin']['output'] = str_replace('[PREFIX_posts', '[PREFIX_posts{{layout}}', (string) $definitions['posts']['bb_plugin']['output']); $definitions['posts']['bb_plugin']['params'] = array_merge(array('layout'), (array) $definitions['posts']['bb_plugin']['params']); $definitions['posts']['bb_plugin']['form']['others']['sections']['general']['fields']['layout'] = array('type' => 'select', 'label' => esc_html__('Layout', 'mustang'), 'options' => array('' => esc_html__('Default layout', 'mustang'), 'simple' => esc_html__('Simple posts or projects layout', 'mustang')), 'preview' => array('type' => 'refresh')); // Testimonials unset($definitions['testimonials']['bb_plugin']['form']['description']); unset($definitions['testimonials']['bb_plugin']['form']['others']['sections']['general']['fields']['no_margin']); // Visual Composer if (function_exists('wma_is_active_vc') && wma_is_active_vc()) { foreach ($definitions as $key => $atts) { if (!in_array($key, array('vc_row', 'vc_row_inner')) && isset($atts['vc_plugin'])) { $definitions[$key]['vc_plugin']['category'] = esc_html__('Theme Modules', 'mustang'); $definitions[$key]['vc_plugin']['icon'] = wm_get_stylesheet_directory_uri('assets/img/webman-32x32.png'); } } // Posts $definitions['posts']['vc_plugin']['params'][30]['value'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9); $definitions['posts']['vc_plugin']['params'][145] = array('heading' => __('Output layout', 'mustang'), 'description' => __('Set optional output layout name. You can use <code>simple</code> with <em>Posts</em> and <em>Projects</em> posts.', 'mustang'), 'type' => 'textfield', 'param_name' => 'layout', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Layout', 'mustang')); // Row $definitions['vc_row']['vc_plugin']['params'][5] = array('heading' => __('Remove section inner container', 'mustang'), 'description' => __('This is only relevant when using "Fullwidth sections" page layout.', 'mustang'), 'type' => 'checkbox', 'param_name' => 'disable_container', 'value' => '', 'value' => array(__('Remove the inner Section container to make the content fill the whole section without any paddings.', 'mustang') => 1), 'holder' => 'hidden', 'class' => ''); $definitions['vc_row']['vc_plugin']['params'][90] = array('heading' => __('Section background video URL', 'mustang'), 'description' => __('Set optional section background video URL. Video will be played automatically in a loop.', 'mustang'), 'type' => 'textfield', 'param_name' => 'video_url', 'value' => '', 'holder' => 'hidden', 'class' => '', 'group' => __('Styling', 'mustang')); // Column $definitions['vc_column']['vc_plugin']['params'][5] = array('heading' => __('Background image', 'mustang'), 'description' => __('The image will cover the column background', 'mustang'), 'type' => 'attach_image', 'param_name' => 'bg_image', 'value' => '', 'holder' => 'hidden', 'class' => ''); // Slideshow $definitions['slideshow']['vc_plugin']['params'][20]['value'] = array(__('Just Next/Prev button', 'mustang') => '', __('Next/Prev + Pagination', 'mustang') => 'pagination'); // bbPress if (class_exists('bbPress')) { //Forum index $definitions['bbp-forum-index'] = array('vc_plugin' => array('name' => __('Forums Index', 'mustang'), 'base' => 'bbp-forum-index', 'class' => 'wm-shortcode-vc-bbp-forum-index', 'category' => __('Forum', 'mustang'), 'show_settings_on_create' => false, 'params' => array(10 => array('heading' => '<a href="http://codex.bbpress.org/shortcodes/" target="_blank"><strong>' . __('bbPress Shortcode', 'mustang') . '</strong></a>', 'description' => __('This will display your entire forum index. No parameters to be set.', 'mustang'), 'type' => 'wm_html', 'param_name' => 'forums', 'value' => '', 'holder' => 'hidden', 'class' => '')))); } } // Output return $definitions; }
return '<div class="' . $atts['class'] . '"' . $atts['style'] . '>' . $atts['content'] . '</div>'; } // /wm_column_markup add_filter('wmhook_shortcode_column_output', 'wm_column_markup', 10, 2); add_filter('wmhook_shortcode_vc_column_output', 'wm_column_markup', 10, 2); /** * VISUAL COMPOSER PLUGIN SUPPORT * * Please note that this is 3rd party plugin. The WebMan Amplifier plugin * just integrates its shortcodes feature with the Visual Composer plugin * to make it easier to create content. If you have any difficulties * with Visual Composer plugin, please contact its developers. * * @link http://codecanyon.net/item/visual-composer-for-wordpress/242431 */ if (function_exists('wma_is_active_vc') && wma_is_active_vc()) { /** * Remove default Visual Composer elements (shortcodes) */ add_theme_support('webman-shortcodes', array('remove_vc_shortcodes')); /** * Deregister VC frontend JS * * This script is not needed and causing issues. * * @since 1.4 * @version 1.4 */ function wm_deregister_visual_composer_front_js() { wp_deregister_script('wpb_composer_front_js');
$shortcode_definitions['soliloquy'] = array('since' => '1.0', 'vc_plugin' => array('name' => __('Soliloquy Slider', 'webman-amplifier'), 'base' => 'soliloquy', 'class' => 'wm-shortcode-vc-soliloquy', 'icon' => 'icon-wpb-images-carousel', 'category' => __('Media', 'webman-amplifier'), 'params' => array(10 => array('heading' => __('Choose a Soliloquy slider', 'webman-amplifier'), 'description' => '', 'type' => 'dropdown', 'param_name' => 'id', 'value' => array_flip(wma_posts_array('post_name', 'soliloquy')), 'holder' => 'hidden', 'class' => '')))); } /** * Master Slider * * @since 1.0.9 */ if (function_exists('get_masterslider_names')) { $shortcode_definitions['masterslider'] = array('since' => '1.0.9', 'vc_plugin' => array('name' => __('Master Slider', 'webman-amplifier'), 'base' => 'masterslider', 'class' => 'wm-shortcode-vc-masterslider', 'icon' => 'icon-wpb-images-carousel', 'category' => __('Media', 'webman-amplifier'), 'params' => array(10 => array('heading' => __('Choose a slider', 'webman-amplifier'), 'description' => '', 'type' => 'dropdown', 'param_name' => 'id', 'value' => $empty + get_masterslider_names(false), 'holder' => 'hidden', 'class' => '')))); } /** * Render certain VC shortcodes even when the plugin is disabled * * @since 1.0 */ if (!wma_is_active_vc()) { /** * vc_row */ $shortcode_definitions['vc_row'] = array('since' => '1.0', 'custom_prefix' => '', 'renderer' => array('alias' => 'row')); /** * vc_row_inner */ $shortcode_definitions['vc_row_inner'] = array('since' => '1.0', 'custom_prefix' => '', 'renderer' => array('alias' => 'row')); /** * vc_column */ $shortcode_definitions['vc_column'] = array('since' => '1.0', 'custom_prefix' => '', 'renderer' => array('alias' => 'column')); /** * vc_column_inner */