Пример #1
0
 /**
  * Constructor.
  *
  * @param   array  $config  Field declaration.
  * @param   array  $merge   Array of property should be merged.
  *
  * @return  void
  */
 public function __construct($config, $merge = array('attributes', 'choices'))
 {
     // Get all themes for mega menu
     $path = apply_filters('wr_megamenu_themes', WR_MEGAMENU_ROOT_PATH . 'themes');
     $files = WR_Megamenu_Helpers_Functions::get_theme_styles($path);
     $this->choices = $files;
     // Call parent method to do remaining initialization
     parent::__construct($config, $merge);
 }
Пример #2
0
 public function __construct()
 {
     $this->type = 'layout';
     $this->config['el_type'] = 'element';
     $this->element_config();
     $this->element_items();
     $this->shortcode_data();
     /* add shortcode */
     add_shortcode($this->config['shortcode'], array(&$this, 'element_shortcode'));
     // enqueue custom script for current element
     if (WR_Megamenu_Helpers_Functions::is_modal_of_element($this->config['shortcode'])) {
         WR_Megamenu_Helpers_Functions::shortcode_enqueue_assets($this, 'admin_assets', '');
     }
 }
Пример #3
0
 /**
  * Icons
  * @param type $element
  * @return string
  */
 static function render($element)
 {
     $element = parent::get_extra_info($element);
     $label = parent::get_label($element);
     $item_id = isset($element['item_id']) ? $element['item_id'] : '';
     $icon_id = $item_id != '' ? '-' . $item_id : '';
     $output = "<div id='icon_selector" . $icon_id . "' class='icon_selector' data-item_id='" . $item_id . "'>\n\t\t\t<input type='hidden' value='{$element['std']}' id='{$element['id']}' DATA_INFO />\n\t\t</div>";
     if (WR_Megamenu_Helpers_Functions::is_modal()) {
         add_filter('wr_mm_assets_enqueue_modal', array(__CLASS__, 'enqueue_assets_modal'));
     } else {
         WR_Megamenu_Init_Assets::load(array('wr-joomlashine-iconselector-js'));
     }
     return parent::final_element($element, $output, $label);
 }
Пример #4
0
 /**
  * Color picker
  * @param type $element
  * @return string
  */
 static function render($element)
 {
     $element = parent::get_extra_info($element);
     $label = parent::get_label($element);
     $bg_color = $element['std'] ? $element['std'] : '#000';
     $wrap_color_class = isset($element['wrap_color_class']) ? $element['wrap_color_class'] : '';
     $_hidden = !isset($element['hide_value']) || isset($element['hide_value']) && $element['hide_value'] == false ? 'type="text"' : 'type="hidden"';
     $output = "<div class='color-selector input-group {$wrap_color_class}' id='color-picker-{$element['id']}'>\n\t\t\t\t\t\t<input {$_hidden} size='10' class='input-small {$element['class']}' id='{$element['id']}' name='{$element['id']}' value='{$element['std']}'  DATA_INFO />\n\t\t\t\t\t\t<span class='input-group-btn'>\n\t\t\t\t\t\t\t<a href='javascript:void(0);' class='btn btn-default btn-sm' title=''>...</a>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>";
     if (!WR_Megamenu_Helpers_Functions::is_modal()) {
         WR_Megamenu_Init_Assets::load(array('wr-colpick-js', 'wr-colpick-css'));
     } else {
         add_filter('wr_mm_assets_enqueue_modal', array(__CLASS__, 'enqueue_assets_color'));
     }
     return parent::final_element($element, $output, $label);
 }
Пример #5
0
 /**
  * Initialize WR Sample plugin.
  *
  * @return  void
  */
 public static function init()
 {
     global $wp_widget_factory, $mega_menu, $wr_megamenu_element, $wr_megamenu_widgets;
     // Init neccessary WR Library classes
     WR_Megamenu_Init_Admin_Menu::hook();
     // Load required assets
     WR_Megamenu_Assets::init();
     WR_Megamenu_Init_Assets::hook();
     // Load update simulator
     WR_Megamenu_Update_Simulator::hook();
     // Init element
     $wr_megamenu_element = new WR_Megamenu_Element();
     $wr_megamenu_element->init();
     //
     if (is_admin()) {
         $mega_menu = new WR_Megamenu_Core_Backend();
         // Insert WooRockets banner
         global $pagenow;
         $post_type = '';
         if ($pagenow == 'post-new.php' && isset($_REQUEST['post_type'])) {
             $post_type = $_REQUEST['post_type'];
         } elseif ($pagenow == 'post.php' && isset($_REQUEST['post'])) {
             $post_type = get_post_type($_REQUEST['post']);
         }
         if ($post_type == 'wr_megamenu_profile') {
             self::insert_banner();
         }
     } else {
         // Process menu frontend
         $frontend = new WR_Megamenu_Core_Frontend();
         $frontend->apply_megamenu();
     }
     // Register 'admin_menu' action
     add_action('admin_menu', array(__CLASS__, 'admin_menu'));
     // Register 'wr_mm_installed_product' filter
     add_filter('wr_mm_installed_product', array(__CLASS__, 'register_product'));
     // Initialize widget support
     $wr_megamenu_widgets = !empty($wr_megamenu_widgets) ? $wr_megamenu_widgets : WR_Megamenu_Helpers_Functions::widgets();
 }
Пример #6
0
 /**
  * Enqueue scripts
  */
 public function enqueue_assets()
 {
     WR_Megamenu_Init_Assets::load(array('wr-mm-bootstrap3-css', 'wr-bootstrap3-js', 'wr-joomlashine-css'));
     WR_Megamenu_Init_Assets::load(array('wr-jquery-ui-css', 'wr-megamenu-modal-css', 'wr-mm-css'));
     WR_Megamenu_Init_Assets::load(array('wr-bootstrap3-icomoon-css', 'wr-font-awesome-css', 'wr-mm-admin-css'));
     WR_Megamenu_Init_Assets::load(array('wr-jquery-ui-css', 'wr-jquery-select2-css', 'wr-jquery-select2-bootstrap3-css'));
     WR_Megamenu_Init_Assets::load(array('wr-mm-jqueryfancybox-css'));
     if (function_exists('wp_enqueue_media')) {
         wp_enqueue_media();
     } else {
         wp_enqueue_style('thickbox');
         wp_enqueue_script('media-upload');
         wp_enqueue_script('thickbox');
     }
     $scripts = array('jquery', 'jquery-ui', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-tabs', 'jquery-ui-dialog', 'jquery-ui-button', 'jquery-ui-slider', 'wr-jquery-livequery-js', 'jquery-resize-js', 'wr-joomlashine-modalresize-js', 'wr-jquery-select2-js');
     WR_Megamenu_Init_Assets::load($scripts);
     $scripts = array('wr-mm-layout-js', 'wr-mm-placeholder');
     WR_Megamenu_Init_Assets::load($scripts);
     // Check # review
     WR_Megamenu_Init_Assets::load(array('wr-mm-modal-js', 'wr-custom-css-js'));
     WR_Megamenu_Init_Assets::load(array('wr-megamenu-placeholder'));
     // Load element editor script
     WR_Megamenu_Init_Assets::load('wr-mm-handleelement-js');
     // Load element settings script
     WR_Megamenu_Init_Assets::load('wr-mm-handlesetting-js');
     // Load ZeroClipboard JavaScript library for Shortcode Content tab
     WR_Megamenu_Init_Assets::load('wr-zeroclipboard-js');
     WR_Megamenu_Init_Assets::load('wr-mm-widget-js');
     // Load Jquery fancybox
     WR_Megamenu_Init_Assets::load('wr-mm-jqueryfancybox-js');
     // Load for element image
     WR_Megamenu_Init_Assets::load('wr-mm-imagefrontend-js');
     WR_Megamenu_Init_Assets::localize('wr-custom-css-js', 'Wr_Megamenu_Translate', WR_Megamenu_Helpers_Functions::js_translation());
     WR_Megamenu_Init_Assets::localize('wr-mm-handlesetting-js', 'Wr_Megamenu_Ajax', WR_Megamenu_Helpers_Functions::localize_js());
     WR_Megamenu_Helpers_Functions::wr_localize();
 }
Пример #7
0
 /**
  * Show Modal page
  */
 function modal_register()
 {
     if (WR_Megamenu_Helpers_Functions::is_modal()) {
         $instance = WR_Megamenu_Helpers_Modal::get_instance();
         if (!empty($_GET['wr_modal_type'])) {
             $instance->show_modal();
         }
         if (!empty($_GET['wr_layout'])) {
             $instance->show_modal('_layout');
         }
         if (!empty($_GET['wr_custom_css'])) {
             $instance->show_modal('_custom_css');
         }
         if (!empty($_GET['wr_add_element'])) {
             $instance->show_modal('_add_element');
         }
     }
 }
Пример #8
0
 /**
  * Check if asset file is processed | or add asset file to processed list
  *
  * @param string $file
  * @param bool   $assign
  */
 private static function assets_check($file, $assign = false)
 {
     @session_start();
     if (self::$run_time == 0) {
         unset($_SESSION);
     }
     self::$run_time++;
     global $post;
     $post_id = !empty($post) ? $post->ID : 0;
     // Check if this is backend or frontend
     $side = WR_Megamenu_Helpers_Functions::is_preview() ? 'admin' : 'wp';
     // $side = 'default';
     if (!$assign) {
         if (in_array($file, @(array) $_SESSION['wr-mm-processed-assets'][$post_id][$side]['assets'])) {
             return;
         }
     } else {
         // store it as processed asset
         $_SESSION['wr-mm-processed-assets'][$post_id]['assets'][$side][] = $file;
     }
 }
Пример #9
0
 * @package    WR MegaMenu
 * @author     WooRockets Team <*****@*****.**>
 * @copyright  Copyright (C) 2014 WooRockets.com All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.woorockets.com
 * Technical Support:  Feedback - http://www.woorockets.com
 */
$custom_css_item = '<li class="jsn-item ui-state-default"><label class="checkbox"><input type="checkbox" name="item-list" value="VALUE" CHECKED>VALUE</label></li>';
$css_files = $css_custom = '';
if (empty($_GET['pid'])) {
    exit;
}
$post_id = esc_sql($_GET['pid']);
// get custom css data
$custom_css_data = WR_Megamenu_Helpers_Functions::custom_css_data(isset($post_id) ? $post_id : NULL);
extract($custom_css_data);
$css_files = stripslashes($css_files);
$css_custom = stripslashes($css_custom);
$_css_files_tooltip = 'Insert path to your CSS files, each line for each file.
						<br>The path can be relative like:
						<br> <i><u>assets/css/yourfile.css</u></i>
						<br>or absolute like:
						<br> <i><u>http://yourwebsite.com/assets/css/yourfile.css</u></i>
						';
$_style = '.tooltip-inner { min-width: 350px !important; } .top-cut .tooltip-inner { margin-top: 60px; }';
WR_Megamenu_Init_Assets::inline('css', $_style, true);
?>

<div class="jsn-master" id="wr-mm-custom-css-box">
	<div class="jsn-bootstrap3">
Пример #10
0
    public function load_profile_assets()
    {
        $profile_selector = $this->settings['location'] . '_' . $this->profile_id;
        $theme_style = isset($this->settings['theme_style']) ? $this->settings['theme_style'] : '';
        $themes_options = get_post_meta($this->profile_id, WR_MEGAMENU_META_KEY . '_themes_options', true);
        $themes_options = json_decode($themes_options, true);
        // Load profile theme
        $default = isset($theme_style) && $theme_style != '' ? $theme_style . '/' . $theme_style . '.css' : 'default/default.css';
        $profile_theme_url = WR_MEGAMENU_ROOT_URL . 'themes/' . $default;
        wp_enqueue_style("wr-{$this->profile_id}", $profile_theme_url, array(), '1.0');
        if (isset($themes_options[$theme_style])) {
            $theme_options = $themes_options[$theme_style];
            $setting = json_decode($theme_options, true);
            $style = '';
            // Menu bar
            $style .= '.wr-megamenu-container.' . $profile_selector . ' {background: ' . $setting['menu-bar-bg'] . ' !important;}';
            $style .= '.' . $profile_selector . ' .wr-mega-menu > li:hover > a, .' . $profile_selector . ' .wr-mega-menu > li.focus > a {background: ' . $setting['menu-bar-on_hover'] . ' !important;}';
            if ($setting['menu-bar-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' .wr-mega-menu > li > a {
							 color: ' . $setting['menu-bar-menu_color'] . ' !important;
							 font-family: ' . $setting['menu-bar-font_face'] . ' !important;
							 font-size:' . $setting['menu-bar-font_size'] . 'px !important;
							 font-weight:' . $setting['menu-bar-font_weight'] . ' !important;
						 }';
            }
            if ($setting['menu-bar-icon_display_mode'] == 'icon_only') {
                $style .= ".{$profile_selector} .wr-mega-menu > li > a .menu_title, .{$profile_selector} .wr-mega-menu .sub-menu a .menu_title, .{$profile_selector} .wr-mega-menu .block-sub-menu a .ig-menu-title {display:none;}";
            } else {
                if ($setting['menu-bar-icon_display_mode'] == 'text_only') {
                    $style .= ".{$profile_selector} .wr-mega-menu > li > a > i, .{$profile_selector} .wr-mega-menu .sub-menu a i {display:none !important;}";
                }
            }
            $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {font-size: " . $setting['menu-bar-icon_size'] . 'px !important;}';
            if ($setting['menu-bar-icon_position'] == 'top') {
                $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {display:block !important;}";
                $style .= ".{$profile_selector} .wr-mega-menu > li > a > i {text-align: center; width: 100% !important ;}";
            }
            if ($setting['heading-text-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' .wr-mega-menu a.caption {
							 color: ' . $setting['heading-text-menu_color'] . ' !important;
							 font-family: ' . $setting['heading-text-font_face'] . ' !important;
							 font-size:' . $setting['heading-text-font_size'] . 'px !important;
							 font-weight:' . $setting['heading-text-font_weight'] . ' !important;
						 }';
            }
            if ($setting['normal-text-font'] != 'inherit') {
                $style .= '.' . $profile_selector . ' ul.sub-menu li a,
							ul.submenu-items li a {
							 color: ' . $setting['normal-text-menu_color'] . ' !important;
							 font-family: ' . $setting['normal-text-font_face'] . ' !important;
							 font-size:' . $setting['normal-text-font_size'] . 'px !important;
							 font-weight:' . $setting['normal-text-font_weight'] . ' !important;
						 }';
            }
            WR_Megamenu_Init_Assets::print_inline('css', $style);
            $script = ' ';
            if ($setting['menu-bar-menu_layout'] == 'vertical') {
                $script .= " \$( '.wr-megamenu-container.{$profile_selector}' ).addClass( 'vertical' );";
            }
            if ($setting['submenu-panel-bullet_icon'] == 'yes') {
                $script .= "\$( '.{$profile_selector} ul.sub-menu li a, .{$profile_selector} ul.submenu-items li a' ).prepend( '<i class=\"glyphicon glyphicon-chevron-right\"></i>' );";
            }
            if ($setting['menu-bar-stick_menu'] == 'yes') {
                $script .= "\$(document).scroll(function () {\n\t\t\t\t\t\t\t\tvar y = \$(document).scrollTop(),\n\t\t\t\t\t\t\t\tmega_container = \$( '.wr-megamenu-container.{$profile_selector}' );\n\t\t\t\t\t\t\t\tresponsive = \$( '.it-responsive-mega' );\n\t\t\t\t\t\t\t\tif (y > mega_container.parent().offset().top) {\n\t\t\t\t\t\t\t\t\tmega_container.addClass( 'stick' );\n\t\t\t\t\t\t\t\t\tresponsive.addClass( 'stick' );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tmega_container.removeClass( 'stick' );\n\t\t\t\t\t\t\t\t\tresponsive.removeClass( 'stick' );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});";
            }
            WR_Megamenu_Init_Assets::inline('js', $script);
        }
        $script = "\n\n\t\t\t\$( '.{$profile_selector} .mega-item.wr-megamenu-fixed, .{$profile_selector} .menu-item-has-children.menu-default' ).on( 'hover', function () {\n\n\t\t\t\tvar\n\t\t\t\t\tmega_inner = null,\n\t\t\t\t\tmega_menu = \$(this).find( ' > .wr-megamenu-inner' ),\n\t\t\t\t\tsub_menu = \$(this).find( ' > .sub-menu' ),\n\t\t\t\t\tis_mega_inner = false\n\t\t\t\t\t;\n\n\t\t\t\tif (sub_menu.length > 0) {\n\t\t\t\t\tmega_inner = sub_menu;\n\t\t\t\t} else if (mega_menu.length > 0) {\n\t\t\t\t\tmega_inner = mega_menu;\n\t\t\t\t\tis_mega_inner = true;\n\t\t\t\t}\n\t\t\t\tif (mega_inner != null) {\n\t\t\t\t\tif (mega_inner.outerWidth() > (\$(window).outerWidth() - mega_inner.offset().left ) ) {\n\t\t\t\t\t\tif (!is_mega_inner) {\n\t\t\t\t\t\t\tmega_inner.addClass( 'wr-megamenu-rtl' );\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.sub-menu li.wr-megamenu-item' ).css({'text-align': 'right', 'background': 'inherit'});\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.wr-mega-menu ul ul.sub-menu' ).css( 'right', '99%' );\n\t\t\t\t\t\t\t\$( '.{$profile_selector} ul.wr-mega-menu ul li' ).on( 'hover', function () {\n\t\t\t\t\t\t\t\t\$(this).find( '> ul.sub-menu' ).css({'right': '100%'});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\$( '.wr-megamenu-container.{$profile_selector} ul ul' ).addClass('pull-right');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tmega_inner.addClass('wr-megamenu-left-inner');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t";
        WR_Megamenu_Init_Assets::inline('js', $script);
        // Custom css
        $custom_css_data = WR_Megamenu_Helpers_Functions::custom_css_data(isset($this->profile_id) ? $this->profile_id : NULL);
        extract($custom_css_data);
        $css_files = stripslashes($css_files);
        if (!empty($css_files)) {
            $css_files = json_decode($css_files);
            $data = $css_files->data;
            foreach ($data as $idx => $file_info) {
                $checked = $file_info->checked;
                $url = $file_info->url;
                // if file is checked to load, enqueue it
                if ($checked) {
                    echo balanceTags("<link rel='stylesheet' id='wr-mg-custom-file-{$this->profile_id}-{$idx}'  href='/{$url}' type='text/css' media='all' />");
                }
            }
        }
        $css_custom = stripslashes($css_custom);
        if (!empty($css_custom)) {
            WR_Megamenu_Init_Assets::print_inline('css', $css_custom);
        }
    }
Пример #11
0
 /**
  * return shortcode content: if shortcode is disable, return empty
  *
  * @param array $atts
  * @param string $content
  */
 public function element_shortcode($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     if ($arr_params['disabled_el'] == 'yes') {
         if (WR_Megamenu_Helpers_Functions::is_preview()) {
             return '';
             //_e( 'This element is deactivated. It will be hidden at frontend', WR_MEGAMENU_TEXTDOMAIN );
         }
         return '';
     }
     // enqueue script for current element in frontend
     add_action('wp_footer', array(&$this, 'enqueue_assets_frontend'), 1);
     // get full shortcode content
     return $this->element_shortcode_full($atts, $content);
 }
Пример #12
0
				<div class="top-buttons-right pull-right">
					<button id="btn-submenu-styling" class="btn btn-default"><?php 
_e('Styling', WR_MEGAMENU_TEXTDOMAIN);
?>
</button>
					<button id="page-custom-css" class="btn btn-default"><?php 
_e('Custom CSS', WR_MEGAMENU_TEXTDOMAIN);
?>
</button>
					<div  id="menu-styling" class="styling-modal jsn-bootstrap3" style="display: none;">

					<?php 
$themes_style = array();
// Get all themes for mega menu
$path = apply_filters('wr_megamenu_themes', WR_MEGAMENU_ROOT_PATH . 'themes');
$files = WR_Megamenu_Helpers_Functions::get_theme_styles($path);
if (count($files)) {
    foreach ($files as $theme => $value) {
        $themes_style[$theme] = ucfirst($theme);
    }
}
$theme_default_options = array('menu-bar-font' => 'inherit', 'menu-bar-bg_value' => '#000', 'menu-bar-bg' => '#000', 'menu-bar-font_type' => 'Standard Font', 'menu-bar-font_face' => 'Arial', 'menu-bar-font_size' => '10', 'menu-bar-font_weight' => 'bold', 'menu-bar-menu_color' => '#fff', 'menu-bar-menu_layout' => 'horizontal', 'menu-bar-on_hover' => '#1cba70', 'menu-bar-stick_menu' => 'no', 'menu-bar-icon_display_mode' => 'text_only', 'menu-bar-icon_position' => 'left', 'menu-bar-icon_size' => '16', 'heading-text-font' => 'inherit', 'heading-text-font_type' => 'Standard Font', 'heading-text-font_face' => 'Arial', 'heading-text-font_size' => '10', 'heading-text-font_weight' => 'bold', 'heading-text-menu_color' => '#000', 'normal-text-font' => 'inherit', 'normal-text-font_type' => 'Standard Font', 'normal-text-font_face' => 'Arial', 'normal-text-font_size' => '10', 'normal-text-font_weight' => 'bold', 'normal-text-menu_color' => '#000', 'submenu-panel-bullet_icon' => 'yes');
// get options from many themes
$selected_theme = isset($data['theme_style']) ? $data['theme_style'] : 'default';
$themes_options = get_post_meta($profile->ID, WR_MEGAMENU_META_KEY . '_themes_options', true);
$themes_options = json_decode($themes_options, true);
foreach ($themes_style as $key => $theme) {
    $setting = isset($themes_options[$key]) ? json_decode($themes_options[$key], true) : array();
    $theme_options = wp_parse_args($setting, $theme_default_options);
    $options = json_encode($theme_options);
    echo balanceTags("<input type='hidden' class='style-{$key}' id='style-{$key}' value='{$options}' name='theme_options[]'/>");
Пример #13
0
    /**
     * Show admin notice
     *
     * @param string $addon_name
     * @param string $core_required
     *
     * @return string
     */
    static function show_notice($data, $action, $type = 'error')
    {
        // show message
        ob_start();
        switch ($action) {
            // show message about core version required
            case 'core_required':
                extract($data);
                ?>
				<div class="<?php 
                echo esc_attr($type);
                ?>
">
					<p>
						<?php 
                _e("You can not activate this WR MegaMenu's provider:", WR_MEGAMENU_TEXTDOMAIN);
                ?>
 <br>
						<b><?php 
                echo esc_html($addon_name);
                ?>
</b>
					</p>

					<p>
						<?php 
                _e("It requires WR MegaMenu's version:", WR_MEGAMENU_TEXTDOMAIN);
                ?>
 <br>
						<b><?php 
                echo esc_html($core_required);
                ?>
</b> <br>
						<?php 
                echo esc_html('or above to work. Please update WR MegaMenu to newest version.');
                ?>
						<br>
					</p>
				</div>

				<!-- custom js to hide "Plugin actived" -->

				<?php 
                $js_code = "\$( '#message.updated' ).hide();";
                echo balanceTags(WR_Megamenu_Helpers_Functions::script_box($js_code));
                break;
            default:
                break;
        }
        $message = ob_get_clean();
        return $message;
    }
Пример #14
0
 /**
  * Set hook prefix for loading assets.
  * @param   string $prefix Current hook prefix.
  * @return  string
  */
 public static function wr_mm_hook_prefix($prefix = '')
 {
     if ('admin' == $prefix && class_exists('WR_Megamenu_Helpers_Functions') && WR_Megamenu_Helpers_Functions::is_modal()) {
         $prefix = 'mm_admin';
     }
     return $prefix;
 }
Пример #15
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array $atts Shortcode attributes.
  * @param   string $content Current content.
  *
  * @return  string
  */
 function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $random_id = WR_Megamenu_Helpers_Common::random_string();
     $script = $html_element = '';
     if (!empty($content)) {
         $content = WR_Megamenu_Helpers_Shortcode::remove_autop($content, true);
     }
     $html_element_style = '<style type="text/css">';
     if (isset($enable_dropcap) && $enable_dropcap == 'yes') {
         if ($content) {
             $styles = array();
             if ($dropcap_font_face_type == 'google fonts' and $dropcap_font_face_value != '') {
                 $script .= WR_Megamenu_Helpers_Functions::add_google_font_link_tag($dropcap_font_face_value);
                 $styles[] = 'font-family:' . $dropcap_font_face_value;
             } elseif ($dropcap_font_face_type == 'standard fonts' and $dropcap_font_face_value) {
                 $styles[] = 'font-family:' . $dropcap_font_face_value;
             }
             if (intval($dropcap_font_size) > 0) {
                 $styles[] = 'font-size:' . intval($dropcap_font_size) . 'px';
                 $styles[] = 'line-height:' . intval($dropcap_font_size) . 'px';
             }
             switch ($dropcap_font_style) {
                 case 'bold':
                     $styles[] = 'font-weight:700';
                     break;
                 case 'italic':
                     $styles[] = 'font-style:italic';
                     break;
                 case 'normal':
                     $styles[] = 'font-weight:normal';
                     break;
             }
             if (strpos($dropcap_font_color, '#') !== false) {
                 $styles[] = 'color:' . $dropcap_font_color;
             }
             if (count($styles)) {
                 $html_element_style .= sprintf('%s .dropcap:first-letter { float:left;', "#{$random_id}");
                 $html_element_style .= implode(';', $styles);
                 $html_element_style .= '}';
             }
             $html_element .= "<div class='dropcap'>{$content}</div>";
         }
     } else {
         $html_element .= $content;
     }
     $html_element_style .= '.preview-text {line-height: ' . $line_height . 'px;}';
     $html_element_style .= '</style>';
     $preview = $html_element_style;
     $preview .= "<div class='preview-text'>" . $html_element . '</div>';
     $html = sprintf('<div class="wr_text" id="%s">', $random_id);
     $html .= $script;
     $html .= $preview;
     $html .= '</div>';
     // Process margins
     if (isset($arr_params['text_margin_top'])) {
         $arr_params['div_margin_top'] = $arr_params['text_margin_top'];
     }
     if (isset($arr_params['text_margin_bottom'])) {
         $arr_params['div_margin_bottom'] = $arr_params['text_margin_bottom'];
     }
     if (isset($arr_params['text_margin_right'])) {
         $arr_params['div_margin_right'] = $arr_params['text_margin_right'];
     }
     if (isset($arr_params['text_margin_left'])) {
         $arr_params['div_margin_left'] = $arr_params['text_margin_left'];
     }
     return $this->element_wrapper($html, $arr_params);
 }
Пример #16
0
 /**
  * Generate HTML code from shortcode content.
  *
  * @param   array $atts Shortcode attributes.
  * @param   string $content Current content.
  *
  * @return  string
  */
 public function element_shortcode_full($atts = null, $content = null)
 {
     $arr_params = shortcode_atts($this->config['params'], $atts);
     extract($arr_params);
     $html_elemments = $script = '';
     $alt_text = $image_alt ? " alt='{$image_alt}'" : '';
     if (isset($arr_params['image_margin_top'])) {
         $arr_params['div_margin_top'] = $arr_params['image_margin_top'];
     }
     if (isset($arr_params['image_margin_bottom'])) {
         $arr_params['div_margin_bottom'] = $arr_params['image_margin_bottom'];
     }
     if (isset($arr_params['image_margin_right'])) {
         $arr_params['div_margin_right'] = $arr_params['image_margin_right'];
     }
     if (isset($arr_params['image_margin_left'])) {
         $arr_params['div_margin_left'] = $arr_params['image_margin_left'];
     }
     // No add image effect in admin view
     if (is_admin()) {
         $image_effect = 'no';
     }
     $class_img = $image_container_style != 'no-styling' ? $image_container_style : '';
     $class_img = $image_effect == 'yes' ? $class_img . ' image-scroll-fade' : $class_img;
     $class_img = !empty($class_img) ? ' class="' . $class_img . '"' : '';
     if ($image_file) {
         $image_id = WR_Megamenu_Helpers_Functions::get_image_id($image_file);
         $attachment = wp_prepare_attachment_for_js($image_id);
         $image_file = !empty($attachment['sizes'][$image_size]['url']) ? $attachment['sizes'][$image_size]['url'] : $image_file;
         $html_elemments .= "<img src='{$image_file}'{$alt_text}{$class_img} />";
         $script = '';
         $target = '';
         if ($image_effect == 'yes' and !isset($_POST['action'])) {
             $data = getimagesize($image_file);
             $width = $data[0];
             $height = $data[1];
             $html_elemments = "<img src='" . WR_Megamenu_Helpers_Functions::path('assets/3rd-party') . '/jquery-lazyload/grey.gif' . "' data-original='{$image_file}' width='{$width}' height='{$height}' {$alt_text} {$class_img}/>";
         }
         if ($open_in) {
             switch ($open_in) {
                 case 'current_browser':
                     $target = '';
                     break;
                 case 'new_browser':
                     $target = ' target="_blank"';
                     break;
                 case 'new_window':
                     $cls_button_fancy = 'wr-button-new-window';
                     $script = WR_Megamenu_Helpers_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%'));
                     break;
                 case 'lightbox':
                     $cls_button_fancy = 'mm-image-fancy';
                     break;
             }
         }
         $class = isset($cls_button_fancy) && !empty($cls_button_fancy) ? " class='{$cls_button_fancy}'" : '';
         // get Single Item and check type to get right link
         $single_item = explode('__#__', $single_item);
         $single_item = $single_item[0];
         $taxonomies = WR_Megamenu_Helpers_Type::get_public_taxonomies();
         $post_types = WR_Megamenu_Helpers_Type::get_post_types();
         // single post
         if (array_key_exists($link_type, $post_types)) {
             $permalink = home_url() . "/?p={$single_item}";
             $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>';
         } else {
             if (array_key_exists($link_type, $taxonomies)) {
                 $permalink = get_term_link(intval($single_item), $link_type);
                 if (!is_wp_error($permalink)) {
                     $html_elemments = "<a href='{$permalink}'{$target}{$class}>" . $html_elemments . '</a>';
                 }
             } else {
                 switch ($link_type) {
                     case 'url':
                         $html_elemments = "<a href='{$image_type_url}'{$target}{$class}>" . $html_elemments . '</a>';
                         break;
                     case 'large_image':
                         $image_id = WR_Megamenu_Helpers_Functions::get_image_id($image_file);
                         $attachment = wp_prepare_attachment_for_js($image_id);
                         $image_url = !empty($attachment['sizes'][$image_image_size]['url']) ? $attachment['sizes'][$image_image_size]['url'] : $image_file;
                         $html_elemments = "<a href='{$image_url}'{$target}{$class}>" . $html_elemments . '</a>';
                         break;
                 }
             }
         }
         if ($image_caption != '') {
             $html_elemments = $html_elemments . '<div class="clearfix"></div><div class="image_caption">' . $image_caption . '</div>';
         }
         if (strtolower($image_alignment) != 'inherit') {
             if (strtolower($image_alignment) == 'left') {
                 $cls_alignment = 'pull-left';
             }
             if (strtolower($image_alignment) == 'right') {
                 $cls_alignment = 'pull-right';
             }
             if (strtolower($image_alignment) == 'center') {
                 $cls_alignment = 'text-center';
             }
             $html_elemments = "<div class='{$cls_alignment}'>" . $html_elemments . '</div>';
         }
     }
     return $this->element_wrapper($html_elemments . $script, $arr_params);
 }