diff --git a/include/Emailer.php b/include/Emailer.php index 9df6ac36c9..5962e9ec8f 100644 --- a/include/Emailer.php +++ b/include/Emailer.php @@ -16,7 +16,7 @@ class Emailer { * @param additionalMailHeader additions to the smtp mail header * @param optional uid user id of the destination user */ - static public function send($params) { + public static function send($params) { call_hooks('emailer_send_prepare', $params); diff --git a/include/Smilies.php b/include/Smilies.php index 92b2063e47..9264a09d88 100644 --- a/include/Smilies.php +++ b/include/Smilies.php @@ -187,11 +187,11 @@ class Smilies { return $s; } - private function encode($m) { + private static function encode($m) { return(str_replace($m[1],base64url_encode($m[1]),$m[0])); } - private function decode($m) { + private static function decode($m) { return(str_replace($m[1],base64url_decode($m[1]),$m[0])); } @@ -204,7 +204,7 @@ class Smilies { * * @todo: Rework because it doesn't work correctly */ - private function preg_heart($x) { + private static function preg_heart($x) { if(strlen($x[1]) == 1) return $x[0]; $t = ''; diff --git a/include/cache.php b/include/cache.php index d3b24c19e7..1f80583633 100644 --- a/include/cache.php +++ b/include/cache.php @@ -42,7 +42,7 @@ class Cache { * * @return integer The cache duration in seconds */ - private function duration($level) { + private static function duration($level) { switch($level) { case CACHE_MONTH; $seconds = 2592000; diff --git a/include/dba.php b/include/dba.php index 675e40b055..ab93598cdd 100644 --- a/include/dba.php +++ b/include/dba.php @@ -476,7 +476,7 @@ class dba { * @param array $args The parameters that are to replace the ? placeholders * @return string The replaced SQL query */ - static private function replace_parameters($sql, $args) { + private static function replace_parameters($sql, $args) { $offset = 0; foreach ($args AS $param => $value) { if (is_int($args[$param]) || is_float($args[$param])) { @@ -516,7 +516,7 @@ class dba { * @param string $sql SQL statement * @return object statement object */ - static public function p($sql) { + public static function p($sql) { $a = get_app(); $stamp1 = microtime(true); @@ -711,7 +711,7 @@ class dba { * @param string $sql SQL statement * @return boolean Was the query successfull? False is returned only if an error occurred */ - static public function e($sql) { + public static function e($sql) { $a = get_app(); $stamp = microtime(true); @@ -761,7 +761,7 @@ class dba { * * @return boolean Are there rows for that condition? */ - static public function exists($table, $condition) { + public static function exists($table, $condition) { if (empty($table)) { return false; } @@ -793,7 +793,7 @@ class dba { * @param string $sql SQL statement * @return array first row of query */ - static public function fetch_first($sql) { + public static function fetch_first($sql) { $params = self::getParam(func_get_args()); $stmt = self::p($sql, $params); @@ -814,7 +814,7 @@ class dba { * * @return int Number of rows */ - static public function affected_rows() { + public static function affected_rows() { return self::$dbo->affected_rows; } @@ -824,7 +824,7 @@ class dba { * @param object Statement object * @return int Number of rows */ - static public function num_rows($stmt) { + public static function num_rows($stmt) { if (!is_object($stmt)) { return 0; } @@ -845,7 +845,7 @@ class dba { * @param object $stmt statement object * @return array current row */ - static public function fetch($stmt) { + public static function fetch($stmt) { if (!is_object($stmt)) { return false; } @@ -895,7 +895,7 @@ class dba { * * @return boolean was the insert successfull? */ - static public function insert($table, $param, $on_duplicate_update = false) { + public static function insert($table, $param, $on_duplicate_update = false) { $sql = "INSERT INTO `".self::$dbo->escape($table)."` (`".implode("`, `", array_keys($param))."`) VALUES (". substr(str_repeat("?, ", count($param)), 0, -2).")"; @@ -938,7 +938,7 @@ class dba { * * @return boolean was the lock successful? */ - static public function lock($table) { + public static function lock($table) { // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html self::e("SET autocommit=0"); $success = self::e("LOCK TABLES `".self::$dbo->escape($table)."` WRITE"); @@ -955,7 +955,7 @@ class dba { * * @return boolean was the unlock successful? */ - static public function unlock() { + public static function unlock() { // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html self::e("COMMIT"); $success = self::e("UNLOCK TABLES"); @@ -969,7 +969,7 @@ class dba { * * @return boolean Was the command executed successfully? */ - static public function transaction() { + public static function transaction() { if (!self::e('COMMIT')) { return false; } @@ -985,7 +985,7 @@ class dba { * * @return boolean Was the command executed successfully? */ - static public function commit() { + public static function commit() { if (!self::e('COMMIT')) { return false; } @@ -998,7 +998,7 @@ class dba { * * @return boolean Was the command executed successfully? */ - static public function rollback() { + public static function rollback() { if (!self::e('ROLLBACK')) { return false; } @@ -1013,7 +1013,7 @@ class dba { * * This process must only be started once, since the value is cached. */ - static private function build_relation_data() { + private static function build_relation_data() { $definition = db_definition(); foreach ($definition AS $table => $structure) { @@ -1037,7 +1037,7 @@ class dba { * * @return boolean|array was the delete successfull? When $in_process is set: deletion data */ - static public function delete($table, $param, $in_process = false, &$callstack = array()) { + public static function delete($table, $param, $in_process = false, &$callstack = array()) { $commands = array(); @@ -1200,7 +1200,7 @@ class dba { * * @return boolean was the update successfull? */ - static public function update($table, $fields, $condition, $old_fields = array()) { + public static function update($table, $fields, $condition, $old_fields = array()) { $table = self::$dbo->escape($table); @@ -1274,7 +1274,7 @@ class dba { * * $data = dba::select($table, $fields, $condition, $params); */ - static public function select($table, $fields = array(), $condition = array(), $params = array()) { + public static function select($table, $fields = array(), $condition = array(), $params = array()) { if ($table == '') { return false; } @@ -1341,7 +1341,7 @@ class dba { * @param object $stmt statement object * @return array Data array */ - static public function inArray($stmt, $do_close = true) { + public static function inArray($stmt, $do_close = true) { if (is_bool($stmt)) { return $stmt; } @@ -1362,7 +1362,7 @@ class dba { * @param object $stmt statement object * @return boolean was the close successfull? */ - static public function close($stmt) { + public static function close($stmt) { if (!is_object($stmt)) { return false; } diff --git a/include/diaspora.php b/include/diaspora.php index 7cc3e81226..3d07268325 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1027,7 +1027,7 @@ class Diaspora { * * @return the replaced string */ - public function replace_people_guid($body, $author_link) { + public static function replace_people_guid($body, $author_link) { $return = preg_replace_callback("&\[url=/people/([^\[\]]*)\](.*)\[\/url\]&Usi", function ($match) use ($author_link) { // $match diff --git a/include/ostatus.php b/include/ostatus.php index 2412839a80..e3724f3bff 100644 --- a/include/ostatus.php +++ b/include/ostatus.php @@ -43,7 +43,7 @@ class ostatus { * * @return array Array of author related entries for the item */ - private function fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch) { + private static function fetchauthor($xpath, $context, $importer, &$contact, $onlyfetch) { $author = array(); $author["author-link"] = $xpath->evaluate('atom:author/atom:uri/text()', $context)->item(0)->nodeValue; @@ -758,7 +758,7 @@ class ostatus { * * @param object $actor The actor object that contains the contact data */ - private function conv_fetch_actor($actor) { + private static function conv_fetch_actor($actor) { // We set the generation to "3" since the data here is not as reliable as the data we get on other occasions $contact = array("network" => NETWORK_OSTATUS, "generation" => 3); @@ -814,7 +814,7 @@ class ostatus { * * @return string The conversation url */ - private function fetch_conversation($self, $conversation_id = "") { + private static function fetch_conversation($self, $conversation_id = "") { if ($conversation_id != "") { $elements = explode(":", $conversation_id); @@ -856,7 +856,7 @@ class ostatus { * * @return object The shared object */ - private function shared_object($id, $conversation) { + private static function shared_object($id, $conversation) { if (!is_array($conversation->items)) { return false; } @@ -877,7 +877,7 @@ class ostatus { * * @return array Array with actor details */ - private function get_actor_details($actor, $uid, $contact_id) { + private static function get_actor_details($actor, $uid, $contact_id) { $details = array(); @@ -921,7 +921,7 @@ class ostatus { * * @return integer The item id of the posted item array */ - private function completion($conversation_url, $uid, $item = array(), $self = "") { + private static function completion($conversation_url, $uid, $item = array(), $self = "") { /// @todo This function is totally ugly and has to be rewritten totally @@ -1335,7 +1335,7 @@ class ostatus { * @param integer $itemid The id of the item * @param string $conversation_url The uri of the conversation */ - private function store_conversation($itemid, $conversation_url) { + private static function store_conversation($itemid, $conversation_url) { $conversation_url = self::convert_href($conversation_url); @@ -1363,7 +1363,7 @@ class ostatus { * * @return string The guid if the post is a reshare */ - private function get_reshared_guid($item) { + private static function get_reshared_guid($item) { $body = trim($item["body"]); // Skip if it isn't a pure repeated messages @@ -1399,7 +1399,7 @@ class ostatus { * * @return string The cleaned body */ - private function format_picture_post($body) { + private static function format_picture_post($body) { $siteinfo = get_attached_data($body); if (($siteinfo["type"] == "photo")) { @@ -1434,7 +1434,7 @@ class ostatus { * * @return object header root element */ - private function add_header($doc, $owner) { + private static function add_header($doc, $owner) { $a = get_app(); @@ -1506,7 +1506,7 @@ class ostatus { * @param object $root XML root element where the hub links are added * @param array $item Data of the item that is to be posted */ - private function get_attachment($doc, $root, $item) { + private static function get_attachment($doc, $root, $item) { $o = ""; $siteinfo = get_attached_data($item["body"]); @@ -1571,7 +1571,7 @@ class ostatus { * * @return object author element */ - private function add_author($doc, $owner) { + private static function add_author($doc, $owner) { $r = q("SELECT `homepage`, `publish` FROM `profile` WHERE `uid` = %d AND `is-default` LIMIT 1", intval($owner["uid"])); if (dbm::is_result($r)) { @@ -1678,7 +1678,7 @@ class ostatus { * * @return object Entry element */ - private function entry($doc, $item, $owner, $toplevel = false) { + private static function entry($doc, $item, $owner, $toplevel = false) { $repeated_guid = self::get_reshared_guid($item); if ($repeated_guid != "") $xml = self::reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel); @@ -1703,7 +1703,7 @@ class ostatus { * * @return object Source element */ - private function source_entry($doc, $contact) { + private static function source_entry($doc, $contact) { $source = $doc->createElement("source"); xml::add_element($doc, $source, "id", $contact["poll"]); xml::add_element($doc, $source, "title", $contact["name"]); @@ -1727,7 +1727,7 @@ class ostatus { * * @return array Contact array */ - private function contact_entry($url, $owner) { + private static function contact_entry($url, $owner) { $r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` IN (0, %d) ORDER BY `uid` DESC LIMIT 1", dbesc(normalise_link($url)), intval($owner["uid"])); @@ -1774,7 +1774,7 @@ class ostatus { * * @return object Entry element */ - private function reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel) { + private static function reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); @@ -1840,7 +1840,7 @@ class ostatus { * * @return object Entry element with "like" */ - private function like_entry($doc, $item, $owner, $toplevel) { + private static function like_entry($doc, $item, $owner, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); @@ -1877,7 +1877,7 @@ class ostatus { * * @return object author element */ - private function add_person_object($doc, $owner, $contact) { + private static function add_person_object($doc, $owner, $contact) { $object = $doc->createElement("activity:object"); xml::add_element($doc, $object, "activity:object-type", ACTIVITY_OBJ_PERSON); @@ -1923,7 +1923,7 @@ class ostatus { * * @return object Entry element */ - private function follow_entry($doc, $item, $owner, $toplevel) { + private static function follow_entry($doc, $item, $owner, $toplevel) { $item["id"] = $item["parent"] = 0; $item["created"] = $item["edited"] = date("c"); @@ -1985,7 +1985,7 @@ class ostatus { * * @return object Entry element */ - private function note_entry($doc, $item, $owner, $toplevel) { + private static function note_entry($doc, $item, $owner, $toplevel) { if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) { logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG); @@ -2012,7 +2012,7 @@ class ostatus { * * @return string The title for the element */ - private function entry_header($doc, &$entry, $owner, $toplevel) { + private static function entry_header($doc, &$entry, $owner, $toplevel) { /// @todo Check if this title stuff is really needed (I guess not) if (!$toplevel) { $entry = $doc->createElement("entry"); @@ -2048,7 +2048,7 @@ class ostatus { * @param string $verb The activity verb * @param bool $complete Add the "status_net" element? */ - private function entry_content($doc, $entry, $item, $owner, $title, $verb = "", $complete = true) { + private static function entry_content($doc, $entry, $item, $owner, $title, $verb = "", $complete = true) { if ($verb == "") $verb = self::construct_verb($item); @@ -2086,7 +2086,7 @@ class ostatus { * @param array $owner Contact data of the poster * @param $complete */ - private function entry_footer($doc, $entry, $item, $owner, $complete = true) { + private static function entry_footer($doc, $entry, $item, $owner, $complete = true) { $mentioned = array();