smartslider&n2controller=slider&n2action=iframe&sliderid=' . $sliderIDorAlias . '&iseditor=' . (self::$iframeReason == 'ajax' ? 0 : 1) . '&hash=' . md5($sliderIDorAlias . NONCE_SALT) ); $html = ''; switch (self::$iframeReason) { case 'divi': $attributes['onload'] = str_replace(array( "\n", "\r", "\r\n", '"', ), array( "", "", "", "'" ), $script) . 'n2SSIframeLoader(this);'; break; case 'visualcomposer': default: $attributes['onload'] = str_replace(array( "\n", "\r", "\r\n" ), "", $script) . 'n2SSIframeLoader(this);'; break; } return $html . '
'; } public static function render($parameters, $usage = 'WordPress Shortcode') { $parameters = shortcode_atts(array( 'id' => md5(time()), 'slider' => '', 'logged_in' => null, 'role' => null, 'cap' => null, 'page' => null, 'lang' => null, 'slide' => null, 'get' => null ), $parameters); if (empty($parameters['slider'])) { return ''; } if ($parameters['logged_in'] !== null) { $logged_in = !!$parameters['logged_in']; if (is_user_logged_in() !== $logged_in) { return ''; } } if ($parameters['role'] !== null || $parameters['cap'] !== null) { $current_user = wp_get_current_user(); if ($parameters['role'] !== null) { $current_user_roles = $current_user->roles; if (!in_array($parameters['role'], $current_user_roles)) { return ''; } } if ($parameters['cap'] !== null) { $current_user_caps = $current_user->allcaps; if (!isset($current_user_caps[$parameters['cap']]) || !$current_user_caps[$parameters['cap']]) { return ''; } } } if ($parameters['page'] !== null) { if ($parameters['page'] == 'home') { $condition = (!is_home() && !is_front_page()); } else { $condition = ((get_the_ID() != intval($parameters['page'])) || (is_home() || is_front_page())); } if ($condition) { return ''; } } if ($parameters['lang'] !== null) { if ($parameters['lang'] != Localization::getLocale()) { return ''; } } if (!isset(self::$cacheSliderOutput[$parameters['slider']])) { if ((is_numeric($parameters['slider']) && intval($parameters['slider']) > 0) || !is_numeric($parameters['slider'])) { ob_start(); $slideTo = false; if ($parameters['slide'] !== null) { $slideTo = intval($parameters['slide']); } if ($parameters['get'] !== null) { $slideTo = Request::$GET->getInt($parameters['get']); } if ($slideTo && is_numeric($parameters['slider']) && intval($parameters['slider']) > 0) { echo wp_kses("", Sanitize::$assetTags); } $applicationTypeFrontend = ApplicationSmartSlider3::getInstance() ->getApplicationTypeFrontend(); $applicationTypeFrontend->process('slider', 'display', false, array( 'sliderID' => $parameters['slider'], 'usage' => $usage )); self::$cacheSliderOutput[$parameters['slider']] = ob_get_clean(); } else { return ''; } } return self::$cacheSliderOutput[$parameters['slider']]; } public static function changeShortcodeMode($mode) { if (self::$shortcodeMode != $mode) { self::$shortcodeMode = $mode; } } public static function shortcodeModeToNormal() { self::changeShortcodeMode('shortcode'); } public static function shortcodeModeToNoop() { self::changeShortcodeMode('noop'); } public static function shortcodeModeToSkip() { self::removeShortcode(); } public static function shortcodeModeRestore() { self::addShortCode(); } public static function addShortCode() { add_shortcode('smartslider3', array( self::class, 'doShortcode' )); } private static function removeShortcode() { remove_shortcode('smartslider3'); } public static function headStart() { self::shortcodeModeToNoop(); add_action('wp_enqueue_scripts', array( self::class, 'shortcodeModeToNormal' ), -1000000); add_action('wp_enqueue_scripts', array( self::class, 'shortcodeModeToNoop' ), 1000000); } public static function headEnd() { remove_action('wp_enqueue_scripts', array( self::class, 'shortcodeModeToNormal' ), -1000000); remove_action('wp_enqueue_scripts', array( self::class, 'shortcodeModeToNoop' ), 1000000); self::shortcodeModeToNormal(); } }