diff --git a/core/customizer/class-core.php b/core/customizer/class-core.php index 9de37bb..f57a579 100644 --- a/core/customizer/class-core.php +++ b/core/customizer/class-core.php @@ -4,7 +4,7 @@ * * @package Helpful * @subpackage Core\Modules - * @version 4.5.0 + * @version 4.5.19 * @since 4.3.0 */ diff --git a/core/helpers/class-feedback.php b/core/helpers/class-feedback.php index 3e59d82..170ecef 100644 --- a/core/helpers/class-feedback.php +++ b/core/helpers/class-feedback.php @@ -4,7 +4,7 @@ * * @package Helpful * @subpackage Core\Helpers - * @version 4.5.7 + * @version 4.5.19 * @since 1.0.0 */ @@ -43,7 +43,7 @@ public static function get_feedback( $entry ) { $feedback['time'] = sprintf( /* translators: %s = time difference */ __( 'Submitted %s ago', 'helpful' ), - human_time_diff( $time, time() ) + human_time_diff( $time, date_i18n('U') ) ); if ( $entry->fields ) { diff --git a/core/modules/class-core.php b/core/modules/class-core.php index 61cb3f8..49216c1 100644 --- a/core/modules/class-core.php +++ b/core/modules/class-core.php @@ -4,7 +4,7 @@ * * @package Helpful * @subpackage Core\Modules - * @version 4.5.7 + * @version 4.5.19 * @since 4.3.0 */ @@ -284,8 +284,7 @@ public function editor_settings() { * @return void */ public function update_option_hook( $option, $old_value, $value ) { - $service = new Services\Options(); - + $service = Services\Options::get_instance(); $options = $service->get_defaults_array( '', true ); if ( in_array( $option, $options, true ) || strpos( $option, 'helpful_customizer' ) ) { diff --git a/core/modules/class-frontend.php b/core/modules/class-frontend.php index ea07388..17df7ab 100644 --- a/core/modules/class-frontend.php +++ b/core/modules/class-frontend.php @@ -5,7 +5,7 @@ * * @package Helpful * @subpackage Core\Modules - * @version 4.5.5 + * @version 4.5.19 * @since 4.3.0 */ @@ -118,12 +118,12 @@ public function enqueue_scripts() { return; } - $options = new Services\Options(); - $customizer = $options->get_option( 'helpful_customizer', '' ); - $active_theme = ( is_array( $customizer ) && array_key_exists( 'theme', $customizer ) ) ? esc_attr( $customizer['theme'] ) : 'base'; + $service = new Services\Options(); - $themes = apply_filters( 'helpful_themes', array() ); - $plugin = Helper::get_plugin_data(); + $customizer = $service->get_option('helpful_customizer', []); + $active_theme = ( is_array( $customizer ) && array_key_exists( 'theme', $customizer ) ) ? esc_attr( $customizer['theme'] ) : 'base'; + $themes = apply_filters( 'helpful_themes', array() ); + $plugin = Helper::get_plugin_data(); if ( ! empty( $themes ) ) { foreach ( $themes as $theme ) { diff --git a/core/services/class-options.php b/core/services/class-options.php index ee79a7a..a08ab5d 100644 --- a/core/services/class-options.php +++ b/core/services/class-options.php @@ -5,7 +5,7 @@ * * @package Helpful * @subpackage Core\Services - * @version 4.5.8 + * @version 4.5.19 * @since 4.4.47 */ @@ -30,6 +30,27 @@ class Options { */ private $options; + /** + * Instanzholder. + * + * @var self + */ + private static $instance; + + /** + * Constructs an instance. + * + * @return self + */ + public static function get_instance() + { + if (!self::$instance) { + self::$instance = new static(); + } + + return self::$instance; + } + /** * Constructor */ @@ -42,7 +63,7 @@ public function __construct() { * Resave the options. */ public function renew_options() { - update_option( 'helpful_options', $this->options ); + update_option( 'helpful_options', maybe_serialize( $this->options ) ); } /** diff --git a/core/tabs/class-feedback.php b/core/tabs/class-feedback.php index 577135d..e4e81a9 100644 --- a/core/tabs/class-feedback.php +++ b/core/tabs/class-feedback.php @@ -4,7 +4,7 @@ * * @package Helpful * @subpackage Core\Tabs - * @version 4.5.5 + * @version 4.5.19 * @since 4.3.0 */ @@ -231,7 +231,7 @@ public function register_tab_alerts() { * @return mixed */ public function sanitize_input( $value ) { - return wp_kses( $value, Helper::kses_allowed_tags() ); + return esc_html( wp_kses( $value, Helper::kses_allowed_tags() ) ); } /** diff --git a/helpful.php b/helpful.php index 39d8344..4e38304 100644 --- a/helpful.php +++ b/helpful.php @@ -2,7 +2,7 @@ /** * Plugin Name: Helpful * Description: Add a fancy feedback form under your posts or post-types and ask your visitors a question. Give them the abbility to vote with yes or no. - * Version: 4.5.18 + * Version: 4.5.19 * Author: Pixelbart * Author URI: https://pixelbart.de * Text Domain: helpful diff --git a/readme.txt b/readme.txt index 4aeceb6..c7709a9 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: helpful, poll, feedback, reviews, vote, review, voting Requires at least: 4.6 Tested up to: 6.0 Requires PHP: 5.6.20 -Stable tag: 4.5.18 +Stable tag: 4.5.19 License: MIT License License URI: https://opensource.org/licenses/MIT