Created
May 21, 2015 07:12
-
-
Save vidhav/86278ebe2b2c3cf3ae56 to your computer and use it in GitHub Desktop.
MODX Output Modifier checks if $input contains a string defined in the $options value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Returns a value if input contains string | |
* [[*link_attributes:containing=`blank=New Window&self=This window`]] | |
*/ | |
parse_str($options, $cases); | |
$output = 'no-match'; | |
foreach ($cases as $needle => $value) { | |
if (strpos($input, $needle) !== false) { | |
$output = $value; | |
} | |
} | |
return $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment