sanitizeShortcodeParameters() public static method

Convert shortcode parameters, attributes, and defaults into a clean set of Tweet parameters
Since: 1.0.0
public static sanitizeShortcodeParameters ( array $attributes = [] ) : array
$attributes array set of shortcode attribute-value pairs or positional content matching the WordPress shortcode regex { @type string|int attribute name or positional int @type mixed shortcode value }
return array cleaned up options ready for comparison { @type string option name @type string|bool option value }
Esempio n. 1
0
 /**
  * Test setting Tweet button sizes from a shortcode attribute
  *
  * @since 1.0.0
  *
  * @covers ::sanitizeShortcodeParameters
  * @small
  *
  * @dataProvider sizeProvider
  *
  * @param string $size           button size configuration
  * @param bool   $expected_valid expected validity
  * @param string $message        error message to display on negative assertion
  *
  * @return void
  */
 public function testSanitizeShortcodeParametersSize($size, $expected_valid, $message = '')
 {
     $options = \Twitter\WordPress\Shortcodes\Share::sanitizeShortcodeParameters(array('size' => $size));
     if ($expected_valid) {
         $this->assertTrue(isset($options['size']) && $options['size'] === 'large', $message);
     } else {
         $this->assertEmpty($options, $message);
     }
 }