public static function show_admin_options($curr_options = null) { ?> <div class="rs-info"> <p class="rs-awesome-paragraph"><?php _e('Here you can create gallery from any Flickr photoset', 'new_royalslider'); ?> </p> <p><?php _e('To create such gallery go to your <a href="http://www.flickr.com/services/api/keys/" target="_blank">Flickr account</a> and request your API key. Then simply enter your data in settings below.<br/>Requested Flickr image thumbnail size is 75x75px, so for some templates you need to change default size of them, you can do this in right sidebar options "Thumbnails,tabs,bullets" -> "Thumbnail Width" and "Thumbnail Height.', 'new_royalslider'); ?> </p> <div class="help-video"><a class="in-page-action" href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-royalslider-from-flickr-photoset" target="_blank"><?php _e('View help video about how to create Flickr gallery', 'new_royalslider'); ?> </a></div><br/> </div> <?php $fields = array(array('name' => 'api_key', 'label' => __('Flickr API key', 'new_royalslider'), 'desc' => __('API key', 'new_royalslider'), 'type' => 'text', 'default' => '', 'data-type' => 'str', 'size' => 'short', 'ignore' => true), array('desc' => __('Your <a href="http://www.flickr.com/services/api/keys/" target="_blank">Flickr API key</a>.', 'new_royalslider')), array('name' => 'photoset_id', 'label' => __('Flickr photoset ID', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'text', 'default' => '', 'data-type' => 'str', 'size' => 'short', 'ignore' => true), array('desc' => __('Any <a href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-how-to-find-flickr-photoset-id" target="_blank">Flickr photoset ID</a>', 'new_royalslider'), 'delimiter' => true), array('name' => 'max_items', 'label' => __('Maximum items', 'new_royalslider'), 'desc' => __('Maximum items to fetch from Flickr', 'new_royalslider'), 'type' => 'number', 'default' => '10', 'data-type' => 'num', 'size' => 'short', 'ignore' => true), array('desc' => __('Maximum number of items to include in slider.', 'new_royalslider')), array('name' => 'medSize', 'label' => __('Image size', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('' => __('500 on longest side', 'new_royalslider'), '_z' => __('640 on longest side', 'new_royalslider'), '_c' => __('800 on longest side', 'new_royalslider'), '_b' => __('1024 on longest side', 'new_royalslider')), 'default' => 'image', 'ignore' => true), array('desc' => __('Size of default main slider image', 'new_royalslider'))); if (isset($curr_options) && isset($curr_options['flickr'])) { $flickr_opts = $curr_options['flickr']; $fields = NewRoyalSliderOptions::parseCurrentOptions($fields, $flickr_opts); } echo '<div id="rs-flickr-options" class="rs-body-options">'; echo '<h3>' . __('Flickr Settings', 'new_royalslider') . '</h3>'; foreach ($fields as $key => $field) { echo NewRoyalSliderOptions::get_field_html($field, 'flickr'); } echo '</div>'; }
public static function show_admin_options($curr_options = null) { ?> <div class="rs-info"> <p class="rs-awesome-paragraph"><?php _e('Here you can create RoyalSlider from <a href="http://500px.com" target="_blank">500px</a> photos', 'new_royalslider'); ?> </p> <p><?php _e('To create such gallery go to your 500px account and request your API consumer key. Then simply enter your data in settings below.<br/>Requested 500px image thumbnail size is 70x70, so for some templates you need to change default size of them, you can do this in right sidebar options "Thumbnails,tabs,bullets" -> "Thumbnail Width" and "Thumbnail Height.', 'new_royalslider'); ?> </p> <div class="help-video"><a class="in-page-action" href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-royalslider-from-500px-photos" target="_blank"><?php _e('View help video about how to create 500px gallery', 'new_royalslider'); ?> </a></div><br/> </div> <?php $fields = array(array('name' => 'consumer_key', 'label' => __('Consumer key', 'new_royalslider'), 'desc' => '', 'type' => 'text', 'default' => '', 'data-type' => 'str', 'size' => 'short', 'ignore' => true), array('desc' => __('Your <a href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-where-to-get-500px-consumer-key" target="_blank">500px consumer key</a>.', 'new_royalslider')), array('name' => 'feature', 'label' => __('Photos source', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('user' => __('By [username]', 'new_royalslider'), 'user_friends' => __('From [username] friends', 'new_royalslider'), 'user_favorites' => __('[username] favorites', 'new_royalslider'), 'popular' => __('Popular (globally)', 'new_royalslider'), 'editors' => __('Editors choice ', 'new_royalslider'), 'fresh_today' => __('Fresh today ', 'new_royalslider'), 'upcoming' => __('Upcoming ', 'new_royalslider')), 'default' => 'image', 'ignore' => true), array('desc' => __('The source of photos for gallery.', 'new_royalslider')), array('name' => 'username', 'label' => __('Username', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'text', 'default' => '', 'data-type' => 'str', 'size' => 'short', 'ignore' => true), array('desc' => __('500px username to get photos from', 'new_royalslider'), 'delimiter' => true), array('name' => 'category', 'label' => __('Category', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('' => __('Any Category', 'new_royalslider'), 'Abstract' => __('Abstract', 'new_royalslider'), 'Animals' => __('Animals', 'new_royalslider'), 'Black and White' => __("Black and White", 'new_royalslider'), 'Celebrities' => __('Celebrities', 'new_royalslider'), 'City and Architecture' => __('Fresh today', 'new_royalslider'), 'Commercial' => __('Commercial', 'new_royalslider'), 'Concert' => __("Concert", 'new_royalslider'), 'Family' => __("Family", 'new_royalslider'), 'Fashion' => __("Fashion", 'new_royalslider'), 'Film' => __("Film", 'new_royalslider'), 'Fine Art' => __("Fine Art", 'new_royalslider'), 'Food' => __("Food", 'new_royalslider'), 'Journalism' => __("Journalism", 'new_royalslider'), 'Landscapes' => __("Landscapes", 'new_royalslider'), 'Macro' => __("Macro", 'new_royalslider'), 'Nature' => __("Nature", 'new_royalslider'), 'Nude' => __("Nude", 'new_royalslider'), 'People' => __("People", 'new_royalslider'), 'Performing Arts' => __("Performing Arts", 'new_royalslider'), 'Sport' => __("Sport", 'new_royalslider'), 'Still Life' => __("Still Life", 'new_royalslider'), 'Street' => __("Street", 'new_royalslider'), 'Transportation' => __("Transportation", 'new_royalslider'), 'Travel' => __("Travel", 'new_royalslider'), 'Underwater' => __("Underwater", 'new_royalslider'), 'Urban Exploration' => __("Urban Exploration", 'new_royalslider'), 'Wedding' => __("Wedding", 'new_royalslider')), 'default' => 'image', 'ignore' => true), array('desc' => __('Optional', 'new_royalslider')), array('name' => 'sort', 'label' => __('Sort by', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('' => __('Default', 'new_royalslider'), 'rating' => __('Rating', 'new_royalslider'), 'times_viewed' => __('Views', 'new_royalslider'), 'votes_count' => __('Votes', 'new_royalslider'), 'created_at' => __('Creation date, newest first.', 'new_royalslider')), 'default' => 'image', 'ignore' => true), array('desc' => __('Photos sort order', 'new_royalslider')), array('name' => 'rpp', 'label' => __('Maximum items', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'number', 'default' => '10', 'data-type' => 'num', 'size' => 'short', 'ignore' => true), array('desc' => __('Maximum number of items to include in slider.', 'new_royalslider'))); if (isset($curr_options) && isset($curr_options['rs_500px'])) { $opts = $curr_options['rs_500px']; $fields = NewRoyalSliderOptions::parseCurrentOptions($fields, $opts); } echo '<div id="rs-500px-options" class="rs-body-options">'; echo '<h3>' . __('500px Settings', 'new_royalslider') . '</h3>'; foreach ($fields as $key => $field) { echo NewRoyalSliderOptions::get_field_html($field, 'rs_500px'); } echo '</div>'; }
public static function show_admin_options($curr_options = null) { ?> <div class="rs-info"> <p class="rs-awesome-paragraph"><?php _e('Here you may create RoyalSlider from your posts', 'new_royalslider'); ?> </p> <p><?php _e('Slider uses Post Featured Image as a default source for images.<br/>To create custom layout use Slide Markup Editor - you may use shortcodes and get custom meta data from eacho post.', 'new_royalslider'); ?> </p> <div class="help-video"><a class="in-page-action" href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-royalslider-from-your-posts" target="_blank"><?php _e('View help video about how to create such slider', 'new_royalslider'); ?> </a></div><br/> </div> <?php $post_types = get_post_types(array('_builtin' => false)); $post_types = array("post" => "post", "page" => "page") + $post_types; $post_types_arr = array(); foreach ($post_types as $key => $post_type) { $selected = ""; $posttype_obj = get_post_type_object($key); $post_types_arr[$key] = $posttype_obj->labels->singular_name; } $fields = array(array('name' => 'post_type', 'label' => __('Post type', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => $post_types_arr, 'default' => 'post', 'ignore' => true), array('desc' => __('Post type to include in slider. Changing this option will automatically reload taxonomies (tags,categories...)', 'new_royalslider')), array('name' => 'max_posts', 'label' => __('Max posts', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'number', 'data-type' => 'num', 'default' => '5', 'ignore' => true), array('desc' => __('Maximum number of posts to include in slider', 'new_royalslider')), array('name' => 'orderby', 'label' => __('Order posts by', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('date' => __('Date', 'new_royalslider'), 'comment_count' => __('Comments', 'new_royalslider')), 'default' => 'date', 'ignore' => true), array('desc' => __('(random order can be set in Miscellaneous options)', 'new_royalslider')), array('name' => 'relation', 'label' => __('Relation', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('OR' => __('Match any selected taxonomy', 'new_royalslider'), 'AND' => __('Match all selected taxonomies', 'new_royalslider')), 'default' => 'OR', 'ignore' => true), array('desc' => __('Relation between terms. "Match all" will select only posts that have all selected taxonomies.', 'new_royalslider')), array('name' => 'link_the_slide', 'label' => __('Link slide to post', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'select', 'data-type' => 'str', 'options' => array('yes' => __('Yes, make link overlay over slide', 'new_royalslider'), 'no' => __('No', 'new_royalslider')), 'default' => 'no', 'ignore' => true), array('desc' => __('If enabled, links whole slide to corresponding post. Please note that such link doesn\'t work with auto-height option. You may edit slide markup to link specific button or image just by wrapping it with "a" HTML tag . {{link_url}} will return you URL to post.'))); if (isset($curr_options) && isset($curr_options['posts'])) { $opts = $curr_options['posts']; $fields = NewRoyalSliderOptions::parseCurrentOptions($fields, $opts); } else { $opts = array('taxonomies' => array()); } echo '<div id="rs-postssource-options" class="rs-body-options">'; echo '<h3>' . __('Posts Settings', 'new_royalslider') . '</h3>'; foreach ($fields as $key => $field) { echo NewRoyalSliderOptions::get_field_html($field, 'posts'); } echo '<div id="rs-taxonomies-fields">'; echo self::get_taxonomies_fields(isset($opts['post_type']) ? $opts['post_type'] : 'post', isset($opts['taxonomies']) ? $opts['taxonomies'] : null); echo '</div>'; echo '<p style="color:#888;"><br/>' . __('If you need custom order, you can filter this query via PHP with help of WordPress filters. <a target="_blank" href="http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-modifying-order-of-posts-in-slider">Read more</a>') . '</p>'; echo '</div>'; }
public static function show_admin_options($curr_options = null) { ?> <div class="rs-info"> <p class="rs-awesome-paragraph"><?php _e('Here you may create <a href="http://instagram.com" target="_blank">Instagram</a> gallery from recent photos, filtered by username or tag.', 'new_royalslider'); ?> </p> <?php self::$access_token = get_option('new_royalslider_instagram_oauth_token'); if (!self::$access_token || !isset(self::$access_token->access_token)) { printf(__('<p style="padding: 12px;background: rgb(255, 236, 236);font-size: 14px;line-height: 20px;"><strong style="color:#C00;">Important note!</strong> Before you start, you need to register Instagram API client.<br/>Please go to <a href="%s">RoyalSlider global settings</a>, enter "Instagram client ID" and "client secret key" and connect to Instagram.</p>', 'new_royalslider'), get_admin_url() . "admin.php?page=new_royalslider_settings"); } ?> <p><?php _e('Instagram thumbnail image size is 150x150px, for some templates you might need to change default size of thumbnail area ("Thumbnails,tabs,bullets" -> "Thumbnail Width" and "Thumbnail Height").', 'new_royalslider'); ?> </p> <div class="help-video"><a class="in-page-action" href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-royalslider-from-instagram-photos" target="_blank"><?php _e('View help video about how to create Instagram gallery', 'new_royalslider'); ?> </a></div><br/> </div> <?php $fields = array(array('name' => 'usernameortag', 'label' => __('Username or tag', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'text', 'default' => '', 'data-type' => 'str', 'size' => 'short', 'ignore' => true), array('desc' => __('Enter Instagram username or #tag. The tag must start with <strong>#</strong> symbol. For example: <strong>david</strong> or <strong>#winter</strong>', 'new_royalslider'), 'delimiter' => true), array('name' => 'limit', 'label' => __('Limit', 'new_royalslider'), 'desc' => __('', 'new_royalslider'), 'type' => 'number', 'default' => '10', 'data-type' => 'num', 'size' => 'short', 'ignore' => true), array('desc' => __('Maximum number of images to fetch from Instagram and include in slider. Max 250.', 'new_royalslider'))); if (isset($curr_options) && isset($curr_options['rs_instagram'])) { $opts = $curr_options['rs_instagram']; $fields = NewRoyalSliderOptions::parseCurrentOptions($fields, $opts); } echo '<div id="rs-instagram-options" class="rs-body-options">'; echo '<h3>' . __('Instagram Settings', 'new_royalslider') . '</h3>'; ?> <?php foreach ($fields as $key => $field) { echo NewRoyalSliderOptions::get_field_html($field, 'rs_instagram'); } echo '</div>'; }
function admin_print_styles() { wp_enqueue_style('wp-jquery-ui-dialog'); wp_enqueue_style('rs-codemirror'); wp_enqueue_style('rs-codemirror-theme'); wp_enqueue_style('rs-codemirror-theme-elegant'); wp_enqueue_style('jquery-rs-qtip-css'); wp_enqueue_style('new-rs-jquery-ui'); wp_enqueue_style('thickbox'); wp_enqueue_style("new-royalslider-admin"); $skins = NewRoyalSliderOptions::getRsSkins(); foreach ($skins as $key => $value) { wp_enqueue_style('new-rs-skin-' . $key); } $templates = NewRoyalSliderOptions::getRsTemplates(); foreach ($templates as $key => $value) { if (isset($value['template-css'])) { wp_enqueue_style('new-rs-template-' . $key); } } wp_enqueue_style('new-royalslider-default-skin-css'); }
static function getRsSkins() { if (self::$rs_skins) { return self::$rs_skins; } self::$rs_skins = array("rsUni" => array('label' => 'Universal', 'path' => NEW_ROYALSLIDER_PLUGIN_URL . 'lib/royalslider/' . 'skins/universal/rs-universal.css'), "rsDefault" => array('label' => 'Dark-default', 'path' => NEW_ROYALSLIDER_PLUGIN_URL . 'lib/royalslider/' . 'skins/default/rs-default.css'), "rsDefaultInv" => array('label' => 'Light', 'path' => NEW_ROYALSLIDER_PLUGIN_URL . 'lib/royalslider/' . 'skins/default-inverted/rs-default-inverted.css'), "rsMinW" => array('label' => 'With controls in corner', 'path' => NEW_ROYALSLIDER_PLUGIN_URL . 'lib/royalslider/' . 'skins/minimal-white/rs-minimal-white.css')); self::$rs_skins = apply_filters('new_royalslider_skins', self::$rs_skins); return self::$rs_skins; }
static function generateSlides($fetch_data, $refresh_cache, $id, $type, $markup = null, $slides = null, $options = null, $template = null, $skin = null, $disable_cache = false) { $arr = false; $refresh_hours = NewRoyalSliderMain::$refresh_hours; if (!$disable_cache) { if ($refresh_hours > 0) { $disable_cache = false; } else { $disable_cache = true; } } if (!$disable_cache) { $transient_key = NewRoyalSliderMain::get_transient_key($id, $type); if (!$id) { $refresh_cache = true; } if ($refresh_cache) { // delete cached version delete_transient($transient_key); } else { $arr = get_transient($transient_key); } } if ($arr === false) { if ($fetch_data) { if ($type != 'nextgen') { $rsdata = NewRoyalSliderMain::query_slider_data($id); } else { $rsdata = NewRoyalSliderMain::query_nextgen_slider_config(); } if (!$rsdata || !$rsdata[0]) { if ($type == 'nextgen') { return NewRoyalSliderMain::frontend_error(__('NextGEN configuration not found. Likely you just haven\'t created it yet, please go to "RoyalSlider admin page > Create New Slider > NextGEN config" and create it.', 'new_royalslider')); } else { return NewRoyalSliderMain::frontend_error(__('Incorrect RoyalSlider ID or problem with query.', 'new_royalslider')); } } $rsdata = $rsdata[0]; $rsdata = apply_filters('new_rs_slider_data', $rsdata); $type = $rsdata['type']; $markup = $rsdata['template_html']; if (!$slides) { $slides = $rsdata['slides']; } $options = $rsdata['options']; $template = $rsdata['template']; $skin = $rsdata['skin']; } if (!is_array($slides)) { $slides = json_decode($slides, ARRAY_A); } if (!class_exists('Mustache_Autoloader')) { require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'lib/Mustache/Autoloader.php'; } require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'classes/NewRoyalSliderOptions.php'; Mustache_Autoloader::register(); $m = new Mustache_Engine(array('escape' => array('NewRoyalSliderGenerator', 'escapeMustache'))); $css_id = 'new-royalslider-' . $id; $t = NewRoyalSliderOptions::getRsTemplates(); $add_js = ''; $curr_template; $selector = ''; if (!isset($t[$template])) { $template = ' noTemplate'; } else { $curr_template = $t[$template]; if (isset($curr_template['add_js'])) { $add_js = $curr_template['add_js']; $add_js = str_replace('{{selector}}', '.' . $css_id, $add_js); } $template = ' ' . $curr_template['template-css-class']; } if ($options) { if (!is_array($options)) { $options = json_decode($options, ARRAY_A); } else { } $gen_opts = self::preParseOpts($options); if (isset($options['sopts'])) { $o = array_merge($options, $options['sopts']); $to_unset = array('sopts', 'posts', 'rs_500px', 'flickr', 'rs_instagram'); foreach ($to_unset as $key => $value) { if (isset($o[$value])) { unset($o[$value]); } } foreach ($o as $key => $option) { if (is_array($option)) { foreach ($option as $subkey => $suboption) { if (is_numeric($suboption)) { $o[$key][$subkey] = (double) $suboption; } } } else { if (is_numeric($option)) { $o[$key] = (double) $option; } } } //return; $init_opts = json_encode($o); $init_opts = str_replace(':"true"', ':!0', $init_opts); $init_opts = str_replace(':"false"', ':!1', $init_opts); $init_opts = str_replace('"', '\'', $init_opts); $init_opts = str_replace(',\'', ',', $init_opts); $init_opts = str_replace('\':', ':', $init_opts); $init_opts = str_replace('{\'', '{', $init_opts); } else { $init_opts = $options; } } else { $options = array(); $gen_opts = self::preParseOpts(null); $init_opts = ''; } $js_init_code = "\t\$('." . $css_id . "').royalSlider(" . $init_opts . ");\n" . $add_js; if (!isset($skin)) { $skin = 'rsDefault'; } $skin = ' ' . $skin; $out = ''; if (NewRoyalSliderMain::$include_style_tag) { if ($gen_opts['thumb_width'] != 96 || $gen_opts['thumb_height'] != 72) { $out .= "\n<style type=\"text/css\">\n"; $out .= '.' . $css_id . ' .rsThumbsHor { height:' . $gen_opts['thumb_height'] . 'px; }' . "\n"; $out .= '.' . $css_id . ' .rsThumbsVer { width:' . $gen_opts['thumb_width'] . 'px; } .' . $css_id . ' .rsThumb { width: ' . $gen_opts['thumb_width'] . 'px; height: ' . $gen_opts['thumb_height'] . 'px; }'; $out .= "\n</style>\n"; } } if (isset($curr_template) && isset($curr_template['wrapHTML'])) { $out .= str_replace('%width%', $gen_opts['width'], $curr_template['wrapHTML']['before']); } $options['id'] = $id; $slides = apply_filters('new_rs_slides_filter', $slides, $options, $type); if ($type === 'custom') { require_once 'renderers/DefaultRenderer.php'; } else { if ($type === 'gallery') { require_once 'renderers/PostGalleryRenderer.php'; } else { if ($type === 'flickr' || $type === '500px') { require_once 'renderers/CustomSourceRenderer.php'; } else { if ($type === 'posts') { require_once 'renderers/PostsListRenderer.php'; } else { if ($type === 'nextgen') { require_once 'renderers/NextGenRenderer.php'; } else { if ($type === 'instagram') { require_once 'renderers/InstagramRenderer.php'; } } } } } } if (is_array($slides) && count($slides) > 0) { $width = $gen_opts['width']; if (is_numeric($width)) { $width .= 'px'; } if ($width) { $width = 'width:' . $width . ';'; } else { $width = ''; } $height = $gen_opts['height']; if (is_numeric($height)) { $height .= 'px'; } if ($height) { $height = 'height:' . $height . ';'; } else { $height = ''; } $out .= '<div id="' . $css_id . '" class="royalSlider ' . $css_id . $skin . $template . '" style="' . $width . $height . ';">' . "\n"; foreach ($slides as $key => $slide) { if ($type === 'custom') { $renderer = new NewRoyalSliderDefaultRenderer($slide, $gen_opts, $options); } else { if ($type === 'gallery') { $renderer = new NewRoyalSliderPostGalleryRenderer($key, $slide, $gen_opts, $options); } else { if ($type === 'flickr' || $type === '500px') { $renderer = new NewRoyalSliderCustomSourceRenderer($slide, $gen_opts, $options); } else { if ($type === 'posts') { $renderer = new NewRoyalSliderPostsRenderer($slide, $gen_opts, $options); } else { if ($type === 'nextgen') { $renderer = new NewRoyalSliderNextGenRenderer($slide, $gen_opts, $options); } else { if ($type === 'instagram') { $renderer = new NewRoyalSliderInstagramRenderer($slide, $gen_opts, $options); } } } } } } $m->getHelpers()->clear(); apply_filters('new_rs_slides_renderer_helper', $m, $slide, $options); $out .= $m->render($markup, $renderer) . "\n"; } $out = apply_filters('new_rs_slides_output_before_end', $out, $id, $type); $out .= "\n" . '</div>' . "\n"; } else { if ($type !== 'posts') { $error_message = print_r($slides, true); if (strlen($error_message) > 5) { $out .= NewRoyalSliderMain::frontend_error(print_r($slides, true)); } else { $out .= NewRoyalSliderMain::frontend_error(__('Slides are missing. ', 'new_royalslider') . print_r($slides, true)); } } else { $out .= NewRoyalSliderMain::frontend_error(__('No posts found matching your criteria.', 'new_royalslider')); } } if (isset($curr_template) && isset($curr_template['wrapHTML'])) { $out .= $curr_template['wrapHTML']['after']; } if ($type != '500px' && $type != 'flickr' && $type != 'instagram') { $pattern = '\\[(\\[?)(gallery|new_royalslider)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all('/' . $pattern . '/s', $out, $matches); $out = preg_replace_callback("/{$pattern}/s", array('NewRoyalSliderGenerator', 'strip_shortcode_tag'), $out); $out = do_shortcode($out); } $arr = array('out' => $out, 'js_init' => $js_init_code); if (!$disable_cache) { set_transient($transient_key, $arr, 60 * 60 * $refresh_hours); } } NewRoyalSliderMain::register_slider($id, $arr['js_init']); return $arr['out']; }
function build_view() { ?> <div id="new-royalslider-edit-page" class="wrap"> <h2 id="edit-slider-text"><span> <?php if ($this->slider_type != 'nextgen') { ?> <?php if (!$this->is_add_new) { if ($this->slider_id) { echo sprintf(__('Editing %s RoyalSlider #', 'new_royalslider'), ucfirst($this->slider_type)); echo '<span>'; echo $this->slider_id; echo '</span>'; } ?> <?php } else { ?> <?php echo sprintf(__('New %s RoyalSlider', 'new_royalslider'), ucfirst($this->slider_type)); ?> <?php } ?> <?php } else { ?> <?php _e('NextGEN template configuration', 'new_royalslider'); if ($this->slider_id) { echo ' #<span>'; echo $this->slider_id; echo '</span>'; } ?> <?php } ?> </span> <a href="#" class="add-new-h2 rs-embed-to-site <?php echo $this->slider_id ? '' : 'rs-hidden'; ?> "><?php _e('Embed this slider to site', 'new_royalslider'); ?> </a> <a href="admin.php?page=new_royalslider" class="add-new-h2"><?php _e('Back to list', 'new_royalslider'); ?> </a> </h2> <?php echo NewRoyalSliderMain::get_embed_help_block($this->slider_id ? $this->slider_id : 123); ?> <div id="poststuff" class="metabox-holder has-right-sidebar"> <div id="side-info-column" class="options-sidebar"> <div id="slider-actions" class="postbox action actions-holder"> <?php if ($this->slider_type != 'gallery' && $this->slider_type != 'nextgen') { ?> <a class="alignleft button-secondary button80" id="preview-slider" href="#"><?php _e('Preview slider', 'new_royalslider'); ?> </a> <?php } ?> <div id="save-progress" class="waiting ajax-saved" > <?php _e('Saved!', 'new_royalslider'); ?> </div> <a class="alignright button-primary button80" id="save-slider" data-slider-id="<?php echo $this->slider_id; ?> " data-create="<?php echo $this->slider_id ? 'false' : 'true'; ?> " data href="#"><?php if ($this->slider_id) { _e('Save slider', 'new_royalslider'); } else { _e('Create slider', 'new_royalslider'); } ?> </a> <br class="clear"> </div> <div id="new-royalslider-options"> <div class="postbox open"> <div class="handlediv" title="Toggle view"></div> <h3 class="hndle"><?php _e('General options', 'new_royalslider'); ?> </h3> <div class="inside slider-opts-group"> <div class="rs-opt"> <div data-help="<?php _e('Template resets all slider settings to create specific type of slideshow. After you set it you may (optionally) modify other options to fit your requirements.<br/><br/> Please note that most templates (except first one) add additional CSS file and change slide HTML markup, so some options might requre minor CSS modifications.', 'new_royalslider'); ?> " class="rs-template-title rs-help-el"><span id="rs-template-title-text"><?php _e('Templates', 'new_royalslider'); ?> </span><i class="help-ico"></i></div> <div id="template-select" class="templates-grid"> <?php require_once 'NewRoyalSliderOptions.php'; $newrs_templates = NewRoyalSliderOptions::getRsTemplates(); $value = isset($this->res['template']) ? $this->res['template'] : 'default'; $template_obj = $newrs_templates[$value]; $template_html = isset($template_obj['template-html']) ? $template_obj['template-html'] : $newrs_templates['default']['template-html']; $col = 0; $row = 0; foreach ($newrs_templates as $key => $args) { $label = $args['label']; //$label echo sprintf('<div class="rs-template"><input id="%s" type="radio" name="template" value="%s" %s><label style="background-position: %s ;" for="%s">%s</label></div>', $key, $key, checked($value, $key, false), '-' . $col * 89 . 'px -' . ($row * 65 + 100) . 'px', $key, ''); $col++; if ($col > 1) { $col = 0; $row++; } } ?> </div> </div> <hr> <div class="rs-opt"> <div data-help="<?php _e('Skin is a set of CSS styled UI controls.', 'new_royalslider'); ?> " class="rs-template-title rs-skin-title rs-help-el"><?php _e('Skin', 'new_royalslider'); ?> <i class="help-ico"></i></div> <select id="skin-select"> <?php require_once 'NewRoyalSliderOptions.php'; $newrs_skins = NewRoyalSliderOptions::getRsSkins(); $value = isset($this->res['skin']) ? $this->res['skin'] : 'rsUni'; foreach ($newrs_skins as $key => $args) { $label = $args['label']; echo sprintf('<option value="%s"%s>%s</option>', $key, selected($value, $key, false), $label); } ?> </select> <a href="http://help.dimsemenov.com/kb/wordpress-royalslider-advanced/wp-adding-custom-skin-without-modifying-core-of-slider" target="_blank" style="color: #888; display:block; margin-top: 5px;"><?php _e('how to add custom skin'); ?> </a> </div> <hr> <a id="edit-slide-markup" class="in-page-action" href="#"><?php _e('Edit slide markup', 'new_royalslider'); ?> </a> </div> </div> <div class="other-options"> <?php $this->get_slider_options(); ?> </div> </div> </div> <div class="sortable-slides-body"> <div class="sortable-slides-container"> <div id="titlediv"> <div id="titlewrap"> <input type="text" name="title" size="40" maxlength="255" placeholder="<?php _e('Slider name', 'new_royalslider'); ?> " id="title" value="<?php echo isset($this->res) ? $this->res['name'] : ''; ?> " /> </div> </div> <div id="template-editor" style="display:none;"> <textarea style="width: 80%; height: 200px;"><?php echo isset($this->res['template_html']) ? esc_html($this->res['template_html']) : esc_html($template_html); ?> </textarea> </div> <input id="admin-slider-type" type="hidden" value="<?php echo isset($_REQUEST['rstype']) ? $_REQUEST['rstype'] : ''; ?> " /> <?php if ($this->slider_type == 'custom') { ?> <div class="rs-add-slides-wrap"> <a class="button" id="create-new-slide" href="#"><?php _e('Create New Slide', 'new_royalslider'); ?> </a> or <a class="button" id="add-images" href="#"><?php _e('Add Images', 'new_royalslider'); ?> </a> </div> <div id="rs-be" style="display:none;" class="with-animation-options"> <div id="rs-be-buttons"> <button class="button button-primary rs-be-add-html-block"><?php _e('Add HTML block', 'new_royalslider'); ?> </button>or <button class="button rs-be-add-image-block"><?php _e('Add image', 'new_royalslider'); ?> </button> </div> <div class="rs-ab-props"> <label for="block-classes-select" class="rs-help-el" data-align="top" data-help="<?php _e('CSS class that is applied to selected block.', 'new_royalslider'); ?> "><?php _e('Block CSS class:', 'new_royalslider'); ?> </label> <select id="block-classes-select"> <option value=''><?php _e('No class', 'new_royalslider'); ?> </option> <?php $anim_block_classes = array('abBlackBox', 'abWhiteBox', 'abTextAlignCenter'); //$anim_block_classes = array('testClass1', 'testClass2'); $saved_items = get_option("new_royalslider_anim_block_classes"); if (is_array($saved_items)) { $anim_block_classes = array_merge($anim_block_classes, $saved_items); } $anim_block_classes = apply_filters('new_royalslider_animated_block_classes', $anim_block_classes); foreach ($anim_block_classes as $key => $value) { ?> <option value='<?php echo $value; ?> '><?php echo $value; ?> </option> <?php } ?> <option value='rs_add_user_class'><?php _e('>> Add new class <<', 'new_royalslider'); ?> </option> <option value='rs_remove_user_class'><?php _e('>> Remove class <<', 'new_royalslider'); ?> </option> </select> <label for="rs-a-b-animEnabled" class=" animation-cb"> <input id="rs-a-b-animEnabled" type="checkbox" value="true" checked="checked" /> <?php _e('Use block animation', 'new_royalslider'); ?> </label> <i class="help-ico rs-help-el" class="rs-help-el" data-align="top" data-help="<?php echo esc_attr(__('Leave animation fields empty to use default settings that are defined in right sidebar options.<br/>Please don\'t overuse animation. Use it wisely and only when it \'s really required.', 'new_royalslider')); ?> "></i> </div> <div class="clear"></div> <div class="rs-be-blocks-list"></div> <div class="rs-anim-blocks-inputs"> <div class="rs-be-editorarea"><textarea></textarea></div> <div class="size-fields"> <div> <label for="rs-a-b-width" class="rs-help-el" data-help="<?php echo esc_attr(__('Width in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> "><?php _e('Width', 'new_royalslider'); ?> </label> <input id="rs-a-b-width" value="" /> </div> <div> <label for="rs-a-b-height" class="rs-help-el" data-help="<?php echo esc_attr(__('Height in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> "><?php _e('Height', 'new_royalslider'); ?> </label> <input id="rs-a-b-height" value="" /> </div> <div> <label for="rs-a-b-left" class="rs-help-el" data-help="<?php echo esc_attr(__('Distance from left in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> "><?php _e('Left', 'new_royalslider'); ?> </label> <input id="rs-a-b-left" value="" /> </div> <div> <label for="rs-a-b-right" class="rs-help-el" data-help="<?php echo esc_attr(__('Distance from right in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> "><?php _e('Right', 'new_royalslider'); ?> </label> <input id="rs-a-b-right" value="" /> </div> <div > <label for="rs-a-b-top" class="rs-help-el" data-help="<?php echo esc_attr(__('Distance from top in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> "><?php _e('Top', 'new_royalslider'); ?> </label> <input id="rs-a-b-top" value="" /> </div> <div> <label class="rs-help-el" data-help="<?php echo esc_attr(__('Distance from bottom in pixels, percents or auto.<br/> e.g. \'123px\', \'50%\' or \'auto\'. ', 'new_royalslider')); ?> " for="rs-a-b-bottom"><?php _e('Bottom', 'new_royalslider'); ?> </label> <input id="rs-a-b-bottom" value="" /> </div> </div> </div> <div class="transition-fields rs-anim-blocks-inputs"> <div> <label for="rs-a-b-speed" class="rs-help-el" data-help="<?php echo esc_attr(__('Animation speed of block.', 'new_royalslider')); ?> "><?php _e('Speed', 'new_royalslider'); ?> </label> <input id="rs-a-b-speed" value="300" /> </div> <div class="rs-be-fade-effect"> <label for="rs-a-b-fade-effect"> <input id="rs-a-b-fade-effect" type="checkbox" checked="checked" value="true" /> <?php _e('Fade in', 'new_royalslider'); ?> </label> </div> <div> <label for="rs-a-b-move-offset" class="rs-help-el" data-help="<?php echo esc_attr(__('Distance for move animation.', 'new_royalslider')); ?> "><?php _e('Move offset', 'new_royalslider'); ?> </label> <input id="rs-a-b-move-offset" value="300" /> </div> <div> <label for="rs-a-b-move-effect" class="rs-help-el" data-help="<?php echo esc_attr(__('Move/slide animation', 'new_royalslider')); ?> "><?php _e('Move effect', 'new_royalslider'); ?> </label> <select id="rs-a-b-move-effect"> <option value="left"><?php _e('From left', 'new_royalslider'); ?> </option> <option value="right"><?php _e('From right', 'new_royalslider'); ?> </option> <option value="top"><?php _e('From top', 'new_royalslider'); ?> </option> <option value="bottom"><?php _e('From bottom', 'new_royalslider'); ?> </option> <option value="none"><?php _e('None', 'new_royalslider'); ?> </option> </select> </div> <div> <label for="rs-a-b-delay" class="rs-help-el" data-help="<?php echo esc_attr(__('Delay before block shows up. Leave field empty or set to AUTO to use default sequential delay.', 'new_royalslider')); ?> "><?php _e('Delay', 'new_royalslider'); ?> </label> <input id="rs-a-b-delay" value="400" /> </div> <div> <label for="rs-a-b-easing" class="rs-help-el" data-help="<?php echo esc_attr(__('Easing function for animation', 'new_royalslider')); ?> "><?php _e('Easing', 'new_royalslider'); ?> </label> <select id="rs-a-b-easing"> <option value="easeOutSine"><?php _e('easeOutSine', 'new_royalslider'); ?> </option> <option value="easeInOutSine"><?php _e('easeInOutSine', 'new_royalslider'); ?> </option> </select> </div> </div> </div> <div id="rs-no-slides-block"> <h2><?php _e("You don't have any slides", 'new_royalslider'); ?> </h2> <p><?php _e("Get started by adding slides via buttons above or watch <a target=\"_blank\" href=\"http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-custom-slider\">introductory video</a>.", 'new_royalslider'); ?> </p> </div> <div id="new-rs-slides"> <?php $this->get_slider_items(); ?> </div> <?php } else { if ($this->slider_type === 'gallery') { ?> <div class="rs-info"> <p class="rs-awesome-paragraph"><?php _e('Here you can create configuration of RoyalSlider that will override default WordPress gallery, and can be added only inside post.', 'new_royalslider'); ?> </p> <div class="help-video"><a class="in-page-action" target="_blank" href="http://help.dimsemenov.com/kb/wordpress-royalslider-tutorials/wp-creating-royalslider-from-images-attached-to-post"><?php _e('View help video about how to create such slider', 'new_royalslider'); ?> </a></div><br/> <p>Or follow these steps:</p> <ol> <li><?php _e('Enter name for slider.', 'new_royalslider'); ?> </li> <li><?php _e('Configure slider options at right side, most of time you just need to change "Template" and "Skin" options.', 'new_royalslider'); ?> </li> <li><?php _e('Click create(save) slider button.', 'new_royalslider'); ?> </li> <li><?php _e('Go to any post and insert default WordPress gallery as usually.', 'new_royalslider'); ?> </li> <li><?php _e('Switch to Text(HTML) tab in post content editor and add <code>royalslider="SLIDER_ID"</code> attribute to gallery shortcode, where <code>SLIDER_ID</code> is id of slider that you\'re editing now.<br/>For example if ID of your slider is 3: <code>[gallery ids="24,22"]</code> should be changed to <code>[gallery royalslider="3" ids="24,22"]</code>.', 'new_royalslider'); ?> </li> <li><?php _e('Optionally change configuration of the slider or change Slide HTML markup.', 'new_royalslider'); ?> </li> </ol> <p><?php _e('You may also override all default WordPress galleries in posts (without adding royalslider attribute to [gallery] shortcode), visit RoyalSlider global settings page to learn more.', 'new_royalslider'); ?> </p> </div> <?php } else { if ($this->slider_type === '500px') { NewRoyalSlider500pxSource::show_admin_options($this->parsed_options); } else { if ($this->slider_type === 'posts') { NewRoyalSliderPostsSource::show_admin_options($this->parsed_options); } else { if ($this->slider_type === 'nextgen') { NewRoyalSliderNextGenSource::show_admin_options($this->parsed_options); } else { if ($this->slider_type === 'flickr') { NewRoyalSliderFlickrSource::show_admin_options($this->parsed_options); } else { if ($this->slider_type === 'instagram') { NewRoyalSliderInstagramSource::show_admin_options($this->parsed_options); } } } } } } } ?> </div> </div> </div> </div> <?php }
static function getImageTab($slide_data, $image_src) { $out = ''; $attachment_id = ''; $big_image = ''; $big_image_src = ''; $image_data = ''; if (isset($slide_data['image'])) { $image_data = $slide_data['image']; if (isset($slide_data['image']['attachment_id'])) { $attachment_id = $slide_data['image']['attachment_id']; $big_image = wp_get_attachment_image_src($attachment_id, 'large'); $big_image_src = $big_image[0]; } } $add_label = $image_data ? __('Change image', 'new_royalslider') : __('Add image', 'new_royalslider'); $hidden = !$image_data ? 'style="display:none"' : ''; $out .= '<div class="rs-image-change-wrap"> <img src="' . $image_src . '" /> <a class="rs-select-image button button-primary" href="#">' . $add_label . '</a> <a class="rs-remove-image button" href="#"' . $hidden . '>' . __('Remove image', 'new_royalslider') . '</a> </div>'; $out .= '<div class="rs-image-inputs-wrap">'; $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'title', 'label' => __('Title & alt <i class="help-ico"></i>', 'new_royalslider'), 'desc' => __('Title of the slide. Alt tag of image. Caption. (by default).<br/> In Slide Markup Editor use <strong>{{title}}</strong> to get value of this field.', 'new_royalslider'), 'type' => 'text', 'default' => isset($slide_data['title']) ? $slide_data['title'] : ''), 'slides'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'description', 'label' => __('Description <i class="help-ico"></i>', 'new_royalslider'), 'desc' => __('Short description of slide, used by some templates (like content slider). <br/>In Slide Markup Editor use <strong>{{description}}</strong>} to get value of this field.', 'new_royalslider'), 'type' => 'textarea', 'default' => isset($slide_data['description']) ? $slide_data['description'] : ''), 'slides'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'link', 'label' => __('Link <i class="help-ico"></i>', 'new_royalslider'), 'desc' => __('Links whole slide to URL in this field. <br/><strong>Please note</strong> that full slide link doesn\'t work with auto-height option and overlays video. You can edit Slide Markup to link just specific button or image by wrapping it with "a" HTML tag .<br/>In Slide Markup Editor use <strong>{{link_url}}</strong> to get value of this field.', 'new_royalslider'), 'type' => 'text', 'default' => isset($slide_data['link']) ? $slide_data['link'] : ''), 'slides'); $out .= '<div class="rs-video-select">'; if (!isset($slide_data['video'])) { $video_data = array('url' => '', 'thumb' => '', 'image' => ''); } else { $video_data = $slide_data['video']; } $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'url', 'label' => __('YouTube or Vimeo video URL <i class="help-ico"></i>', 'new_royalslider'), 'desc' => __('Link to YouTube or Vimeo video page. In formats like:<br/>vimeo.com/123123<br/>www.youtube.com/watch?v=7iIld0Z_wlc<br/>youtu.be/7iIld0Z_wlc<br/>In Slide Markup Editor use <strong>{{video_url}}</strong> to get value of this field.', 'new_royalslider'), 'type' => 'text', 'default' => $video_data['url']), 'slides[video]'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'image', 'type' => 'hidden', 'default' => isset($video_data['image']) ? $video_data['image'] : ''), 'slides[video]'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'thumb', 'type' => 'hidden', 'default' => isset($video_data['thumb']) ? $video_data['thumb'] : ''), 'slides[video]'); $out .= '</div>'; $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'attachment_id', 'type' => 'hidden', 'default' => $attachment_id), 'slides[image]'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'large', 'type' => 'hidden', 'default' => $big_image_src), 'adminarea'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'large_gen', 'type' => 'hidden', 'default' => $big_image_src), 'adminarea'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'large_width', 'type' => 'hidden', 'default' => $big_image ? $big_image[1] : ''), 'adminarea'); $out .= NewRoyalSliderOptions::get_field_html(array('name' => 'large_height', 'type' => 'hidden', 'default' => $big_image ? $big_image[2] : ''), 'adminarea'); $out .= '</div>'; return $out; }
function frontend_styles() { global $wpdb; $table = self::get_sliders_table_name(); if (count($this->sliders_to_enqueue) > 0 || $this->load_all) { $this->has_slider_on_page = true; $qstr = " \r\n\t\t\t\tSELECT id, skin, template FROM {$table} WHERE active=1\r\n\t\t\t"; if (!$this->load_all) { $ids = '('; foreach ($this->sliders_to_enqueue as $key => $value) { if ($key != 0) { $ids .= ','; } $ids .= (int) $value; } $ids .= ')'; $qstr .= " AND id IN {$ids} "; } $res = $wpdb->get_results($qstr, ARRAY_A); require_once 'NewRoyalSliderOptions.php'; $templates = NewRoyalSliderOptions::getRsTemplates(); $skins = NewRoyalSliderOptions::getRsSkins(); foreach ($res as $key => $slider_data) { // skins if (isset($slider_data['skin']) && isset($skins[$slider_data['skin']])) { $this->push_style($slider_data['skin'], $skins[$slider_data['skin']]['path']); } // templates if (isset($slider_data['template']) && isset($templates[$slider_data['template']])) { $template = $templates[$slider_data['template']]; if (isset($template['template-css'])) { $this->push_style($slider_data['template'], $template['template-css']); } } } } if (count($this->styles) > 0) { wp_register_style('new-royalslider-core-css', NEW_ROYALSLIDER_PLUGIN_URL . 'lib/royalslider/royalslider.css', false, NEW_ROYALSLIDER_WP_VERSION, 'all'); wp_enqueue_style('new-royalslider-core-css'); } foreach ($this->styles as $key => $style) { wp_register_style($key . '-css', $style, array('new-royalslider-core-css'), NEW_ROYALSLIDER_WP_VERSION, 'all'); wp_enqueue_style($key . '-css'); } }
static function generateSlides($refresh_cache, $id, $type, $markup, $slides, $options, $template, $skin) { $transient_key = NewRoyalSliderMain::get_transient_key($id, $type); if (!$id) { $refresh_cache = true; } if ($refresh_cache) { // delete cached version delete_transient($transient_key); $arr = false; } else { $arr = get_transient($transient_key); } if ($arr === false) { if (!is_array($slides)) { $slides = json_decode($slides, ARRAY_A); } require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'lib/Mustache/Autoloader.php'; require_once 'renderers/DefaultRenderer.php'; require_once 'renderers/PostGalleryRenderer.php'; require_once 'renderers/CustomSourceRenderer.php'; require_once 'renderers/PostsListRenderer.php'; require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'classes/NewRoyalSliderOptions.php'; Mustache_Autoloader::register(); $m = new Mustache_Engine(array('escape' => array('NewRoyalSliderGenerator', 'escapeMustache'))); $css_id = 'new-royalslider-' . $id; $t = NewRoyalSliderOptions::getRsTemplates(); $add_js = ''; $curr_template; $selector = ''; if (!isset($t[$template])) { $template = ' noTemplate'; } else { $curr_template = $t[$template]; if (isset($curr_template['add_js'])) { $add_js = $curr_template['add_js']; $add_js = str_replace('{{selector}}', '.' . $css_id, $add_js); } $template = ' ' . $curr_template['template-css-class']; } if ($options) { if (!is_array($options)) { $options = json_decode($options, ARRAY_A); } else { } $gen_opts = self::preParseOpts($options); if (isset($options['sopts'])) { $o = array_merge($options, $options['sopts']); $to_unset = array('sopts', 'posts', 'rs_500px', 'flickr'); foreach ($to_unset as $key => $value) { if (isset($o[$value])) { unset($o[$value]); } } foreach ($o as $key => $option) { if (is_array($option)) { foreach ($option as $subkey => $suboption) { if (is_numeric($suboption)) { $o[$key][$subkey] = (double) $suboption; } } } else { if (is_numeric($option)) { $o[$key] = (double) $option; } } } //return; $init_opts = json_encode($o); $init_opts = str_replace(':"true"', ':!0', $init_opts); $init_opts = str_replace(':"false"', ':!1', $init_opts); $init_opts = str_replace('"', '\'', $init_opts); $init_opts = str_replace(',\'', ',', $init_opts); $init_opts = str_replace('\':', ':', $init_opts); $init_opts = str_replace('{\'', '{', $init_opts); } else { $init_opts = $options; } } else { $options = array(); $gen_opts = self::preParseOpts(null); $init_opts = ''; } $js_init_code = "\t\$('." . $css_id . "').royalSlider(" . $init_opts . ");\n" . $add_js; if (!isset($skin)) { $skin = 'rsDefault'; } $skin = ' ' . $skin; $out = ''; if ($gen_opts['thumb_width'] != 96 || $gen_opts['thumb_height'] != 72) { $out .= "\n<style type=\"text/css\">\n"; $out .= '.' . $css_id . ' .rsThumbsVer { width:' . $gen_opts['thumb_width'] . 'px; } .' . $css_id . ' .rsThumb { width: ' . $gen_opts['thumb_width'] . 'px; height: ' . $gen_opts['thumb_height'] . 'px; }'; $out .= "\n</style>\n"; } if (isset($curr_template) && isset($curr_template['wrapHTML'])) { $out .= str_replace('%width%', $gen_opts['width'], $curr_template['wrapHTML']['before']); } $options['id'] = $id; $slides = apply_filters('new_rs_slides_filter', $slides, $options, $type); if (is_array($slides)) { $out .= '<div id="' . $css_id . '" class="royalSlider ' . $css_id . $skin . $template . '" style="width:' . $gen_opts['width'] . '; height:' . $gen_opts['height'] . ';">'; foreach ($slides as $key => $slide) { if ($type === 'custom') { $renderer = new NewRoyalSliderDefaultRenderer($slide, $gen_opts, $options); } else { if ($type === 'gallery') { $renderer = new NewRoyalSliderPostGalleryRenderer($key, $slide, $gen_opts, $options); } else { if ($type === 'flickr' || $type === '500px') { $renderer = new NewRoyalSliderCustomSourceRenderer($slide, $gen_opts, $options); } else { if ($type === 'posts') { $renderer = new NewRoyalSliderPostsRenderer($slide, $gen_opts, $options); } } } } $m->getHelpers()->clear(); apply_filters('new_rs_slides_renderer_helper', $m, $slide, $options); $out .= $m->render($markup, $renderer); } $out .= '</div>'; } else { $out .= NewRoyalSliderMain::frontend_error(__('Slides are missing: ', 'new_royalslider') . print_r($slides, true)); } if (isset($curr_template) && isset($curr_template['wrapHTML'])) { $out .= $curr_template['wrapHTML']['after']; } if ($type != '500px' && $type != 'flickr') { $pattern = '\\[(\\[?)(gallery|new_royalslider)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)'; preg_match_all('/' . $pattern . '/s', $out, $matches); $out = preg_replace_callback("/{$pattern}/s", array('NewRoyalSliderGenerator', 'strip_shortcode_tag'), $out); $out = do_shortcode($out); } $arr = array('out' => $out, 'js_init' => $js_init_code); $refresh_hours = NewRoyalSliderMain::$refresh_hours; if ($refresh_hours > 0) { set_transient($transient_key, $arr, 60 * 60 * $refresh_hours); } } NewRoyalSliderMain::register_slider($id, $arr['js_init']); return $arr['out']; }