Since: 1.3.0
Inheritance: implements Twitter\WordPress\Shortcodes\ShortcodeInterface
Exemple #1
0
 /**
  * Front-end display of widget
  *
  * @since 1.3.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)
 {
     $button_html = \Twitter\WordPress\Shortcodes\PeriscopeOnAir::shortcodeHandler($instance);
     if (!$button_html) {
         return;
     }
     /** This filter is documented in wp-includes/default-widgets.php */
     $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
     unset($instance['title']);
     echo $args['before_widget'];
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // escaped in markup builder
     // @codingStandardsIgnoreStart WordPress.XSS.EscapeOutput
     echo $button_html;
     // @codingStandardsIgnoreEnd WordPress.XSS.EscapeOutput
     echo $args['after_widget'];
 }
 /**
  * Test extracting a Periscope username from a shortcode through username attribute
  *
  * @since 1.3.0
  *
  * @covers ::sanitizeShortcodeParameters
  * @small
  *
  * @dataProvider usernameProvider
  *
  * @param string $username Twitter username test value
  *
  * @return void
  */
 public function testSanitizeShortcodeParametersScreenName($username)
 {
     $expected = 'twitter';
     $options = \Twitter\WordPress\Shortcodes\PeriscopeOnAir::sanitizeShortcodeParameters(array('username' => $username));
     $this->assertTrue(isset($options['username']) && $options['username'] === $expected, 'Failed to extract screen name from attribute');
 }