]> git.wh0rd.org - tt-rss.git/commitdiff
move label stuff to Labels class
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 4 May 2017 12:57:40 +0000 (15:57 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Thu, 4 May 2017 12:57:40 +0000 (15:57 +0300)
fix some unresolved functions

14 files changed:
classes/api.php
classes/article.php
classes/feeds.php
classes/labels.php [new file with mode: 0644]
classes/opml.php
classes/pref/feeds.php
classes/pref/labels.php
include/functions.php
include/labels.php [deleted file]
include/rssfuncs.php
plugins/auto_assign_labels/init.php
plugins/import_export/init.php
plugins/note/init.php
tests/ApiTest.php

index cb035c86be8b20119025773b9a2ea15754b552f7..bffa2bf07d7c890fd5c2192b9d147a60944d6778 100644 (file)
@@ -458,14 +458,14 @@ class API extends Handler {
 
                        $checked = false;
                        foreach ($article_labels as $al) {
-                               if (feed_to_label_id($al[0]) == $line['id']) {
+                               if (Labels::feed_to_label_id($al[0]) == $line['id']) {
                                        $checked = true;
                                        break;
                                }
                        }
 
                        array_push($rv, array(
-                               "id" => (int)label_to_feed_id($line['id']),
+                               "id" => (int)Labels::label_to_feed_id($line['id']),
                                "caption" => $line['caption'],
                                "fg_color" => $line['fg_color'],
                                "bg_color" => $line['bg_color'],
@@ -481,8 +481,8 @@ class API extends Handler {
                $label_id = (int) $this->dbh->escape_string($_REQUEST['label_id']);
                $assign = (bool) ($this->dbh->escape_string($_REQUEST['assign']) == "true");
 
-               $label = $this->dbh->escape_string(label_find_caption(
-                       feed_to_label_id($label_id), $_SESSION["uid"]));
+               $label = $this->dbh->escape_string(Labels::find_caption(
+                       Labels::feed_to_label_id($label_id), $_SESSION["uid"]));
 
                $num_updated = 0;
 
@@ -491,9 +491,9 @@ class API extends Handler {
                        foreach ($article_ids as $id) {
 
                                if ($assign)
-                                       label_add_article($id, $label, $_SESSION["uid"]);
+                                       Labels::add_article($id, $label, $_SESSION["uid"]);
                                else
-                                       label_remove_article($id, $label, $_SESSION["uid"]);
+                                       Labels::remove_article($id, $label, $_SESSION["uid"]);
 
                                ++$num_updated;
 
index 95f1704c95f20c66ced3c39e9940e19b904a204f..45974a23c63b976cbdabaf4661b3a53920599d93 100644 (file)
@@ -154,7 +154,7 @@ class Article extends Handler_Protected {
 
                        if (count($labels) != 0) {
                                foreach ($labels as $label) {
-                                       label_add_article($ref_id, trim($label), $owner_uid);
+                                       Labels::add_article($ref_id, trim($label), $owner_uid);
                                }
                        }
 
@@ -179,7 +179,7 @@ class Article extends Handler_Protected {
 
                                if (count($labels) != 0) {
                                        foreach ($labels as $label) {
-                                               label_add_article($ref_id, trim($label), $owner_uid);
+                                               Labels::add_article($ref_id, trim($label), $owner_uid);
                                        }
                                }
 
@@ -344,7 +344,7 @@ class Article extends Handler_Protected {
                $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
                $label_id = $this->dbh->escape_string($_REQUEST["lid"]);
 
-               $label = $this->dbh->escape_string(label_find_caption($label_id,
+               $label = $this->dbh->escape_string(Labels::find_caption($label_id,
                $_SESSION["uid"]));
 
                $reply["info-for-headlines"] = array();
@@ -354,9 +354,9 @@ class Article extends Handler_Protected {
                        foreach ($ids as $id) {
 
                                if ($assign)
-                                       label_add_article($id, $label, $_SESSION["uid"]);
+                                       Labels::add_article($id, $label, $_SESSION["uid"]);
                                else
-                                       label_remove_article($id, $label, $_SESSION["uid"]);
+                                       Labels::remove_article($id, $label, $_SESSION["uid"]);
 
                                $labels = $this->get_article_labels($id, $_SESSION["uid"]);
 
@@ -955,16 +955,16 @@ class Article extends Handler_Protected {
                        ORDER BY caption");
 
                while ($line = db_fetch_assoc($result)) {
-                       $rk = array(label_to_feed_id($line["label_id"]),
+                       $rk = array(Labels::label_to_feed_id($line["label_id"]),
                                $line["caption"], $line["fg_color"],
                                $line["bg_color"]);
                        array_push($rv, $rk);
                }
 
                if (count($rv) > 0)
-                       label_update_cache($owner_uid, $id, $rv);
+                       Labels::update_cache($owner_uid, $id, $rv);
                else
-                       label_update_cache($owner_uid, $id, array("no-labels" => 1));
+                       Labels::update_cache($owner_uid, $id, array("no-labels" => 1));
 
                return $rv;
        }
index 740c7df43ec96b6cea44e9443d24fb0d93f79a0d..6c85bbf3177deccc2cb459e8205606b0dfb839ad 100755 (executable)
@@ -870,7 +870,7 @@ class Feeds extends Handler_Protected {
                $result = false;
 
                if ($feed < LABEL_BASE_INDEX) {
-                       $label_feed = feed_to_label_id($feed);
+                       $label_feed = Labels::feed_to_label_id($feed);
                        $result = $this->dbh->query("SELECT id FROM ttrss_labels2 WHERE
                                                        id = '$label_feed' AND owner_uid = " . $_SESSION['uid']);
                } else if (!$cat_view && is_numeric($feed) && $feed > 0) {
@@ -1354,7 +1354,7 @@ class Feeds extends Handler_Protected {
 
                        } else if ($feed < LABEL_BASE_INDEX) { // label
 
-                               $label_id = feed_to_label_id($feed);
+                               $label_id = Labels::feed_to_label_id($feed);
 
                                db_query("UPDATE ttrss_user_entries
                                        SET unread = false, last_read = NOW() WHERE ref_id IN
@@ -1435,7 +1435,7 @@ class Feeds extends Handler_Protected {
 
                } else if ($feed < LABEL_BASE_INDEX) {
 
-                       $label_id = feed_to_label_id($feed);
+                       $label_id = Labels::feed_to_label_id($feed);
 
                        return Feeds::getLabelUnread($label_id, $owner_uid);
 
@@ -1608,7 +1608,7 @@ class Feeds extends Handler_Protected {
                } else if ($id == -6) {
                        return __("Recently read");
                } else if ($id < LABEL_BASE_INDEX) {
-                       $label_id = feed_to_label_id($id);
+                       $label_id = Labels::feed_to_label_id($id);
                        $result = db_query("SELECT caption FROM ttrss_labels2 WHERE id = '$label_id'");
                        if (db_num_rows($result) == 1) {
                                return db_fetch_result($result, 0, "caption");
@@ -1931,7 +1931,7 @@ class Feeds extends Handler_Protected {
                        $query_strategy_part = "true";
                        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                } else if ($feed <= LABEL_BASE_INDEX) { // labels
-                       $label_id = feed_to_label_id($feed);
+                       $label_id = Labels::feed_to_label_id($feed);
 
                        $query_strategy_part = "label_id = '$label_id' AND
                                        ttrss_labels2.id = ttrss_user_labels2.label_id AND
diff --git a/classes/labels.php b/classes/labels.php
new file mode 100644 (file)
index 0000000..2ca623a
--- /dev/null
@@ -0,0 +1,162 @@
+<?php
+class Labels
+{
+       static function label_to_feed_id($label) {
+               return LABEL_BASE_INDEX - 1 - abs($label);
+       }
+
+       static function feed_to_label_id($feed) {
+               return LABEL_BASE_INDEX - 1 + abs($feed);
+       }
+
+       static function find_id($label, $owner_uid) {
+               $result = db_query(
+                       "SELECT id FROM ttrss_labels2 WHERE caption = '$label'
+                               AND owner_uid = '$owner_uid' LIMIT 1");
+
+               if (db_num_rows($result) == 1) {
+                       return db_fetch_result($result, 0, "id");
+               } else {
+                       return 0;
+               }
+       }
+
+       static function find_caption($label, $owner_uid) {
+               $result = db_query(
+                       "SELECT caption FROM ttrss_labels2 WHERE id = '$label'
+                               AND owner_uid = '$owner_uid' LIMIT 1");
+
+               if (db_num_rows($result) == 1) {
+                       return db_fetch_result($result, 0, "caption");
+               } else {
+                       return "";
+               }
+       }
+
+       static function get_all_labels($owner_uid)      {
+               $rv = array();
+
+               $result = db_query("SELECT fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = " . $owner_uid);
+
+               while ($line = db_fetch_assoc($result)) {
+                       array_push($rv, $line);
+               }
+
+               return $rv;
+       }
+
+       static function update_cache($owner_uid, $id, $labels = false, $force = false) {
+
+               if ($force)
+                       Labels::clear_cache($id);
+
+               if (!$labels)
+                       $labels = Article::get_article_labels($id);
+
+               $labels = db_escape_string(json_encode($labels));
+
+               db_query("UPDATE ttrss_user_entries SET
+                       label_cache = '$labels' WHERE ref_id = '$id' AND  owner_uid = '$owner_uid'");
+
+       }
+
+       static function clear_cache($id)        {
+
+               db_query("UPDATE ttrss_user_entries SET
+                       label_cache = '' WHERE ref_id = '$id'");
+
+       }
+
+       static function remove_article($id, $label, $owner_uid) {
+
+               $label_id = Labels::find_id($label, $owner_uid);
+
+               if (!$label_id) return;
+
+               db_query(
+                       "DELETE FROM ttrss_user_labels2
+                       WHERE
+                               label_id = '$label_id' AND
+                               article_id = '$id'");
+
+               Labels::clear_cache($id);
+       }
+
+       static function add_article($id, $label, $owner_uid)    {
+
+               $label_id = Labels::find_id($label, $owner_uid);
+
+               if (!$label_id) return;
+
+               $result = db_query(
+                       "SELECT
+                               article_id FROM ttrss_labels2, ttrss_user_labels2
+                       WHERE
+                               label_id = id AND
+                               label_id = '$label_id' AND
+                               article_id = '$id' AND owner_uid = '$owner_uid'
+                       LIMIT 1");
+
+               if (db_num_rows($result) == 0) {
+                       db_query("INSERT INTO ttrss_user_labels2
+                               (label_id, article_id) VALUES ('$label_id', '$id')");
+               }
+
+               Labels::clear_cache($id);
+
+       }
+
+       static function remove($id, $owner_uid) {
+               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
+
+               db_query("BEGIN");
+
+               $result = db_query("SELECT caption FROM ttrss_labels2
+                       WHERE id = '$id'");
+
+               $caption = db_fetch_result($result, 0, "caption");
+
+               $result = db_query("DELETE FROM ttrss_labels2 WHERE id = '$id'
+                       AND owner_uid = " . $owner_uid);
+
+               if (db_affected_rows($result) != 0 && $caption) {
+
+                       /* Remove access key for the label */
+
+                       $ext_id = LABEL_BASE_INDEX - 1 - $id;
+
+                       db_query("DELETE FROM ttrss_access_keys WHERE
+                               feed_id = '$ext_id' AND owner_uid = $owner_uid");
+
+                       /* Remove cached data */
+
+                       db_query("UPDATE ttrss_user_entries SET label_cache = ''
+                               WHERE label_cache LIKE '%$caption%' AND owner_uid = " . $owner_uid);
+
+               }
+
+               db_query("COMMIT");
+       }
+
+       static function create($caption, $fg_color = '', $bg_color = '', $owner_uid = false)    {
+
+               if (!$owner_uid) $owner_uid = $_SESSION['uid'];
+
+               db_query("BEGIN");
+
+               $result = db_query("SELECT id FROM ttrss_labels2
+                       WHERE caption = '$caption' AND owner_uid = $owner_uid");
+
+               if (db_num_rows($result) == 0) {
+                       $result = db_query(
+                               "INSERT INTO ttrss_labels2 (caption,owner_uid,fg_color,bg_color)
+                                       VALUES ('$caption', '$owner_uid', '$fg_color', '$bg_color')");
+
+                       $result = db_affected_rows($result) != 0;
+               }
+
+               db_query("COMMIT");
+
+               return $result;
+       }
+}
\ No newline at end of file
index a3381cc747a617c803797ce9b3e9584db1dd6c2f..0671053c88aba83224f4b1054dd7d80c7669e26e 100644 (file)
@@ -292,9 +292,9 @@ class Opml extends Handler_Protected {
                        $fg_color = $this->dbh->escape_string($attrs->getNamedItem('label-fg-color')->nodeValue);
                        $bg_color = $this->dbh->escape_string($attrs->getNamedItem('label-bg-color')->nodeValue);
 
-                       if (!label_find_id($label_name, $_SESSION['uid'])) {
+                       if (!Labels::find_id($label_name, $_SESSION['uid'])) {
                                $this->opml_notice(T_sprintf("Adding label %s", htmlspecialchars($label_name)));
-                               label_create($label_name, $fg_color, $bg_color, $owner_uid);
+                               Labels::create($label_name, $fg_color, $bg_color, $owner_uid);
                        } else {
                                $this->opml_notice(T_sprintf("Duplicate label: %s", htmlspecialchars($label_name)));
                        }
index c12e76f6b51df68c58283c4bf451f7936f07befd..f1eea93f764bf9deb6035d9549e2ced7b04ea757 100755 (executable)
@@ -171,7 +171,7 @@ class Pref_Feeds extends Handler_Protected {
 
                                while ($line = $this->dbh->fetch_assoc($result)) {
 
-                                       $label_id = label_to_feed_id($line['id']);
+                                       $label_id = Labels::label_to_feed_id($line['id']);
 
                                        $feed = $this->feedlist_init_feed($label_id, false, 0);
 
@@ -1806,7 +1806,7 @@ class Pref_Feeds extends Handler_Protected {
                        CCache::remove($id, $owner_uid);
 
                } else {
-                       label_remove(feed_to_label_id($id), $owner_uid);
+                       Labels::remove(Labels::feed_to_label_id($id), $owner_uid);
                        //CCache::remove($id, $owner_uid); don't think labels are cached
                }
        }
index 26fbb02b1b9532b3753523ecb352e6f6ff301aa5..5720a1f4b8303ebfd5a9fec940303356e0e1f787 100644 (file)
@@ -136,7 +136,7 @@ class Pref_Labels extends Handler_Protected {
                                        AND owner_uid = " . $_SESSION["uid"]);
                        }
 
-                       $caption = $this->dbh->escape_string(label_find_caption($id, $_SESSION["uid"]));
+                       $caption = $this->dbh->escape_string(Labels::find_caption($id, $_SESSION["uid"]));
 
                        /* Remove cached data */
 
@@ -156,7 +156,7 @@ class Pref_Labels extends Handler_Protected {
                                fg_color = '', bg_color = '' WHERE id = '$id'
                                AND owner_uid = " . $_SESSION["uid"]);
 
-                       $caption = $this->dbh->escape_string(label_find_caption($id, $_SESSION["uid"]));
+                       $caption = $this->dbh->escape_string(Labels::find_caption($id, $_SESSION["uid"]));
 
                        /* Remove cached data */
 
@@ -216,7 +216,7 @@ class Pref_Labels extends Handler_Protected {
                $ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
 
                foreach ($ids as $id) {
-                       label_remove($id, $_SESSION["uid"]);
+                       Labels::remove($id, $_SESSION["uid"]);
                }
 
        }
@@ -227,7 +227,7 @@ class Pref_Labels extends Handler_Protected {
 
                if ($caption) {
 
-                       if (label_create($caption)) {
+                       if (Labels::create($caption)) {
                                if (!$output) {
                                        print T_sprintf("Created label <b>%s</b>", htmlspecialchars($caption));
                                }
index 1d52bc62ebd3303312bc6936c92d0f7c7affb8b8..58989d131b6062a88d2c33fd1c468eb4b966477f 100644 (file)
 
        require_once 'db-prefs.php';
        require_once 'version.php';
-       require_once 'labels.php';
        require_once 'controls.php';
 
        define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . VERSION . ' (http://tt-rss.org/)');
 
                while ($line = db_fetch_assoc($result)) {
 
-                       $id = label_to_feed_id($line["id"]);
+                       $id = Labels::label_to_feed_id($line["id"]);
 
                        $cv = array("id" => $id,
                                "counter" => (int) $line["unread"],
diff --git a/include/labels.php b/include/labels.php
deleted file mode 100644 (file)
index f39f092..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-<?php
-       function label_to_feed_id($label) {
-               return LABEL_BASE_INDEX - 1 - abs($label);
-       }
-
-       function feed_to_label_id($feed) {
-               return LABEL_BASE_INDEX - 1 + abs($feed);
-       }
-
-       function label_find_id($label, $owner_uid) {
-               $result = db_query(
-                       "SELECT id FROM ttrss_labels2 WHERE caption = '$label'
-                               AND owner_uid = '$owner_uid' LIMIT 1");
-
-               if (db_num_rows($result) == 1) {
-                       return db_fetch_result($result, 0, "id");
-               } else {
-                       return 0;
-               }
-       }
-
-       function label_find_caption($label, $owner_uid) {
-               $result = db_query(
-                       "SELECT caption FROM ttrss_labels2 WHERE id = '$label'
-                               AND owner_uid = '$owner_uid' LIMIT 1");
-
-               if (db_num_rows($result) == 1) {
-                       return db_fetch_result($result, 0, "caption");
-               } else {
-                       return "";
-               }
-       }
-
-       function get_all_labels($owner_uid) {
-               $rv = array();
-
-               $result = db_query("SELECT fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = " . $owner_uid);
-
-               while ($line = db_fetch_assoc($result)) {
-                       array_push($rv, $line);
-               }
-
-               return $rv;
-       }
-
-       function label_update_cache($owner_uid, $id, $labels = false, $force = false) {
-
-               if ($force)
-                       label_clear_cache($id);
-
-               if (!$labels)
-                       $labels = get_article_labels($id);
-
-               $labels = db_escape_string(json_encode($labels));
-
-               db_query("UPDATE ttrss_user_entries SET
-                       label_cache = '$labels' WHERE ref_id = '$id' AND  owner_uid = '$owner_uid'");
-
-       }
-
-       function label_clear_cache($id) {
-
-               db_query("UPDATE ttrss_user_entries SET
-                       label_cache = '' WHERE ref_id = '$id'");
-
-       }
-
-       function label_remove_article($id, $label, $owner_uid) {
-
-               $label_id = label_find_id($label, $owner_uid);
-
-               if (!$label_id) return;
-
-               db_query(
-                       "DELETE FROM ttrss_user_labels2
-                       WHERE
-                               label_id = '$label_id' AND
-                               article_id = '$id'");
-
-               label_clear_cache($id);
-       }
-
-       function label_add_article($id, $label, $owner_uid) {
-
-               $label_id = label_find_id($label, $owner_uid);
-
-               if (!$label_id) return;
-
-               $result = db_query(
-                       "SELECT
-                               article_id FROM ttrss_labels2, ttrss_user_labels2
-                       WHERE
-                               label_id = id AND
-                               label_id = '$label_id' AND
-                               article_id = '$id' AND owner_uid = '$owner_uid'
-                       LIMIT 1");
-
-               if (db_num_rows($result) == 0) {
-                       db_query("INSERT INTO ttrss_user_labels2
-                               (label_id, article_id) VALUES ('$label_id', '$id')");
-               }
-
-               label_clear_cache($id);
-
-       }
-
-       function label_remove($id, $owner_uid) {
-               if (!$owner_uid) $owner_uid = $_SESSION["uid"];
-
-               db_query("BEGIN");
-
-               $result = db_query("SELECT caption FROM ttrss_labels2
-                       WHERE id = '$id'");
-
-               $caption = db_fetch_result($result, 0, "caption");
-
-               $result = db_query("DELETE FROM ttrss_labels2 WHERE id = '$id'
-                       AND owner_uid = " . $owner_uid);
-
-               if (db_affected_rows($result) != 0 && $caption) {
-
-                       /* Remove access key for the label */
-
-                       $ext_id = LABEL_BASE_INDEX - 1 - $id;
-
-                       db_query("DELETE FROM ttrss_access_keys WHERE
-                               feed_id = '$ext_id' AND owner_uid = $owner_uid");
-
-                       /* Remove cached data */
-
-                       db_query("UPDATE ttrss_user_entries SET label_cache = ''
-                               WHERE label_cache LIKE '%$caption%' AND owner_uid = " . $owner_uid);
-
-               }
-
-               db_query("COMMIT");
-       }
-
-       function label_create($caption, $fg_color = '', $bg_color = '', $owner_uid = false) {
-
-               if (!$owner_uid) $owner_uid = $_SESSION['uid'];
-
-               db_query("BEGIN");
-
-               $result = false;
-
-               $result = db_query("SELECT id FROM ttrss_labels2
-                       WHERE caption = '$caption' AND owner_uid = $owner_uid");
-
-               if (db_num_rows($result) == 0) {
-                       $result = db_query(
-                               "INSERT INTO ttrss_labels2 (caption,owner_uid,fg_color,bg_color)
-                                       VALUES ('$caption', '$owner_uid', '$fg_color', '$bg_color')");
-
-                       $result = db_affected_rows($result) != 0;
-               }
-
-               db_query("COMMIT");
-
-               return $result;
-       }
index d816450fccefbd73e324c03cfb389569460e52fa..33b6ff6e4018f1df17948ce158ecb36c2c37ec85 100644 (file)
                                _debug("assigning labels [other]...", $debug_enabled);
 
                                foreach ($article_labels as $label) {
-                                       label_add_article($entry_ref_id, $label[1], $owner_uid);
+                                       Labels::add_article($entry_ref_id, $label[1], $owner_uid);
                                }
 
                                _debug("assigning labels [filters]...", $debug_enabled);
                foreach ($filters as $f) {
                        if ($f["type"] == "label") {
                                if (!labels_contains_caption($article_labels, $f["param"])) {
-                                       label_add_article($id, $f["param"], $owner_uid);
+                                       Labels::add_article($id, $f["param"], $owner_uid);
                                }
                        }
                }
index 4592175e36d358a034de59457cc5308d33ea8189..1209a02abde5d065e9aae6d11a8552c668fa1c86 100644 (file)
@@ -21,7 +21,7 @@ class Auto_Assign_Labels extends Plugin {
                $result = db_query("SELECT id, fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = " . $owner_uid);
 
                while ($line = db_fetch_assoc($result)) {
-                       array_push($rv, array(label_to_feed_id($line["id"]),
+                       array_push($rv, array(Labels::label_to_feed_id($line["id"]),
                                $line["caption"], $line["fg_color"], $line["bg_color"]));
                }
 
index ec618b72352c977c09767707935d62a9965b145c..27cb736983f4d121a58c7ce3e2dac775af0f68dd 100644 (file)
@@ -378,10 +378,10 @@ class Import_Export extends Plugin implements IHandler {
                                                                if (is_array($label_cache) && $label_cache["no-labels"] != 1) {
                                                                        foreach ($label_cache as $label) {
 
-                                                                               label_create($label[1],
+                                                                               Labels::create($label[1],
                                                                                        $label[2], $label[3], $owner_uid);
 
-                                                                               label_add_article($ref_id, $label[1], $owner_uid);
+                                                                               Labels::add_article($ref_id, $label[1], $owner_uid);
 
                                                                        }
                                                                }
index dd372ce5e971554d342353d748fc15bde0d640e4..65cdf30e4854ec74121b19c3dc1112ded853debf 100644 (file)
@@ -62,7 +62,7 @@ class Note extends Plugin {
                db_query("UPDATE ttrss_user_entries SET note = '$note'
                        WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
 
-               $formatted_note = format_article_note($id, $note);
+               $formatted_note = Article::format_article_note($id, $note);
 
                print json_encode(array("note" => $formatted_note,
                                "raw_length" => mb_strlen($note)));
index 1f52d44a964cb6918227a21fe52893bd86508359..24f474e512e697b89c31218c1c6a3d9e62708b8e 100644 (file)
@@ -211,7 +211,7 @@ final class ApiTest extends TestCase {
        public function testLabels() {
                // create label
 
-               label_create('Test', '', '', 1);
+               Labels::create('Test', '', '', 1);
 
                $this->testLogin();
                $ret = $this->apiCall([], "getLabels");
@@ -219,7 +219,7 @@ final class ApiTest extends TestCase {
 
                $this->assertEquals('Test', $ret['content'][0]['caption']);
                $label_feed_id = $ret['content'][0]['id'];
-               $label_id = feed_to_label_id($label_feed_id);
+               $label_id = Labels::feed_to_label_id($label_feed_id);
 
                $this->assertLessThan(0, $label_feed_id);
                $this->assertGreaterThan(0, $label_id);
@@ -246,7 +246,7 @@ final class ApiTest extends TestCase {
 
                // clean up and check
 
-               label_remove($label_id, 1);
+               Labels::remove($label_id, 1);
 
                $ret = $this->apiCall([], "getLabels");
                $this->assertEmpty($ret['content']);