コード例 #1
0
        /**
         *
         * @param type $content			 : inner shortcode elements of this column
         * @param string $shortcode_data
         * @return string
         */
        public function element_in_megamenu($content = '', $shortcode_data = '')
        {
            $column_html = empty($content) ? '' : WR_Megamenu_Helpers_Shortcode::do_shortcode_admin($content, true);
            $span = !empty($this->params['span']) ? $this->params['span'] : 'span12';
            $shortcode_data = '[' . $this->config['shortcode'] . ' span="' . $span . '"]';
            // Remove empty value attributes of shortcode tag.
            $shortcode_data = preg_replace('/\\[*([a-z_]*[\\n\\s\\t]*=[\\n\\s\\t]*"")/', '', $shortcode_data);
            $rnd_id = WR_Megamenu_Helpers_Common::random_string();
            $column[] = '<div class="jsn-column-container clearafter shortcode-container ">
							<div class="jsn-column ' . $span . '">
								<div class="thumbnail clearafter">
									<textarea class="hidden" name="shortcode_content[]" >' . $shortcode_data . '</textarea>
									<div class="jsn-column-content item-container" data-column-class="' . $span . '" >
										<div class="jsn-handle-drag jsn-horizontal jsn-iconbar-trigger"><div class="jsn-iconbar layout"><a class="item-delete column" onclick="return false;" title="' . __('Delete column', WR_MEGAMENU_TEXTDOMAIN) . '" href="#"><i class="icon-trash"></i></a></div></div>
										<div class="jsn-element-container item-container-content">' . $column_html . '</div>
										<a class="jsn-add-more wr-more-element" href="javascript:void(0);"><i class="icon-plus"></i>' . __('Add Element', WR_MEGAMENU_TEXTDOMAIN) . '</a>
									</div>
									<textarea class="hidden" name="shortcode_content[]" >[/' . $this->config['shortcode'] . ']</textarea>
								</div>
							</div>
						</div>';
            return $column;
        }
コード例 #2
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);
 }