Пример #1
0
        function form($instance)
        {
            $instance = wp_parse_args((array) $instance, array('title' => __("RoyalSlider", "new_royalslider")));
            ?>
        <p>
            <label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e("Title", "new_royalslider");
            ?>
:</label>
            <input id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" value="<?php 
            echo $instance['title'];
            ?>
" />
        </p>
        <p>
            <label for="<?php 
            echo $this->get_field_id('royalslider_id');
            ?>
"><?php 
            _e("Select slider to add", "new_royalslider");
            ?>
:</label>
            <select id="<?php 
            echo $this->get_field_id('royalslider_id');
            ?>
" name="<?php 
            echo $this->get_field_name('royalslider_id');
            ?>
" style="width:100%;">
                <?php 
            global $wpdb;
            $table = NewRoyalSliderMain::get_sliders_table_name();
            $qstr = " \n\t\t\t\t\tSELECT id, name FROM {$table} WHERE active=1  AND type!='gallery'\n\t\t\t\t";
            $res = $wpdb->get_results($qstr, ARRAY_A);
            $curr_id = isset($instance['royalslider_id']) ? $instance['royalslider_id'] : '';
            if (is_array($res)) {
                foreach ($res as $key => $slider_data) {
                    $id = $slider_data['id'];
                    $selected = '';
                    if ($id == $curr_id) {
                        $selected = ' selected="selected"';
                    }
                    $name = isset($slider_data['name']) ? $slider_data['name'] . ' ' : '';
                    echo '<option value="' . $id . '"' . $selected . '>' . $name . '#' . $id . '</option>';
                }
            }
            ?>
            </select>
        </p>
    <?php 
        }
 function gallery_shortcode($output, $attr)
 {
     global $post;
     if (!isset($attr['royalslider'])) {
         if (NewRoyalSliderMain::$override_all_default_galleries) {
             $rsid = NewRoyalSliderMain::$override_all_default_galleries;
         } else {
             return $output;
         }
     } else {
         $rsid = $attr['royalslider'];
     }
     // $rsdata = NewRoyalSliderMain::query_slider_data( $rsid );
     // if(!$rsdata || !$rsdata[0]) {
     // 	return NewRoyalSliderMain::frontend_error(__('Incorrect royalslider ID in gallery shortcode (or in Global, or problem with query.', 'new_royalslider'));
     // }
     // $rsdata = $rsdata[0];
     if (isset($attr['orderby'])) {
         $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
         if (!$attr['orderby']) {
             unset($attr['orderby']);
         }
     }
     extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'ids' => '', 'include' => '', 'exclude' => ''), $attr));
     $id = intval($id);
     if ('RAND' == $order) {
         $orderby = 'none';
     }
     if (!empty($ids)) {
         // 'ids' is explicitly ordered
         $orderby = 'post__in';
         $include = $ids;
     }
     if (!empty($include)) {
         $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
         $attachments = array();
         foreach ($_attachments as $key => $val) {
             $attachments[$val->ID] = $_attachments[$key];
         }
     } elseif (!empty($exclude)) {
         $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
     } else {
         $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
     }
     if (empty($attachments)) {
         return NewRoyalSliderMain::frontend_error(__('No post attachments found.', 'new_royalslider'));
     }
     if (is_feed()) {
         $output = "\n";
         foreach ($attachments as $att_id => $attachment) {
             $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
         }
         return $output;
     }
     require_once 'rsgenerator/NewRoyalSliderGenerator.php';
     return NewRoyalSliderGenerator::generateSlides(true, true, $rsid, 'gallery', null, $attachments, null, null, null, true);
     return $output;
 }
 function ajax_save_slider()
 {
     check_ajax_referer('new_royalslider_save_ajax_nonce');
     global $wpdb;
     $data = stripslashes_deep($_POST);
     $options = isset($_POST['options']) ? json_encode($data['options']) : '';
     $slides = isset($_POST['slides']) ? json_encode($data['slides']) : '';
     $table_name = NewRoyalSliderMain::get_sliders_table_name();
     //$type = strtolower($type);
     $values = array('name' => $data['name'], 'type' => $data['slider_type'], 'skin' => $data['skin'], 'slides' => $slides, 'options' => $options, 'template' => $data['template'], 'template_html' => $data['template_html']);
     $format = array('%s', '%s', '%s', '%s', '%s', '%s', '%s');
     if (isset($_POST['isCreate']) && $_POST['isCreate'] == 'true') {
         $wpdb->insert($table_name, $values, $format);
         echo $wpdb->insert_id;
         if ($data['slider_type'] == 'nextgen') {
             update_option('new_royalslider_ng_slider_id', $wpdb->insert_id);
         }
     } else {
         if (isset($_POST['slider_id'])) {
             $wpdb->update($table_name, $values, array('ID' => $_POST['slider_id']), $format, array('%d'));
             NewRoyalSliderMain::delete_cache_for($_POST['slider_id'], $data['slider_type']);
             echo 'saved';
             if ($data['slider_type'] == 'nextgen') {
                 update_option('new_royalslider_ng_slider_id', (int) $_POST['slider_id']);
             }
         } else {
             echo 'incorrect id';
         }
     }
     die;
 }
 private function duplicate_slider($id)
 {
     global $wpdb;
     $table = NewRoyalSliderMain::get_sliders_table_name();
     $res = $wpdb->get_results($wpdb->prepare("\n                    SELECT * FROM {$table} WHERE id=%d\n                ", $id), ARRAY_A);
     $res = $res[0];
     $res['name'] = (isset($res['name']) && $res['name'] != '' ? $res['name'] . ' ' : '') . __('(copy of ', 'new_royalslider') . '#' . $id . ')';
     unset($res['id']);
     $wpdb->insert($table, $res);
     return $wpdb->insert_id;
 }
 static function get_image_data($self, $isThumb = false)
 {
     $sizes = NewRoyalSliderMain::$image_sizes;
     $s;
     $image_data;
     if ($isThumb) {
         $s = 'thumbI';
     } else {
         $s = 'i';
     }
     if (!$isThumb && !$self->image_data || $isThumb && !$self->thumb_image_data) {
         if (isset($self->options['image_generation']) && isset($self->options['image_generation'][$s . 'mageWidth']) && isset($self->options['image_generation'][$s . 'mageHeight'])) {
             $img_width = (int) $self->options['image_generation'][$s . 'mageWidth'];
             $img_height = (int) $self->options['image_generation'][$s . 'mageHeight'];
             if ($img_width == 0 || $img_height == 0) {
                 $image_data = wp_get_attachment_image_src($self->attachment_id, !$isThumb ? $sizes['large'] : $sizes['thumbnail']);
             } else {
                 if (!$self->full_img_url) {
                     $self->full_img_url = wp_get_attachment_image_src($self->attachment_id, NewRoyalSliderMain::$image_sizes['full']);
                     if (is_array($self->full_img_url) > 0) {
                         $self->full_img_url = $self->full_img_url[0];
                     }
                 }
                 $image_data = NewRoyalSliderMain::aq_resize(wp_get_attachment_url($self->attachment_id), $img_width, $img_height, true, false);
             }
         } else {
             $image_data = wp_get_attachment_image_src($self->attachment_id, !$isThumb ? $sizes['large'] : $sizes['thumbnail']);
         }
         if ($isThumb) {
             $self->thumb_image_data = $image_data;
         } else {
             $self->image_data = $image_data;
         }
     }
     if (!$isThumb && $self->image_data) {
         return $self->image_data;
     }
     if ($isThumb && $self->thumb_image_data) {
         return $self->thumb_image_data;
     } else {
         return array(0 => '', 1 => '', 2 => '');
     }
 }
        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 
        }
 function activate_db()
 {
     $curr_ver = get_option("new_royalslider_version");
     if ($curr_ver != NEW_ROYALSLIDER_WP_VERSION) {
         global $wpdb;
         $charset_collate = '';
         if (!empty($wpdb->charset)) {
             $charset_collate = " DEFAULT CHARACTER SET {$wpdb->charset}";
         }
         if (!empty($wpdb->collate)) {
             $charset_collate .= " COLLATE {$wpdb->collate}";
         }
         $table_name = NewRoyalSliderMain::get_sliders_table_name();
         $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " (\r\n\t\t\t\t\t  id \t\t\t\tmediumint(9) NOT NULL AUTO_INCREMENT,\t\r\n\t\t\t\t\t  active            tinyint(1) not null default 1,\r\n\t\t\t\t\t  type \t\t\t\tvarchar(100) NOT NULL,\t\t\t\t  \r\n\t\t\t\t\t  name \t\t\t\tvarchar(100) NOT NULL,\r\n\t\t\t\t\t  skin \t\t\t\tvarchar(100) NOT NULL,\r\n\t\t\t\t\t  template          varchar(100) NOT NULL,\r\n\t\t\t\t\t  slides\t\t\tlongtext NOT NULL, \r\n\t\t\t\t\t  options\t\t\tmediumtext NOT NULL, \r\n\t\t\t\t\t  template_html\t\tmediumtext NOT NULL, \r\n\r\n\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t)" . $charset_collate . ";";
         $wpdb->query($sql);
         // increase size of fields in old versions
         if ($curr_ver && version_compare($curr_ver, '3.0.3', '<')) {
             $upd_sql = "\r\n\t\t\t\tALTER TABLE {$table_name}\r\n\t\t\t\t\tMODIFY type varchar(100),\r\n\t\t\t\t\tMODIFY name varchar(100),\r\n\t\t\t\t\tMODIFY skin varchar(100),\r\n\t\t\t\t\tMODIFY template varchar(100)\r\n\t\t\t\t";
             $wpdb->query($upd_sql);
         }
         $options = array('timeout' => 10, 'headers' => array('Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded; charset=' . get_option('blog_charset'), 'User-Agent' => 'WordPress/' . get_bloginfo("version") . ' RoyalSlider/' . NEW_ROYALSLIDER_WP_VERSION, 'Referer' => home_url()));
         update_option("new_royalslider_version", NEW_ROYALSLIDER_WP_VERSION);
     }
 }
Пример #8
0
 function get_slider($id, $shortcode_atts = null)
 {
     $rsdata = self::query_slider_data($id);
     if (!$rsdata || !$rsdata[0]) {
         return NewRoyalSliderMain::frontend_error(__('Incorrect RoyalSlider ID in shortcode or problem with query.', 'new_royalslider'));
     }
     $rsdata = $rsdata[0];
     require_once 'rsgenerator/NewRoyalSliderGenerator.php';
     $rsdata = apply_filters('new_rs_slider_data', $rsdata, $shortcode_atts);
     $output = '';
     $output .= NewRoyalSliderGenerator::generateSlides(false, $rsdata['id'], $rsdata['type'], $rsdata['template_html'], $rsdata['slides'], $rsdata['options'], $rsdata['template'], $rsdata['skin']);
     return $output;
 }
Пример #9
0
<?php

if (!defined('ABSPATH')) {
    exit;
}
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
global $wpdb;
require_once 'classes/NewRoyalSliderMain.php';
$slider_table = NewRoyalSliderMain::get_sliders_table_name();
$wpdb->query("DROP TABLE IF EXISTS {$slider_table}");
delete_option("new_royalslider_version");
delete_option('new_royalslider_config');
delete_option('new_royalslider_anim_block_classes');
delete_option('new_royalslider_instagram_oauth_token');
delete_option('new_royalslider_ng_slider_id');
<?php

if (!defined('ABSPATH')) {
    die('No direct access allowed');
}
foreach ($images as &$image) {
    $thumb_size = $storage->get_image_dimensions($image, $thumbnail_size_name);
    $image->title = $image->alttext;
    $image->thumbnailsSize = $storage->get_image_dimensions($image, $thumbnail_size_name);
    $image->thumbnailURL = $storage->get_image_url($image, $thumbnail_size_name);
    $image->imageURL = $storage->get_image_url($image);
}
require_once NEW_ROYALSLIDER_PLUGIN_PATH . 'classes/rsgenerator/NewRoyalSliderGenerator.php';
echo NewRoyalSliderGenerator::generateSlides(true, true, $displayed_gallery_id, 'nextgen', null, $images, null, null, null, true);
NewRoyalSliderMain::custom_footer_scripts(array($displayed_gallery_id => NewRoyalSliderMain::$sliders_init_code[$displayed_gallery_id]));
unset(NewRoyalSliderMain::$sliders_init_code[$displayed_gallery_id]);