/**
  *
  */
 public function enqueue_scripts()
 {
     parent::enqueue_scripts();
     if ($this->get_setting('printCss') == 'true') {
         $theme = $this->get_theme();
         wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider-' . $theme, METASLIDER_ASSETS_URL . "sliders/nivoslider/themes/{$theme}/{$theme}.css", false, METASLIDER_VERSION);
     }
 }
示例#2
0
 /**
  * Output the carousel HTML for the filmstrip
  *
  * @param string  $html
  * @param integer $slider_id
  * @param array   $settings
  * @return string $html
  */
 public function metaslider_flex_filmstrip_html($html, $slider_id, $settings)
 {
     if (isset($settings["navigation"]) && $settings['navigation'] == 'filmstrip') {
         $slider = new MetaSlider($slider_id, array());
         $query = $slider->get_slides();
         if (isset($settings["noConflict"]) && $settings['noConflict'] == 'true') {
             $class = 'filmstrip';
         } else {
             $class = 'flexslider filmstrip';
         }
         $html .= '<div id="metaslider_' . $slider_id . '_filmstrip" class="' . $class . '">';
         $html .= "\n            <ul class='slides'>";
         while ($query->have_posts()) {
             $query->next_post();
             $type = get_post_meta($query->post->ID, 'ml-slider_type', true);
             if ($type == 'post_feed') {
                 $post_feed = new MetaPostFeedSlide();
                 $post_feed->set_slide($query->post->ID);
                 $post_feed->set_slider($slider_id);
                 $the_query = new WP_Query($post_feed->get_post_args());
                 $slides = array();
                 while ($the_query->have_posts()) {
                     $the_query->the_post();
                     $id = get_post_thumbnail_id($the_query->post->ID);
                     if ($override_id = get_post_meta($the_query->post->ID, 'metaslider_post_feed_image', true)) {
                         if (wp_attachment_is_image($override_id)) {
                             $id = $override_id;
                         }
                     }
                     $imageHelper = new MetaSliderImageHelper($id, $settings['thumb_width'], $settings['thumb_height'], 'true');
                     $url = $imageHelper->get_image_url();
                     $list_item = "<li class=\"ms-thumb slide-{$query->post->ID} post-{$the_query->post->ID}\" style=\"display: none;\"><img src=\"{$url}\" /></li>";
                     $list_item = apply_filters("metaslider_filmstrip_list_item", $list_item, $query->post, $url);
                     $html .= "\n                {$list_item}";
                 }
                 wp_reset_query();
             } else {
                 if ($type == 'external') {
                     $url = get_post_meta($query->post->ID, 'ml-slider_extimgurl', true);
                     $list_item = "<li class=\"ms-thumb slide-{$query->post->ID}\" style=\"display: none;\"><img src=\"{$url}\" /></li>";
                     $list_item = apply_filters("metaslider_filmstrip_list_item", $list_item, $query->post, $url);
                     $html .= "\n                {$list_item}";
                 } else {
                     // generate thumbnail
                     $imageHelper = new MetaSliderImageHelper($query->post->ID, $settings['thumb_width'], $settings['thumb_height'], 'true');
                     $url = $imageHelper->get_image_url();
                     if (strlen($url)) {
                         $list_item = "<li class=\"ms-thumb slide-{$query->post->ID}\" style=\"display: none;\"><img src=\"{$url}\" /></li>";
                         $list_item = apply_filters("metaslider_filmstrip_list_item", $list_item, $query->post, $url);
                         $html .= "\n                {$list_item}";
                     }
                 }
             }
         }
         $html .= "\n            </ul>\n        </div>";
     }
     return $html;
 }
示例#3
0
 /**
  * 
  */
 public function get_slider_css($css, $settings, $slider_id)
 {
     $css = parent::get_slider_css($css, $settings, $slider_id);
     if ($this->get_setting('printCss') == 'true') {
         $theme = $this->get_theme();
         $css .= "\n        @import url('" . METASLIDER_ASSETS_URL . "sliders/nivoslider/themes/{$theme}/{$theme}.css');";
     }
     return $css;
 }
示例#4
0
        /**
         * Render the admin page (tabs, slides, settings)
         */
        public function render_admin_page()
        {
            $this->admin_process();
            $this->upgrade_to_pro_cta();
            $this->do_system_check();
            $slider_id = $this->slider ? $this->slider->id : 0;
            ?>


        <script type='text/javascript'>
            var metaslider_slider_id = <?php 
            echo $slider_id;
            ?>
;
        </script>

        <div class="wrap metaslider">
            <form accept-charset="UTF-8" action="?page=metaslider&amp;id=<?php 
            echo $slider_id;
            ?>
" method="post">
                <?php 
            if ($this->slider) {
                wp_nonce_field('metaslider_save_' . $this->slider->id);
            }
            $this->print_slideshow_selector();
            if (!$this->slider) {
                return;
            }
            ?>

                <div id='poststuff'>
                    <div id='post-body' class='metabox-holder columns-2'>

                        <div id='post-body-content'>
                            <div class="left">

                                <?php 
            do_action("metaslider_admin_table_before", $this->slider->id);
            ?>


                                <table class="widefat sortable">
                                    <thead>
                                        <tr>
                                            <th style="width: 100px;">
                                                <h3><?php 
            _e("Slides", "metaslider");
            ?>
</h3>
                                                <?php 
            do_action("metaslider_admin_table_header_left", $this->slider->id);
            ?>

                                            </th>
                                            <th>
                                                <a href='#' class='button alignright add-slide' data-editor='content' title='<?php 
            _e("Add Slide", "metaslider");
            ?>
'>
                                                    <span class='wp-media-buttons-icon'></span> <?php 
            _e("Add Slide", "metaslider");
            ?>

                                                </a>
                                                <?php 
            do_action("metaslider_admin_table_header_right", $this->slider->id);
            ?>

                                            </th>
                                        </tr>
                                    </thead>

                                    <tbody>
                                        <?php 
            $this->slider->render_admin_slides();
            ?>

                                    </tbody>
                                </table>

                                <?php 
            do_action("metaslider_admin_table_after", $this->slider->id);
            ?>


                            </div>
                        </div>

                        <div id="postbox-container-1" class="postbox-container">
                            <div class='right'>
                                <div class="ms-postbox" id="metaslider_configuration">
                                    <h3 class='configuration'>
                                        <?php 
            _e("Settings", "metaslider");
            ?>

                                        <input class='alignright button button-primary' type='submit' name='save' id='ms-save' value='<?php 
            _e("Save", "metaslider");
            ?>
' />
                                        <input class='alignright button button-primary' type='submit' name='preview' id='ms-preview' value='<?php 
            _e("Save & Preview", "metaslider");
            ?>
' data-slider_id='<?php 
            echo $this->slider->id;
            ?>
' data-slider_width='<?php 
            echo $this->slider->get_setting('width');
            ?>
' data-slider_height='<?php 
            echo $this->slider->get_setting('height');
            ?>
' />
                                        <span class="spinner"></span>
                                    </h3>
                                    <div class="inside">
                                        <table class="settings">
                                            <tbody>
                                                <?php 
            $aFields = array('type' => array('priority' => 0, 'type' => 'slider-lib', 'value' => $this->slider->get_setting('type'), 'options' => array('flex' => array('label' => __("Flex Slider", "metaslider")), 'responsive' => array('label' => __("R. Slides", "metaslider")), 'nivo' => array('label' => __("Nivo Slider", "metaslider")), 'coin' => array('label' => __("Coin Slider", "metaslider")))), 'width' => array('priority' => 10, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 9999, 'step' => 1, 'value' => $this->slider->get_setting('width'), 'label' => __("Width", "metaslider"), 'class' => 'coin flex responsive nivo', 'helptext' => __("Slideshow width", "metaslider"), 'after' => __("px", "metaslider")), 'height' => array('priority' => 20, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 9999, 'step' => 1, 'value' => $this->slider->get_setting('height'), 'label' => __("Height", "metaslider"), 'class' => 'coin flex responsive nivo', 'helptext' => __("Slideshow height", "metaslider"), 'after' => __("px", "metaslider")), 'effect' => array('priority' => 30, 'type' => 'select', 'value' => $this->slider->get_setting('effect'), 'label' => __("Effect", "metaslider"), 'class' => 'effect coin flex responsive nivo', 'helptext' => __("Slide transition effect", "metaslider"), 'options' => array('random' => array('class' => 'option coin nivo', 'label' => __("Random", "metaslider")), 'swirl' => array('class' => 'option coin', 'label' => __("Swirl", "metaslider")), 'rain' => array('class' => 'option coin', 'label' => __("Rain", "metaslider")), 'straight' => array('class' => 'option coin', 'label' => __("Straight", "metaslider")), 'sliceDown' => array('class' => 'option nivo', 'label' => __("Slide Down", "metaslider")), 'sliceUp' => array('class' => 'option nivo', 'label' => __("Slice Up", "metaslider")), 'sliceUpLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Left", "metaslider")), 'sliceUpDown' => array('class' => 'option nivo', 'label' => __("Slice Up Down", "metaslider")), 'slideUpDownLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Down Left", "metaslider")), 'fold' => array('class' => 'option nivo', 'label' => __("Fold", "metaslider")), 'fade' => array('class' => 'option nivo flex responsive', 'label' => __("Fade", "metaslider")), 'slideInRight' => array('class' => 'option nivo', 'label' => __("Slide In Right", "metaslider")), 'slideInLeft' => array('class' => 'option nivo', 'label' => __("Slide In Left", "metaslider")), 'boxRandom' => array('class' => 'option nivo', 'label' => __("Box Random", "metaslider")), 'boxRain' => array('class' => 'option nivo', 'label' => __("Box Rain", "metaslider")), 'boxRainReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Reverse", "metaslider")), 'boxRainGrowReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Grow Reverse", "metaslider")), 'slide' => array('class' => 'option flex', 'label' => __("Slide", "metaslider")))), 'theme' => array('priority' => 40, 'type' => 'theme', 'value' => $this->slider->get_setting('theme'), 'label' => __("Theme", "metaslider"), 'class' => 'effect coin flex responsive nivo', 'helptext' => __("Slideshow theme", "metaslider"), 'options' => array('default' => array('class' => 'option nivo flex coin responsive', 'label' => __("Default", "metaslider")), 'dark' => array('class' => 'option nivo', 'label' => __("Dark (Nivo)", "metaslider")), 'light' => array('class' => 'option nivo', 'label' => __("Light (Nivo)", "metaslider")), 'bar' => array('class' => 'option nivo', 'label' => __("Bar (Nivo)", "metaslider")))), 'links' => array('priority' => 50, 'type' => 'checkbox', 'label' => __("Arrows", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('links') == 'true' ? 'checked' : '', 'helptext' => __("Show the previous/next arrows", "metaslider")), 'navigation' => array('priority' => 60, 'type' => 'navigation', 'label' => __("Navigation", "metaslider"), 'class' => 'option coin flex nivo responsive', 'value' => $this->slider->get_setting('navigation'), 'helptext' => __("Show the slide navigation bullets", "metaslider"), 'options' => array('false' => array('label' => __("Hidden", "metaslider")), 'true' => array('label' => __("Dots", "metaslider")))));
            if ($this->get_view() == 'dropdown') {
                $aFields['title'] = array('type' => 'title', 'priority' => 5, 'class' => 'option flex nivo responsive coin', 'value' => get_the_title($this->slider->id), 'label' => __("Title", "metaslider"), 'helptext' => __("Slideshow title", "metaslider"));
            }
            $aFields = apply_filters('metaslider_basic_settings', $aFields, $this->slider);
            echo $this->build_settings_rows($aFields);
            ?>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                                <div class="ms-postbox ms-toggle closed" id="metaslider_advanced_settings">
                                    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php 
            _e("Advanced Settings", "metaslider");
            ?>
</span></h3>
                                    <div class="inside">
                                        <table>
                                            <tbody>
                                                <?php 
            $aFields = array('fullWidth' => array('priority' => 5, 'type' => 'checkbox', 'label' => __("Stretch", "metaslider"), 'class' => 'option flex nivo responsive', 'after' => __("100% wide output", "metaslider"), 'checked' => $this->slider->get_setting('fullWidth') == 'true' ? 'checked' : '', 'helptext' => __("Stretch the slideshow output to fill it's parent container", "metaslider")), 'center' => array('priority' => 10, 'type' => 'checkbox', 'label' => __("Center align", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('center') == 'true' ? 'checked' : '', 'helptext' => __("Center align the slideshow", "metaslider")), 'autoPlay' => array('priority' => 20, 'type' => 'checkbox', 'label' => __("Auto play", "metaslider"), 'class' => 'option flex nivo responsive', 'checked' => $this->slider->get_setting('autoPlay') == 'true' ? 'checked' : '', 'helptext' => __("Transition between slides automatically", "metaslider")), 'smartCrop' => array('priority' => 30, 'type' => 'select', 'label' => __("Image Crop", "metaslider"), 'class' => 'option coin flex nivo responsive', 'value' => $this->slider->get_setting('smartCrop'), 'options' => array('true' => array('label' => __("Smart", "metaslider"), 'class' => ''), 'false' => array('label' => __("Standard", "metaslider"), 'class' => ''), 'disabled' => array('label' => __("Disabled", "metaslider"), 'class' => '')), 'helptext' => __("Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size", "metaslider")), 'carouselMode' => array('priority' => 40, 'type' => 'checkbox', 'label' => __("Carousel mode", "metaslider"), 'class' => 'option flex showNextWhenChecked', 'checked' => $this->slider->get_setting('carouselMode') == 'true' ? 'checked' : '', 'helptext' => __("Display multiple slides at once. Slideshow output will be 100% wide.", "metaslider")), 'carouselMargin' => array('priority' => 45, 'min' => 0, 'max' => 9999, 'step' => 1, 'type' => 'number', 'label' => __("Carousel margin", "metaslider"), 'class' => 'option flex', 'value' => $this->slider->get_setting('carouselMargin'), 'helptext' => __("Pixel margin between slides in carousel.", "metaslider"), 'after' => __("px", "metaslider")), 'random' => array('priority' => 50, 'type' => 'checkbox', 'label' => __("Random", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('random') == 'true' ? 'checked' : '', 'helptext' => __("Randomise the order of the slides", "metaslider")), 'hoverPause' => array('priority' => 60, 'type' => 'checkbox', 'label' => __("Hover pause", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('hoverPause') == 'true' ? 'checked' : '', 'helptext' => __("Pause the slideshow when hovering over slider, then resume when no longer hovering.", "metaslider")), 'reverse' => array('priority' => 70, 'type' => 'checkbox', 'label' => __("Reverse", "metaslider"), 'class' => 'option flex', 'checked' => $this->slider->get_setting('reverse') == 'true' ? 'checked' : '', 'helptext' => __("Reverse the animation direction", "metaslider")), 'delay' => array('priority' => 80, 'type' => 'number', 'size' => 3, 'min' => 500, 'max' => 10000, 'step' => 100, 'value' => $this->slider->get_setting('delay'), 'label' => __("Slide delay", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("How long to display each slide, in milliseconds", "metaslider"), 'after' => __("ms", "metaslider")), 'animationSpeed' => array('priority' => 90, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 2000, 'step' => 100, 'value' => $this->slider->get_setting('animationSpeed'), 'label' => __("Animation speed", "metaslider"), 'class' => 'option flex responsive nivo', 'helptext' => __("Set the speed of animations, in milliseconds", "metaslider"), 'after' => __("ms", "metaslider")), 'slices' => array('priority' => 100, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('slices'), 'label' => __("Number of slices", "metaslider"), 'class' => 'option nivo', 'helptext' => __("Number of slices", "metaslider"), 'after' => __("ms", "metaslider")), 'spw' => array('priority' => 110, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('spw'), 'label' => __("Number of squares", "metaslider") . " (" . __("Width", "metaslider") . ")", 'class' => 'option nivo', 'helptext' => __("Number of squares", "metaslider"), 'after' => ''), 'sph' => array('priority' => 120, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('sph'), 'label' => __("Number of squares", "metaslider") . " (" . __("Height", "metaslider") . ")", 'class' => 'option nivo', 'helptext' => __("Number of squares", "metaslider"), 'after' => ''), 'direction' => array('priority' => 130, 'type' => 'select', 'label' => __("Slide direction", "metaslider"), 'class' => 'option flex', 'helptext' => __("Select the sliding direction", "metaslider"), 'value' => $this->slider->get_setting('direction'), 'options' => array('horizontal' => array('label' => __("Horizontal", "metaslider"), 'class' => ''), 'vertical' => array('label' => __("Vertical", "metaslider"), 'class' => ''))), 'easing' => array('priority' => 140, 'type' => 'select', 'label' => __("Easing", "metaslider"), 'class' => 'option flex', 'helptext' => __("Animation easing effect", "metaslider"), 'value' => $this->slider->get_setting('easing'), 'options' => $this->get_easing_options()), 'prevText' => array('priority' => 150, 'type' => 'text', 'label' => __("Previous text", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Set the text for the 'previous' direction item", "metaslider"), 'value' => $this->slider->get_setting('prevText') == 'false' ? '' : $this->slider->get_setting('prevText')), 'nextText' => array('priority' => 160, 'type' => 'text', 'label' => __("Next text", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Set the text for the 'next' direction item", "metaslider"), 'value' => $this->slider->get_setting('nextText') == 'false' ? '' : $this->slider->get_setting('nextText')), 'sDelay' => array('priority' => 170, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 500, 'step' => 10, 'value' => $this->slider->get_setting('sDelay'), 'label' => __("Square delay", "metaslider"), 'class' => 'option coin', 'helptext' => __("Delay between squares in ms", "metaslider"), 'after' => __("ms", "metaslider")), 'opacity' => array('priority' => 180, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 1, 'step' => 0.1, 'value' => $this->slider->get_setting('opacity'), 'label' => __("Opacity", "metaslider"), 'class' => 'option coin', 'helptext' => __("Opacity of title and navigation", "metaslider"), 'after' => ''), 'titleSpeed' => array('priority' => 190, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 10000, 'step' => 100, 'value' => $this->slider->get_setting('titleSpeed'), 'label' => __("Caption speed", "metaslider"), 'class' => 'option coin', 'helptext' => __("Set the fade in speed of the caption", "metaslider"), 'after' => __("ms", "metaslider")), 'developerOptions' => array('priority' => 195, 'type' => 'divider', 'class' => 'option coin flex responsive nivo', 'value' => __("Developer options", "metaslider")), 'cssClass' => array('priority' => 200, 'type' => 'text', 'label' => __("CSS classes", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Specify any custom CSS Classes you would like to be added to the slider wrapper", "metaslider"), 'value' => $this->slider->get_setting('cssClass') == 'false' ? '' : $this->slider->get_setting('cssClass')), 'printCss' => array('priority' => 210, 'type' => 'checkbox', 'label' => __("Print CSS", "metaslider"), 'class' => 'option coin flex responsive nivo useWithCaution', 'checked' => $this->slider->get_setting('printCss') == 'true' ? 'checked' : '', 'helptext' => __("Uncheck this is you would like to include your own CSS", "metaslider")), 'printJs' => array('priority' => 220, 'type' => 'checkbox', 'label' => __("Print JS", "metaslider"), 'class' => 'option coin flex responsive nivo useWithCaution', 'checked' => $this->slider->get_setting('printJs') == 'true' ? 'checked' : '', 'helptext' => __("Uncheck this is you would like to include your own Javascript", "metaslider")), 'noConflict' => array('priority' => 230, 'type' => 'checkbox', 'label' => __("No conflict mode", "metaslider"), 'class' => 'option flex', 'checked' => $this->slider->get_setting('noConflict') == 'true' ? 'checked' : '', 'helptext' => __("Delay adding the flexslider class to the slideshow", "metaslider")));
            $aFields = apply_filters('metaslider_advanced_settings', $aFields, $this->slider);
            echo $this->build_settings_rows($aFields);
            ?>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                                <div class="ms-postbox shortcode ms-toggle" id="metaslider_usage">
                                    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php 
            _e("Usage", "metaslider");
            ?>
</span></h3>
                                    <div class="inside">
                                        <ul class='tabs'>
                                            <li rel='tab-1' class='selected'><?php 
            _e("Shortcode", "metaslider");
            ?>
</li>
                                            <li rel='tab-2'><?php 
            _e("Template Include", "metaslider");
            ?>
</li>
                                        </ul>
                                        <div class='tabs-content'>
                                            <div class='tab tab-1'>
                                            <p><?php 
            _e("Copy & paste the shortcode directly into any WordPress post or page.", "metaslider");
            ?>
</p>
                                            <input readonly='readonly' type='text' value='[metaslider id=<?php 
            echo $this->slider->id;
            ?>
]' /></div>
                                            <div class='tab tab-2' style='display: none'>
                                            <p><?php 
            _e("Copy & paste this code into a template file to include the slideshow within your theme.", "metaslider");
            ?>
</p>
                                            <textarea readonly='readonly'>&lt;?php &#13;&#10;    echo do_shortcode("[metaslider id=<?php 
            echo $this->slider->id;
            ?>
]"); &#13;&#10;?></textarea></div>
                                        </div>
                                    </div>
                                </div>

                                <?php 
            if (!is_plugin_active('ml-slider-pro/ml-slider-pro.php')) {
                ?>


                                <div class="ms-postbox social" id="metaslider_social">
                                    <div class="inside">
                                        <ul class='info'>
                                            <li style='width: 33%;'>
                                                <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.metaslider.com" data-text="Check out Meta Slider, an easy to use slideshow plugin for WordPress" data-hashtags="metaslider, wordpress, slideshow">Tweet</a>
                                                <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
                                            </li>
                                            <li style='width: 34%;'>
                                                <div class="g-plusone" data-size="medium" data-href="http://www.metaslider.com"></div>
                                                <script type="text/javascript">
                                                  (function() {
                                                    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                                                    po.src = 'https://apis.google.com/js/plusone.js';
                                                    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
                                                  })();
                                                </script>
                                            </li>
                                            <li style='width: 33%;'>
                                                <iframe style='border:none; overflow:hidden; width:80px; height:21px;' src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fwpmetaslider&amp;width=120&amp;layout=button_count&amp;action=like&amp;show_faces=true&amp;share=false&amp;height=21&amp;appId=156668027835524" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                                <?php 
            }
            ?>


                                <a class='delete-slider alignright button-secondary' href='<?php 
            echo wp_nonce_url("?page=metaslider&amp;delete={$this->slider->id}", "metaslider_delete_slider");
            ?>
'><?php 
            _e("Delete Slider", "metaslider");
            ?>
</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <?php 
        }
示例#5
0
 /**
  * Include slider assets
  */
 public function enqueue_scripts()
 {
     parent::enqueue_scripts();
     if ($this->get_setting('printJs') == 'true') {
         wp_enqueue_script('metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', array('jquery'), METASLIDER_VERSION);
     }
 }
示例#6
0
 /**
  * Create a new slider
  */
 private function add_slider()
 {
     $defaults = array();
     // if possible, take a copy of the last edited slider settings in place of default settings
     if ($last_modified = $this->find_slider('modified', 'DESC')) {
         $defaults = get_post_meta($last_modified, 'ml-slider_settings', true);
     }
     // insert the post
     $id = wp_insert_post(array('post_title' => __("New Slider", 'metaslider'), 'post_status' => 'publish', 'post_type' => 'ml-slider'));
     // use the default settings if we can't find anything more suitable.
     if (empty($defaults)) {
         $slider = new MetaSlider($id);
         $defaults = $slider->get_default_parameters();
     }
     // insert the post meta
     add_post_meta($id, 'ml-slider_settings', $defaults, true);
     // create the taxonomy term, the term is the ID of the slider itself
     wp_insert_term($id, 'ml-slider');
 }
        /**
         * Render the admin page (tabs, slides, settings)
         */
        public function render_admin_page()
        {
            $this->admin_process();
            //$this->upgrade_to_pro_cta();
            $this->do_system_check();
            $slider_id = $this->slider ? $this->slider->id : 0;
            ?>

        <script type='text/javascript'>
            var metaslider_slider_id = <?php 
            echo $slider_id;
            ?>
;
        </script>

        <div class="wrap metaslider">
            <form accept-charset="UTF-8" action="?page=hw-metaslider&amp;id=<?php 
            echo $slider_id;
            ?>
" method="post">
                <?php 
            if ($this->slider) {
                wp_nonce_field('hw_metaslider_save_' . $this->slider->id);
            }
            $this->print_slideshow_selector();
            if (!$this->slider) {
                return;
            }
            ?>
                <div id='poststuff'>
                    <div id='post-body' class='metabox-holder columns-2'>

                        <div id='post-body-content'>
                            <div class="left">

                                <?php 
            do_action("metaslider_admin_table_before", $this->slider->id);
            ?>

                                <table class="widefat sortable">
                                    <thead>
                                        <tr>
                                            <th style="width: 100px;">
                                                <h3><?php 
            _e("Slides", "metaslider");
            ?>
</h3>
                                                <?php 
            do_action("metaslider_admin_table_header_left", $this->slider->id);
            ?>
                                            </th>
                                            <th>
                                                <a href='#' class='button alignright add-slide' data-editor='content' title='<?php 
            _e("Add Slide", "metaslider");
            ?>
'>
                                                    <span class='wp-media-buttons-icon'></span> <?php 
            _e("Add Slide", "metaslider");
            ?>
                                                </a>
                                                <?php 
            do_action("metaslider_admin_table_header_right", $this->slider->id);
            ?>
                                            </th>
                                        </tr>
                                    </thead>

                                    <tbody>
                                        <?php 
            $this->slider->render_admin_slides();
            ?>
                                    </tbody>
                                </table>

                                <?php 
            do_action("metaslider_admin_table_after", $this->slider->id);
            ?>

                            </div>
                        </div>

                        <div id="postbox-container-1" class="postbox-container">
                            <div class='right'>
                                <div class="ms-postbox" id="metaslider_configuration">
                                    <h3 class='configuration'>
                                        <?php 
            _e("Settings", "metaslider");
            ?>
                                        <input class='alignright button button-primary' type='submit' name='save' id='ms-save' value='<?php 
            _e("Save", "metaslider");
            ?>
' />
                                        <input class='alignright button button-primary' type='submit' name='preview' id='ms-preview' value='<?php 
            _e("Save & Preview", "metaslider");
            ?>
' data-slider_id='<?php 
            echo $this->slider->id;
            ?>
' data-slider_width='<?php 
            echo $this->slider->get_setting('width');
            ?>
' data-slider_height='<?php 
            echo $this->slider->get_setting('height');
            ?>
' />
                                        <span class="spinner"></span>
                                    </h3>
                                    <div class="inside">
                                        <table class="settings">
                                            <tbody>
                                                <?php 
            $aFields = array('type' => array('priority' => 0, 'type' => 'slider-lib', 'value' => $this->slider->get_setting('type'), 'options' => array('flex' => array('label' => __("Flex Slider", "metaslider")), 'responsive' => array('label' => __("R. Slides", "metaslider")), 'nivo' => array('label' => __("Nivo Slider", "metaslider")), 'coin' => array('label' => __("Coin Slider", "metaslider")))), 'width' => array('priority' => 10, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 9999, 'step' => 1, 'value' => $this->slider->get_setting('width'), 'label' => __("Width", "metaslider"), 'class' => 'coin flex responsive nivo', 'helptext' => __("Slideshow width", "metaslider"), 'after' => __("px", "metaslider")), 'height' => array('priority' => 20, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 9999, 'step' => 1, 'value' => $this->slider->get_setting('height'), 'label' => __("Height", "metaslider"), 'class' => 'coin flex responsive nivo', 'helptext' => __("Slideshow height", "metaslider"), 'after' => __("px", "metaslider")), 'effect' => array('priority' => 30, 'type' => 'select', 'value' => $this->slider->get_setting('effect'), 'label' => __("Effect", "metaslider"), 'class' => 'effect coin flex responsive nivo', 'helptext' => __("Slide transition effect", "metaslider"), 'options' => array('random' => array('class' => 'option coin nivo', 'label' => __("Random", "metaslider")), 'swirl' => array('class' => 'option coin', 'label' => __("Swirl", "metaslider")), 'rain' => array('class' => 'option coin', 'label' => __("Rain", "metaslider")), 'straight' => array('class' => 'option coin', 'label' => __("Straight", "metaslider")), 'sliceDown' => array('class' => 'option nivo', 'label' => __("Slide Down", "metaslider")), 'sliceUp' => array('class' => 'option nivo', 'label' => __("Slice Up", "metaslider")), 'sliceUpLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Left", "metaslider")), 'sliceUpDown' => array('class' => 'option nivo', 'label' => __("Slice Up Down", "metaslider")), 'slideUpDownLeft' => array('class' => 'option nivo', 'label' => __("Slide Up Down Left", "metaslider")), 'fold' => array('class' => 'option nivo', 'label' => __("Fold", "metaslider")), 'fade' => array('class' => 'option nivo flex responsive', 'label' => __("Fade", "metaslider")), 'slideInRight' => array('class' => 'option nivo', 'label' => __("Slide In Right", "metaslider")), 'slideInLeft' => array('class' => 'option nivo', 'label' => __("Slide In Left", "metaslider")), 'boxRandom' => array('class' => 'option nivo', 'label' => __("Box Random", "metaslider")), 'boxRain' => array('class' => 'option nivo', 'label' => __("Box Rain", "metaslider")), 'boxRainReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Reverse", "metaslider")), 'boxRainGrowReverse' => array('class' => 'option nivo', 'label' => __("Box Rain Grow Reverse", "metaslider")), 'slide' => array('class' => 'option flex', 'label' => __("Slide", "metaslider")))), 'theme' => array('priority' => 40, 'type' => 'theme', 'value' => $this->slider->get_setting('theme'), 'label' => __("Theme", "metaslider"), 'class' => 'effect coin flex responsive nivo', 'helptext' => __("Slideshow theme", "metaslider"), 'options' => array('default' => array('class' => 'option nivo flex coin responsive', 'label' => __("Default", "metaslider")), 'dark' => array('class' => 'option nivo', 'label' => __("Dark (Nivo)", "metaslider")), 'light' => array('class' => 'option nivo', 'label' => __("Light (Nivo)", "metaslider")), 'bar' => array('class' => 'option nivo', 'label' => __("Bar (Nivo)", "metaslider")))), 'links' => array('priority' => 50, 'type' => 'checkbox', 'label' => __("Arrows", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('links') == 'true' ? 'checked' : '', 'helptext' => __("Show the previous/next arrows", "metaslider")), 'navigation' => array('priority' => 60, 'type' => 'navigation', 'label' => __("Navigation", "metaslider"), 'class' => 'option coin flex nivo responsive', 'value' => $this->slider->get_setting('navigation'), 'helptext' => __("Show the slide navigation bullets", "metaslider"), 'options' => array('false' => array('label' => __("Hidden", "metaslider")), 'true' => array('label' => __("Dots", "metaslider")))));
            if ($this->get_view() == 'dropdown') {
                $aFields['title'] = array('type' => 'title', 'priority' => 5, 'class' => 'option flex nivo responsive coin', 'value' => get_the_title($this->slider->id), 'label' => __("Title", "metaslider"), 'helptext' => __("Slideshow title", "metaslider"));
            }
            $aFields = apply_filters('hw_metaslider_basic_settings', $aFields, $this->slider);
            echo $this->build_settings_rows($aFields);
            ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                                <div class="ms-postbox ms-toggle closed" id="metaslider_advanced_settings">
                                    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php 
            _e("Advanced Settings", "metaslider");
            ?>
</span></h3>
                                    <div class="inside">
                                        <table>
                                            <tbody>
                                                <?php 
            $aFields = array('fullWidth' => array('priority' => 5, 'type' => 'checkbox', 'label' => __("Stretch", "metaslider"), 'class' => 'option flex nivo responsive', 'after' => __("100% wide output", "metaslider"), 'checked' => $this->slider->get_setting('fullWidth') == 'true' ? 'checked' : '', 'helptext' => __("Stretch the slideshow output to fill it's parent container", "metaslider")), 'center' => array('priority' => 10, 'type' => 'checkbox', 'label' => __("Center align", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('center') == 'true' ? 'checked' : '', 'helptext' => __("Center align the slideshow", "metaslider")), 'autoPlay' => array('priority' => 20, 'type' => 'checkbox', 'label' => __("Auto play", "metaslider"), 'class' => 'option flex nivo responsive', 'checked' => $this->slider->get_setting('autoPlay') == 'true' ? 'checked' : '', 'helptext' => __("Transition between slides automatically", "metaslider")), 'smartCrop' => array('priority' => 30, 'type' => 'select', 'label' => __("Image Crop", "metaslider"), 'class' => 'option coin flex nivo responsive', 'value' => $this->slider->get_setting('smartCrop'), 'options' => array('true' => array('label' => __("Smart Crop", "metaslider"), 'class' => ''), 'false' => array('label' => __("Standard", "metaslider"), 'class' => ''), 'disabled' => array('label' => __("Disabled", "metaslider"), 'class' => ''), 'disabled_pad' => array('label' => __("Disabled (Smart Pad)", "metaslider"), 'class' => 'option flex')), 'helptext' => __("Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size", "metaslider")), 'carouselMode' => array('priority' => 40, 'type' => 'checkbox', 'label' => __("Carousel mode", "metaslider"), 'class' => 'option flex showNextWhenChecked', 'checked' => $this->slider->get_setting('carouselMode') == 'true' ? 'checked' : '', 'helptext' => __("Display multiple slides at once. Slideshow output will be 100% wide.", "metaslider")), 'carouselMargin' => array('priority' => 45, 'min' => 0, 'max' => 9999, 'step' => 1, 'type' => 'number', 'label' => __("Carousel margin", "metaslider"), 'class' => 'option flex', 'value' => $this->slider->get_setting('carouselMargin'), 'helptext' => __("Pixel margin between slides in carousel.", "metaslider"), 'after' => __("px", "metaslider")), 'random' => array('priority' => 50, 'type' => 'checkbox', 'label' => __("Random", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('random') == 'true' ? 'checked' : '', 'helptext' => __("Randomise the order of the slides", "metaslider")), 'hoverPause' => array('priority' => 60, 'type' => 'checkbox', 'label' => __("Hover pause", "metaslider"), 'class' => 'option coin flex nivo responsive', 'checked' => $this->slider->get_setting('hoverPause') == 'true' ? 'checked' : '', 'helptext' => __("Pause the slideshow when hovering over slider, then resume when no longer hovering.", "metaslider")), 'reverse' => array('priority' => 70, 'type' => 'checkbox', 'label' => __("Reverse", "metaslider"), 'class' => 'option flex', 'checked' => $this->slider->get_setting('reverse') == 'true' ? 'checked' : '', 'helptext' => __("Reverse the animation direction", "metaslider")), 'delay' => array('priority' => 80, 'type' => 'number', 'size' => 3, 'min' => 500, 'max' => 10000, 'step' => 100, 'value' => $this->slider->get_setting('delay'), 'label' => __("Slide delay", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("How long to display each slide, in milliseconds", "metaslider"), 'after' => __("ms", "metaslider")), 'animationSpeed' => array('priority' => 90, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 2000, 'step' => 100, 'value' => $this->slider->get_setting('animationSpeed'), 'label' => __("Animation speed", "metaslider"), 'class' => 'option flex responsive nivo', 'helptext' => __("Set the speed of animations, in milliseconds", "metaslider"), 'after' => __("ms", "metaslider")), 'slices' => array('priority' => 100, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('slices'), 'label' => __("Number of slices", "metaslider"), 'class' => 'option nivo', 'helptext' => __("Number of slices", "metaslider"), 'after' => __("ms", "metaslider")), 'spw' => array('priority' => 110, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('spw'), 'label' => __("Number of squares", "metaslider") . " (" . __("Width", "metaslider") . ")", 'class' => 'option nivo', 'helptext' => __("Number of squares", "metaslider"), 'after' => ''), 'sph' => array('priority' => 120, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 20, 'step' => 1, 'value' => $this->slider->get_setting('sph'), 'label' => __("Number of squares", "metaslider") . " (" . __("Height", "metaslider") . ")", 'class' => 'option nivo', 'helptext' => __("Number of squares", "metaslider"), 'after' => ''), 'direction' => array('priority' => 130, 'type' => 'select', 'label' => __("Slide direction", "metaslider"), 'class' => 'option flex', 'helptext' => __("Select the sliding direction", "metaslider"), 'value' => $this->slider->get_setting('direction'), 'options' => array('horizontal' => array('label' => __("Horizontal", "metaslider"), 'class' => ''), 'vertical' => array('label' => __("Vertical", "metaslider"), 'class' => ''))), 'easing' => array('priority' => 140, 'type' => 'select', 'label' => __("Easing", "metaslider"), 'class' => 'option flex', 'helptext' => __("Animation easing effect", "metaslider"), 'value' => $this->slider->get_setting('easing'), 'options' => $this->get_easing_options()), 'prevText' => array('priority' => 150, 'type' => 'text', 'label' => __("Previous text", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Set the text for the 'previous' direction item", "metaslider"), 'value' => $this->slider->get_setting('prevText') == 'false' ? '' : $this->slider->get_setting('prevText')), 'nextText' => array('priority' => 160, 'type' => 'text', 'label' => __("Next text", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Set the text for the 'next' direction item", "metaslider"), 'value' => $this->slider->get_setting('nextText') == 'false' ? '' : $this->slider->get_setting('nextText')), 'sDelay' => array('priority' => 170, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 500, 'step' => 10, 'value' => $this->slider->get_setting('sDelay'), 'label' => __("Square delay", "metaslider"), 'class' => 'option coin', 'helptext' => __("Delay between squares in ms", "metaslider"), 'after' => __("ms", "metaslider")), 'opacity' => array('priority' => 180, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 1, 'step' => 0.1, 'value' => $this->slider->get_setting('opacity'), 'label' => __("Opacity", "metaslider"), 'class' => 'option coin', 'helptext' => __("Opacity of title and navigation", "metaslider"), 'after' => ''), 'titleSpeed' => array('priority' => 190, 'type' => 'number', 'size' => 3, 'min' => 0, 'max' => 10000, 'step' => 100, 'value' => $this->slider->get_setting('titleSpeed'), 'label' => __("Caption speed", "metaslider"), 'class' => 'option coin', 'helptext' => __("Set the fade in speed of the caption", "metaslider"), 'after' => __("ms", "metaslider")), 'developerOptions' => array('priority' => 195, 'type' => 'divider', 'class' => 'option coin flex responsive nivo', 'value' => __("Developer options", "metaslider")), 'cssClass' => array('priority' => 200, 'type' => 'text', 'label' => __("CSS classes", "metaslider"), 'class' => 'option coin flex responsive nivo', 'helptext' => __("Specify any custom CSS Classes you would like to be added to the slider wrapper", "metaslider"), 'value' => $this->slider->get_setting('cssClass') == 'false' ? '' : $this->slider->get_setting('cssClass')), 'printCss' => array('priority' => 210, 'type' => 'checkbox', 'label' => __("Print CSS", "metaslider"), 'class' => 'option coin flex responsive nivo useWithCaution', 'checked' => $this->slider->get_setting('printCss') == 'true' ? 'checked' : '', 'helptext' => __("Uncheck this is you would like to include your own CSS", "metaslider")), 'printJs' => array('priority' => 220, 'type' => 'checkbox', 'label' => __("Print JS", "metaslider"), 'class' => 'option coin flex responsive nivo useWithCaution', 'checked' => $this->slider->get_setting('printJs') == 'true' ? 'checked' : '', 'helptext' => __("Uncheck this is you would like to include your own Javascript", "metaslider")), 'noConflict' => array('priority' => 230, 'type' => 'checkbox', 'label' => __("No conflict mode", "metaslider"), 'class' => 'option flex', 'checked' => $this->slider->get_setting('noConflict') == 'true' ? 'checked' : '', 'helptext' => __("Delay adding the flexslider class to the slideshow", "metaslider")));
            $aFields = apply_filters('hw_metaslider_advanced_settings', $aFields, $this->slider);
            echo $this->build_settings_rows($aFields);
            ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>

                                <div class="ms-postbox shortcode ms-toggle" id="metaslider_usage">
                                    <div class="handlediv" title="Click to toggle"><br></div><h3 class="hndle"><span><?php 
            _e("Cách sử dụng", "metaslider");
            ?>
</span></h3>
                                    <div class="inside">
                                        <ul class='tabs'>
                                            <li rel='tab-1' class='selected'><?php 
            _e("Shortcode", "metaslider");
            ?>
</li>
                                            <li rel='tab-2'><?php 
            _e("PHP", "metaslider");
            ?>
</li>
                                        </ul>
                                        <div class='tabs-content'>
                                            <div class='tab tab-1'>
                                            <p><?php 
            _e("Hiển thị slider với shortcode sau.", "metaslider");
            ?>
</p>
                                            <input readonly='readonly' type='text' value='[hw_metaslider id=<?php 
            echo $this->slider->id;
            ?>
]' /></div>
                                            <div class='tab tab-2' style='display: none'>
                                            <p><?php 
            _e("Gọi shortcode với hàm PHP trong template:", "metaslider");
            ?>
</p>
                                            <textarea readonly='readonly'>&lt;?php &#13;&#10;    echo do_shortcode("[hw_metaslider id=<?php 
            echo $this->slider->id;
            ?>
]"); &#13;&#10;?></textarea></div>
                                        </div>
                                    </div>
                                </div>


                                <a class='delete-slider alignright button-secondary' href='<?php 
            echo wp_nonce_url("?page=hw-metaslider&amp;delete={$this->slider->id}", "metaslider_delete_slider");
            ?>
'><?php 
            _e("Delete Slider", "metaslider");
            ?>
</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <?php 
        }