function form($instance)
    {
        if (isValidKey()) {
            $instance = wp_parse_args((array) $instance, array('title' => ''));
            $title = $instance['title'];
            $testimonial_categories = get_terms('easy-testimonial-category', 'orderby=title&hide_empty=0');
            ?>

				<p><label for="<?php 
            echo $this->get_field_id('title');
            ?>
">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 esc_attr($title);
            ?>
" /></label></p>
			<?php 
        } else {
            ?>

			<p><strong>Please Note:</strong><br/> This Feature Requires Easy Testimonials Pro.</p>
			<p><a href="https://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=submit_testimonials_widget&utm_campaign=up
				grade" target="_blank">Upgrade to Pro</a></p>
			<?php 
        }
    }
Пример #2
0
 function __construct()
 {
     $this->theme_array = $this->load_theme_array();
     $this->free_theme_array = $this->load_free_theme_array();
     $this->pro_theme_array = $this->load_pro_theme_array();
     $this->cycle_transitions = $this->load_cycle_transitions();
     $this->dir_path = plugin_dir_path(__FILE__);
     $this->url_path = plugin_dir_url(__FILE__);
     $this->is_pro = isValidKey();
     $this->do_export = isset($_POST['_easy_t_do_export']) && $_POST['_easy_t_do_export'] == '_easy_t_do_export' ? true : false;
     $this->cache_time = get_option('easy_t_cache_time', 900);
     //default to 15 minutes
     $this->cache_enabled = get_option('easy_t_cache_enabled', true);
     //default to true
     $this->typography_cache_key = $this->generate_typography_cache_key();
 }
    function form($instance)
    {
        // load config
        $curr_dir = dirname(dirname(__FILE__));
        $config_path = $curr_dir . "/lib/config.php";
        include $config_path;
        $defaults = array('title' => '', 'count' => 5, 'show_title' => 0, 'category' => '', 'use_excerpt' => 0, 'show_rating' => false, 'show_date' => false, 'width' => false, 'show_testimonial_image' => 1, 'order' => 'ASC', 'order_by' => 'date', 'show_other' => 0, 'theme' => '', 'testimonials_per_slide' => 1, 'show_pager_icons' => 1, 'transition' => 'fade', 'timer' => '5000', 'pause_on_hover' => 1, 'paused' => 0, 'prev_next' => 1, 'auto_height' => 1);
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = $instance['title'];
        $count = $instance['count'];
        $testimonials_per_slide = $instance['testimonials_per_slide'];
        $show_title = $instance['show_title'];
        $show_rating = $instance['show_rating'];
        $use_excerpt = $instance['use_excerpt'];
        $category = $instance['category'];
        $show_date = $instance['show_date'];
        $width = $instance['width'];
        $show_testimonial_image = $instance['show_testimonial_image'];
        $order = $instance['order'];
        $order_by = $instance['order_by'];
        $show_other = $instance['show_other'];
        $theme = $instance['theme'];
        $testimonial_categories = get_terms('easy-testimonial-category', 'orderby=title&hide_empty=0');
        $ip = isValidKey();
        $testimonials_per_slide = $instance['testimonials_per_slide'];
        $show_pager_icons = $instance['show_pager_icons'];
        $transition = $instance['transition'];
        $timer = $instance['timer'];
        $pause_on_hover = $instance['pause_on_hover'];
        $paused = $instance['paused'];
        $prev_next = $instance['prev_next'];
        $auto_height = $instance['auto_height'];
        ?>
		<div class="gp_widget_form_wrapper">
			<p>
				<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">Widget Title:</label>
				<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
			</p>
			
			<p>
				<label for="<?php 
        echo $this->get_field_id('theme');
        ?>
">Theme:</label><br/>
				<select name="<?php 
        echo $this->get_field_name('theme');
        ?>
" id="<?php 
        echo $this->get_field_id('theme');
        ?>
">	
					<optgroup label="Free Themes">
					<?php 
        foreach ($free_theme_array as $key => $theme_name) {
            ?>
						<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($theme == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
><?php 
            echo htmlentities($theme_name);
            ?>
</option>					
					<?php 
        }
        ?>
					</optgroup>
					<?php 
        foreach ($pro_theme_array as $group_key => $theme_group) {
            ?>
						<?php 
            $group_label = $this->get_theme_group_label($theme_group);
            ?>
							<?php 
            if (!$ip) {
                ?>
							<optgroup  disabled="disabled" label="<?php 
                echo htmlentities($group_label);
                ?>
 (Pro)">
							<?php 
            } else {
                ?>
							<optgroup  label="<?php 
                echo htmlentities($group_label);
                ?>
">
							<?php 
            }
            ?>
							<?php 
            foreach ($theme_group as $key => $theme_name) {
                ?>
								<?php 
                if (!$ip) {
                    ?>
								<option disabled="disabled" value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                } else {
                    ?>
								<option value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                }
                ?>
							<?php 
            }
            ?>
						</optgroup>
					<?php 
        }
        ?>
				</select>
				<?php 
        if (!$ip) {
            ?>
				<br />
				<em><a target="_blank" href="http://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=wp_widgets&utm_campaign=widget_themes">Upgrade To Unlock All 75+ Pro Themes!</a></em>
				<?php 
        }
        ?>
			</p>
			<p>
				<label for="<?php 
        echo $this->get_field_id('width');
        ?>
">Width: </label><br />
				<input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
" name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text" value="<?php 
        echo esc_attr($width);
        ?>
" /></label>
				<br/>
				<em>(e.g. 100px or 25%)</em>
			</p>
			
			<fieldset class="radio_text_input">
				<legend>Filter Testimonials:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('category');
        ?>
">Category:</label><br/>			
						<select name="<?php 
        echo $this->get_field_name('category');
        ?>
" id="<?php 
        echo $this->get_field_id('category');
        ?>
">
							<option value="">All Categories</option>
							<?php 
        foreach ($testimonial_categories as $cat) {
            ?>
							<option value="<?php 
            echo $cat->slug;
            ?>
" <?php 
            if ($category == $cat->slug) {
                ?>
selected="SELECTED"<?php 
            }
            ?>
><?php 
            echo htmlentities($cat->name);
            ?>
</option>
							<?php 
        }
        ?>
						</select>
						<br/>
						<em><a href="<?php 
        echo admin_url('edit-tags.php?taxonomy=easy-testimonial-category&post_type=testimonial');
        ?>
">Manage Categories</a></em>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('count');
        ?>
">Count:</label>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('count');
        ?>
" name="<?php 
        echo $this->get_field_name('count');
        ?>
" type="text" value="<?php 
        echo esc_attr($count);
        ?>
" /></label>
					</p>
					<p class="description"><em>The number of Testimonials to display.  Set to -1 to display All Testimonials.</em></p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('order');
        ?>
">Order:</label><br/>
						<select id="<?php 
        echo $this->get_field_id('order_by');
        ?>
" name="<?php 
        echo $this->get_field_name('order_by');
        ?>
" class="multi_left">
							<option value="title" <?php 
        if ($order_by == "title") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Title</option>
							<option value="rand" <?php 
        if ($order_by == "rand") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Random</option>
							<option value="id" <?php 
        if ($order_by == "id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>ID</option>
							<option value="author" <?php 
        if ($order_by == "author") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Author</option>
							<option value="name" <?php 
        if ($order_by == "name") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Name</option>
							<option value="date" <?php 
        if ($order_by == "date") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Date</option>
							<option value="last_modified" <?php 
        if ($order_by == "last_modified") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Last Modified</option>
							<option value="parent_id" <?php 
        if ($order_by == "parent_id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Parent ID</option>
						</select>
						<select id="<?php 
        echo $this->get_field_id('order');
        ?>
" name="<?php 
        echo $this->get_field_name('order');
        ?>
" class="multi_right">
							<option value="ASC" <?php 
        if ($order == "ASC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Ascending (ASC)</option>
							<option value="DESC" <?php 
        if ($order == "DESC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Descending (DESC)</option>
						</select>
					</p>
				</div>
			</fieldset>
			
			<fieldset class="radio_text_input">
				<legend>Fields To Display:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_title) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
">Show Testimonial Title</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
" name="<?php 
        echo $this->get_field_name('use_excerpt');
        ?>
" type="checkbox" value="1" <?php 
        if ($use_excerpt) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
">Use Testimonial Excerpt</label>
					</p>	
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
" name="<?php 
        echo $this->get_field_name('show_testimonial_image');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_testimonial_image) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
">Show Featured Image</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_date) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
">Show Testimonial Date</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_other');
        ?>
" name="<?php 
        echo $this->get_field_name('show_other');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_other) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_other');
        ?>
">Show "Location / Product Reviewed / Other" Field</label>
					</p>
				</div>
			</fieldset>
					
			<fieldset class="radio_text_input">
					<legend>Show Rating:</legend> &nbsp;
						<div class="bikeshed bikeshed_radio">
							<div class="radio_wrapper">
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="before" <?php 
        if ($show_rating == 'before') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Before Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="after" <?php 
        if ($show_rating == 'after') {
            ?>
checked="checked"<?php 
        }
        ?>
 > After Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="stars" <?php 
        if ($show_rating == 'stars') {
            ?>
checked="checked"<?php 
        }
        ?>
 > As Stars</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="" <?php 
        if ($show_rating == '') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Do Not Show</label></p>
							</div>
						</div>						
						<br />
						<span style="padding-left:0px" class="description"><em>Whether to show Ratings, and How.  If you are using a custom theme, make sure you follow the recommended settings here.</em></span>
					</p>
			</fieldset>
			
			<fieldset class="radio_text_input">
				<legend>Slideshow Options:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('testimonials_per_slide');
        ?>
">Testimonials Per Slide:</label>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('testimonials_per_slide');
        ?>
" name="<?php 
        echo $this->get_field_name('testimonials_per_slide');
        ?>
" type="text" value="<?php 
        echo esc_attr($testimonials_per_slide);
        ?>
" />				
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('transition');
        ?>
">Transition:</label><br/>
						<select name="<?php 
        echo $this->get_field_name('transition');
        ?>
" id="<?php 
        echo $this->get_field_id('transition');
        ?>
">	
							<optgroup label="Free Options">
							<?php 
        foreach ($cycle_transitions as $key => $transition_options) {
            ?>
								<?php 
            if ($transition_options['pro'] == true) {
                continue;
            }
            ?>
 
								<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($transition == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
><?php 
            echo htmlentities($transition_options['label']);
            ?>
</option>
							<?php 
        }
        ?>
							</optgroup>
							<?php 
        if ($ip) {
            ?>
							<optgroup label="Pro Options">
							<?php 
        } else {
            ?>
							<optgroup label="Pro Options (Upgrade To Unlock!)" disabled="disabled">
							<?php 
        }
        ?>
							<?php 
        foreach ($cycle_transitions as $key => $transition_options) {
            ?>
								<?php 
            if ($transition_options['pro'] == false) {
                continue;
            }
            ?>
 
								<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($transition == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
 <?php 
            if (!$ip) {
                echo 'disabled="disabled"';
            }
            ?>
><?php 
            echo htmlentities($transition_options['label']);
            ?>
</option>
							<?php 
        }
        ?>
							</optgroup>
						</select>
						<?php 
        if (!$ip) {
            ?>
						<br />
						<em><a target="_blank" href="http://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=wp_widgets&utm_campaign=widget_transitions">Upgrade To Unlock All Transitions!</a></em>
						<?php 
        }
        ?>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('timer');
        ?>
">Timer:</label>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('timer');
        ?>
" name="<?php 
        echo $this->get_field_name('timer');
        ?>
" type="text" value="<?php 
        echo esc_attr($timer);
        ?>
" />
					</p>
					<p class="description">The time between transitions.  Please Note: 1000 = 1 second.</p>
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('pause_on_hover');
        ?>
" name="<?php 
        echo $this->get_field_name('pause_on_hover');
        ?>
" type="checkbox" value="true" <?php 
        if ($pause_on_hover) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('pause_on_hover');
        ?>
">Pause on Hover</label>
					</p>
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('auto_height');
        ?>
" name="<?php 
        echo $this->get_field_name('auto_height');
        ?>
" type="checkbox" value="1" <?php 
        if ($auto_height) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('auto_height');
        ?>
">Auto Height</label>
						<br/>
					</p>	
					<p class="description after_checkbox"><em>If checked, the height of the slideshow will be adjusted to the height of each Testimonial.</em></p>
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_pager_icons');
        ?>
" name="<?php 
        echo $this->get_field_name('show_pager_icons');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_pager_icons) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_pager_icons');
        ?>
">Show Pager Icons</label>
					</p>	
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('prev_next');
        ?>
" name="<?php 
        echo $this->get_field_name('prev_next');
        ?>
" type="checkbox" value="1" <?php 
        if ($prev_next) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('prev_next');
        ?>
">Show Previous and Next Buttons</label>
					</p>
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('paused');
        ?>
" name="<?php 
        echo $this->get_field_name('paused');
        ?>
" type="checkbox" value="1" <?php 
        if ($paused) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('paused');
        ?>
">Disable Auto Transition</label>
					</p>	
					<p class="description after_checkbox"><em>If checked, Testimonials only Transition when manually triggered (ie, via Pager Icons or Previous/Next buttons)</em></p>
				</div>
			</fieldset>
			
		</div>
		<?php 
    }
Пример #4
0
    function form($instance)
    {
        // load config
        $curr_dir = dirname(dirname(__FILE__));
        $config_path = $curr_dir . "/lib/config.php";
        include $config_path;
        $defaults = array('title' => '', 'count' => 5, 'show_title' => 0, 'category' => '', 'use_excerpt' => 0, 'show_rating' => false, 'show_date' => false, 'width' => false, 'show_testimonial_image' => 0, 'order' => 'ASC', 'order_by' => 'date', 'show_other' => 0, 'theme' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = $instance['title'];
        $count = $instance['count'];
        $show_title = $instance['show_title'];
        $show_rating = $instance['show_rating'];
        $use_excerpt = $instance['use_excerpt'];
        $category = $instance['category'];
        $show_date = $instance['show_date'];
        $width = $instance['width'];
        $show_testimonial_image = $instance['show_testimonial_image'];
        $order = $instance['order'];
        $order_by = $instance['order_by'];
        $show_other = $instance['show_other'];
        $theme = $instance['theme'];
        $testimonial_categories = get_terms('easy-testimonial-category', 'orderby=title&hide_empty=0');
        $ip = isValidKey();
        ?>
		<div class="gp_widget_form_wrapper">
			<p>
				<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">Widget Title:</label>
				<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
			</p>			
		
			<p>
				<label for="<?php 
        echo $this->get_field_id('theme');
        ?>
">Theme:</label><br/>
				<select name="<?php 
        echo $this->get_field_name('theme');
        ?>
" id="<?php 
        echo $this->get_field_id('theme');
        ?>
">	
					<optgroup label="Free Themes">
					<?php 
        foreach ($free_theme_array as $key => $theme_name) {
            ?>
						<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($theme == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
><?php 
            echo htmlentities($theme_name);
            ?>
</option>					
					<?php 
        }
        ?>
					</optgroup>
					<?php 
        foreach ($pro_theme_array as $group_key => $theme_group) {
            ?>
						<?php 
            $group_label = $this->get_theme_group_label($theme_group);
            ?>
							<?php 
            if (!$ip) {
                ?>
							<optgroup  disabled="disabled" label="<?php 
                echo htmlentities($group_label);
                ?>
 (Pro)">
							<?php 
            } else {
                ?>
							<optgroup  label="<?php 
                echo htmlentities($group_label);
                ?>
">
							<?php 
            }
            ?>
							<?php 
            foreach ($theme_group as $key => $theme_name) {
                ?>
								<?php 
                if (!$ip) {
                    ?>
								<option disabled="disabled" value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                } else {
                    ?>
								<option value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                }
                ?>
							<?php 
            }
            ?>
						</optgroup>
					<?php 
        }
        ?>
				</select>
				<?php 
        if (!$ip) {
            ?>
				<br />
				<em><a target="_blank" href="http://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=wp_widgets&utm_campaign=widget_themes">Upgrade To Unlock All 75+ Pro Themes!</a></em>
				<?php 
        }
        ?>
			</p>
			
			<p>
				<label for="<?php 
        echo $this->get_field_id('width');
        ?>
">Width: </label><br />
				<input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
" name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text" value="<?php 
        echo esc_attr($width);
        ?>
" /></label>
				<br/>
				<em>(e.g. 100px or 25%)</em>
			</p>

			<fieldset class="radio_text_input">
				<legend>Filter Testimonials:</legend> &nbsp;
				<div class="bikeshed bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('category');
        ?>
">Category:</label><br/>			
						<select name="<?php 
        echo $this->get_field_name('category');
        ?>
" id="<?php 
        echo $this->get_field_id('category');
        ?>
">
							<option value="">All Categories</option>
							<?php 
        foreach ($testimonial_categories as $cat) {
            ?>
							<option value="<?php 
            echo $cat->slug;
            ?>
" <?php 
            if ($category == $cat->slug) {
                ?>
selected="SELECTED"<?php 
            }
            ?>
><?php 
            echo htmlentities($cat->name);
            ?>
</option>
							<?php 
        }
        ?>
						</select>
						<br/>
						<em><a href="<?php 
        echo admin_url('edit-tags.php?taxonomy=easy-testimonial-category&post_type=testimonial');
        ?>
">Manage Categories</a></em>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('count');
        ?>
">Count:</label>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('count');
        ?>
" name="<?php 
        echo $this->get_field_name('count');
        ?>
" type="text" value="<?php 
        echo esc_attr($count);
        ?>
" /></label>
						<br />
						<em>The number of Testimonials to display.  Set to -1 to display All Testimonials.</em>
					</p>
					
				</div>
			</fieldset>

		
			<fieldset class="radio_text_input">
				<legend>Fields To Display:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_title) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
">Show Testimonial Title</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
" name="<?php 
        echo $this->get_field_name('use_excerpt');
        ?>
" type="checkbox" value="1" <?php 
        if ($use_excerpt) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
">Use Testimonial Excerpt</label>
					</p>	
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
" name="<?php 
        echo $this->get_field_name('show_testimonial_image');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_testimonial_image) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
">Show Featured Image</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_date) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
">Show Testimonial Date</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_other');
        ?>
" name="<?php 
        echo $this->get_field_name('show_other');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_other) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_other');
        ?>
">Show "Location / Product Reviewed / Other" Field</label>
					</p>
				</div>
			</fieldset>

			<fieldset class="radio_text_input">
					<legend>Show Rating:</legend> &nbsp;
						<div class="bikeshed bikeshed_radio">
							<div class="radio_wrapper">
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="before" <?php 
        if ($show_rating == 'before') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Before Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="after" <?php 
        if ($show_rating == 'after') {
            ?>
checked="checked"<?php 
        }
        ?>
 > After Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="stars" <?php 
        if ($show_rating == 'stars') {
            ?>
checked="checked"<?php 
        }
        ?>
 > As Stars</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="" <?php 
        if ($show_rating == '') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Do Not Show</label></p>
							</div>
						</div>						
						<br />
						<span style="padding-left:0px" class="description">Whether to show Ratings, and How.  If you are using a custom theme, make sure you follow the recommended settings here.</span>
					</p>
			</fieldset>
		</div>
		<?php 
    }
Пример #5
0
//free and pro theme arrays are stored in config.php
include "lib/config.php";
//some functions for theme output
function get_theme_group_label($theme_group)
{
    reset($theme_group);
    $first_key = key($theme_group);
    $group_label = $theme_group[$first_key];
    if (($dash_pos = strpos($group_label, ' -')) !== FALSE && ($avatar_pos = strpos($group_label, 'Avatar')) === FALSE) {
        $group_label = substr($group_label, 0, $dash_pos);
    }
    return $group_label;
}
//check for pro
$ip = isValidKey();
//load currently selected theme
$theme = get_option('testimonials_style');
?>
		
		<form method="post" action="options.php"><?php 
if (!$ip) {
    ?>
			<p class="plugin_is_not_registered"><a href="https://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=themes"><?php 
    _e('Upgrade to Easy Testimonials Pro now', 'easy-testimonials');
    ?>
</a> <?php 
    _e('to unlock all 75+ themes!', 'easy-testimonials');
    ?>
 </p>
		<?php 
function easy_testimonials_build_typography_css($prefix, $extra = '')
{
    $css_rule_template = ' %s: %s;';
    $output = '';
    if (!isValidKey()) {
        return $output;
    }
    /*
     * Font Family
     */
    $option_val = get_option($prefix . 'font_family', '');
    if (!empty($option_val)) {
        // strip off 'google:' prefix if needed
        $option_val = str_replace('google:', '', $option_val);
        // wrap font family name in quotes
        $option_val = '\'' . $option_val . '\'';
        $output .= sprintf($css_rule_template, 'font-family', $option_val);
    }
    /*
     * Font Size
     */
    $option_val = get_option($prefix . 'font_size', '');
    if (!empty($option_val)) {
        // append 'px' if needed
        if (is_numeric($option_val)) {
            $option_val .= 'px';
        }
        $output .= sprintf($css_rule_template, 'font-size', $option_val);
    }
    /*
     * Font Style - add font-style and font-weight rules
     * NOTE: in this special case, we are adding 2 rules!
     */
    $option_val = get_option($prefix . 'font_style', '');
    // Convert the value to 2 CSS rules, font-style and font-weight
    // NOTE: we lowercase the value before comparison, for simplification
    switch (strtolower($option_val)) {
        case 'regular':
            // not bold not italic
            $output .= sprintf($css_rule_template, 'font-style', 'normal');
            $output .= sprintf($css_rule_template, 'font-weight', 'normal');
            break;
        case 'bold':
            // bold, but not italic
            $output .= sprintf($css_rule_template, 'font-style', 'normal');
            $output .= sprintf($css_rule_template, 'font-weight', 'bold');
            break;
        case 'italic':
            // italic, but not bold
            $output .= sprintf($css_rule_template, 'font-style', 'italic');
            $output .= sprintf($css_rule_template, 'font-weight', 'normal');
            break;
        case 'bold italic':
            // bold and italic
            $output .= sprintf($css_rule_template, 'font-style', 'italic');
            $output .= sprintf($css_rule_template, 'font-weight', 'bold');
            break;
        default:
            // empty string or other invalid value, ignore and move on
            break;
    }
    /*
     * Font Color
     * RWG: Moved this after other options so that, for Stars display 
     *      we can empty $output and start over with just the font color
     *      preventing the user from accidentally doing crazy things with their stars
     */
    //RWG: if this is the Rating and extra is set to Stars, only apply the chosen color (ie, wipe out the output string and start anew -- this prevents the user from accidentally breaking their stars display)
    if ($prefix == "easy_t_rating_" && $extra == "stars") {
        $output = "";
    }
    $option_val = get_option($prefix . 'font_color', '');
    if (!empty($option_val)) {
        $output .= sprintf($css_rule_template, 'color', $option_val);
    }
    // return the completed CSS string
    return trim($output);
}
    function form($instance)
    {
        // load config
        $curr_dir = dirname(dirname(__FILE__));
        $config_path = $curr_dir . "/lib/config.php";
        include $config_path;
        $defaults = array('title' => '', 'count' => 10, 'show_title' => 0, 'category' => '', 'use_excerpt' => 0, 'show_rating' => false, 'show_date' => false, 'cols' => 3, 'show_testimonial_image' => 0, 'order' => 'ASC', 'order_by' => 'date', 'show_other' => 0, 'theme' => '');
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = $instance['title'];
        $count = $instance['count'];
        $show_title = $instance['show_title'];
        $show_rating = $instance['show_rating'];
        $use_excerpt = $instance['use_excerpt'];
        $category = $instance['category'];
        $show_date = isset($instance['show_date']) ? $instance['show_date'] : 1;
        $show_testimonial_image = isset($instance['show_testimonial_image']) ? $instance['show_testimonial_image'] : 1;
        $order = $instance['order'];
        $order_by = $instance['order_by'];
        $show_other = isset($instance['show_other']) ? $instance['show_other'] : 0;
        $theme = $instance['theme'];
        $testimonial_categories = get_terms('easy-testimonial-category', 'orderby=title&hide_empty=0');
        $cols = $instance['cols'];
        $grid_width = isset($instance['grid_width']) ? $instance['grid_width'] : '';
        $grid_spacing = isset($instance['grid_spacing']) ? $instance['grid_spacing'] : '';
        $grid_class = isset($instance['grid_class']) ? $instance['grid_class'] : '';
        $cell_width = isset($instance['cell_width']) ? $instance['cell_width'] : '';
        $responsive = isset($instance['responsive']) ? $instance['responsive'] : 1;
        $equal_height_rows = isset($instance['equal_height_rows']) ? $instance['equal_height_rows'] : 0;
        $ip = isValidKey();
        ?>

		<div class="gp_widget_form_wrapper">
			<p>
				<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">Widget Title:</label>
				<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" />
			</p>			
		
			<p>
				<label for="<?php 
        echo $this->get_field_id('theme');
        ?>
">Theme:</label><br/>
				<select name="<?php 
        echo $this->get_field_name('theme');
        ?>
" id="<?php 
        echo $this->get_field_id('theme');
        ?>
">	
					<optgroup label="Free Themes">
					<?php 
        foreach ($free_theme_array as $key => $theme_name) {
            ?>

						<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($theme == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
><?php 
            echo htmlentities($theme_name);
            ?>
</option>					
					<?php 
        }
        ?>

					</optgroup>
					<?php 
        foreach ($pro_theme_array as $group_key => $theme_group) {
            ?>

						<?php 
            $group_label = $this->get_theme_group_label($theme_group);
            ?>

							<?php 
            if (!$ip) {
                ?>

							<optgroup  disabled="disabled" label="<?php 
                echo htmlentities($group_label);
                ?>
 (Pro)">
							<?php 
            } else {
                ?>

							<optgroup  label="<?php 
                echo htmlentities($group_label);
                ?>
">
							<?php 
            }
            ?>

							<?php 
            foreach ($theme_group as $key => $theme_name) {
                ?>

								<?php 
                if (!$ip) {
                    ?>

								<option disabled="disabled" value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                } else {
                    ?>

								<option value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                }
                ?>

							<?php 
            }
            ?>

						</optgroup>
					<?php 
        }
        ?>

				</select>
				<?php 
        if (!$ip) {
            ?>

				<br />
				<em><a target="_blank" href="http://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=wp_widgets&utm_campaign=widget_themes">Upgrade To Unlock All 75+ Pro Themes!</a></em>
				<?php 
        }
        ?>

			</p>
			
			<p>
				<label for="<?php 
        echo $this->get_field_id('cols');
        ?>
">Number Of Columns: </label><br />				
				<select class="widefat" id="<?php 
        echo $this->get_field_id('cols');
        ?>
" name="<?php 
        echo $this->get_field_name('cols');
        ?>
">
				<?php 
        foreach (range(1, 10) as $iCol) {
            ?>

					<?php 
            $sel_attr = $cols == $iCol ? 'selected="selected"' : '';
            ?>

					<?php 
            printf('<option value="%d" %s>%d</option>', $iCol, $sel_attr, $iCol);
            ?>

				<?php 
        }
        ?>

				</select>
				<br/>
			</p>

			<fieldset class="radio_text_input">
				<legend>Advanced Options</legend> &nbsp;
				<div class="bikeshed bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('grid_width');
        ?>
">Width of the Grid: </label><br />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('grid_width');
        ?>
" name="<?php 
        echo $this->get_field_name('grid_width');
        ?>
" type="text" value="<?php 
        echo esc_attr($grid_width);
        ?>
" /></label>
						<br/>
						<em>e.g. 100px or 25%. Leave blank to use the default width.</em>
					</p>

					<p>
						<label for="<?php 
        echo $this->get_field_id('cell_width');
        ?>
">Width of Each Cell: </label><br />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('cell_width');
        ?>
" name="<?php 
        echo $this->get_field_name('cell_width');
        ?>
" type="text" value="<?php 
        echo esc_attr($cell_width);
        ?>
" /></label>
						<br/>
						<em>e.g. 100px or 25%. Leave blank to use the default width.</em>
					</p>
				
					<p>
						<label for="<?php 
        echo $this->get_field_id('grid_spacing');
        ?>
">Spacing between each cell:</label><br />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('grid_spacing');
        ?>
" name="<?php 
        echo $this->get_field_name('grid_spacing');
        ?>
" type="text" value="<?php 
        echo esc_attr($grid_spacing);
        ?>
" /></label>
						<br/>
						<em>e.g. 100px or 25%. Leave blank to use the default spacing.</em>
					</p>


					<p>
						<label for="<?php 
        echo $this->get_field_id('grid_class');
        ?>
">CSS classes: </label><br />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('grid_class');
        ?>
" name="<?php 
        echo $this->get_field_name('grid_class');
        ?>
" type="text" value="<?php 
        echo esc_attr($grid_class);
        ?>
" /></label>
						<br/>
						<em>Extra CSS classes to be applied to this grid.</em>
					</p>

					<p>
						<input name="<?php 
        echo $this->get_field_name('responsive');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('responsive');
        ?>
" name="<?php 
        echo $this->get_field_name('responsive');
        ?>
" type="checkbox" value="1" <?php 
        if ($responsive) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('responsive');
        ?>
">Responsive</label>
					</p>

					<p>
						<input name="<?php 
        echo $this->get_field_name('equal_height_rows');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('equal_height_rows');
        ?>
" name="<?php 
        echo $this->get_field_name('equal_height_rows');
        ?>
" type="checkbox" value="1" <?php 
        if ($equal_height_rows) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('equal_height_rows');
        ?>
">Make testimonials in each row the same height</label>
					</p>
				</div>
			</fieldset>
			
			<fieldset class="radio_text_input">
				<legend>Filter Testimonials:</legend> &nbsp;
				<div class="bikeshed bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('category');
        ?>
">Category:</label><br/>			
						<select name="<?php 
        echo $this->get_field_name('category');
        ?>
" id="<?php 
        echo $this->get_field_id('category');
        ?>
">
							<option value="">All Categories</option>
							<?php 
        foreach ($testimonial_categories as $cat) {
            ?>

							<option value="<?php 
            echo $cat->slug;
            ?>
" <?php 
            if ($category == $cat->slug) {
                ?>
selected="SELECTED"<?php 
            }
            ?>
><?php 
            echo htmlentities($cat->name);
            ?>
</option>
							<?php 
        }
        ?>

						</select>
						<br/>
						<em><a href="<?php 
        echo admin_url('edit-tags.php?taxonomy=easy-testimonial-category&post_type=testimonial');
        ?>
">Manage Categories</a></em>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('count');
        ?>
">Count:</label>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('count');
        ?>
" name="<?php 
        echo $this->get_field_name('count');
        ?>
" type="text" value="<?php 
        echo esc_attr($count);
        ?>
" /></label>
						<br />
						<em>The number of Testimonials to display. Leave blank to display all of your Testimonials.</em>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('order');
        ?>
">Order:</label><br/>
						<select id="<?php 
        echo $this->get_field_id('order_by');
        ?>
" name="<?php 
        echo $this->get_field_name('order_by');
        ?>
" class="multi_left">
							<option value="title" <?php 
        if ($order_by == "title") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Title</option>
							<option value="rand" <?php 
        if ($order_by == "rand") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Random</option>
							<option value="id" <?php 
        if ($order_by == "id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>ID</option>
							<option value="author" <?php 
        if ($order_by == "author") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Author</option>
							<option value="name" <?php 
        if ($order_by == "name") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Name</option>
							<option value="date" <?php 
        if ($order_by == "date") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Date</option>
							<option value="last_modified" <?php 
        if ($order_by == "last_modified") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Last Modified</option>
							<option value="parent_id" <?php 
        if ($order_by == "parent_id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Parent ID</option>
						</select>
						<select id="<?php 
        echo $this->get_field_id('order');
        ?>
" name="<?php 
        echo $this->get_field_name('order');
        ?>
" class="multi_right">
							<option value="ASC" <?php 
        if ($order == "ASC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Ascending (ASC)</option>
							<option value="DESC" <?php 
        if ($order == "DESC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Descending (DESC)</option>
						</select>
					</p>
				</div>
			</fieldset>

		
			<fieldset class="radio_text_input">
				<legend>Fields To Display:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<input name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_title) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
">Show Testimonial Title</label>
					</p>
					
					<p>
						<input name="<?php 
        echo $this->get_field_name('use_excerpt');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
" name="<?php 
        echo $this->get_field_name('use_excerpt');
        ?>
" type="checkbox" value="1" <?php 
        if ($use_excerpt) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
">Use Testimonial Excerpt</label>
					</p>	
					
					<p>
						<input name="<?php 
        echo $this->get_field_name('show_testimonial_image');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
" name="<?php 
        echo $this->get_field_name('show_testimonial_image');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_testimonial_image) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
">Show Featured Image</label>
					</p>
					
					<p>
						<input name="<?php 
        echo $this->get_field_name('show_date');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_date) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
">Show Testimonial Date</label>
					</p>
					
					<p>
						<input name="<?php 
        echo $this->get_field_name('show_other');
        ?>
" type="hidden" value="0" />
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_other');
        ?>
" name="<?php 
        echo $this->get_field_name('show_other');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_other) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_other');
        ?>
">Show "Location / Product Reviewed / Other" Field</label>
					</p>
				</div>
			</fieldset>

			<fieldset class="radio_text_input">
					<legend>Show Rating:</legend> &nbsp;
						<div class="bikeshed bikeshed_radio">
							<div class="radio_wrapper">
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="before" <?php 
        if ($show_rating == 'before') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Before Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="after" <?php 
        if ($show_rating == 'after') {
            ?>
checked="checked"<?php 
        }
        ?>
 > After Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="stars" <?php 
        if ($show_rating == 'stars') {
            ?>
checked="checked"<?php 
        }
        ?>
 > As Stars</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="" <?php 
        if ($show_rating == '') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Do Not Show</label></p>
							</div>
						</div>						
						<br />
						<span style="padding-left:0px" class="description">Whether to show Ratings, and How.  If you are using a custom theme, make sure you follow the recommended settings here.</span>
					</p>
			</fieldset>
		</div>
		<?php 
    }
Пример #8
0
    }
    ?>
	value="<?php 
    echo $slug;
    ?>
" <?php 
    if (get_option('testimonials_style') == $slug) {
        echo 'checked="CHECKED"';
    }
    ?>
><label for="<?php 
    echo $slug;
    ?>
"><?php 
    echo $name;
    if (!isValidKey()) {
        ?>
<br/><em>Requires PRO - Upgrade to Enable!</em><?php 
    }
    ?>
<br/><img src="<?php 
    echo plugins_url('img/easy-t-' . str_replace('_', '-', str_replace('_style', '', $slug)) . '.png', __FILE__);
    ?>
"/></label></p>
					<?php 
}
?>
					<div style="clear:both;"></div>
				</td>
			</tr>
		</table>
 function typography_input($name, $label, $description)
 {
     global $EasyT_BikeShed;
     $options = array();
     $options['name'] = $name;
     $options['label'] = $label;
     $options['description'] = $description;
     $options['google_fonts'] = true;
     $options['default_color'] = '#008800';
     $options['values'] = $this->get_typography_values($name);
     $options['disabled'] = !isValidKey();
     // typography inputs are Pro only
     $EasyT_BikeShed->typography($options);
 }
Пример #10
0
function easy_testimonials_build_typography_css($prefix)
{
    $css_rule_template = ' %s: %s;';
    $output = '';
    if (!isValidKey()) {
        return $output;
    }
    /*
     * Font Family
     */
    $option_val = get_option($prefix . 'font_family', '');
    if (!empty($option_val)) {
        // strip off 'google:' prefix if needed
        $option_val = str_replace('google:', '', $option_val);
        // wrap font family name in quotes
        $option_val = '\'' . $option_val . '\'';
        $output .= sprintf($css_rule_template, 'font-family', $option_val);
    }
    /*
     * Font Size
     */
    $option_val = get_option($prefix . 'font_size', '');
    if (!empty($option_val)) {
        // append 'px' if needed
        if (is_numeric($option_val)) {
            $option_val .= 'px';
        }
        $output .= sprintf($css_rule_template, 'font-size', $option_val);
    }
    /*
     * Font Color
     */
    $option_val = get_option($prefix . 'font_color', '');
    if (!empty($option_val)) {
        $output .= sprintf($css_rule_template, 'color', $option_val);
    }
    /*
     * Font Style - add font-style and font-weight rules
     * NOTE: in this special case, we are adding 2 rules!
     */
    $option_val = get_option($prefix . 'font_style', '');
    // Convert the value to 2 CSS rules, font-style and font-weight
    // NOTE: we lowercase the value before comparison, for simplification
    switch (strtolower($option_val)) {
        case 'regular':
            // not bold not italic
            $output .= sprintf($css_rule_template, 'font-style', 'normal');
            $output .= sprintf($css_rule_template, 'font-weight', 'normal');
            break;
        case 'bold':
            // bold, but not italic
            $output .= sprintf($css_rule_template, 'font-style', 'normal');
            $output .= sprintf($css_rule_template, 'font-weight', 'bold');
            break;
        case 'italic':
            // italic, but not bold
            $output .= sprintf($css_rule_template, 'font-style', 'italic');
            $output .= sprintf($css_rule_template, 'font-weight', 'normal');
            break;
        case 'bold italic':
            // bold and italic
            $output .= sprintf($css_rule_template, 'font-style', 'italic');
            $output .= sprintf($css_rule_template, 'font-weight', 'bold');
            break;
        default:
            // empty string or other invalid value, ignore and move on
            break;
    }
    // return the completed CSS string
    return trim($output);
}
    function form($instance)
    {
        // load config
        $curr_dir = dirname(dirname(__FILE__));
        $config_path = $curr_dir . "/lib/config.php";
        include $config_path;
        $defaults = array('title' => '', 'count' => 5, 'show_title' => 0, 'category' => '', 'use_excerpt' => 0, 'show_rating' => false, 'show_date' => false, 'width' => false, 'show_testimonial_image' => 0, 'order' => 'ASC', 'order_by' => 'date', 'show_other' => 0, 'theme' => get_option('testimonials_style', 'default_style'), 'paginate' => false, 'testimonials_per_page' => 10);
        $instance = wp_parse_args((array) $instance, $defaults);
        $title = $instance['title'];
        $count = $instance['count'];
        $show_title = $instance['show_title'];
        $show_rating = $instance['show_rating'];
        $use_excerpt = $instance['use_excerpt'];
        $category = $instance['category'];
        $show_date = $instance['show_date'];
        $width = $instance['width'];
        $show_testimonial_image = $instance['show_testimonial_image'];
        $order = $instance['order'];
        $order_by = $instance['order_by'];
        $show_other = $instance['show_other'];
        $theme = $instance['theme'];
        $paginate = $instance['paginate'];
        $testimonials_per_page = $instance['testimonials_per_page'];
        $testimonial_categories = get_terms('easy-testimonial-category', 'orderby=title&hide_empty=0');
        $ip = isValidKey();
        ?>
		<div class="gp_widget_form_wrapper">
			<p class="hide_in_popup">
				<label for="<?php 
        echo $this->get_field_id('title');
        ?>
">Widget Title:</label>
				<input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo esc_attr($title);
        ?>
" data-shortcode-hidden="1" />
			</p>			
		
			<p>
				<label for="<?php 
        echo $this->get_field_id('theme');
        ?>
">Theme:</label><br/>
				<select name="<?php 
        echo $this->get_field_name('theme');
        ?>
" id="<?php 
        echo $this->get_field_id('theme');
        ?>
">	
					<optgroup label="Free Themes">
					<?php 
        foreach ($free_theme_array as $key => $theme_name) {
            ?>
						<option value="<?php 
            echo $key;
            ?>
" <?php 
            if ($theme == $key) {
                echo 'selected="SELECTED"';
            }
            ?>
><?php 
            echo htmlentities($theme_name);
            ?>
</option>					
					<?php 
        }
        ?>
					</optgroup>
					<?php 
        foreach ($pro_theme_array as $group_key => $theme_group) {
            ?>
						<?php 
            $group_label = $this->get_theme_group_label($theme_group);
            ?>
							<?php 
            if (!$ip) {
                ?>
							<optgroup  disabled="disabled" label="<?php 
                echo htmlentities($group_label);
                ?>
 (Pro)">
							<?php 
            } else {
                ?>
							<optgroup  label="<?php 
                echo htmlentities($group_label);
                ?>
">
							<?php 
            }
            ?>
							<?php 
            foreach ($theme_group as $key => $theme_name) {
                ?>
								<?php 
                if (!$ip) {
                    ?>
								<option disabled="disabled" value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                } else {
                    ?>
								<option value="<?php 
                    echo $key;
                    ?>
" <?php 
                    if ($theme == $key) {
                        echo 'selected="SELECTED"';
                    }
                    ?>
><?php 
                    echo htmlentities($theme_name);
                    ?>
</option>
								<?php 
                }
                ?>
							<?php 
            }
            ?>
						</optgroup>
					<?php 
        }
        ?>
				</select>
				<?php 
        if (!$ip) {
            ?>
				<br />
				<em><a target="_blank" href="http://goldplugins.com/our-plugins/easy-testimonials-details/upgrade-to-easy-testimonials-pro/?utm_source=wp_widgets&utm_campaign=widget_themes">Upgrade To Unlock All 75+ Pro Themes!</a></em>
				<?php 
        }
        ?>
			</p>
			
			<p>
				<label for="<?php 
        echo $this->get_field_id('width');
        ?>
">Width: </label><br />
				<input class="widefat" id="<?php 
        echo $this->get_field_id('width');
        ?>
" name="<?php 
        echo $this->get_field_name('width');
        ?>
" type="text" value="<?php 
        echo esc_attr($width);
        ?>
" /></label>
				<br/>
				<em>(e.g. 100px or 25%)</em>
			</p>

			<fieldset class="radio_text_input">
				<legend>Testimonials Per Page</legend> &nbsp;
				<div class="bikeshed bikeshed_radio">
					<p>
						<label>
							<input type="radio" name="<?php 
        echo $this->get_field_name('paginate');
        ?>
" value="all" class="tog" <?php 
        echo $paginate == 'all' ? 'checked="checked"' : '';
        ?>
>All On One Page
						</label>
						<br/>
						<em>No pagination links will be displayed and all testimonials will be shown.</em>
					</p>
					<p>
						<label>
							<input type="radio" name="<?php 
        echo $this->get_field_name('paginate');
        ?>
" value="max" class="tog" <?php 
        echo $paginate == 'max' ? 'checked="checked"' : '';
        ?>
>Max Per Page: 
						</label>
						<input type="text" name="<?php 
        echo $this->get_field_name('testimonials_per_page');
        ?>
" id="<?php 
        echo $this->get_field_id('testimonials_per_page');
        ?>
" class="small-text" value="<?php 
        echo esc_attr($testimonials_per_page);
        ?>
">
						<br/>
						<em>Pagination links will be displayed with this many testimonials shown per page.</em>
					</p>
					<p>
						<label>
							<input type="radio" name="<?php 
        echo $this->get_field_name('paginate');
        ?>
" value="0" class="tog" <?php 
        echo $paginate == false ? 'checked="checked"' : '';
        ?>
>Specific Amount: 
						</label>
						<input type="text" name="<?php 
        echo $this->get_field_name('count');
        ?>
" id="<?php 
        echo $this->get_field_id('count');
        ?>
" class="small-text" value="<?php 
        echo esc_attr($count);
        ?>
">
						<br/>
						<em>No pagination links will be displayed and we will try to load exactly this many testimonials.</em>
					</p>
				</div>
			</fieldset>
			
			<fieldset class="radio_text_input">
				<legend>Filter Testimonials:</legend> &nbsp;
				<div class="bikeshed bikeshed_radio">
					<p>
						<label for="<?php 
        echo $this->get_field_id('category');
        ?>
">Category:</label><br/>			
						<select name="<?php 
        echo $this->get_field_name('category');
        ?>
" id="<?php 
        echo $this->get_field_id('category');
        ?>
">
							<option value="">All Categories</option>
							<?php 
        foreach ($testimonial_categories as $cat) {
            ?>
							<option value="<?php 
            echo $cat->slug;
            ?>
" <?php 
            if ($category == $cat->slug) {
                ?>
selected="SELECTED"<?php 
            }
            ?>
><?php 
            echo htmlentities($cat->name);
            ?>
</option>
							<?php 
        }
        ?>
						</select>
						<br/>
						<em><a href="<?php 
        echo admin_url('edit-tags.php?taxonomy=easy-testimonial-category&post_type=testimonial');
        ?>
">Manage Categories</a></em>
					</p>
					
					<p>
						<label for="<?php 
        echo $this->get_field_id('order');
        ?>
">Order:</label><br/>
						<select id="<?php 
        echo $this->get_field_id('order_by');
        ?>
" name="<?php 
        echo $this->get_field_name('order_by');
        ?>
" class="multi_left" data-shortcode-key="orderby">
							<option value="title" <?php 
        if ($order_by == "title") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Title</option>
							<option value="rand" <?php 
        if ($order_by == "rand") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Random</option>
							<option value="id" <?php 
        if ($order_by == "id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>ID</option>
							<option value="author" <?php 
        if ($order_by == "author") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Author</option>
							<option value="name" <?php 
        if ($order_by == "name") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Name</option>
							<option value="date" <?php 
        if ($order_by == "date") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Date</option>
							<option value="last_modified" <?php 
        if ($order_by == "last_modified") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Last Modified</option>
							<option value="parent_id" <?php 
        if ($order_by == "parent_id") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Parent ID</option>
						</select>
						<select id="<?php 
        echo $this->get_field_id('order');
        ?>
" name="<?php 
        echo $this->get_field_name('order');
        ?>
" class="multi_right">
							<option value="ASC" <?php 
        if ($order == "ASC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Ascending (ASC)</option>
							<option value="DESC" <?php 
        if ($order == "DESC") {
            ?>
selected="SELECTED"<?php 
        }
        ?>
>Descending (DESC)</option>
						</select>
					</p>
				</div>
			</fieldset>

		
			<fieldset class="radio_text_input">
				<legend>Fields To Display:</legend> &nbsp;
				<div class="bikeshed_radio">
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_title');
        ?>
" name="<?php 
        echo $this->get_field_name('show_title');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_title) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_title');
        ?>
">Show Testimonial Title</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
" name="<?php 
        echo $this->get_field_name('use_excerpt');
        ?>
" type="checkbox" value="1" <?php 
        if ($use_excerpt) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('use_excerpt');
        ?>
">Use Testimonial Excerpt</label>
					</p>	
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
" name="<?php 
        echo $this->get_field_name('show_testimonial_image');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_testimonial_image) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
 data-shortcode-key="show_thumbs" />
						<label for="<?php 
        echo $this->get_field_id('show_testimonial_image');
        ?>
">Show Featured Image</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_date');
        ?>
" name="<?php 
        echo $this->get_field_name('show_date');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_date) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_date');
        ?>
">Show Testimonial Date</label>
					</p>
					
					<p>
						<input class="widefat" id="<?php 
        echo $this->get_field_id('show_other');
        ?>
" name="<?php 
        echo $this->get_field_name('show_other');
        ?>
" type="checkbox" value="1" <?php 
        if ($show_other) {
            ?>
checked="CHECKED"<?php 
        }
        ?>
/>
						<label for="<?php 
        echo $this->get_field_id('show_other');
        ?>
">Show "Location / Product Reviewed / Other" Field</label>
					</p>
				</div>
			</fieldset>

			<fieldset class="radio_text_input">
					<legend>Show Rating:</legend> &nbsp;
						<div class="bikeshed bikeshed_radio">
							<div class="radio_wrapper">
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="before" <?php 
        if ($show_rating == 'before') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Before Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="after" <?php 
        if ($show_rating == 'after') {
            ?>
checked="checked"<?php 
        }
        ?>
 > After Testimonial</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="stars" <?php 
        if ($show_rating == 'stars') {
            ?>
checked="checked"<?php 
        }
        ?>
 > As Stars</label></p>
								<p class="radio_option"><label><input class="tog" name="<?php 
        echo $this->get_field_name('show_rating');
        ?>
" type="radio" value="" <?php 
        if ($show_rating == '') {
            ?>
checked="checked"<?php 
        }
        ?>
 > Do Not Show</label></p>
							</div>
						</div>						
						<br />
						<span style="padding-left:0px" class="description">Whether to show Ratings, and How.  If you are using a custom theme, make sure you follow the recommended settings here.</span>
					</p>
			</fieldset>
		</div>
		<?php 
    }