コード例 #1
0
    /**
     * Print the HTML for the slide template metabox.
     *
     * @return void
     *
     */
    public function print_slide_template_metabox()
    {
        global $TS_Total_Slider;
        if (!$this->slug) {
            if (!array_key_exists('group', $_GET)) {
                return false;
            }
            $this->slug = $this->sanitize_slide_group_slug($_GET['group']);
        }
        $slide_group = new Total_Slide_Group($this->slug);
        if (!$slide_group->load()) {
            return false;
        }
        ?>
<div id="template-switch-controls">
			<p>
			<?php 
        $t = new Total_Slider_Template_Iterator();
        ?>
				<select name="template-slug" id="template-slug-selector">
					
					<?php 
        $builtin = $t->discover_templates('builtin');
        ?>
					<?php 
        if (is_array($builtin) && count($builtin) > 0) {
            ?>
					<optgroup label="<?php 
            _e('Built-in', 'total-slider');
            ?>
">
						<?php 
            foreach ($builtin as $tpl) {
                ?>

							<option
								value="<?php 
                echo esc_attr($tpl['slug']);
                ?>
"
								<?php 
                if ('builtin' == $slide_group->templateLocation && $slide_group->template == $tpl['slug']) {
                    ?>
								selected="selected"
								<?php 
                }
                ?>
								
							><?php 
                echo esc_html($tpl['name']);
                ?>
</option>
						<?php 
            }
            ?>
					</optgroup>
					<?php 
        }
        ?>
					
					<?php 
        $theme = $t->discover_templates('theme');
        ?>
					<?php 
        if (is_array($theme) && count($theme) > 0) {
            ?>
					<optgroup label="<?php 
            _e('Theme', 'total-slider');
            ?>
">
						<?php 
            foreach ($theme as $tpl) {
                ?>
							<option
								value="<?php 
                echo esc_attr($tpl['slug']);
                ?>
"
								<?php 
                if ('theme' == $slide_group->templateLocation && $slide_group->template == $tpl['slug']) {
                    ?>
								selected="selected"
								<?php 
                }
                ?>
								
							><?php 
                echo esc_html($tpl['name']);
                ?>
</option>
						<?php 
            }
            ?>
					</optgroup>
					<?php 
        }
        ?>
					
					<?php 
        $legacy = $t->discover_templates('legacy', false);
        ?>
					<?php 
        if (is_array($legacy) && count($legacy) > 0) {
            ?>
					<optgroup label="<?php 
            _e('v1.0 Templates', 'total-slider');
            ?>
">
						<?php 
            foreach ($legacy as $tpl) {
                ?>
							<option
							value="<?php 
                echo esc_attr($tpl['slug']);
                ?>
"
							<?php 
                if ('legacy' == $slide_group->templateLocation) {
                    ?>
								selected="selected"
								<?php 
                }
                ?>
							><?php 
                echo esc_html($tpl['name']);
                ?>
</option>
						<?php 
            }
            ?>
					</optgroup>								
					<?php 
        }
        ?>
										
			
					<?php 
        //$downloaded = $t->discover_templates('downloaded');
        ?>
					<?php 
        $downloaded = false;
        ?>
					<?php 
        if (is_array($downloaded) && count($downloaded) > 0) {
            ?>
					<!--<optgroup label="<?php 
            _e('Downloaded', 'total-slider');
            ?>
">
						<?php 
            foreach ($downloaded as $tpl) {
                ?>
							<option
								value="<?php 
                echo esc_attr($tpl['slug']);
                ?>
"
								<?php 
                if ('downloaded' == $slide_group->templateLocation && $slideGroup->template == $tpl['slug']) {
                    ?>
								selected="selected"
								<?php 
                }
                ?>
								
							><?php 
                echo esc_html($tpl['name']);
                ?>
</option>
						<?php 
            }
            ?>
																
					</optgroup>	-->
					<?php 
        }
        ?>
													
				</select>
			<input id="template-switch-button" type="submit" class="button-secondary action" style="margin-top:8px; max-width:180px;" value="<?php 
        _e('Change Template', 'total-slider');
        ?>
" />
			</p>
		</div><?php 
    }
コード例 #2
0
			<tr class="form-field form-required">
				<th scope="row"><label for="group-name"><?php 
_e('Group Name', 'total-slider');
?>
</label></th>
				<td><input name="group-name" type="text" id="group-name" value="" /></td>
			</tr>
			<tr class="form-field form-required">
				<th scope="row"><label for="template-slug"><?php 
_e('Template', 'total-slider');
?>
</label></th>
				<td>
					<?php 
$t = new Total_Slider_Template_Iterator();
?>
					<select name="template-slug" id="template-slug">
						
						<?php 
$builtin = $t->discover_templates('builtin');
?>
						<?php 
if (is_array($builtin) && count($builtin) > 0) {
    ?>
						<optgroup label="<?php 
    _e('Built-in', 'total-slider');
    ?>
">
							<?php 
    foreach ($builtin as $tpl) {
コード例 #3
0
ファイル: slides.php プロジェクト: rodrigo3965/total-slider
}
// determine and load template
if (!$TS_Total_Slider->template || !is_a($TS_Total_Slider->template, 'Total_Slider_Template')) {
    $TS_Total_Slider->determine_template();
}
if ('post' == strtolower($_SERVER['REQUEST_METHOD']) && array_key_exists('action', $_GET) && 'changeTemplate' == $_GET['action']) {
    // change the template and redirect
    if (!wp_verify_nonce($_POST['total-slider-change-template-nonce'], 'total-slider-change-template')) {
        die(__('Unable to confirm the form’s security.', 'total-slider'));
    }
    // update the new template
    $desired_tpl_slug = Total_Slider_Template::sanitize_slug($_POST['template-slug']);
    $tpl_location = false;
    $tpl_slug = false;
    // determine which template location this template is from
    $t = new Total_Slider_Template_Iterator();
    foreach (Total_Slider::$allowed_template_locations as $l) {
        if ($tpl_location || $tpl_slug) {
            break;
        }
        $choices = $t->discover_templates($l, false);
        // find the right template and set our provision template slug and location to it
        if (is_array($choices) && count($choices) > 0) {
            foreach ($choices as $c) {
                if ($desired_tpl_slug == $c['slug']) {
                    $tpl_location = $l;
                    $tpl_slug = $desired_tpl_slug;
                    break;
                }
            }
        }