Convert shortcode parameters into a clean set of Twitter embedded video options parameters
public static sanitizeShortcodeParameters ( array $attributes = [] ) : array | ||
$attributes | array | set of shortcode attribute-value pairs matching the WordPress shortcode regex { @type string attribute name @type mixed shortcode value } |
return | array | cleaned up options ready for comparison { @type string option name @type string|bool option value } |
/** * Test extracting a Tweet ID from a shortcode through id attribute * * @since 1.0.0 * * @covers ::sanitizeShortcodeParameters * @small * * @dataProvider tweetIDProvider * * @param string $tweet_id Tweet ID test value * * @return void */ public function testSanitizeShortcodeParametersID($tweet_id) { $expected = '560070183650213889'; $options = \Twitter\WordPress\Shortcodes\EmbeddedTweetVideo::sanitizeShortcodeParameters(array('id' => $tweet_id)); $this->assertTrue(isset($options['id']) && $options['id'] === $expected, 'Failed to extract ID from attribute'); }
/** * Test disabling a Tweet Video status overlay through a shortcode option * * @since 1.0.0 * * @covers ::sanitizeShortcodeParameters * @small * * @dataProvider hideStatusProvider * * @param array $attributes shortcode attributes { * @type string attribute * @type mixed value * } * * @return void */ public function testSanitizeShortCodeParametersStatus($attributes) { $options = \Twitter\WordPress\Shortcodes\EmbeddedTweetVideo::sanitizeShortcodeParameters($attributes); $this->assertTrue(isset($options['status']) && false === $options['status'], 'Failed to set a status value of false'); }