. * */ namespace Friendica\Model; /** * This class handles FileTag related functions * * post categories and "save to file" use the same item.file table for storage. * We will differentiate the different uses by wrapping categories in angle brackets * and save to file categories in square brackets. * To do this we need to escape these characters if they appear in our tag. */ class FileTag { /** * URL encode <, >, left and right brackets * * @param string $s String to be URL encoded. * * @return string The URL encoded string. */ private static function encode($s) { return str_replace(['<', '>', '[', ']'], ['%3c', '%3e', '%5b', '%5d'], $s); } /** * URL decode <, >, left and right brackets * * @param string $s The URL encoded string to be decoded * * @return string The decoded string. */ private static function decode($s) { return str_replace(['%3c', '%3e', '%5b', '%5d'], ['<', '>', '[', ']'], $s); } /** * Get file tags from array * * ex. given [music,video] return