@@ -3,29 +3,29 @@ |
||
| 3 | 3 | defined('WPINC') || die; |
| 4 | 4 | |
| 5 | 5 | spl_autoload_register(function ($className) { |
| 6 | - $classMap = [ |
|
| 7 | - 'WP_Posts_List_Table' => ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php', |
|
| 8 | - ]; |
|
| 9 | - if (array_key_exists($className, $classMap) && file_exists($classMap[$className])) { |
|
| 10 | - require_once $classMap[$className]; |
|
| 11 | - } |
|
| 12 | - $namespaces = [ |
|
| 13 | - 'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/', |
|
| 14 | - 'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/', |
|
| 15 | - 'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/', |
|
| 16 | - 'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/', |
|
| 17 | - 'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/', |
|
| 18 | - ]; |
|
| 19 | - foreach ($namespaces as $prefix => $baseDir) { |
|
| 20 | - $len = strlen($prefix); |
|
| 21 | - if (0 !== strncmp($prefix, $className, $len)) { |
|
| 22 | - continue; |
|
| 23 | - } |
|
| 24 | - $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
| 25 | - if (!file_exists($file)) { |
|
| 26 | - continue; |
|
| 27 | - } |
|
| 28 | - require $file; |
|
| 29 | - break; |
|
| 30 | - } |
|
| 6 | + $classMap = [ |
|
| 7 | + 'WP_Posts_List_Table' => ABSPATH.'wp-admin/includes/class-wp-posts-list-table.php', |
|
| 8 | + ]; |
|
| 9 | + if (array_key_exists($className, $classMap) && file_exists($classMap[$className])) { |
|
| 10 | + require_once $classMap[$className]; |
|
| 11 | + } |
|
| 12 | + $namespaces = [ |
|
| 13 | + 'GeminiLabs\\SiteReviews\\' => __DIR__.'/plugin/', |
|
| 14 | + 'GeminiLabs\\SiteReviews\\Tests\\' => __DIR__.'/tests/', |
|
| 15 | + 'GeminiLabs\\Sepia\\PoParser\\' => __DIR__.'/vendors/sepia/po-parser/', |
|
| 16 | + 'GeminiLabs\\Sinergi\\BrowserDetector\\' => __DIR__.'/vendors/sinergi/browser-detector/', |
|
| 17 | + 'GeminiLabs\\Vectorface\\Whip\\' => __DIR__.'/vendors/vectorface/whip/', |
|
| 18 | + ]; |
|
| 19 | + foreach ($namespaces as $prefix => $baseDir) { |
|
| 20 | + $len = strlen($prefix); |
|
| 21 | + if (0 !== strncmp($prefix, $className, $len)) { |
|
| 22 | + continue; |
|
| 23 | + } |
|
| 24 | + $file = $baseDir.str_replace('\\', '/', substr($className, $len)).'.php'; |
|
| 25 | + if (!file_exists($file)) { |
|
| 26 | + continue; |
|
| 27 | + } |
|
| 28 | + require $file; |
|
| 29 | + break; |
|
| 30 | + } |
|
| 31 | 31 | }); |
@@ -8,141 +8,141 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class GL_Plugin_Check_v4 |
| 10 | 10 | { |
| 11 | - const MIN_PHP_VERSION = '5.6.0'; |
|
| 12 | - const MIN_WORDPRESS_VERSION = '4.7.0'; |
|
| 11 | + const MIN_PHP_VERSION = '5.6.0'; |
|
| 12 | + const MIN_WORDPRESS_VERSION = '4.7.0'; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var array |
|
| 16 | - */ |
|
| 17 | - public $versions; |
|
| 14 | + /** |
|
| 15 | + * @var array |
|
| 16 | + */ |
|
| 17 | + public $versions; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - protected $file; |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + protected $file; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @param string $file |
|
| 26 | - */ |
|
| 27 | - public function __construct($file) |
|
| 28 | - { |
|
| 29 | - $this->file = realpath($file); |
|
| 30 | - $versionRequirements = get_file_data($this->file, [ |
|
| 31 | - 'php' => 'Requires PHP', |
|
| 32 | - 'wordpress' => 'Requires at least', |
|
| 33 | - ]); |
|
| 34 | - $this->versions = wp_parse_args(array_filter($versionRequirements), [ |
|
| 35 | - 'php' => static::MIN_PHP_VERSION, |
|
| 36 | - 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
| 37 | - ]); |
|
| 38 | - } |
|
| 24 | + /** |
|
| 25 | + * @param string $file |
|
| 26 | + */ |
|
| 27 | + public function __construct($file) |
|
| 28 | + { |
|
| 29 | + $this->file = realpath($file); |
|
| 30 | + $versionRequirements = get_file_data($this->file, [ |
|
| 31 | + 'php' => 'Requires PHP', |
|
| 32 | + 'wordpress' => 'Requires at least', |
|
| 33 | + ]); |
|
| 34 | + $this->versions = wp_parse_args(array_filter($versionRequirements), [ |
|
| 35 | + 'php' => static::MIN_PHP_VERSION, |
|
| 36 | + 'wordpress' => static::MIN_WORDPRESS_VERSION, |
|
| 37 | + ]); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return bool |
|
| 42 | - */ |
|
| 43 | - public function canProceed() |
|
| 44 | - { |
|
| 45 | - if ($this->isValid()) { |
|
| 46 | - return true; |
|
| 47 | - } |
|
| 48 | - add_action('activated_plugin', [$this, 'deactivate']); |
|
| 49 | - add_action('admin_notices', [$this, 'deactivate']); |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 40 | + /** |
|
| 41 | + * @return bool |
|
| 42 | + */ |
|
| 43 | + public function canProceed() |
|
| 44 | + { |
|
| 45 | + if ($this->isValid()) { |
|
| 46 | + return true; |
|
| 47 | + } |
|
| 48 | + add_action('activated_plugin', [$this, 'deactivate']); |
|
| 49 | + add_action('admin_notices', [$this, 'deactivate']); |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 56 | - public function isPhpValid() |
|
| 57 | - { |
|
| 58 | - return !version_compare(PHP_VERSION, $this->versions['php'], '<'); |
|
| 59 | - } |
|
| 53 | + /** |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | + public function isPhpValid() |
|
| 57 | + { |
|
| 58 | + return !version_compare(PHP_VERSION, $this->versions['php'], '<'); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @return bool |
|
| 63 | - */ |
|
| 64 | - public function isValid() |
|
| 65 | - { |
|
| 66 | - return $this->isPhpValid() && $this->isWpValid(); |
|
| 67 | - } |
|
| 61 | + /** |
|
| 62 | + * @return bool |
|
| 63 | + */ |
|
| 64 | + public function isValid() |
|
| 65 | + { |
|
| 66 | + return $this->isPhpValid() && $this->isWpValid(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @return bool |
|
| 71 | - */ |
|
| 72 | - public function isWpValid() |
|
| 73 | - { |
|
| 74 | - global $wp_version; |
|
| 75 | - return !version_compare($wp_version, $this->versions['wordpress'], '<'); |
|
| 76 | - } |
|
| 69 | + /** |
|
| 70 | + * @return bool |
|
| 71 | + */ |
|
| 72 | + public function isWpValid() |
|
| 73 | + { |
|
| 74 | + global $wp_version; |
|
| 75 | + return !version_compare($wp_version, $this->versions['wordpress'], '<'); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * @param string $plugin |
|
| 80 | - * @return void |
|
| 81 | - */ |
|
| 82 | - public function deactivate($plugin) |
|
| 83 | - { |
|
| 84 | - if ($this->isValid()) { |
|
| 85 | - return; |
|
| 86 | - } |
|
| 87 | - $pluginSlug = plugin_basename($this->file); |
|
| 88 | - if ($plugin == $pluginSlug) { |
|
| 89 | - $this->redirect(); //exit |
|
| 90 | - } |
|
| 91 | - $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin'); |
|
| 92 | - deactivate_plugins($pluginSlug); |
|
| 93 | - $this->printNotice($pluginData['name']); |
|
| 94 | - } |
|
| 78 | + /** |
|
| 79 | + * @param string $plugin |
|
| 80 | + * @return void |
|
| 81 | + */ |
|
| 82 | + public function deactivate($plugin) |
|
| 83 | + { |
|
| 84 | + if ($this->isValid()) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 87 | + $pluginSlug = plugin_basename($this->file); |
|
| 88 | + if ($plugin == $pluginSlug) { |
|
| 89 | + $this->redirect(); //exit |
|
| 90 | + } |
|
| 91 | + $pluginData = get_file_data($this->file, ['name' => 'Plugin Name'], 'plugin'); |
|
| 92 | + deactivate_plugins($pluginSlug); |
|
| 93 | + $this->printNotice($pluginData['name']); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - /** |
|
| 97 | - * @return array |
|
| 98 | - */ |
|
| 99 | - protected function getMessages() |
|
| 100 | - { |
|
| 101 | - return [ |
|
| 102 | - 'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'site-reviews'), |
|
| 103 | - 'php_version' => _x('PHP version', 'admin-text', 'site-reviews'), |
|
| 104 | - 'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'site-reviews'), |
|
| 105 | - 'update_php' => _x('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'site-reviews'), |
|
| 106 | - 'update_wp' => _x('Update WordPress', 'admin-text', 'site-reviews'), |
|
| 107 | - 'wp_version' => _x('WordPress version', 'admin-text', 'site-reviews'), |
|
| 108 | - 'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'site-reviews'), |
|
| 109 | - ]; |
|
| 110 | - } |
|
| 96 | + /** |
|
| 97 | + * @return array |
|
| 98 | + */ |
|
| 99 | + protected function getMessages() |
|
| 100 | + { |
|
| 101 | + return [ |
|
| 102 | + 'notice' => _x('The %s plugin was deactivated.', 'admin-text', 'site-reviews'), |
|
| 103 | + 'php_version' => _x('PHP version', 'admin-text', 'site-reviews'), |
|
| 104 | + 'rollback' => _x('You can use the %s plugin to restore %s to the previous version.', 'admin-text', 'site-reviews'), |
|
| 105 | + 'update_php' => _x('Please contact your hosting provider or server administrator to upgrade the version of PHP on your server (your server is running PHP version %s), or try to find an alternative plugin.', 'admin-text', 'site-reviews'), |
|
| 106 | + 'update_wp' => _x('Update WordPress', 'admin-text', 'site-reviews'), |
|
| 107 | + 'wp_version' => _x('WordPress version', 'admin-text', 'site-reviews'), |
|
| 108 | + 'wrong_version' => _x('This plugin requires %s or greater in order to work properly.', 'admin-text', 'site-reviews'), |
|
| 109 | + ]; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * @param string $pluginName |
|
| 114 | - * @return void |
|
| 115 | - */ |
|
| 116 | - protected function printNotice($pluginName) |
|
| 117 | - { |
|
| 118 | - $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
| 119 | - $messages = $this->getMessages(); |
|
| 120 | - $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName); |
|
| 121 | - if (!$this->isPhpValid()) { |
|
| 122 | - printf($noticeTemplate, |
|
| 123 | - sprintf($messages['notice'], $pluginName), |
|
| 124 | - sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
|
| 125 | - sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
| 126 | - ); |
|
| 127 | - } elseif (!$this->isWpValid()) { |
|
| 128 | - printf($noticeTemplate, |
|
| 129 | - sprintf($messages['notice'], $pluginName), |
|
| 130 | - sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
|
| 131 | - $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp']) |
|
| 132 | - ); |
|
| 133 | - } |
|
| 134 | - } |
|
| 112 | + /** |
|
| 113 | + * @param string $pluginName |
|
| 114 | + * @return void |
|
| 115 | + */ |
|
| 116 | + protected function printNotice($pluginName) |
|
| 117 | + { |
|
| 118 | + $noticeTemplate = '<div id="message" class="notice notice-error error is-dismissible"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>'; |
|
| 119 | + $messages = $this->getMessages(); |
|
| 120 | + $rollbackMessage = sprintf('<strong>'.$messages['rollback'].'</strong>', '<a href="https://wordpress.org/plugins/wp-rollback/">WP Rollback</a>', $pluginName); |
|
| 121 | + if (!$this->isPhpValid()) { |
|
| 122 | + printf($noticeTemplate, |
|
| 123 | + sprintf($messages['notice'], $pluginName), |
|
| 124 | + sprintf($messages['wrong_version'], $messages['php_version'].' '.$this->versions['php']), |
|
| 125 | + sprintf($messages['update_php'], PHP_VERSION).'</p><p>'.$rollbackMessage |
|
| 126 | + ); |
|
| 127 | + } elseif (!$this->isWpValid()) { |
|
| 128 | + printf($noticeTemplate, |
|
| 129 | + sprintf($messages['notice'], $pluginName), |
|
| 130 | + sprintf($messages['wrong_version'], $messages['wp_version'].' '.$this->versions['wordpress']), |
|
| 131 | + $rollbackMessage.'</p><p>'.sprintf('<a href="%s">%s</a>', admin_url('update-core.php'), $messages['update_wp']) |
|
| 132 | + ); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * @return void |
|
| 138 | - */ |
|
| 139 | - protected function redirect() |
|
| 140 | - { |
|
| 141 | - wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
| 142 | - filter_input(INPUT_GET, 'plugin_status'), |
|
| 143 | - filter_input(INPUT_GET, 'paged'), |
|
| 144 | - filter_input(INPUT_GET, 's') |
|
| 145 | - ))); |
|
| 146 | - exit; |
|
| 147 | - } |
|
| 136 | + /** |
|
| 137 | + * @return void |
|
| 138 | + */ |
|
| 139 | + protected function redirect() |
|
| 140 | + { |
|
| 141 | + wp_safe_redirect(self_admin_url(sprintf('plugins.php?plugin_status=%s&paged=%s&s=%s', |
|
| 142 | + filter_input(INPUT_GET, 'plugin_status'), |
|
| 143 | + filter_input(INPUT_GET, 'paged'), |
|
| 144 | + filter_input(INPUT_GET, 's') |
|
| 145 | + ))); |
|
| 146 | + exit; |
|
| 147 | + } |
|
| 148 | 148 | } |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Text extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public static function defaults() |
|
| 11 | - { |
|
| 12 | - return [ |
|
| 13 | - 'class' => 'regular-text', |
|
| 14 | - ]; |
|
| 15 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public static function defaults() |
|
| 11 | + { |
|
| 12 | + return [ |
|
| 13 | + 'class' => 'regular-text', |
|
| 14 | + ]; |
|
| 15 | + } |
|
| 16 | 16 | } |
@@ -4,32 +4,32 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Radio 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 | - 'value' => 1, |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * @inheritDoc |
|
| 17 | + */ |
|
| 18 | + public static function defaults() |
|
| 19 | + { |
|
| 20 | + return [ |
|
| 21 | + 'value' => 1, |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @inheritDoc |
|
| 27 | - */ |
|
| 28 | - public static function required() |
|
| 29 | - { |
|
| 30 | - return [ |
|
| 31 | - 'is_multi' => true, |
|
| 32 | - 'type' => 'radio', |
|
| 33 | - ]; |
|
| 34 | - } |
|
| 25 | + /** |
|
| 26 | + * @inheritDoc |
|
| 27 | + */ |
|
| 28 | + public static function required() |
|
| 29 | + { |
|
| 30 | + return [ |
|
| 31 | + 'is_multi' => true, |
|
| 32 | + 'type' => 'radio', |
|
| 33 | + ]; |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Password extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public static function defaults() |
|
| 11 | - { |
|
| 12 | - return [ |
|
| 13 | - 'class' => 'regular-text', |
|
| 14 | - ]; |
|
| 15 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public static function defaults() |
|
| 11 | + { |
|
| 12 | + return [ |
|
| 13 | + 'class' => 'regular-text', |
|
| 14 | + ]; |
|
| 15 | + } |
|
| 16 | 16 | } |
@@ -4,32 +4,32 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Checkbox 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 | - 'value' => 1, |
|
| 22 | - ]; |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * @inheritDoc |
|
| 17 | + */ |
|
| 18 | + public static function defaults() |
|
| 19 | + { |
|
| 20 | + return [ |
|
| 21 | + 'value' => 1, |
|
| 22 | + ]; |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @inheritDoc |
|
| 27 | - */ |
|
| 28 | - public static function required() |
|
| 29 | - { |
|
| 30 | - return [ |
|
| 31 | - 'is_multi' => true, |
|
| 32 | - 'type' => 'checkbox', |
|
| 33 | - ]; |
|
| 34 | - } |
|
| 25 | + /** |
|
| 26 | + * @inheritDoc |
|
| 27 | + */ |
|
| 28 | + public static function required() |
|
| 29 | + { |
|
| 30 | + return [ |
|
| 31 | + 'is_multi' => true, |
|
| 32 | + 'type' => 'checkbox', |
|
| 33 | + ]; |
|
| 34 | + } |
|
| 35 | 35 | } |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Rating extends Field |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @inheritDoc |
|
| 11 | - */ |
|
| 12 | - public function getTag() |
|
| 13 | - { |
|
| 14 | - return 'select'; |
|
| 15 | - } |
|
| 9 | + /** |
|
| 10 | + * @inheritDoc |
|
| 11 | + */ |
|
| 12 | + public function getTag() |
|
| 13 | + { |
|
| 14 | + return 'select'; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * @inheritDoc |
|
| 19 | - */ |
|
| 20 | - public static function required() |
|
| 21 | - { |
|
| 22 | - $options = ['' => __('Select a Rating', 'site-reviews')]; |
|
| 23 | - foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) { |
|
| 24 | - $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating); |
|
| 25 | - } |
|
| 26 | - return [ |
|
| 27 | - 'class' => 'glsr-star-rating', |
|
| 28 | - 'options' => $options, |
|
| 29 | - 'type' => 'select', |
|
| 30 | - ]; |
|
| 31 | - } |
|
| 17 | + /** |
|
| 18 | + * @inheritDoc |
|
| 19 | + */ |
|
| 20 | + public static function required() |
|
| 21 | + { |
|
| 22 | + $options = ['' => __('Select a Rating', 'site-reviews')]; |
|
| 23 | + foreach (range(glsr()->constant('MAX_RATING', RatingModule::class), 1) as $rating) { |
|
| 24 | + $options[$rating] = sprintf(_n('%s Star', '%s Stars', $rating, 'site-reviews'), $rating); |
|
| 25 | + } |
|
| 26 | + return [ |
|
| 27 | + 'class' => 'glsr-star-rating', |
|
| 28 | + 'options' => $options, |
|
| 29 | + 'type' => 'select', |
|
| 30 | + ]; |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Number extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public static function defaults() |
|
| 11 | - { |
|
| 12 | - return [ |
|
| 13 | - 'class' => 'small-text', |
|
| 14 | - ]; |
|
| 15 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public static function defaults() |
|
| 11 | + { |
|
| 12 | + return [ |
|
| 13 | + 'class' => 'small-text', |
|
| 14 | + ]; |
|
| 15 | + } |
|
| 16 | 16 | } |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Button extends Field |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @inheritDoc |
|
| 9 | - */ |
|
| 10 | - public static function defaults() |
|
| 11 | - { |
|
| 12 | - return [ |
|
| 13 | - 'class' => 'button', |
|
| 14 | - ]; |
|
| 15 | - } |
|
| 7 | + /** |
|
| 8 | + * @inheritDoc |
|
| 9 | + */ |
|
| 10 | + public static function defaults() |
|
| 11 | + { |
|
| 12 | + return [ |
|
| 13 | + 'class' => 'button', |
|
| 14 | + ]; |
|
| 15 | + } |
|
| 16 | 16 | } |