← All changes
|
inc/ExternalPlugin/Elementor/Widgets/Course/SingleCourseBaseElementor.php
+101
-101
4.3.9
→
4.4.8
View file →
| @@ -1,101 +1,101 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Class SingleInstructorBaseElementor | |
| 4 | - * | |
| 5 | - * Has general methods for sections single instructor widgets use | |
| 6 | - * | |
| 7 | - * @sicne 4.2.3 | |
| 8 | - * @version 1.0.0 | |
| 9 | - */ | |
| 10 | - | |
| 11 | -namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course; | |
| 12 | - | |
| 13 | -use LearnPress\ExternalPlugin\Elementor\LPElementor; | |
| 14 | -use LearnPress\Models\CourseModel; | |
| 15 | -use LP_Course; | |
| 16 | - | |
| 17 | -trait SingleCourseBaseElementor { | |
| 18 | - /** | |
| 19 | - * @var string $title | |
| 20 | - */ | |
| 21 | - public $title = ''; | |
| 22 | - /** | |
| 23 | - * @var string $prefix_name; | |
| 24 | - */ | |
| 25 | - private $prefix_name = 'learnpress_'; | |
| 26 | - /** | |
| 27 | - * @var string $name; | |
| 28 | - */ | |
| 29 | - public $name = ''; | |
| 30 | - /** | |
| 31 | - * @var string $icon | |
| 32 | - */ | |
| 33 | - public $icon; | |
| 34 | - /** | |
| 35 | - * @var string[] key search widget | |
| 36 | - */ | |
| 37 | - public $keywords = array(); | |
| 38 | - /** | |
| 39 | - * @var array Controls | |
| 40 | - */ | |
| 41 | - public $controls = array(); | |
| 42 | - /** | |
| 43 | - * @var array Controls | |
| 44 | - */ | |
| 45 | - public $categories = array( LPElementor::CATE_COURSE ); | |
| 46 | - | |
| 47 | - public function get_title() { | |
| 48 | - return $this->title; | |
| 49 | - } | |
| 50 | - | |
| 51 | - public function get_name() { | |
| 52 | - return $this->prefix_name . $this->name; | |
| 53 | - } | |
| 54 | - | |
| 55 | - public function get_icon() { | |
| 56 | - return $this->icon ?? 'eicon-site-logo'; | |
| 57 | - } | |
| 58 | - | |
| 59 | - public function get_keywords() { | |
| 60 | - return array_push( $this->keywords, 'learnpress' ); | |
| 61 | - } | |
| 62 | - | |
| 63 | - public function get_categories() { | |
| 64 | - return $this->categories; | |
| 65 | - } | |
| 66 | - | |
| 67 | - public function get_help_url() { | |
| 68 | - return ''; | |
| 69 | - } | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * Get course | |
| 73 | - * | |
| 74 | - * @return bool|LP_Course|mixed | |
| 75 | - * @deprecated 4.2.7.3 | |
| 76 | - */ | |
| 77 | - public function get_course() { | |
| 78 | - $id = get_the_ID(); | |
| 79 | - if ( ! $id ) { | |
| 80 | - return false; | |
| 81 | - } | |
| 82 | - | |
| 83 | - return learn_press_get_course( $id ); | |
| 84 | - } | |
| 85 | - | |
| 86 | - /** | |
| 87 | - * Get course | |
| 88 | - * | |
| 89 | - * @return false|CourseModel | |
| 90 | - * @since 4.2.7.3 | |
| 91 | - * @version 1.0.0 | |
| 92 | - */ | |
| 93 | - public function get_course_model() { | |
| 94 | - $id = get_the_ID(); | |
| 95 | - if ( ! $id ) { | |
| 96 | - return false; | |
| 97 | - } | |
| 98 | - | |
| 99 | - return CourseModel::find( $id, true ); | |
| 100 | - } | |
| 101 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Class SingleInstructorBaseElementor | |
| 4 | + * | |
| 5 | + * Has general methods for sections single instructor widgets use | |
| 6 | + * | |
| 7 | + * @sicne 4.2.3 | |
| 8 | + * @version 1.0.0 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course; | |
| 12 | + | |
| 13 | +use LearnPress\ExternalPlugin\Elementor\LPElementor; | |
| 14 | +use LearnPress\Models\CourseModel; | |
| 15 | +use LP_Course; | |
| 16 | + | |
| 17 | +trait SingleCourseBaseElementor { | |
| 18 | + /** | |
| 19 | + * @var string $title | |
| 20 | + */ | |
| 21 | + public $title = ''; | |
| 22 | + /** | |
| 23 | + * @var string $prefix_name; | |
| 24 | + */ | |
| 25 | + private $prefix_name = 'learnpress_'; | |
| 26 | + /** | |
| 27 | + * @var string $name; | |
| 28 | + */ | |
| 29 | + public $name = ''; | |
| 30 | + /** | |
| 31 | + * @var string $icon | |
| 32 | + */ | |
| 33 | + public $icon; | |
| 34 | + /** | |
| 35 | + * @var string[] key search widget | |
| 36 | + */ | |
| 37 | + public $keywords = array(); | |
| 38 | + /** | |
| 39 | + * @var array Controls | |
| 40 | + */ | |
| 41 | + public $controls = array(); | |
| 42 | + /** | |
| 43 | + * @var array Controls | |
| 44 | + */ | |
| 45 | + public $categories = array( LPElementor::CATE_COURSE ); | |
| 46 | + | |
| 47 | + public function get_title() { | |
| 48 | + return $this->title; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public function get_name() { | |
| 52 | + return $this->prefix_name . $this->name; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public function get_icon() { | |
| 56 | + return $this->icon ?? 'eicon-site-logo'; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public function get_keywords() { | |
| 60 | + return array_push( $this->keywords, 'learnpress' ); | |
| 61 | + } | |
| 62 | + | |
| 63 | + public function get_categories() { | |
| 64 | + return $this->categories; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public function get_help_url() { | |
| 68 | + return ''; | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * Get course | |
| 73 | + * | |
| 74 | + * @return bool|LP_Course|mixed | |
| 75 | + * @deprecated 4.2.7.3 | |
| 76 | + */ | |
| 77 | + public function get_course() { | |
| 78 | + $id = get_the_ID(); | |
| 79 | + if ( ! $id ) { | |
| 80 | + return false; | |
| 81 | + } | |
| 82 | + | |
| 83 | + return learn_press_get_course( $id ); | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Get course | |
| 88 | + * | |
| 89 | + * @return false|CourseModel | |
| 90 | + * @since 4.2.7.3 | |
| 91 | + * @version 1.0.0 | |
| 92 | + */ | |
| 93 | + public function get_course_model() { | |
| 94 | + $id = get_the_ID(); | |
| 95 | + if ( ! $id ) { | |
| 96 | + return false; | |
| 97 | + } | |
| 98 | + | |
| 99 | + return CourseModel::find( $id, true ); | |
| 100 | + } | |
| 101 | +} | |