/** * Set hook prefix for loading assets. * * @param string $prefix Current hook prefix. * * @return string */ public static function hook_prefix($prefix = '') { if ('admin' == $prefix && class_exists('WR_Pb_Helper_Functions') && WR_Pb_Helper_Functions::is_modal()) { $prefix = 'pb_admin'; } return $prefix; }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); // tag1,tag2 => tag1 tag2 , to filter $tag = str_replace(' ', '_', $tag); $tag = str_replace(',', ' ', $tag); $inner_content = WR_Pb_Helper_Shortcode::remove_autop($content); WR_Pb_Helper_Functions::heading_icon($heading, $icon); return "\n\t\t\t<div class='panel panel-default' data-tag='{$tag}'>\n\t\t\t\t<div class='panel-heading'>\n\t\t\t\t\t<h4 class='panel-title'>\n\t\t\t\t\t\t<a data-toggle='collapse' href='#collapse{index}'>\n\t\t\t\t\t\t\t<i class='{$icon}'></i>{$heading}\n\t\t\t\t\t\t\t<i class='wr-icon-accordion'></i>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h4>\n\t\t\t\t</div>\n\t\t\t\t<div id='collapse{index}' class='panel-collapse collapse {show_hide}'>\n\t\t\t\t <div class='panel-body'>\n\t\t\t\t {$inner_content}\n\t\t\t\t </div>\n\t\t\t\t</div>\n\t\t\t</div><!--seperate-->"; }
/** * Initialize core functionalities. * * @return void */ function init() { global $Wr_Pb, $Wr_Pb_Widgets; // Initialize WR PageBuilder $Wr_Pb = new WR_Pb_Core(); new WR_Pb_Utils_Plugin(); do_action('wr_pagebuilder_init'); // Initialize productivity functions WR_Pb_Product_Plugin::init(); // Initialize widget support $Wr_Pb_Widgets = !empty($Wr_Pb_Widgets) ? $Wr_Pb_Widgets : WR_Pb_Helper_Functions::widgets(); }
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_Pb_Helper_Functions::is_modal_of_element($this->config['shortcode'])) { WR_Pb_Helper_Functions::shortcode_enqueue_assets($this, 'admin_assets', ''); } parent::__construct(); }
/** * Activate handle */ function do_activate() { // get current version of plugin $latest_version = WR_Pb_Helper_Functions::get_plugin_info(WR_PB_FILE, 'Version'); // get previous version of plugin $old_version = get_transient('wr_pb_version'); // compare version if (!$old_version || version_compare($old_version, $latest_version, '<')) { // update plugin version set_transient('wr_pb_version', $latest_version); // remove cache folder if plugin is installed before if ($old_version) { WR_Pb_Utils_Common::remove_cache_folder(); } } // remove free shortcode directory if (is_dir(WP_PLUGIN_DIR . '/wr-shortcodes-free')) { delete_plugins(array('wr-shortcodes-free/main.php')); } }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); $content_class = !empty($image_file) ? 'carousel-caption' : 'carousel-content'; $img = !empty($image_file) ? "<img width='{WIDTH}' height='{HEIGHT}' src='{$image_file}' alt='{$alt}' style='height : {HEIGHT}px;'>" : ''; // remove image shortcode in content $content = WR_Pb_Helper_Shortcode::remove_wr_shortcodes($content, 'wr_image'); $inner_content = WR_Pb_Helper_Shortcode::remove_autop($content); WR_Pb_Helper_Functions::heading_icon($heading, $icon, true); $heading = trim($heading); $inner_content = trim($inner_content); if (empty($heading) && empty($inner_content)) { $html_content = ""; } else { $html_content = "<div class='{$content_class}'>"; $html_content .= !empty($heading) ? "<h4><i class='{$icon}'></i>{$heading}</h4>" : ''; $html_content .= !empty($inner_content) ? "<p>{$inner_content}</p>" : ''; $html_content .= "</div>"; } return "<div class='{active} item'>{$img}{$html_content}</div><!--seperate-->"; }
public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $href = ''; if (!empty($link_type)) { $taxonomies = WR_Pb_Helper_Type::get_public_taxonomies(); $post_types = WR_Pb_Helper_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } } else { switch ($link_type) { case 'url': $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'"; break; } } } } $target = $script = ''; 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_Pb_Helper_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = ' wr-prtbl-button-fancy'; break; } } $button_type = " type='button'"; $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy; $script = !isset($script) ? '' : $script; // Process col title $attr_title .= '<div class="wr-prtbl-title">'; // Process for image $attr_title .= '[prtbl_item_image]<div class="wr-prtbl-image">'; if ($prtbl_item_image) { $attr_title .= '<img src="' . $prtbl_item_image . '" />'; } $attr_title .= '</div>[/prtbl_item_image]'; // Process for title $attr_title .= '[prtbl_item_title]<h3>' . $prtbl_item_title . '</h3>[/prtbl_item_title]'; $attr_title .= '</div>'; $attr_title .= '[prtbl_item_meta]<div class="wr-prtbl-meta">'; $attr_title .= '[prtbl_item_price]<div class="wr-prtbl-price">'; if ($prtbl_item_currency) { $attr_title .= '<sup class="wr-prtbl-currency">' . $prtbl_item_currency . '</sup>'; } $attr_title .= $prtbl_item_price; if ($prtbl_item_time) { $attr_title .= '<sub class="wr-prtbl-time">' . $prtbl_item_time . '</sub>'; } $attr_title .= '</div>[/prtbl_item_price]'; // Process for description $attr_title .= '[prtbl_item_desc]<p class="wr-prtbl-desc">' . $prtbl_item_desc . '</p>[/prtbl_item_desc]'; $attr_title .= '</div>[/prtbl_item_meta]'; $featured = $prtbl_item_feature == 'yes' ? ' wr-prtbl-cols-featured' : ''; $pr_tbl_col_html = "<div class='wr-prtbl-cols{$featured}'>"; $pr_tbl_col_html .= '<div class="wr-prtbl-header">' . $attr_title . '</div>'; if (!empty($content)) { $pr_tbl_col_html .= '<ul class="wr-prtbl-features">'; $pr_tbl_col_html .= do_shortcode($content); $pr_tbl_col_html .= '</ul>'; } $pr_tbl_col_html .= "<div class='wr-prtbl-footer'>[prtbl_item_button]<a class='btn btn-default {$cls_button_fancy}'{$href}{$target}{$button_type}>{$prtbl_item_button_text}</a>[/prtbl_item_button]</div>"; $pr_tbl_col_html .= '</div>'; return $disabled_el == 'no' ? $pr_tbl_col_html . $script : ''; }
/** * 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) { $script = ''; if (!empty($atts) and is_array($atts)) { if (!isset($atts['border_bottom_width_value_'])) { $atts['border_bottom_width_value_'] = ''; $atts['border_bottom_style'] = ''; $atts['border_bottom_color'] = ''; } if (!isset($atts['padding_bottom_value_'])) { $atts['padding_bottom_value_'] = ''; } if (!isset($attrs['font_size_value_'])) { $attrs['font_size_value_'] = ''; } } // Reload shortcode params: because we get Heading Text from "text" param WR_Pb_Helper_Shortcode::generate_shortcode_params($this->items, NULL, $atts); $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $style = array(); $exclude_params = array('tag', 'text', 'preview'); $stylesheet = $font_style = ''; // Override custom style if (!empty($arr_params) and is_array($arr_params)) { if ($arr_params['font'] == 'inherit' || $arr_params['font'] == 'Inherit') { unset($arr_params['font']); unset($arr_params['font_face_type']); unset($arr_params['font_face_value']); unset($arr_params['font_size_value_']); unset($arr_params['font_style']); unset($arr_params['color']); } if (isset($arr_params['font']) && $arr_params['font'] == 'custom') { unset($arr_params['font']); if (isset($arr_params['font_style']) && strtolower($arr_params['font_style']) == 'bold') { $arr_params['font_weight'] = '700'; unset($arr_params['font_style']); } if (isset($arr_params['font_style']) && strtolower($arr_params['font_style']) == 'normal') { $arr_params['font_weight'] = 'normal'; unset($arr_params['font_style']); } } if (isset($arr_params['font_size_value_']) && $arr_params['font_size_value_'] == '') { unset($arr_params['font_size_value_']); } if ($arr_params['border_bottom_width_value_'] == '') { unset($arr_params['border_bottom_width_value_']); unset($arr_params['border_bottom_style']); unset($arr_params['border_bottom_color']); } if ($arr_params['padding_bottom_value_'] == '') { unset($arr_params['padding_bottom_value_']); } if ($arr_params['text_align'] == 'inherit' || $arr_params['text_align'] == 'Inherit') { unset($arr_params['text_align']); } } foreach ($arr_params as $key => $value) { if ($value != '') { if ($key == 'font_face_type') { if ($value == __('Standard fonts', WR_PBL) || $value == 'standard fonts') { $font_style = 'font-family:' . $arr_params['font_face_value']; } elseif ($value == __('Google fonts', WR_PBL) || $value == 'google fonts') { $script = WR_Pb_Helper_Functions::add_google_font_link_tag($arr_params['font_face_value']); $font_style = 'font-family:' . $arr_params['font_face_value']; } } elseif ($key != 'font_face_value') { $key = WR_Pb_Helper_Functions::remove_tag($key); if (!in_array($key, $exclude_params)) { switch ($key) { case 'border_bottom_width_value_': $style[$key] = 'border-bottom-width:' . $value . 'px'; break; case 'text_align': $style[$key] = 'text-align:' . $value; break; case 'font_size_value_': $style[$key] = 'font-size:' . $value . 'px'; break; case 'font_style': $style[$key] = 'font-style:' . $value; break; case 'border_bottom_style': $style[$key] = 'border-bottom-style:' . $value; break; case 'border_bottom_color': $style[$key] = 'border-bottom-color:' . $value; break; case 'padding_bottom_value_': $style[$key] = 'padding-bottom:' . $value . 'px'; break; case 'font_weight': $style[$key] = 'font-weight:' . $value; break; case 'color': $style[$key] = 'color:' . $value; break; } } } } } // Finalize style $style = implode(';', $style) . ';' . $font_style; if ($style == ';') { $style = ''; } extract($arr_params); if ($enable_underline == 'yes') { } // Process heading margins if (isset($arr_params['heading_margin_top'])) { $arr_params['div_margin_top'] = $arr_params['heading_margin_top']; } if (isset($arr_params['heading_margin_bottom'])) { $arr_params['div_margin_bottom'] = $arr_params['heading_margin_bottom']; } if (isset($arr_params['heading_margin_right'])) { $arr_params['div_margin_right'] = $arr_params['heading_margin_right']; } if (isset($arr_params['heading_margin_left'])) { $arr_params['div_margin_left'] = $arr_params['heading_margin_left']; } // Finalize HTML code $true_element = "<{$arr_params['tag']} style='{$style}'>" . do_shortcode($content) . "</{$arr_params['tag']}>"; return $this->element_wrapper($script . $stylesheet . $true_element, $arr_params); }
* @copyright Copyright (C) 2012 www.woorockets.com. All Rights Reserved. * @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.www.woorockets.com * Technical Support: Feedback - http://www.www.woorockets.com */ /** * @todo : Custom CSS modal */ $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>'; if (empty($_GET['pid'])) { exit; } $post_id = esc_sql($_GET['pid']); // get custom css data $custom_css_data = WR_Pb_Helper_Functions::custom_css_data(isset($post_id) ? $post_id : NULL); $css_files = !empty($custom_css_data['css_files']) ? stripslashes($custom_css_data['css_files']) : ''; $css_custom = !empty($custom_css_data['css_custom']) ? stripslashes($custom_css_data['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; font-weight: 100 !important; }'; WR_Pb_Init_Assets::inline('css', $_style, true); ?> <div class="jsn-master" id="wr-pb-custom-css-box"> <div class="jsn-bootstrap3"> <!-- CSS files -->
/** * return shortcode content: if shortcode is disable, return empty * * @param array $atts * @param string $content */ public function element_shortcode($atts = null, $content = null) { $this->init_element(); $prefix = WR_Pb_Helper_Functions::is_preview() ? 'pb_admin' : 'wp'; // enqueue custom assets at footer of frontend/backend add_action("{$prefix}_footer", array(&$this, 'custom_assets_frontend')); $arr_params = shortcode_atts($this->config['params'], $atts); if ($arr_params['disabled_el'] == 'yes') { if (WR_Pb_Helper_Functions::is_preview()) { return ''; //_e( 'This element is deactivated. It will be hidden at frontend', WR_PBL ); } return ''; } // enqueue script for current element in frontend add_action('wp_footer', array(&$this, 'enqueue_assets_frontend'), 1); // get full shortcode content $string = htmlentities($content, null, 'utf-8'); $content = str_replace(" ", "", $string); $content = html_entity_decode($content); return $this->element_shortcode_full($atts, $content); }
/** * Custom function when update an Addon plugin */ public static function update_hook($plugin_file) { // Get plugin_directory/main_file $main_file = pathinfo($plugin_file); $addon_folder = basename($main_file['dirname']); // Get current version of addon $addon_version = WR_Pb_Helper_Functions::get_plugin_info($plugin_file, 'Version'); // Get stored version of addon $option_name = 'wr_addon_' . $addon_folder . '_version'; $addon_version_old = get_option($option_name); // If version is changed, updated if (version_compare($addon_version, $addon_version_old) != 0) { do_action('reload_wr_shortcodes'); // Update version update_option($option_name, $addon_version); } }
/** * Get custom css data: Css files, Css code of a post * * @global type $post * * @param type $post_id * * @return type */ static function custom_css_data($post_id) { $arr = array('css_files' => '', 'css_custom' => ''); if (isset($post_id)) { $arr['css_files'] = WR_Pb_Helper_Functions::custom_css($post_id, 'css_files'); $arr['css_custom'] = WR_Pb_Helper_Functions::custom_css($post_id, 'css_custom'); } return $arr; }
/** * 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) { $html_element = ''; $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $styles = array(); if ($pb_bg_color) { $styles[] = 'background-color:' . $pb_bg_color; } if (intval($pb_border_top) > 0) { $styles[] = 'border-top-width:' . (int) $pb_border_top . 'px'; $styles[] = 'border-top-style: solid'; } if (intval($pb_border_left) > 0) { $styles[] = 'border-left-width:' . (int) $pb_border_left . 'px'; $styles[] = 'border-left-style: solid'; } if (intval($pb_border_bottom) > 0) { $styles[] = 'border-bottom-width:' . (int) $pb_border_bottom . 'px'; $styles[] = 'border-bottom-style: solid'; } if (intval($pb_border_right) > 0) { $styles[] = 'border-right-width:' . (int) $pb_border_right . 'px'; $styles[] = 'border-right-style: solid'; } if ($pb_border_color) { $styles[] = 'border-color:' . $pb_border_color; } $elements = explode('__#__', $elements); $class = ''; if ($pb_show_drop == 'yes') { $class .= 'promo-box-shadow'; } $single_item = explode('__#__', $single_item); $single_item = $single_item[0]; $script = $cls_button_fancy = $target = $button = ''; if (in_array('button', $elements)) { $taxonomies = WR_Pb_Helper_Type::get_public_taxonomies(); $post_types = WR_Pb_Helper_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $button_href = "href='{$permalink}'"; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $button_href = "href='{$permalink}'"; } } else { switch ($link_type) { case 'no_link': $button_href = ''; break; case 'url': $button_href = "href='{$pb_button_url}'"; break; } } } if ($pb_button_open_in and $link_type != 'no_link') { switch ($pb_button_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_Pb_Helper_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = 'wr-pb-button-fancy'; $script = WR_Pb_Helper_Functions::fancybox(".{$cls_button_fancy}", array('type' => 'iframe', 'width' => '75%', 'height' => '75%')); break; } } $pb_button_size = isset($pb_button_size) && $pb_button_size != 'default' ? $pb_button_size : ''; $pb_button_color = isset($pb_button_color) && $pb_button_color != 'default' ? $pb_button_color : ''; $button = "<a class='pull-right btn {$pb_button_size} {$pb_button_color} {$cls_button_fancy}' {$target} {$button_href}>{$pb_button_title}</a>"; } $styles = implode(';', $styles); $styles = $styles ? "style='{$styles}'" : ''; $html_element .= "<div class='wr-promobox'>"; $html_element .= "<section class='{$class}' {$styles}>"; $html_element .= $button; if (in_array('title', $elements)) { $style_title = array(); if ($title_font == 'custom') { if ($title_font_face_type == 'google fonts') { $script .= WR_Pb_Helper_Functions::add_google_font_link_tag($title_font_face_value); $style_title[] = 'font-family:' . $title_font_face_value; } elseif ($title_font_face_value) { $style_title[] = 'font-family:' . $title_font_face_value; } if (intval($title_font_size) > 0) { $style_title[] = 'font-size:' . intval($title_font_size) . 'px'; } switch ($title_font_style) { case 'bold': $style_title[] = 'font-weight:700'; break; case 'italic': $style_title[] = 'font-style:italic'; break; case 'normal': $style_title[] = 'font-weight:normal'; break; } if (strpos($title_font_color, '#') !== false) { $style_title[] = 'color:' . $title_font_color; } } if ($title_padding_bottom) { $style_title[] = 'padding-bottom:' . $title_padding_bottom . 'px'; } if ($title_margin_bottom) { $style_title[] = 'margin-bottom:' . $title_margin_bottom . 'px'; } if (count($style_title)) { $style_title = 'style="' . implode(';', $style_title) . '"'; } else { $style_title = ''; } $html_element .= "<h2 {$style_title}>{$pb_title}</h2>"; } $content = !$content ? '' : $content; if (in_array('content', $elements)) { $html_element .= "<p>{$content}</p>"; } $html_element .= '</section>'; $html_element .= '</div>'; return $this->element_wrapper($html_element . $script, $arr_params); }
/** * Localize Script */ public function wr_localize() { WR_Pb_Init_Assets::localize('wr-pb-handlesetting-js', 'Wr_Ajax', WR_Pb_Helper_Functions::localize_js()); }
/** * 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); $button_text = !$button_text ? '' : $button_text; $button_size = !$button_size || strtolower($button_size) == 'default' ? '' : $button_size; $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $button_icon = !$icon ? '' : "<i class='{$icon}'></i>"; $tag = 'a'; $href = ''; $single_item = explode('__#__', $single_item); $single_item = $single_item[0]; if (!empty($link_type)) { $taxonomies = WR_Pb_Helper_Type::get_public_taxonomies(); $post_types = WR_Pb_Helper_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } } else { switch ($link_type) { case 'no_link': $tag = 'button'; break; case 'url': $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'"; break; } } } } $target = ''; 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_Pb_Helper_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = 'wr-button-fancy'; $script = WR_Pb_Helper_Functions::fancybox(".{$cls_button_fancy}", array('type' => 'iframe', 'width' => '75%', 'height' => '75%')); break; } } $button_type = $tag == 'button' ? " type='button'" : ''; $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy; $script = !isset($script) ? '' : $script; // custom style $cs_stype = array(); if (!empty($button_width)) { $cs_stype[] = "width: {$button_width}px;"; } if (!empty($button_height)) { $cs_stype[] = "height: {$button_height}px;"; $padding_top = intval($button_height) / 2 - 12; $cs_stype[] = "padding-top: {$padding_top}px;"; } $cs_stype = sprintf('style="%s [style]"', implode('', $cs_stype)); // Process CSS Class and CSS ID wrapper $extra_class = !empty($arr_params['css_suffix']) ? esc_attr($arr_params['css_suffix']) : ''; $extra_class = !empty($extra_class) ? ' ' . ltrim($extra_class, ' ') : ''; $extra_id = !empty($arr_params['id_wrapper']) ? esc_attr($arr_params['id_wrapper']) : ''; $extra_id = !empty($extra_id) ? "id='" . ltrim($extra_id, ' ') . "'" : ''; $html_result = "<{$tag} {$extra_id} {$cs_stype} class='btn {$extra_class} {$button_size} {$button_color} {$cls_button_fancy}'{$href}{$target}{$button_type}>[icon]{$button_icon}[/icon][title]{$button_text}[/title]</{$tag}>"; return $html_result . $script . '<!--seperate-->'; }
/** * Load required assets. * * @return void */ public static function load_assets() { WR_Pb_Helper_Functions::enqueue_styles(); WR_Pb_Helper_Functions::enqueue_scripts_end(); }
/** * Custom script for Video background */ static function print_player_scripts() { echo WR_Pb_Helper_Functions::script_box("\$('.wr_video_bg').mb_YTPlayer(); \$('.wr_video_bg').click(function(){ \$(this).playYTP() });"); }
/** * Check compatibility of Addons vs Core * * @global type $Wr_Sc_Providers */ public static function compatibility_check() { global $Wr_Sc_Providers; $providers = $Wr_Sc_Providers; // get current version of core $core_version = WR_Pb_Helper_Functions::get_plugin_info(WR_PB_FILE, 'Version'); foreach ($providers as $dir => $provider) { if (!empty($provider['file']) && !empty($provider['path'])) { $addon_file = $provider['file']; // get value of core version required $core_required = WR_Pb_Addon::core_version_requied_value($provider, $addon_file); if ($core_required) { // addon plugin name $addon_name = WR_Pb_Helper_Functions::get_plugin_info($provider['file_path'], 'Name'); $compatibility = WR_Pb_Addon::compatibility_handle($core_required, $core_version, $addon_file); if (!$compatibility) { // remove provider from list unset($Wr_Sc_Providers[$dir]); // show notice self::$notice[] = WR_Pb_Addon::show_notice(array('addon_name' => $addon_name, 'core_required' => $core_required), 'core_required'); } } } } }
/** * Print style on front-end */ function print_frontend_styles() { global $post; if (!isset($post) || !is_object($post)) { return; } $wr_deactivate_pb = get_post_meta($post->ID, '_wr_deactivate_pb', true); // if not deactivate pagebuilder on this post if (empty($wr_deactivate_pb)) { $custom_css_data = WR_Pb_Helper_Functions::custom_css_data(isset($post->ID) ? $post->ID : NULL); extract($custom_css_data); $css_custom = html_entity_decode(stripslashes($css_custom)); echo balanceTags("<style id='wr-pb-custom-{$post->ID}-css'>\n{$css_custom}\n</style>\n"); } }
/** * 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); $button_text = !$button_text ? '' : $button_text; $button_size = !$button_size || strtolower($button_size) == 'default' ? '' : $button_size; $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $button_icon = !$icon ? '' : "<i class='{$icon}'></i>"; $tag = 'a'; $href = ''; $single_item = explode('__#__', $single_item); $single_item = $single_item[0]; if (!empty($link_type)) { $taxonomies = WR_Pb_Helper_Type::get_public_taxonomies(); $post_types = WR_Pb_Helper_Type::get_post_types(); // single post if (array_key_exists($link_type, $post_types)) { $permalink = home_url() . "/?p={$single_item}"; $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } else { if (array_key_exists($link_type, $taxonomies)) { $permalink = get_term_link(intval($single_item), $link_type); if (!is_wp_error($permalink)) { $href = !$single_item ? ' href="#"' : " href='{$permalink}'"; } } else { switch ($link_type) { case 'no_link': $tag = 'button'; break; case 'url': $href = !$button_type_url ? ' href="#"' : " href='{$button_type_url}'"; break; } } } } $target = ''; 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_Pb_Helper_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = 'wr-button-fancy'; $script = WR_Pb_Helper_Functions::fancybox(".{$cls_button_fancy}", array('type' => 'iframe', 'width' => '75%', 'height' => '75%')); break; } } $button_type = $tag == 'button' ? " type='button'" : ''; $cls_button_fancy = !isset($cls_button_fancy) ? '' : $cls_button_fancy; $script = !isset($script) ? '' : $script; $cls_alignment = $custom_style = ''; if (strtolower($arr_params['button_alignment']) != 'inherit') { if (strtolower($arr_params['button_alignment']) == 'left') { $cls_alignment = 'pull-left'; } if (strtolower($arr_params['button_alignment']) == 'right') { $cls_alignment = 'pull-right'; } if (strtolower($arr_params['button_alignment']) == 'center') { $custom_style = ';text-align:center;'; } } if (isset($arr_params['button_margin_top'])) { $arr_params['div_margin_top'] = $arr_params['button_margin_top']; } if (isset($arr_params['button_margin_left'])) { $arr_params['div_margin_left'] = $arr_params['button_margin_left']; } if (isset($arr_params['button_margin_right'])) { $arr_params['div_margin_right'] = $arr_params['button_margin_right']; } if (isset($arr_params['button_margin_bottom'])) { $arr_params['div_margin_bottom'] = $arr_params['button_margin_bottom']; } $html_element = $script . "<{$tag} class='btn {$cls_alignment} {$button_size} {$button_color} {$cls_button_fancy}'{$href}{$target}{$button_type}>{$button_icon}{$button_text}</{$tag}>"; return $this->element_wrapper($html_element, $arr_params, null, $custom_style); }
echo WR_PB_URI; ?> assets/woorockets/images/about-us/unlimited-icon.png"></span>Unlimited customization ability</li> <li><span><img src="<?php echo WR_PB_URI; ?> assets/woorockets/images/about-us/additional-icon.png"></span>Additional eCommerce features</li> </ul> <p class="btn-premium"><a href="http://www.woorockets.com/themes/?utm_source=PageBuilder&utm_medium=About&utm_campaign=Cross%20Promo%20Banner" target="_blank"><strong>View the collection now</strong><br> <span>And learn how our themes can boost your business!</span></a></p> </div> <div id="wr-logo"> <a tagret="_blank" href="http://www.woorockets.com/?utm_source=PageBuilder%20About&utm_medium=bot%20logo&utm_campaign=Cross%20Promo%20Plugins" class="link"></a> <img src="<?php echo WR_Pb_Helper_Functions::path('assets/woorockets') . '/images/about-us/logo-footer.png'; ?> " /> <h3>www.woorockets.com</h3> </div> </div> <script type="text/javascript"> (function($) { $(document).ready(function() { $('#email-features .left-feature .box-email form .txt').focus(function () { $('#email-features .left-feature .box-email form').addClass('focus'); }) $('#email-features .left-feature .box-email form .txt').blur(function () { $('#email-features .left-feature .box-email form').removeClass('focus');
/** * 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_Pb_Utils_Common::random_string(); $script = $html_element = ''; if (!empty($content)) { $content = WR_Pb_Helper_Shortcode::remove_autop($content); } 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_Pb_Helper_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 type="text/css">'; $html_element .= sprintf('%1$s .dropcap:first-letter, %1$s .dropcap p:first-letter { float:left;', "#{$random_id}"); $html_element .= implode(';', $styles); $html_element .= '}'; $html_element .= '</style>'; } $html_element .= "<div class='dropcap'>{$content}</div>"; } } else { $html_element .= $content; } $html = sprintf('<div class="wr_text" id="%s">', $random_id); $html .= $script; $html .= $html_element; $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); }
echo esc_html($msg); ?> </strong> </p> </div> <?php } $options = array('wr_pb_settings_cache', 'wr_pb_settings_boostrap_js', 'wr_pb_settings_boostrap_css'); // submit handle if (!empty($_POST)) { foreach ($options as $key) { $value = !empty($_POST[$key]) ? 'enable' : 'disable'; update_option($key, $value); } unset($_POST); WR_Pb_Helper_Functions::alert_msg(array('success', __('Your settings are saved successfully', WR_PBL))); } // get saved options value foreach ($options as $key) { ${$key} = get_option($key, 'enable'); } // show options form ?> <form method="POST" action="options.php"> <?php $page = 'wr-pb-settings'; settings_fields($page); do_settings_sections($page); submit_button(); ?> </form>
/** * 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']; } $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_Pb_Helper_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; $width = $attachment['sizes'][$image_size]['width']; $height = $attachment['sizes'][$image_size]['height']; $html_elemments .= "<img width='{$width}' height='{$height}' src='{$image_file}'{$alt_text}{$class_img} />"; $script = ''; $target = ''; if ($image_effect == 'yes' and !isset($_POST['action'])) { $html_elemments = "<img src='" . WR_Pb_Helper_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_Pb_Helper_Functions::new_window(".{$cls_button_fancy}", array('width' => '75%', 'height' => '75%')); break; case 'lightbox': $cls_button_fancy = 'wr-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_Pb_Helper_Type::get_public_taxonomies(); $post_types = WR_Pb_Helper_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_Pb_Helper_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 (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); }
/** * 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); $initial_open = intval($arr_params['initial_open']); $tab_position = $arr_params['tab_position']; $random_id = WR_Pb_Utils_Common::random_string(); $tab_navigator = array(); $tab_navigator[] = '<ul class="nav nav-tabs">'; $sub_shortcode = do_shortcode($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = $initial_open > count($items) ? 1 : $initial_open; $fade_effect = ''; if ($arr_params['fade_effect'] == 'yes') { $fade_effect = 'fade in'; } foreach ($items as $idx => $item) { // Extract icon & heading $ex_heading = explode('<!--heading-->', $item); $ex_icon = explode('<!--icon-->', isset($ex_heading[1]) ? $ex_heading[1] : ''); $new_key = $random_id . $idx; $active = $idx + 1 == $initial_open ? 'active' : ''; $item = isset($ex_icon[1]) ? $ex_icon[1] : ''; $item = str_replace('{index}', $new_key, $item); $item = str_replace('{active}', $active, $item); $item = str_replace('{fade_effect}', $fade_effect, $item); $items[$idx] = $item; $icon = !empty($ex_icon[0]) ? "<i class='{$ex_icon[0]}'></i> " : ''; $heading = !empty($ex_heading[0]) ? $ex_heading[0] : __('Tab Item ') . ' ' . $idx; WR_Pb_Helper_Functions::heading_icon($heading, $icon); $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $tab_navigator[] = "<li {$active_li}><a href='#pane{$new_key}'>{$icon}{$heading}</a></li>"; } $sub_shortcode = implode('', $items); $tab_content = "<div class='tab-content'>{$sub_shortcode}</div>"; // update min-height of each tab content in case tap position is left/right if (in_array($tab_position, array('left', 'right'))) { $min_height = 36 * count($items); $tab_content = WR_Pb_Utils_Placeholder::remove_placeholder($tab_content, 'custom_style', "style='min-height: {$min_height}px'"); } $tab_navigator[] = '</ul>'; $tab_positions = array('top' => '', 'left' => 'tabs-left', 'right' => 'tabs-right', 'bottom' => 'tabs-below'); $extra_class = $tab_positions[$tab_position]; if ($tab_position == 'bottom') { $tab_content .= implode('', $tab_navigator); } else { $tab_content = implode('', $tab_navigator) . $tab_content; } $html_element = "<div class='tabbable {$extra_class}' id='tab_{ID}'>{$tab_content}</div>"; $html_element = str_replace('{ID}', "{$random_id}", $html_element); return $this->element_wrapper($html_element, $arr_params); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { extract(shortcode_atts($this->config['params'], $atts)); WR_Pb_Helper_Functions::heading_icon($heading, $icon, true); return "\n\t\t\t<li>\n\t\t\t\t[icon]<div class='wr-sub-icons' style='wr-styles'>\n\t\t\t\t\t<i class='{$icon}'></i>\n\t\t\t\t</div>[/icon]\n\t\t\t\t<div class='wr-list-content-wrap'>\n\t\t\t\t\t[heading]<h4 style='wr-list-title'>{$heading}</h4>[/heading]\n\t\t\t\t\t<p>{$content}</p>\n\t\t\t\t</div>\n\t\t\t</li><!--seperate-->"; }
/** * Register jquery-te assets * * @param array $scripts * @return array */ static function register_assets_register_modal($assets) { $assets['wr-pb-jquery-te-js'] = array('src' => WR_Pb_Helper_Functions::path('assets/3rd-party/jquery-te') . '/jquery-te-1.4.0.min.js', 'ver' => '1.4.0'); $assets['wr-pb-jquery-te-css'] = array('src' => WR_Pb_Helper_Functions::path('assets/3rd-party/jquery-te') . '/jquery-te-1.4.0.css', 'ver' => '1.4.0'); return $assets; }
/** * Remove group in layout * * @param type $group * @param type $layout */ static function remove_layout($group, $layout) { $layout_name = str_replace('.tpl', '', $layout); $dir = WR_Pb_Helper_Functions::get_wp_upload_folder('/wr-pb-layout/' . $group, false); $deleted = array(); if (is_dir($dir)) { // remove .tpl file $layout_file = $dir . "/{$layout_name}.tpl"; if (file_exists($layout_file)) { $deleted[] = unlink($layout_file) ? 1 : 0; } $thumbnail = "{$dir}/{$layout_name}.png"; $got_ext = self::check_ext_exist($dir, $layout_name); if (!empty($got_ext)) { $thumbnail = "{$dir}/{$layout_name}.{$got_ext}"; if (file_exists($thumbnail)) { $deleted[] = unlink($thumbnail) ? 1 : 0; } } if (in_array(0, $deleted)) { return false; } return true; } return false; }