/** * 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('IG_Pb_Helper_Functions') && IG_Pb_Helper_Functions::is_modal()) { $prefix = 'pb_admin'; } return $prefix; }
/** * Check compatibility of Addons vs Core * * @global type $Ig_Sc_Providers */ public static function compatibility_check() { global $Ig_Sc_Providers; $providers = $Ig_Sc_Providers; // get current version of core $core_version = IG_Pb_Helper_Functions::get_plugin_info(IG_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 = IG_Pb_Addon::core_version_requied_value($provider, $addon_file); if ($core_required) { // addon plugin name $addon_name = IG_Pb_Helper_Functions::get_plugin_info($provider['file_path'], 'Name'); $compatibility = IG_Pb_Addon::compatibility_handle($core_required, $core_version, $addon_file); if (!$compatibility) { // remove provider from list unset($Ig_Sc_Providers[$dir]); // show notice self::$notice[] = IG_Pb_Addon::show_notice(array('addon_name' => $addon_name, 'core_required' => $core_required), 'core_required'); } } } } }
/** * 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 = IG_Pb_Helper_Shortcode::remove_autop($content); IG_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' data-parent='#accordion_{ID}' href='#collapse{index}'>\n\t\t\t\t\t\t<i class='{$icon}'></i>{$heading}\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 $Ig_Pb, $Ig_Pb_Widgets; // Initialize IG PageBuilder $Ig_Pb = new IG_Pb_Core(); new IG_Pb_Utils_Plugin(); do_action('ig_pagebuilder_init'); // Initialize productivity functions IG_Pb_Product_Plugin::init(); // Initialize widget support $Ig_Pb_Widgets = !empty($Ig_Pb_Widgets) ? $Ig_Pb_Widgets : IG_Pb_Helper_Functions::widgets(); }
/** * Register tinymce assets * * @param array $scripts * @return array */ static function register_assets_register_modal($assets) { $assets['ig-pb-wysiwyg-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/jquery.wysiwyg.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-css'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/jquery.wysiwyg.css', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-0.9-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/jquery.wysiwyg-0.9.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-0.9-css'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/jquery.wysiwyg-0.9.css', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-colorpicker-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/controls/wysiwyg.colorpicker.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-table-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/controls/wysiwyg.table.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-cssWrap-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/controls/wysiwyg.cssWrap.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-image-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/controls/wysiwyg.image.js', 'ver' => '1.0.0'); $assets['ig-pb-wysiwyg-link-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-jwysiwyg') . '/controls/wysiwyg.link.js', 'ver' => '1.0.0'); return $assets; }
/** * 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); $script = $html_element = ''; if (isset($enable_dropcap) && $enable_dropcap == 'yes') { if ($content) { $styles = array(); if ($dropcap_font_face_type == 'google fonts' and $dropcap_font_face_value != '') { $script .= IG_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 .= 'div.ig_text p.dropcap:first-letter { float:left;'; $html_element .= implode(';', $styles); $html_element .= '}'; $html_element .= '</style>'; } $html_element .= "<p class='dropcap'>{$content}</p>"; } } else { $html_element .= '<p>' . $content . '</p>'; } $html = '<div class="ig_text">'; $html .= $script; $html .= $html_element; $html .= '</div>'; return $this->element_wrapper($html, $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); extract($arr_params); $html_elemments = $script = ''; $image_styles = array(); if ($image_margin_top) { $image_styles[] = "margin-top:{$image_margin_top}px"; } if ($image_margin_bottom) { $image_styles[] = "margin-bottom:{$image_margin_bottom}px"; } if ($image_margin_right) { $image_styles[] = "margin-right:{$image_margin_right}px"; } if ($image_margin_left) { $image_styles[] = "margin-left:{$image_margin_left}px"; } $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : ''; if ($image_file) { $html_elemments .= "<div class='contact-img-wrapper {$image_container_style}'>"; $image_id = IG_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; $html_elemments .= "<img src='{$image_file}'{$alt_text}{$styles}{$class_img} />"; $script = ''; $target = ''; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); if ($items) { $buttons = "" . implode('', $items) . ''; $html_elemments .= "<div class='btns-wrapper'><div class='contact-btns'>" . $buttons . "</div><div class='vertical-helper'></div></div>"; } $html_elemments .= '</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); }
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 (IG_Pb_Helper_Functions::is_modal_of_element($this->config['shortcode'])) { IG_Pb_Helper_Functions::shortcode_enqueue_assets($this, 'admin_assets', ''); } parent::__construct(); }
/** * 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 src='{$image_file}' style='{HEIGHT}'>" : ''; // remove image shortcode in content $content = IG_Pb_Helper_Shortcode::remove_ig_shortcodes($content, 'ig_image'); $inner_content = IG_Pb_Helper_Shortcode::remove_autop($content); IG_Pb_Helper_Functions::heading_icon($heading, $icon, true); 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-->"; }
/** * Activate handle */ function do_activate() { // get current version of plugin $latest_version = IG_Pb_Helper_Functions::get_plugin_info(IG_PB_FILE, 'Version'); // get previous version of plugin $old_version = get_transient('ig_pb_version'); // compare version if (!$old_version || version_compare($old_version, $latest_version, '<')) { // update plugin version set_transient('ig_pb_version', $latest_version); // remove cache folder if plugin is installed before if ($old_version) { IG_Pb_Utils_Common::remove_cache_folder(); } } // remove free shortcode directory if (is_dir(WP_PLUGIN_DIR . '/ig-shortcodes-free')) { delete_plugins(array('ig-shortcodes-free/main.php')); } }
<p><strong><?php echo esc_html($msg); ?> </strong></p> </div> <?php } $options = array('ig_pb_settings_cache', 'ig_pb_settings_boostrap_js', 'ig_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); IG_Pb_Helper_Functions::alert_msg(array('success', __('Your settings are saved successfully', IGPBL))); } // get saved options value foreach ($options as $key) { ${$key} = get_option($key, 'enable'); } // show options form ?> <form method="POST" action="options.php"> <?php $page = 'ig-pb-settings'; settings_fields($page); do_settings_sections($page); submit_button(); ?> </form>
/** * 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)); IG_Pb_Helper_Functions::heading_icon($heading, $icon, true); return "\n\t\t\t<li>\n\t\t\t\t[icon]<div class='ig-sub-icons' style='ig-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='ig-list-content-wrap'>\n\t\t\t\t\t[heading]<h4 style='ig-list-title'>{$heading}</h4>[/heading]\n\t\t\t\t\t<div class='ig-list-content'>\n\t\t\t\t\t\t{$content}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</li><!--seperate-->"; }
/** * Print style on front-end */ function print_frontend_styles() { global $post; if (!isset($post) || !is_object($post)) { return; } $ig_deactivate_pb = get_post_meta($post->ID, '_ig_deactivate_pb', true); // if not deactivate pagebuilder on this post if (empty($ig_deactivate_pb)) { $custom_css_data = IG_Pb_Helper_Functions::custom_css_data(isset($post->ID) ? $post->ID : NULL); extract($custom_css_data); $css_custom = stripslashes($css_custom); echo balanceTags("<style id='ig-pb-custom-{$post->ID}-css'>\n{$css_custom}\n</style>\n"); } }
/** * 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 IG PageBuilder's provider:", IGPBL); ?> <br> <b><?php echo esc_html($addon_name); ?> </b> </p> <p> <?php _e("It requires IG PageBuilder's version:", IGPBL); ?> <br> <b><?php echo esc_html($core_required); ?> </b> <br> <?php echo esc_html('or above to work. Please update IG PageBuilder to newest version.'); ?> <br> </p> </div> <!-- custom js to hide "Plugin actived" --> <?php $js_code = "\$('#message.updated').hide();"; echo balanceTags(IG_Pb_Helper_Functions::script_box($js_code)); break; default: break; } $message = ob_get_clean(); return $message; }
/** * Remove group in layout * * @param type $group * @param type $layout */ static function remove_layout($group, $layout) { $layout_name = str_replace('.tpl', '', $layout); $dir = IG_Pb_Helper_Functions::get_wp_upload_folder('/ig-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; }
/** * 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 = IG_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 (IG_Pb_Helper_Functions::is_preview()) { return ''; //_e( 'This element is deactivated. It will be hidden at frontend', IGPBL ); } 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); }
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}'" : 'alt=""'; $image_styles = array(); if ($image_margin_top) { $image_styles[] = "margin-top:{$image_margin_top}px"; } if ($image_margin_bottom) { $image_styles[] = "margin-bottom:{$image_margin_bottom}px"; } if ($image_margin_right) { $image_styles[] = "margin-right:{$image_margin_right}px"; } if ($image_margin_left) { $image_styles[] = "margin-left:{$image_margin_left}px"; } $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : ''; $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_type == 'banner') { $img_banner = ' data-image-type="banner" data-image-text="' . $banner_text . '" '; } if ($image_file) { $image_id = IG_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; if ($image_type != 'banner_wel') { $html_elemments .= "<img src='{$image_file}'{$alt_text}{$styles}{$class_img}{$img_banner} />"; } else { $html_elemments .= "<div class=\"wel-banner\"><img src='{$image_file}'{$alt_text}{$styles}{$class_img} />\n <div class=\"wel-b-overlay\">{$welcome_text}</div>\n </div>"; } $script = ''; $target = ''; if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'lightbox': $cls_button_fancy = ' pt-image-fancy'; $img_gal = ' rel="prettyPhoto" '; break; } } $class = !empty($cls_button_fancy) ? "class='{$cls_button_fancy}'" : ''; $img_gal = !empty($img_gal) ? $img_gal : ''; // get Single Item and check type to get right link @($single_item = explode('__#__', $single_item)); $single_item = $single_item[0]; $taxonomies = IG_Pb_Helper_Type::get_public_taxonomies(); $post_types = IG_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}{$img_gal}>" . $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}{$img_gal}>" . $html_elemments . '</a>'; } } else { switch ($link_type) { case 'url': $html_elemments = "<a href='{$image_type_url}'{$target}{$class}{$img_gal}>" . $html_elemments . '</a>'; break; case 'large_image': $image_id = IG_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}{$img_gal}>" . $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); }
/** * Register jquery-te assets * * @param array $scripts * @return array */ static function register_assets_register_modal($assets) { $assets['ig-pb-jquery-te-js'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-te') . '/jquery-te-1.4.0.min.js', 'ver' => '1.4.0'); $assets['ig-pb-jquery-te-css'] = array('src' => IG_Pb_Helper_Functions::path('assets/3rd-party/jquery-te') . '/jquery-te-1.4.0.css', 'ver' => '1.4.0'); return $assets; }
/** * 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 = IG_Pb_Helper_Type::get_public_taxonomies(); $post_types = IG_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 'lightbox': $cls_button_fancy = 'ig-button-fancy'; $script = IG_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; $html_result = "<{$tag} class='btn {$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-->'; }
/** * 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) { global $post; $arr = array('css_files' => '', 'css_custom' => ''); if (isset($post_id)) { $arr['css_files'] = IG_Pb_Helper_Functions::custom_css($post_id, 'css_files'); $arr['css_custom'] = IG_Pb_Helper_Functions::custom_css($post_id, 'css_custom'); } return $arr; }
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html * * Websites: http://www.www.innogears.com * Technical Support: Feedback - http://www.www.innogears.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>'; $css_files = $css_custom = ''; if (empty($_GET['pid'])) { exit; } $post_id = esc_sql($_GET['pid']); // get custom css data $custom_css_data = IG_Pb_Helper_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; }'; IG_Init_Assets::inline('css', $_style, true); ?> <div class="jsn-master" id="ig-pb-custom-css-box"> <div class="jsn-bootstrap3">
/** * 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 = IG_Pb_Helper_Type::get_public_taxonomies(); $post_types = IG_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 'lightbox': $cls_button_fancy = 'ig-pb-button-fancy'; 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>"; if (isset($cls_button_fancy) && !empty($cls_button_fancy)) { $button .= ' <script type="text/javascript"> (function($) { $(document).ready(function() { $(".' . $cls_button_fancy . '" ).fancybox({type:"iframe",autoScale:"false",transitionIn:"elastic",transitionOut:"elastic",width:"75%",height:"75%"}); }); })(jQuery); </script>'; } } $styles = implode(';', $styles); $styles = $styles ? "style='{$styles}'" : ''; $html_element .= "<div class='ig-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 .= IG_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 ig_localize() { IG_Init_Assets::localize('ig-pb-handlesetting-js', 'Ig_Ajax', IG_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); $initial_open = intval($arr_params['initial_open']); $tab_position = $arr_params['tab_position']; $random_id = IG_Pb_Utils_Common::random_string(); $tab_navigator = array(); $tab_navigator[] = '<ul class="nav nav-tabs">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($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; IG_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}' data-toggle='tab'>{$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 = IG_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); }
/** * 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}'" : ''; $image_styles = array(); if ($image_margin_top) { $image_styles[] = "margin-top:{$image_margin_top}px"; } if ($image_margin_bottom) { $image_styles[] = "margin-bottom:{$image_margin_bottom}px"; } if ($image_margin_right) { $image_styles[] = "margin-right:{$image_margin_right}px"; } if ($image_margin_left) { $image_styles[] = "margin-left:{$image_margin_left}px"; } $styles = count($image_styles) ? ' style="' . implode(';', $image_styles) . '"' : ''; $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 = IG_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; $html_elemments .= "<img src='{$image_file}'{$alt_text}{$styles}{$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='" . IG_Pb_Helper_Functions::path('assets/3rd-party') . '/jquery-lazyload/grey.gif' . "' data-original='{$image_file}' width='{$width}' height='{$height}' {$alt_text}{$styles} {$class_img}/>"; } if ($open_in) { switch ($open_in) { case 'current_browser': $target = ''; break; case 'new_browser': $target = ' target="_blank"'; break; case 'lightbox': $cls_button_fancy = 'ig-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 = IG_Pb_Helper_Type::get_public_taxonomies(); $post_types = IG_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 = IG_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) { $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 IG_Pb_Helper_Shortcode::generate_shortcode_params($this->items, NULL, $atts); $arr_params = shortcode_atts($this->config['params'], $atts); $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', IGPBL) || $value == 'standard fonts') { $font_style = 'font-family:' . $arr_params['font_face_value']; } elseif ($value == __('Google fonts', IGPBL) || $value == 'google fonts') { $script = IG_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 = IG_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 = ''; } // Finalize HTML code $true_element = "<{$arr_params['tag']} style='{$style}'>" . IG_Pb_Helper_Shortcode::remove_autop($content) . "</{$arr_params['tag']}>"; return $this->element_wrapper($script . $stylesheet . $true_element, $arr_params); }
/** * define shortcode structure of element */ function element_shortcode($atts = null, $content = null) { $extra_class = $style = $custom_script = ''; if (isset($atts) && is_array($atts)) { $arr_styles = array(); switch ($atts['width']) { case 'full': $extra_class = 'ig_fullwidth'; // some overwrite css to enable row full width $script = "\$('body').addClass('ig-full-width');"; $custom_script = IG_Pb_Helper_Functions::script_box($script); $arr_styles[] = '-webkit-box-sizing: content-box;-moz-box-sizing: content-box;box-sizing: content-box;width: 100%;padding-left: 1000px;padding-right: 1000px;margin:0 -1000px;'; break; case 'boxed': ///$arr_styles[] = "width: 100%;"; break; } $background = ''; switch ($atts['background']) { case 'none': if ($atts['width'] == 'full') { $background = 'background: none;'; } break; case 'solid': $solid_color = $atts['solid_color_value']; $background = "background-color: {$solid_color};"; break; case 'gradient': $background = $atts['gradient_color_css']; break; case 'pattern': $pattern_img = $atts['pattern']; $pattern_repeat = $atts['repeat']; $pattern_stretch = $atts['stretch']; $background = "background-image:url(\"{$pattern_img}\");"; switch ($pattern_repeat) { case 'full': $background_repeat = 'repeat'; break; case 'vertical': $background_repeat = 'repeat-y'; break; case 'horizontal': $background_repeat = 'repeat-x'; break; } $background .= "background-repeat:{$background_repeat};"; switch ($pattern_stretch) { case 'none': $background_size = ''; break; case 'full': $background_size = '100% 100%'; break; case 'cover': $background_size = 'cover'; break; case 'contain': $background_size = 'contain'; break; } $background .= !empty($background_size) ? "background-size:{$background_size};" : ''; break; case 'image': $image = $atts['image']; $image_position = $atts['position']; $background = "background-image:url(\"{$image}\");background-position:{$image_position};"; break; } $arr_styles[] = $background; if (isset($atts['paralax']) && $atts['paralax'] == 'yes') { $arr_styles[] = 'background-attachment:fixed;'; } if (isset($atts['border_width_value_']) && intval($atts['border_width_value_'])) { $border = array(); $border[] = $atts['border_width_value_'] . 'px'; $border[] = $atts['border_style']; $border[] = $atts['border_color']; $border = implode(' ', $border); $arr_styles[] = "border-top:{$border}; border-bottom:{$border};"; } $arr_styles[] = "padding-top:{$atts['div_padding_top']}px;"; $arr_styles[] = "padding-bottom:{$atts['div_padding_bottom']}px;"; if ($atts['width'] != 'full') { $arr_styles[] = "padding-left:{$atts['div_padding_left']}px;"; $arr_styles[] = "padding-right:{$atts['div_padding_right']}px;"; } $arr_styles = implode('', $arr_styles); $style = !empty($arr_styles) ? "style='{$arr_styles}'" : ''; } $extra_class .= !empty($atts['css_suffix']) ? ' ' . esc_attr($atts['css_suffix']) : ''; $extra_class = ltrim($extra_class, ' '); $extra_id = !empty($atts['id_wrapper']) ? ' ' . esc_attr($atts['id_wrapper']) : ''; $extra_id = !empty($extra_id) ? "id='" . ltrim($extra_id, ' ') . "'" : ''; return $custom_script . "<div class='jsn-bootstrap3'>" . "<div {$extra_id} class='row {$extra_class}' {$style}>" . IG_Pb_Helper_Shortcode::remove_autop($content) . '</div>' . '</div>'; }