]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Continued a bit:
[friendica.git] / mod / item.php
index c4508aca6a42cfebfed23f1b69d73427bd418413..bcf7a4b4693699db540603e27e4ba72e3e7280ad 100644 (file)
@@ -33,7 +33,7 @@ function item_post(App $a) {
                return;
        }
 
-       require_once('include/security.php');
+       require_once 'include/security.php';
 
        $uid = local_user();
 
@@ -142,7 +142,7 @@ function item_post(App $a) {
                                $parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
 
                                if (!isset($parent_contact["nick"])) {
-                                       require_once("include/Scrape.php");
+                                       require_once 'include/Scrape.php';
                                        $probed_contact = probe_url($thrparent[0]["author-link"]);
                                        if ($probed_contact["network"] != NETWORK_FEED) {
                                                $parent_contact = $probed_contact;
@@ -264,12 +264,12 @@ function item_post(App $a) {
                 * use the user default permissions - as they won't have
                 * been supplied via a form.
                 */
-
+               /// @TODO use x($_REQUEST, 'foo') here
                if (($api_source)
-                       && (! array_key_exists('contact_allow',$_REQUEST))
-                       && (! array_key_exists('group_allow',$_REQUEST))
-                       && (! array_key_exists('contact_deny',$_REQUEST))
-                       && (! array_key_exists('group_deny',$_REQUEST))) {
+                       && (! array_key_exists('contact_allow', $_REQUEST))
+                       && (! array_key_exists('group_allow', $_REQUEST))
+                       && (! array_key_exists('contact_deny', $_REQUEST))
+                       && (! array_key_exists('group_deny', $_REQUEST))) {
                        $str_group_allow   = $user['allow_gid'];
                        $str_contact_allow = $user['allow_cid'];
                        $str_group_deny    = $user['deny_gid'];
@@ -513,12 +513,12 @@ function item_post(App $a) {
        // Fold multi-line [code] sequences
        $body = preg_replace('/\[\/code\]\s*\[code\]/ism', "\n", $body);
 
-       $body = scale_external_images($body,false);
+       $body = scale_external_images($body, false);
 
        // Setting the object type if not defined before
        if (!$objecttype) {
                $objecttype = ACTIVITY_OBJ_NOTE; // Default value
-               require_once("include/plaintext.php");
+               require_once 'include/plaintext.php';
                $objectdata = get_attached_data($body);
 
                if ($post["type"] == "link") {
@@ -545,7 +545,7 @@ function item_post(App $a) {
                $contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
 
                if (!in_array($contact,$tags)) {
-                       $body = $contact.' '.$body;
+                       $body = $contact . ' ' . $body;
                        $tags[] = $contact;
                }
 
@@ -557,7 +557,7 @@ function item_post(App $a) {
                        $toplevel_contact = '@' . $toplevel_parent[0]['nick'] . '+' . $toplevel_parent[0]['id'];
                } else {
                        $toplevel_parent = q("SELECT `author-link`, `author-name` FROM `item` WHERE `id` = `parent` AND `parent` = %d", intval($parent));
-                       $toplevel_contact = '@[url='.$toplevel_parent[0]['author-link'].']'.$toplevel_parent[0]['author-name'].'[/url]';
+                       $toplevel_contact = '@[url=' . $toplevel_parent[0]['author-link'] . ']' . $toplevel_parent[0]['author-name'] . '[/url]';
                }
 
                if (!in_array($toplevel_contact, $tags)) {
@@ -581,8 +581,8 @@ function item_post(App $a) {
                         * Robert Johnson should be first in the $tags array
                         */
                        $fullnametagged = false;
-                       for ($x = 0; $x < count($tagged); $x ++) {
-                               if (stristr($tagged[$x],$tag . ' ')) {
+                       foreach ($tagged as $nextTag) {
+                               if (stristr($nextTag, $tag . ' ')) {
                                        $fullnametagged = true;
                                        break;
                                }
@@ -730,7 +730,7 @@ function item_post(App $a) {
 
        // preview mode - prepare the body for display and send it via json
        if ($preview) {
-               require_once('include/conversation.php');
+               require_once 'include/conversation.php';
                // We set the datarray ID to -1 because in preview mode the dataray
                // doesn't have an ID.
                $datarray["id"] = -1;
@@ -988,7 +988,7 @@ function item_post(App $a) {
                                $link = '<a href="' . App::get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
                                $html    = prepare_body($datarray);
                                $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
-                               include_once('include/html2plain.php');
+                               include_once 'include/html2plain.php';
                                $params = array (
                                    'fromName' => $a->user['username'],
                                    'fromEmail' => $a->user['email'],
@@ -1041,7 +1041,7 @@ function item_post_return($baseurl, $api_source, $return_path) {
        }
 
        $json = array('success' => 1);
-       if (x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) {
+       if (x($_REQUEST, 'jsreload') && strlen($_REQUEST['jsreload'])) {
                $json['reload'] = $baseurl . '/' . $_REQUEST['jsreload'];
        }
 
@@ -1059,7 +1059,7 @@ function item_content(App $a) {
                return;
        }
 
-       require_once('include/security.php');
+       require_once 'include/security.php';
 
        $o = '';
        if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
@@ -1087,9 +1087,9 @@ function item_content(App $a) {
  *
  * @return boolean true if replaced, false if not replaced
  */
-function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
-       require_once("include/Scrape.php");
-       require_once("include/socgraph.php");
+function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") {
+       require_once 'include/Scrape.php';
+       require_once 'include/socgraph.php';
 
        $replaced = false;
        $r = null;
@@ -1099,7 +1099,7 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo
                //is it already replaced?
                if (strpos($tag, '[url=')) {
                        //append tag to str_tags
-                       if (!stristr($str_tags,$tag)) {
+                       if (!stristr($str_tags, $tag)) {
                                if (strlen($str_tags)) {
                                        $str_tags .= ',';
                                }