diff --git a/.gitignore b/.gitignore
index a0bc42b..75be1b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.idea
-
+vendor
+composer.lock
Thumbs.db
diff --git a/components/API.php b/components/API.php
index 1ddcbed..9681354 100644
--- a/components/API.php
+++ b/components/API.php
@@ -3,6 +3,10 @@
use Yii;
+/**
+ * Base API class
+ * @package yii\easyii\components
+ */
class API extends \yii\base\Object
{
static $classes;
diff --git a/components/ActiveQuery.php b/components/ActiveQuery.php
index 369703c..86cf93c 100644
--- a/components/ActiveQuery.php
+++ b/components/ActiveQuery.php
@@ -1,6 +1,10 @@
getSession()->setFlash($type=='error'?'danger':$type, $message);
}
+ /**
+ * Redirect user back one step
+ * @return \yii\web\Response
+ */
public function back()
{
return $this->redirect(Yii::$app->request->referrer);
diff --git a/components/Module.php b/components/Module.php
index aa0f07b..8cc5c98 100644
--- a/components/Module.php
+++ b/components/Module.php
@@ -4,6 +4,10 @@
use Yii;
use yii\easyii\models\Module as ModuleModel;
+/**
+ * Base Module class
+ * @package yii\easyii\components
+ */
class Module extends \yii\base\Module
{
public $defaultRoute = 'a';
@@ -49,6 +53,12 @@ public static function registerTranslations($moduleName)
}
}
+ /**
+ * Returns a module name based on namespace
+ *
+ * @param $namespace
+ * @return string|bool
+ */
public static function getModuleName($namespace)
{
foreach(ModuleModel::findAllActive() as $module)
diff --git a/modules/article/api/Article.php b/modules/article/api/Article.php
index ad59309..bba6050 100644
--- a/modules/article/api/Article.php
+++ b/modules/article/api/Article.php
@@ -11,6 +11,16 @@
use yii\easyii\modules\article\models\Category;
use yii\easyii\modules\article\models\Item;
+/**
+ * Class Article
+ * @package yii\easyii\modules\article\api
+ *
+ * @method static \stdClass cat(mixed $id_slug) Get article category by id or slug
+ * @method static array cats(array $options = []) Get article categories
+ * @method static \stdClass item(mixed $id_slug) Get article item by id or slug
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class Article extends \yii\easyii\components\API
{
private $_cats;
@@ -210,7 +220,7 @@ private function notFound($id_slug)
elseif(preg_match(Category::$SLUG_PATTERN, $id_slug)){
- return $this->createCatObject(''.Yii::t('easyii/article/api', 'Create category').'');
+ return $this->createCatObject(''.Yii::t('easyii/article/api', 'Create category').'');
}
else{
return $this->createCatObject($this->errorText('WRONG CATEGORY IDENTIFIER'));
diff --git a/modules/carousel/api/Carousel.php b/modules/carousel/api/Carousel.php
index 5a1a98e..ebfbdb9 100644
--- a/modules/carousel/api/Carousel.php
+++ b/modules/carousel/api/Carousel.php
@@ -6,6 +6,11 @@
use yii\easyii\helpers\Data;
use yii\easyii\modules\carousel\models\Carousel as CarouselModel;
+/**
+ * Carousel API
+ * @package yii\easyii\modules\carousel\api
+ * @method static string widgets(array $options = []) Bootstrap carousel widget
+ */
class Carousel extends \yii\easyii\components\API
{
public $clientOptions = ['interval' => 5000];
diff --git a/modules/catalog/api/Catalog.php b/modules/catalog/api/Catalog.php
index e127793..ccc6ac3 100644
--- a/modules/catalog/api/Catalog.php
+++ b/modules/catalog/api/Catalog.php
@@ -11,6 +11,18 @@
use yii\easyii\modules\catalog\models\Category;
use yii\easyii\modules\catalog\models\Item;
+/**
+ * Class Catalog
+ * @package yii\easyii\modules\catalog\api
+ *
+ * @method static \stdClass cat(mixed $id_slug) Get catalog category by id or slug
+ * @method static array cats(array $options = []) Get catalog categories
+ * @method static \stdClass item(mixed $id_slug) Get catalog item by id or slug
+ * @method static string photo(int $id) Get catalog photo by ID
+ * @method static void plugin(array $options = []) On all your photos, called as $photo->box, will be apply Fancybox plugin.
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class Catalog extends \yii\easyii\components\API
{
private $_cats;
diff --git a/modules/faq/api/Faq.php b/modules/faq/api/Faq.php
index 36d52e5..d43d2da 100644
--- a/modules/faq/api/Faq.php
+++ b/modules/faq/api/Faq.php
@@ -5,6 +5,12 @@
use yii\easyii\helpers\Data;
use yii\easyii\modules\faq\models\Faq as FaqModel;
+/**
+ * FAQ API
+ * @package yii\easyii\modules\faq\api
+ *
+ * @method static array all() array of all FAQ as stdClass objects
+ */
class Faq extends \yii\easyii\components\API
{
public function api_all()
diff --git a/modules/feedback/api/Feedback.php b/modules/feedback/api/Feedback.php
index f0e5a42..392e1c5 100644
--- a/modules/feedback/api/Feedback.php
+++ b/modules/feedback/api/Feedback.php
@@ -10,6 +10,13 @@
use yii\bootstrap\Alert;
use yii\easyii\widgets\ReCaptcha;
+/**
+ * Feedback module API
+ * @package yii\easyii\modules\feedback\api
+ *
+ * @method static string form() Returns fully worked standalone html form.
+ * @method static array create(array $attributes) If you using your own form, this function will be useful for manual saving feedback's.
+ */
class Feedback extends \yii\easyii\components\API
{
public function api_form()
diff --git a/modules/file/api/File.php b/modules/file/api/File.php
index 15f3b55..16715bc 100644
--- a/modules/file/api/File.php
+++ b/modules/file/api/File.php
@@ -7,6 +7,16 @@
use yii\easyii\modules\file\models\File as FileModel;
use yii\widgets\LinkPager;
+/**
+ * File module API
+ * @package yii\easyii\modules\file\api
+ *
+ * @method static \stdClass get(mixed $id_slug) Get a file by ID or slug
+ * @method static array all(array $options = []) Get all files
+ * @method static mixed last(int $limit = 1) Get last files
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class File extends \yii\easyii\components\API
{
private $_files = [];
diff --git a/modules/gallery/api/Gallery.php b/modules/gallery/api/Gallery.php
index 4869184..6b12fa1 100644
--- a/modules/gallery/api/Gallery.php
+++ b/modules/gallery/api/Gallery.php
@@ -10,6 +10,17 @@
use yii\easyii\widgets\Fancybox;
use yii\easyii\modules\gallery\models\Album;
+/**
+ * Gallery module API
+ * @package yii\easyii\modules\gallery\api
+ *
+ * @method static \stdClass album(mixed $id_slug) Get album by id or slug
+ * @method static array albums(array $options = []) Get albums
+ * @method static string photo(int $id) Get catalog photo by ID
+ * @method static void plugin(array $options = []) On all your photos, called as $photo->box, will be apply Fancybox plugin.
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class Gallery extends \yii\easyii\components\API
{
private $_albums;
diff --git a/modules/guestbook/api/Guestbook.php b/modules/guestbook/api/Guestbook.php
index 5efb7c9..7448dfa 100644
--- a/modules/guestbook/api/Guestbook.php
+++ b/modules/guestbook/api/Guestbook.php
@@ -12,7 +12,17 @@
use yii\easyii\modules\guestbook\models\Guestbook as GuestbookModel;
use yii\easyii\widgets\ReCaptcha;
-
+/**
+ * Guestbook module API
+ * @package yii\easyii\modules\guestbook\api
+ *
+ * @method static string form() Returns fully worked standalone html form.
+ * @method static array all(array $options = []) Get all posts
+ * @method static array create(array $attributes) If you using your own form, this function will be useful for manual saving guestbook posts.
+ * @method static mixed last(int $limit = 1) Get last posts
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class Guestbook extends \yii\easyii\components\API
{
private $_adp;
diff --git a/modules/news/api/News.php b/modules/news/api/News.php
index e195106..f068c90 100644
--- a/modules/news/api/News.php
+++ b/modules/news/api/News.php
@@ -8,6 +8,16 @@
use yii\easyii\modules\news\models\News as NewsModel;
+/**
+ * Class News
+ * @package yii\easyii\modules\news\api
+ *
+ * @method static \stdClass get(mixed $id_slug) Get news object by id or slug
+ * @method static array all(array $options = []) Get all news
+ * @method static mixed last(int $limit = 1) Get last posts
+ * @method static string pages() returns pagination html generated by yii\widgets\LinkPager widget.
+ * @method static \stdClass pagination() returns yii\data\Pagination object.
+ */
class News extends \yii\easyii\components\API
{
private $_adp;
diff --git a/modules/page/api/Page.php b/modules/page/api/Page.php
index c7a321b..07ee6b7 100644
--- a/modules/page/api/Page.php
+++ b/modules/page/api/Page.php
@@ -5,10 +5,20 @@
use yii\helpers\Url;
use yii\easyii\modules\page\models\Page as PageModel;
+/**
+ * Page API
+ * @package yii\easyii\modules\page\api
+ *
+ * @method static \stdClass get(mixed $id_slug) Get page object by id or slug
+ */
class Page extends \yii\easyii\components\API
{
private $_pages = [];
+ /**
+ * @param $id_slug
+ * @return mixed
+ */
public function api_get($id_slug)
{
if(!isset($this->_pages[$id_slug])){
@@ -17,6 +27,12 @@ public function api_get($id_slug)
return $this->_pages[$id_slug];
}
+ /**
+ * Find page by id or slug
+ *
+ * @param $id_slug
+ * @return object
+ */
private function findPage($id_slug)
{
$page = PageModel::find()->where(['or', 'page_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id_slug])->one();
diff --git a/modules/subscribe/api/Subscribe.php b/modules/subscribe/api/Subscribe.php
index e441774..fa78574 100644
--- a/modules/subscribe/api/Subscribe.php
+++ b/modules/subscribe/api/Subscribe.php
@@ -8,6 +8,13 @@
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
+/**
+ * Class Subscribe
+ * @package yii\easyii\modules\subscribe\api
+ *
+ * @method static string form() Returns fully working standalone html form.
+ * @method static array create(array $attributes) If you are using your own form, this function will be useful for manual saving of subscribers.
+ */
class Subscribe extends \yii\easyii\components\API
{
public $options = [