/** * Constructor * * @return void */ public function __construct() { // Load core functionalities $this->includes(); $this->autoload(); // Initialize assets management and loader IG_Pb_Assets_Register::init(); IG_Init_Assets::hook(); // Register necessary actions add_action('widgets_init', array(&$this, 'init'), 100); add_action('admin_init', array('IG_Gadget_Base', 'hook'), 100); add_action('admin_init', array('IG_Pb_Product_Plugin', 'settings_form')); // Initialize built-in shortcodes include dirname(__FILE__) . '/shortcodes/main.php'; }
<button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Cancel', IG_LIBRARY_TEXTDOMAIN); ?> </button> </div> </div> </div> </div> </div> <?php // Load inline script initialization $script = ' new $.IG_ProductAddons({ base_url: "' . esc_url(admin_url('admin-ajax.php?action=ig-addons-management')) . '", core_plugin: "' . $plugin['Identified_Name'] . '", has_saved_account: ' . ($has_customer_account ? 'true' : 'false') . ', language: { CANCEL: "' . __('Cancel', IG_LIBRARY_TEXTDOMAIN) . '", INSTALL: "' . __('Install', IG_LIBRARY_TEXTDOMAIN) . '", UNINSTALL: "' . __('Uninstall', IG_LIBRARY_TEXTDOMAIN) . '", INSTALLED: "' . __('Installed', IG_LIBRARY_TEXTDOMAIN) . '", INCOMPATIBLE: "' . __('Incompatible', IG_LIBRARY_TEXTDOMAIN) . '", UNINSTALL_CONFIRM: "' . __('Are you sure you want to uninstall %s?', IG_LIBRARY_TEXTDOMAIN) . '", AUTHENTICATING: "' . __('Verifying...', IG_LIBRARY_TEXTDOMAIN) . '", INSTALLING: "' . __('Installing...', IG_LIBRARY_TEXTDOMAIN) . '", UPDATING: "' . __('Updating...', IG_LIBRARY_TEXTDOMAIN) . '", UNINSTALLING: "' . __('Uninstalling...', IG_LIBRARY_TEXTDOMAIN) . '", } });'; IG_Init_Assets::inline('js', $script);
$page = 'ig-pb-settings'; settings_fields($page); do_settings_sections($page); submit_button(); ?> </form> </div> <?php // Load inline script initialization $script = ' new IG_Pb_Settings({ ajaxurl: "' . admin_url('admin-ajax.php') . '", _nonce: "' . wp_create_nonce(IGNONCE) . '", button: "ig-pb-clear-cache", button: "ig-pb-clear-cache", loading: "#ig-pb-clear-cache .layout-loading", message: $("#ig-pb-clear-cache").parent().find(".layout-message"), }); '; IG_Init_Assets::inline('js', $script); // Load inlide style $loading_img = IG_PB_URI . '/assets/innogears/images/icons-16/icon-16-loading-circle.gif'; $style = ' .jsn-bootstrap3 { margin-top: 30px; } .jsn-bootstrap3 .checkbox { background:#fff; } #ig-pb-clear-cache, .layout-message { margin-left: 6px; } .jsn-icon-loading { background: url("' . $loading_img . '") no-repeat scroll left center; content: " "; display: none; height: 16px; width: 16px; float: right; margin-left: 20px; margin-top: -26px; padding-top: 10px; } '; IG_Init_Assets::inline('css', $style);
/** * Register assets with WordPress. * * @return void */ protected static function register() { // Filter assets to be registered self::$assets = apply_filters('ig_register_assets', self::$assets); foreach (self::$assets as $key => $value) { // If asset is registered, continue the loop if (in_array($key, self::$registered)) { continue; } // Store asset being registered self::$registered[] = $key; // Set default value for missing data isset($value['deps']) || ($value['deps'] = array()); isset($value['ver']) || ($value['ver'] = null); // Detect asset type $type = substr($key, -4) == '-css' ? 'style' : 'script'; // Shorten asset and dependency keys $key = preg_replace('/-(css|js)$/', '', $key); foreach ($value['deps'] as $k => $v) { if (array_key_exists($v, self::$assets)) { $value['deps'][$k] = preg_replace('/-(css|js)$/', '', $v); } } // Register asset call_user_func("wp_register_{$type}", $key, $value['src'], $value['deps'], $value['ver']); } }
" class="item"> <div class="checkbox"> <label> <input type="checkbox" onclick="jQuery(this).next().val(this.checked ? 1 : 0);" <?php if ($this->attributes['value']) { echo ' checked="checked"'; } ?> /> <input <?php $this->html_attributes(array('class', 'id', 'placeholder')); ?> /> <?php esc_html_e($label); ?> </label> </div> </li> <?php // Restore original attributes $this->attributes = $original_attrs; } ?> </ul> <?php if ($this->sortable) { $script = ' $("#' . $this->get('id', null, true) . '").sortable({});'; IG_Init_Assets::inline('js', $script, true); }
extract($_POST); $submodal = !empty($submodal) ? 'submodal_frame' : ''; if (!isset($params)) { exit; } if (!empty($shortcode)) { $script = ''; if (isset($init_tab) && $init_tab == 'styling') { // Auto move to Styling tab if previous action // is coping style from other element. $script .= "\n\t\t\t(function (\$) {\n\t\t\t\t\$(document).ready(function (){\n\t\t\t\t\tsetTimeout(function (){\n\t\t\t\t\t\t\$('[href=\"#styling\"]').click();\n\t\t\t\t\t}, 500);\n\n\t\t\t\t});\n\t\t\t})(jQuery);"; } if ($_REQUEST['form_only']) { $script .= " var ig_pb_modal_ajax = true;"; } IG_Init_Assets::print_inline('js', $script, true); ?> <div id="ig-element-<?php echo esc_attr(IG_Pb_Helper_Shortcode::shortcode_name($shortcode)); ?> "> <div class="ig-pb-form-container jsn-bootstrap3"> <div id="modalOptions" class="form-horizontal <?php echo esc_attr($submodal); ?> "> <?php if (!empty($params)) { $params = stripslashes($params); $params = urldecode($params);
/** * Localize for js files */ public static function ig_localize() { IG_Init_Assets::localize('ig-pb-handleelement', 'Ig_Translate', IG_Pb_Helper_Functions::js_translation()); IG_Init_Assets::localize('ig-pb-handleelement', 'Ig_Js_Html', IG_Pb_Helper_Shortcode::$item_html_template); IG_Init_Assets::localize('ig-pb-handleelement', 'Ig_Ajax', IG_Pb_Helper_Functions::localize_js()); // Localize scripts for premade layout modal. IG_Init_Assets::localize('ig-pb-premade-pages', 'Ig_Translate', IG_Pb_Helper_Functions::js_translation()); IG_Init_Assets::localize('ig-pb-premade-pages', 'Ig_Ajax', IG_Pb_Helper_Functions::localize_js()); IG_Init_Assets::localize('ig-pb-layout', 'Ig_Translate', IG_Pb_Helper_Functions::js_translation()); IG_Init_Assets::localize('ig-pb-widget', 'Ig_Preview_Html', IG_Pb_Helper_Functions::get_element_item_html(array('element_wrapper' => 'div', 'modal_title' => '', 'element_type' => 'data-el-type="element"', 'name' => 'Widget Element Setting', 'shortcode' => 'IG_SHORTCODE_CONTENT', 'shortcode_data' => 'IG_SHORTCODE_DATA', 'content_class' => 'ig-pb-element', 'content' => 'Widget Element Setting'))); }
/** * HTML content for Custom css Modal */ public function content_custom_css() { $assets = apply_filters('ig_pb_assets_enqueue_modal', array('ig-pb-codemirror-css', 'ig-pb-codemirror-js', 'ig-pb-codemirrormode-css-js')); IG_Init_Assets::load($assets); include IG_PB_TPL_PATH . '/custom-css.php'; }
/** * Register pagebuilder widget assets * * @return void */ function widget_register_assets() { global $pagenow; if ($pagenow == 'widgets.php') { // enqueue admin script if (function_exists('wp_enqueue_media')) { wp_enqueue_media(); } else { wp_enqueue_style('thickbox'); wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); } $this->load_assets(); IG_Init_Assets::load('ig-pb-handlesetting-js'); IG_Init_Assets::load('ig-pb-jquery-fancybox-js'); IG_Init_Assets::load('ig-pb-widget-js'); } }
/** * Render form. * * @param string $alignment Form alignment, either 'form-inline', 'form-horizontal' or leave empty for vertical alignment. * @param array $js_init Print Javascript initialization for which: tabs, accordion, tips? * @param string $section_id Which form section to render? Leave empty to render all sections by default. * * @return void */ public function render($alignment = null, $js_init = array('tips', 'accordions', 'tabs'), $section_id = '') { // Do 'ig_pre_render_form' action do_action('ig_pre_render_form', $this); // Render all form sections or a specified one? if (!empty($section_id) && array_key_exists($section_id, $this->fields)) { // Update Javascript initialization $js_init[] = 'ajax'; // Backup current fields data $fields = $this->fields; // Remove data of unnecessary form section foreach (array_keys($this->fields) as $sid) { if ($section_id != $sid) { unset($this->fields[$sid]['fields']); unset($this->fields[$sid]['fieldsets']); unset($this->fields[$sid]['accordion']); unset($this->fields[$sid]['tabs']); } } } // Load assets IG_Init_Assets::load(array('ig-form-css', 'ig-form-js')); // Load form template if (!empty($alignment)) { $tpl = IG_Loader::get_path("form/tmpl/form-{$alignment}.php"); } if (isset($tpl) && !empty($tpl)) { include $tpl; } else { include IG_Loader::get_path('form/tmpl/form.php'); } // Render all form sections or a specified one? if (!empty($section_id) && array_key_exists($section_id, $this->fields)) { // Restore original fields data $this->fields = $fields; } // Do 'ig_post_render_form' action do_action('ig_post_render_form', $this); }
/** * Enqueue custom asset for front-end. * * @return void */ public function custom_assets_frontend() { parent::custom_assets_frontend(); if (file_exists(ABSPATH . 'wp-includes/js/mediaelement/wp-mediaelement.js')) { wp_enqueue_style('mediaelement'); // re- register mediaelement player js to avoid conflict in admin if (is_admin()) { if (file_exists(ABSPATH . 'wp-includes/js/mediaelement/mediaelement-and-player.min.js')) { IG_Init_Assets::load('ig-pb-mediaelement-js', get_site_url() . '/wp-includes/js/mediaelement/mediaelement-and-player.min.js'); } else { IG_Init_Assets::load('ig-pb-mediaelement-js', get_site_url() . '/wp-includes/js/mediaelement/mediaelement-and-player.js'); } } else { wp_enqueue_script('mediaelement'); } } }
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"> <!-- CSS files --> <div class="form-group control-group jsn-items-list-container ig-modal-content"> <label for="option-items-itemlist" class="control-label top-cut" ><?php _e('CSS Files', IGPBL); ?> <i class=" icon-question-sign" data-toggle="tooltip" data-title="<?php _e($_css_files_tooltip, IGPBL); ?> "></i></label> <div class="controls">