diff --git a/includes/class-CategoryTemplated.php b/includes/class-CategoryTemplated.php index 990e33a..309a7ab 100644 --- a/includes/class-CategoryTemplated.php +++ b/includes/class-CategoryTemplated.php @@ -1,128 +1,128 @@ . namespace itwikidelbot; /** * Handle a generic category associated to a template */ abstract class CategoryTemplated extends Category { /** * Template name of this category * * To be overrided */ const TEMPLATE_NAME = 'EXAMPLE_NAME'; /** * Constructor * * @param $args Template arguments */ public function __construct() { parent::__construct( $this->getTemplatedTitle() ); } /** * Get the name of the template * * @return string */ public function getTemplateName() { return static::TEMPLATE_NAME; } /** * Get the name of the template for the page title * * @return string */ public function getTemplateTitleName() { - return $this->getTemplateName() . '_TITLE'; + return $this->getTemplateName() . '.title'; } /** * Get the name of the template for the summary * * @return string */ public function getTemplateSummaryName() { - return $this->getTemplateName() . '_SUMMARY'; + return $this->getTemplateName() . '.summary'; } /** * Get the name of the template for the content */ public function getTemplateContentName() { - return $this->getTemplateName() . '_CONTENT'; + return $this->getTemplateName() . '.content'; } /** * Get the template arguments * * @return array */ abstract public function getTemplateArguments(); /** * Get the edit summary for this category from its template * * @return string */ public function getTemplatedSummary() { return Template::get( $this->getTemplateSummaryName(), $this->getTemplateArguments() ); } /** * Get the page title from its template * * @return string */ public function getTemplatedTitle() { return Template::get( $this->getTemplateTitleName(), $this->getTemplateArguments() ); } /** * Get the page content for this category from its template * * @return string */ public function getTemplatedContent() { return Template::get( $this->getTemplateContentName(), $this->getTemplateArguments() ); } /** * Save this category from the content of its template * * @return mixed */ public function save() { return $this->saveByContentSummary( $this->getTemplatedContent(), $this->getTemplatedSummary() ); } /** * Save this category from the content of its template if it does not exist * * @return self */ public function saveIfNotExists() { if( ! $this->exists() ) { $this->save(); } return $this; } } diff --git a/templates/CATEGORY_DAY_CONTENT.tpl b/templates/CATEGORY_CONSENSUAL.content.tpl similarity index 56% copy from templates/CATEGORY_DAY_CONTENT.tpl copy to templates/CATEGORY_CONSENSUAL.content.tpl index c73885f..748c744 100644 --- a/templates/CATEGORY_DAY_CONTENT.tpl +++ b/templates/CATEGORY_CONSENSUAL.content.tpl @@ -1,21 +1,21 @@ -This is the template for the content of a daily category. +This is the template for the content of a daily consensual category. Placeholders: %1$s: category title %2$d: year %3$d: month 1-12 %3$02d: month 01-12 %4$s: month name %5$d: day 1-31 %5$02d: day 01-31 -{{Cancellazione/cat|2018/4/19}} +{{Cancellazione/cat|2018/4/13}} -[[Categoria:Cancellazioni - aprile 2018| 19022018]] +[[Categoria:Cancellazioni del 13 aprile 2018| consensuale]] {{Cancellazione/cat|%2$d/%3$d/%5$d}} -[[Categoria:Cancellazioni - %4$s %2$d| %5$02d%3$02d%2$d]] +[[Categoria:Cancellazioni del %5$d %4$s %2$d| consensuale]] diff --git a/templates/CATEGORY_DAY_CONTENT.tpl b/templates/CATEGORY_DAY.content.tpl similarity index 100% rename from templates/CATEGORY_DAY_CONTENT.tpl rename to templates/CATEGORY_DAY.content.tpl diff --git a/templates/CATEGORY_DAY_SUMMARY.tpl b/templates/CATEGORY_DAY.summary.tpl similarity index 100% rename from templates/CATEGORY_DAY_SUMMARY.tpl rename to templates/CATEGORY_DAY.summary.tpl diff --git a/templates/CATEGORY_DAY_TITLE.tpl b/templates/CATEGORY_DAY.title.tpl similarity index 100% rename from templates/CATEGORY_DAY_TITLE.tpl rename to templates/CATEGORY_DAY.title.tpl diff --git a/templates/CATEGORY_MONTH_CONTENT.tpl b/templates/CATEGORY_MONTH.content.tpl similarity index 100% rename from templates/CATEGORY_MONTH_CONTENT.tpl rename to templates/CATEGORY_MONTH.content.tpl diff --git a/templates/CATEGORY_MONTH_SUMMARY.tpl b/templates/CATEGORY_MONTH.summary.tpl similarity index 100% rename from templates/CATEGORY_MONTH_SUMMARY.tpl rename to templates/CATEGORY_MONTH.summary.tpl diff --git a/templates/CATEGORY_MONTH_TITLE.tpl b/templates/CATEGORY_MONTH.title.tpl similarity index 100% rename from templates/CATEGORY_MONTH_TITLE.tpl rename to templates/CATEGORY_MONTH.title.tpl diff --git a/templates/CATEGORY_YEAR_CONTENT.tpl b/templates/CATEGORY_YEAR.content.tpl similarity index 100% rename from templates/CATEGORY_YEAR_CONTENT.tpl rename to templates/CATEGORY_YEAR.content.tpl diff --git a/templates/CATEGORY_YEAR_SUMMARY.tpl b/templates/CATEGORY_YEAR.summary.tpl similarity index 100% rename from templates/CATEGORY_YEAR_SUMMARY.tpl rename to templates/CATEGORY_YEAR.summary.tpl diff --git a/templates/CATEGORY_YEAR_TITLE.tpl b/templates/CATEGORY_YEAR.title.tpl similarity index 100% rename from templates/CATEGORY_YEAR_TITLE.tpl rename to templates/CATEGORY_YEAR.title.tpl