aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-11-08 17:13:51 +0100
committerLaria Carolin Chabowski <laria@laria.me>2020-11-08 17:13:51 +0100
commit743c562ac9a8d8df7a176a989ebee36ad2acbfb7 (patch)
treea36d2e7e7226d12aa55b912f77e9ac0c7e873b89
parent05b42c3327a14351692330bdc299dd011cd03dc4 (diff)
downloadratatoeskr-cms-743c562ac9a8d8df7a176a989ebee36ad2acbfb7.tar.gz
ratatoeskr-cms-743c562ac9a8d8df7a176a989ebee36ad2acbfb7.tar.bz2
ratatoeskr-cms-743c562ac9a8d8df7a176a989ebee36ad2acbfb7.zip
Move article status consts into Article class
-rw-r--r--ratatoeskr/backend.php2
-rw-r--r--ratatoeskr/frontend.php2
-rw-r--r--ratatoeskr/setup/setup.php2
-rw-r--r--ratatoeskr/sys/models.php25
4 files changed, 14 insertions, 17 deletions
diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php
index 597e1d5..23568a1 100644
--- a/ratatoeskr/backend.php
+++ b/ratatoeskr/backend.php
@@ -379,7 +379,7 @@ function build_backend_subactions()
$inputs["date"] = time();
}
if (!isset($inputs["article_status"])) {
- $inputs["article_status"] = ARTICLE_STATUS_LIVE;
+ $inputs["article_status"] = Article::STATUS_LIVE;
}
/* Push data back to template */
diff --git a/ratatoeskr/frontend.php b/ratatoeskr/frontend.php
index 0bac1e4..56bb231 100644
--- a/ratatoeskr/frontend.php
+++ b/ratatoeskr/frontend.php
@@ -169,7 +169,7 @@ function comment_transform_ste($comment)
* urlname - (optional) Filter by urlname.
* section - (optional) Filter by section (section name).
* sectionvar - (optional) Filter by section (Name of variable that contains a section).
- * status - (optional) Filter by status (numeric, <ARTICLE_STATUS_>).
+ * status - (optional) Filter by status (numeric, <Article::STATUS_>).
* tag - (optional) Filter by tag (tag name).
* tagvar - (optional) Filter by tag (Name of variable that contains a tag).
* sort - (optional) How to sort. Format: "fieldname direction" where fieldname is one of [id, urlname, title, timestamp] and direction is one of [asc, desc].
diff --git a/ratatoeskr/setup/setup.php b/ratatoeskr/setup/setup.php
index d096afd..7fc4bb7 100644
--- a/ratatoeskr/setup/setup.php
+++ b/ratatoeskr/setup/setup.php
@@ -228,7 +228,7 @@ STYLE;
$article->title["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "");
$article->text["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
$article->excerpt["en"] = new Translation("Congratulations! You have just installed Ratatöskr!", "Markdown");
- $article->status = ARTICLE_STATUS_LIVE;
+ $article->status = Article::STATUS_LIVE;
$article->timestamp = time();
$article->allow_comments = true;
$article->set_section($section);
diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php
index 74d4419..d51bb1f 100644
--- a/ratatoeskr/sys/models.php
+++ b/ratatoeskr/sys/models.php
@@ -36,18 +36,6 @@ require_once(dirname(__FILE__) . "/pluginpackage.php");
$ratatoeskr_settings = null;
/*
- * Constants: ARTICLE_STATUS_
- * Possible <Article>::$status values.
- *
- * ARTICLE_STATUS_HIDDEN - Article is hidden (Numeric: 0)
- * ARTICLE_STATUS_LIVE - Article is visible / live (Numeric: 1)
- * ARTICLE_STATUS_STICKY - Article is sticky (Numeric: 2)
- */
-define("ARTICLE_STATUS_HIDDEN", 0);
-define("ARTICLE_STATUS_LIVE", 1);
-define("ARTICLE_STATUS_STICKY", 2);
-
-/*
* Class: DoesNotExistError
* This Exception is thrown by an ::by_*-constructor or any array-like object if the desired object is not present in the database.
*/
@@ -2636,6 +2624,15 @@ class Repository extends BySQLRowEnabled
*/
class Article extends BySQLRowEnabled
{
+ /** @var int Article is hidden (Numeric: 0) */
+ public const STATUS_HIDDEN = 0;
+
+ /** @var int Article is visible / live (Numeric: 1) */
+ public const STATUS_LIVE = 1;
+
+ /** @var int Article is sticky (Numeric: 2) */
+ public const STATUS_STICKY = 2;
+
/** @var int */
private $id;
@@ -2666,7 +2663,7 @@ class Article extends BySQLRowEnabled
/** @var Image|null The article image. If none: null */
public $article_image = null;
- /** @var int One of the ARTICLE_STATUS_* constants */
+ /** @var int One of the self::STATUS_* constants */
public $status;
/** @var int Timestamp */
@@ -2750,7 +2747,7 @@ class Article extends BySQLRowEnabled
$obj->meta = "";
$obj->custom = [];
$obj->article_image = null;
- $obj->status = ARTICLE_STATUS_HIDDEN;
+ $obj->status = self::STATUS_HIDDEN;
$obj->section_id = $ratatoeskr_settings["default_section"];
$obj->timestamp = time();
$obj->allow_comments = $ratatoeskr_settings["allow_comments_default"];