示例#1
0
#-----------------------------------------------------------------
# Supersized JS Output
#-----------------------------------------------------------------
?>

<?php 
if ($slidedata->slidertype == "supersized") {
    ?>

(function($){
	
	$(document).ready(function(){
		
		$.supersized({		
		<?php 
    $supersizedoptions = supersized_form_array();
    foreach ($supersizedoptions as $key => $option) {
        if (isset($option['js']) && $option['js'] == "char") {
            echo $key . ':"' . $options[$key] . "\", \n";
        } elseif (isset($option['js']) && $option['js'] == "bolean") {
            $options[$key] == 'true' ? $value = '1' : ($value = '0');
            echo $key . ':' . $value . ", \n";
        } else {
            echo $key . ':' . $options[$key] . ", \n";
        }
    }
    ?>
				
		<?php 
    #-----------------------------------------------------------------
    # create Slides
示例#2
0
function lambda_slider_edit()
{
    ?>

	<div id="lambda-option-panel" class="bootstrap-wpadmin">
	
	<script type="text/javascript">
	jQuery(document).ready(function($) {
		
		/* ------------------------------------------------
		WordPress Media Upload
		------------------------------------------------ */
		var formfield = "";
		
		$('.lambda_upload_slider').live('click' , function() {
			 formfield = $(this).attr('title');
			 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
			 return false;
		});
		
		
		window.send_to_editor = function(html) {
			imgurl = jQuery('img',html).attr('src');
			jQuery('#'+ formfield).val(imgurl);
			tb_remove();
		}
		
	});	
	</script>
		
	<form method="post" action="options.php" class="well form-inline" >
	
	<?php 
    wp_nonce_field('update-options');
    //get needed slider data
    $slider = $_GET['edit'];
    $options = is_array(get_option($slider)) ? get_option($slider) : array();
    ?>
		
	<div class="lambda-opttitle">
    	<div class="lambda-opttitle-pad settingstitle">
			<h1><?php 
    echo _e('Slider Manager', UT_THEME_NAME);
    ?>
</h1>
			<input type="submit" class="lambda_save btn btn-success right" value="<?php 
    _e('Save Settings', UT_THEME_NAME);
    ?>
" />
			<div class="clear"></div>				
        </div>
    </div>
	
	<div class="navbar">
			<div class="navbar-inner">
				<div class="container">
				
				<ul class="options_tabs nav">
					<li><a href="#general-settings" data-toggle="tab"><?php 
    _e('General Slider Settings', UT_THEME_NAME);
    ?>
</a></li>
					
					<?php 
    //<li><a href="#image-settings" data-toggle="tab"><?php _e('Image Source Settings', UT_THEME_NAME); </a></li>
    ?>
					
					<li><a href="#image-items" data-toggle="tab"><?php 
    _e('Add Slider Items', UT_THEME_NAME);
    ?>
</a></li>
				</ul>
				
				</div>
			</div>
	</div>
	
	
	<div class="tab-content">	
	
	<div id="general-settings" class="tab-pane active">

	<?php 
    global $wpdb, $theme_path;
    $table_name = $wpdb->base_prefix . "lambda_sliders";
    $slider_result = $wpdb->get_row('SELECT * FROM ' . $table_name . ' WHERE option_name = "' . $slider . '"');
    switch ($slider_result->slidertype) {
        case "flexslider":
            $slider_form_options = flexslider_form_array();
            break;
        case "supersized":
            $slider_form_options = supersized_form_array();
            break;
        case "elasticslider":
            $slider_form_options = elastic_form_array();
            break;
        case "cameraslider":
            $slider_form_options = camera_form_array();
            break;
    }
    foreach ($slider_form_options as $key => $value) {
        $optionvalue = isset($options[$key]) ? $options[$key] : '';
        switch ($value['keytype']) {
            case "input":
                render_lambda_input($key, $value, $optionvalue, $slider);
                break;
            case "select":
                render_lambda_select($key, $value, $optionvalue, $slider);
                break;
            case "radio":
                render_lambda_radio($key, $value, $optionvalue, $slider);
                break;
        }
    }
    ?>
	</div><!-- /#general settings -->
		
	
	
	
	
	<div id="image-settings" class="tab-pane">
	<?php 
    $slider_form_options = lambda_slider_source_tab();
    foreach ($slider_form_options as $key => $value) {
        $optionvalue = isset($options[$key]) ? $options[$key] : '';
        switch ($value['keytype']) {
            case "input":
                render_lambda_input($key, $value, $optionvalue, $slider);
                break;
            case "select":
                render_lambda_select($key, $value, $optionvalue, $slider);
                break;
            case "radio":
                render_lambda_radio($key, $value, $optionvalue, $slider);
                break;
        }
    }
    ?>
	
	
		<div class="lambda_row">		
		<label class="regular_label"><?php 
    _e('Choose Category', UT_THEME_NAME);
    ?>
</label><br />
		
		<?php 
    wp_dropdown_categories(array('selected' => $slider['imgCat'], 'name' => $slider . '[imgCat]', 'orderby' => 'Name', 'hierarchical' => 1, 'class' => 'lambda_select', 'show_option_all' => __("All Categories", UT_THEME_NAME), 'hide_empty' => '0'));
    ?>
		
		</div>
	
	
	</div><!-- /#image settings -->
	
	
	<div id="image-items" class="tab-pane">
		
		<button class="add_slider_item btn btn-success" title="<?php 
    echo $_GET['slidertype'];
    ?>
" name="<?php 
    echo $slider;
    ?>
"><i class="icon-picture icon-white"></i> <?php 
    _e('Add Slide', UT_THEME_NAME);
    ?>
</button>
		
		<hr />
		
		<div id="single-items">
		
			
			
			<?php 
    #-----------------------------------------------------------------
    # Add Items for first call
    #-----------------------------------------------------------------
    if (empty($options['slides'])) {
        $slider_basic_items = lambda_slider_item_array();
    } else {
        $slider_basic_items = $options['slides'];
    }
    foreach ($slider_basic_items as $key => $value) {
        ?>
					
					<div id="lambda_<?php 
        echo $key;
        ?>
" class="slider_item">
					
						<div class="slider-header"><?php 
        echo $value['caption_text'];
        ?>
</div>
						
						<div class="slider-content">
															
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
        _e("Choose an Image", UT_THEME_NAME);
        ?>
									</div>
								</div>
								<div class="lambda_row section">
								
								<input id="<?php 
        echo $key;
        ?>
" type="text" name="<?php 
        echo $slider;
        ?>
[slides][<?php 
        echo $key;
        ?>
][imgurl]" value="<?php 
        echo $value['imgurl'];
        ?>
" />
								<button id="btn_<?php 
        echo $key;
        ?>
" class="lambda_upload_slider thickbox btn btn-mini btn-success" title="<?php 
        echo $key;
        ?>
">upload</button><br />
								<br />																	
								<img src="<?php 
        echo aq_resize($value['imgurl'], 150, 150, true);
        ?>
" />
								</div>								
								
								
								
								
								<?php 
        if ($_GET['slidertype'] == 'cameraslider') {
            ?>
								
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
            _e('or place an embedded video code', UT_THEME_NAME);
            ?>
									</div>
								</div>
								<div class="lambda_row section">
								
								<span class="badge badge-info"><?php 
            _e('You can also insert an image if using a video, this will be used as a poster!', UT_THEME_NAME);
            ?>
</span><br /><br />
								<textarea id="caption_<?php 
            echo $key;
            ?>
" name="<?php 
            echo $slider;
            ?>
[slides][<?php 
            echo $key;
            ?>
][video]"><?php 
            echo $value['video'];
            ?>
</textarea>
								</div>
								
								<?php 
        }
        ?>
								
								
								
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
        _e('Caption Headline', UT_THEME_NAME);
        ?>
									</div>
								</div>
								<div class="lambda_row section">
								
								<input id="caption_<?php 
        echo $key;
        ?>
" type="text" name="<?php 
        echo $slider;
        ?>
[slides][<?php 
        echo $key;
        ?>
][caption_text]" value="<?php 
        echo $value['caption_text'];
        ?>
" /><br />
								
								</div>
								
															
								
								<?php 
        if ($_GET['slidertype'] == 'cameraslider') {
            ?>
								
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
            _e('Caption Text', UT_THEME_NAME);
            ?>
									</div>
								</div>
								<div class="lambda_row section">								
								
								<textarea class="lambda_textarea" name="<?php 
            echo $slider;
            ?>
[slides][<?php 
            echo $key;
            ?>
][caption_desc]"><?php 
            echo $value['caption_desc'];
            ?>
</textarea>
								
								</div>
								
								<?php 
            $alignvalues['default'] = 'left';
            $alignvalues['fullname'] = 'Caption Align';
            $alignvalues['keyvalues'] = 'left;right';
            $savetarget = $slider . "[slides][" . $key . "][caption_align]";
            $captionalign = isset($value['caption_align']) ? $value['caption_align'] : 'left';
            render_lambda_radio($key, $alignvalues, $captionalign, $slider, true, $savetarget);
            ?>
									
								
								<?php 
            $alignvalues['default'] = 'white';
            $alignvalues['fullname'] = 'Caption Color';
            $alignvalues['keyvalues'] = 'white;dark';
            $savetarget = $slider . "[slides][" . $key . "][caption_color]";
            $captioncolor = isset($value['caption_color']) ? $value['caption_color'] : 'white';
            render_lambda_radio($key, $alignvalues, $captioncolor, $slider, true, $savetarget);
            ?>
							
								
								
								
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
            _e('Buttonlink', UT_THEME_NAME);
            ?>
									</div>
								</div>
								<div class="lambda_row section">
								
								<input id="caption_link_<?php 
            echo $key;
            ?>
" type="text" name="<?php 
            echo $slider;
            ?>
[slides][<?php 
            echo $key;
            ?>
][caption_link]" value="<?php 
            echo $value['caption_link'];
            ?>
" /><br />
								
								</div>	
								
								
								<div class="lambda-opttitle">
									<div class="lambda-opttitle-pad">
										<?php 
            _e('Buttontext', UT_THEME_NAME);
            ?>
									</div>
								</div>
								<div class="lambda_row section">
								
								<input id="buttontext_<?php 
            echo $key;
            ?>
" type="text" name="<?php 
            echo $slider;
            ?>
[slides][<?php 
            echo $key;
            ?>
][buttontext]" value="<?php 
            echo $value['buttontext'];
            ?>
" /><br />
								
								</div>							
								<?php 
        }
        ?>
								
								
								
								
								
								
								<button id="btn_del_<?php 
        echo $key;
        ?>
" class="lambda_delete_slide btn btn-mini btn-danger"  title="lambda_<?php 
        echo $key;
        ?>
">delete</button>
								
						  </div>
					
					</div>
		<?php 
    }
    ?>
		
		</div>
	
	</div><!-- /#image settings -->
	</div><!-- /#tab content -->
	
	<hr />
	
	<div class="lambda-opttitle">
            <div class="lambda-opttitle-pad settingstitle">
				<input type="hidden" name="action" value="update" />
				<input type="hidden" name="page_options" value="<?php 
    echo $slider;
    ?>
" />
				<input type="submit" class="lambda_save btn btn-success right" value="<?php 
    _e('Save Settings', UT_THEME_NAME);
    ?>
" />
				<div class="clear"></div>				
            </div>
    </div>
	</form>
	</div><!-- /#option panel -->
	<?php 
}