Exemple #1
0
 function wma_bb_shortcode_def($shortcode, $property = '')
 {
     // Helper variables
     $output = '';
     $def = wma_shortcodes()->get_definitions();
     $def = $def['bb_plugin'];
     $custom_modules_category = apply_filters('wmhook_shortcode_wma_bb_shortcode_def_category_custom_name', _x('Theme Modules', 'Page builder modules category name.', 'webman-amplifier'));
     if (apply_filters('wmhook_shortcode_wma_bb_shortcode_def_category_advanced', false, $shortcode)) {
         $custom_modules_category = __('Advanced Modules', 'fl-builder');
         // Taking translation from Beaver Builder plugin
     }
     // Processing
     if ('all' === $shortcode) {
         $output = $def;
         // Get the array of definitions for all BB supported shortcodes
     } elseif (isset($def[$shortcode])) {
         $output = wp_parse_args($def[$shortcode], array('name' => '-', 'description' => '', 'category' => $custom_modules_category, 'enabled' => true, 'editor_export' => true, 'dir' => trailingslashit(WMAMP_INCLUDES_DIR) . 'shortcodes/page-builder/beaver-builder/modules/', 'url' => trailingslashit(WMAMP_INCLUDES_URL) . 'shortcodes/page-builder/beaver-builder/modules/', 'partial_refresh' => true, 'output' => '', 'output_children' => '', 'params' => array(), 'params_children' => array(), 'form' => array(), 'form_children' => array()));
         // Allow filtering
         $output = apply_filters('wmhook_shortcode_wma_bb_shortcode_def_output', $output, $shortcode);
         // Put all BB module registration values into a single array
         $output['register'] = array('name' => $output['name'], 'description' => $output['description'], 'category' => $output['category'], 'enabled' => $output['enabled'], 'editor_export' => $output['editor_export'], 'dir' => $output['dir'], 'url' => $output['url'], 'partial_refresh' => $output['partial_refresh']);
         if ($property && isset($output[$property])) {
             $output = $output[$property];
         } elseif ($property && !isset($output[$property])) {
             $output = '';
         }
     }
     // Output
     return $output;
 }
 /**
  * Register shortcodes
  *
  * @since    1.0
  * @version  1.1
  *
  * @access  public
  *
  * @uses  WM_Shortcodes
  */
 public function register_shortcodes()
 {
     if (apply_filters('wmhook_wmamp_' . 'enable_shortcodes', true) && !wma_supports_subfeature('disable-shortcodes')) {
         require WMAMP_INCLUDES_DIR . 'shortcodes/class-shortcodes.php';
         return wma_shortcodes();
     }
 }
/**
 * Visual Editor custom plugin
 *
 * @since    1.0
 * @version  1.2.2
 *
 * @param  array $plugins_array
 */
function wma_ve_custom_mce_plugin($plugins_array = array())
{
    // 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 $plugins_array;
    }
    // Processing
    $plugins_array['wmShortcodes'] = WMAMP_ASSETS_URL . 'js/shortcodes-button.js';
    // Output
    return $plugins_array;
}