コード例 #1
0
ファイル: shortcodes_1.php プロジェクト: Vatia13/dancesport
function return_smooth_slider($slider_id = '', $offset = '0', $data = array())
{
    global $smooth_slider;
    $slider_html = '';
    if ($smooth_slider['multiple_sliders'] == '1' and is_singular()) {
        global $post;
        $post_id = $post->ID;
        if (ss_slider_on_this_post($post_id)) {
            $slider_id = get_slider_for_the_post($post_id);
        }
    }
    if ((!is_singular() or $smooth_slider['multiple_sliders'] != '1') and (empty($slider_id) or !isset($slider_id))) {
        $slider_id = '1';
    }
    if (!empty($slider_id)) {
        $set = '';
        $data['slider_id'] = $slider_id;
        $slider_handle = 'smooth_slider_' . $slider_id;
        $data['slider_handle'] = $slider_handle;
        $r_array = carousel_posts_on_slider($smooth_slider['no_posts'], $offset, $slider_id, $echo = '0', $set, $data);
        $slider_handle = 'smooth_slider_' . $slider_id;
        $slider_html = return_global_smooth_slider($slider_handle, $r_array, $slider_id, $set, $data);
    }
    //end of not empty slider_id condition
    return $slider_html;
}
コード例 #2
0
ファイル: smooth-slider.php プロジェクト: radscheit/unicorn
function add_to_slider_checkbox()
{
    global $post, $smooth_slider;
    if (current_user_can($smooth_slider['user_level'])) {
        $extra = "";
        $post_id = $post->ID;
        if (isset($post->ID)) {
            $post_id = $post->ID;
            if (is_post_on_any_slider($post_id)) {
                $extra = 'checked="checked"';
            }
        }
        $post_slider_arr = array();
        $post_sliders = ss_get_post_sliders($post_id);
        if ($post_sliders) {
            foreach ($post_sliders as $post_slider) {
                $post_slider_arr[] = $post_slider['slider_id'];
            }
        }
        $sliders = ss_get_sliders();
        $sslider_link = get_post_meta($post_id, 'slide_redirect_url', true);
        $sslider_nolink = get_post_meta($post_id, 'sslider_nolink', true);
        $thumbnail_key = $smooth_slider['img_pick'][1];
        $sslider_thumbnail = get_post_meta($post_id, $thumbnail_key, true);
        $sslider_disable_image = get_post_meta($post_id, '_disable_image', true);
        $smooth_embed_shortcode = get_post_meta($post_id, '_smooth_embed_shortcode', true);
        ?>
	
	  <?php 
        /* start tab 2.6 */
        ?>
	
             <script type="text/javascript">
		jQuery(document).ready(function($) {
			jQuery("#smooth_basic").css({"background":"#222222","color":"#ffffff"});
			jQuery("#smooth_basic").on("click", function(){ 
				jQuery("#smooth_basic_tab").fadeIn("fast");
				jQuery("#smooth_advaced_tab").fadeOut("fast");
				jQuery(this).css({"background":"#222222","color":"#ffffff"});
				jQuery("#smooth_advanced").css({"background":"buttonface","color":"#222222"});
			});
			jQuery("#smooth_advanced").on("click", function(){
				jQuery("#smooth_basic_tab").fadeOut("fast");
				jQuery("#smooth_advaced_tab").fadeIn("fast");
				jQuery(this).css({"background":"#222222","color":"#ffffff"});
				jQuery("#smooth_basic").css({"background":"buttonface","color":"#222222"});
				
			});
		}); 
		</script>
	    <?php 
        /* End tab 2.6 */
        ?>
	<div style="border-bottom: 1px solid #ccc;padding-bottom: 0;padding-left: 10px;">
		<button type="button" id="smooth_basic" style="padding:5px 30px 5px 30px;margin: 0;cursor:pointer;border:0;outline:none;">Basic</button>
		<button type="button" id="smooth_advanced" style="padding:5px 30px 5px 30px;margin:0 0 0 10px;cursor:pointer;border:0;outline:none">Advanced</button>
		</div>
	<div id="smooth_basic_tab">
		<div id="slider_checkbox">
		<table class="form-table">
		<tr valign="top">
		<th scope="row"><input type="checkbox" class="sldr_post" name="slider" value="slider" <?php 
        echo $extra;
        ?>
 />
		<label for="slider"><?php 
        _e('Add this post/page to', 'smooth-slider');
        ?>
 </label></th>
		<td><select name="slider_name[]" multiple="multiple" size="2" style="height:4em;">
                <?php 
        foreach ($sliders as $slider) {
            ?>
                  <option value="<?php 
            echo $slider['slider_id'];
            ?>
" <?php 
            if (in_array($slider['slider_id'], $post_slider_arr)) {
                echo 'selected';
            }
            ?>
><?php 
            echo $slider['slider_name'];
            ?>
</option>
                <?php 
        }
        ?>
                </select></td></tr>
	
	<tr valign="top">
		 <th scope="row"><label for="sslider_link"><?php 
        _e('Slide Link URL ', 'smooth-slider');
        ?>
</label></th>
                <td><input type="text" name="sslider_link" class="sslider_link" value="<?php 
        echo $sslider_link;
        ?>
" size="50" /><small><?php 
        _e('If left empty, it will be by default linked to the permalink.', 'smooth-slider');
        ?>
</small> </td></tr>
                
	<tr valign="top">
		 <th scope="row"><label for="sslider_nolink"> <?php 
        _e('Do not link this slide to any page(url)', 'smooth-slider');
        ?>
</label></th>
                <td><input type="checkbox" name="sslider_nolink" class="sslider_nolink" value="1" <?php 
        if ($sslider_nolink == '1') {
            echo "checked";
        }
        ?>
  /> </td></tr>
		</table>
                  </div>
	</div>
	<div id="smooth_advaced_tab" style="display:none;">   
		<div class="slider_checkbox">
		<table class="form-table">
            <?php 
        if ($smooth_slider['multiple_sliders'] == '1') {
            ?>
                <tr valign="top">
		<th scope="row"><label for="display_slider"><?php 
            _e('Display ', 'smooth-slider');
            ?>
		<select name="display_slider_name">
                <?php 
            foreach ($sliders as $slider) {
                ?>
                  <option value="<?php 
                echo $slider['slider_id'];
                ?>
" <?php 
                if (ss_post_on_slider($post_id, $slider['slider_id'])) {
                    echo 'selected';
                }
                ?>
><?php 
                echo $slider['slider_name'];
                ?>
</option>
                <?php 
            }
            ?>
                </select><?php 
            _e('on this Post/Page', 'smooth-slider');
            ?>
</th> 
		<td><input type="checkbox" class="sldr_post" name="display_slider" value="1" <?php 
            if (ss_slider_on_this_post($post_id)) {
                echo "checked";
            }
            ?>
 /><?php 
            _e('(Add the Smooth Slider template tag manually on your page.php/single.php or whatever page template file)');
            ?>
</label></td></tr>
          <?php 
        }
        ?>
		  
		<tr valign="top">
		 <th scope="row"><label for="_smooth_slider_style"><?php 
        _e('Stylesheet to use if slider is displayed on this Post/Page', 'smooth-slider');
        ?>
 </label></th>
    <?php 
        $slider_style = get_post_meta($post->ID, '_smooth_slider_style', true);
        ?>
        <td> <select name="_smooth_slider_style" >
			<?php 
        $directory = SMOOTH_SLIDER_CSS_DIR;
        if ($handle = opendir($directory)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' and $file != '..') {
                    ?>
                  <option value="<?php 
                    echo $file;
                    ?>
" <?php 
                    if ($slider_style == $file or empty($slider_style) and $smooth_slider['stylesheet'] == $file) {
                        echo "selected";
                    }
                    ?>
 ><?php 
                    echo $file;
                    ?>
</option>
             <?php 
                }
            }
            closedir($handle);
        }
        ?>
        </select> </td></tr>
          
	<input type="hidden" name="sldr-verify" id="sldr-verify" value="<?php 
        echo wp_create_nonce('SmoothSlider');
        ?>
" />
	   	 <tr valign="top">
		 <th scope="row"><label for="sslider_thumbnail"><?php 
        _e('Custom Thumbnail Image(url)', 'smooth-slider');
        ?>
</label></th>
                	<td><input type="text" name="sslider_thumbnail" class="sslider_thumbnail" value="<?php 
        echo $sslider_thumbnail;
        ?>
" size="50" />
                </td></tr>
		<tr valign="top">
		<th scope="row"><label for="disable_image"><?php 
        _e('Disable Thumbnail Image', 'smooth-slider');
        ?>
 </label></th>
		<td><input type="checkbox" name="disable_image" value="1" <?php 
        if ($sslider_disable_image == '1') {
            echo "checked";
        }
        ?>
  /> </td>
		</tr>
              
                
		<!-- Added for video - Start -->
		<tr valign="top">
		<th scope="row"><label for="embed_shortcode"><?php 
        _e('Embed Shortcode', 'smooth-slider');
        ?>
 </label><br><br><div style="font-weight:normal;border:1px dashed #ccc;padding:5px;color:#666;line-height:20px;font-size:13px;">You can embed any type of shortcode e.g video shortcode or button shortcode which you want to be overlaid on the slide.</div></th>
		<td><textarea rows="4" cols="50" name="smooth_sslider_eshortcode"><?php 
        echo htmlentities($smooth_embed_shortcode, ENT_QUOTES);
        ?>
</textarea></td>
		</tr>
		</table>
		<!-- Added for video - End -->

                 </div>
    </div>
        
<?php 
    }
}
コード例 #3
0
function add_to_slider_checkbox()
{
    global $post, $smooth_slider;
    if (current_user_can($smooth_slider['user_level'])) {
        $extra = "";
        $post_id = $post->ID;
        if (isset($post->ID)) {
            $post_id = $post->ID;
            if (is_post_on_any_slider($post_id)) {
                $extra = 'checked="checked"';
            }
        }
        $post_slider_arr = array();
        $post_sliders = ss_get_post_sliders($post_id);
        if ($post_sliders) {
            foreach ($post_sliders as $post_slider) {
                $post_slider_arr[] = $post_slider['slider_id'];
            }
        }
        $sliders = ss_get_sliders();
        ?>

		<div id="slider_checkbox">
				<input type="checkbox" class="sldr_post" name="slider" value="slider" <?php 
        echo $extra;
        ?>
 />
				<label for="slider">Add this post/page to </label>
				<select name="slider_name[]" multiple="multiple" size="2" style="height:4em;">
                <?php 
        foreach ($sliders as $slider) {
            ?>

                  <option value="<?php 
            echo $slider['slider_id'];
            ?>
" <?php 
            if (in_array($slider['slider_id'], $post_slider_arr)) {
                echo 'selected';
            }
            ?>
><?php 
            echo $slider['slider_name'];
            ?>
</option>
                <?php 
        }
        ?>

                </select>
                
         <?php 
        if ($smooth_slider['multiple_sliders'] == '1') {
            ?>

                <br />
                <br />
                <br />
                
                <input type="checkbox" class="sldr_post" name="display_slider" value="1" <?php 
            if (ss_slider_on_this_post($post_id)) {
                echo "checked";
            }
            ?>
 />
				<label for="display_slider">Display 
				<select name="display_slider_name">
                <?php 
            foreach ($sliders as $slider) {
                ?>

                  <option value="<?php 
                echo $slider['slider_id'];
                ?>
" <?php 
                if (ss_post_on_slider($post_id, $slider['slider_id'])) {
                    echo 'selected';
                }
                ?>
><?php 
                echo $slider['slider_name'];
                ?>
</option>
                <?php 
            }
            ?>

                </select> on this Post/Page (you need to add the Smooth Slider template tag manually on your page.php/single.php or whatever page template file)</label>
          <?php 
        }
        ?>

          
				<input type="hidden" name="sldr-verify" id="sldr-verify" value="<?php 
        echo wp_create_nonce('SmoothSlider');
        ?>
" />
	    </div>
        <br />
        <div>
        <?php 
        $slider_style = get_post_meta($post->ID, 'slider_style', true);
        ?>

         <select name="slider_style" >
			<?php 
        $directory = WP_PLUGIN_DIR . '/' . str_replace(basename(__FILE__), "", plugin_basename(__FILE__)) . '/css/styles/';
        if ($handle = opendir($directory)) {
            while (false !== ($file = readdir($handle))) {
                if ($file != '.' and $file != '..') {
                    ?>

                  <option value="<?php 
                    echo $file;
                    ?>
" <?php 
                    if ($slider_style == $file) {
                        echo "selected";
                    }
                    ?>
 ><?php 
                    echo $file;
                    ?>
</option>
             <?php 
                }
            }
            closedir($handle);
        }
        ?>

        </select> <label for="slider_style">Stylesheet to use if slider is displayed on this Post/Page </label><br /> <br />
        
  <?php 
        $thumbnail_key = $smooth_slider['img_pick'][1];
        $sslider_thumbnail = get_post_meta($post_id, $thumbnail_key, true);
        $sslider_link = get_post_meta($post_id, 'slide_redirect_url', true);
        $sslider_nolink = get_post_meta($post_id, 'sslider_nolink', true);
        ?>

                <label for="sslider_thumbnail">Custom Thumbnail Image(url)
                <input type="text" name="sslider_thumbnail" class="sslider_thumbnail" value="<?php 
        echo $sslider_thumbnail;
        ?>
" size="75" />
                <br /> </label> <br /><br />
                <fieldset>
                <label for="sslider_link">Slide Link URL 
                <input type="text" name="sslider_link" class="sslider_link" value="<?php 
        echo $sslider_link;
        ?>
" size="50" /> </label>
                <label for="sslider_nolink"> 
                <input type="checkbox" name="sslider_nolink" class="sslider_nolink" value="1" <?php 
        if ($sslider_nolink == '1') {
            echo "checked";
        }
        ?>
  /> Do not link this slide to any page(url)</label>
                 </fieldset>
                 </div>
        
<?php 
    }
}