Plugin Directory

Changeset 2566651


Ignore:
Timestamp:
07/18/2021 01:24:53 PM (5 years ago)
Author:
Shmidtelson
Message:

Update to version 1.2.0 from GitHub

Location:
wp-post-rating
Files:
24 added
8 deleted
22 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-post-rating/tags/1.2.0/config/php-scoper/symfony_config.inc.php

    r2427790 r2566651  
    11<?php
    22
    3 declare(strict_types = 1);
     3declare(strict_types=1);
    44
    55use Isolated\Symfony\Component\Finder\Finder;
     
    1414     * For more see: https://github.com/humbug/php-scoper#finders-and-paths
    1515     */
    16     'finders'                    => array(
    17         Finder::create()->files()->in( 'vendor/symfony/config' ),
     16    'finders' => array(
     17        Finder::create()->files()->in('vendor/symfony/config'),
    1818    ),
    1919
     
    2626     * For more see: https://github.com/humbug/php-scoper#patchers
    2727     */
    28     'patchers'                   => array(),
     28    'patchers' => array(),
    2929);
  • wp-post-rating/tags/1.2.0/readme.txt

    r2427790 r2566651  
    4444
    4545== Changelog ==
     46= 1.2.0 =
     47* Stars rating library moved to @romua1d/star-rating-js library
    4648= 1.1.1.0 =
    4749* Global refactoring. Moved to Symfony DI
  • wp-post-rating/tags/1.2.0/src/Entity/SettingEntity.php

    r2427790 r2566651  
    99    public $position = 'shortcode';
    1010    public $starsMainColor = '#fdd835';
    11     public $starsSecondColor = '#fbc02d';
    1211    public $starsTextColor = '#000';
    1312    public $starsTextBackgroundColor = '#fff';
     
    1817        $this->setPosition($data['position']);
    1918        $this->setStarsMainColor($data['starsMainColor']);
    20         $this->setStarsSecondColor($data['starsSecondColor']);
    2119        $this->setStarsTextColor($data['starsTextColor']);
    2220        $this->setStarsTextBackgroundColor($data['starsTextBackgroundColor']);
     
    5452    {
    5553        $this->starsMainColor = $starsMainColor;
    56     }
    57 
    58     /**
    59      * @return mixed
    60      */
    61     public function getStarsSecondColor()
    62     {
    63         return $this->starsSecondColor;
    64     }
    65 
    66     /**
    67      * @param mixed $starsSecondColor
    68      */
    69     public function setStarsSecondColor($starsSecondColor): void
    70     {
    71         $this->starsSecondColor = $starsSecondColor;
    7254    }
    7355
  • wp-post-rating/tags/1.2.0/src/Service/ConfigService.php

    r2427790 r2566651  
    9999    public function getPluginCssPath()
    100100    {
    101         return $this->getPluginUrl().'assets/css/';
     101        return $this->getPluginUrl().'dist/';
    102102    }
    103103
     
    107107    public function getPluginJSPath()
    108108    {
    109         return $this->getPluginUrl().'assets/js/min/';
     109        return $this->getPluginUrl().'dist/';
    110110    }
    111111}
  • wp-post-rating/tags/1.2.0/src/Service/ScriptsService.php

    r2427790 r2566651  
    4444        wp_enqueue_style(
    4545            self::SCRIPT_NAME,
    46             $this->configService->getPluginCssPath().'wp-post-rating.min.css',
     46            $this->configService->getPluginCssPath() . 'main.css',
    4747            [],
    4848            $this->params->get('wpr.version'),
     
    5252        wp_enqueue_script(
    5353            self::SCRIPT_NAME,
    54             $this->configService->getPluginJSPath().'wp-post-rating.min.js',
     54            $this->configService->getPluginJSPath() . 'main.bundle.js',
    5555            ['jquery'],
    5656            $this->params->get('wpr.version'),
     
    6666    public function initAdminScripts($hook)
    6767    {
    68         if ($hook === 'settings_page_'.ConfigService::OPTIONS_KEY) {
     68        if ($hook === 'settings_page_' . ConfigService::OPTIONS_KEY) {
    6969            /*
    7070             * COLOR PICKER
     
    7575            wp_register_script(
    7676                'admin-settings-page',
    77                 $this->configService->getPluginJSPath().'admin-settings-page.min.js',
     77                $this->configService->getPluginJSPath() . 'admin.bundle.js',
    7878                ['jquery', 'wp-color-picker']
    7979            );
     
    8282        }
    8383
    84         if ($hook === 'settings_page_'.ConfigService::OPTIONS_KEY or $hook === 'plugins.php') {
     84        if ($hook === 'settings_page_' . ConfigService::OPTIONS_KEY or $hook === 'plugins.php') {
    8585            wp_register_style(
    8686                'admin-settings-page',
    87                 $this->configService->getPluginCssPath().'admin-settings-page.min.css'
     87                $this->configService->getPluginCssPath() . 'admin.css'
    8888            );
    8989            wp_enqueue_style('admin-settings-page');
     
    9898:root {
    9999    --wpr-main-color: %s;
    100     --wpr-second-color: %s;
    101100    --wpr-text-color: %s;
    102101    --wpr-text-background-color: %s;
    103102}',
    104103            $settingsDto->getStarsMainColor(),
    105             $settingsDto->getStarsSecondColor(),
    106104            $settingsDto->getStarsTextColor(),
    107105            $settingsDto->getStarsTextBackgroundColor()
  • wp-post-rating/tags/1.2.0/src/Service/SettingFormService.php

    r2427790 r2566651  
    3030        $settingEntity = $this->settingService->getSetting();
    3131        $settingEntity->setStarsMainColor(htmlspecialchars($_POST['main_color']));
    32         $settingEntity->setStarsSecondColor(htmlspecialchars($_POST['second_color']));
    3332        $settingEntity->setStarsTextColor(htmlspecialchars($_POST['text_color']));
    3433        $settingEntity->setStarsTextBackgroundColor(htmlspecialchars($_POST['text_background_color']));
     
    5857    {
    5958        $this->validateColorHEX($settingEntity->getStarsMainColor());
    60         $this->validateColorHEX($settingEntity->getStarsSecondColor());
    6159        $this->validateColorHEX($settingEntity->getStarsTextColor());
    6260        $this->validateColorHEX($settingEntity->getStarsTextBackgroundColor());
  • wp-post-rating/tags/1.2.0/src/Views/RatingView.php

    r2427790 r2566651  
    88use WPR\Service\TwigEnvironmentService;
    99use WPR\Service\WordpressFunctionsService;
     10use WPR\Service\SettingService;
    1011
    1112class RatingView
     
    3132    private $twigService;
    3233
     34    /**
     35     * @var SettingService
     36     */
     37    private $settingService;
     38
    3339    public function __construct(
    3440        WordpressFunctionsService $wordpressService,
    3541        RatingService $ratingService,
    3642        SchemaOrgView $schemaView,
    37         TwigEnvironmentService $twigService
     43        TwigEnvironmentService $twigService,
     44        SettingService $settingService
    3845    ) {
    3946        $this->wordpressService = $wordpressService;
     
    4148        $this->schemaView = $schemaView;
    4249        $this->twigService = $twigService;
     50        $this->settingService = $settingService;
    4351    }
    4452
     
    5361            'total' => $this->ratingService->getTotalVotesByPostId($id),
    5462            'jsonMarkup' => $this->schemaView->getJSONLD(),
     63            'starsColor' => $this->settingService->getSetting()->getStarsMainColor(),
     64            'textColor' => $this->settingService->getSetting()->getStarsTextColor(),
     65            'backgroundColor' => $this->settingService->getSetting()->getStarsTextBackgroundColor(),
    5566        ]);
    5667    }
  • wp-post-rating/tags/1.2.0/src/Wordpress/WPR_Widget.php

    r2363367 r2566651  
    181181            $date = date_i18n($date_format, strtotime($post['created_at']));
    182182            $stars =
    183                 '<small class="wpr_rating_list">'
     183                '<small class="wpr_rating_list" style="color: var(--wpr-main-color);">'
    184184                .str_repeat('<span class="icon-star"></span>', (int) $post['vote'])
    185185                .'</small>';
  • wp-post-rating/tags/1.2.0/views/admin/settings.twig

    r2363367 r2566651  
    4848                <td>
    4949                    <fieldset>
    50                         <div class="wpr-wrapp wpr-wrapp-admin">
    51                             <div class="wpr-rating">
    52                                 <span class="icon-star checked" data-value="5" title="{{ __('Vote', PLUGIN_NAME) }} 5"></span>
    53                                 <span class="icon-star" data-value="4"
    54                                       title="{{ __('Vote', PLUGIN_NAME) }} 4"></span>
    55                                 <span class="icon-star" data-value="3"
    56                                       title="{{ __('Vote', PLUGIN_NAME) }} 3"></span>
    57                                 <span class="icon-star" data-value="2"
    58                                       title="{{ __('Vote', PLUGIN_NAME) }} 2"></span>
    59                                 <span class="icon-star" data-value="1"
    60                                       title="{{ __('Vote', PLUGIN_NAME) }} 1"></span>
    61                             </div>
    62                             <div class="wpr-info-container">
    63                                 <span>{{ __('Votes', PLUGIN_NAME) }}&nbsp;</span>
    64                                 <span class="wpr-total">(1)</span>
    65                             </div>
    66                         </div>
     50                        <div class="wpr-wrapp wpr-wrapp-admin"><span></span></div>
    6751                    </fieldset>
    6852                </td>
     
    8266                            {{ __('Second (darker) color choose automatically', PLUGIN_NAME) }}
    8367                        </p>
    84                         <input class="second_color_chooser_js" name="second_color" type="hidden"
    85                                value="{{ options.getStarsSecondColor }}"/>
    8668                    </fieldset>
    8769                </td>
  • wp-post-rating/tags/1.2.0/views/star-rating.twig

    r2363367 r2566651  
    1 <div class="wpr-wrapp" id="wpr-widget-{{ postId }}">
    2     <div class="wpr-rating" data-id="{{ postId }}">
    3         {% for i in 5..1 %}
    4             <span class="icon-star {% if i == avgRating %}checked{% endif %}" data-value="{{ i }}"></span>
    5         {% endfor %}
    6     </div>
    7     <div class="wpr-rating-loader wpr-hide">
    8         <i class="icon-spin4 animate-spin"></i>
    9     </div>
    10     <div class="wpr-info-container">
    11         {% if total %}
    12             <span>{{ __('Votes', PLUGIN_NAME) }}&nbsp;</span>
    13             <span class="wpr-total">({{ total }})</span>
    14         {% else %}
    15             <span>{{ __('Vote', PLUGIN_NAME) }}</span>
    16             <span class="wpr-total"></span>
    17         {% endif %}
    18     </div>
    19 </div>
     1<div
     2    class="wpr-wrapp"
     3    id="wpr-widget-{{ postId }}"
     4    data-id="{{ postId }}"
     5    data-value="{{ avgRating }}"
     6    data-votestitle="{{ __('Votes', PLUGIN_NAME) }}"
     7    data-total="{{ total }}"
     8    data-fontsize="30px"
     9    data-starscolor="{{ starsColor }}"
     10    data-textcolor="{{ textColor }}"
     11    data-backgroundcolor="{{ backgroundColor }}"
     12
     13></div>
    2014{{ jsonMarkup|raw }}
  • wp-post-rating/tags/1.2.0/wp-post-rating.php

    r2427790 r2566651  
    44Plugin URI: https://github.com/shmidtelson/wp-post-rating
    55Description: Powerful post rating wordpress plugin
    6 Version: 1.1.1.0
     6Version: 1.2.0
    77Author: Romua1d
    88Author URI: https://romua1d.ru
  • wp-post-rating/trunk/config/php-scoper/symfony_config.inc.php

    r2427790 r2566651  
    11<?php
    22
    3 declare(strict_types = 1);
     3declare(strict_types=1);
    44
    55use Isolated\Symfony\Component\Finder\Finder;
     
    1414     * For more see: https://github.com/humbug/php-scoper#finders-and-paths
    1515     */
    16     'finders'                    => array(
    17         Finder::create()->files()->in( 'vendor/symfony/config' ),
     16    'finders' => array(
     17        Finder::create()->files()->in('vendor/symfony/config'),
    1818    ),
    1919
     
    2626     * For more see: https://github.com/humbug/php-scoper#patchers
    2727     */
    28     'patchers'                   => array(),
     28    'patchers' => array(),
    2929);
  • wp-post-rating/trunk/readme.txt

    r2427790 r2566651  
    4444
    4545== Changelog ==
     46= 1.2.0 =
     47* Stars rating library moved to @romua1d/star-rating-js library
    4648= 1.1.1.0 =
    4749* Global refactoring. Moved to Symfony DI
  • wp-post-rating/trunk/src/Entity/SettingEntity.php

    r2427790 r2566651  
    99    public $position = 'shortcode';
    1010    public $starsMainColor = '#fdd835';
    11     public $starsSecondColor = '#fbc02d';
    1211    public $starsTextColor = '#000';
    1312    public $starsTextBackgroundColor = '#fff';
     
    1817        $this->setPosition($data['position']);
    1918        $this->setStarsMainColor($data['starsMainColor']);
    20         $this->setStarsSecondColor($data['starsSecondColor']);
    2119        $this->setStarsTextColor($data['starsTextColor']);
    2220        $this->setStarsTextBackgroundColor($data['starsTextBackgroundColor']);
     
    5452    {
    5553        $this->starsMainColor = $starsMainColor;
    56     }
    57 
    58     /**
    59      * @return mixed
    60      */
    61     public function getStarsSecondColor()
    62     {
    63         return $this->starsSecondColor;
    64     }
    65 
    66     /**
    67      * @param mixed $starsSecondColor
    68      */
    69     public function setStarsSecondColor($starsSecondColor): void
    70     {
    71         $this->starsSecondColor = $starsSecondColor;
    7254    }
    7355
  • wp-post-rating/trunk/src/Service/ConfigService.php

    r2427790 r2566651  
    9999    public function getPluginCssPath()
    100100    {
    101         return $this->getPluginUrl().'assets/css/';
     101        return $this->getPluginUrl().'dist/';
    102102    }
    103103
     
    107107    public function getPluginJSPath()
    108108    {
    109         return $this->getPluginUrl().'assets/js/min/';
     109        return $this->getPluginUrl().'dist/';
    110110    }
    111111}
  • wp-post-rating/trunk/src/Service/ScriptsService.php

    r2427790 r2566651  
    4444        wp_enqueue_style(
    4545            self::SCRIPT_NAME,
    46             $this->configService->getPluginCssPath().'wp-post-rating.min.css',
     46            $this->configService->getPluginCssPath() . 'main.css',
    4747            [],
    4848            $this->params->get('wpr.version'),
     
    5252        wp_enqueue_script(
    5353            self::SCRIPT_NAME,
    54             $this->configService->getPluginJSPath().'wp-post-rating.min.js',
     54            $this->configService->getPluginJSPath() . 'main.bundle.js',
    5555            ['jquery'],
    5656            $this->params->get('wpr.version'),
     
    6666    public function initAdminScripts($hook)
    6767    {
    68         if ($hook === 'settings_page_'.ConfigService::OPTIONS_KEY) {
     68        if ($hook === 'settings_page_' . ConfigService::OPTIONS_KEY) {
    6969            /*
    7070             * COLOR PICKER
     
    7575            wp_register_script(
    7676                'admin-settings-page',
    77                 $this->configService->getPluginJSPath().'admin-settings-page.min.js',
     77                $this->configService->getPluginJSPath() . 'admin.bundle.js',
    7878                ['jquery', 'wp-color-picker']
    7979            );
     
    8282        }
    8383
    84         if ($hook === 'settings_page_'.ConfigService::OPTIONS_KEY or $hook === 'plugins.php') {
     84        if ($hook === 'settings_page_' . ConfigService::OPTIONS_KEY or $hook === 'plugins.php') {
    8585            wp_register_style(
    8686                'admin-settings-page',
    87                 $this->configService->getPluginCssPath().'admin-settings-page.min.css'
     87                $this->configService->getPluginCssPath() . 'admin.css'
    8888            );
    8989            wp_enqueue_style('admin-settings-page');
     
    9898:root {
    9999    --wpr-main-color: %s;
    100     --wpr-second-color: %s;
    101100    --wpr-text-color: %s;
    102101    --wpr-text-background-color: %s;
    103102}',
    104103            $settingsDto->getStarsMainColor(),
    105             $settingsDto->getStarsSecondColor(),
    106104            $settingsDto->getStarsTextColor(),
    107105            $settingsDto->getStarsTextBackgroundColor()
  • wp-post-rating/trunk/src/Service/SettingFormService.php

    r2427790 r2566651  
    3030        $settingEntity = $this->settingService->getSetting();
    3131        $settingEntity->setStarsMainColor(htmlspecialchars($_POST['main_color']));
    32         $settingEntity->setStarsSecondColor(htmlspecialchars($_POST['second_color']));
    3332        $settingEntity->setStarsTextColor(htmlspecialchars($_POST['text_color']));
    3433        $settingEntity->setStarsTextBackgroundColor(htmlspecialchars($_POST['text_background_color']));
     
    5857    {
    5958        $this->validateColorHEX($settingEntity->getStarsMainColor());
    60         $this->validateColorHEX($settingEntity->getStarsSecondColor());
    6159        $this->validateColorHEX($settingEntity->getStarsTextColor());
    6260        $this->validateColorHEX($settingEntity->getStarsTextBackgroundColor());
  • wp-post-rating/trunk/src/Views/RatingView.php

    r2427790 r2566651  
    88use WPR\Service\TwigEnvironmentService;
    99use WPR\Service\WordpressFunctionsService;
     10use WPR\Service\SettingService;
    1011
    1112class RatingView
     
    3132    private $twigService;
    3233
     34    /**
     35     * @var SettingService
     36     */
     37    private $settingService;
     38
    3339    public function __construct(
    3440        WordpressFunctionsService $wordpressService,
    3541        RatingService $ratingService,
    3642        SchemaOrgView $schemaView,
    37         TwigEnvironmentService $twigService
     43        TwigEnvironmentService $twigService,
     44        SettingService $settingService
    3845    ) {
    3946        $this->wordpressService = $wordpressService;
     
    4148        $this->schemaView = $schemaView;
    4249        $this->twigService = $twigService;
     50        $this->settingService = $settingService;
    4351    }
    4452
     
    5361            'total' => $this->ratingService->getTotalVotesByPostId($id),
    5462            'jsonMarkup' => $this->schemaView->getJSONLD(),
     63            'starsColor' => $this->settingService->getSetting()->getStarsMainColor(),
     64            'textColor' => $this->settingService->getSetting()->getStarsTextColor(),
     65            'backgroundColor' => $this->settingService->getSetting()->getStarsTextBackgroundColor(),
    5566        ]);
    5667    }
  • wp-post-rating/trunk/src/Wordpress/WPR_Widget.php

    r2363367 r2566651  
    181181            $date = date_i18n($date_format, strtotime($post['created_at']));
    182182            $stars =
    183                 '<small class="wpr_rating_list">'
     183                '<small class="wpr_rating_list" style="color: var(--wpr-main-color);">'
    184184                .str_repeat('<span class="icon-star"></span>', (int) $post['vote'])
    185185                .'</small>';
  • wp-post-rating/trunk/views/admin/settings.twig

    r2363367 r2566651  
    4848                <td>
    4949                    <fieldset>
    50                         <div class="wpr-wrapp wpr-wrapp-admin">
    51                             <div class="wpr-rating">
    52                                 <span class="icon-star checked" data-value="5" title="{{ __('Vote', PLUGIN_NAME) }} 5"></span>
    53                                 <span class="icon-star" data-value="4"
    54                                       title="{{ __('Vote', PLUGIN_NAME) }} 4"></span>
    55                                 <span class="icon-star" data-value="3"
    56                                       title="{{ __('Vote', PLUGIN_NAME) }} 3"></span>
    57                                 <span class="icon-star" data-value="2"
    58                                       title="{{ __('Vote', PLUGIN_NAME) }} 2"></span>
    59                                 <span class="icon-star" data-value="1"
    60                                       title="{{ __('Vote', PLUGIN_NAME) }} 1"></span>
    61                             </div>
    62                             <div class="wpr-info-container">
    63                                 <span>{{ __('Votes', PLUGIN_NAME) }}&nbsp;</span>
    64                                 <span class="wpr-total">(1)</span>
    65                             </div>
    66                         </div>
     50                        <div class="wpr-wrapp wpr-wrapp-admin"><span></span></div>
    6751                    </fieldset>
    6852                </td>
     
    8266                            {{ __('Second (darker) color choose automatically', PLUGIN_NAME) }}
    8367                        </p>
    84                         <input class="second_color_chooser_js" name="second_color" type="hidden"
    85                                value="{{ options.getStarsSecondColor }}"/>
    8668                    </fieldset>
    8769                </td>
  • wp-post-rating/trunk/views/star-rating.twig

    r2363367 r2566651  
    1 <div class="wpr-wrapp" id="wpr-widget-{{ postId }}">
    2     <div class="wpr-rating" data-id="{{ postId }}">
    3         {% for i in 5..1 %}
    4             <span class="icon-star {% if i == avgRating %}checked{% endif %}" data-value="{{ i }}"></span>
    5         {% endfor %}
    6     </div>
    7     <div class="wpr-rating-loader wpr-hide">
    8         <i class="icon-spin4 animate-spin"></i>
    9     </div>
    10     <div class="wpr-info-container">
    11         {% if total %}
    12             <span>{{ __('Votes', PLUGIN_NAME) }}&nbsp;</span>
    13             <span class="wpr-total">({{ total }})</span>
    14         {% else %}
    15             <span>{{ __('Vote', PLUGIN_NAME) }}</span>
    16             <span class="wpr-total"></span>
    17         {% endif %}
    18     </div>
    19 </div>
     1<div
     2    class="wpr-wrapp"
     3    id="wpr-widget-{{ postId }}"
     4    data-id="{{ postId }}"
     5    data-value="{{ avgRating }}"
     6    data-votestitle="{{ __('Votes', PLUGIN_NAME) }}"
     7    data-total="{{ total }}"
     8    data-fontsize="30px"
     9    data-starscolor="{{ starsColor }}"
     10    data-textcolor="{{ textColor }}"
     11    data-backgroundcolor="{{ backgroundColor }}"
     12
     13></div>
    2014{{ jsonMarkup|raw }}
  • wp-post-rating/trunk/wp-post-rating.php

    r2427790 r2566651  
    44Plugin URI: https://github.com/shmidtelson/wp-post-rating
    55Description: Powerful post rating wordpress plugin
    6 Version: 1.1.1.0
     6Version: 1.2.0
    77Author: Romua1d
    88Author URI: https://romua1d.ru
Note: See TracChangeset for help on using the changeset viewer.