public static function form_parts($instance = null, $number = null) { $form_parts = Axl_Testimonials_Widget_Settings::get_settings(); if (!empty($instance['do_number'])) { $std = ' .' . Axl_Testimonials_Widget::ID . $number; $form_parts['css_class'] = array('section' => 'widget', 'type' => 'readonly', 'title' => esc_html__('CSS Class', 'testimonials-widget'), 'desc' => esc_html__('This widget\'s unique CSS class for styling', 'testimonials-widget'), 'std' => $std, 'widget' => 1); } $form_parts = apply_filters('tw_slider_widget_options', $form_parts); return $form_parts; }
/** * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public static function get_testimonials_options($atts = null) { $sections = Axl_Testimonials_Widget_Settings::get_sections(); $settings = Axl_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('Axl_Testimonials_Widget_Archives_Widget' => 'testimonials_archives', 'Axl_Testimonials_Widget_Categories_Widget' => 'testimonials_categories', 'Axl_Testimonials_Widget_Recent_Testimonials_Widget' => 'testimonials_recent', 'Axl_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; }