Commit 280e92c2fbdbb8872e9c5c680fa06ed7feee396f

Authored by Dmitryi
1 parent 823ef13e

авторизация через соц сети

Showing 47 changed files with 1191 additions and 435 deletions   Show diff stats
common/config/main.php
... ... @@ -40,6 +40,125 @@ return [
40 40 'authManager' => [
41 41 'class' => 'yii\rbac\DbManager',
42 42 ],
  43 +
  44 + //подключаем конфигурации API соц сетей для авторизации
  45 +
  46 + 'eauth' => [
  47 + 'class' => 'nodge\eauth\EAuth',
  48 + 'popup' => true, // Use the popup window instead of redirecting.
  49 + 'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache' on production environments.
  50 + 'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited.
  51 + 'httpClient' => [
  52 + // uncomment this to use streams in safe_mode
  53 + //'useStreamsFallback' => true,
  54 + ],
  55 + 'services' => [ // You can change the providers and their classes.
  56 + 'google' => [
  57 + // register your app here: https://code.google.com/apis/console/
  58 + 'class' => 'nodge\eauth\services\GoogleOAuth2Service',
  59 + 'clientId' => 'artbox-1138',
  60 + 'clientSecret' => '',
  61 + 'title' => 'Google',
  62 + ],
  63 + 'twitter' => [
  64 + // register your app here: https://dev.twitter.com/apps/new
  65 + 'class' => 'nodge\eauth\services\TwitterOAuth1Service',
  66 + 'key' => '8vReLxI63vTs98MBMqhvrszwy',
  67 + 'secret' => 'jOqNbHIkQw4cVKKJkgrMtaEeCcfbeT1GTik4pF6O9D7AmqcwOG',
  68 + ],
  69 + 'yandex' => [
  70 + // register your app here: https://oauth.yandex.ru/client/my
  71 + 'class' => 'nodge\eauth\services\YandexOAuth2Service',
  72 + 'clientId' => 'ea13195ac0424ff8a190838bec41bb71',
  73 + 'clientSecret' => '911f2c9afcbf4f5f9319b3134c096c86',
  74 + 'title' => 'Yandex',
  75 + ],
  76 + 'facebook' => [
  77 + // register your app here: https://developers.facebook.com/apps/
  78 + 'class' => 'nodge\eauth\services\FacebookOAuth2Service',
  79 + 'clientId' => '1642047622727997',
  80 + 'clientSecret' => 'f5b7ba4f062a568678b764fc74cc416e',
  81 + ],
  82 + 'yahoo' => [
  83 + 'class' => 'nodge\eauth\services\YahooOpenIDService',
  84 + //'realm' => '*.example.org', // your domain, can be with wildcard to authenticate on subdomains.
  85 + ],
  86 + 'linkedin' => [
  87 + // register your app here: https://www.linkedin.com/secure/developer
  88 + 'class' => 'nodge\eauth\services\LinkedinOAuth1Service',
  89 + 'key' => '77s41eixn3dyvo',
  90 + 'secret' => '1xLZQ7RRK6RNjo4U',
  91 + 'title' => 'LinkedIn (OAuth1)',
  92 + ],
  93 + 'linkedin_oauth2' => [
  94 + // register your app here: https://www.linkedin.com/secure/developer
  95 + 'class' => 'nodge\eauth\services\LinkedinOAuth2Service',
  96 + 'clientId' => '77s41eixn3dyvo',
  97 + 'clientSecret' => '1xLZQ7RRK6RNjo4U',
  98 + 'title' => 'LinkedIn (OAuth2)',
  99 + ],
  100 + 'github' => [
  101 + // register your app here: https://github.com/settings/applications
  102 + 'class' => 'nodge\eauth\services\GitHubOAuth2Service',
  103 + 'clientId' => 'd00283b5cfb225cd1600',
  104 + 'clientSecret' => 'f482361fad7184819d452f421c8b09db60830b42',
  105 + ],
  106 + 'live' => [
  107 + // register your app here: https://account.live.com/developers/applications/index
  108 + 'class' => 'nodge\eauth\services\LiveOAuth2Service',
  109 + 'clientId' => '00000000481796AE',
  110 + 'clientSecret' => 'rt9GiJrlKz3sE6CvdOeuwWyYbl1tQT03',
  111 + ],
  112 + 'steam' => [
  113 + 'class' => 'nodge\eauth\services\SteamOpenIDService',
  114 + //'realm' => '*.example.org', // your domain, can be with wildcard to authenticate on subdomains.
  115 + ],
  116 + 'instagram' => [
  117 + // register your app here: https://instagram.com/developer/register/
  118 + 'class' => 'nodge\eauth\services\InstagramOAuth2Service',
  119 + 'clientId' => '...',
  120 + 'clientSecret' => '...',
  121 + ],
  122 + 'vkontakte' => [
  123 + // register your app here: https://vk.com/editapp?act=create&site=1
  124 + 'class' => 'nodge\eauth\services\VKontakteOAuth2Service',
  125 + 'clientId' => '5155388',
  126 + 'clientSecret' => 'jxgmdGVQw7huGKRpnX3a',
  127 + ],
  128 + 'mailru' => [
  129 + // register your app here: http://api.mail.ru/sites/my/add
  130 + 'class' => 'nodge\eauth\services\MailruOAuth2Service',
  131 + 'clientId' => '739322',
  132 + 'clientSecret' => 'd6ce7be6ff791375adff58fe0e4460b2',
  133 + ],
  134 + 'odnoklassniki' => [
  135 + // register your app here: http://dev.odnoklassniki.ru/wiki/pages/viewpage.action?pageId=13992188
  136 + // ... or here: http://www.odnoklassniki.ru/dk?st.cmd=appsInfoMyDevList&st._aid=Apps_Info_MyDev
  137 + 'class' => 'nodge\eauth\services\OdnoklassnikiOAuth2Service',
  138 + 'clientId' => '...',
  139 + 'clientSecret' => '...',
  140 + 'clientPublic' => '...',
  141 + 'title' => 'Odnoklas.',
  142 + ],
  143 + ],
  144 + ],
  145 +
  146 + // (optionally) you can configure logging
  147 + 'log' => [
  148 + 'targets' => [
  149 + [
  150 + 'class' => 'yii\log\FileTarget',
  151 + 'logFile' => '@app/runtime/logs/eauth.log',
  152 + 'categories' => ['nodge\eauth\*'],
  153 + 'logVars' => [],
  154 + ],
  155 + ],
  156 + ],
  157 +
  158 + /*========End=======
  159 + *end api sicial
  160 + * */
  161 +
43 162 ],
44 163 'language' => 'ru-RU'
45 164 ];
... ...
common/models/LoginForm.php
1 1 <?php
2 2 namespace common\models;
3   -
4 3 use Yii;
5 4 use yii\base\Model;
6   -
7 5 /**
8   - * Login form
  6 + * LoginForm is the model behind the login form.
9 7 */
10 8 class LoginForm extends Model
11 9 {
12 10 public $username;
13 11 public $password;
14 12 public $rememberMe = true;
15   -
16   - private $_user;
17   -
18   -
  13 +
  14 + private $_user = false;
19 15 /**
20   - * @inheritdoc
  16 + * @return array the validation rules.
21 17 */
22 18 public function rules()
23 19 {
24   - return [
  20 + return array(
25 21 // username and password are both required
26   - [['username', 'password'], 'required'],
27   - // rememberMe must be a boolean value
28   - ['rememberMe', 'boolean'],
  22 + array(array('username', 'password'), 'required'),
29 23 // password is validated by validatePassword()
30   - ['password', 'validatePassword'],
31   - ];
  24 + array('password', 'validatePassword'),
  25 + // rememberMe must be a boolean value
  26 + array('rememberMe', 'boolean'),
  27 + );
32 28 }
33   -
34 29 /**
35 30 * Validates the password.
36 31 * This method serves as the inline validation for password.
37   - *
38   - * @param string $attribute the attribute currently being validated
39   - * @param array $params the additional name-value pairs given in the rule
40 32 */
41   - public function validatePassword($attribute, $params)
  33 + public function validatePassword()
42 34 {
43   - if (!$this->hasErrors()) {
44   - $user = $this->getUser();
45   - if (!$user || !$user->validatePassword($this->password)) {
46   - $this->addError($attribute, 'Incorrect username or password.');
47   - }
  35 + $user = $this->getUser();
  36 + if (!$user || !$user->validatePassword($this->password)) {
  37 + $this->addError('password', 'Incorrect username or password.');
48 38 }
49 39 }
50   -
51 40 /**
52 41 * Logs in a user using the provided username and password.
53   - *
54 42 * @return boolean whether the user is logged in successfully
55 43 */
56 44 public function login()
57 45 {
58 46 if ($this->validate()) {
59   - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
  47 + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
60 48 } else {
61 49 return false;
62 50 }
63 51 }
64   -
65 52 /**
66 53 * Finds user by [[username]]
67 54 *
68 55 * @return User|null
69 56 */
70   - protected function getUser()
  57 + private function getUser()
71 58 {
72   - if ($this->_user === null) {
  59 + if ($this->_user === false) {
73 60 $this->_user = User::findByUsername($this->username);
74 61 }
75   -
76 62 return $this->_user;
77 63 }
78 64 -}
  65 +}
79 66 \ No newline at end of file
... ...
common/models/User.php
... ... @@ -24,8 +24,13 @@ use developeruz\db_rbac\interfaces\UserRbacInterface;
24 24 */
25 25 class User extends ActiveRecord implements IdentityInterface, UserRbacInterface
26 26 {
  27 + /**
  28 + * @var array EAuth attributes
  29 + */
  30 +
27 31 const STATUS_DELETED = 0;
28 32 const STATUS_ACTIVE = 10;
  33 + public $profile;
29 34  
30 35 /**
31 36 * @inheritdoc
... ... @@ -59,10 +64,36 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface
59 64 /**
60 65 * @inheritdoc
61 66 */
62   - public static function findIdentity($id)
63   - {
64   - return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]);
65   - }
  67 + public static function findIdentity($id) {
  68 + if (Yii::$app->getSession()->has('user-'.$id)) {
  69 + return new self(Yii::$app->getSession()->get('user-'.$id));
  70 + }
  71 + else {
  72 + return isset(self::$users[$id]) ? new self(self::$users[$id]) : null;
  73 + }
  74 + }
  75 + /**
  76 + * @param \nodge\eauth\ServiceBase $service
  77 + * @return User
  78 + * @throws ErrorException
  79 + */
  80 + public static function findByEAuth($service) {
  81 + if (!$service->getIsAuthenticated()) {
  82 + throw new ErrorException('EAuth user should be authenticated before creating identity.');
  83 + }
  84 + $id = $service->getServiceName().'-'.$service->getId();
  85 + $attributes = array(
  86 + 'id' => $id,
  87 + 'username' => $service->getAttribute('name'),
  88 + 'authKey' => md5($id),
  89 + 'profile' => $service->getAttributes(),
  90 + );
  91 + $attributes['profile']['service'] = $service->getServiceName();
  92 + Yii::$app->getSession()->set('user-'.$id, $attributes);
  93 + return new self($attributes);
  94 + }
  95 +
  96 + public $authKey;
66 97  
67 98 /**
68 99 * @inheritdoc
... ...
composer.json
... ... @@ -21,7 +21,8 @@
21 21 "dmstr/yii2-adminlte-asset": "2.*",
22 22 "yiisoft/yii2-jui": "^2.0",
23 23 "kartik-v/yii2-widget-select2": "@dev",
24   - "developeruz/yii2-db-rbac": "*"
  24 + "developeruz/yii2-db-rbac": "*",
  25 + "nodge/yii2-eauth": "*"
25 26 },
26 27 "require-dev": {
27 28 "yiisoft/yii2-codeception": "*",
... ...
composer.lock
... ... @@ -4,8 +4,7 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5 "This file is @generated automatically"
6 6 ],
7   - "hash": "52ade047603d8461342b32b7f76785af",
8   - "content-hash": "35117bfe670ed414624b171df746a308",
  7 + "hash": "6b310fccece1d1eddc11db43624c06ab",
9 8 "packages": [
10 9 {
11 10 "name": "almasaeed2010/adminlte",
... ... @@ -461,16 +460,16 @@
461 460 },
462 461 {
463 462 "name": "dmstr/yii2-adminlte-asset",
464   - "version": "2.2.3",
  463 + "version": "2.2.4",
465 464 "source": {
466 465 "type": "git",
467 466 "url": "https://github.com/dmstr/yii2-adminlte-asset.git",
468   - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10"
  467 + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148"
469 468 },
470 469 "dist": {
471 470 "type": "zip",
472   - "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/45cffbfe90d79f3c405b4cc98f7f318ae372bb10",
473   - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10",
  471 + "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c842a15ceef4e903f70ac927ec3246e6d53e1148",
  472 + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148",
474 473 "shasum": ""
475 474 },
476 475 "require": {
... ... @@ -511,7 +510,7 @@
511 510 "extension",
512 511 "yii2"
513 512 ],
514   - "time": "2015-10-07 21:31:26"
  513 + "time": "2015-11-06 10:35:36"
515 514 },
516 515 {
517 516 "name": "ezyang/htmlpurifier",
... ... @@ -559,16 +558,16 @@
559 558 },
560 559 {
561 560 "name": "kartik-v/yii2-krajee-base",
562   - "version": "v1.7.7",
  561 + "version": "v1.7.8",
563 562 "source": {
564 563 "type": "git",
565 564 "url": "https://github.com/kartik-v/yii2-krajee-base.git",
566   - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19"
  565 + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f"
567 566 },
568 567 "dist": {
569 568 "type": "zip",
570   - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19",
571   - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19",
  569 + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f",
  570 + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f",
572 571 "shasum": ""
573 572 },
574 573 "require": {
... ... @@ -601,7 +600,7 @@
601 600 "widget",
602 601 "yii2"
603 602 ],
604   - "time": "2015-06-16 05:19:57"
  603 + "time": "2015-11-22 06:35:23"
605 604 },
606 605 {
607 606 "name": "kartik-v/yii2-widget-select2",
... ... @@ -652,17 +651,178 @@
652 651 "time": "2015-09-22 03:10:57"
653 652 },
654 653 {
  654 + "name": "lusitanian/oauth",
  655 + "version": "v0.3.6",
  656 + "source": {
  657 + "type": "git",
  658 + "url": "https://github.com/Lusitanian/PHPoAuthLib.git",
  659 + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5"
  660 + },
  661 + "dist": {
  662 + "type": "zip",
  663 + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/4ce8c488971410233eb3b1e6d9ac4e81debb41d5",
  664 + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5",
  665 + "shasum": ""
  666 + },
  667 + "require": {
  668 + "php": ">=5.3.0"
  669 + },
  670 + "require-dev": {
  671 + "phpunit/phpunit": "3.7.*",
  672 + "predis/predis": "0.8.*@dev",
  673 + "symfony/http-foundation": "~2.1"
  674 + },
  675 + "suggest": {
  676 + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.",
  677 + "predis/predis": "Allows using the Redis storage backend.",
  678 + "symfony/http-foundation": "Allows using the Symfony Session storage backend."
  679 + },
  680 + "type": "library",
  681 + "extra": {
  682 + "branch-alias": {
  683 + "dev-master": "0.1-dev"
  684 + }
  685 + },
  686 + "autoload": {
  687 + "psr-0": {
  688 + "OAuth": "src",
  689 + "OAuth\\Unit": "tests"
  690 + }
  691 + },
  692 + "notification-url": "https://packagist.org/downloads/",
  693 + "license": [
  694 + "MIT"
  695 + ],
  696 + "authors": [
  697 + {
  698 + "name": "David Desberg",
  699 + "email": "david@daviddesberg.com"
  700 + },
  701 + {
  702 + "name": "Pieter Hordijk",
  703 + "email": "info@pieterhordijk.com"
  704 + }
  705 + ],
  706 + "description": "PHP 5.3+ oAuth 1/2 Library",
  707 + "keywords": [
  708 + "Authentication",
  709 + "authorization",
  710 + "oauth",
  711 + "security"
  712 + ],
  713 + "time": "2015-09-09 06:43:02"
  714 + },
  715 + {
  716 + "name": "nodge/lightopenid",
  717 + "version": "1.1.2",
  718 + "source": {
  719 + "type": "git",
  720 + "url": "https://github.com/Nodge/LightOpenID.git",
  721 + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041"
  722 + },
  723 + "dist": {
  724 + "type": "zip",
  725 + "url": "https://api.github.com/repos/Nodge/LightOpenID/zipball/a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041",
  726 + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041",
  727 + "shasum": ""
  728 + },
  729 + "require": {
  730 + "php": ">=5.2"
  731 + },
  732 + "type": "library",
  733 + "autoload": {
  734 + "classmap": [
  735 + "openid.php",
  736 + "provider/provider.php"
  737 + ]
  738 + },
  739 + "notification-url": "https://packagist.org/downloads/",
  740 + "license": [
  741 + "MIT License"
  742 + ],
  743 + "authors": [
  744 + {
  745 + "name": "Mewp",
  746 + "homepage": "http://code.google.com/p/lightopenid/"
  747 + },
  748 + {
  749 + "name": "Ignat Ignatov",
  750 + "homepage": "https://github.com/iignatov/LightOpenID"
  751 + }
  752 + ],
  753 + "description": "Lightweight PHP5 library for easy OpenID authentication.",
  754 + "homepage": "https://github.com/Nodge/LightOpenID",
  755 + "keywords": [
  756 + "Authentication",
  757 + "OpenId"
  758 + ],
  759 + "time": "2013-08-31 16:48:56"
  760 + },
  761 + {
  762 + "name": "nodge/yii2-eauth",
  763 + "version": "2.3.0",
  764 + "source": {
  765 + "type": "git",
  766 + "url": "https://github.com/Nodge/yii2-eauth.git",
  767 + "reference": "25963e78c6083734736187bff992dd9da60fd125"
  768 + },
  769 + "dist": {
  770 + "type": "zip",
  771 + "url": "https://api.github.com/repos/Nodge/yii2-eauth/zipball/25963e78c6083734736187bff992dd9da60fd125",
  772 + "reference": "25963e78c6083734736187bff992dd9da60fd125",
  773 + "shasum": ""
  774 + },
  775 + "require": {
  776 + "lib-curl": "*",
  777 + "lusitanian/oauth": "~0.3.0",
  778 + "nodge/lightopenid": "~1.1.0",
  779 + "php": ">=5.4.0",
  780 + "yiisoft/yii2": "*"
  781 + },
  782 + "type": "yii2-extension",
  783 + "extra": {
  784 + "bootstrap": "nodge\\eauth\\Bootstrap"
  785 + },
  786 + "autoload": {
  787 + "psr-4": {
  788 + "nodge\\eauth\\": "src/"
  789 + }
  790 + },
  791 + "notification-url": "https://packagist.org/downloads/",
  792 + "license": [
  793 + "New BSD License"
  794 + ],
  795 + "authors": [
  796 + {
  797 + "name": "Maxim Zemskov",
  798 + "email": "nodge@yandex.ru",
  799 + "homepage": "http://nodge.ru/"
  800 + }
  801 + ],
  802 + "description": "Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).",
  803 + "homepage": "https://github.com/Nodge/yii2-eauth",
  804 + "keywords": [
  805 + "Authentication",
  806 + "OpenId",
  807 + "eauth",
  808 + "extension",
  809 + "oauth",
  810 + "yii2"
  811 + ],
  812 + "time": "2015-10-17 16:51:17"
  813 + },
  814 + {
655 815 "name": "rmrevin/yii2-fontawesome",
656   - "version": "2.12.0",
  816 + "version": "2.12.2",
657 817 "source": {
658 818 "type": "git",
659 819 "url": "https://github.com/rmrevin/yii2-fontawesome.git",
660   - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068"
  820 + "reference": "62308687477734c166753de0ad9e2333dc7dce32"
661 821 },
662 822 "dist": {
663 823 "type": "zip",
664   - "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/51d33ec9d1d7edab2166f1d42668c1bc8d28c068",
665   - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068",
  824 + "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/62308687477734c166753de0ad9e2333dc7dce32",
  825 + "reference": "62308687477734c166753de0ad9e2333dc7dce32",
666 826 "shasum": ""
667 827 },
668 828 "require": {
... ... @@ -688,9 +848,9 @@
688 848 ],
689 849 "authors": [
690 850 {
691   - "name": "Roman Revin",
692   - "email": "xgismox@gmail.com",
693   - "homepage": "http://rmrevin.ru/"
  851 + "name": "Revin Roman",
  852 + "email": "roman@rmrevin.com",
  853 + "homepage": "https://rmrevin.com/"
694 854 }
695 855 ],
696 856 "description": "Asset Bundle for Yii2 with Font Awesome",
... ... @@ -701,7 +861,7 @@
701 861 "font",
702 862 "yii"
703 863 ],
704   - "time": "2015-08-15 16:50:16"
  864 + "time": "2015-11-20 09:17:45"
705 865 },
706 866 {
707 867 "name": "swiftmailer/swiftmailer",
... ...
frontend/controllers/SiteController.php
... ... @@ -16,7 +16,8 @@ use yii\filters\VerbFilter;
16 16 use yii\filters\AccessControl;
17 17 use frontend\models\OptionsToValues;
18 18 use yii\validators\EmailValidator;
19   -
  19 +use common\models\User;
  20 +use yii\helpers\VarDumper;
20 21 use common\models\Page;
21 22  
22 23 /**
... ... @@ -52,6 +53,11 @@ class SiteController extends Controller
52 53 'logout' => ['post'],
53 54 ],
54 55 ],
  56 + 'eauth' => [
  57 + // required to disable csrf validation on OpenID requests
  58 + 'class' => \nodge\eauth\openid\ControllerBehavior::className(),
  59 + 'only' => ['login'],
  60 + ],
55 61 ];
56 62 }
57 63  
... ... @@ -94,6 +100,42 @@ class SiteController extends Controller
94 100 */
95 101 public function actionLogin()
96 102 {
  103 +
  104 + $serviceName = Yii::$app->getRequest()->getQueryParam('service');
  105 + if (isset($serviceName)) {
  106 + /** @var $eauth \nodge\eauth\ServiceBase */
  107 + $eauth = Yii::$app->get('eauth')->getIdentity($serviceName);
  108 + $eauth->setRedirectUrl(Yii::$app->getUser()->getReturnUrl());
  109 + $eauth->setCancelUrl(Yii::$app->getUrlManager()->createAbsoluteUrl('site/login'));
  110 +
  111 + try {
  112 + if ($eauth->authenticate()) {
  113 +// var_dump($eauth->getIsAuthenticated(), $eauth->getAttributes()); exit;
  114 +
  115 + $identity = User::findByEAuth($eauth);
  116 + Yii::$app->getUser()->login($identity);
  117 +
  118 + // special redirect with closing popup window
  119 + $eauth->redirect();
  120 + }
  121 + else {
  122 + // close popup window and redirect to cancelUrl
  123 + $eauth->cancel();
  124 + }
  125 + }
  126 + catch (\nodge\eauth\ErrorException $e) {
  127 + // save error to show it later
  128 + Yii::$app->getSession()->setFlash('error', 'EAuthException: '.$e->getMessage());
  129 +
  130 + // close popup window and redirect to cancelUrl
  131 +// $eauth->cancel();
  132 + $eauth->redirect($eauth->getCancelUrl());
  133 + }
  134 + }
  135 +
  136 +
  137 +
  138 +
97 139 if (!\Yii::$app->user->isGuest) {
98 140 return $this->goHome();
99 141 }
... ... @@ -126,7 +168,13 @@ class SiteController extends Controller
126 168 * @return mixed
127 169 */
128 170 public function actionContact()
129   - {
  171 + {
  172 +
  173 + //Yii::$app->user->logout();
  174 + $identity = Yii::$app->getUser()->getIdentity();
  175 + var_dump($identity[profile]);
  176 + die();
  177 +
130 178 $model = new ContactForm();
131 179 if ($model->load(Yii::$app->request->post()) && $model->validate()) {
132 180 if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
... ... @@ -217,6 +265,7 @@ class SiteController extends Controller
217 265 $option_list = $option_model->find()->where(1)->all();
218 266 $option_values = array();
219 267 $post = \Yii::$app->request->post();
  268 +
220 269 if(!empty(\Yii::$app->request->post())) {
221 270 $options_to_values = array();
222 271 $hasErrors = false;
... ...
frontend/views/site/login.php
1 1 <?php
2   -
3   -/* @var $this yii\web\View */
4   -/* @var $form yii\bootstrap\ActiveForm */
5   -/* @var $model \common\models\LoginForm */
6   -
7 2 use yii\helpers\Html;
8   -use yii\bootstrap\ActiveForm;
9   -
  3 +use yii\widgets\ActiveForm;
  4 +/**
  5 + * @var yii\web\View $this
  6 + * @var yii\widgets\ActiveForm $form
  7 + * @var app\models\LoginForm $model
  8 + */
10 9 $this->title = 'Login';
11 10 $this->params['breadcrumbs'][] = $this->title;
12 11 ?>
13   -<div class="site-login">
14   - <h1><?= Html::encode($this->title) ?></h1>
15   -
16   - <p>Please fill out the following fields to login:</p>
17   -
18   - <div class="row">
19   - <div class="col-lg-5">
20   - <?php $form = ActiveForm::begin(['id' => 'login-form']); ?>
  12 +<h1><?php echo Html::encode($this->title); ?></h1>
21 13  
22   - <?= $form->field($model, 'username') ?>
23   -
24   - <?= $form->field($model, 'password')->passwordInput() ?>
25   -
26   - <?= $form->field($model, 'rememberMe')->checkbox() ?>
  14 +<?php
  15 + if (Yii::$app->getSession()->hasFlash('error')) {
  16 + echo '<div class="alert alert-danger">'.Yii::$app->getSession()->getFlash('error').'</div>';
  17 + }
  18 +?>
27 19  
28   - <div style="color:#999;margin:1em 0">
29   - If you forgot your password you can <?= Html::a('reset it', ['site/request-password-reset']) ?>.
30   - </div>
  20 +<p class="lead">Do you already have an account on one of these sites? Click the logo to log in with it here:</p>
  21 +<?php echo \nodge\eauth\Widget::widget(array('action' => 'site/login')); ?>
  22 +<hr/>
31 23  
32   - <div class="form-group">
33   - <?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
34   - </div>
  24 +<p>Please fill out the following fields to login:</p>
35 25  
36   - <?php ActiveForm::end(); ?>
37   - </div>
  26 +<?php $form = ActiveForm::begin(array('options' => array('class' => 'form-horizontal', 'id' => 'login-form'))); ?>
  27 + <?php echo $form->field($model, 'username')->textInput(); ?>
  28 + <?php echo $form->field($model, 'password')->passwordInput(); ?>
  29 + <?php echo $form->field($model, 'rememberMe')->checkbox(); ?>
  30 + <div class="form-actions">
  31 + <?php echo Html::submitButton('Login', array('class' => 'btn btn-primary')); ?>
38 32 </div>
39   -</div>
  33 +<?php ActiveForm::end(); ?>
40 34 \ No newline at end of file
... ...
vendor/composer/autoload_classmap.php
... ... @@ -6,4 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
6 6 $baseDir = dirname($vendorDir);
7 7  
8 8 return array(
  9 + 'LightOpenID' => $vendorDir . '/nodge/lightopenid/openid.php',
  10 + 'LightOpenIDProvider' => $vendorDir . '/nodge/lightopenid/provider/provider.php',
9 11 );
... ...
vendor/composer/autoload_namespaces.php
... ... @@ -7,6 +7,8 @@ $baseDir = dirname($vendorDir);
7 7  
8 8 return array(
9 9 'cebe\\gravatar\\' => array($vendorDir . '/cebe/yii2-gravatar'),
  10 + 'OAuth\\Unit' => array($vendorDir . '/lusitanian/oauth/tests'),
  11 + 'OAuth' => array($vendorDir . '/lusitanian/oauth/src'),
10 12 'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
11 13 'Diff' => array($vendorDir . '/phpspec/php-diff/lib'),
12 14 );
... ...
vendor/composer/autoload_psr4.php
... ... @@ -16,6 +16,7 @@ return array(
16 16 'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'),
17 17 'yii\\' => array($vendorDir . '/yiisoft/yii2'),
18 18 'rmrevin\\yii\\fontawesome\\' => array($vendorDir . '/rmrevin/yii2-fontawesome'),
  19 + 'nodge\\eauth\\' => array($vendorDir . '/nodge/yii2-eauth/src'),
19 20 'kartik\\select2\\' => array($vendorDir . '/kartik-v/yii2-widget-select2'),
20 21 'kartik\\base\\' => array($vendorDir . '/kartik-v/yii2-krajee-base'),
21 22 'dmstr\\' => array($vendorDir . '/dmstr/yii2-adminlte-asset'),
... ...
vendor/composer/installed.json
... ... @@ -696,60 +696,6 @@
696 696 ]
697 697 },
698 698 {
699   - "name": "rmrevin/yii2-fontawesome",
700   - "version": "2.12.0",
701   - "version_normalized": "2.12.0.0",
702   - "source": {
703   - "type": "git",
704   - "url": "https://github.com/rmrevin/yii2-fontawesome.git",
705   - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068"
706   - },
707   - "dist": {
708   - "type": "zip",
709   - "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/51d33ec9d1d7edab2166f1d42668c1bc8d28c068",
710   - "reference": "51d33ec9d1d7edab2166f1d42668c1bc8d28c068",
711   - "shasum": ""
712   - },
713   - "require": {
714   - "bower-asset/fontawesome": "4.4.*",
715   - "php": ">=5.4.0",
716   - "yiisoft/yii2": "2.0.*"
717   - },
718   - "time": "2015-08-15 16:50:16",
719   - "type": "yii2-extension",
720   - "extra": {
721   - "asset-installer-paths": {
722   - "npm-asset-library": "vendor/npm",
723   - "bower-asset-library": "vendor/bower"
724   - }
725   - },
726   - "installation-source": "dist",
727   - "autoload": {
728   - "psr-4": {
729   - "rmrevin\\yii\\fontawesome\\": ""
730   - }
731   - },
732   - "notification-url": "https://packagist.org/downloads/",
733   - "license": [
734   - "MIT"
735   - ],
736   - "authors": [
737   - {
738   - "name": "Roman Revin",
739   - "email": "xgismox@gmail.com",
740   - "homepage": "http://rmrevin.ru/"
741   - }
742   - ],
743   - "description": "Asset Bundle for Yii2 with Font Awesome",
744   - "keywords": [
745   - "asset",
746   - "awesome",
747   - "bundle",
748   - "font",
749   - "yii"
750   - ]
751   - },
752   - {
753 699 "name": "almasaeed2010/adminlte",
754 700 "version": "v2.3.2",
755 701 "version_normalized": "2.3.2.0",
... ... @@ -837,62 +783,6 @@
837 783 ]
838 784 },
839 785 {
840   - "name": "dmstr/yii2-adminlte-asset",
841   - "version": "2.2.3",
842   - "version_normalized": "2.2.3.0",
843   - "source": {
844   - "type": "git",
845   - "url": "https://github.com/dmstr/yii2-adminlte-asset.git",
846   - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10"
847   - },
848   - "dist": {
849   - "type": "zip",
850   - "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/45cffbfe90d79f3c405b4cc98f7f318ae372bb10",
851   - "reference": "45cffbfe90d79f3c405b4cc98f7f318ae372bb10",
852   - "shasum": ""
853   - },
854   - "require": {
855   - "almasaeed2010/adminlte": "~2.0",
856   - "cebe/yii2-gravatar": "1.*",
857   - "rmrevin/yii2-fontawesome": "~2.9",
858   - "yiisoft/yii2": "2.*",
859   - "yiisoft/yii2-bootstrap": "2.*"
860   - },
861   - "time": "2015-10-07 21:31:26",
862   - "type": "yii2-extension",
863   - "extra": {
864   - "branch-alias": {
865   - "dev-master": "2.0.x-dev"
866   - }
867   - },
868   - "installation-source": "dist",
869   - "autoload": {
870   - "psr-4": {
871   - "dmstr\\": ""
872   - }
873   - },
874   - "notification-url": "https://packagist.org/downloads/",
875   - "license": [
876   - "BSD-3-Clause"
877   - ],
878   - "authors": [
879   - {
880   - "name": "Tobias Munk",
881   - "email": "tobias@diemeisterei.de"
882   - },
883   - {
884   - "name": "Evgeniy Tkachenko",
885   - "email": "et.coder@gmail.com"
886   - }
887   - ],
888   - "description": "Backend theme for Yii2 Framework",
889   - "keywords": [
890   - "AdminLTE",
891   - "extension",
892   - "yii2"
893   - ]
894   - },
895   - {
896 786 "name": "yiisoft/yii2-jui",
897 787 "version": "2.0.4",
898 788 "version_normalized": "2.0.4.0",
... ... @@ -945,54 +835,6 @@
945 835 ]
946 836 },
947 837 {
948   - "name": "kartik-v/yii2-krajee-base",
949   - "version": "v1.7.7",
950   - "version_normalized": "1.7.7.0",
951   - "source": {
952   - "type": "git",
953   - "url": "https://github.com/kartik-v/yii2-krajee-base.git",
954   - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19"
955   - },
956   - "dist": {
957   - "type": "zip",
958   - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19",
959   - "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19",
960   - "shasum": ""
961   - },
962   - "require": {
963   - "yiisoft/yii2-bootstrap": "@dev"
964   - },
965   - "time": "2015-06-16 05:19:57",
966   - "type": "yii2-extension",
967   - "installation-source": "dist",
968   - "autoload": {
969   - "psr-4": {
970   - "kartik\\base\\": ""
971   - }
972   - },
973   - "notification-url": "https://packagist.org/downloads/",
974   - "license": [
975   - "BSD-3-Clause"
976   - ],
977   - "authors": [
978   - {
979   - "name": "Kartik Visweswaran",
980   - "email": "kartikv2@gmail.com",
981   - "homepage": "http://www.krajee.com/"
982   - }
983   - ],
984   - "description": "Base library and foundation components for all Yii2 Krajee extensions.",
985   - "homepage": "https://github.com/kartik-v/yii2-krajee-base",
986   - "keywords": [
987   - "base",
988   - "extension",
989   - "foundation",
990   - "krajee",
991   - "widget",
992   - "yii2"
993   - ]
994   - },
995   - {
996 838 "name": "bower-asset/jquery",
997 839 "version": "2.1.4",
998 840 "version_normalized": "2.1.4.0",
... ... @@ -1395,5 +1237,330 @@
1395 1237 "CC-BY-3.0"
1396 1238 ],
1397 1239 "description": "Font Awesome"
  1240 + },
  1241 + {
  1242 + "name": "dmstr/yii2-adminlte-asset",
  1243 + "version": "2.2.4",
  1244 + "version_normalized": "2.2.4.0",
  1245 + "source": {
  1246 + "type": "git",
  1247 + "url": "https://github.com/dmstr/yii2-adminlte-asset.git",
  1248 + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148"
  1249 + },
  1250 + "dist": {
  1251 + "type": "zip",
  1252 + "url": "https://api.github.com/repos/dmstr/yii2-adminlte-asset/zipball/c842a15ceef4e903f70ac927ec3246e6d53e1148",
  1253 + "reference": "c842a15ceef4e903f70ac927ec3246e6d53e1148",
  1254 + "shasum": ""
  1255 + },
  1256 + "require": {
  1257 + "almasaeed2010/adminlte": "~2.0",
  1258 + "cebe/yii2-gravatar": "1.*",
  1259 + "rmrevin/yii2-fontawesome": "~2.9",
  1260 + "yiisoft/yii2": "2.*",
  1261 + "yiisoft/yii2-bootstrap": "2.*"
  1262 + },
  1263 + "time": "2015-11-06 10:35:36",
  1264 + "type": "yii2-extension",
  1265 + "extra": {
  1266 + "branch-alias": {
  1267 + "dev-master": "2.0.x-dev"
  1268 + }
  1269 + },
  1270 + "installation-source": "dist",
  1271 + "autoload": {
  1272 + "psr-4": {
  1273 + "dmstr\\": ""
  1274 + }
  1275 + },
  1276 + "notification-url": "https://packagist.org/downloads/",
  1277 + "license": [
  1278 + "BSD-3-Clause"
  1279 + ],
  1280 + "authors": [
  1281 + {
  1282 + "name": "Tobias Munk",
  1283 + "email": "tobias@diemeisterei.de"
  1284 + },
  1285 + {
  1286 + "name": "Evgeniy Tkachenko",
  1287 + "email": "et.coder@gmail.com"
  1288 + }
  1289 + ],
  1290 + "description": "Backend theme for Yii2 Framework",
  1291 + "keywords": [
  1292 + "AdminLTE",
  1293 + "extension",
  1294 + "yii2"
  1295 + ]
  1296 + },
  1297 + {
  1298 + "name": "nodge/lightopenid",
  1299 + "version": "1.1.2",
  1300 + "version_normalized": "1.1.2.0",
  1301 + "source": {
  1302 + "type": "git",
  1303 + "url": "https://github.com/Nodge/LightOpenID.git",
  1304 + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041"
  1305 + },
  1306 + "dist": {
  1307 + "type": "zip",
  1308 + "url": "https://api.github.com/repos/Nodge/LightOpenID/zipball/a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041",
  1309 + "reference": "a5492cc0c932c557b7e9b54a6e5bbd85cc5fa041",
  1310 + "shasum": ""
  1311 + },
  1312 + "require": {
  1313 + "php": ">=5.2"
  1314 + },
  1315 + "time": "2013-08-31 16:48:56",
  1316 + "type": "library",
  1317 + "installation-source": "dist",
  1318 + "autoload": {
  1319 + "classmap": [
  1320 + "openid.php",
  1321 + "provider/provider.php"
  1322 + ]
  1323 + },
  1324 + "notification-url": "https://packagist.org/downloads/",
  1325 + "license": [
  1326 + "MIT License"
  1327 + ],
  1328 + "authors": [
  1329 + {
  1330 + "name": "Mewp",
  1331 + "homepage": "http://code.google.com/p/lightopenid/"
  1332 + },
  1333 + {
  1334 + "name": "Ignat Ignatov",
  1335 + "homepage": "https://github.com/iignatov/LightOpenID"
  1336 + }
  1337 + ],
  1338 + "description": "Lightweight PHP5 library for easy OpenID authentication.",
  1339 + "homepage": "https://github.com/Nodge/LightOpenID",
  1340 + "keywords": [
  1341 + "Authentication",
  1342 + "OpenId"
  1343 + ]
  1344 + },
  1345 + {
  1346 + "name": "lusitanian/oauth",
  1347 + "version": "v0.3.6",
  1348 + "version_normalized": "0.3.6.0",
  1349 + "source": {
  1350 + "type": "git",
  1351 + "url": "https://github.com/Lusitanian/PHPoAuthLib.git",
  1352 + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5"
  1353 + },
  1354 + "dist": {
  1355 + "type": "zip",
  1356 + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/4ce8c488971410233eb3b1e6d9ac4e81debb41d5",
  1357 + "reference": "4ce8c488971410233eb3b1e6d9ac4e81debb41d5",
  1358 + "shasum": ""
  1359 + },
  1360 + "require": {
  1361 + "php": ">=5.3.0"
  1362 + },
  1363 + "require-dev": {
  1364 + "phpunit/phpunit": "3.7.*",
  1365 + "predis/predis": "0.8.*@dev",
  1366 + "symfony/http-foundation": "~2.1"
  1367 + },
  1368 + "suggest": {
  1369 + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.",
  1370 + "predis/predis": "Allows using the Redis storage backend.",
  1371 + "symfony/http-foundation": "Allows using the Symfony Session storage backend."
  1372 + },
  1373 + "time": "2015-09-09 06:43:02",
  1374 + "type": "library",
  1375 + "extra": {
  1376 + "branch-alias": {
  1377 + "dev-master": "0.1-dev"
  1378 + }
  1379 + },
  1380 + "installation-source": "dist",
  1381 + "autoload": {
  1382 + "psr-0": {
  1383 + "OAuth": "src",
  1384 + "OAuth\\Unit": "tests"
  1385 + }
  1386 + },
  1387 + "notification-url": "https://packagist.org/downloads/",
  1388 + "license": [
  1389 + "MIT"
  1390 + ],
  1391 + "authors": [
  1392 + {
  1393 + "name": "David Desberg",
  1394 + "email": "david@daviddesberg.com"
  1395 + },
  1396 + {
  1397 + "name": "Pieter Hordijk",
  1398 + "email": "info@pieterhordijk.com"
  1399 + }
  1400 + ],
  1401 + "description": "PHP 5.3+ oAuth 1/2 Library",
  1402 + "keywords": [
  1403 + "Authentication",
  1404 + "authorization",
  1405 + "oauth",
  1406 + "security"
  1407 + ]
  1408 + },
  1409 + {
  1410 + "name": "nodge/yii2-eauth",
  1411 + "version": "2.3.0",
  1412 + "version_normalized": "2.3.0.0",
  1413 + "source": {
  1414 + "type": "git",
  1415 + "url": "https://github.com/Nodge/yii2-eauth.git",
  1416 + "reference": "25963e78c6083734736187bff992dd9da60fd125"
  1417 + },
  1418 + "dist": {
  1419 + "type": "zip",
  1420 + "url": "https://api.github.com/repos/Nodge/yii2-eauth/zipball/25963e78c6083734736187bff992dd9da60fd125",
  1421 + "reference": "25963e78c6083734736187bff992dd9da60fd125",
  1422 + "shasum": ""
  1423 + },
  1424 + "require": {
  1425 + "lib-curl": "*",
  1426 + "lusitanian/oauth": "~0.3.0",
  1427 + "nodge/lightopenid": "~1.1.0",
  1428 + "php": ">=5.4.0",
  1429 + "yiisoft/yii2": "*"
  1430 + },
  1431 + "time": "2015-10-17 16:51:17",
  1432 + "type": "yii2-extension",
  1433 + "extra": {
  1434 + "bootstrap": "nodge\\eauth\\Bootstrap"
  1435 + },
  1436 + "installation-source": "dist",
  1437 + "autoload": {
  1438 + "psr-4": {
  1439 + "nodge\\eauth\\": "src/"
  1440 + }
  1441 + },
  1442 + "notification-url": "https://packagist.org/downloads/",
  1443 + "license": [
  1444 + "New BSD License"
  1445 + ],
  1446 + "authors": [
  1447 + {
  1448 + "name": "Maxim Zemskov",
  1449 + "email": "nodge@yandex.ru",
  1450 + "homepage": "http://nodge.ru/"
  1451 + }
  1452 + ],
  1453 + "description": "Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).",
  1454 + "homepage": "https://github.com/Nodge/yii2-eauth",
  1455 + "keywords": [
  1456 + "Authentication",
  1457 + "OpenId",
  1458 + "eauth",
  1459 + "extension",
  1460 + "oauth",
  1461 + "yii2"
  1462 + ]
  1463 + },
  1464 + {
  1465 + "name": "kartik-v/yii2-krajee-base",
  1466 + "version": "v1.7.8",
  1467 + "version_normalized": "1.7.8.0",
  1468 + "source": {
  1469 + "type": "git",
  1470 + "url": "https://github.com/kartik-v/yii2-krajee-base.git",
  1471 + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f"
  1472 + },
  1473 + "dist": {
  1474 + "type": "zip",
  1475 + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f",
  1476 + "reference": "f90b9ff515ced4e40ff5ec8156a5c9f7f51e2a7f",
  1477 + "shasum": ""
  1478 + },
  1479 + "require": {
  1480 + "yiisoft/yii2-bootstrap": "@dev"
  1481 + },
  1482 + "time": "2015-11-22 06:35:23",
  1483 + "type": "yii2-extension",
  1484 + "installation-source": "dist",
  1485 + "autoload": {
  1486 + "psr-4": {
  1487 + "kartik\\base\\": ""
  1488 + }
  1489 + },
  1490 + "notification-url": "https://packagist.org/downloads/",
  1491 + "license": [
  1492 + "BSD-3-Clause"
  1493 + ],
  1494 + "authors": [
  1495 + {
  1496 + "name": "Kartik Visweswaran",
  1497 + "email": "kartikv2@gmail.com",
  1498 + "homepage": "http://www.krajee.com/"
  1499 + }
  1500 + ],
  1501 + "description": "Base library and foundation components for all Yii2 Krajee extensions.",
  1502 + "homepage": "https://github.com/kartik-v/yii2-krajee-base",
  1503 + "keywords": [
  1504 + "base",
  1505 + "extension",
  1506 + "foundation",
  1507 + "krajee",
  1508 + "widget",
  1509 + "yii2"
  1510 + ]
  1511 + },
  1512 + {
  1513 + "name": "rmrevin/yii2-fontawesome",
  1514 + "version": "2.12.2",
  1515 + "version_normalized": "2.12.2.0",
  1516 + "source": {
  1517 + "type": "git",
  1518 + "url": "https://github.com/rmrevin/yii2-fontawesome.git",
  1519 + "reference": "62308687477734c166753de0ad9e2333dc7dce32"
  1520 + },
  1521 + "dist": {
  1522 + "type": "zip",
  1523 + "url": "https://api.github.com/repos/rmrevin/yii2-fontawesome/zipball/62308687477734c166753de0ad9e2333dc7dce32",
  1524 + "reference": "62308687477734c166753de0ad9e2333dc7dce32",
  1525 + "shasum": ""
  1526 + },
  1527 + "require": {
  1528 + "bower-asset/fontawesome": "4.4.*",
  1529 + "php": ">=5.4.0",
  1530 + "yiisoft/yii2": "2.0.*"
  1531 + },
  1532 + "time": "2015-11-20 09:17:45",
  1533 + "type": "yii2-extension",
  1534 + "extra": {
  1535 + "asset-installer-paths": {
  1536 + "npm-asset-library": "vendor/npm",
  1537 + "bower-asset-library": "vendor/bower"
  1538 + }
  1539 + },
  1540 + "installation-source": "dist",
  1541 + "autoload": {
  1542 + "psr-4": {
  1543 + "rmrevin\\yii\\fontawesome\\": ""
  1544 + }
  1545 + },
  1546 + "notification-url": "https://packagist.org/downloads/",
  1547 + "license": [
  1548 + "MIT"
  1549 + ],
  1550 + "authors": [
  1551 + {
  1552 + "name": "Revin Roman",
  1553 + "email": "roman@rmrevin.com",
  1554 + "homepage": "https://rmrevin.com/"
  1555 + }
  1556 + ],
  1557 + "description": "Asset Bundle for Yii2 with Font Awesome",
  1558 + "keywords": [
  1559 + "asset",
  1560 + "awesome",
  1561 + "bundle",
  1562 + "font",
  1563 + "yii"
  1564 + ]
1398 1565 }
1399 1566 ]
... ...
vendor/dmstr/yii2-adminlte-asset/CHANGELOG.md
1 1 CHANGELOG
2 2 ---------
3 3  
  4 +## 2.2.4
  5 + * [FIX] fixed active menu with modules (Vasiliy Baranov)
  6 + * [ENH] added .hold-transition
  7 +
  8 +## 2.2.3
  9 + * [ENH] : updated Gravatar widget E-Mail usage (@Quexer69)
  10 +
4 11 ## 2.2.2
5 12 * fixed Menu widget selection
6 13 * updated example views
... ... @@ -114,4 +121,4 @@ CHANGELOG
114 121 * fixed missing csrf token, updated menu, code-formatting
115 122 * updated paths, added Phundament 4 template
116 123 * update README.md
117   - * initial commit
118 124 \ No newline at end of file
  125 + * initial commit
... ...
vendor/dmstr/yii2-adminlte-asset/example-views/phundament/app/layouts/main.php
... ... @@ -29,7 +29,7 @@ dmstr\web\AdminLteAsset::register($this);
29 29 <![endif]-->
30 30 </head>
31 31  
32   -<body class="skin-black">
  32 +<body class="hold-transition skin-black sidebar-mini">
33 33 <?php $this->beginBody() ?>
34 34  
35 35 <div class="wrapper">
... ...
vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php
1 1 <?php
2   -
3 2 use yii\helpers\Html;
4   -use yii\helpers\Url;
5   -
6   -$username = Yii::$app->user->identity->firstname.' '.Yii::$app->user->identity->lastname;
7 3  
8 4 /* @var $this \yii\web\View */
9 5 /* @var $content string */
... ... @@ -234,7 +230,7 @@ $username = Yii::$app-&gt;user-&gt;identity-&gt;firstname.&#39; &#39;.Yii::$app-&gt;user-&gt;identity-&gt;
234 230 <li class="dropdown user user-menu">
235 231 <a href="#" class="dropdown-toggle" data-toggle="dropdown">
236 232 <img src="<?= $directoryAsset ?>/img/user2-160x160.jpg" class="user-image" alt="User Image"/>
237   - <span class="hidden-xs"><?=$username; ?></span>
  233 + <span class="hidden-xs">Alexander Pierce</span>
238 234 </a>
239 235 <ul class="dropdown-menu">
240 236 <!-- User image -->
... ... @@ -243,12 +239,11 @@ $username = Yii::$app-&gt;user-&gt;identity-&gt;firstname.&#39; &#39;.Yii::$app-&gt;user-&gt;identity-&gt;
243 239 alt="User Image"/>
244 240  
245 241 <p>
246   - <?=$username; ?> - Web Developer
  242 + Alexander Pierce - Web Developer
247 243 <small>Member since Nov. 2012</small>
248 244 </p>
249 245 </li>
250   - <!--
251   - Menu Body
  246 + <!-- Menu Body -->
252 247 <li class="user-body">
253 248 <div class="col-xs-4 text-center">
254 249 <a href="#">Followers</a>
... ... @@ -260,11 +255,10 @@ $username = Yii::$app-&gt;user-&gt;identity-&gt;firstname.&#39; &#39;.Yii::$app-&gt;user-&gt;identity-&gt;
260 255 <a href="#">Friends</a>
261 256 </div>
262 257 </li>
263   - -->
264 258 <!-- Menu Footer-->
265 259 <li class="user-footer">
266 260 <div class="pull-left">
267   - <a href="<?=Url::toRoute('site/profile'); ?>" class="btn btn-default btn-flat">Profile</a>
  261 + <a href="#" class="btn btn-default btn-flat">Profile</a>
268 262 </div>
269 263 <div class="pull-right">
270 264 <?= Html::a(
... ...
vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/left.php
... ... @@ -30,22 +30,10 @@
30 30 [
31 31 'options' => ['class' => 'sidebar-menu'],
32 32 'items' => [
33   - ['label' => 'Страница', 'icon' => 'fa fa-file-code-o', 'url' => ['/page/']],
34   - ['label' => 'Термин', 'icon' => 'fa fa-file-code-o', 'url' => ['/termin_lang/']],
35   - ['label' => 'Меню', 'icon' => 'fa fa-file-code-o', 'url' => ['/menu/']],
  33 + ['label' => 'Menu Yii2', 'options' => ['class' => 'header']],
36 34 ['label' => 'Gii', 'icon' => 'fa fa-file-code-o', 'url' => ['/gii']],
37 35 ['label' => 'Debug', 'icon' => 'fa fa-dashboard', 'url' => ['/debug']],
38 36 ['label' => 'Login', 'url' => ['site/login'], 'visible' => Yii::$app->user->isGuest],
39   - ['label' => 'Пользователи', 'icon' => 'fa fa-file-code-o', 'url' => ['/user/']],
40   - [
41   - 'label' => 'Роли',
42   - 'icon' => 'fa fa-share',
43   - 'url' => '#',
44   - 'items' => [
45   - ['label' => 'Управление ролями', 'icon' => 'fa fa-file-code-o', 'url' => ['/permit/access/role'],],
46   - ['label' => 'Управление правами доступа', 'icon' => 'fa fa-dashboard', 'url' => ['/permit/access/permission'],],
47   - ],
48   - ],
49 37 [
50 38 'label' => 'Same tools',
51 39 'icon' => 'fa fa-share',
... ...
vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/main.php
... ... @@ -36,7 +36,7 @@ if (Yii::$app-&gt;controller-&gt;action-&gt;id === &#39;login&#39;) {
36 36 <title><?= Html::encode($this->title) ?></title>
37 37 <?php $this->head() ?>
38 38 </head>
39   - <body class="skin-blue sidebar-mini">
  39 + <body class="hold-transition skin-blue sidebar-mini">
40 40 <?php $this->beginBody() ?>
41 41 <div class="wrapper">
42 42  
... ...
vendor/dmstr/yii2-adminlte-asset/widgets/Menu.php
... ... @@ -152,6 +152,9 @@ class Menu extends \yii\widgets\Menu
152 152 if (isset($arrayRoute[1]) && $arrayRoute[1] !== $arrayThisRoute[1]) {
153 153 return false;
154 154 }
  155 + if (isset($arrayRoute[2]) && $arrayRoute[2] !== $arrayThisRoute[2]) {
  156 + return false;
  157 + }
155 158 unset($item['url']['#']);
156 159 if (count($item['url']) > 1) {
157 160 foreach (array_splice($item['url'], 1) as $name => $value) {
... ...
vendor/kartik-v/yii2-krajee-base/AnimateAsset.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ...
vendor/kartik-v/yii2-krajee-base/AssetBundle.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -21,10 +21,10 @@ class AssetBundle extends \yii\web\AssetBundle
21 21 const EMPTY_PATH = 'N0/P@T#';
22 22 const KRAJEE_ASSET = 'K3/@$$3T$';
23 23 const KRAJEE_PATH = 'K3/P@T#';
24   -
  24 +
25 25 public $js = self::KRAJEE_ASSET;
26 26 public $css = self::KRAJEE_ASSET;
27   - public $sourcePath = self::KRAJEE_PATH;
  27 + public $sourcePath = self::KRAJEE_PATH;
28 28 public $depends = [
29 29 'yii\web\JqueryAsset',
30 30 'yii\web\YiiAsset',
... ... @@ -34,7 +34,8 @@ class AssetBundle extends \yii\web\AssetBundle
34 34 /**
35 35 * @inheritdoc
36 36 */
37   - public function init() {
  37 + public function init()
  38 + {
38 39 parent::init();
39 40 if ($this->js === self::KRAJEE_ASSET) {
40 41 $this->js = [];
... ... @@ -46,7 +47,7 @@ class AssetBundle extends \yii\web\AssetBundle
46 47 $this->sourcePath = null;
47 48 }
48 49 }
49   -
  50 +
50 51 /**
51 52 * Adds a language JS locale file
52 53 *
... ... @@ -62,7 +63,7 @@ class AssetBundle extends \yii\web\AssetBundle
62 63 if (empty($lang) || substr($lang, 0, 2) == 'en') {
63 64 return $this;
64 65 }
65   - $ext = $min ? (YII_DEBUG ? ".min.js" : ".js") : ".js";
  66 + $ext = $min ? (YII_DEBUG ? ".min.js" : ".js") : ".js";
66 67 $file = "{$prefix}{$lang}{$ext}";
67 68 if ($dir === null) {
68 69 $dir = 'js';
... ... @@ -75,16 +76,16 @@ class AssetBundle extends \yii\web\AssetBundle
75 76 $file = "{$prefix}{$lang}{$ext}";
76 77 }
77 78 if (Config::fileExists("{$path}/{$file}")) {
78   - $this->js[] = empty($dir) ? $file : "{$dir}/{$file}";
  79 + $this->js[] = empty($dir) ? $file : "{$dir}/{$file}";
79 80 }
80 81 return $this;
81 82 }
82   -
  83 +
83 84 /**
84 85 * Set up CSS and JS asset arrays based on the base-file names
85 86 *
86 87 * @param string $type whether 'css' or 'js'
87   - * @param array $files the list of 'css' or 'js' basefile names
  88 + * @param array $files the list of 'css' or 'js' basefile names
88 89 */
89 90 protected function setupAssets($type, $files = [])
90 91 {
... ...
vendor/kartik-v/yii2-krajee-base/CHANGE.md
1   -version 1.7.7
2   -=============
  1 +Change Log: `yii2-krajee-base`
  2 +==============================
  3 +
  4 +## Version 1.7.8
  5 +
  6 +**Date:** 22-Nov-2015
  7 +
  8 +- (enh #40): Various enhancements for PJAX .
  9 +- (enh #41): Added .gitignore for Composer stuff.
  10 +- (bug #42): Better and more correct date format parsing.
  11 +- (enh #46): Enhance `Html5Input` initialization.
  12 +- (enh #47): Implement message translations.
  13 +
  14 +## Version 1.7.7
  15 +
3 16 **Date:** 16-Jun-2015
4 17  
5 18 - (enh #37): Set range input caption to change during slide.
6 19 - (enh #38): Update to use `Json::htmlEncode` as per yii release v2.0.4.
7 20  
8   -version 1.7.6
9   -=============
  21 +## Version 1.7.6
  22 +
10 23 **Date:** 09-May-2015
11 24  
12 25 - (enh #36): Add kv-input-group-hide class.
13 26  
14   -version 1.7.5
15   -=============
  27 +## Version 1.7.5
  28 +
16 29 **Date:** 03-May-2015
17 30  
18 31 - (enh #30): Improve translation trait for determining messages folder.
... ... @@ -20,8 +33,8 @@ version 1.7.5
20 33 - (enh #34): New `addLanguage` method in `AssetBundle`.
21 34 - (enh #35): Allow extending translation messages.
22 35  
23   -version 1.7.4
24   -=============
  36 +## Version 1.7.4
  37 +
25 38 **Date:** 13-Feb-2015
26 39  
27 40 - (enh #28): Create WidgetTrait for better code reuse.
... ... @@ -29,27 +42,27 @@ version 1.7.4
29 42 - (enh #29): New `getModule` and `initModule` methods in `Config`.
30 43 - Set copyright year to current.
31 44  
32   -version 1.7.3
33   -=============
  45 +## Version 1.7.3
  46 +
34 47 **Date:** 25-Jan-2015
35 48  
36 49 - (enh #26): Enhance `Widget` options to store multiple plugin config.
37 50 - (enh #27): Set directory and URL separator rightly for the setLanguage validation.
38 51  
39   -version 1.7.2
40   -=============
  52 +## Version 1.7.2
  53 +
41 54 **Date:** 20-Jan-2015
42 55  
43 56 - (enh #24): Revert use of DIRECTORY_SEPARATOR and use forward slash instead.
44 57  
45   -version 1.7.1
46   -=============
  58 +## Version 1.7.1
  59 +
47 60 **Date:** 15-Jan-2015
48 61  
49 62 - (enh #23): Enhance AssetBundle for over riding empty assets from AssetManager.
50 63  
51   -version 1.7.0
52   -=============
  64 +## Version 1.7.0
  65 +
53 66 **Date:** 12-Jan-2015
54 67  
55 68 - Fix kartik-v/yii2-widget-datepicker#10 - Language definition in pluginOptions
... ... @@ -57,8 +70,8 @@ version 1.7.0
57 70 - (enh #22): Implement base Module class.
58 71 - Code formatting updates as per Yii2 coding style.
59 72  
60   -version 1.6.0
61   -=============
  73 +## Version 1.6.0
  74 +
62 75 **Date:** 16-Dec-2014
63 76  
64 77 - (bug #16): variable `$short` in `InputWidget` in method `setLanguage` set without `$prefix`.
... ... @@ -67,8 +80,8 @@ version 1.6.0
67 80 - (enh #19): Avoid inspect errors in IDE for `Html5Input`.
68 81 - (enh #20): Add new PluginAssetBundle for bootstrap JS dependent plugins.
69 82  
70   -version 1.5.0
71   -=============
  83 +## Version 1.5.0
  84 +
72 85 **Date:** 06-Dec-2014
73 86  
74 87 - (enh #11): Added new properties `disabled` and `readonly` to `InputWidget` and `Html5Input`.
... ... @@ -79,8 +92,8 @@ version 1.5.0
79 92 - (enh #13): Enhancements to Config helper and change `self` methods to `static`.
80 93 - (bug #14): Fix line terminators and new lines in `getPluginScript`.
81 94  
82   -version 1.4.0
83   -=============
  95 +## Version 1.4.0
  96 +
84 97 **Date:** 29-Nov-2014
85 98  
86 99 - (enh #9): Enhanced language validation for combined ISO-639 and ISO-3166 codes
... ... @@ -93,8 +106,8 @@ version 1.4.0
93 106 - `getCurrentDir` - gets the current directory of the extended class object
94 107 - `fileExists` - modified file_exists method after replacing the slashes with right directory separator
95 108  
96   -version 1.3.0
97   -=============
  109 +## Version 1.3.0
  110 +
98 111 **Date:** 25-Nov-2014
99 112  
100 113 - (enh #6): Enhance `InputWidget` for attaching multiple jQuery plugins.
... ... @@ -118,8 +131,8 @@ Following functionality included in `InputWidget` and `Widget` classes:
118 131 - New protected property `_dataVar` included for generating the above data attribute.
119 132  
120 133  
121   -version 1.2.0
122   -=============
  134 +## Version 1.2.0
  135 +
123 136 **Date:** 25-Nov-2014
124 137  
125 138 - (bug #2): AssetBundle::EMPTY_PATH is not setting sourcePath to null.
... ... @@ -127,8 +140,8 @@ version 1.2.0
127 140 - (enh #4): Add validations for html inputs, dropdowns, and widgets in `Config`.
128 141 - (enh #5): Correctly validate checkbox and radio checked states for `InputWidget`.
129 142  
130   -version 1.1.0
131   -=============
  143 +## Version 1.1.0
  144 +
132 145 **Date:** 10-Nov-2014
133 146  
134 147 - Validation for sub repositories containing input widgets.
... ... @@ -137,8 +150,8 @@ version 1.1.0
137 150 - Include `AnimateAsset` bundle.
138 151 - Code formatting as per standards.
139 152  
140   -version 1.0.0
141   -=============
  153 +## Version 1.0.0
  154 +
142 155 **Date:** 06-Nov-2014
143 156  
144 157 Initial release
145 158 \ No newline at end of file
... ...
vendor/kartik-v/yii2-krajee-base/Config.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -43,7 +43,9 @@ class Config
43 43 'listBox',
44 44 'dropDownList',
45 45 'checkboxList',
46   - 'radioList'
  46 + 'radioList',
  47 + 'checkboxButtonGroup',
  48 + 'radioButtonGroup'
47 49 ];
48 50  
49 51 protected static $_validInputWidgets = [
... ... @@ -187,6 +189,9 @@ class Config
187 189 /**
188 190 * Check if a namespaced widget is valid or installed.
189 191 *
  192 + * @param string $type the widget type
  193 + * @param string $reason the message to be displayed for dependency failure
  194 + *
190 195 * @throws InvalidConfigException
191 196 */
192 197 public static function validateInputWidget($type, $reason = self::DEFAULT_REASON)
... ... @@ -197,8 +202,7 @@ class Config
197 202 }
198 203  
199 204 /**
200   - * Convert a language string in yii\i18n format to
201   - * a ISO-639 format (2 or 3 letter code).
  205 + * Convert a language string in yii\i18n format to a ISO-639 format (2 or 3 letter code).
202 206 *
203 207 * @param string $language the input language string
204 208 *
... ... @@ -263,6 +267,7 @@ class Config
263 267 */
264 268 public static function initModule($class)
265 269 {
  270 + /** @noinspection PhpUndefinedFieldInspection */
266 271 $m = $class::MODULE;
267 272 $module = $m ? static::getModule($m) : null;
268 273 if ($module === null || !$module instanceof $class) {
... ...
vendor/kartik-v/yii2-krajee-base/Html5Input.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -23,73 +23,82 @@ use yii\helpers\ArrayHelper;
23 23 class Html5Input extends InputWidget
24 24 {
25 25 /**
26   - * @var array the special inputs which need captions
27   - */
28   - private static $_specialInputs = [
29   - 'color',
30   - 'range'
31   - ];
32   - /**
33 26 * @var string the HTML 5 input type
34 27 */
35 28 public $type;
  29 +
36 30 /**
37 31 * @var string the width in 'px' or '%' of the HTML5 input container
38 32 */
39 33 public $width;
  34 +
40 35 /**
41 36 * @var array the HTML attributes for the widget container
42 37 */
43 38 public $containerOptions = [];
  39 +
44 40 /**
45 41 * @var array the HTML attributes for the HTML-5 input.
46 42 */
47 43 public $html5Options = [];
  44 +
48 45 /**
49 46 * @var array the HTML attributes for the HTML-5 input container
50 47 */
51 48 public $html5Container = [];
  49 +
52 50 /**
53 51 * @var string|boolean the message shown for unsupported browser. If set to false
54 52 * will not be displayed
55 53 */
56 54 public $noSupport;
  55 +
57 56 /**
58 57 * @var string array the HTML attributes for container displaying unsupported browser message
59 58 */
60 59 public $noSupportOptions = [];
  60 +
61 61 /**
62 62 * @var string one of the SIZE modifiers 'lg', 'md', 'sm', 'xs'
63 63 */
64 64 public $size;
  65 +
65 66 /**
66 67 * @var array the addon content
67   - * - prepend: array/string the prepend addon content. If set as an array, the
68   - * following options can be set:
  68 + * - prepend: array/string the prepend addon content. If set as an array, the following options can be set:
69 69 * - content: string the prepend addon content
70 70 * - asButton: boolean whether the addon is a button
71 71 * - options: array the HTML attributes for the prepend addon
72   - * - append: array/string the append addon content. If set as an array, the
73   - * following options can be set:
  72 + * - append: array/string the append addon content. If set as an array, the following options can be set:
74 73 * - content: string the append addon content
75 74 * - asButton: boolean whether the addon is a button
76 75 * - options: array the HTML attributes for the append addon
77   - * - preCaption: array/string the addon content placed before the caption. If
78   - * set as an array, the following options can be set:
  76 + * - preCaption: array/string the addon content placed before the caption. If set as an array, the following
  77 + * options can be set:
79 78 * - content: string the append addon content
80 79 * - asButton: boolean whether the addon is a button
81 80 * - options: array the HTML attributes for the append addon */
82 81 public $addon = [];
83 82  
84 83 /**
85   - * Runs the widget
  84 + * @var array the special inputs which need captions
  85 + */
  86 + private static $_specialInputs = [
  87 + 'color',
  88 + 'range'
  89 + ];
  90 +
  91 + /**
  92 + * @inheritdoc
86 93 */
87   - public function init()
  94 + public function run()
88 95 {
89   - parent::init();
90 96 $this->initInput();
91 97 }
92 98  
  99 + /**
  100 + * Initializes the input
  101 + */
93 102 protected function initInput()
94 103 {
95 104 $this->initDisability($this->html5Options);
... ... @@ -117,7 +126,7 @@ class Html5Input extends InputWidget
117 126 $input = 'jQuery("#' . $this->html5Options['id'] . '")';
118 127 $js = "{$caption}.on('change',function(){{$input}.val(this.value)});\n" .
119 128 "{$input}.on('input change',function(e){{$caption}.val(this.value);if(e.type=='change'){{$caption}.trigger('change');}});";
120   - $view->registerJs($js);
  129 + $this->registerWidgetJs($js);
121 130 }
122 131  
123 132 /**
... ... @@ -146,8 +155,11 @@ class Html5Input extends InputWidget
146 155 $message = '';
147 156 } else {
148 157 $noSupport = !empty($this->noSupport) ? $this->noSupport :
149   - Yii::t('app', 'It is recommended you use an upgraded browser to display the {type} control properly.',
150   - ['type' => $this->type]);
  158 + Yii::t(
  159 + 'kvbase',
  160 + 'It is recommended you use an upgraded browser to display the {type} control properly.',
  161 + ['type' => $this->type]
  162 + );
151 163 $message = "\n<br>" . Html::tag('div', $noSupport, $this->noSupportOptions);
152 164 }
153 165 return "<!--[if lt IE 10]>\n{$caption}{$message}\n<![endif]--><![if gt IE 9]>\n{$content}\n<![endif]>";
... ...
vendor/kartik-v/yii2-krajee-base/Html5InputAsset.php
... ... @@ -3,7 +3,7 @@
3 3 /**
4 4 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
5 5 * @package yii2-krajee-base
6   - * @version 1.7.7
  6 + * @version 1.7.8
7 7 */
8 8  
9 9 namespace kartik\base;
... ... @@ -14,7 +14,7 @@ namespace kartik\base;
14 14 * @author Kartik Visweswaran <kartikv2@gmail.com>
15 15 * @since 1.0
16 16 */
17   -class Html5InputAsset extends \kartik\base\AssetBundle
  17 +class Html5InputAsset extends AssetBundle
18 18 {
19 19 /**
20 20 * @inheritdoc
... ...
vendor/kartik-v/yii2-krajee-base/InputWidget.php
... ... @@ -4,12 +4,13 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
11 11  
12 12 use Yii;
  13 +use yii\base\InvalidConfigException;
13 14 use yii\helpers\FormatConverter;
14 15 use yii\helpers\Html;
15 16 use yii\helpers\ArrayHelper;
... ... @@ -77,6 +78,12 @@ class InputWidget extends \yii\widgets\InputWidget
77 78 * ~~~
78 79 */
79 80 public $pluginEvents = [];
  81 +
  82 + /**
  83 + * @var string a pjax container identifier if applicable inside which the widget will be rendered.
  84 + * If this is set, the widget will automatically reinitialize on pjax completion.
  85 + */
  86 + public $pjaxContainerId;
80 87  
81 88 /**
82 89 * @var boolean whether the widget should automatically format the date from
... ... @@ -132,6 +139,15 @@ class InputWidget extends \yii\widgets\InputWidget
132 139 public function init()
133 140 {
134 141 parent::init();
  142 + $this->initInputWidget();
  143 + }
  144 +
  145 + /**
  146 + * Initializes the input widget
  147 + */
  148 + protected function initInputWidget()
  149 + {
  150 + $this->initI18N(__DIR__, 'kvbase');
135 151 if (!isset($this->language)) {
136 152 $this->language = Yii::$app->language;
137 153 }
... ... @@ -182,6 +198,7 @@ class InputWidget extends \yii\widgets\InputWidget
182 198 /**
183 199 * Sets the language JS file if it exists
184 200 *
  201 + * @param string $prefix the language filename prefix
185 202 * @param string $assetPath the path to the assets
186 203 * @param string $filePath the path to the JS file with the file name prefix
187 204 * @param string $suffix the file name suffix - defaults to '.js'
... ... @@ -220,6 +237,11 @@ class InputWidget extends \yii\widgets\InputWidget
220 237  
221 238 /**
222 239 * Generates an input
  240 + *
  241 + * @param string $type the input type
  242 + * @param bool $list whether the input is of dropdown list type
  243 + *
  244 + * @return mixed
223 245 */
224 246 protected function getInput($type, $list = false)
225 247 {
... ... @@ -313,20 +335,18 @@ class InputWidget extends \yii\widgets\InputWidget
313 335 }
314 336 if (isset($this->pluginOptions['format'])) {
315 337 $format = $this->pluginOptions['format'];
316   - $format = strncmp($format, 'php:', 4) === 0 ? substr($format,
317   - 4) : FormatConverter::convertDateIcuToPhp($format, $type);
  338 + $format = strncmp($format, 'php:', 4) === 0 ? substr($format, 4) :
  339 + FormatConverter::convertDateIcuToPhp($format, $type);
318 340 $this->pluginOptions['format'] = static::convertDateFormat($format);
319 341 return;
320 342 }
321 343 $attrib = $type . 'Format';
322 344 $format = isset(Yii::$app->formatter->$attrib) ? Yii::$app->formatter->$attrib : '';
323   - if (isset($this->dateFormat) && strncmp($this->dateFormat, 'php:', 4) === 0) {
324   - $this->pluginOptions['format'] = static::convertDateFormat(substr($format, 4));
325   - } elseif ($format != '') {
326   - $format = FormatConverter::convertDateIcuToPhp($format, $type);
327   - $this->pluginOptions['format'] = static::convertDateFormat($format);
328   - } else {
329   - throw InvalidConfigException("Error parsing '{$type}' format.");
  345 + if (empty($format)) {
  346 + throw new InvalidConfigException("Error parsing '{$type}' format.");
330 347 }
  348 + $format = strncmp($format, 'php:', 4) === 0 ? substr($format, 4) :
  349 + FormatConverter::convertDateIcuToPhp($format, $type);
  350 + $this->pluginOptions['format'] = static::convertDateFormat($format);
331 351 }
332   -}
333 352 \ No newline at end of file
  353 +}
... ...
vendor/kartik-v/yii2-krajee-base/Module.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -13,7 +13,7 @@ namespace kartik\base;
13 13 * Base module class for Krajee extensions
14 14 *
15 15 * @author Kartik Visweswaran <kartikv2@gmail.com>
16   - * @since 1.7.7
  16 + * @since 1.7.8
17 17 */
18 18 class Module extends \yii\base\Module
19 19 {
... ...
vendor/kartik-v/yii2-krajee-base/PluginAssetBundle.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -26,4 +26,3 @@ class PluginAssetBundle extends AssetBundle
26 26 'yii\bootstrap\BootstrapPluginAsset'
27 27 ];
28 28 }
29   -
30 29 \ No newline at end of file
... ...
vendor/kartik-v/yii2-krajee-base/README.md
1 1 yii2-krajee-base
2 2 ================
3 3  
4   -[![Latest Stable Version](https://poser.pugx.org/kartik-v/yii2-krajee-base/v/stable)](https://packagist.org/packages/kartik-v/yii2-krajee-base)
  4 +[![Latest Stable Version](https://img.shields.io/packagist/v/kartik-v/yii2-krajee-base.svg)](https://packagist.org/packages/kartik-v/yii2-krajee-base)
5 5 [![License](https://poser.pugx.org/kartik-v/yii2-krajee-base/license)](https://packagist.org/packages/kartik-v/yii2-krajee-base)
6 6 [![Total Downloads](https://poser.pugx.org/kartik-v/yii2-krajee-base/downloads)](https://packagist.org/packages/kartik-v/yii2-krajee-base)
7 7 [![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-krajee-base/d/monthly)](https://packagist.org/packages/kartik-v/yii2-krajee-base)
... ... @@ -15,7 +15,7 @@ This is a base library with set of foundation classes and components used by all
15 15 To ensure a leaner code base / foundation component for use in all Krajee extensions (e.g. yii2-widgets, yii2-datecontrol, yii2-grid, yii2-dynagrid etc.). This should allow most developers to plug and play components only they need, without needing the complete suite of widgets. For example, this mitigates [this issue](https://github.com/kartik-v/yii2-grid/issues/123).
16 16  
17 17 ## Latest Release
18   -The latest version of the extension is v1.7.7. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-krajee-base/blob/master/CHANGE.md) for details.
  18 +The latest version of the extension is v1.7.8. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-krajee-base/blob/master/CHANGE.md) for details.
19 19  
20 20 ## Extension Classes
21 21  
... ...
vendor/kartik-v/yii2-krajee-base/TranslationTrait.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -14,33 +14,41 @@ use Yii;
14 14 /**
15 15 * Trait for all translations used in Krajee extensions
16 16 *
  17 + * @property array $i18n
  18 + *
17 19 * @author Kartik Visweswaran <kartikv2@gmail.com>
18   - * @since 1.7.7
  20 + * @since 1.7.8
19 21 */
20 22 trait TranslationTrait
21 23 {
22 24 /**
23 25 * Yii i18n messages configuration for generating translations
24 26 *
  27 + * @param string $dir the directory path where translation files will exist
  28 + * @param string $cat the message category
  29 + *
25 30 * @return void
26 31 */
27   - public function initI18N($dir = '')
  32 + public function initI18N($dir = '', $cat = '')
28 33 {
29   - if (empty($this->_msgCat)) {
  34 + if (empty($cat) && empty($this->_msgCat)) {
30 35 return;
31 36 }
  37 + if (empty($cat)) {
  38 + $cat = $this->_msgCat;
  39 + }
32 40 if (empty($dir)) {
33 41 $reflector = new \ReflectionClass(get_class($this));
34 42 $dir = dirname($reflector->getFileName());
35 43 }
36   - Yii::setAlias("@{$this->_msgCat}", $dir);
  44 + Yii::setAlias("@{$cat}", $dir);
37 45 if (empty($this->i18n)) {
38 46 $this->i18n = [
39 47 'class' => 'yii\i18n\PhpMessageSource',
40   - 'basePath' => "@{$this->_msgCat}/messages",
  48 + 'basePath' => "@{$cat}/messages",
41 49 'forceTranslation' => true
42 50 ];
43 51 }
44   - Yii::$app->i18n->translations[$this->_msgCat . '*'] = $this->i18n;
  52 + Yii::$app->i18n->translations["{$cat}*"] = $this->i18n;
45 53 }
46   -}
47 54 \ No newline at end of file
  55 +}
... ...
vendor/kartik-v/yii2-krajee-base/Widget.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -33,9 +33,7 @@ class Widget extends \yii\base\Widget
33 33 public $pluginOptions = [];
34 34  
35 35 /**
36   - * @var array widget JQuery events. You must define events in
37   - * event-name => event-function format
38   - * for example:
  36 + * @var array widget JQuery events. You must define events in event-name => event-function format for example:
39 37 * ~~~
40 38 * pluginEvents = [
41 39 * "change" => "function() { log("change"); }",
... ... @@ -46,6 +44,12 @@ class Widget extends \yii\base\Widget
46 44 public $pluginEvents = [];
47 45  
48 46 /**
  47 + * @var string a pjax container identifier if applicable inside which the widget will be rendered. If this is set,
  48 + * the widget will automatically reinitialize on pjax completion.
  49 + */
  50 + public $pjaxContainerId;
  51 +
  52 + /**
49 53 * @var array the the internalization configuration for this widget
50 54 */
51 55 public $i18n = [];
... ...
vendor/kartik-v/yii2-krajee-base/WidgetAsset.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ...
vendor/kartik-v/yii2-krajee-base/WidgetTrait.php
... ... @@ -4,7 +4,7 @@
4 4 * @package yii2-krajee-base
5 5 * @author Kartik Visweswaran <kartikv2@gmail.com>
6 6 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
7   - * @version 1.7.7
  7 + * @version 1.7.8
8 8 */
9 9  
10 10 namespace kartik\base;
... ... @@ -16,6 +16,14 @@ use yii\web\View;
16 16 /**
17 17 * Trait used for Krajee widgets.
18 18 *
  19 + * @property array $options
  20 + * @property array $pluginOptions
  21 + * @property array $_encOptions
  22 + * @property string $_hashVar
  23 + * @property string $_dataVar
  24 + *
  25 + * @method View getView()
  26 + *
19 27 * @author Kartik Visweswaran <kartikv2@gmail.com>
20 28 * @since 1.6.0
21 29 */
... ... @@ -30,6 +38,7 @@ trait WidgetTrait
30 38 */
31 39 protected function setDataVar($name)
32 40 {
  41 + /** @noinspection PhpUndefinedFieldInspection */
33 42 $this->_dataVar = "data-krajee-{$name}";
34 43 }
35 44  
... ... @@ -76,14 +85,15 @@ trait WidgetTrait
76 85 /**
77 86 * Registers plugin options by storing it in a hashed javascript variable
78 87 *
  88 + * @param string $name the plugin name
  89 + *
79 90 * @return void
80 91 */
81 92 protected function registerPluginOptions($name)
82 93 {
83   - $view = $this->getView();
84 94 $this->hashPluginOptions($name);
85 95 $encOptions = empty($this->_encOptions) ? '{}' : $this->_encOptions;
86   - $view->registerJs("var {$this->_hashVar} = {$encOptions};\n", View::POS_HEAD);
  96 + $this->registerWidgetJs("var {$this->_hashVar} = {$encOptions};\n", View::POS_HEAD);
87 97 }
88 98  
89 99 /**
... ... @@ -94,7 +104,7 @@ trait WidgetTrait
94 104 * @param string $callback the javascript callback function to be called after plugin loads
95 105 * @param string $callbackCon the javascript callback function to be passed to the plugin constructor
96 106 *
97   - * @return the generated plugin script
  107 + * @return string the generated plugin script
98 108 */
99 109 protected function getPluginScript($name, $element = null, $callback = null, $callbackCon = null)
100 110 {
... ... @@ -131,9 +141,35 @@ trait WidgetTrait
131 141 protected function registerPlugin($name, $element = null, $callback = null, $callbackCon = null)
132 142 {
133 143 $script = $this->getPluginScript($name, $element, $callback, $callbackCon);
134   - if (!empty($script)) {
135   - $view = $this->getView();
136   - $view->registerJs($script);
  144 + $this->registerWidgetJs($script);
  145 + }
  146 +
  147 + /**
  148 + * Registers a JS code block for the widget.
  149 + *
  150 + * @param string $js the JS code block to be registered
  151 + * @param integer $position the position at which the JS script tag should be inserted in a page. The possible
  152 + * values are:
  153 + * - [[POS_HEAD]]: in the head section
  154 + * - [[POS_BEGIN]]: at the beginning of the body section
  155 + * - [[POS_END]]: at the end of the body section
  156 + * - [[POS_LOAD]]: enclosed within jQuery(window).load(). Note that by using this position, the method will
  157 + * automatically register the jQuery js file.
  158 + * - [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value. Note that by using
  159 + * this position, the method will automatically register the jQuery js file.
  160 + * @param string $key the key that identifies the JS code block. If null, it will use $js as the key. If two JS
  161 + * code blocks are registered with the same key, the latter will overwrite the former.
  162 + */
  163 + public function registerWidgetJs($js, $position = View::POS_READY, $key = null)
  164 + {
  165 + if (empty($js)) {
  166 + return;
  167 + }
  168 + $view = $this->getView();
  169 + $view->registerJs($js, $position, $key);
  170 + if (!empty($this->pjaxContainerId) && ($position === View::POS_LOAD || $position === View::POS_READY)) {
  171 + $pjax = 'jQuery("#' . $this->pjaxContainerId . '")';
  172 + $view->registerJs("{$pjax}.on('pjax:complete',function(){ {$js} });");
137 173 }
138 174 }
139   -}
140 175 \ No newline at end of file
  176 +}
... ...
vendor/kartik-v/yii2-krajee-base/assets/css/html5input.css
... ... @@ -3,7 +3,7 @@
3 3 * @subpackage yii2-widget-activeform
4 4 * @author Kartik Visweswaran <kartikv2@gmail.com>
5 5 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
6   - * @version 1.7.7
  6 + * @version 1.7.8
7 7 *
8 8 * HTML 5 input styling for Twitter Bootstrap 3.0
9 9 * Covers color and range inputs
... ...
vendor/kartik-v/yii2-krajee-base/assets/css/html5input.min.css
... ... @@ -3,7 +3,7 @@
3 3 * @subpackage yii2-widget-activeform
4 4 * @author Kartik Visweswaran <kartikv2@gmail.com>
5 5 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
6   - * @version 1.7.7
  6 + * @version 1.7.8
7 7 *
8 8 * HTML 5 input styling for Twitter Bootstrap 3.0
9 9 * Covers color and range inputs
... ...
vendor/kartik-v/yii2-krajee-base/assets/css/kv-widgets.css
... ... @@ -3,7 +3,7 @@
3 3 * @subpackage yii2-widget-activeform
4 4 * @author Kartik Visweswaran <kartikv2@gmail.com>
5 5 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
6   - * @version 1.7.7
  6 + * @version 1.7.8
7 7 *
8 8 * Common CSS file for all kartik\widgets.
9 9 *
... ...
vendor/kartik-v/yii2-krajee-base/assets/css/kv-widgets.min.css
... ... @@ -3,7 +3,7 @@
3 3 * @subpackage yii2-widget-activeform
4 4 * @author Kartik Visweswaran <kartikv2@gmail.com>
5 5 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2015
6   - * @version 1.7.7
  6 + * @version 1.7.8
7 7 *
8 8 * Common CSS file for all kartik\widgets.
9 9 *
... ...
vendor/rmrevin/yii2-fontawesome/.bowerrc deleted
1   -{
2   - "directory": "vendor/bower",
3   - "interactive": true
4   -}
5 0 \ No newline at end of file
vendor/rmrevin/yii2-fontawesome/.scrutinizer.yml
... ... @@ -4,7 +4,7 @@ build:
4 4 version: 5.5.12
5 5 dependencies:
6 6 before:
7   - - composer global require "fxp/composer-asset-plugin:1.0.0"
  7 + - composer global require "fxp/composer-asset-plugin:~1.0.0"
8 8 tests:
9 9 override:
10 10 - phpunit
... ...
vendor/rmrevin/yii2-fontawesome/CHANGELOG.md
  1 +2015-11-20 - 2.12.2
  2 +-------------------
  3 +* Add shortcuts methods `i()` for `FA::icon()` and `FA::s()` for `FA::stack()`
  4 +* Update readme
  5 +
  6 +2015-11-09 - 2.12.1
  7 +-------------------
  8 +* Variable `FA::$cssPrefix` transferred to the class `FontAwesome`.
  9 +* Refactoring.
  10 +* Update tests.
  11 +
1 12 2015-08-15 - 2.12.0
2 13 -------------------
3 14 * `Font Awesome` updated to version `4.4`.
... ...
vendor/rmrevin/yii2-fontawesome/FA.php
... ... @@ -14,9 +14,6 @@ namespace rmrevin\yii\fontawesome;
14 14 class FA extends FontAwesome
15 15 {
16 16  
17   - /** @var string CSS Class prefix */
18   - public static $cssPrefix = 'fa';
19   -
20 17 /**
21 18 * Get all icon constants for dropdown list in example
22 19 * @param bool $html whether to render icon as array value prefix
... ...
vendor/rmrevin/yii2-fontawesome/FontAwesome.php
... ... @@ -7,6 +7,8 @@
7 7  
8 8 namespace rmrevin\yii\fontawesome;
9 9  
  10 +use rmrevin\yii\fontawesome\component;
  11 +
10 12 /**
11 13 * Class FA
12 14 * @package rmrevin\yii\fontawesome
... ... @@ -14,7 +16,12 @@ namespace rmrevin\yii\fontawesome;
14 16 class FontAwesome
15 17 {
16 18  
  19 + /** @var string CSS Class prefix */
  20 + public static $cssPrefix = 'fa';
  21 +
17 22 /**
  23 + * Creates an `Icon` component that can be used to FontAwesome html icon
  24 + *
18 25 * @param string $name
19 26 * @param array $options
20 27 * @return component\Icon
... ... @@ -25,6 +32,21 @@ class FontAwesome
25 32 }
26 33  
27 34 /**
  35 + * Shortcut for `icon()` method
  36 + * @see icon()
  37 + *
  38 + * @param string $name
  39 + * @param array $options
  40 + * @return component\Icon
  41 + */
  42 + public static function i($name, $options = [])
  43 + {
  44 + return static::icon($name, $options);
  45 + }
  46 +
  47 + /**
  48 + * Creates an `Stack` component that can be used to FontAwesome html icon
  49 + *
28 50 * @param array $options
29 51 * @return component\Stack
30 52 */
... ... @@ -34,6 +56,18 @@ class FontAwesome
34 56 }
35 57  
36 58 /**
  59 + * Shortcut for `stack()` method
  60 + * @see stack()
  61 + *
  62 + * @param array $options
  63 + * @return component\Stack
  64 + */
  65 + public static function s($options = [])
  66 + {
  67 + return static::stack($options);
  68 + }
  69 +
  70 + /**
37 71 * Size values
38 72 * @see rmrevin\yii\fontawesome\component\Icon::size
39 73 */
... ... @@ -57,4 +91,4 @@ class FontAwesome
57 91 */
58 92 const FLIP_HORIZONTAL = 'horizontal';
59 93 const FLIP_VERTICAL = 'vertical';
60   -}
61 94 \ No newline at end of file
  95 +}
... ...
vendor/rmrevin/yii2-fontawesome/README.md
1   -Yii 2 Font Awesome Asset Bundle
  1 +Yii 2 [Font Awesome](http://fortawesome.github.io/Font-Awesome/) Asset Bundle
2 2 ===============================
3 3  
4 4 This extension provides a assets bundle with [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
... ... @@ -20,7 +20,8 @@ Code Status
20 20  
21 21 Support
22 22 -------
23   -[GutHub issues](https://github.com/rmrevin/yii2-fontawesome/issues) or [public chat](https://gitter.im/rmrevin/support).
  23 +* [GutHub issues](https://github.com/rmrevin/yii2-fontawesome/issues)
  24 +* [Public chat](https://gitter.im/rmrevin/support)
24 25  
25 26 Installation
26 27 ------------
... ... @@ -30,13 +31,13 @@ The preferred way to install this extension is through [composer](https://getcom
30 31 Either run
31 32  
32 33 ```bash
33   -composer require "rmrevin/yii2-fontawesome:2.10.*"
  34 +composer require "rmrevin/yii2-fontawesome:~2.12"
34 35 ```
35 36  
36 37 or add
37 38  
38 39 ```
39   -"rmrevin/yii2-fontawesome": "2.10.*",
  40 +"rmrevin/yii2-fontawesome": "~2.12",
40 41 ```
41 42  
42 43 to the `require` section of your `composer.json` file.
... ... @@ -66,22 +67,78 @@ class AppAsset extends AssetBundle
66 67  
67 68 ```
68 69  
69   -Helper
70   -------
  70 +Class reference
  71 +---------------
  72 +
  73 +Namespace: `rmrevin\yii\fontawesome`;
  74 +
  75 +###Class `FA` or `FontAwesome`
  76 +
  77 +* `static FA::icon($name, $options=[])` - Creates an [`component\Icon`](#class-componenticon-icon) that can be used to FontAwesome html icon
  78 + * `$name` - name of icon in font awesome set.
  79 + * `$options` - additional attributes for `i.fa` html tag.
  80 +* `static FA::stack($name, $options=[])` - Creates an [`component\Stack`](#class-componentstack-stack) that can be used to FontAwesome html icon
  81 + * `$options` - additional attributes for `span.fa-stack` html tag.
  82 +
  83 +###Class `component\Icon` (`$Icon`)
  84 +
  85 +* `(string)$Icon` - render icon
  86 +* `$Icon->render()` - render icon
  87 +* `$Icon->tag($value)` - set another html tag for icon (default `i`)
  88 + * `$value` - name of tag
  89 +* `$Icon->addCssClass($value)` - add to html tag css class in `$value`
  90 + * `$value` - name of css class
  91 +* `$Icon->inverse()` - add to html tag css class `fa-inverse`
  92 +* `$Icon->spin()` - add to html tag css class `fa-spin`
  93 +* `$Icon->fixedWidth()` - add to html tag css class `fa-fw`
  94 +* `$Icon->ul()` - add to html tag css class `fa-ul`
  95 +* `$Icon->li()` - add to html tag css class `fa-li`
  96 +* `$Icon->border()` - add to html tag css class `fa-border`
  97 +* `$Icon->pullLeft()` - add to html tag css class `pull-left`
  98 +* `$Icon->pullRight()` - add to html tag css class `pull-right`
  99 +* `$Icon->size($value)` - add to html tag css class with size
  100 + * `$value` - size value (variants: `FA::SIZE_LARGE`, `FA::SIZE_2X`, `FA::SIZE_3X`, `FA::SIZE_4X`, `FA::SIZE_5X`)
  101 +* `$Icon->rotate($value)` - add to html tag css class with rotate
  102 + * `$value` - rotate value (variants: `FA::ROTATE_90`, `FA::ROTATE_180`, `FA::ROTATE_270`)
  103 +* `$Icon->flip($value)` - add to html tag css class with rotate
  104 + * `$value` - flip value (variants: `FA::FLIP_HORIZONTAL`, `FA::FLIP_VERTICAL`)
  105 +
  106 +###Class `component\Stack` (`$Stack`)
  107 +
  108 +* `(string)$Stack` - render icon stack
  109 +* `$Stack->render()` - render icon stack
  110 +* `$Stack->tag($value)` - set another html tag for icon stack (default `span`)
  111 +* `$Stack->icon($icon, $options=[])` - set icon for stack
  112 + * `$icon` - name of icon or `component\Icon` object
  113 + * `$options` - additional attributes for icon html tag.
  114 +* `$Stack->icon($icon, $options=[])` - set background icon for stack
  115 + * `$icon` - name of icon or `component\Icon` object
  116 + * `$options` - additional attributes for icon html tag.
  117 +
  118 +Helper examples
  119 +---------------
71 120  
72 121 ```php
73 122 use rmrevin\yii\fontawesome\FA;
74 123  
  124 +// normal use
75 125 echo FA::icon('home'); // <i class="fa fa-home"></i>
  126 +
  127 +// shortcut
  128 +echo FA::i('home'); // <i class="fa fa-home"></i>
  129 +
  130 +// icon with additional attributes
76 131 echo FA::icon(
77 132 'arrow-left',
78 133 ['class' => 'big', 'data-role' => 'arrow']
79 134 ); // <i class="big fa fa-arrow-left" data-role="arrow"></i>
80 135  
  136 +// icon in button
81 137 echo Html::submitButton(
82 138 Yii::t('app', '{icon} Save', ['icon' => FA::icon('check')])
83 139 ); // <button type="submit"><i class="fa fa-check"></i> Save</button>
84 140  
  141 +// icon with additional methods
85 142 echo FA::icon('cog')->inverse(); // <i class="fa fa-cog fa-inverse"></i>
86 143 echo FA::icon('cog')->spin(); // <i class="fa fa-cog fa-spin"></i>
87 144 echo FA::icon('cog')->fixedWidth(); // <i class="fa fa-cog fa-fw"></i>
... ... @@ -91,18 +148,22 @@ echo FA::icon(&#39;cog&#39;)-&gt;border(); // &lt;i class=&quot;fa fa-cog fa-border&quot;&gt;&lt;/i&gt;
91 148 echo FA::icon('cog')->pullLeft(); // <i class="fa fa-cog pull-left"></i>
92 149 echo FA::icon('cog')->pullRight(); // <i class="fa fa-cog pull-right"></i>
93 150  
  151 +// icon size
94 152 echo FA::icon('cog')->size(FA::SIZE_3X);
95 153 // values: FA::SIZE_LARGE, FA::SIZE_2X, FA::SIZE_3X, FA::SIZE_4X, FA::SIZE_5X
96 154 // <i class="fa fa-cog fa-size-3x"></i>
97 155  
  156 +// icon rotate
98 157 echo FA::icon('cog')->rotate(FA::ROTATE_90);
99 158 // values: FA::ROTATE_90, FA::ROTATE_180, FA::ROTATE_180
100 159 // <i class="fa fa-cog fa-rotate-90"></i>
101 160  
  161 +// icon flip
102 162 echo FA::icon('cog')->flip(FA::FLIP_VERTICAL);
103 163 // values: FA::FLIP_HORIZONTAL, FA::FLIP_VERTICAL
104 164 // <i class="fa fa-cog fa-flip-vertical"></i>
105 165  
  166 +// icon with multiple methods
106 167 echo FA::icon('cog')
107 168 ->spin()
108 169 ->fixedWidth()
... ... @@ -110,6 +171,7 @@ echo FA::icon(&#39;cog&#39;)
110 171 ->size(FA::SIZE_LARGE);
111 172 // <i class="fa fa-cog fa-spin fa-fw pull-left fa-size-lg"></i>
112 173  
  174 +// icons stack
113 175 echo FA::stack()
114 176 ->icon('twitter')
115 177 ->on('square-o');
... ... @@ -118,9 +180,10 @@ echo FA::stack()
118 180 // <i class="fa fa-twitter fa-stack-1x"></i>
119 181 // </span>
120 182  
  183 +// icons stack with additional attributes
121 184 echo FA::stack(['data-role' => 'stacked-icon'])
122   - ->on((new FA\Icon('square'))->inverse())
123   - ->icon((new FA\Icon('cog'))->spin());
  185 + ->on(FA::Icon('square')->inverse())
  186 + ->icon(FA::Icon('cog')->spin());
124 187 // <span class="fa-stack" data-role="stacked-icon">
125 188 // <i class="fa fa-square-o fa-inverse fa-stack-2x"></i>
126 189 // <i class="fa fa-cog fa-spin fa-stack-1x"></i>
... ... @@ -130,8 +193,8 @@ echo FA::stack([&#39;data-role&#39; =&gt; &#39;stacked-icon&#39;])
130 193 echo FA::icon(FA::_COG);
131 194 echo FA::icon(FA::_DESKTOP);
132 195 echo FA::stack()
133   - ->on((new FA\Icon(FA::_SQUARE))->inverse())
134   - ->icon((new FA\Icon(FA::_COG))->spin());
  196 + ->on(FA::_CIRCLE_O)
  197 + ->icon(FA::_TWITTER);
135 198 ```
136 199  
137 200 ### Set another prefix
... ...
vendor/rmrevin/yii2-fontawesome/component/Icon.php
... ... @@ -215,6 +215,7 @@ class Icon
215 215 * @param string|bool $throw
216 216 * @return \rmrevin\yii\fontawesome\component\Icon
217 217 * @throws \yii\base\InvalidConfigException
  218 + * @codeCoverageIgnore
218 219 */
219 220 public function addCssClass($class, $condition = true, $throw = false)
220 221 {
... ... @@ -249,4 +250,4 @@ class Icon
249 250  
250 251 return Html::tag($tag, $content, $options);
251 252 }
252 253 -}
  254 +}
253 255 \ No newline at end of file
... ...
vendor/rmrevin/yii2-fontawesome/composer.json
... ... @@ -17,9 +17,9 @@
17 17 },
18 18 "authors": [
19 19 {
20   - "name": "Roman Revin",
21   - "email": "xgismox@gmail.com",
22   - "homepage": "http://rmrevin.ru/"
  20 + "name": "Revin Roman",
  21 + "email": "roman@rmrevin.com",
  22 + "homepage": "https://rmrevin.com/"
23 23 }
24 24 ],
25 25 "require": {
... ...
vendor/rmrevin/yii2-fontawesome/composer.lock
... ... @@ -4,7 +4,8 @@
4 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5 "This file is @generated automatically"
6 6 ],
7   - "hash": "54ddca2d2b639ae136422a58590cdccc",
  7 + "hash": "a6e2105374df8af26fdde9137b018143",
  8 + "content-hash": "94d3274c874502d1e22ab4ff59c2386f",
8 9 "packages": [
9 10 {
10 11 "name": "bower-asset/fontawesome",
... ...
vendor/rmrevin/yii2-fontawesome/phpunit.xml.dist
... ... @@ -6,10 +6,13 @@
6 6 convertWarningsToExceptions="true"
7 7 stopOnFailure="false">
8 8 <filter>
9   - <blacklist>
10   - <directory suffix=".php">./tests</directory>
11   - <directory suffix=".php">./vendor</directory>
12   - </blacklist>
  9 + <whitelist>
  10 + <directory suffix=".php">./</directory>
  11 + <exclude>
  12 + <directory>./tests</directory>
  13 + <directory>./vendor</directory>
  14 + </exclude>
  15 + </whitelist>
13 16 </filter>
14 17 <testsuites>
15 18 <testsuite name="Test Suite">
... ...
vendor/rmrevin/yii2-fontawesome/tests/unit/fontawesome/MainTest.php
... ... @@ -76,6 +76,33 @@ class MainTest extends \rmrevin\yii\fontawesome\tests\unit\TestCase
76 76 ->on((new Icon('square-o'))->size(FA::SIZE_3X)),
77 77 '<span class="fa-stack"><i class="fa fa-square-o fa-3x fa-stack-2x"></i><i class="fa fa-cog fa-spin fa-stack-1x"></i></span>'
78 78 );
  79 +
  80 + $this->assertEquals(
  81 + (string)FA::stack()
  82 + ->icon(FA::Icon('cog')->spin())
  83 + ->on(FA::Icon('square-o')->size(FA::SIZE_3X)),
  84 + '<span class="fa-stack"><i class="fa fa-square-o fa-3x fa-stack-2x"></i><i class="fa fa-cog fa-spin fa-stack-1x"></i></span>'
  85 + );
  86 +
  87 + $this->assertNotEquals(
  88 + (string)FA::stack()
  89 + ->icon((string)FA::Icon('cog')->spin())
  90 + ->on((string)FA::Icon('square-o')->size(FA::SIZE_3X)),
  91 + '<span class="fa-stack"><i class="fa fa-square-o fa-3x fa-stack-2x"></i><i class="fa fa-cog fa-spin fa-stack-1x"></i></span>'
  92 + );
  93 + }
  94 +
  95 + public function testAnotherPrefix()
  96 + {
  97 + $old_prefix = FA::$cssPrefix;
  98 +
  99 + FA::$cssPrefix = 'fontawesome';
  100 +
  101 + $this->assertEquals(FA::icon('cog'), '<i class="fontawesome fontawesome-cog"></i>');
  102 + $this->assertEquals(FA::icon('cog')->tag('span'), '<span class="fontawesome fontawesome-cog"></span>');
  103 + $this->assertEquals(FA::icon('cog')->addCssClass('highlight'), '<i class="fontawesome fontawesome-cog highlight"></i>');
  104 +
  105 + FA::$cssPrefix = $old_prefix;
79 106 }
80 107  
81 108 public function testIconOutput()
... ... @@ -145,4 +172,15 @@ class MainTest extends \rmrevin\yii\fontawesome\tests\unit\TestCase
145 172 FA::icon('cog')
146 173 ->flip('badvalue');
147 174 }
  175 +
  176 + public function testIconAddCssClassCondition()
  177 + {
  178 + $this->assertEquals(FA::icon('cog')->addCssClass('highlight', true), '<i class="fa fa-cog highlight"></i>');
  179 +
  180 + $this->setExpectedException(
  181 + 'yii\base\InvalidConfigException',
  182 + 'Condition is false'
  183 + );
  184 + FA::icon('cog')->addCssClass('highlight', false, true);
  185 + }
148 186 }
149 187 \ No newline at end of file
... ...
vendor/yiisoft/extensions.php
... ... @@ -57,15 +57,6 @@ return array (
57 57 '@yii/faker' => $vendorDir . '/yiisoft/yii2-faker',
58 58 ),
59 59 ),
60   - 'rmrevin/yii2-fontawesome' =>
61   - array (
62   - 'name' => 'rmrevin/yii2-fontawesome',
63   - 'version' => '2.12.0.0',
64   - 'alias' =>
65   - array (
66   - '@rmrevin/yii/fontawesome' => $vendorDir . '/rmrevin/yii2-fontawesome',
67   - ),
68   - ),
69 60 'cebe/yii2-gravatar' =>
70 61 array (
71 62 'name' => 'cebe/yii2-gravatar',
... ... @@ -75,15 +66,6 @@ return array (
75 66 '@cebe/gravatar' => $vendorDir . '/cebe/yii2-gravatar/cebe/gravatar',
76 67 ),
77 68 ),
78   - 'dmstr/yii2-adminlte-asset' =>
79   - array (
80   - 'name' => 'dmstr/yii2-adminlte-asset',
81   - 'version' => '2.2.3.0',
82   - 'alias' =>
83   - array (
84   - '@dmstr' => $vendorDir . '/dmstr/yii2-adminlte-asset',
85   - ),
86   - ),
87 69 'yiisoft/yii2-jui' =>
88 70 array (
89 71 'name' => 'yiisoft/yii2-jui',
... ... @@ -93,15 +75,6 @@ return array (
93 75 '@yii/jui' => $vendorDir . '/yiisoft/yii2-jui',
94 76 ),
95 77 ),
96   - 'kartik-v/yii2-krajee-base' =>
97   - array (
98   - 'name' => 'kartik-v/yii2-krajee-base',
99   - 'version' => '1.7.7.0',
100   - 'alias' =>
101   - array (
102   - '@kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base',
103   - ),
104   - ),
105 78 'kartik-v/yii2-widget-select2' =>
106 79 array (
107 80 'name' => 'kartik-v/yii2-widget-select2',
... ... @@ -120,4 +93,41 @@ return array (
120 93 '@developeruz/db_rbac' => $vendorDir . '/developeruz/yii2-db-rbac',
121 94 ),
122 95 ),
  96 + 'dmstr/yii2-adminlte-asset' =>
  97 + array (
  98 + 'name' => 'dmstr/yii2-adminlte-asset',
  99 + 'version' => '2.2.4.0',
  100 + 'alias' =>
  101 + array (
  102 + '@dmstr' => $vendorDir . '/dmstr/yii2-adminlte-asset',
  103 + ),
  104 + ),
  105 + 'nodge/yii2-eauth' =>
  106 + array (
  107 + 'name' => 'nodge/yii2-eauth',
  108 + 'version' => '2.3.0.0',
  109 + 'alias' =>
  110 + array (
  111 + '@nodge/eauth' => $vendorDir . '/nodge/yii2-eauth/src',
  112 + ),
  113 + 'bootstrap' => 'nodge\\eauth\\Bootstrap',
  114 + ),
  115 + 'kartik-v/yii2-krajee-base' =>
  116 + array (
  117 + 'name' => 'kartik-v/yii2-krajee-base',
  118 + 'version' => '1.7.8.0',
  119 + 'alias' =>
  120 + array (
  121 + '@kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base',
  122 + ),
  123 + ),
  124 + 'rmrevin/yii2-fontawesome' =>
  125 + array (
  126 + 'name' => 'rmrevin/yii2-fontawesome',
  127 + 'version' => '2.12.2.0',
  128 + 'alias' =>
  129 + array (
  130 + '@rmrevin/yii/fontawesome' => $vendorDir . '/rmrevin/yii2-fontawesome',
  131 + ),
  132 + ),
123 133 );
... ...