Be liberal in what we accept in shortcode syntax before constructing a Follow button
public static sanitizeShortcodeParameters ( array $attributes = [] ) : array | ||
$attributes | array | provided shortcode attributes { @type string shortcode attribute name @type mixed shortcode attribute value } |
return | array | simplified shortcode values with defaults removed { @type string shortcode attribute name @type bool|string shortcode attribute value } |
/** * 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'); }