/** * 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); $random_id = IG_Pb_Utils_Common::random_string(); $tooltip_id = "tooltip_{$random_id}"; // don't allow to run shortcode $content = str_replace('[', '[[', $content); $content = str_replace(']', ']]', $content); $content = html_entity_decode($content); $content = preg_replace('/\\s+/', ' ', trim($content)); $button_color = !$button_color || strtolower($button_color) == 'default' ? '' : $button_color; $position = strtolower($position); $delay_show = !empty($show) ? intval($show) : 500; $delay_hide = !empty($hide) ? intval($hide) : 100; $direction = array('top' => 'top', 'bottom' => 'bottom', 'left' => 'left', 'right' => 'right'); $script = "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$('#{$tooltip_id}').click(function(e){\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t})\n\t\t\t\t\t\$('#{$tooltip_id}').tooltip({\n\t\t\t\t\t\thtml: true,\n\t\t\t\t\t\tdelay: { show: {$delay_show}, hide: {$delay_hide} },\n\t\t\t\t\t\tplacement: '{$direction[$position]}'\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; if ($tooltips_button == 'no') { $html = "<a id='{$tooltip_id}' class='ig-label-des-tipsy' title='{$content}' href='#'>{$text}</a>"; } else { $html = "<a id='{$tooltip_id}' class='ig-label-des-tipsy btn {$button_color}' title='{$content}' href='#'>{$text}</a>"; } $html = $html . $script; if (is_admin()) { $custom_style = "style='margin-top: 50px;'"; $html_element = "<center {$custom_style}>{$html}</center>"; } else { $html_element = $html; } return $this->element_wrapper($html_element, $arr_params); }
/** * Remove cache folder * * @return type */ static function remove_cache_folder() { $cache_dir = WP_CONTENT_DIR . '/uploads' . '/igcache/pagebuilder'; IG_Pb_Utils_Common::recursive_delete($cache_dir); // if directory still exits, false if (is_dir($dir)) { return false; } return true; }
/** * 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); $random_id = IG_Pb_Utils_Common::random_string(); $carousel_id = "carousel_{$random_id}"; $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = $automatic_cycling == 'yes' ? $interval_time : 'false'; $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : ''; $script = "<script type='text/javascript'>(function (\$){ \$( document ).ready(function(){if( \$( '#{$carousel_id}' ).length ){ \$( '#{$carousel_id}' ).carousel( {interval: {$interval},{$pause}} );}});} )( jQuery )</script>"; $styles = array(); if (!empty($dimension_width)) { $styles[] = "width : {$dimension_width}{$dimension_width_unit};"; } if (!empty($dimension_height)) { $styles[] = "height : {$dimension_height}px;"; } if (in_array($align, array('left', 'right', 'inherit'))) { $styles[] = "float : {$align};"; } else { if ($align == 'center') { $styles[] = 'margin : 0 auto;'; } } $styles = trim(implode(' ', $styles)); $styles = !empty($styles) ? "style='{$styles}'" : ''; $carousel_indicators = array(); $carousel_indicators[] = '<ol class="carousel-indicators">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1; foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{active}', $active, $item); $item = str_replace('{WIDTH}', !empty($dimension_width) ? 'width : ' . $dimension_width . $dimension_width_unit . ';' : '', $item); $item = str_replace('{HEIGHT}', !empty($dimension_height) ? 'height : ' . $dimension_height . 'px;' : '', $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $carousel_indicators[] = "<li data-target='#{$carousel_id}' data-slide-to='{$idx}' {$active_li}></li>"; } $carousel_content = "<div class='carousel-inner'>" . implode('', $items) . '</div>'; $carousel_indicators[] = '</ol>'; $carousel_indicators = implode('', $carousel_indicators); if ($show_indicator == 'no') { $carousel_indicators = ''; } $carousel_navigator = ''; if ($show_arrows == 'yes') { $carousel_navigator = "<a class='left carousel-control' href='#{$carousel_id}' data-slide='prev'><span class='icon-arrow-left'></span></a><a class='right carousel-control' href='#{$carousel_id}' data-slide='next'><span class='icon-arrow-right'></span></a>"; } $html = "<div class='carousel slide' {$styles} id='{$carousel_id}'>{$carousel_indicators} {$carousel_content} {$carousel_navigator}</div>"; return $this->element_wrapper($html . $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']); $multi_open = $arr_params['multi_open']; $filter = $arr_params['filter']; $random_id = IG_Pb_Utils_Common::random_string(); $script = ''; if ($multi_open == 'yes') { $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$( '#accordion_{$random_id} .panel-title a' ).click( function(e ){\n\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\tcollapse_item.collapse( 'toggle' )\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } else { // some case the collapse doesn't work, need this code $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\t\$( '#accordion_{$random_id} .panel-collapse' ).click( function(e ){\n\t\t\t\t\t\tvar collapse_item = \$( '#accordion_{$random_id} '+this.hash )\n\t\t\t\t\t\t\$( '#accordion_{$random_id} .panel-body' ).each(function(){\n\t\t\t\t\t\t\t\$( this ).addClass( 'panel-collapse' );\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcollapse_item.removeClass( 'panel-collapse' );\n\t\t\t\t\t\tcollapse_item.attr( 'style', '' );\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); // remove empty element $items = array_filter($items); // update id, class for each item $initial_open = $initial_open > count($items) ? 1 : $initial_open; foreach ($items as $idx => $item) { $open = $idx + 1 == $initial_open ? 'in' : ''; $item = str_replace('{index}', $random_id . $idx, $item); $item = str_replace('{show_hide}', $open, $item); $items[$idx] = $item; } $sub_shortcode = implode('', $items); $filter_html = ''; if ($filter == 'yes') { $sub_sc_data = IG_Pb_Helper_Shortcode::extract_sub_shortcode($content); $sub_sc_data = reset($sub_sc_data); // tags to filter item $tags = array('all'); foreach ($sub_sc_data as $shortcode) { $extract_params = shortcode_parse_atts($shortcode); $tags[] = $extract_params['tag']; } $tags = array_filter($tags); if (count($tags) > 1) { $tags = implode(',', $tags); $tags = explode(',', $tags); $tags = array_unique($tags); $filter_html = IG_Pb_Helper_Shortcode::render_parameter('filter_list', $tags, $random_id); // remove "All" tag array_shift($tags); $inner_tags = implode(',', $tags); $script .= "<script type='text/javascript'>( function (\$) {\n\t\t\t\t\$( document ).ready( function ()\n\t\t\t\t{\n\t\t\t\t\twindow.parent.jQuery.noConflict()( '#jsn_view_modal').contents().find( '#ig_share_data' ).text( '{$inner_tags}')\n\t\t\t\t\tvar parent_criteria = '#filter_{$random_id}'\n\t\t\t\t\tvar clientsClone = \$( '#accordion_{$random_id}' );\n\t\t\t\t\tvar tag_to_filter = 'div';\n\t\t\t\t\tvar class_to_filter = '.panel-default';\n\n\t\t\t\t\t\$( parent_criteria + ' a' ).click( function(e ) {\n\t\t\t\t\t\t// stop running filter\n\t\t\t\t\t\t\$( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).stop( true )\n\t\t\t\t\t\t})\n\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t//active clicked criteria\n\t\t\t\t\t\t\$( parent_criteria + ' li' ).removeClass( 'active' );\n\t\t\t\t\t\t\$( this ).parent().addClass( 'active' );\n\n\t\t\t\t\t\tvar filterData = \$( this ).attr( 'class' );\n\t\t\t\t\t\tvar filters;\n\t\t\t\t\t\tif( filterData == 'all' ){\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfilters = clientsClone.find( tag_to_filter + '[data-tag~='+ filterData +']' );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclientsClone.find( class_to_filter ).each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeOut()\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfilters.each(function(){\n\t\t\t\t\t\t\t\$( this ).fadeIn()\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} )( jQuery )</script>"; } } $html = '<div class="panel-group" id="accordion_{ID}">' . $sub_shortcode . '</div>'; $html = str_replace('{ID}', $random_id, $html); return $this->element_wrapper($filter_html . $html . $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 = 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); }
/** * DEFINE shortcode content * * @param type $atts * @param type $content */ public function element_shortcode_full($atts = null, $content = null) { $arr_params = shortcode_atts($this->config['params'], $atts); extract($arr_params); $random_id = IG_Pb_Utils_Common::random_string(); $carousel_id = "carousel_{$random_id}"; $interval_time = !empty($cycling_interval) ? intval($cycling_interval) * 1000 : 5000; $interval = $automatic_cycling == 'yes' ? $interval_time : 'false'; $pause = $pause_mouseover == 'yes' ? 'pause : "hover"' : ''; $script = ""; /*$styles = array(); if ( ! empty( $dimension_width ) ) $styles[] = "width : {$dimension_width}{$dimension_width_unit};"; if ( ! empty( $dimension_height ) ) $styles[] = "height : {$dimension_height}px;"; if ( in_array( $align, array( 'left', 'right', 'inherit') ) ) { $styles[] = "float : $align;"; } else if ( $align == 'center' ) $styles[] = 'margin : 0 auto;'; $styles = trim( implode( ' ', $styles ) ); $styles = ! empty( $styles ) ? "style='$styles'" : ''; */ $carousel_indicators = array(); $carousel_indicators[] = '<ol class="carousel-indicators">'; $sub_shortcode = IG_Pb_Helper_Shortcode::remove_autop($content); $items = explode('<!--seperate-->', $sub_shortcode); $items = array_filter($items); $initial_open = isset($initial_open) ? $initial_open > count($items) ? 1 : $initial_open : 1; foreach ($items as $idx => $item) { $active = $idx + 1 == $initial_open ? 'active' : ''; $item = str_replace('{active}', $active, $item); $item = str_replace('{WIDTH}', 'width : ' . $dimension_width . $dimension_width_unit . ';', $item); $item = str_replace('{HEIGHT}', 'height : ' . $dimension_height . 'px;', $item); $items[$idx] = $item; $active_li = $idx + 1 == $initial_open ? "class='active'" : ''; $carousel_indicators[] = "<li data-target='#{$carousel_id}' data-slide-to='{$idx}' {$active_li}></li>"; } $carousel_content = "" . implode('', $items) . ''; $html = "<div class='content-carousel' {$styles} id='{$carousel_id}'> \n\t\t\t\t <div class=\"slider\" data-slider=\"ios\" data-autoplay=\"{$autoplay}\" data-mode=\"{$car_mode}\" " . ($dimension_width != "" ? "data-width=\"{$dimension_width}\"" : "") . " " . ($dimension_height != "" ? "data-height=\"{$dimension_height}\"" : "") . ">\n\t\t\t\t {$carousel_content}\n\t\t\t\t </div>\n\t\t\t\t </div>"; return $this->element_wrapper($html . $script, $arr_params); }
/** * * @param type $content : inner shortcode elements of this column * @param string $shortcode_data * @return string */ public function element_in_pgbldr($content = '', $shortcode_data = '') { $column_html = empty($content) ? '' : IG_Pb_Helper_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 = IG_Pb_Utils_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', IGPBL) . '" 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 ig-more-element" href="javascript:void(0);"><i class="icon-plus"></i>' . __('Add Element', IGPBL) . '</a> </div> <textarea class="hidden" name="shortcode_content[]" >[/' . $this->config['shortcode'] . ']</textarea> </div> </div> </div>'; return $column; }
/** * Deactivate handle * * @global type $pagenow * @global type $wpdb */ function do_deactivate() { global $pagenow; if ($pagenow == 'plugins.php') { $deactivate_action = false; $ig_pb_plugin = 'ig-pagebuilder/ig-pagebuilder.php'; // check if single deactivate plugin/ bulk deactivate plugins if (!empty($_REQUEST['action']) && in_array($_REQUEST['action'], array('deactivate-selected', 'deactivate'))) { $action = $_REQUEST['action']; if ($action == 'deactivate' && $_REQUEST['plugin'] == $ig_pb_plugin || $action == 'deactivate-selected' && in_array($ig_pb_plugin, $_REQUEST['checked'])) { $deactivate_action = true; } } if ($deactivate_action) { $ig_action = 'ig_deactivate'; $plugin_url = admin_url('plugins.php'); // check whether delete only IG PageBuilder OR Bulk deactivate plugins $deactivate_one = isset($_POST['action']) ? false : true; // show Confirmation form before doing deactivate if (!isset($_REQUEST['ig_wpnonce']) && !isset($_REQUEST['ig_back'])) { // create ig_nonce $ig_nonce = wp_create_nonce($ig_action); $method = $deactivate_one ? 'GET' : 'POST'; $back_text = __('No, take me back', IGPBL); if ($deactivate_one) { $back_btn = "<a href='{$plugin_url}' class='button button-large'>" . $back_text . '</a>'; } else { $back_btn = "<input type='submit' name='ig_back' class='button button-large' value='" . $back_text . "'>"; } $form = " action='{$plugin_url}' method='{$method}' "; $fields = ''; foreach ($_REQUEST as $key => $value) { if (!is_array($value)) { $fields .= "<input type='hidden' name='{$key}' value='{$value}' />"; } else { foreach ($value as $p) { $fields .= "<input type='hidden' name='{$key}[]' value='{$p}' />"; } } } $fields .= "<input type='hidden' name='ig_wpnonce' value='{$ig_nonce}' />"; // show message ob_start(); ?> <p> <?php _e('After deactivating, all content built with PageBuilder will be parsed to plain HTML code. Are you sure you want to deactivate PageBuilder plugin?', IGPBL); ?> </p> <center> <form <?php echo balanceTags($form); ?> > <?php echo balanceTags($fields); ?> <input type="submit" name="ig_deactivate" class="button button-large" value="<?php _e('Yes, deactivate plugin', IGPBL); ?> " style="background: #d9534f;color: #fff;text-shadow:none;border:none;"> <?php echo balanceTags($back_btn); ?> </form> </center> <p style="font-style: italic; font-size: 12px;margin-top: 20px;"> <?php _e("Or if you want to deactivate without parsing 'content built with PageBuilder' to HTML code, click on the button below", IGPBL); ?> </p> <center> <form <?php echo balanceTags($form); ?> > <?php echo balanceTags($fields); ?> <input type="submit" name="ig_deactivate_light" class="button button-large" value="<?php _e('Deactivate without parsing data', IGPBL); ?> " style="background: #f0ad4e;color: #fff;text-shadow:none;border:none;"> </form> </center> <?php $message = ob_get_clean(); // Change page title _default_wp_die_handler($message, __('WordPress › Confirmation', IGPBL)); exit; } else { // get nonce $ig_nonce = esc_sql($_REQUEST['ig_wpnonce']); $nonce = wp_verify_nonce($ig_nonce, $ig_action); // if nonce is invalid if (!in_array($nonce, array(1, 2))) { _default_wp_die_handler(__('Nonce is invalid!', IGPBL)); exit; } // do action when customer choose "take me back" in confirmation form if (isset($_REQUEST['ig_back'])) { // remove IG PageBuilder from the checked list if (($key = array_search($ig_pb_plugin, $_REQUEST['checked'])) !== false) { unset($_REQUEST['checked'][$key]); } // Overwrite list of checked plugins to deactivating $_POST['checked'] = $_REQUEST['checked']; } else { if (isset($_REQUEST['ig_deactivate'])) { global $wpdb; // update post content = value of '_ig_html_content', deactivate pagebuilder $meta_key1 = 1; $meta_key2 = '_ig_html_content'; $meta_key3 = '_ig_deactivate_pb'; $wpdb->query($wpdb->prepare("\n\t\t\t\t\t\t\t\tUPDATE\t\t{$wpdb->posts} p\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p1\n\t\t\t\t\t\t\t\t\t\t\tON p1.post_id = p.ID\n\t\t\t\t\t\t\t\tLEFT JOIN\t{$wpdb->postmeta} p2\n\t\t\t\t\t\t\t\t\t\t\tON p2.post_id = p.ID\n\t\t\t\t\t\t\t\tSET\t\t\tpost_content = p1.meta_value, p2.meta_value = %d\n\t\t\t\t\t\t\t\tWHERE\t\tp1.meta_key = %s\n\t\t\t\t\t\t\t\t\t\t\tAND p2.meta_key = %s\n\t\t\t\t\t\t\t\t", $meta_key1, $meta_key2, $meta_key3)); // delete pagebuilder content IG_Pb_Utils_Common::delete_meta_key(array('_ig_page_builder_content', '_ig_page_active_tab')); do_action('ig_pb_deactivate'); } } } } } }
/** * Remove group layout * * @param type $group */ static function remove_group($group) { $group = substr($group, 0, -7); $dir = IG_Pb_Helper_Functions::get_wp_upload_folder('/ig-pb-layout/' . $group, false); if (is_dir($dir)) { IG_Pb_Utils_Common::recursive_delete($dir); // if directory still exits, false if (is_dir($dir)) { return false; } return true; } return false; }
/** * Upload premade layout to file * * @return type */ function upload_layout() { if (!isset($_POST[IGNONCE]) || !wp_verify_nonce($_POST[IGNONCE], IGNONCE)) { return; } $status = 0; if (!empty($_FILES)) { $fileinfo = $_FILES['file']; $file = $fileinfo['tmp_name']; $tmp_file = 'tmp-layout-' . time(); $dest = IG_Pb_Helper_Functions::get_wp_upload_folder('/ig-pb-layout/' . $tmp_file); if ($fileinfo['type'] == 'application/octet-stream') { WP_Filesystem(); $unzipfile = unzip_file($file, $dest); if ($unzipfile) { // explore extracted folder to get provider info $status = IG_Pb_Helper_Layout::import($dest); } // remove zip file unlink($file); } IG_Pb_Utils_Common::recursive_delete($dest); } echo intval($status); exit; }
/** * * Uninstalling IG PageBuilder: deletes post metas & options * * @author InnoGears Team <*****@*****.**> * @package IGPGBLDR * @version $Id$ */ //if uninstall not called from WordPress exit if (!defined('WP_UNINSTALL_PLUGIN')) { exit; } include_once 'core/utils/common.php'; // delete all other providers $providers = get_transient('_ig_pb_providers'); if ($providers) { $providers = unserialize($providers); $list_plugins = array(); foreach ($providers as $provider) { if (!empty($provider['file'])) { $list_plugins[] = $provider['file']; } } delete_plugins($list_plugins); } // delete cache folder IG_Pb_Utils_Common::remove_cache_folder(); // delete meta key IG_Pb_Utils_Common::delete_meta_key(array('_ig_page_builder_content', '_ig_html_content', '_ig_page_active_tab', '_ig_post_view_count', '_ig_deactivate_pb', '_ig_page_builder_css_files', '_ig_page_builder_css_custom'));
/** * Return html structure of shortcode in Page Builder area * * @param type $shortcode_name * @param type $attr * @param type $content */ public static function shortcode_to_pagebuilder($shortcode_name, $content = '', $shortcode_data = '', $shortcode_params = '') { $class = IG_Pb_Helper_Shortcode::get_shortcode_class($shortcode_name); if (class_exists($class)) { global $Ig_Pb; $elements = $Ig_Pb->get_elements(); $instance = isset($elements['element'][strtolower($class)]) ? $elements['element'][strtolower($class)] : null; if (!is_object($instance)) { $instance = new $class(); } $instance->init_element(); $el_title = ''; if ($class != 'IG_Widget') { // extract param of shortcode ( now for column ) if (isset($instance->config['extract_param'])) { parse_str(trim($shortcode_params), $output); foreach ($instance->config['extract_param'] as $param) { if (isset($output[$param])) { $instance->params[$param] = IG_Pb_Utils_Common::remove_quotes($output[$param]); } } } // get content in pagebuilder of shortcode: Element Title must always first option of Content tab if (isset($instance->items['content']) && isset($instance->items['content'][0])) { $title = $instance->items['content'][0]; if ($title['role'] == 'title') { $params = shortcode_parse_atts($shortcode_params); $el_title = !empty($params[$title['id']]) ? $params[$title['id']] : __('(Untitled)', IGPBL); } } } else { $widget_info = IG_Pb_Helper_Shortcode::extract_widget_params($shortcode_data); $el_title = !empty($widget_info['title']) ? $widget_info['title'] : ''; $params = IG_Pb_Helper_Shortcode::extract_params($shortcode_data); $instance->config['shortcode'] = $params['widget_id']; $instance->config['el_type'] = 'widget'; } $shortcode_view = $instance->element_in_pgbldr($content, $shortcode_data, $el_title); return $shortcode_view[0]; } }
/** * Generate HTML for local audio player. * * @param array $params Shortcode parameters. * * @return string HTML code. */ function generate_local_files($params) { $random_id = IG_Pb_Utils_Common::random_string(); $audio_size = array(); $audio_size['width'] = ' width="' . $params['audio_local_dimension_width'] . '" '; $audio_size['height'] = $params['audio_local_dimension_height'] != '' ? ' height="' . $params['audio_local_dimension_height'] . '" ' : ''; $player_options = '{'; $player_options .= $params['audio_local_start_volume'] != '' ? 'startVolume: ' . (int) $params['audio_local_start_volume'] / 100 . ',' : ''; $player_options .= $params['audio_local_loop'] != '' ? 'loop: ' . $params['audio_local_loop'] . ',' : ''; if (!isset($params['audio_local_player_image'])) { $_player_color = isset($params['audio_local_player_color']) ? '$( ".mejs-mediaelement, .mejs-controls", audio_container ).css( "background", "none repeat scroll 0 0 ' . $params['audio_local_player_color'] . '" );' : ''; } else { $_player_color = isset($params['audio_local_player_color']) ? '$( ".mejs-mediaelement, .mejs-controls", audio_container ).css( "background", "url(\'' . $params['audio_local_player_image'] . '\' ) repeat scroll 0 0 ' . $params['audio_local_player_color'] . '");' : ''; } $_progress_bar_color = isset($params['audio_local_progress_color']) ? '$( ".mejs-time-loaded, .mejs-horizontal-volume-current", audio_container ).css( "background", "none repeat scroll 0 0 ' . $params['audio_local_progress_color'] . '" );' : ''; $params['audio_local_elements'] = explode('__#__', $params['audio_local_elements']); $player_elements = ''; $player_elements .= in_array('play_button', $params['audio_local_elements']) ? '' : '$( ".mejs-playpause-button", audio_container ).hide();'; $player_elements .= in_array('current_time', $params['audio_local_elements']) ? '' : '$( ".mejs-currenttime-container", audio_container ).hide();'; $player_elements .= in_array('time_rail', $params['audio_local_elements']) ? '' : '$( ".mejs-time-rail", audio_container ).hide();'; $player_elements .= in_array('track_duration', $params['audio_local_elements']) ? '' : '$( ".mejs-duration-container", audio_container ).hide();'; $player_elements .= in_array('volume_button', $params['audio_local_elements']) ? '' : '$( ".mejs-volume-button", audio_container ).hide();'; $player_elements .= in_array('volume_slider', $params['audio_local_elements']) ? '' : '$( ".mejs-horizontal-volume-slider", audio_container ).hide();'; $container_class = $container_style = ''; if ($params['audio_alignment'] === 'right') { $player_elements .= 'audio_container.css( "float", "right" )'; $container_class .= 'clearafter pull-right'; } else { if ($params['audio_alignment'] === 'center') { $container_style .= 'margin: 0 auto;'; $player_elements .= 'audio_container.css( "margin", "0 auto" )'; } else { if ($params['audio_alignment'] === 'left') { $player_elements .= 'audio_container.css( "float", "left" )'; $container_class .= 'clearafter pull-left'; } } } // Genarate Container class $container_class .= ' ig-' . $random_id . ' ' . $container_class; $container_class = $container_class ? ' class="' . $container_class . '" ' : ''; $player_options .= 'success: function( mediaElement, domObject ){ var audio_container = $( domObject ).parents( ".mejs-container" ); ' . $player_elements . ' },'; $player_options .= 'keyActions:[]}'; $script = ' <script type="text/javascript"> jQuery( document ).ready( function ($ ){ new MediaElementPlayer("#' . $random_id . '", ' . $player_options . ' ); }); </script>'; $fixed_css = ''; if (isset($params['audio_local_dimension_height']) && $params['audio_local_dimension_height'] != '') { $fixed_css = "<style type='text/css'>.jsn-bootstrap3 .ig-element-audio .ig-{$random_id} .mejs-container {\n\tmin-height: {$params['audio_local_dimension_height']}px; \n}</style>"; } $container_style .= isset($params['audio_margin_left']) && $params['audio_margin_left'] != '' ? 'margin-left:' . $params['audio_margin_left'] . 'px;' : ''; $container_style .= isset($params['audio_margin_top']) && $params['audio_margin_top'] != '' ? 'margin-top:' . $params['audio_margin_top'] . 'px;' : ''; $container_style .= isset($params['audio_margin_right']) && $params['audio_margin_right'] != '' ? 'margin-right:' . $params['audio_margin_right'] . 'px;' : ''; $container_style .= isset($params['audio_margin_bottom']) && $params['audio_margin_bottom'] != '' ? 'margin-bottom:' . $params['audio_margin_bottom'] . 'px;' : ''; $container_style .= isset($params['audio_local_dimension_width']) && $params['audio_local_dimension_width'] != '' ? 'width:' . $params['audio_local_dimension_width'] . 'px' : ''; $container_style = $container_style ? ' style=" ' . $container_style . ' " ' : ''; // Define the media type $src = str_replace(' ', '+', $params['audio_source_local']); $source = '<source type="%s" src="%s" />'; $type = wp_check_filetype($src); $source = sprintf($source, $type['type'], esc_url($src)); return $fixed_css . $script . '<div ' . $container_class . $container_style . '> <audio controls="controls" preload="none" ' . $audio_size['width'] . $audio_size['height'] . ' id="' . $random_id . '" src="' . $src . '" > ' . $source . ' </audio> </div>'; }
/** * Generate HTML for Vimeo. * * @param array $params Shortcode parameters. * * @return string HTML code. */ function generate_vimeo($params) { $random_id = IG_Pb_Utils_Common::random_string(); $_w = ' width="' . $params['video_vimeo_dimension_width'] . '" '; $_h = $params['video_vimeo_dimension_height'] ? ' height="' . $params['video_vimeo_dimension_height'] . '" ' : ''; // Alignment $container_class = ''; $object_style = ''; if ($params['video_alignment'] === 'right') { $object_style .= 'float:right;'; $container_class .= 'clearafter pull-right'; } else { if ($params['video_alignment'] === 'center') { $object_style .= 'margin: 0 auto;'; } else { if ($params['video_alignment'] === 'left') { $object_style .= 'float:left;'; $container_class .= 'clearafter pull-left'; } } } // Genarate Container class $container_class = $container_class ? 'class="' . $container_class . '" ' : ''; // Margin. $container_style = ''; $container_style .= isset($params['video_margin_left']) && $params['video_margin_left'] != '' ? 'margin-left:' . $params['video_margin_left'] . 'px;' : ''; $container_style .= isset($params['video_margin_top']) && $params['video_margin_top'] != '' ? 'margin-top:' . $params['video_margin_top'] . 'px;' : ''; $container_style .= isset($params['video_margin_right']) && $params['video_margin_right'] != '' ? 'margin-right:' . $params['video_margin_right'] . 'px;' : ''; $container_style .= isset($params['video_margin_bottom']) && $params['video_margin_bottom'] != '' ? 'margin-bottom:' . $params['video_margin_bottom'] . 'px;' : ''; $container_style = $container_style ? ' style=" ' . $container_style . ' " ' : ''; // Get video ID. $params['video_source_link_vimeo'] = urldecode($params['video_source_link_vimeo']); $video_info = $this->get_vimeo_video_info($params['video_source_link_vimeo']); $video_info = json_decode($video_info); if (!$video_info) { return; } $video_info = $video_info->html; $_arr = array(); $video_src = ''; preg_match('/src\\s*\\n*=\\s*\\n*"([^"]*)"/i', $video_info, $_arr); if (count($_arr)) { $video_src = $_arr[1]; $video_src .= '?innerframe=true'; $video_src .= isset($params['video_vimeo_autoplay']) ? '&autoplay=' . (string) $params['video_vimeo_autoplay'] : ''; $video_src .= isset($params['video_vimeo_loop']) ? '&loop=' . (string) $params['video_vimeo_loop'] : ''; $video_src .= isset($params['video_vimeo_title']) ? '&title=' . (string) $params['video_vimeo_title'] : ''; $video_src .= isset($params['video_vimeo_color']) ? '&color=' . str_replace('#', '', (string) $params['video_vimeo_color']) : ''; } $embed = '<div ' . $container_class . $container_style . '>'; $embed .= '<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen style="display:block;' . $object_style . '" ' . $_w . $_h . '" src="' . $video_src . '" frameborder="0"></iframe>'; $embed .= '</div>'; return $embed; }
/** * Dummy content * * @return array */ static function lorem_text($word_count = 50) { return ucfirst(IG_Pb_Utils_Common::lorem_text($word_count, true)); }