X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FFileTag.php;h=d459237e757355684e6043172c3c99d76c57c8e2;hb=2e05dac7dae0a3d028b442a2d5afbd4176a32e99;hp=f4d04634fa78e1a5037e1b64c3660c4ee802cee8;hpb=c1f99c70b1c7d62120723f3b142e843ba25ab338;p=friendica.git diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index f4d04634fa..d459237e75 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -1,16 +1,28 @@ . + * */ namespace Friendica\Model; -use Friendica\Core\L10n; -use Friendica\Core\PConfig; -use Friendica\Database\DBA; - /** - * @brief This class handles FileTag related functions + * 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 @@ -20,49 +32,29 @@ use Friendica\Database\DBA; class FileTag { /** - * @brief URL encode <, >, left and right brackets + * URL encode <, >, left and right brackets * * @param string $s String to be URL encoded. * * @return string The URL encoded string. */ - public static function encode($s) + private static function encode($s) { return str_replace(['<', '>', '[', ']'], ['%3c', '%3e', '%5b', '%5d'], $s); } /** - * @brief URL decode <, >, left and right brackets + * URL decode <, >, left and right brackets * * @param string $s The URL encoded string to be decoded * * @return string The decoded string. */ - public static function decode($s) + private static function decode($s) { return str_replace(['%3c', '%3e', '%5b', '%5d'], ['<', '>', '[', ']'], $s); } - /** - * @brief Query files for tag - * - * @param string $table The table to be queired. - * @param string $s The search term - * @param string $type Optional file type. - * - * @return string Query string. - */ - public static function fileQuery($table, $s, $type = 'file') - { - if ($type == 'file') { - $str = preg_quote('[' . str_replace('%', '%%', self::encode($s)) . ']'); - } else { - $str = preg_quote('<' . str_replace('%', '%%', self::encode($s)) . '>'); - } - - return " AND " . (($table) ? DBA::escape($table) . '.' : '') . "file regexp '" . DBA::escape($str) . "' "; - } - /** * Get file tags from array * @@ -122,199 +114,4 @@ class FileTag return $return; } - - /** - * @brief Get file tags from list - * - * ex. given music,video return