| @@ -1,5 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * FrontendController.php | |
| 4 | + * | |
| 5 | + * The FrontendController class file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <alexanderschneider85@gmail.com> | |
| 10 | + * @copyright 2008-2017 Alexander Schneider | |
| 11 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 | |
| 12 | + * @version SVN: $id$ | |
| 13 | + * @link http://wordpress.org/extend/plugins/user-access-manager/ | |
| 14 | + */ | |
| 2 | 15 | |
| 3 | 16 | declare(strict_types=1); |
| 4 | 17 | |
| 5 | 18 | namespace UserAccessManager\Controller\Frontend; |
| @@ -12,8 +25,13 @@ | ||
| 12 | 25 | use UserAccessManager\UserGroup\UserGroupTypeException; |
| 13 | 26 | use UserAccessManager\Wrapper\Php; |
| 14 | 27 | use UserAccessManager\Wrapper\Wordpress; |
| 15 | 28 | |
| 29 | +/** | |
| 30 | + * Class FrontendController | |
| 31 | + * | |
| 32 | + * @package UserAccessManager\Controller | |
| 33 | + */ | |
| 16 | 34 | class FrontendController extends Controller |
| 17 | 35 | { |
| 18 | 36 | public const HANDLE_STYLE_LOGIN_FORM = 'UserAccessManagerLoginForm'; |
| 19 | 37 | |
| @@ -26,17 +44,24 @@ | ||
| 26 | 44 | ) { |
| 27 | 45 | parent::__construct($php, $wordpress, $wordpressConfig); |
| 28 | 46 | } |
| 29 | 47 | |
| 30 | - public function enqueueStylesAndScripts(): void | |
| 48 | + private function registerStylesAndScripts(): void | |
| 31 | 49 | { |
| 50 | + $urlPath = $this->wordpressConfig->getUrlPath(); | |
| 51 | + | |
| 32 | 52 | $this->wordpress->registerStyle( |
| 33 | 53 | self::HANDLE_STYLE_LOGIN_FORM, |
| 34 | - $this->wordpressConfig->getUrlPath().'assets/css/uamLoginForm.css', | |
| 54 | + $urlPath.'assets/css/uamLoginForm.css', | |
| 35 | 55 | [], |
| 36 | 56 | UserAccessManager::VERSION, |
| 37 | 57 | 'screen' |
| 38 | 58 | ); |
| 59 | + } | |
| 60 | + | |
| 61 | + public function enqueueStylesAndScripts(): void | |
| 62 | + { | |
| 63 | + $this->registerStylesAndScripts(); | |
| 39 | 64 | $this->wordpress->enqueueStyle(self::HANDLE_STYLE_LOGIN_FORM); |
| 40 | 65 | } |
| 41 | 66 | |
| 42 | 67 | /** |
| @@ -58,8 +83,13 @@ | ||
| 58 | 83 | |
| 59 | 84 | return $ancestors; |
| 60 | 85 | } |
| 61 | 86 | |
| 87 | + | |
| 88 | + /* | |
| 89 | + * Functions for the redirection and files. | |
| 90 | + */ | |
| 91 | + | |
| 62 | 92 | /** |
| 63 | 93 | * @throws UserGroupTypeException |
| 64 | 94 | */ |
| 65 | 95 | public function getWpSeoUrl(array|string $url, string $type, object $object): bool|array|string |
| @@ -66,12 +96,16 @@ | ||
| 66 | 96 | { |
| 67 | 97 | return ($this->accessHandler->checkObjectAccess($type, $object->ID) === true) ? $url : false; |
| 68 | 98 | } |
| 69 | 99 | |
| 100 | + /* | |
| 101 | + * Elementor | |
| 102 | + */ | |
| 103 | + | |
| 70 | 104 | /** |
| 71 | 105 | * @throws UserGroupTypeException |
| 72 | 106 | */ |
| 73 | - public function getElementorContent(mixed $content): mixed | |
| 107 | + public function getElementorContent($content): mixed | |
| 74 | 108 | { |
| 75 | 109 | $this->wordpress->removeAction('elementor/frontend/the_content', [$this, 'getElementorContent']); |
| 76 | 110 | $post = $this->wordpress->getCurrentPost(); |
| 77 | 111 | |