@@ -915,6 +915,74 @@ function getMultiValue($params)
915915 return $ tvOutput ;
916916 }
917917
918+ function filterMultiValue ($ tvOutput , $ params )
919+ {
920+ foreach ($ params ['where ' ] as $ fieldclause => $ value ) {
921+ $ fieldclause = explode (': ' , $ fieldclause , 2 );
922+ $ fieldname = $ fieldclause [0 ];
923+ $ fieldclause = (count ($ fieldclause ) == 1 ) ? '' : $ fieldclause [1 ];
924+ switch (htmlspecialchars_decode ($ fieldclause )) {
925+ case '' :
926+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
927+ if ($ tvOut [$ fieldname ] != $ value ) {
928+ unset($ tvOutput [$ tvKey ]);
929+ }
930+ }
931+ break ;
932+ case '!= ' :
933+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
934+ if ($ tvOut [$ fieldname ] == $ value ) {
935+ unset($ tvOutput [$ tvKey ]);
936+ }
937+ }
938+ break ;
939+ case '> ' :
940+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
941+ if ($ tvOut [$ fieldname ] <= $ value ) {
942+ unset($ tvOutput [$ tvKey ]);
943+ }
944+ }
945+ break ;
946+ case '< ' :
947+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
948+ if ($ tvOut [$ fieldname ] >= $ value ) {
949+ unset($ tvOutput [$ tvKey ]);
950+ }
951+ }
952+ break ;
953+ case '>= ' :
954+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
955+ if ($ tvOut [$ fieldname ] < $ value ) {
956+ unset($ tvOutput [$ tvKey ]);
957+ }
958+ }
959+ break ;
960+ case '<= ' :
961+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
962+ if ($ tvOut [$ fieldname ] > $ value ) {
963+ unset($ tvOutput [$ tvKey ]);
964+ }
965+ }
966+ break ;
967+ case 'LIKE ' :
968+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
969+ if (strpos ($ tvOut [$ fieldname ], $ value ) === false ) {
970+ unset($ tvOutput [$ tvKey ]);
971+ }
972+ }
973+ break ;
974+ case 'NOT LIKE ' :
975+ foreach ($ tvOutput as $ tvKey => $ tvOut ) {
976+ if (strpos ($ tvOut [$ fieldname ], $ value ) !== false ) {
977+ unset($ tvOutput [$ tvKey ]);
978+ }
979+ }
980+ break ;
981+ }
982+ }
983+ return $ tvOutput ;
984+ }
985+
918986 function displayMultiValue ($ tvOutput , $ params )
919987 {
920988 // replace masked placeholder tags (for templates that are set directly set in snippet call by @CODE)
@@ -926,7 +994,7 @@ function displayMultiValue($tvOutput, $params)
926994 $ firstEmpty = true ;
927995 if ($ countOutput ) {
928996 // check for first item empty
929- foreach ($ tvOutput[ 0 ] as $ value ) {
997+ foreach (current ( $ tvOutput) as $ value ) {
930998 if ($ value != '' ) {
931999 $ firstEmpty = false ;
9321000 }
0 commit comments