X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Ftext.php;h=ea5deb4c1442a7c43ebb8929dbac66f64209290a;hb=0cd9db9cb7f4c96f597e37590a536eaae123238d;hp=e8384123c4a64cb2547ab13ca84adf031a493a19;hpb=98b407218d9954d5dc89615d4bc8a6438c97ebcd;p=friendica.git diff --git a/include/text.php b/include/text.php index e8384123c4..ea5deb4c14 100644 --- a/include/text.php +++ b/include/text.php @@ -293,7 +293,7 @@ function paginate_data(App $a, $count = null) { $stripped = trim($stripped, '/'); $pagenum = $a->pager['page']; - if (($a->page_offset != '') AND !preg_match('/[?&].offset=/', $stripped)) { + if (($a->page_offset != '') && !preg_match('/[?&].offset=/', $stripped)) { $stripped .= '&offset=' . urlencode($a->page_offset); } @@ -425,9 +425,9 @@ function expand_acl($s) { $ret = array(); if (strlen($s)) { - $t = str_replace('<','',$s); - $a = explode('>',$t); - foreach($a as $aa) { + $t = str_replace('<', '', $s); + $a = explode('>', $t); + foreach ($a as $aa) { if (intval($aa)) { $ret[] = intval($aa); } @@ -442,10 +442,11 @@ if (! function_exists('sanitise_acl')) { * @param string $item */ function sanitise_acl(&$item) { - if (intval($item)) + if (intval($item)) { $item = '<' . intval(notags(trim($item))) . '>'; - else + } else { unset($item); + } }} @@ -461,14 +462,15 @@ if (! function_exists('perms2str')) { */ function perms2str($p) { $ret = ''; - if (is_array($p)) + if (is_array($p)) { $tmp = $p; - else + } else { $tmp = explode(',',$p); + } if (is_array($tmp)) { - array_walk($tmp,'sanitise_acl'); - $ret = implode('',$tmp); + array_walk($tmp, 'sanitise_acl'); + $ret = implode('', $tmp); } return $ret; }} @@ -670,11 +672,6 @@ function get_template_file($a, $filename, $root = '') { }} - - - - - if (! function_exists('attribute_contains')) { /** * for html,xml parsing - let's say you've got @@ -1249,7 +1246,7 @@ if (! function_exists('link_compare')) { * @return boolean True if the URLs match, otherwise False * */ -function link_compare($a,$b) { +function link_compare($a, $b) { return (strcasecmp(normalise_link($a), normalise_link($b)) === 0); }} @@ -1279,8 +1276,8 @@ function redir_private_images($a, &$item) function put_item_in_cache(&$item, $update = false) { - if (($item["rendered-hash"] != hash("md5", $item["body"])) OR ($item["rendered-hash"] == "") OR - ($item["rendered-html"] == "") OR get_config("system", "ignore_cache")) { + if (($item["rendered-hash"] != hash("md5", $item["body"])) || ($item["rendered-hash"] == "") || + ($item["rendered-html"] == "") || get_config("system", "ignore_cache")) { // The function "redir_private_images" changes the body. // I'm not sure if we should store it permanently, so we save the old value. @@ -1293,7 +1290,7 @@ function put_item_in_cache(&$item, $update = false) { $item["rendered-hash"] = hash("md5", $item["body"]); $item["body"] = $body; - if ($update AND ($item["id"] != 0)) { + if ($update && ($item["id"] != 0)) { q("UPDATE `item` SET `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d", dbesc($item["rendered-html"]), dbesc($item["rendered-hash"]), intval($item["id"])); } @@ -1315,14 +1312,14 @@ if (! function_exists('prepare_body')) { * @hook prepare_body ('item'=>item array, 'html'=>body string) after first bbcode to html * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) */ -function prepare_body(&$item,$attach = false, $preview = false) { +function prepare_body(&$item, $attach = false, $preview = false) { $a = get_app(); call_hooks('prepare_body_init', $item); - $searchpath = z_root()."/search?tag="; + $searchpath = z_root() . "/search?tag="; - $tags=array(); + $tags = array(); $hashtags = array(); $mentions = array(); @@ -1355,8 +1352,9 @@ function prepare_body(&$item,$attach = false, $preview = false) { $update = (!local_user() and !remote_user() and ($item["uid"] == 0)); // Or update it if the current viewer is the intented viewer - if (($item["uid"] == local_user()) AND ($item["uid"] != 0)) + if (($item["uid"] == local_user()) && ($item["uid"] != 0)) { $update = true; + } put_item_in_cache($item, $update); $s = $item["rendered-html"]; @@ -1374,7 +1372,7 @@ function prepare_body(&$item,$attach = false, $preview = false) { $as = ''; $vhead = false; - $arr = explode('[/attach],',$item['attach']); + $arr = explode('[/attach],', $item['attach']); if (count($arr)) { $as .= '