Пример #1
0
function get_theme_field()
{
    echo "<div class='th'>Theme</div>\n\t\t\t  <select name='wordtour_settings[default_theme]'>\n\t\t\t\t<option value=''>--Select Theme--</option>";
    foreach (wt_get_themes() as $theme) {
        $theme_name = strtoupper($theme);
        if ($theme_name != "LIBRARY") {
            $selected_theme = $options["default_theme"] == $theme ? "selected='true'" : "";
            echo "<option {$selected_theme} value='{$theme}'>{$theme_name}</option>";
        }
    }
    echo "</select>";
}
Пример #2
0
     break;
     // GENERAL
 // GENERAL
 case "panel-state":
     if (isset($_POST["page"]) && isset($_POST["panels"])) {
         echo wordtour_update_panel_state($_POST["page"], $_POST["panels"]);
     }
     break;
 case "theme_path":
     global $_wt_options;
     if (isset($_POST["path"]) && !empty($_POST["path"])) {
         $path = trim($_POST["path"]);
         $full_path = realpath(ABSPATH . $path);
         if (is_dir($full_path)) {
             $theme_select_markup = "<select id='theme_default_name' name='wordtour_settings[default_theme]'>";
             foreach (wt_get_themes($full_path . "/") as $theme) {
                 $theme_name = strtoupper($theme);
                 if ($theme_name != "LIBRARY") {
                     $selected_theme = $options["default_theme"] == $theme ? "selected='true'" : "";
                     $theme_select_markup .= "<option {$selected_theme} value='{$theme}'>{$theme_name}</option>";
                 }
             }
             $theme_select_markup .= "</select>";
             $abspath = ABSPATH;
             if ($pos = strpos($full_path, '\\')) {
                 $abspath = preg_replace('/\\//', '\\', $abspath);
             }
             echo json_encode(array("success" => 1, "path" => str_replace($abspath, "", $full_path) . ($pos ? "\\" : "/"), "themes" => $theme_select_markup));
         } else {
             echo json_encode(array("error" => 1, "msg" => "Path '<i>{$full_path}</i>' doesnt exist"));
         }
Пример #3
0
function wordtour_settings_general_panel($collapsed = 0)
{
    global $_wt_options;
    $options = $_wt_options->options();
    wt_dynamic_panel_start(array("title" => "General", "id" => "wordtour-panel-general"), "general", $collapsed);
    ?>
	<div class="wordtour-field wordtour-field-block">
		<div class="label">Language</div>
		<div>
			<select>
				<option>English</option>	
			</select>
		</div>	
	</div>
	<div class="wordtour-field wordtour-field-block">
		<div class="label">User Premission</div>
		<div>
			<select name="wordtour_settings[user_role]">
				<option <?php 
    echo $options["user_role"] == "manage_options" ? "selected='true'" : "";
    ?>
 value="manage_options">Administrator</option>
				<option <?php 
    echo $options["user_role"] == "edit_pages" ? "selected='true'" : "";
    ?>
 value="edit_pages">Editor</option>
				<option <?php 
    echo $options["user_role"] == "edit_posts" ? "selected='true'" : "";
    ?>
 value="edit_posts">Author</option>
			</select>
		</div>	
	</div>
	
	
	
	<div class="wordtour-field wordtour-field-block">
		<div class="label">Theme Path</div>
		<div id="theme_path_error" style='color:red;display:none;'></div>
		<div>
			<?php 
    $theme_path = $options["theme_path"] ? $options["theme_path"] : WT_THEME_PATH;
    ?>
 
			<span  title='<?php 
    echo ABSPATH;
    ?>
'>your_wordpress_path<?php 
    echo ($pos = strpos(ABSPATH, '\\')) ? "\\" : "/";
    ?>
</span>
			<input style='width:70%' id='theme_path' type='text' name='wordtour_settings[theme_path]' readonly='true' value='<?php 
    echo $theme_path;
    ?>
'/>
			<input style='width:7%' id='theme_path_button' class='button' type='button' value='Edit'></input>
		</div>
	</div>
	
	<div class="wordtour-field wordtour-field-block">
		<div class="label">Theme Name</div>
		<div id="theme_default_wrap">
			<select  name='wordtour_settings[default_theme]'>
			<?php 
    $theme_select_markup = "<option value=''>--Select Theme--</option>";
    foreach (wt_get_themes() as $theme) {
        $theme_name = strtoupper($theme);
        if ($theme_name != "LIBRARY") {
            $selected_theme = $options["default_theme"] == $theme ? "selected='true'" : "";
            $theme_select_markup .= "<option {$selected_theme} value='{$theme}'>{$theme}</option>";
        }
    }
    echo $theme_select_markup;
    ?>
			</select>
			<p class="help">It is highly recommended to create a new theme, by duplicating the "default" theme folder. because each WordTour upgrade will overwrite "default" folder</p>	
		</div>	
	</div>		
<?php 
    wt_dynamic_panel_end();
}
Пример #4
0
    /** @see WP_Widget::form */
    function form($instance)
    {
        global $_wt_options;
        $title = esc_attr($instance['title']);
        $date = $instance['date_range'];
        $order = $instance['order'];
        $group_by = $instance['group_by'];
        $group_by_tour = $instance['group_by_tour'];
        $artists = $instance['artists'];
        $tour = $instance['tour'];
        $limit = $instance['limit'];
        ?>
        	<input type="hidden" id="<?php 
        echo $this->get_field_id('render_type');
        ?>
" name="<?php 
        echo $this->get_field_name('render_type');
        ?>
" type="text" value="widget" />
            <p>
            	<label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:');
        ?>
 
            	<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" />
            	</label>
            </p>
            <p>
            	<label>Type
            	<select class="widefat" id="<?php 
        echo $this->get_field_id('range');
        ?>
" name="<?php 
        echo $this->get_field_name('date_range');
        ?>
">
            		<option <?php 
        if ($date == "UPCOMING") {
            echo "selected='true'";
        }
        ?>
 value="UPCOMING">Upcoming</option>
            		<option <?php 
        if ($date == "TODAY") {
            echo "selected='true'";
        }
        ?>
 value="TODAY">TODAY</option>
            		<option <?php 
        if ($date == "ARCHIVE") {
            echo "selected='true'";
        }
        ?>
 value="ARCHIVE">ARCHIVE</option>
            	</select>
            	</label>
            </p>
            <p>
            	<label>Order By
            	<select class="widefat" id="<?php 
        echo $this->get_field_id('order');
        ?>
" name="<?php 
        echo $this->get_field_name('order');
        ?>
">
            		<option <?php 
        if ($date == "DESC") {
            echo "selected='true'";
        }
        ?>
 value="DESC">Descending</option>
            		<option <?php 
        if ($order == "ASC") {
            echo "selected='true'";
        }
        ?>
 value="ASC">Ascending</option>
            	</select>
            	</label>
            </p>
             <p>
            	<label>Limit
            	     <input class="widefat" id="<?php 
        echo $this->get_field_id('limit');
        ?>
" name="<?php 
        echo $this->get_field_name('limit');
        ?>
" type="text" value="<?php 
        echo $limit;
        ?>
" />
            	</label>
            </p>
            <p>
            	<label>Theme
            	<select class="widefat" id="<?php 
        echo $this->get_field_id('theme');
        ?>
" name="<?php 
        echo $this->get_field_name('theme');
        ?>
">
            		<?php 
        foreach (wt_get_themes() as $theme) {
            $selected_theme = $_wt_options->options("default_theme") == $theme ? "selected='true'" : "";
            echo "<option {$selected_theme} value='{$theme}'>" . strtoupper($theme) . "</option>";
        }
        ?>
            	</select>
            	</label>
            </p>
            
            
             
            <p>
            	<label>Group By Artist
            	<select class="widefat" id="<?php 
        echo $this->get_field_id('group_by');
        ?>
" name="<?php 
        echo $this->get_field_name('group_by');
        ?>
">
            		<option value="">NO</option>
            		<option <?php 
        if ($group_by == "ARTIST") {
            echo "selected='true'";
        }
        ?>
 value="ARTIST">YES</option>
            	</select>
            	</label>
            </p>
            <p>
            	<label>Group By Tour
            	<select class="widefat" id="<?php 
        echo $this->get_field_id('group_by_tour');
        ?>
" name="<?php 
        echo $this->get_field_name('group_by_tour');
        ?>
">
            		<option value="0">NO</option>
            		<option <?php 
        if ($group_by_tour == "1") {
            echo "selected='true'";
        }
        ?>
 value="1">YES</option>
            	</select>
            	</label>
            </p>
            <p>
            	<label>Include Artists
            	<input class="widefat" id="<?php 
        echo $this->get_field_id('artists');
        ?>
" name="<?php 
        echo $this->get_field_name('artists');
        ?>
" type="text" value="<?php 
        echo $artists;
        ?>
" />
            	<br/>
            	<small>Artists IDs, separated by commas.</small>
            	</label>
            </p>
            <p>
            	<label>Include Tour
            	<input class="widefat" id="<?php 
        echo $this->get_field_id('tour');
        ?>
" name="<?php 
        echo $this->get_field_name('tour');
        ?>
" type="text" value="<?php 
        echo $tour;
        ?>
" />
            	<br/>
            	<small>Tour IDs, separated by commas.</small>
            	</label>
            </p>            
        <?php 
    }