Since: 1.0.0
Inheritance: implements Twitter\WordPress\Shortcodes\ShortcodeInterface
コード例 #1
0
ファイル: Follow.php プロジェクト: twitter/wordpress
 /**
  * Front-end display of widget
  *
  * @since 1.0.0
  *
  * @param array $args     Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  *
  * @return void
  */
 public function widget($args, $instance)
 {
     $follow_button_html = \Twitter\WordPress\Shortcodes\Follow::shortcodeHandler($instance);
     if (!$follow_button_html) {
         return;
     }
     echo $args['before_widget'];
     /** This filter is documented in wp-includes/default-widgets.php */
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // escaped in markup builder
     // @codingStandardsIgnoreStart WordPress.XSS.EscapeOutput
     echo $follow_button_html;
     // @codingStandardsIgnoreEnd WordPress.XSS.EscapeOutput
     echo $args['after_widget'];
 }
コード例 #2
0
ファイル: Follow.php プロジェクト: cemoulto/wordpress
 /**
  * Test hiding Twitter screen name through a shortcode attribute value
  *
  * @since 1.0.0
  *
  * @covers ::sanitizeShortcodeParameters
  * @small
  *
  * @dataProvider falseyShortcodeParameterProvider
  *
  * @param bool|int|string $falsey_value falsey value to test
  *
  * @return void
  */
 public function testSanitizeShortcodeParametersShowScreenName($falsey_value)
 {
     $options = \Twitter\WordPress\Shortcodes\Follow::sanitizeShortcodeParameters(array('show_screen_name' => $falsey_value));
     $this->assertTrue(isset($options['show_screen_name']) && false === $options['show_screen_name'], 'Failed to disable screen name display from attribute');
 }