@@ -4,36 +4,36 @@ |
||
| 4 | 4 | |
| 5 | 5 | class YesNo extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public function getTag() |
|
| 11 | - { |
|
| 12 | - return 'input'; |
|
| 13 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public function getTag() |
|
| 11 | + { |
|
| 12 | + return 'input'; |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @inheritDoc |
|
| 17 | - */ |
|
| 18 | - public static function defaults() |
|
| 19 | - { |
|
| 20 | - return [ |
|
| 21 | - 'class' => 'inline', |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * @inheritDoc |
|
| 17 | + */ |
|
| 18 | + public static function defaults() |
|
| 19 | + { |
|
| 20 | + return [ |
|
| 21 | + 'class' => 'inline', |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @inheritDoc |
|
| 27 | - */ |
|
| 28 | - public static function required() |
|
| 29 | - { |
|
| 30 | - return [ |
|
| 31 | - 'is_multi' => true, |
|
| 32 | - 'options' => [ |
|
| 33 | - 'no' => __('No', 'site-reviews'), |
|
| 34 | - 'yes' => __('Yes', 'site-reviews'), |
|
| 35 | - ], |
|
| 36 | - 'type' => 'radio', |
|
| 37 | - ]; |
|
| 38 | - } |
|
| 25 | + /** |
|
| 26 | + * @inheritDoc |
|
| 27 | + */ |
|
| 28 | + public static function required() |
|
| 29 | + { |
|
| 30 | + return [ |
|
| 31 | + 'is_multi' => true, |
|
| 32 | + 'options' => [ |
|
| 33 | + 'no' => __('No', 'site-reviews'), |
|
| 34 | + 'yes' => __('Yes', 'site-reviews'), |
|
| 35 | + ], |
|
| 36 | + 'type' => 'radio', |
|
| 37 | + ]; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -4,31 +4,31 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Code extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public function getTag() |
|
| 11 | - { |
|
| 12 | - return 'textarea'; |
|
| 13 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public function getTag() |
|
| 11 | + { |
|
| 12 | + return 'textarea'; |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @inheritDoc |
|
| 17 | - */ |
|
| 18 | - public static function defaults() |
|
| 19 | - { |
|
| 20 | - return [ |
|
| 21 | - 'class' => 'large-text code', |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * @inheritDoc |
|
| 17 | + */ |
|
| 18 | + public static function defaults() |
|
| 19 | + { |
|
| 20 | + return [ |
|
| 21 | + 'class' => 'large-text code', |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @inheritDoc |
|
| 27 | - */ |
|
| 28 | - public static function required() |
|
| 29 | - { |
|
| 30 | - return [ |
|
| 31 | - 'type' => 'textarea', |
|
| 32 | - ]; |
|
| 33 | - } |
|
| 25 | + /** |
|
| 26 | + * @inheritDoc |
|
| 27 | + */ |
|
| 28 | + public static function required() |
|
| 29 | + { |
|
| 30 | + return [ |
|
| 31 | + 'type' => 'textarea', |
|
| 32 | + ]; |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -6,19 +6,19 @@ |
||
| 6 | 6 | |
| 7 | 7 | class FieldDefaults extends Defaults |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @return array |
|
| 11 | - */ |
|
| 12 | - protected function defaults() |
|
| 13 | - { |
|
| 14 | - return [ |
|
| 15 | - 'class' => '', |
|
| 16 | - 'id' => '', |
|
| 17 | - 'label' => '', |
|
| 18 | - 'options' => [], |
|
| 19 | - 'text' => '', |
|
| 20 | - 'type' => '', |
|
| 21 | - 'value' => '', |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 9 | + /** |
|
| 10 | + * @return array |
|
| 11 | + */ |
|
| 12 | + protected function defaults() |
|
| 13 | + { |
|
| 14 | + return [ |
|
| 15 | + 'class' => '', |
|
| 16 | + 'id' => '', |
|
| 17 | + 'label' => '', |
|
| 18 | + 'options' => [], |
|
| 19 | + 'text' => '', |
|
| 20 | + 'type' => '', |
|
| 21 | + 'value' => '', |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'fields' => [ |
|
| 5 | - 'select' => 'browser-default', |
|
| 6 | - 'textarea' => 'materialize-textarea', |
|
| 7 | - ], |
|
| 8 | - 'pagination' => [ |
|
| 9 | - 'type' => 'list', |
|
| 10 | - ], |
|
| 11 | - 'validation' => [ |
|
| 12 | - 'error_tag' => 'span', |
|
| 13 | - 'error_tag_class' => 'red-text', |
|
| 14 | - 'input_error_class' => 'invalid', |
|
| 15 | - 'message_tag_class' => 'wpcf7-response-output', |
|
| 16 | - ], |
|
| 4 | + 'fields' => [ |
|
| 5 | + 'select' => 'browser-default', |
|
| 6 | + 'textarea' => 'materialize-textarea', |
|
| 7 | + ], |
|
| 8 | + 'pagination' => [ |
|
| 9 | + 'type' => 'list', |
|
| 10 | + ], |
|
| 11 | + 'validation' => [ |
|
| 12 | + 'error_tag' => 'span', |
|
| 13 | + 'error_tag_class' => 'red-text', |
|
| 14 | + 'input_error_class' => 'invalid', |
|
| 15 | + 'message_tag_class' => 'wpcf7-response-output', |
|
| 16 | + ], |
|
| 17 | 17 | ]; |
@@ -6,14 +6,14 @@ |
||
| 6 | 6 | |
| 7 | 7 | class TemplateTags |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @return string |
|
| 11 | - */ |
|
| 12 | - public function getDescription() |
|
| 13 | - { |
|
| 14 | - $tags = glsr(TemplateTagsDefaults::class)->defaults(); |
|
| 15 | - return array_reduce(array_keys($tags), function ($carry, $tag) use ($tags) { |
|
| 16 | - return $carry.sprintf('<br><code>{%s}</code> %s', $tag, $tags[$tag]); |
|
| 17 | - }); |
|
| 18 | - } |
|
| 9 | + /** |
|
| 10 | + * @return string |
|
| 11 | + */ |
|
| 12 | + public function getDescription() |
|
| 13 | + { |
|
| 14 | + $tags = glsr(TemplateTagsDefaults::class)->defaults(); |
|
| 15 | + return array_reduce(array_keys($tags), function ($carry, $tag) use ($tags) { |
|
| 16 | + return $carry.sprintf('<br><code>{%s}</code> %s', $tag, $tags[$tag]); |
|
| 17 | + }); |
|
| 18 | + } |
|
| 19 | 19 | } |
@@ -6,19 +6,19 @@ |
||
| 6 | 6 | |
| 7 | 7 | class TemplateTagsDefaults extends Defaults |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @return array |
|
| 11 | - */ |
|
| 12 | - protected function defaults() |
|
| 13 | - { |
|
| 14 | - return [ |
|
| 15 | - 'review_rating' => _x('The review rating number (1-5)', 'admin-text', 'site-reviews'), |
|
| 16 | - 'review_title' => _x('The review title', 'admin-text', 'site-reviews'), |
|
| 17 | - 'review_content' => _x('The review content', 'admin-text', 'site-reviews'), |
|
| 18 | - 'review_author' => _x('The review author', 'admin-text', 'site-reviews'), |
|
| 19 | - 'review_email' => _x('The email of the review author', 'admin-text', 'site-reviews'), |
|
| 20 | - 'review_ip' => _x('The IP address of the review author', 'admin-text', 'site-reviews'), |
|
| 21 | - 'review_link' => _x('The link to edit/view a review', 'admin-text', 'site-reviews'), |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 9 | + /** |
|
| 10 | + * @return array |
|
| 11 | + */ |
|
| 12 | + protected function defaults() |
|
| 13 | + { |
|
| 14 | + return [ |
|
| 15 | + 'review_rating' => _x('The review rating number (1-5)', 'admin-text', 'site-reviews'), |
|
| 16 | + 'review_title' => _x('The review title', 'admin-text', 'site-reviews'), |
|
| 17 | + 'review_content' => _x('The review content', 'admin-text', 'site-reviews'), |
|
| 18 | + 'review_author' => _x('The review author', 'admin-text', 'site-reviews'), |
|
| 19 | + 'review_email' => _x('The email of the review author', 'admin-text', 'site-reviews'), |
|
| 20 | + 'review_ip' => _x('The IP address of the review author', 'admin-text', 'site-reviews'), |
|
| 21 | + 'review_link' => _x('The link to edit/view a review', 'admin-text', 'site-reviews'), |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -4,36 +4,36 @@ |
||
| 4 | 4 | |
| 5 | 5 | abstract class Hooks |
| 6 | 6 | { |
| 7 | - protected $addon; |
|
| 8 | - protected $basename; |
|
| 9 | - protected $controller; |
|
| 7 | + protected $addon; |
|
| 8 | + protected $basename; |
|
| 9 | + protected $controller; |
|
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - add_action('init', [$this->addon, 'update']); |
|
| 17 | - add_action('admin_enqueue_scripts', [$this->controller, 'enqueueAdminAssets']); |
|
| 18 | - add_action('enqueue_block_editor_assets', [$this->controller, 'enqueueBlockAssets'], 9); |
|
| 19 | - add_action('wp_enqueue_scripts', [$this->controller, 'enqueuePublicAssets']); |
|
| 20 | - add_filter('plugin_action_links_'.$this->basename, [$this->controller, 'filterActionLinks']); |
|
| 21 | - add_filter('site-reviews/config', [$this->controller, 'filterConfigPath']); |
|
| 22 | - add_filter('site-reviews/addon/documentation', [$this->controller, 'filterDocumentation']); |
|
| 23 | - add_filter('site-reviews/gettext/'.$this->addon->id, [$this->controller, 'filterGettext'], 10, 2); |
|
| 24 | - add_filter('site-reviews/gettext_with_context/'.$this->addon->id, [$this->controller, 'filterGettextWithContext'], 10, 3); |
|
| 25 | - add_filter('site-reviews/ngettext/'.$this->addon->id, [$this->controller, 'filterNgettext'], 10, 4); |
|
| 26 | - add_filter('site-reviews/ngettext_with_context/'.$this->addon->id, [$this->controller, 'filterNgettextWithContext'], 10, 5); |
|
| 27 | - add_filter('site-reviews/path', [$this->controller, 'filterFilePaths'], 10, 2); |
|
| 28 | - add_filter('site-reviews/addon/settings', [$this->controller, 'filterSettings']); |
|
| 29 | - add_filter('site-reviews/addon/system-info', [$this->controller, 'filterSystemInfo']); |
|
| 30 | - add_filter('site-reviews/translation/entries', [$this->controller, 'filterTranslationEntries']); |
|
| 31 | - add_filter('site-reviews/translator/domains', [$this->controller, 'filterTranslatorDomains']); |
|
| 32 | - add_action('init', [$this->controller, 'registerBlocks'], 9); |
|
| 33 | - add_action('plugins_loaded', [$this->controller, 'registerLanguages']); |
|
| 34 | - add_action('init', [$this->controller, 'registerShortcodes']); |
|
| 35 | - add_action('init', [$this->controller, 'registerTinymcePopups']); |
|
| 36 | - add_action('widgets_init', [$this->controller, 'registerWidgets']); |
|
| 37 | - add_action('site-reviews/addon/settings/'.$this->addon->slug, [$this->controller, 'renderSettings']); |
|
| 38 | - } |
|
| 11 | + /** |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + add_action('init', [$this->addon, 'update']); |
|
| 17 | + add_action('admin_enqueue_scripts', [$this->controller, 'enqueueAdminAssets']); |
|
| 18 | + add_action('enqueue_block_editor_assets', [$this->controller, 'enqueueBlockAssets'], 9); |
|
| 19 | + add_action('wp_enqueue_scripts', [$this->controller, 'enqueuePublicAssets']); |
|
| 20 | + add_filter('plugin_action_links_'.$this->basename, [$this->controller, 'filterActionLinks']); |
|
| 21 | + add_filter('site-reviews/config', [$this->controller, 'filterConfigPath']); |
|
| 22 | + add_filter('site-reviews/addon/documentation', [$this->controller, 'filterDocumentation']); |
|
| 23 | + add_filter('site-reviews/gettext/'.$this->addon->id, [$this->controller, 'filterGettext'], 10, 2); |
|
| 24 | + add_filter('site-reviews/gettext_with_context/'.$this->addon->id, [$this->controller, 'filterGettextWithContext'], 10, 3); |
|
| 25 | + add_filter('site-reviews/ngettext/'.$this->addon->id, [$this->controller, 'filterNgettext'], 10, 4); |
|
| 26 | + add_filter('site-reviews/ngettext_with_context/'.$this->addon->id, [$this->controller, 'filterNgettextWithContext'], 10, 5); |
|
| 27 | + add_filter('site-reviews/path', [$this->controller, 'filterFilePaths'], 10, 2); |
|
| 28 | + add_filter('site-reviews/addon/settings', [$this->controller, 'filterSettings']); |
|
| 29 | + add_filter('site-reviews/addon/system-info', [$this->controller, 'filterSystemInfo']); |
|
| 30 | + add_filter('site-reviews/translation/entries', [$this->controller, 'filterTranslationEntries']); |
|
| 31 | + add_filter('site-reviews/translator/domains', [$this->controller, 'filterTranslatorDomains']); |
|
| 32 | + add_action('init', [$this->controller, 'registerBlocks'], 9); |
|
| 33 | + add_action('plugins_loaded', [$this->controller, 'registerLanguages']); |
|
| 34 | + add_action('init', [$this->controller, 'registerShortcodes']); |
|
| 35 | + add_action('init', [$this->controller, 'registerTinymcePopups']); |
|
| 36 | + add_action('widgets_init', [$this->controller, 'registerWidgets']); |
|
| 37 | + add_action('site-reviews/addon/settings/'.$this->addon->slug, [$this->controller, 'renderSettings']); |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -13,329 +13,329 @@ |
||
| 13 | 13 | |
| 14 | 14 | abstract class Controller extends BaseController |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * @var Addon |
|
| 18 | - */ |
|
| 19 | - protected $addon; |
|
| 16 | + /** |
|
| 17 | + * @var Addon |
|
| 18 | + */ |
|
| 19 | + protected $addon; |
|
| 20 | 20 | |
| 21 | - public function __construct() |
|
| 22 | - { |
|
| 23 | - $this->setAddon(); |
|
| 24 | - } |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 23 | + $this->setAddon(); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @return void |
|
| 28 | - * @action admin_enqueue_scripts |
|
| 29 | - */ |
|
| 30 | - public function enqueueAdminAssets() |
|
| 31 | - { |
|
| 32 | - if ($this->isReviewAdminPage()) { |
|
| 33 | - $this->enqueueAsset('css', ['suffix' => 'admin']); |
|
| 34 | - $this->enqueueAsset('js', ['suffix' => 'admin']); |
|
| 35 | - } |
|
| 36 | - } |
|
| 26 | + /** |
|
| 27 | + * @return void |
|
| 28 | + * @action admin_enqueue_scripts |
|
| 29 | + */ |
|
| 30 | + public function enqueueAdminAssets() |
|
| 31 | + { |
|
| 32 | + if ($this->isReviewAdminPage()) { |
|
| 33 | + $this->enqueueAsset('css', ['suffix' => 'admin']); |
|
| 34 | + $this->enqueueAsset('js', ['suffix' => 'admin']); |
|
| 35 | + } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return void |
|
| 40 | - * @action enqueue_block_editor_assets |
|
| 41 | - */ |
|
| 42 | - public function enqueueBlockAssets() |
|
| 43 | - { |
|
| 44 | - $this->registerAsset('css', ['suffix' => 'blocks']); |
|
| 45 | - $this->registerAsset('js', [ |
|
| 46 | - 'dependencies' => [glsr()->id.'/admin'], |
|
| 47 | - 'suffix' => 'blocks', |
|
| 48 | - ]); |
|
| 49 | - } |
|
| 38 | + /** |
|
| 39 | + * @return void |
|
| 40 | + * @action enqueue_block_editor_assets |
|
| 41 | + */ |
|
| 42 | + public function enqueueBlockAssets() |
|
| 43 | + { |
|
| 44 | + $this->registerAsset('css', ['suffix' => 'blocks']); |
|
| 45 | + $this->registerAsset('js', [ |
|
| 46 | + 'dependencies' => [glsr()->id.'/admin'], |
|
| 47 | + 'suffix' => 'blocks', |
|
| 48 | + ]); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return void |
|
| 53 | - * @action wp_enqueue_scripts |
|
| 54 | - */ |
|
| 55 | - public function enqueuePublicAssets() |
|
| 56 | - { |
|
| 57 | - $this->enqueueAsset('css'); |
|
| 58 | - $this->enqueueAsset('js', ['in_footer' => true]); |
|
| 59 | - } |
|
| 51 | + /** |
|
| 52 | + * @return void |
|
| 53 | + * @action wp_enqueue_scripts |
|
| 54 | + */ |
|
| 55 | + public function enqueuePublicAssets() |
|
| 56 | + { |
|
| 57 | + $this->enqueueAsset('css'); |
|
| 58 | + $this->enqueueAsset('js', ['in_footer' => true]); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @return array |
|
| 63 | - * @filter plugin_action_links_{addon_id}/{addon_id}.php |
|
| 64 | - */ |
|
| 65 | - public function filterActionLinks(array $links) |
|
| 66 | - { |
|
| 67 | - if (glsr()->hasPermission('settings')) { |
|
| 68 | - $links['settings'] = glsr(Builder::class)->a(_x('Settings', 'admin-text', 'site-reviews'), [ |
|
| 69 | - 'href' => admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-addons'), |
|
| 70 | - ]); |
|
| 71 | - } |
|
| 72 | - return $links; |
|
| 73 | - } |
|
| 61 | + /** |
|
| 62 | + * @return array |
|
| 63 | + * @filter plugin_action_links_{addon_id}/{addon_id}.php |
|
| 64 | + */ |
|
| 65 | + public function filterActionLinks(array $links) |
|
| 66 | + { |
|
| 67 | + if (glsr()->hasPermission('settings')) { |
|
| 68 | + $links['settings'] = glsr(Builder::class)->a(_x('Settings', 'admin-text', 'site-reviews'), [ |
|
| 69 | + 'href' => admin_url('edit.php?post_type='.glsr()->post_type.'&page=settings#tab-addons'), |
|
| 70 | + ]); |
|
| 71 | + } |
|
| 72 | + return $links; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @param string $path |
|
| 77 | - * @return string |
|
| 78 | - * @filter site-reviews/config |
|
| 79 | - */ |
|
| 80 | - public function filterConfigPath($path) |
|
| 81 | - { |
|
| 82 | - $addonPrefix = $this->addon->id.'/'; |
|
| 83 | - return Str::contains($path, $addonPrefix) |
|
| 84 | - ? $addonPrefix.str_replace($addonPrefix, '', $path) |
|
| 85 | - : $path; |
|
| 86 | - } |
|
| 75 | + /** |
|
| 76 | + * @param string $path |
|
| 77 | + * @return string |
|
| 78 | + * @filter site-reviews/config |
|
| 79 | + */ |
|
| 80 | + public function filterConfigPath($path) |
|
| 81 | + { |
|
| 82 | + $addonPrefix = $this->addon->id.'/'; |
|
| 83 | + return Str::contains($path, $addonPrefix) |
|
| 84 | + ? $addonPrefix.str_replace($addonPrefix, '', $path) |
|
| 85 | + : $path; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * @return array |
|
| 90 | - * @filter site-reviews/addon/documentation |
|
| 91 | - */ |
|
| 92 | - public function filterDocumentation(array $documentation) |
|
| 93 | - { |
|
| 94 | - $documentation[$this->addon->name] = glsr(Template::class)->build($this->addon->id.'/views/documentation'); |
|
| 95 | - return $documentation; |
|
| 96 | - } |
|
| 88 | + /** |
|
| 89 | + * @return array |
|
| 90 | + * @filter site-reviews/addon/documentation |
|
| 91 | + */ |
|
| 92 | + public function filterDocumentation(array $documentation) |
|
| 93 | + { |
|
| 94 | + $documentation[$this->addon->name] = glsr(Template::class)->build($this->addon->id.'/views/documentation'); |
|
| 95 | + return $documentation; |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * @param string $path |
|
| 100 | - * @param string $file |
|
| 101 | - * @return string |
|
| 102 | - * @filter site-reviews/path |
|
| 103 | - */ |
|
| 104 | - public function filterFilePaths($path, $file) |
|
| 105 | - { |
|
| 106 | - $addonPrefix = $this->addon->id.'/'; |
|
| 107 | - return Str::startsWith($addonPrefix, $file) |
|
| 108 | - ? $this->addon->path(Str::replaceFirst($addonPrefix, '', $file)) |
|
| 109 | - : $path; |
|
| 110 | - } |
|
| 98 | + /** |
|
| 99 | + * @param string $path |
|
| 100 | + * @param string $file |
|
| 101 | + * @return string |
|
| 102 | + * @filter site-reviews/path |
|
| 103 | + */ |
|
| 104 | + public function filterFilePaths($path, $file) |
|
| 105 | + { |
|
| 106 | + $addonPrefix = $this->addon->id.'/'; |
|
| 107 | + return Str::startsWith($addonPrefix, $file) |
|
| 108 | + ? $this->addon->path(Str::replaceFirst($addonPrefix, '', $file)) |
|
| 109 | + : $path; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * @param string $translation |
|
| 114 | - * @param string $text |
|
| 115 | - * @return string |
|
| 116 | - * @filter site-reviews/gettext/{addon_id} |
|
| 117 | - */ |
|
| 118 | - public function filterGettext($translation, $text) |
|
| 119 | - { |
|
| 120 | - return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 121 | - 'single' => $text, |
|
| 122 | - ]); |
|
| 123 | - } |
|
| 112 | + /** |
|
| 113 | + * @param string $translation |
|
| 114 | + * @param string $text |
|
| 115 | + * @return string |
|
| 116 | + * @filter site-reviews/gettext/{addon_id} |
|
| 117 | + */ |
|
| 118 | + public function filterGettext($translation, $text) |
|
| 119 | + { |
|
| 120 | + return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 121 | + 'single' => $text, |
|
| 122 | + ]); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * @param string $translation |
|
| 127 | - * @param string $text |
|
| 128 | - * @param string $context |
|
| 129 | - * @return string |
|
| 130 | - * @filter site-reviews/gettext_with_context/{addon_id} |
|
| 131 | - */ |
|
| 132 | - public function filterGettextWithContext($translation, $text, $context) |
|
| 133 | - { |
|
| 134 | - return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 135 | - 'context' => $context, |
|
| 136 | - 'single' => $text, |
|
| 137 | - ]); |
|
| 138 | - } |
|
| 125 | + /** |
|
| 126 | + * @param string $translation |
|
| 127 | + * @param string $text |
|
| 128 | + * @param string $context |
|
| 129 | + * @return string |
|
| 130 | + * @filter site-reviews/gettext_with_context/{addon_id} |
|
| 131 | + */ |
|
| 132 | + public function filterGettextWithContext($translation, $text, $context) |
|
| 133 | + { |
|
| 134 | + return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 135 | + 'context' => $context, |
|
| 136 | + 'single' => $text, |
|
| 137 | + ]); |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * @param string $translation |
|
| 142 | - * @param string $single |
|
| 143 | - * @param string $plural |
|
| 144 | - * @param int $number |
|
| 145 | - * @return string |
|
| 146 | - * @filter site-reviews/ngettext/{addon_id} |
|
| 147 | - */ |
|
| 148 | - public function filterNgettext($translation, $single, $plural, $number) |
|
| 149 | - { |
|
| 150 | - return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 151 | - 'number' => $number, |
|
| 152 | - 'plural' => $plural, |
|
| 153 | - 'single' => $single, |
|
| 154 | - ]); |
|
| 155 | - } |
|
| 140 | + /** |
|
| 141 | + * @param string $translation |
|
| 142 | + * @param string $single |
|
| 143 | + * @param string $plural |
|
| 144 | + * @param int $number |
|
| 145 | + * @return string |
|
| 146 | + * @filter site-reviews/ngettext/{addon_id} |
|
| 147 | + */ |
|
| 148 | + public function filterNgettext($translation, $single, $plural, $number) |
|
| 149 | + { |
|
| 150 | + return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 151 | + 'number' => $number, |
|
| 152 | + 'plural' => $plural, |
|
| 153 | + 'single' => $single, |
|
| 154 | + ]); |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * @param string $translation |
|
| 159 | - * @param string $single |
|
| 160 | - * @param string $plural |
|
| 161 | - * @param int $number |
|
| 162 | - * @param string $context |
|
| 163 | - * @return string |
|
| 164 | - * @filter site-reviews/ngettext_with_context/{addon_id} |
|
| 165 | - */ |
|
| 166 | - public function filterNgettextWithContext($translation, $single, $plural, $number, $context) |
|
| 167 | - { |
|
| 168 | - return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 169 | - 'context' => $context, |
|
| 170 | - 'number' => $number, |
|
| 171 | - 'plural' => $plural, |
|
| 172 | - 'single' => $single, |
|
| 173 | - ]); |
|
| 174 | - } |
|
| 157 | + /** |
|
| 158 | + * @param string $translation |
|
| 159 | + * @param string $single |
|
| 160 | + * @param string $plural |
|
| 161 | + * @param int $number |
|
| 162 | + * @param string $context |
|
| 163 | + * @return string |
|
| 164 | + * @filter site-reviews/ngettext_with_context/{addon_id} |
|
| 165 | + */ |
|
| 166 | + public function filterNgettextWithContext($translation, $single, $plural, $number, $context) |
|
| 167 | + { |
|
| 168 | + return glsr(Translator::class)->translate($translation, $this->addon->id, [ |
|
| 169 | + 'context' => $context, |
|
| 170 | + 'number' => $number, |
|
| 171 | + 'plural' => $plural, |
|
| 172 | + 'single' => $single, |
|
| 173 | + ]); |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | - /** |
|
| 177 | - * @return array |
|
| 178 | - * @filter site-reviews/addon/settings |
|
| 179 | - */ |
|
| 180 | - public function filterSettings(array $settings) |
|
| 181 | - { |
|
| 182 | - $settingsFile = $this->addon->path('config/settings.php'); |
|
| 183 | - if (file_exists($settingsFile)) { |
|
| 184 | - $settings = array_merge((include $settingsFile), $settings); |
|
| 185 | - } |
|
| 186 | - return $settings; |
|
| 187 | - } |
|
| 176 | + /** |
|
| 177 | + * @return array |
|
| 178 | + * @filter site-reviews/addon/settings |
|
| 179 | + */ |
|
| 180 | + public function filterSettings(array $settings) |
|
| 181 | + { |
|
| 182 | + $settingsFile = $this->addon->path('config/settings.php'); |
|
| 183 | + if (file_exists($settingsFile)) { |
|
| 184 | + $settings = array_merge((include $settingsFile), $settings); |
|
| 185 | + } |
|
| 186 | + return $settings; |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - /** |
|
| 190 | - * @return array |
|
| 191 | - * @filter site-reviews/addon/system-info |
|
| 192 | - */ |
|
| 193 | - public function filterSystemInfo(array $details) |
|
| 194 | - { |
|
| 195 | - $version = $this->addon->version; |
|
| 196 | - $previousVersion = glsr(OptionManager::class)->get('addons.'.$this->addon->id.'.version_upgraded_from'); |
|
| 197 | - if (empty($previousVersion)) { |
|
| 198 | - $previousVersion = $version; |
|
| 199 | - } |
|
| 200 | - $details[$this->addon->name] = sprintf('%s (%s)', $this->addon->version, $previousVersion); |
|
| 201 | - return $details; |
|
| 202 | - } |
|
| 189 | + /** |
|
| 190 | + * @return array |
|
| 191 | + * @filter site-reviews/addon/system-info |
|
| 192 | + */ |
|
| 193 | + public function filterSystemInfo(array $details) |
|
| 194 | + { |
|
| 195 | + $version = $this->addon->version; |
|
| 196 | + $previousVersion = glsr(OptionManager::class)->get('addons.'.$this->addon->id.'.version_upgraded_from'); |
|
| 197 | + if (empty($previousVersion)) { |
|
| 198 | + $previousVersion = $version; |
|
| 199 | + } |
|
| 200 | + $details[$this->addon->name] = sprintf('%s (%s)', $this->addon->version, $previousVersion); |
|
| 201 | + return $details; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * @return array |
|
| 206 | - * @filter site-reviews/translation/entries |
|
| 207 | - */ |
|
| 208 | - public function filterTranslationEntries(array $entries) |
|
| 209 | - { |
|
| 210 | - $potFile = $this->addon->path($this->addon->languages.'/'.$this->addon->id.'.pot'); |
|
| 211 | - return glsr(Translation::class)->extractEntriesFromPotFile($potFile, $entries); |
|
| 212 | - } |
|
| 204 | + /** |
|
| 205 | + * @return array |
|
| 206 | + * @filter site-reviews/translation/entries |
|
| 207 | + */ |
|
| 208 | + public function filterTranslationEntries(array $entries) |
|
| 209 | + { |
|
| 210 | + $potFile = $this->addon->path($this->addon->languages.'/'.$this->addon->id.'.pot'); |
|
| 211 | + return glsr(Translation::class)->extractEntriesFromPotFile($potFile, $entries); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * @return array |
|
| 216 | - * @filter site-reviews/translator/domains |
|
| 217 | - */ |
|
| 218 | - public function filterTranslatorDomains(array $domains) |
|
| 219 | - { |
|
| 220 | - $domains[] = $this->addon->id; |
|
| 221 | - return $domains; |
|
| 222 | - } |
|
| 214 | + /** |
|
| 215 | + * @return array |
|
| 216 | + * @filter site-reviews/translator/domains |
|
| 217 | + */ |
|
| 218 | + public function filterTranslatorDomains(array $domains) |
|
| 219 | + { |
|
| 220 | + $domains[] = $this->addon->id; |
|
| 221 | + return $domains; |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - /** |
|
| 225 | - * @return void |
|
| 226 | - * @action init |
|
| 227 | - */ |
|
| 228 | - public function registerBlocks() |
|
| 229 | - { |
|
| 230 | - } |
|
| 224 | + /** |
|
| 225 | + * @return void |
|
| 226 | + * @action init |
|
| 227 | + */ |
|
| 228 | + public function registerBlocks() |
|
| 229 | + { |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * @return void |
|
| 234 | - * @action plugins_loaded |
|
| 235 | - */ |
|
| 236 | - public function registerLanguages() |
|
| 237 | - { |
|
| 238 | - load_plugin_textdomain($this->addon->id, false, |
|
| 239 | - trailingslashit(plugin_basename($this->addon->path()).'/'.$this->addon->languages) |
|
| 240 | - ); |
|
| 241 | - } |
|
| 232 | + /** |
|
| 233 | + * @return void |
|
| 234 | + * @action plugins_loaded |
|
| 235 | + */ |
|
| 236 | + public function registerLanguages() |
|
| 237 | + { |
|
| 238 | + load_plugin_textdomain($this->addon->id, false, |
|
| 239 | + trailingslashit(plugin_basename($this->addon->path()).'/'.$this->addon->languages) |
|
| 240 | + ); |
|
| 241 | + } |
|
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * @return void |
|
| 245 | - * @action init |
|
| 246 | - */ |
|
| 247 | - public function registerShortcodes() |
|
| 248 | - { |
|
| 249 | - } |
|
| 243 | + /** |
|
| 244 | + * @return void |
|
| 245 | + * @action init |
|
| 246 | + */ |
|
| 247 | + public function registerShortcodes() |
|
| 248 | + { |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * @return void |
|
| 253 | - * @action admin_init |
|
| 254 | - */ |
|
| 255 | - public function registerTinymcePopups() |
|
| 256 | - { |
|
| 257 | - } |
|
| 251 | + /** |
|
| 252 | + * @return void |
|
| 253 | + * @action admin_init |
|
| 254 | + */ |
|
| 255 | + public function registerTinymcePopups() |
|
| 256 | + { |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * @return void |
|
| 261 | - * @action widgets_init |
|
| 262 | - */ |
|
| 263 | - public function registerWidgets() |
|
| 264 | - { |
|
| 265 | - } |
|
| 259 | + /** |
|
| 260 | + * @return void |
|
| 261 | + * @action widgets_init |
|
| 262 | + */ |
|
| 263 | + public function registerWidgets() |
|
| 264 | + { |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * @param string $rows |
|
| 269 | - * @return void |
|
| 270 | - * @action site-reviews/addon/settings/{addon_slug} |
|
| 271 | - */ |
|
| 272 | - public function renderSettings($rows) |
|
| 273 | - { |
|
| 274 | - glsr(Template::class)->render($this->addon->id.'/views/settings', [ |
|
| 275 | - 'context' => [ |
|
| 276 | - 'rows' => $rows, |
|
| 277 | - 'title' => $this->addon->name, |
|
| 278 | - ], |
|
| 279 | - ]); |
|
| 280 | - } |
|
| 267 | + /** |
|
| 268 | + * @param string $rows |
|
| 269 | + * @return void |
|
| 270 | + * @action site-reviews/addon/settings/{addon_slug} |
|
| 271 | + */ |
|
| 272 | + public function renderSettings($rows) |
|
| 273 | + { |
|
| 274 | + glsr(Template::class)->render($this->addon->id.'/views/settings', [ |
|
| 275 | + 'context' => [ |
|
| 276 | + 'rows' => $rows, |
|
| 277 | + 'title' => $this->addon->name, |
|
| 278 | + ], |
|
| 279 | + ]); |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * @param string $extension |
|
| 284 | - * @return array |
|
| 285 | - */ |
|
| 286 | - protected function buildAssetArgs($extension, array $args = []) |
|
| 287 | - { |
|
| 288 | - $args = wp_parse_args($args, [ |
|
| 289 | - 'in_footer' => false, |
|
| 290 | - 'suffix' => '', |
|
| 291 | - ]); |
|
| 292 | - $dependencies = Arr::get($args, 'dependencies', [glsr()->id.Str::prefix('/', $args['suffix'])]); |
|
| 293 | - $path = 'assets/'.$this->addon->id.Str::prefix('-', $args['suffix']).'.'.$extension; |
|
| 294 | - if (!file_exists($this->addon->path($path)) || !in_array($extension, ['css', 'js'])) { |
|
| 295 | - return []; |
|
| 296 | - } |
|
| 297 | - $funcArgs = [ |
|
| 298 | - $this->addon->id.Str::prefix('/', $args['suffix']), |
|
| 299 | - $this->addon->url($path), |
|
| 300 | - Arr::consolidate($dependencies), |
|
| 301 | - $this->addon->version, |
|
| 302 | - ]; |
|
| 303 | - if ('js' === $extension && wp_validate_boolean($args['in_footer'])) { |
|
| 304 | - $funcArgs[] = true; // load script in the footer |
|
| 305 | - } |
|
| 306 | - return $funcArgs; |
|
| 307 | - } |
|
| 282 | + /** |
|
| 283 | + * @param string $extension |
|
| 284 | + * @return array |
|
| 285 | + */ |
|
| 286 | + protected function buildAssetArgs($extension, array $args = []) |
|
| 287 | + { |
|
| 288 | + $args = wp_parse_args($args, [ |
|
| 289 | + 'in_footer' => false, |
|
| 290 | + 'suffix' => '', |
|
| 291 | + ]); |
|
| 292 | + $dependencies = Arr::get($args, 'dependencies', [glsr()->id.Str::prefix('/', $args['suffix'])]); |
|
| 293 | + $path = 'assets/'.$this->addon->id.Str::prefix('-', $args['suffix']).'.'.$extension; |
|
| 294 | + if (!file_exists($this->addon->path($path)) || !in_array($extension, ['css', 'js'])) { |
|
| 295 | + return []; |
|
| 296 | + } |
|
| 297 | + $funcArgs = [ |
|
| 298 | + $this->addon->id.Str::prefix('/', $args['suffix']), |
|
| 299 | + $this->addon->url($path), |
|
| 300 | + Arr::consolidate($dependencies), |
|
| 301 | + $this->addon->version, |
|
| 302 | + ]; |
|
| 303 | + if ('js' === $extension && wp_validate_boolean($args['in_footer'])) { |
|
| 304 | + $funcArgs[] = true; // load script in the footer |
|
| 305 | + } |
|
| 306 | + return $funcArgs; |
|
| 307 | + } |
|
| 308 | 308 | |
| 309 | - /** |
|
| 310 | - * @param string $extension |
|
| 311 | - * @return void |
|
| 312 | - */ |
|
| 313 | - protected function enqueueAsset($extension, array $args = []) |
|
| 314 | - { |
|
| 315 | - if ($args = $this->buildAssetArgs($extension, $args)) { |
|
| 316 | - $function = 'js' === $extension |
|
| 317 | - ? 'wp_enqueue_script' |
|
| 318 | - : 'wp_enqueue_style'; |
|
| 319 | - call_user_func_array($function, $args); |
|
| 320 | - } |
|
| 321 | - } |
|
| 309 | + /** |
|
| 310 | + * @param string $extension |
|
| 311 | + * @return void |
|
| 312 | + */ |
|
| 313 | + protected function enqueueAsset($extension, array $args = []) |
|
| 314 | + { |
|
| 315 | + if ($args = $this->buildAssetArgs($extension, $args)) { |
|
| 316 | + $function = 'js' === $extension |
|
| 317 | + ? 'wp_enqueue_script' |
|
| 318 | + : 'wp_enqueue_style'; |
|
| 319 | + call_user_func_array($function, $args); |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | 322 | |
| 323 | - /** |
|
| 324 | - * @param string $extension |
|
| 325 | - * @return void |
|
| 326 | - */ |
|
| 327 | - protected function registerAsset($extension, array $args = []) |
|
| 328 | - { |
|
| 329 | - if ($args = $this->buildAssetArgs($extension, $args)) { |
|
| 330 | - $function = 'js' === $extension |
|
| 331 | - ? 'wp_register_script' |
|
| 332 | - : 'wp_register_style'; |
|
| 333 | - call_user_func_array($function, $args); |
|
| 334 | - } |
|
| 335 | - } |
|
| 323 | + /** |
|
| 324 | + * @param string $extension |
|
| 325 | + * @return void |
|
| 326 | + */ |
|
| 327 | + protected function registerAsset($extension, array $args = []) |
|
| 328 | + { |
|
| 329 | + if ($args = $this->buildAssetArgs($extension, $args)) { |
|
| 330 | + $function = 'js' === $extension |
|
| 331 | + ? 'wp_register_script' |
|
| 332 | + : 'wp_register_style'; |
|
| 333 | + call_user_func_array($function, $args); |
|
| 334 | + } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - /** |
|
| 338 | - * @return void |
|
| 339 | - */ |
|
| 340 | - abstract protected function setAddon(); |
|
| 337 | + /** |
|
| 338 | + * @return void |
|
| 339 | + */ |
|
| 340 | + abstract protected function setAddon(); |
|
| 341 | 341 | } |
@@ -9,83 +9,83 @@ |
||
| 9 | 9 | |
| 10 | 10 | abstract class Field |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * @var Builder |
|
| 14 | - */ |
|
| 15 | - protected $builder; |
|
| 12 | + /** |
|
| 13 | + * @var Builder |
|
| 14 | + */ |
|
| 15 | + protected $builder; |
|
| 16 | 16 | |
| 17 | - public function __construct(Builder $builder) |
|
| 18 | - { |
|
| 19 | - $this->builder = $builder; |
|
| 20 | - } |
|
| 17 | + public function __construct(Builder $builder) |
|
| 18 | + { |
|
| 19 | + $this->builder = $builder; |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @return string|void |
|
| 24 | - */ |
|
| 25 | - public function build() |
|
| 26 | - { |
|
| 27 | - $this->builder->args = $this->getArgs(); |
|
| 28 | - $this->builder->tag = $this->getTag(); |
|
| 29 | - return $this->builder->build($this->builder->tag); |
|
| 30 | - } |
|
| 22 | + /** |
|
| 23 | + * @return string|void |
|
| 24 | + */ |
|
| 25 | + public function build() |
|
| 26 | + { |
|
| 27 | + $this->builder->args = $this->getArgs(); |
|
| 28 | + $this->builder->tag = $this->getTag(); |
|
| 29 | + return $this->builder->build($this->builder->tag); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return array |
|
| 34 | - */ |
|
| 35 | - public function getArgs() |
|
| 36 | - { |
|
| 37 | - return $this->builder->args; |
|
| 38 | - } |
|
| 32 | + /** |
|
| 33 | + * @return array |
|
| 34 | + */ |
|
| 35 | + public function getArgs() |
|
| 36 | + { |
|
| 37 | + return $this->builder->args; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function getTag() |
|
| 44 | - { |
|
| 45 | - return $this->builder->tag; |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function getTag() |
|
| 44 | + { |
|
| 45 | + return $this->builder->tag; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return array |
|
| 50 | - */ |
|
| 51 | - public static function defaults() |
|
| 52 | - { |
|
| 53 | - return []; |
|
| 54 | - } |
|
| 48 | + /** |
|
| 49 | + * @return array |
|
| 50 | + */ |
|
| 51 | + public static function defaults() |
|
| 52 | + { |
|
| 53 | + return []; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @return array |
|
| 58 | - */ |
|
| 59 | - public static function merge(array $args) |
|
| 60 | - { |
|
| 61 | - $merged = array_merge( |
|
| 62 | - wp_parse_args($args, static::defaults()), |
|
| 63 | - static::required() |
|
| 64 | - ); |
|
| 65 | - $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args)); |
|
| 66 | - $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args)); |
|
| 67 | - return $merged; |
|
| 68 | - } |
|
| 56 | + /** |
|
| 57 | + * @return array |
|
| 58 | + */ |
|
| 59 | + public static function merge(array $args) |
|
| 60 | + { |
|
| 61 | + $merged = array_merge( |
|
| 62 | + wp_parse_args($args, static::defaults()), |
|
| 63 | + static::required() |
|
| 64 | + ); |
|
| 65 | + $merged['class'] = implode(' ', static::mergedAttribute('class', ' ', $args)); |
|
| 66 | + $merged['style'] = implode(';', static::mergedAttribute('style', ';', $args)); |
|
| 67 | + return $merged; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @param string $delimiter |
|
| 72 | - * @param string $key |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - public static function mergedAttribute($key, $delimiter, array $args) |
|
| 76 | - { |
|
| 77 | - return Arr::unique(array_merge( |
|
| 78 | - explode($delimiter, Arr::get($args, $key)), |
|
| 79 | - explode($delimiter, Arr::get(static::defaults(), $key)), |
|
| 80 | - explode($delimiter, Arr::get(static::required(), $key)) |
|
| 81 | - )); |
|
| 82 | - } |
|
| 70 | + /** |
|
| 71 | + * @param string $delimiter |
|
| 72 | + * @param string $key |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + public static function mergedAttribute($key, $delimiter, array $args) |
|
| 76 | + { |
|
| 77 | + return Arr::unique(array_merge( |
|
| 78 | + explode($delimiter, Arr::get($args, $key)), |
|
| 79 | + explode($delimiter, Arr::get(static::defaults(), $key)), |
|
| 80 | + explode($delimiter, Arr::get(static::required(), $key)) |
|
| 81 | + )); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @return array |
|
| 86 | - */ |
|
| 87 | - public static function required() |
|
| 88 | - { |
|
| 89 | - return []; |
|
| 90 | - } |
|
| 84 | + /** |
|
| 85 | + * @return array |
|
| 86 | + */ |
|
| 87 | + public static function required() |
|
| 88 | + { |
|
| 89 | + return []; |
|
| 90 | + } |
|
| 91 | 91 | } |