/**
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public static function get_testimonials_options($atts = null)
 {
     $sections = Testimonials_Widget_Settings::get_sections();
     $settings = Testimonials_Widget_Settings::get_settings();
     $ignored_types = array('expand_begin', 'expand_end', 'expand_all', 'content');
     $do_continue = false;
     $do_used_with = false;
     $first_dl = true;
     $open_dl = false;
     $html = '';
     foreach ($settings as $setting => $parts) {
         if (in_array($parts['type'], $ignored_types)) {
             continue;
         }
         if (empty($parts['show_code'])) {
             continue;
         }
         // section header
         if (!empty($sections[$parts['section']])) {
             if (!$first_dl) {
                 $html .= '</dl>';
                 $open_dl = false;
             }
             $html .= '<h2>' . $sections[$parts['section']] . '</h2>';
             unset($sections[$parts['section']]);
             $do_used_with = true;
         }
         if ('heading' == $parts['type']) {
             if ($open_dl) {
                 $html .= '</dl>';
                 $open_dl = false;
             }
             $html .= '<h2>' . $parts['desc'] . '</h2>';
             $do_continue = true;
             $do_used_with = true;
         }
         if ($do_used_with) {
             $used_with_codes = self::get_used_with_codes($parts);
             if (!empty($used_with_codes)) {
                 $used_with_codes = implode('</code>, <code>', $used_with_codes);
                 $html .= '<p>' . esc_html__('Used with: ', 'testimonials-widget');
                 $html .= '<code>' . $used_with_codes . '</code>';
                 $html .= '</p>';
             }
             $do_used_with = false;
         }
         if ($do_continue) {
             $do_continue = false;
             continue;
         }
         if (empty($open_dl)) {
             $html .= '<dl>';
             $first_dl = false;
             $open_dl = true;
         }
         // option name
         $html .= '<dt>' . $parts['title'] . '</dt>';
         // description
         if (!empty($parts['desc'])) {
             $html .= '<dd>' . $parts['desc'] . '</dd>';
         }
         // validation helpers
         $validate = self::define_options_validate($parts);
         if (!empty($validate)) {
             $html .= '<dd>' . $validate . '</dd>';
         }
         $choices = self::define_options_choices($parts);
         if (!empty($choices)) {
             $html .= '<dd>' . esc_html__('Options: ', 'testimonials-widget') . '<code>' . $choices . '</code></dd>';
         }
         $value = self::define_options_value($setting, $parts);
         if (!empty($value)) {
             $html .= '<dd>' . esc_html__('Usage: ', 'testimonials-widget') . '<code>' . $setting . '="' . $value . '"</code></dd>';
         }
     }
     // remaining widgets
     $widgets = array('Testimonials_Widget_Archives_Widget' => 'testimonials_archives', 'Testimonials_Widget_Categories_Widget' => 'testimonials_categories', 'Testimonials_Widget_Recent_Testimonials_Widget' => 'testimonials_recent', 'Testimonials_Widget_Tag_Cloud_Widget' => 'testimonials_tag_cloud');
     $widgets = apply_filters('tw_options_widgets', $widgets);
     foreach ($widgets as $widget => $shortcode) {
         $form_parts = $widget::form_parts();
         // section header
         $html .= '</dl>';
         $html .= '<h2>' . $widget::$title . '</h2>';
         $used_with_codes = array('[' . $shortcode . ']', '' . $shortcode . '()');
         $used_with_codes = apply_filters('tw_used_with_codes_widgets', $used_with_codes, $widget, $shortcode);
         if (!empty($used_with_codes)) {
             $used_with_codes = implode('</code>, <code>', $used_with_codes);
             $html .= '<p>' . esc_html__('Used with: ', 'testimonials-widget');
             $html .= '<code>' . $used_with_codes . '</code>';
             $html .= '</p>';
         }
         $html .= '<dl>';
         foreach ($form_parts as $setting => $parts) {
             if (in_array($parts['type'], $ignored_types)) {
                 continue;
             }
             // option name
             $html .= '<dt>' . $parts['title'] . '</dt>';
             // description
             if (!empty($parts['desc'])) {
                 $html .= '<dd>' . $parts['desc'] . '</dd>';
             }
             // validation helpers
             $validate = self::define_options_validate($parts);
             if (!empty($validate)) {
                 $html .= '<dd>' . $validate . '</dd>';
             }
             $choices = self::define_options_choices($parts);
             if (!empty($choices)) {
                 $html .= '<dd>' . esc_html__('Options: ', 'testimonials-widget') . '<code>' . $choices . '</code></dd>';
             }
             $value = self::define_options_value($setting, $parts);
             if (!empty($value)) {
                 $html .= '<dd>' . esc_html__('Usage: ', 'testimonials-widget') . '<code>' . $setting . '="' . $value . '"</code></dd>';
             }
         }
         if ($open_dl) {
             $html .= '</dl>';
         }
     }
     if ($open_dl) {
         $html .= '</dl>';
     }
     $html = links_add_target($html, '_tw');
     $html = apply_filters('tw_options_html', $html);
     return $html;
 }
Пример #2
0
 public function form($instance)
 {
     $defaults = Testimonials_Widget::get_defaults();
     $do_number = true;
     if (empty($instance)) {
         $do_number = false;
         if (empty($defaults['char_limit'])) {
             $defaults['char_limit'] = 500;
         }
         if (empty($defaults['random'])) {
             $defaults['random'] = 1;
         }
         $instance = array();
     }
     $instance = wp_parse_args($instance, $defaults);
     $form_parts = Testimonials_Widget_Settings::get_settings();
     if ($do_number) {
         $number = $this->number;
         $std = ' .' . Testimonials_Widget::id . $number;
         $form_parts['css_class'] = array('section' => 'widget', 'type' => 'readonly', 'title' => __('CSS Class', 'testimonials-widget'), 'desc' => __('This widget\'s unique CSS class for styling', 'testimonials-widget'), 'std' => $std);
     }
     // remove non-widget parts
     unset($form_parts['paging']);
     unset($form_parts['debug_mode']);
     // fixme make reset work
     unset($form_parts['reset_defaults']);
     foreach ($form_parts as $key => $part) {
         $part['id'] = $key;
         $this->display_setting($part, $instance);
     }
 }
 /**
  *
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public static function settings()
 {
     // Widget
     self::$settings['title'] = array('section' => 'widget', 'title' => esc_html__('Widget Title', 'testimonials-widget'), 'std' => esc_html__('Testimonials', 'testimonials-widget'), 'validate' => 'wp_kses_post');
     self::$settings['title_link'] = array('section' => 'widget', 'title' => esc_html__('Title Link', 'testimonials-widget'), 'desc' => esc_html__('URL, path, or post ID to link widget title to. Ex: http://example.com/stuff, /testimonials, or 123', 'testimonials-widget'), 'validate' => 'wp_kses_data');
     self::$settings['char_limit'] = array('section' => 'widget', 'title' => esc_html__('Character Limit', 'testimonials-widget'), 'desc' => esc_html__('Number of characters to limit non-single testimonial views to', 'testimonials-widget'), 'validate' => 'absint');
     self::$settings['refresh_interval'] = array('section' => 'widget', 'title' => esc_html__('Rotation Speed', 'testimonials-widget'), 'desc' => esc_html__('Number of seconds between testimonial rotations or 0 for no rotation at all refresh', 'testimonials-widget'), 'std' => 5, 'validate' => 'absint');
     self::$settings['widget_expand_all'] = array('section' => 'widget', 'type' => 'expand_all');
     self::$settings['widget_expand_begin'] = array('section' => 'widget', 'desc' => esc_html__('Additional Widget Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['transition_mode'] = array('section' => 'widget', 'title' => esc_html__('Transition Mode?', 'testimonials-widget'), 'desc' => esc_html__('Type of transition between slides', 'testimonials-widget'), 'type' => 'select', 'choices' => array('fade' => esc_html__('Fade', 'testimonials-widget'), 'horizontal' => esc_html__('Horizontal', 'testimonials-widget'), 'vertical' => esc_html__('Vertical', 'testimonials-widget')), 'std' => 'fade');
     self::$settings['show_start_stop'] = array('section' => 'widget', 'title' => esc_html__('Show Play/Pause?', 'testimonials-widget'), 'desc' => esc_html__('Display start and stop buttons underneath the testimonial slider.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['keep_whitespace'] = array('section' => 'widget', 'title' => esc_html__('Keep Whitespace?', 'testimonials-widget'), 'desc' => esc_html__('Keeps testimonials looking as entered than sans auto-formatting', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['bottom_text'] = array('section' => 'widget', 'title' => esc_html__('Testimonial Bottom Text', 'testimonials-widget'), 'desc' => esc_html__('Custom text or HTML for bottom of testimonials', 'testimonials-widget'), 'type' => 'textarea', 'validate' => 'wp_kses_post');
     self::$settings['widget_expand_end'] = array('section' => 'widget', 'type' => 'expand_end');
     // General
     self::$settings['general_expand_begin'] = array('desc' => esc_html__('General Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['use_bxslider'] = array('title' => esc_html__('Use bxSlider?', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Testimonials\' used custom JavaScript for transitions.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'backwards' => array('version' => '2.15.0', 'std' => 0), 'std' => 1, 'widget' => 0);
     $use_bxslider = tw_get_option('use_bxslider');
     if ($use_bxslider) {
         self::$settings['exclude_bxslider_css'] = array('title' => esc_html__('Exclude bxSlider CSS?', 'testimonials-widget'), 'desc' => esc_html__('For a bare-bones, unthemed slider.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     }
     self::$settings['exclude_css'] = array('title' => esc_html__('Exclude default CSS?', 'testimonials-widget'), 'desc' => esc_html__('Prevent default CSS from being loaded.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['include_ie7_css'] = array('title' => esc_html__('Include IE7 CSS?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['disable_quotes'] = array('title' => esc_html__('Hide built-in quotes?', 'testimonials-widget'), 'desc' => esc_html__('Remove open and close quote span tags surrounding testimonial content', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['remove_hentry'] = array('title' => esc_html__('Remove `.hentry` CSS?', 'testimonials-widget'), 'desc' => esc_html__('Some themes use class `.hentry` in a manner that breaks Testimonials\' CSS', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['use_quote_tag'] = array('title' => esc_html__('Use `&lt;q&gt;` tag?', 'testimonials-widget'), 'desc' => esc_html__('Not HTML5 compliant', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['general_heading_fields'] = array('desc' => esc_html__('Fields to Show', 'testimonials-widget'), 'type' => 'heading');
     self::$settings['hide_gravatar'] = array('title' => esc_html__('Hide Gravatar Image?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_image'] = array('title' => esc_html__('Hide Image?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_image_single'] = array('title' => esc_html__('Hide Image in Single View?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['hide_content'] = array('title' => esc_html__('Hide Testimonial Content?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_source'] = array('title' => esc_html__('Hide Author/Source?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display "Post Title" in cite', 'testimonials-widget'));
     self::$settings['hide_email'] = array('title' => esc_html__('Hide Email?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['hide_title'] = array('title' => esc_html__('Hide Job Title?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_location'] = array('title' => esc_html__('Hide Location?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_company'] = array('title' => esc_html__('Hide Company?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_url'] = array('title' => esc_html__('Hide URL?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['general_heading_misc'] = array('desc' => esc_html__('Miscellaneous', 'testimonials-widget'), 'type' => 'heading');
     self::$settings['item_reviewed'] = array('title' => esc_html__('Default Reviewed Item?', 'testimonials-widget'), 'desc' => esc_html__('Name of thing being referenced in testimonials', 'testimonials-widget'), 'std' => get_option('blogname'), 'widget' => 0);
     self::$settings['item_reviewed_url'] = array('title' => esc_html__('Default Reviewed Item URL?', 'testimonials-widget'), 'desc' => esc_html__('URL of thing being referenced in testimonials', 'testimonials-widget'), 'std' => network_site_url(), 'validate' => 'url', 'widget' => 0);
     self::$settings['paging'] = array('title' => esc_html__('Enable Paging?', 'testimonials-widget'), 'desc' => esc_html__('For `[testimonials]`', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => esc_html__('Disable', 'testimonials-widget'), 1 => esc_html__('Enable', 'testimonials-widget'), 'before' => esc_html__('Before testimonials', 'testimonials-widget'), 'after' => esc_html__('After testimonials', 'testimonials-widget')), 'std' => 1, 'widget' => 0);
     $desc = __('Adds HTML tag markup per the <a href="%s">Review schema</a> to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results.', 'testimonials-widget');
     self::$settings['enable_schema'] = array('title' => esc_html__('Enable Review Schema?', 'testimonials-widget'), 'desc' => sprintf($desc, 'http://schema.org/Review'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['enable_video'] = array('title' => esc_html__('Enable Video?', 'testimonials-widget'), 'desc' => esc_html__('Only enable when displaying video content.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['do_shortcode'] = array('title' => esc_html__('Enable [shortcodes]?', 'testimonials-widget'), 'desc' => esc_html__('If unchecked, shortcodes are stripped.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['hide_not_found'] = array('title' => esc_html__('Hide "Testimonials Not Found"?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['target'] = array('title' => esc_html__('URL Target', 'testimonials-widget'), 'desc' => esc_html__('Add target to all URLs; leave blank if none', 'testimonials-widget'), 'validate' => 'term');
     self::$settings['general_expand_end'] = array('type' => 'expand_end');
     // Selection
     self::$settings['selection_expand_begin'] = array('section' => 'selection', 'desc' => esc_html__('Selection Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['category'] = array('section' => 'selection', 'title' => esc_html__('Category Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated category names. Ex: Category A, Another category', 'testimonials-widget'), 'validate' => 'terms', 'suggest' => true);
     self::$settings['tags'] = array('section' => 'selection', 'title' => esc_html__('Tags Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated tag names. Ex: Tag A, Another tag', 'testimonials-widget'), 'validate' => 'terms', 'suggest' => true);
     self::$settings['tags_all'] = array('section' => 'selection', 'title' => esc_html__('Require All Tags?', 'testimonials-widget'), 'desc' => esc_html__('Select only testimonials with all of the given tags', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['ids'] = array('section' => 'selection', 'title' => esc_html__('Include IDs Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated testimonial IDs. Ex: 3,1,2', 'testimonials-widget'), 'validate' => 'ids');
     self::$settings['exclude'] = array('section' => 'selection', 'title' => esc_html__('Exclude IDs Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated testimonial IDs. Ex: 3,1,2', 'testimonials-widget'), 'validate' => 'ids');
     self::$settings['limit'] = array('section' => 'selection', 'title' => esc_html__('Limit', 'testimonials-widget'), 'desc' => esc_html__('Number of testimonials to select per instance', 'testimonials-widget'), 'std' => 10, 'validate' => 'nozero');
     self::$settings['selection_expand_end'] = array('section' => 'selection', 'type' => 'expand_end');
     // Ordering
     self::$settings['ordering_expand_begin'] = array('section' => 'ordering', 'desc' => esc_html__('Ordering Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['random'] = array('section' => 'ordering', 'title' => esc_html__('Random Order?', 'testimonials-widget'), 'desc' => esc_html__('If checked, ignores ORDER BY, ORDER BY meta_key, and ORDER BY Order. Widgets are random by default automatically', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['orderby'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY', 'testimonials-widget'), 'desc' => esc_html__('Used when "Random Order" is disabled', 'testimonials-widget'), 'type' => 'select', 'choices' => array('ID' => esc_html__('Testimonial ID', 'testimonials-widget'), 'author' => esc_html__('Author', 'testimonials-widget'), 'date' => esc_html__('Date', 'testimonials-widget'), 'menu_order' => esc_html__('Menu Order', 'testimonials-widget'), 'title' => esc_html__('Source', 'testimonials-widget'), 'none' => esc_html__('No order', 'testimonials-widget')), 'std' => 'ID', 'validate' => 'term');
     self::$settings['meta_key'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY meta_key', 'testimonials-widget'), 'desc' => esc_html__('Used when "Random Order" is disabled and sorting by a testimonials meta key is needed. Overrides ORDER BY', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => esc_html__('None', 'testimonials-widget'), 'testimonials-widget-title' => esc_html__('Job Title', 'testimonials-widget'), 'testimonials-widget-email' => esc_html__('Email', 'testimonials-widget'), 'testimonials-widget-location' => esc_html__('Location', 'testimonials-widget'), 'testimonials-widget-company' => esc_html__('Company', 'testimonials-widget'), 'testimonials-widget-url' => esc_html__('URL', 'testimonials-widget')), 'validate' => 'slug');
     self::$settings['order'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY Order', 'testimonials-widget'), 'type' => 'select', 'choices' => array('DESC' => esc_html__('Descending', 'testimonials-widget'), 'ASC' => esc_html__('Ascending', 'testimonials-widget')), 'std' => 'DESC', 'validate' => 'order');
     self::$settings['ordering_expand_end'] = array('section' => 'ordering', 'type' => 'expand_end');
     // Post Type
     self::$settings['allow_comments'] = array('section' => 'post_type', 'title' => esc_html__('Allow Comments?', 'testimonials-widget'), 'desc' => esc_html__('Only affects the Testimonials post edit page. Your theme controls the front-end view.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     $desc = __('URL slug-name for <a href="%1s">testimonials archive</a> page.', 'testimonials-widget');
     $has_archive = tw_get_option('has_archive', '');
     $site_url = network_site_url('/' . $has_archive . '/');
     self::$settings['has_archive'] = array('section' => 'post_type', 'title' => esc_html__('Archive Page URL', 'testimonials-widget'), 'desc' => sprintf($desc, $site_url), 'std' => 'testimonials-archive', 'validate' => 'slash_sanitize_title', 'widget' => 0);
     $desc = esc_html__('URL slug-name for testimonial view pages. Shouldn\'t be the same as the Archive Page URL nor should it match a page URL slug.', 'testimonials-widget');
     self::$settings['rewrite_slug'] = array('section' => 'post_type', 'title' => esc_html__('Testimonial Page URL', 'testimonials-widget'), 'desc' => $desc, 'std' => 'testimonial', 'validate' => 'slash_sanitize_title', 'widget' => 0);
     // Columns
     self::$settings['columns_id'] = array('section' => 'columns', 'title' => esc_html__('Hide ID?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     self::$settings['columns_thumbnail'] = array('section' => 'columns', 'title' => esc_html__('Hide Image?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['columns_shortcode'] = array('section' => 'columns', 'title' => esc_html__('Hide Shortcode?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['columns_job_title'] = array('section' => 'columns', 'title' => esc_html__('Hide Job Title?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     self::$settings['columns_location'] = array('section' => 'columns', 'title' => esc_html__('Hide Location?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     self::$settings['columns_email'] = array('section' => 'columns', 'title' => esc_html__('Hide Email?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     self::$settings['columns_company'] = array('section' => 'columns', 'title' => esc_html__('Hide Company?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     self::$settings['columns_url'] = array('section' => 'columns', 'title' => esc_html__('Hide URL?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0);
     // Reset
     self::$settings['reset_expand_begin'] = array('section' => 'reset', 'desc' => esc_html__('Reset', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['use_cpt_taxonomy'] = array('section' => 'reset', 'title' => esc_html__('Don\'t Use Default Taxonomies?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('If checked, use Testimonials\' own category and tag taxonomies instead', 'testimonials-widget'), 'widget' => 0);
     parent::settings();
     if (empty($use_bxslider)) {
         self::$settings['version_options_heading'] = array('section' => 'reset', 'desc' => esc_html__('Version Based Options', 'testimonials-widget'), 'type' => 'heading');
         self::$settings['disable_animation'] = array('section' => 'reset', 'title' => esc_html__('Disable Animation?', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Disable animation between testimonial transitions. Useful when stacking widgets.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
         self::$settings['fade_out_speed'] = array('section' => 'reset', 'title' => esc_html__('Fade Out Speed', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Transition duration in milliseconds; higher values indicate slower animations, not faster ones.', 'testimonials-widget'), 'std' => 1250, 'validate' => 'absint');
         self::$settings['fade_in_speed'] = array('section' => 'reset', 'title' => esc_html__('Fade In Speed', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Transition duration in milliseconds; higher values indicate slower animations, not faster ones.', 'testimonials-widget'), 'std' => 500, 'validate' => 'absint');
         self::$settings['height'] = array('section' => 'reset', 'title' => esc_html__('Height', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Testimonials height, in pixels. Overrides minimum and maximum height', 'testimonials-widget'), 'validate' => 'min1');
         self::$settings['min_height'] = array('section' => 'reset', 'title' => esc_html__('Minimum Height', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Set for minimum display height, in pixels', 'testimonials-widget'), 'validate' => 'min1');
         self::$settings['max_height'] = array('section' => 'reset', 'title' => esc_html__('Maximum Height', 'testimonials-widget'), 'desc' => esc_html__('Prior to 2.15.0, Set for maximum display height, in pixels', 'testimonials-widget'), 'validate' => 'min1');
     }
     self::$settings['reset_expand_end'] = array('section' => 'reset', 'type' => 'expand_end');
     self::$settings = apply_filters('testimonials_widget_settings', self::$settings);
     foreach (self::$settings as $id => $parts) {
         self::$settings[$id] = wp_parse_args($parts, self::$default);
     }
 }
 /**
  *
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public static function settings()
 {
     // Widget
     self::$settings['title'] = array('section' => 'widget', 'title' => esc_html__('Title', 'testimonials-widget'), 'std' => esc_html__('Testimonials', 'testimonials-widget'), 'validate' => 'wp_kses_post');
     self::$settings['title_link'] = array('section' => 'widget', 'title' => esc_html__('Title Link', 'testimonials-widget'), 'desc' => esc_html__('URL, path, or post ID to link widget title to. Ex: http://example.com/stuff, /testimonials, or 123', 'testimonials-widget'), 'validate' => 'wp_kses_data');
     self::$settings['adaptive_height'] = array('section' => 'widget', 'title' => esc_html__('Adaptive Slider Height?', 'testimonials-widget'), 'desc' => esc_html__('Dynamically adjust slider height based on each slide\'s height.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['bottom_text'] = array('section' => 'widget', 'title' => esc_html__('Bottom Text', 'testimonials-widget'), 'desc' => esc_html__('Common text or HTML for bottom of testimonials.', 'testimonials-widget'), 'type' => 'textarea', 'validate' => 'wp_kses_post');
     self::$settings['char_limit'] = array('section' => 'widget', 'title' => esc_html__('Character Limit', 'testimonials-widget'), 'desc' => esc_html__('Number of characters to limit non-single testimonial views to.', 'testimonials-widget'), 'validate' => 'absint');
     self::$settings['keep_whitespace'] = array('section' => 'widget', 'title' => esc_html__('Keep Whitespace?', 'testimonials-widget'), 'desc' => esc_html__('Keeps testimonials looking as entered than sans auto-formatting.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['refresh_interval'] = array('section' => 'widget', 'title' => esc_html__('Rotation Speed', 'testimonials-widget'), 'desc' => esc_html__('Number of seconds between testimonial rotations or 0 for no rotation at all refresh.', 'testimonials-widget'), 'std' => 5, 'validate' => 'absint');
     self::$settings['show_start_stop'] = array('section' => 'widget', 'title' => esc_html__('Show Play/Pause?', 'testimonials-widget'), 'desc' => esc_html__('Display start and stop buttons underneath the testimonial slider.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['slide_width'] = array('section' => 'widget', 'title' => esc_html__('Slide Width?', 'testimonials-widget'), 'desc' => esc_html__('Width of each testimonial. Increase to thumbnail width or greater for improved looks. Requried for horizontal transitions.', 'testimonials-widget'), 'validate' => 'intval', 'std' => 0);
     self::$settings['transition_mode'] = array('section' => 'widget', 'title' => esc_html__('Transition Mode?', 'testimonials-widget'), 'desc' => esc_html__('Type of transition between slides.', 'testimonials-widget'), 'type' => 'select', 'choices' => array('fade' => esc_html__('Fade', 'testimonials-widget'), 'horizontal' => esc_html__('Horizontal', 'testimonials-widget'), 'vertical' => esc_html__('Vertical', 'testimonials-widget')), 'std' => 'fade');
     self::$settings['widget_expand_all'] = array('section' => 'widget', 'type' => 'expand_all');
     // General
     self::$settings['general_expand_begin'] = array('desc' => esc_html__('General Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['item_reviewed'] = array('title' => esc_html__('Default Reviewed Item?', 'testimonials-widget'), 'desc' => esc_html__('Name of thing being referenced in testimonials.', 'testimonials-widget'), 'std' => get_option('blogname'), 'widget' => 0, 'validate' => 'wp_kses_post');
     self::$settings['item_reviewed_url'] = array('title' => esc_html__('Default Reviewed Item URL?', 'testimonials-widget'), 'desc' => esc_html__('URL of thing being referenced in testimonials.', 'testimonials-widget'), 'std' => network_site_url(), 'validate' => 'url', 'widget' => 0);
     self::$settings['disable_quotes'] = array('title' => esc_html__('Disable built-in quotes?', 'testimonials-widget'), 'desc' => esc_html__('Remove open and close quote span tags surrounding testimonial content.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['hide_not_found'] = array('title' => esc_html__('Disable "Testimonials Not Found"?', 'testimonials-widget'), 'desc' => esc_html__('Remove "Testimonials Not Found" content when no testimonials are found to be displayed.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['paging'] = array('title' => esc_html__('Enable Paging?', 'testimonials-widget'), 'desc' => esc_html__('Show paging controls for `[testimonials]` listing.', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => esc_html__('Disable', 'testimonials-widget'), 1 => esc_html__('Enable', 'testimonials-widget'), 'before' => esc_html__('Before testimonials', 'testimonials-widget'), 'after' => esc_html__('After testimonials', 'testimonials-widget')), 'std' => 1, 'widget' => 0);
     $desc = __('Adds HTML tag markup per the <a href="%s">Review schema</a> to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results.', 'testimonials-widget');
     self::$settings['enable_schema'] = array('title' => esc_html__('Enable Review Schema?', 'testimonials-widget'), 'desc' => sprintf($desc, 'http://schema.org/Review'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['do_shortcode'] = array('title' => esc_html__('Enable [shortcodes]?', 'testimonials-widget'), 'desc' => esc_html__('If unchecked, shortcodes are stripped.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['enable_video'] = array('title' => esc_html__('Enable Video?', 'testimonials-widget'), 'desc' => esc_html__('Only enable when displaying video content.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['exclude_bxslider_css'] = array('title' => esc_html__('Exclude bxSlider CSS?', 'testimonials-widget'), 'desc' => esc_html__('For a bare-bones, unthemed slider.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0, 'show_code' => false);
     self::$settings['exclude_css'] = array('title' => esc_html__('Exclude default CSS?', 'testimonials-widget'), 'desc' => esc_html__('Prevent default CSS from being loaded.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0, 'show_code' => false);
     self::$settings['remove_hentry'] = array('title' => esc_html__('Remove `.hentry` CSS?', 'testimonials-widget'), 'desc' => esc_html__('Some themes use class `.hentry` in a manner that breaks Testimonials\' CSS.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1);
     self::$settings['target'] = array('title' => esc_html__('URL Target', 'testimonials-widget'), 'desc' => esc_html__('Add target to all URLs; leave blank if none.', 'testimonials-widget'), 'validate' => 'term');
     self::$settings['use_quote_tag'] = array('title' => esc_html__('Use `&lt;q&gt;` tag?', 'testimonials-widget'), 'desc' => esc_html__('Not HTML5 compliant.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['general_expand_end'] = array('type' => 'expand_end');
     // Fields
     self::$settings['fields_expand_begin'] = array('section' => 'fields', 'desc' => esc_html__('Field Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['hide_source'] = array('section' => 'fields', 'title' => esc_html__('Hide Author?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display testimonial title in cite.', 'testimonials-widget'));
     self::$settings['hide_company'] = array('section' => 'fields', 'title' => esc_html__('Hide Company?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display testimonial company in cite.', 'testimonials-widget'));
     self::$settings['hide_content'] = array('section' => 'fields', 'title' => esc_html__('Hide Content?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display testimonial content in a view.', 'testimonials-widget'));
     self::$settings['hide_email'] = array('section' => 'fields', 'title' => esc_html__('Hide Email?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'desc' => esc_html__('Don\'t display or link to testimonial email in cite.', 'testimonials-widget'));
     self::$settings['hide_gravatar'] = array('section' => 'fields', 'title' => esc_html__('Hide Gravatar?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display Gravatar image with testimonial.', 'testimonials-widget'));
     self::$settings['hide_image'] = array('section' => 'fields', 'title' => esc_html__('Hide Image?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display featured image with testimonial.', 'testimonials-widget'));
     self::$settings['hide_image_single'] = array('section' => 'fields', 'title' => esc_html__('Hide Image in Single View?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     self::$settings['hide_title'] = array('section' => 'fields', 'title' => esc_html__('Hide Job Title?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display testimonial job title in cite.', 'testimonials-widget'));
     self::$settings['hide_location'] = array('section' => 'fields', 'title' => esc_html__('Hide Location?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display testimonial location in cite.', 'testimonials-widget'));
     self::$settings['hide_url'] = array('section' => 'fields', 'title' => esc_html__('Hide URL?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('Don\'t display or link to testimonial URL in cite.', 'testimonials-widget'));
     self::$settings['fields_expand_end'] = array('type' => 'expand_end');
     // Selection
     self::$settings['selection_expand_begin'] = array('section' => 'selection', 'desc' => esc_html__('Selection Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['category'] = array('section' => 'selection', 'title' => esc_html__('Category Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated category names or IDs.', 'testimonials-widget'), 'validate' => 'terms', 'suggest' => true);
     self::$settings['exclude'] = array('section' => 'selection', 'title' => esc_html__('Exclude IDs Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated testimonial IDs.', 'testimonials-widget'), 'validate' => 'ids');
     self::$settings['ids'] = array('section' => 'selection', 'title' => esc_html__('Include IDs Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated testimonial IDs.', 'testimonials-widget'), 'validate' => 'ids');
     self::$settings['limit'] = array('section' => 'selection', 'title' => esc_html__('Limit', 'testimonials-widget'), 'desc' => esc_html__('Number of testimonials to select per instance.', 'testimonials-widget'), 'std' => 10, 'validate' => 'nozero');
     self::$settings['tags_all'] = array('section' => 'selection', 'title' => esc_html__('Require All Tags?', 'testimonials-widget'), 'desc' => esc_html__('Select only testimonials with all of the given tags.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['tags'] = array('section' => 'selection', 'title' => esc_html__('Tags Filter', 'testimonials-widget'), 'desc' => esc_html__('Comma separated tag slugs or IDs.', 'testimonials-widget'), 'validate' => 'terms', 'suggest' => true);
     self::$settings['selection_expand_end'] = array('section' => 'selection', 'type' => 'expand_end');
     // Ordering
     self::$settings['ordering_expand_begin'] = array('section' => 'ordering', 'desc' => esc_html__('Ordering Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['orderby'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY', 'testimonials-widget'), 'desc' => esc_html__('Used when "Random Order" is disabled.', 'testimonials-widget'), 'type' => 'select', 'choices' => array('ID' => esc_html__('Testimonial ID', 'testimonials-widget'), 'author' => esc_html__('Author', 'testimonials-widget'), 'date' => esc_html__('Date', 'testimonials-widget'), 'menu_order' => esc_html__('Menu Order', 'testimonials-widget'), 'title' => esc_html__('Author', 'testimonials-widget'), 'none' => esc_html__('No order', 'testimonials-widget')), 'std' => 'ID', 'validate' => 'term');
     self::$settings['meta_key'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY meta_key', 'testimonials-widget'), 'desc' => esc_html__('Used when "Random Order" is disabled and sorting by a testimonials meta key is needed. Overrides ORDER BY.', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => esc_html__('None', 'testimonials-widget'), 'testimonials-widget-title' => esc_html__('Job Title', 'testimonials-widget'), 'testimonials-widget-email' => esc_html__('Email', 'testimonials-widget'), 'testimonials-widget-location' => esc_html__('Location', 'testimonials-widget'), 'testimonials-widget-company' => esc_html__('Company', 'testimonials-widget'), 'testimonials-widget-url' => esc_html__('URL', 'testimonials-widget')), 'validate' => 'slug');
     self::$settings['order'] = array('section' => 'ordering', 'title' => esc_html__('ORDER BY Order', 'testimonials-widget'), 'type' => 'select', 'choices' => array('DESC' => esc_html__('Descending', 'testimonials-widget'), 'ASC' => esc_html__('Ascending', 'testimonials-widget')), 'std' => 'DESC', 'validate' => 'order');
     self::$settings['random'] = array('section' => 'ordering', 'title' => esc_html__('Random Order?', 'testimonials-widget'), 'desc' => esc_html__('If checked, ignores ORDER BY, ORDER BY meta_key, and ORDER BY Order. Widgets are random by default automatically.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true');
     self::$settings['ordering_expand_end'] = array('section' => 'ordering', 'type' => 'expand_end');
     // Post Type
     self::$settings['allow_comments'] = array('section' => 'post_type', 'title' => esc_html__('Allow Comments?', 'testimonials-widget'), 'desc' => esc_html__('Only affects the Testimonials post edit page. Your theme controls the front-end view.', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0, 'show_code' => false);
     $desc = __('URL slug-name for <a href="%1s">testimonials archive</a> page.', 'testimonials-widget');
     $has_archive = tw_get_option('has_archive', '');
     $site_url = network_site_url('/' . $has_archive . '/');
     self::$settings['has_archive'] = array('section' => 'post_type', 'title' => esc_html__('Archive Page URL', 'testimonials-widget'), 'desc' => sprintf($desc, $site_url), 'std' => 'testimonials-archive', 'validate' => 'slash_sanitize_title', 'widget' => 0, 'show_code' => false);
     self::$settings['use_cpt_taxonomy'] = array('section' => 'post_type', 'title' => esc_html__('Disable Default Taxonomies?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'desc' => esc_html__('If checked, use Testimonials\' own category and tag taxonomies than WordPress\' defaults.', 'testimonials-widget'), 'widget' => 0, 'show_code' => false);
     self::$settings['enable_archives'] = array('desc' => esc_html__('Include testimonials in archive and category views.', 'testimonials-widget'), 'section' => 'post_type', 'show_code' => false, 'title' => esc_html__('Enable archives view?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0);
     $desc = esc_html__('URL slug-name for testimonial view pages. Shouldn\'t be the same as the Archive Page URL nor should it match a page URL slug.', 'testimonials-widget');
     self::$settings['rewrite_slug'] = array('section' => 'post_type', 'title' => esc_html__('Testimonial Page URL', 'testimonials-widget'), 'desc' => $desc, 'std' => 'testimonial', 'validate' => 'slash_sanitize_title', 'widget' => 0, 'show_code' => false);
     // Columns
     self::$settings['columns_author'] = array('section' => 'columns', 'title' => esc_html__('Hide Author?', 'testimonials-widget', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_company'] = array('section' => 'columns', 'title' => esc_html__('Hide Company?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_email'] = array('section' => 'columns', 'title' => esc_html__('Hide Email?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_id'] = array('section' => 'columns', 'title' => esc_html__('Hide ID?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_thumbnail'] = array('section' => 'columns', 'title' => esc_html__('Hide Image?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0, 'show_code' => false);
     self::$settings['columns_job_title'] = array('section' => 'columns', 'title' => esc_html__('Hide Job Title?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_location'] = array('section' => 'columns', 'title' => esc_html__('Hide Location?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     self::$settings['columns_shortcode'] = array('section' => 'columns', 'title' => esc_html__('Hide Shortcode?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'widget' => 0, 'show_code' => false);
     self::$settings['columns_url'] = array('section' => 'columns', 'title' => esc_html__('Hide URL?', 'testimonials-widget'), 'type' => 'checkbox', 'validate' => 'is_true', 'std' => 1, 'widget' => 0, 'show_code' => false);
     // Reset
     self::$settings['reset_expand_begin'] = array('section' => 'reset', 'desc' => esc_html__('Reset', 'testimonials-widget'), 'type' => 'expand_begin');
     parent::settings();
     self::$settings['reset_expand_end'] = array('section' => 'reset', 'type' => 'expand_end');
     self::$settings = apply_filters('tw_settings', self::$settings);
     foreach (self::$settings as $id => $parts) {
         self::$settings[$id] = wp_parse_args($parts, self::$default);
     }
     if (!empty($_REQUEST['page']) && 'testimonialswidget_settings' == $_REQUEST['page']) {
         // Examples
         self::$settings['examples'] = array('section' => 'examples', 'desc' => Testimonials_Widget::testimonials_examples(), 'type' => 'content', 'widget' => 0);
         self::$settings['examples'] = wp_parse_args(self::$settings['examples'], self::$default);
         // Shortcode Attributes
         self::$settings['options'] = array('section' => 'options', 'type' => 'content', 'desc' => Testimonials_Widget::testimonials_options(), 'widget' => 0);
         self::$settings['options'] = wp_parse_args(self::$settings['options'], self::$default);
     }
 }
Пример #5
0
 public function get_testimonials_html($testimonials, $atts, $is_list = true, $widget_number = null)
 {
     // display attributes
     $hide_not_found = $atts['hide_not_found'];
     $paging = Testimonials_Widget_Settings::is_true($atts['paging']);
     $paging_before = 'before' == $atts['paging'];
     $paging_after = 'after' == $atts['paging'];
     $refresh_interval = $atts['refresh_interval'];
     $target = $atts['target'];
     $html = '';
     $id = self::id;
     if (is_null($widget_number)) {
         $html .= '<div class="' . $id;
         if ($is_list) {
             $html .= ' ' . $id . '_list';
         }
         $html .= '">';
     } else {
         $id_base = $id . $widget_number;
         $html .= '<div class="' . $id . ' ' . $id_base . '">';
     }
     if (empty($testimonials) && !$hide_not_found) {
         $testimonials = array(array('testimonial_content' => __('No testimonials found', 'testimonials-widget')));
     }
     if ($paging || $paging_before) {
         $html .= self::get_testimonials_paging($testimonials, $atts);
     }
     $is_first = true;
     foreach ($testimonials as $testimonial) {
         $content = self::get_testimonial_html($testimonial, $atts, $is_list, $is_first, $widget_number);
         $content = apply_filters('testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number);
         $html .= $content;
         $is_first = false;
     }
     if ($paging || $paging_after) {
         $html .= self::get_testimonials_paging($testimonials, $atts, false);
     }
     $html .= '</div>';
     if ($target) {
         $html = links_add_target($html, $target);
     }
     return $html;
 }
 public static function get_testimonials_html($testimonials, $atts, $is_list = true, $widget_number = null)
 {
     $hide_not_found = $atts['hide_not_found'];
     $paging = Testimonials_Widget_Settings::is_true($atts['paging']);
     $paging_before = 'before' === strtolower($atts['paging']);
     $paging_after = 'after' === strtolower($atts['paging']);
     $target = $atts['target'];
     $id = self::ID;
     if (is_null($widget_number)) {
         $div_open = '<div class="' . $id;
         if ($is_list) {
             $div_open .= ' listing';
         }
         $div_open .= '">';
     } else {
         $id_base = $id . $widget_number;
         $div_open = '<div class="' . $id . ' ' . $id_base . '">';
     }
     $div_open .= "\n";
     if (empty($testimonials) && !$hide_not_found) {
         $testimonials = array(array('testimonial_content' => esc_html__('No testimonials found', 'testimonials-widget')));
         self::set_not_found(true);
     } else {
         self::set_not_found();
     }
     $pre_paging = '';
     if ($paging || $paging_before) {
         $pre_paging = self::get_testimonials_paging($atts);
     }
     $is_first = true;
     $testimonial_content = '';
     foreach ($testimonials as $testimonial) {
         $content = self::get_testimonial_html($testimonial, $atts, $is_list, $is_first, $widget_number);
         if ($target) {
             $content = links_add_target($content, $target);
         }
         $content = apply_filters('testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number);
         $is_first = false;
         $testimonial_content .= $content;
     }
     $post_paging = '';
     if ($paging || $paging_after) {
         $post_paging = self::get_testimonials_paging($atts, false);
     }
     $div_close = '</div>';
     $div_close .= "\n";
     $html = $div_open . $pre_paging . $testimonial_content . $post_paging . $div_close;
     $html = apply_filters('testimonials_widget_get_testimonials_html', $html, $testimonials, $atts, $is_list, $widget_number, $div_open, $pre_paging, $testimonial_content, $post_paging, $div_close);
     return $html;
 }
 public static function get_suggest($id, $suggest_id)
 {
     return Testimonials_Widget_Settings::get_suggest($id, $suggest_id);
 }
 public static function load_settings()
 {
     // Widget
     self::$settings['title'] = array('section' => 'widget', 'title' => __('Widget Title', 'testimonials-widget'), 'std' => __('Testimonials', 'testimonials-widget'));
     self::$settings['title_link'] = array('section' => 'widget', 'title' => __('Title Link', 'testimonials-widget'), 'desc' => __('URL or Post ID to link widget title to. Ex: 123 or http://example.com', 'testimonials-widget'));
     self::$settings['keep_whitespace'] = array('section' => 'widget', 'title' => __('Keep Whitespace?', 'testimonials-widget'), 'desc' => __('Keeps testimonials looking as entered than sans auto-formatting', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['min_height'] = array('section' => 'widget', 'title' => __('Minimum Height', 'testimonials-widget'), 'desc' => __('Set for minimum display height, in pixels', 'testimonials-widget'));
     self::$settings['max_height'] = array('section' => 'widget', 'title' => __('Maximum Height', 'testimonials-widget'), 'desc' => __('Set for maximum display height, in pixels', 'testimonials-widget'));
     self::$settings['refresh_interval'] = array('section' => 'widget', 'title' => __('Rotation Speed', 'testimonials-widget'), 'desc' => __('Number of seconds between testimonial rotations or 0 for no rotation at all refresh', 'testimonials-widget'), 'std' => 5);
     // General
     self::$settings['general_expand_begin'] = array('desc' => __('General Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['char_limit'] = array('title' => __('Character Limit', 'testimonials-widget'), 'desc' => __('Number of characters to limit non-single testimonial views to', 'testimonials-widget'));
     self::$settings['hide_not_found'] = array('title' => __('Hide "Testimonials Not Found"?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_gravatar'] = array('title' => __('Hide Gravatar Image?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_image'] = array('title' => __('Hide Image?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_content'] = array('title' => __('Hide Testimonial Content?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_source'] = array('title' => __('Hide Author/Source?', 'testimonials-widget'), 'type' => 'checkbox', 'desc' => __('Don\'t display "Post Title" in cite', 'testimonials-widget'));
     self::$settings['hide_email'] = array('title' => __('Hide Email?', 'testimonials-widget'), 'type' => 'checkbox', 'std' => 1);
     self::$settings['hide_title'] = array('title' => __('Hide Title?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_company'] = array('title' => __('Hide Company?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['hide_url'] = array('title' => __('Hide URL?', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['target'] = array('title' => __('URL Target', 'testimonials-widget'), 'desc' => __('Adds target to all URLs; leave blank if none', 'testimonials-widget'));
     self::$settings['bottom_text'] = array('title' => __('Testimonial Bottom Text', 'testimonials-widget'), 'desc' => __('Custom text or HTML for bottom of testimonials', 'testimonials-widget'), 'type' => 'textarea');
     self::$settings['paging'] = array('title' => __('Enable Paging?', 'testimonials-widget'), 'desc' => __('For `[testimonialswidget_list]`', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => __('Disable', 'testimonials-widget'), 1 => __('Enable', 'testimonials-widget'), 'before' => __('Before testimonials', 'testimonials-widget'), 'after' => __('After testimonials', 'testimonials-widget')), 'std' => 1);
     self::$settings['remove_hentry'] = array('title' => __('Remove `.hentry` CSS?', 'testimonials-widget'), 'desc' => __('Some themes use class `.hentry` in a manner that breaks Testimonials Widgets CSS', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['general_expand_end'] = array('type' => 'expand_end');
     // Selection
     self::$settings['selection_expand_begin'] = array('section' => 'selection', 'desc' => __('Selection Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['category'] = array('section' => 'selection', 'title' => __('Category Filter', 'testimonials-widget'), 'desc' => __('Comma separated category slug-names. Ex: category-a, another-category', 'testimonials-widget'));
     self::$settings['tags'] = array('section' => 'selection', 'title' => __('Tags Filter', 'testimonials-widget'), 'desc' => __('Comma separated tag slug-names. Ex: tag-a, another-tag', 'testimonials-widget'));
     self::$settings['tags_all'] = array('section' => 'selection', 'title' => __('Require All Tags?', 'testimonials-widget'), 'desc' => __('Select only testimonials with all of the given tags', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['ids'] = array('section' => 'selection', 'title' => __('Include IDs Filter', 'testimonials-widget'), 'desc' => __('Comma separated testimonial IDs. Ex: 3,1,2', 'testimonials-widget'));
     self::$settings['exclude'] = array('section' => 'selection', 'title' => __('Exclude IDs Filter', 'testimonials-widget'), 'desc' => __('Comma separated testimonial IDs. Ex: 3,1,2', 'testimonials-widget'));
     self::$settings['limit'] = array('section' => 'selection', 'title' => __('Limit', 'testimonials-widget'), 'desc' => __('Number of testimonials to select per instance', 'testimonials-widget'), 'std' => 10);
     self::$settings['selection_expand_end'] = array('section' => 'selection', 'type' => 'expand_end');
     // Ordering
     self::$settings['ordering_expand_begin'] = array('section' => 'ordering', 'desc' => __('Ordering Options', 'testimonials-widget'), 'type' => 'expand_begin');
     self::$settings['random'] = array('section' => 'ordering', 'title' => __('Random Order?', 'testimonials-widget'), 'desc' => __('If checked, ignores ORDER BY, ORDER BY meta_key, and ORDER BY Order. Widgets are random by default automatically', 'testimonials-widget'), 'type' => 'checkbox');
     self::$settings['orderby'] = array('section' => 'ordering', 'title' => __('ORDER BY', 'testimonials-widget'), 'desc' => __('Used when "Random Order" is disabled', 'testimonials-widget'), 'type' => 'select', 'choices' => array('ID' => __('Testimonial ID', 'testimonials-widget'), 'author' => __('Author', 'testimonials-widget'), 'title' => __('Source', 'testimonials-widget'), 'date' => __('Date', 'testimonials-widget'), 'none' => __('No order', 'testimonials-widget')), 'std' => 'ID');
     self::$settings['meta_key'] = array('section' => 'ordering', 'title' => __('ORDER BY meta_key', 'testimonials-widget'), 'desc' => __('Used when "Random Order" is disabled and sorting by a testimonials meta key is needed. Overrides ORDER BY', 'testimonials-widget'), 'type' => 'select', 'choices' => array('' => __('None', 'testimonials-widget'), 'testimonials-widget-title' => __('Title', 'testimonials-widget'), 'testimonials-widget-email' => __('Email', 'testimonials-widget'), 'testimonials-widget-company' => __('Company', 'testimonials-widget'), 'testimonials-widget-url' => __('URL', 'testimonials-widget')));
     self::$settings['order'] = array('section' => 'ordering', 'title' => __('ORDER BY Order', 'testimonials-widget'), 'type' => 'select', 'choices' => array('DESC' => __('Descending', 'testimonials-widget'), 'ASC' => __('Ascending', 'testimonials-widget')), 'std' => 'DESC');
     self::$settings['ordering_expand_end'] = array('section' => 'ordering', 'type' => 'expand_end');
     // Debug
     self::$settings['debug_mode'] = array('section' => 'testing', 'title' => __('Debug Mode?', 'testimonials-widget'), 'desc' => __('Not implemented yet', 'testimonials-widget'), 'type' => 'checkbox');
     // Reset
     self::$settings['reset_defaults'] = array('section' => 'reset', 'title' => __('Reset to Defaults?', 'testimonials-widget'), 'type' => 'checkbox', 'class' => 'warning', 'desc' => __('Check this box to reset options to their defaults', 'testimonials-widget'));
     // Reference
     if (false) {
         self::$settings['example_text'] = array('title' => __('Example Text Input', 'testimonials-widget'), 'desc' => __('This is a description for the text input.', 'testimonials-widget'), 'std' => 'Default value');
         self::$settings['example_textarea'] = array('title' => __('Example Textarea Input', 'testimonials-widget'), 'desc' => __('This is a description for the textarea input.', 'testimonials-widget'), 'std' => 'Default value', 'type' => 'textarea');
         self::$settings['example_checkbox'] = array('title' => __('Example Checkbox', 'testimonials-widget'), 'desc' => __('This is a description for the checkbox.', 'testimonials-widget'), 'type' => 'checkbox', 'std' => 1);
         self::$settings['example_heading'] = array('title' => '', 'desc' => 'Example Heading', 'type' => 'heading');
         self::$settings['example_radio'] = array('title' => __('Example Radio', 'testimonials-widget'), 'desc' => __('This is a description for the radio buttons.', 'testimonials-widget'), 'type' => 'radio', 'choices' => array('choice1' => 'Choice 1', 'choice2' => 'Choice 2', 'choice3' => 'Choice 3'));
         self::$settings['example_select'] = array('title' => __('Example Select', 'testimonials-widget'), 'desc' => __('This is a description for the drop-down.', 'testimonials-widget'), 'type' => 'select', 'choices' => array('choice1' => 'Other Choice 1', 'choice2' => 'Other Choice 2', 'choice3' => 'Other Choice 3'));
     }
     self::$settings = apply_filters('testimonials_widget_settings', self::$settings);
     foreach (self::$settings as $id => $parts) {
         self::$settings[$id] = wp_parse_args($parts, self::$default);
     }
 }