* @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])) {
* @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);
* @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);
*
* @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;
}
* @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);
*
* @return int Number of rows
*/
- static public function affected_rows() {
+ public static function affected_rows() {
return self::$dbo->affected_rows;
}
* @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;
}
* @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;
}
*
* @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).")";
*
* @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");
*
* @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");
*
* @return boolean Was the command executed successfully?
*/
- static public function transaction() {
+ public static function transaction() {
if (!self::e('COMMIT')) {
return false;
}
*
* @return boolean Was the command executed successfully?
*/
- static public function commit() {
+ public static function commit() {
if (!self::e('COMMIT')) {
return false;
}
*
* @return boolean Was the command executed successfully?
*/
- static public function rollback() {
+ public static function rollback() {
if (!self::e('ROLLBACK')) {
return false;
}
*
* 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) {
*
* @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();
*
* @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);
*
* $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;
}
* @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;
}
* @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;
}
*
* @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;
*
* @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);
*
* @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);
*
* @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;
}
*
* @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();
*
* @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
* @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);
*
* @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
*
* @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")) {
*
* @return object header root element
*/
- private function add_header($doc, $owner) {
+ private static function add_header($doc, $owner) {
$a = get_app();
* @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"]);
*
* @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)) {
*
* @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);
*
* @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"]);
*
* @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"]));
*
* @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);
*
* @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);
*
* @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);
*
* @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");
*
* @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);
*
* @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");
* @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);
* @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();