Plugin Directory

Changeset 2633166


Ignore:
Timestamp:
11/21/2021 03:14:02 PM (4 years ago)
Author:
proofratings
Message:

version 1.0.5

Location:
proofratings
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • proofratings/tags/1.0.5/assets/css/proofratings-admin.css

    r2632854 r2633166  
    2121    font-size: inherit;
    2222}
     23
     24.proofratings-settings-wrap {padding-left: 20px;}
     25body.proofratings_page_proofratings-analytics .proofratings-settings-wrap {padding-left: 0}
    2326
    2427.proofratings-settings-wrap .shortcode-info {
     
    232235
    233236.proofratings-popup-widgets-box > * {box-sizing: border-box;}
     237
     238body.toplevel_page_proofratings {background-color: #fff}
     239
     240body.toplevel_page_proofratings #wpcontent {padding-left: 0}
     241
     242.proofratings-analytics-wrap {margin: 0; padding: 20px 30px}
     243
     244.analytics-filter {
     245    display: flex;
     246    align-items: center;
     247    padding: 15px 30px;
     248    margin: 0 -30px;
     249    margin-bottom: 20px;
     250    justify-content: space-between;
     251    border-bottom: 1px solid #f3f3f3;
     252}
     253
     254.analytics-filter select, #analytics-date {
     255    line-height: 32px;
     256    height: 34px;
     257    border: 1px solid #8c8f94;
     258    border-radius: 0;
     259    box-sizing: border-box;
     260}
     261
     262#analytics-date {
     263    width: 230px;
     264    padding: 0 15px;
     265    font-size: 14px;
     266    align-items: center;
     267    display: inline-flex;
     268    font-weight: 600;
     269    background-color: #fff;
     270    cursor: pointer;
     271}
     272
     273#analytics-date .dashicons {
     274    margin-left: -10px;
     275    margin-right: 6px;
     276}
     277
     278.analytics-information {
     279    display: grid;
     280    max-width: 600px;
     281    gap: 30px;
     282    grid-template-columns: repeat(3, 1fr)
     283}
     284
     285.analytics-information p {
     286    color: #a8a8a8;
     287    font-size: 14px;
     288}
     289
     290.analytics-information .name {
     291    margin: 0;
     292    font-size: 16px;
     293}
     294
     295.analytics-information .name + p {margin-top: 5px;}
     296
     297.analytics-information .counter {
     298    font-size: 36px;
     299    font-weight: bold;
     300    display: block;
     301    margin: 8px 0 20px;
     302    line-height: 1;
     303    position: relative;
     304}
     305
     306.analytics-information .counter:before {
     307    content: "";
     308    display: block;
     309    height: 8px;
     310    width: 72px;
     311    margin-bottom: 19px;
     312    border-radius: 40px;
     313    background-color: #fdbe91;
     314}
     315
     316.analytics-information .impressions .counter:before {
     317    background-color: #4123FF;
     318}
     319
     320.analytics-information .engagements .counter:before {visibility: hidden;}
     321
     322#analytics-chart {
     323    margin-top: 30px;
     324}
  • proofratings/tags/1.0.5/assets/js/proofratings.js

    r2632854 r2633166  
    4747    })
    4848
    49     if ( $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge').length ) {
     49    const proofratings_items = $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge');
     50    if ( proofratings_items.length ) {
    5051        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'impression'})
    5152    }
    5253
    53     $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge').on('click', function(){
     54    proofratings_items.on('click', function(){
    5455        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'click'})
    5556    })
    5657
     58    proofratings_items.on('mouseenter', function(){
     59        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'engagement'})
     60    })
    5761
    5862})(jQuery)
  • proofratings/tags/1.0.5/assets/js/redux.min.js

    r2632854 r2633166  
    1 !function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e="function"==typeof Symbol&&Symbol.observable||"@@observable",n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){return t(r.apply(this,arguments))}}function u(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function p(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?c(Object(e),!0).forEach((function(t){u(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(){var n=r.apply(void 0,arguments),o=function(){throw Error(t(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},f=e.map((function(r){return r(i)}));return o=a.apply(void 0,f)(n.dispatch),p(p({},n),{},{dispatch:o})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function b(){if(s)throw Error(t(3));return a}function h(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));p=r,v({type:o.REPLACE})}function E(){var r,n=h;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(b())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}return v({type:o.INIT}),(c={dispatch:v,subscribe:h,getState:b,replaceReducer:O})[e]=E,c},Object.defineProperty(r,"__esModule",{value:!0})}));
     1!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}(),n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){for(var e=arguments.length,n=Array(e),o=0;e>o;o++)n[o]=arguments[o];return t(r.apply(this,n))}}function u(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function c(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?u(Object(e),!0).forEach((function(t){p(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function p(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(n,o){var i=r(n,o),f=function(){throw Error(t(15))},u={getState:i.getState,dispatch:function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];return f.apply(void 0,[r].concat(e))}},p=e.map((function(r){return r(u)}));return f=a.apply(void 0,p)(i.dispatch),c(c({},i),{},{dispatch:f})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function h(){if(s)throw Error(t(3));return a}function b(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));return p=r,v({type:o.REPLACE}),E}function g(){var r,n=b;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(h())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}v({type:o.INIT});var E=((c={dispatch:v,subscribe:b,getState:h,replaceReducer:O})[e]=g,c);return E},Object.defineProperty(r,"__esModule",{value:!0})}));
  • proofratings/tags/1.0.5/inc/class-proofratings-admin.php

    r2632854 r2633166  
    4343     */
    4444    public function __construct() {
     45        include_once dirname( __FILE__ ) . '/class-proofratings-generate-style.php';
    4546        include_once dirname( __FILE__ ) . '/class-proofratings-settings.php';
     47
    4648        $this->settings_page = WP_ProofRatings_Settings::instance();
     49        $this->analytics = include_once dirname( __FILE__ ) . '/class-proofratings-analytics.php';
    4750       
    4851        add_action( 'init', [$this, 'register_your_domain']);
    4952        add_action( 'admin_menu', [ $this, 'admin_menu' ] );
    5053        add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
    51         add_action( "updated_option", [ $this, 'generate_css' ], 10, 3 );
    5254    }
    5355
     
    7173
    7274    /**
    73      * Generate styles
    74      */
    75     public function generate_css($old_value, $value, $option) {
    76         if ( !isset($_POST['option_page']) || 'proofratings' != $_POST['option_page'] ) {
    77             return;
    78         }
    79 
    80         $postdata = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
    81        
    82         $widget_settings = wp_parse_args($postdata['proofratings_widget_settings'], [
    83             'proofratings_font' => 'inherit',
    84         ]);
    85        
    86         ob_start();
    87 
    88         if ( $widget_settings['proofratings_font'] ) {
    89             echo ":root {\n";
    90                 printf("\t--proofratingsFont: %s;\n", $widget_settings['proofratings_font']);
    91             echo "}\n\n";
    92         }
    93 
    94         $badges_square = get_proofratings_badges_square();
    95         if ( $badges_square->customize == 'yes' ) {
    96             echo ".proofratings-widget.proofratings-widget-square {\n";
    97                 if ( $badges_square->star_color ) {
    98                     printf("\t--themeColor: %s;\n", $badges_square->star_color);
    99                 }
    100 
    101                 if ( $badges_square->text_color ) {
    102                     printf("\t--textColor: %s;\n", $badges_square->text_color);
    103                 }
    104 
    105                 if ( $badges_square->background ) {
    106                     printf("\tbackground-color: %s;\n", $badges_square->background);
    107                 }
    108 
    109                 if ( $badges_square->shadow == 'yes' ) {                   
    110                     if ( $badges_square->shadow_color ) {
    111                         printf("\t--shadowColor: %s;\n", $badges_square->shadow_color);
    112                     }
    113                 }
    114 
    115             echo "}\n\n";
    116 
    117             if ( $badges_square->shadow == 'yes' ) {
    118                 echo ".proofratings-widget.proofratings-widget-square:hover {\n";
    119                     if ( $badges_square->star_color ) {
    120                         printf("\t--borderColor: %s;\n", $badges_square->star_color);
    121                     }
    122 
    123                     if ( $badges_square->shadow_hover_color ) {
    124                         printf("\t--shadowColor: %s;\n", $badges_square->shadow_hover_color);
    125                     }
    126                 echo "}\n\n";
    127             }
    128 
    129             if ( $badges_square->shadow == 'no' ) {
    130                 echo ".proofratings-widget.proofratings-widget-square, .proofratings-widget.proofratings-widget-square:hover {\n";
    131                     echo "\t--borderColor: transparent;\n";
    132                     echo "\t--shadowColor: transparent;\n";
    133                 echo "}\n\n";
    134             }
    135         }
    136 
    137         $badges_rectangle = get_proofratings_badges_rectangle();
    138         if ( $badges_rectangle->customize == 'yes' ) {
    139             echo ".proofratings-widget.proofratings-widget-rectangle {\n";
    140                 if ( $badges_rectangle->star_color ) {
    141                     printf("\t--themeColor: %s;\n", $badges_rectangle->star_color);
    142                 }
    143 
    144                 if ( $badges_rectangle->icon_color ) {
    145                     printf("\t--iconColor: %s;\n", $badges_rectangle->icon_color);
    146                 }
    147 
    148                 if ( $badges_rectangle->text_color ) {
    149                     printf("\t--textColor: %s;\n", $badges_rectangle->text_color);
    150                 }
    151 
    152                 if ( $badges_rectangle->review_count_textcolor ) {
    153                     printf("\t--reviewCountTextColor: %s;\n", $badges_rectangle->review_count_textcolor);
    154                 }
    155 
    156                 if ( $badges_rectangle->background ) {
    157                     printf("\tbackground-color: %s;\n", $badges_rectangle->background);
    158                 }
    159 
    160                 if ( $badges_rectangle->shadow == 'yes' ) {                 
    161                     if ( $badges_rectangle->shadow_color ) {
    162                         printf("\t--shadowColor: %s;\n", $badges_rectangle->shadow_color);
    163                     }
    164                 }
    165 
    166             echo "}\n\n";
    167 
    168             if ( $badges_rectangle->shadow == 'yes' ) {
    169                 echo ".proofratings-widget.proofratings-widget-rectangle:hover {\n";
    170                     if ( $badges_rectangle->star_color ) {
    171                         printf("\t--borderColor: %s;\n", $badges_rectangle->star_color);
    172                     }
    173 
    174                     if ( $badges_rectangle->shadow_hover_color ) {
    175                         printf("\t--shadowColor: %s;\n", $badges_rectangle->shadow_hover_color);
    176                     }
    177                 echo "}\n\n";
    178             }
    179 
    180             if ( $badges_rectangle->shadow == 'no' ) {
    181                 echo ".proofratings-widget.proofratings-widget-rectangle, .proofratings-widget.proofratings-widget-rectangle:hover {\n";
    182                     echo "\t--borderColor: transparent;\n";
    183                     echo "\t--shadowColor: transparent;\n";
    184                 echo "}\n\n";
    185             }
    186         }
    187 
    188         $overall_rectangle = get_proofratings_overall_ratings_rectangle();
    189         if ( $overall_rectangle->customize == 'yes' ) {
    190             echo ".proofratings-badge.proofratings-badge-rectangle {\n";
    191                 if ( $overall_rectangle->star_color ) {
    192                     printf("\t--star_color: %s;\n", $overall_rectangle->star_color);
    193                 }
    194                
    195                 if ( $overall_rectangle->rating_color ) {
    196                     printf("\t--rating_color: %s;\n", $overall_rectangle->rating_color);
    197                 }
    198 
    199                 if ( $overall_rectangle->review_text_color ) {
    200                     printf("\t--review_text_color: %s;\n", $overall_rectangle->review_text_color);
    201                 }
    202 
    203                 if ( $overall_rectangle->review_background ) {
    204                     printf("\t--review_background: %s;\n", $overall_rectangle->review_background);
    205                 }
    206 
    207                 if ( $overall_rectangle->background_color ) {
    208                     printf("\t--background_color: %s;\n", $overall_rectangle->background_color);
    209                 }
    210 
    211                 if ( $overall_rectangle->shadow == 'no') {
    212                     printf("\t--shadow_color: transparent!important;\n");
    213                     printf("\t--shadow_hover: transparent!important;\n");
    214                 } else {
    215                     if ( $overall_rectangle->shadow_color ) {
    216                         printf("\t--shadow_color: %s;\n", $overall_rectangle->shadow_color);
    217                     }
    218                    
    219                     if ( $overall_rectangle->shadow_hover ) {
    220                         printf("\t--shadow_hover: %s;\n", $overall_rectangle->shadow_hover);
    221                     }
    222                 }
    223             echo "}\n\n";
    224 
    225             echo ".proofratings-badge.proofratings-badge-rectangle.badge-float {\n";
    226                 if ( $overall_rectangle->shadow_color ) {
    227                     printf("\t--shadow_color: %s;\n", $overall_rectangle->shadow_color);
    228                 }
    229                
    230                 if ( $overall_rectangle->shadow_hover ) {
    231                     printf("\t--shadow_hover: %s;\n", $overall_rectangle->shadow_hover);
    232                 }
    233             echo "}\n\n";
    234         }
    235 
    236         $overall_narrow = get_proofratings_overall_ratings_narrow();
    237         if ( $overall_narrow->customize == 'yes' ) {
    238             echo ".proofratings-badge.proofratings-badge-narrow {\n";
    239                 if ( $overall_narrow->star_color ) {
    240                     printf("\t--star_color: %s;\n", $overall_narrow->star_color);
    241                 }
    242                
    243                 if ( $overall_narrow->rating_color ) {
    244                     printf("\t--rating_color: %s;\n", $overall_narrow->rating_color);
    245                 }
    246 
    247                 if ( $overall_narrow->review_text_color ) {
    248                     printf("\t--review_text_color: %s;\n", $overall_narrow->review_text_color);
    249                 }
    250 
    251                 if ( $overall_narrow->review_background ) {
    252                     printf("\t--review_background: %s;\n", $overall_narrow->review_background);
    253                 }
    254 
    255                 if ( $overall_narrow->background_color ) {
    256                     printf("\t--background_color: %s;\n", $overall_narrow->background_color);
    257                 }
    258 
    259                 if ( $overall_narrow->shadow == 'no') {
    260                     printf("\t--shadow_color: transparent!important;\n");
    261                     printf("\t--shadow_hover: transparent!important;\n");
    262                 } else {
    263                     if ( $overall_narrow->shadow_color ) {
    264                         printf("\t--shadow_color: %s;\n", $overall_narrow->shadow_color);
    265                     }
    266    
    267                     if ( $overall_narrow->shadow_hover ) {
    268                         printf("\t--shadow_hover: %s;\n", $overall_narrow->shadow_hover);
    269                     }
    270                 }
    271 
    272             echo "}\n\n";
    273 
    274             echo ".proofratings-badge.proofratings-badge-narrow.badge-float {\n";
    275                 if ( $overall_narrow->shadow_color ) {
    276                     printf("\t--shadow_color: %s;\n", $overall_narrow->shadow_color);
    277                 }
    278 
    279                 if ( $overall_narrow->shadow_hover ) {
    280                     printf("\t--shadow_hover: %s;\n", $overall_narrow->shadow_hover);
    281                 }
    282             echo "}\n\n";
    283         }
    284        
    285 
    286         $badges_popup = get_proofratings_badges_popup();
    287         if ( $badges_popup->customize == 'yes' ) {
    288             echo ".proofratings-badges-popup .proofratings-widget {\n";
    289                 if ( $badges_popup->star_color ) {
    290                     printf("\t--themeColor: %s;\n", $badges_popup->star_color);
    291                 }
    292 
    293                 if ( $badges_popup->text_color ) {
    294                     printf("\t--reviewCountTextColor: %s;\n", $badges_popup->reviewCountTextColor);
    295                 }
    296 
    297                 if ( $badges_popup->review_text_background ) {
    298                     printf("\t--review_text_background: %s;\n", $badges_popup->review_text_background);
    299                 }
    300 
    301                 if ( $badges_popup->view_review_color ) {
    302                     printf("\t--view_review_color: %s;\n", $badges_popup->view_review_color);
    303                 }
    304 
    305                 if ( $badges_popup->rating_color ) {
    306                     printf("\t--rating_color: %s;\n", $badges_popup->rating_color);
    307                 }
    308             echo "}\n\n";
    309         }
    310 
    311         $banner_badge = get_proofratings_overall_ratings_cta_banner();
    312 
    313         if ($banner_badge->customize == 'yes' ) {
    314             echo ".proofratings-banner-badge {\n";
    315                 if ( $banner_badge->star_color ) {
    316                     printf("\t--star_color: %s;\n", $banner_badge->star_color);
    317                 }
    318 
    319                 if ( $banner_badge->number_review_text_color ) {
    320                     printf("\t--reviewCountTextcolor: %s;\n", $banner_badge->number_review_text_color);
    321                 }
    322                
    323                 if ( $banner_badge->background_color ) {
    324                     printf("\t--backgroundColor: %s;\n", $banner_badge->background_color);
    325                 }
    326 
    327                 if ( $banner_badge->rating_text_color ) {
    328                     printf("\t--rating_text_color: %s;\n", $banner_badge->rating_text_color);
    329                 }
    330 
    331                 if ( $banner_badge->review_rating_background_color ) {
    332                     printf("\t--review_rating_background_color: %s;\n", $banner_badge->review_rating_background_color);
    333                 }
    334             echo "}\n\n";
    335         }
    336 
    337         echo ".proofratings-banner-badge .proofratings-button.button1 {\n";
    338             if ( $banner_badge->button1_shape == 'round' ) {
    339                 printf("\t--radius: 100px;\n");
    340             }
    341 
    342             if ( $banner_badge->button1_textcolor ) {
    343                 printf("\t--textColor: %s;\n", $banner_badge->button1_textcolor);
    344             }
    345 
    346             if ( $banner_badge->button1_hover_textcolor ) {
    347                 printf("\t--textHoverColor: %s;\n", $banner_badge->button1_hover_textcolor);
    348             }
    349 
    350             if ( $banner_badge->button1_background_color ) {
    351                 printf("\t--backgroundColor: %s;\n", $banner_badge->button1_background_color);
    352             }
    353 
    354             if ( $banner_badge->button1_hover_background_color ) {
    355                 printf("\t--backgroundHoverColor: %s;\n", $banner_badge->button1_hover_background_color);
    356             }
    357 
    358             if ( $banner_badge->button1_border == 'yes' ) {
    359                 if ( $banner_badge->button1_border_color ) {
    360                     printf("\t--borderColor: %s;\n", $banner_badge->button1_border_color);
    361                 }
    362                
    363                 if ( $banner_badge->button1_hover_border_color ) {
    364                     printf("\t--borderHoverColor: %s;\n", $banner_badge->button1_hover_border_color);
    365                 }
    366             }
    367         echo "}\n\n";
    368        
    369         echo ".proofratings-banner-badge .proofratings-button.button2 {\n";
    370             if ( $banner_badge->button2_shape == 'round' ) {
    371                 printf("\t--radius: 100px;\n");
    372             }
    373 
    374             if ( $banner_badge->button2_textcolor ) {
    375                 printf("\t--textColor: %s;\n", $banner_badge->button2_textcolor);
    376             }
    377 
    378             if ( $banner_badge->button2_hover_textcolor ) {
    379                 printf("\t--textHoverColor: %s;\n", $banner_badge->button2_hover_textcolor);
    380             }
    381 
    382             if ( $banner_badge->button2_background_color ) {
    383                 printf("\t--backgroundColor: %s;\n", $banner_badge->button2_background_color);
    384             }
    385 
    386             if ( $banner_badge->button2_hover_background_color ) {
    387                 printf("\t--backgroundHoverColor: %s;\n", $banner_badge->button2_hover_background_color);
    388             }
    389 
    390             if ( $banner_badge->button2_border == 'yes' ) {
    391                 if ( $banner_badge->button2_border_color ) {
    392                     printf("\t--borderColor: %s;\n", $banner_badge->button2_border_color);
    393                 }
    394                
    395                 if ( $banner_badge->button2_hover_border_color ) {
    396                     printf("\t--borderHoverColor: %s;\n", $banner_badge->button2_hover_border_color);
    397                 }
    398             }
    399         echo "}\n\n";
    400        
    401            
    402         $styles = ob_get_clean();
    403 
    404 
    405         file_put_contents(wp_upload_dir()['basedir'] . '/proofratings-generated.css', $styles);
    406     }
    407 
    408     /**
    40975     * Add menu page
    41076     */
    41177    public function admin_menu() {
    412        
    413         $setting_output = 'awaiting';
     78        $proofratings_status = get_proofratings_current_status();
    41479
    415         $proofratings_status = get_proofratings_current_status();
    416         if ( !$proofratings_status || 'not_registered' == $proofratings_status->status) {
    417             $setting_output = 'account_inactive_output';
    418         }
    419        
     80        $main_screen = [$this->settings_page, 'awaiting'];
    42081        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
    421             $setting_output = 'output';
     82            $main_screen = [$this->analytics, 'output'];
    42283        }
    42384
    424         add_menu_page(__('Proofratings', 'proofratings'), __('Proofratings', 'proofratings'), 'manage_options', 'proofratings', [$this->settings_page, $setting_output], 'dashicons-star-filled', 25);
     85        if ( !$proofratings_status || 'not_registered' == $proofratings_status->status) {
     86            $main_screen = [$this->settings_page, 'account_inactive_output'];           
     87        }
     88
     89        if ( $proofratings_status && 'pause' == $proofratings_status->status) {
     90            $main_screen = [$this->settings_page, 'pause'];
     91        }
     92
     93        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
     94            $main_screen = [$this->analytics, 'output'];
     95        }
     96
     97        add_menu_page(__('Proofratings', 'proofratings'), __('Proofratings', 'proofratings'), 'manage_options', 'proofratings', $main_screen, 'dashicons-star-filled', 25);
     98
     99        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
     100            add_submenu_page('proofratings', __('Proofratings Analytics', 'proofratings'), __('Analytics', 'proofratings'), 'manage_options', 'proofratings', [$this->analytics, 'output']);
     101            add_submenu_page('proofratings', __('Proofratings Widgets', 'proofratings'), __('Widgets', 'proofratings'), 'manage_options', 'proofratings-analytics', [$this->settings_page, 'output']);
     102        }
    425103    }
    426104
     
    428106     * Enqueues CSS and JS assets.
    429107     */
    430     public function admin_enqueue_scripts() {   
     108    public function admin_enqueue_scripts() {      
    431109        $screen = get_current_screen();
    432         if ( in_array( $screen->id, [ 'toplevel_page_proofratings' ] ) ) {
     110        if ( in_array( $screen->id, [ 'toplevel_page_proofratings', 'proofratings_page_proofratings-analytics' ] ) ) {
    433111            wp_enqueue_style( 'didact-gothic', 'https://fonts.googleapis.com/css2?family=Didact+Gothic&display=swap', [], PROOFRATINGS_VERSION);
    434112            wp_enqueue_style( 'proofratings-frontend', PROOFRATINGS_PLUGIN_URL . '/assets/css/proofratings.css', ['wp-color-picker'], PROOFRATINGS_VERSION);
  • proofratings/tags/1.0.5/inc/class-proofratings-settings.php

    r2632854 r2633166  
    175175        ?>
    176176        <div class="wrap proofratings-settings-wrap">
    177             <h1 class="wp-heading-inline"><?php _e('Proofratings Settings', 'proofratings') ?></h1>
     177            <h1 class="wp-heading-inline"><?php _e('Proofrating Status', 'proofratings') ?></h1>
    178178            <hr class="wp-header-end">
    179179            <h2 class="nav-tab-wrapper">
     
    186186        </div>
    187187        <?php
    188     }   
     188    }
     189
     190    /**
     191     * Shows the plugin's settings page.
     192     */
     193    public function pause() {
     194        ?>
     195        <div class="wrap proofratings-settings-wrap">
     196            <h1 class="wp-heading-inline"><?php _e('Proofrating Status', 'proofratings') ?></h1>
     197            <hr class="wp-header-end">
     198            <h2 class="nav-tab-wrapper">
     199                <a href="#proofratings-pause-tab" class="nav-tab"><?php _e('Pause', 'proofratings'); ?></a>
     200            </h2>
     201
     202            <div id="proofratings-pause-tab" class="settings_panel">
     203                <h3><?php _e('Your account has been paused', 'proofratings') ?></h3>
     204            </div>
     205        </div>
     206        <?php
     207    }
    189208
    190209    /**
  • proofratings/trunk/assets/css/proofratings-admin.css

    r2622371 r2633166  
    2121    font-size: inherit;
    2222}
     23
     24.proofratings-settings-wrap {padding-left: 20px;}
     25body.proofratings_page_proofratings-analytics .proofratings-settings-wrap {padding-left: 0}
    2326
    2427.proofratings-settings-wrap .shortcode-info {
     
    232235
    233236.proofratings-popup-widgets-box > * {box-sizing: border-box;}
     237
     238body.toplevel_page_proofratings {background-color: #fff}
     239
     240body.toplevel_page_proofratings #wpcontent {padding-left: 0}
     241
     242.proofratings-analytics-wrap {margin: 0; padding: 20px 30px}
     243
     244.analytics-filter {
     245    display: flex;
     246    align-items: center;
     247    padding: 15px 30px;
     248    margin: 0 -30px;
     249    margin-bottom: 20px;
     250    justify-content: space-between;
     251    border-bottom: 1px solid #f3f3f3;
     252}
     253
     254.analytics-filter select, #analytics-date {
     255    line-height: 32px;
     256    height: 34px;
     257    border: 1px solid #8c8f94;
     258    border-radius: 0;
     259    box-sizing: border-box;
     260}
     261
     262#analytics-date {
     263    width: 230px;
     264    padding: 0 15px;
     265    font-size: 14px;
     266    align-items: center;
     267    display: inline-flex;
     268    font-weight: 600;
     269    background-color: #fff;
     270    cursor: pointer;
     271}
     272
     273#analytics-date .dashicons {
     274    margin-left: -10px;
     275    margin-right: 6px;
     276}
     277
     278.analytics-information {
     279    display: grid;
     280    max-width: 600px;
     281    gap: 30px;
     282    grid-template-columns: repeat(3, 1fr)
     283}
     284
     285.analytics-information p {
     286    color: #a8a8a8;
     287    font-size: 14px;
     288}
     289
     290.analytics-information .name {
     291    margin: 0;
     292    font-size: 16px;
     293}
     294
     295.analytics-information .name + p {margin-top: 5px;}
     296
     297.analytics-information .counter {
     298    font-size: 36px;
     299    font-weight: bold;
     300    display: block;
     301    margin: 8px 0 20px;
     302    line-height: 1;
     303    position: relative;
     304}
     305
     306.analytics-information .counter:before {
     307    content: "";
     308    display: block;
     309    height: 8px;
     310    width: 72px;
     311    margin-bottom: 19px;
     312    border-radius: 40px;
     313    background-color: #fdbe91;
     314}
     315
     316.analytics-information .impressions .counter:before {
     317    background-color: #4123FF;
     318}
     319
     320.analytics-information .engagements .counter:before {visibility: hidden;}
     321
     322#analytics-chart {
     323    margin-top: 30px;
     324}
  • proofratings/trunk/assets/js/proofratings.js

    r2632853 r2633166  
    4747    })
    4848
    49     if ( $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge').length ) {
     49    const proofratings_items = $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge');
     50    if ( proofratings_items.length ) {
    5051        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'impression'})
    5152    }
    5253
    53     $('.proofratings-widget, .proofratings-badge, .proofratings-banner-badge').on('click', function(){
     54    proofratings_items.on('click', function(){
    5455        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'click'})
    5556    })
    5657
     58    proofratings_items.on('mouseenter', function(){
     59        $.post(proofratings.api + '/stats', {site_url: proofratings.site_url, type: 'engagement'})
     60    })
    5761
    5862})(jQuery)
  • proofratings/trunk/assets/js/redux.min.js

    r2622371 r2633166  
    1 !function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e="function"==typeof Symbol&&Symbol.observable||"@@observable",n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){return t(r.apply(this,arguments))}}function u(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function p(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?c(Object(e),!0).forEach((function(t){u(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):c(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(){var n=r.apply(void 0,arguments),o=function(){throw Error(t(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},f=e.map((function(r){return r(i)}));return o=a.apply(void 0,f)(n.dispatch),p(p({},n),{},{dispatch:o})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function b(){if(s)throw Error(t(3));return a}function h(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));p=r,v({type:o.REPLACE})}function E(){var r,n=h;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(b())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}return v({type:o.INIT}),(c={dispatch:v,subscribe:h,getState:b,replaceReducer:O})[e]=E,c},Object.defineProperty(r,"__esModule",{value:!0})}));
     1!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self).Redux={})}(this,(function(r){"use strict";function t(r){return"Minified Redux error #"+r+"; visit https://redux.js.org/Errors?code="+r+" for the full message or use the non-minified dev environment for full errors. "}var e=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}(),n=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+n(),REPLACE:"@@redux/REPLACE"+n(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+n()}};function i(r){if("object"!=typeof r||null===r)return!1;for(var t=r;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t}function f(r,t){return function(){for(var e=arguments.length,n=Array(e),o=0;e>o;o++)n[o]=arguments[o];return t(r.apply(this,n))}}function u(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function c(r){for(var t=1;arguments.length>t;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?u(Object(e),!0).forEach((function(t){p(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}function p(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function a(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return 0===t.length?function(r){return r}:1===t.length?t[0]:t.reduce((function(r,t){return function(){return r(t.apply(void 0,arguments))}}))}r.__DO_NOT_USE__ActionTypes=o,r.applyMiddleware=function(){for(var r=arguments.length,e=Array(r),n=0;r>n;n++)e[n]=arguments[n];return function(r){return function(n,o){var i=r(n,o),f=function(){throw Error(t(15))},u={getState:i.getState,dispatch:function(r){for(var t=arguments.length,e=Array(t>1?t-1:0),n=1;t>n;n++)e[n-1]=arguments[n];return f.apply(void 0,[r].concat(e))}},p=e.map((function(r){return r(u)}));return f=a.apply(void 0,p)(i.dispatch),c(c({},i),{},{dispatch:f})}}},r.bindActionCreators=function(r,e){if("function"==typeof r)return f(r,e);if("object"!=typeof r||null===r)throw Error(t(16));var n={};for(var o in r){var i=r[o];"function"==typeof i&&(n[o]=f(i,e))}return n},r.combineReducers=function(r){for(var e=Object.keys(r),n={},i=0;e.length>i;i++){var f=e[i];"function"==typeof r[f]&&(n[f]=r[f])}var u,c=Object.keys(n);try{!function(r){Object.keys(r).forEach((function(e){var n=r[e];if(void 0===n(void 0,{type:o.INIT}))throw Error(t(12));if(void 0===n(void 0,{type:o.PROBE_UNKNOWN_ACTION()}))throw Error(t(13))}))}(n)}catch(r){u=r}return function(r,e){if(void 0===r&&(r={}),u)throw u;for(var o=!1,i={},f=0;c.length>f;f++){var p=c[f],a=r[p],l=(0,n[p])(a,e);if(void 0===l)throw Error(t(14));i[p]=l,o=o||l!==a}return(o=o||c.length!==Object.keys(r).length)?i:r}},r.compose=a,r.createStore=function r(n,f,u){var c;if("function"==typeof f&&"function"==typeof u||"function"==typeof u&&"function"==typeof arguments[3])throw Error(t(0));if("function"==typeof f&&void 0===u&&(u=f,f=void 0),void 0!==u){if("function"!=typeof u)throw Error(t(1));return u(r)(n,f)}if("function"!=typeof n)throw Error(t(2));var p=n,a=f,l=[],y=l,s=!1;function d(){y===l&&(y=l.slice())}function h(){if(s)throw Error(t(3));return a}function b(r){if("function"!=typeof r)throw Error(t(4));if(s)throw Error(t(5));var e=!0;return d(),y.push(r),function(){if(e){if(s)throw Error(t(6));e=!1,d();var n=y.indexOf(r);y.splice(n,1),l=null}}}function v(r){if(!i(r))throw Error(t(7));if(void 0===r.type)throw Error(t(8));if(s)throw Error(t(9));try{s=!0,a=p(a,r)}finally{s=!1}for(var e=l=y,n=0;e.length>n;n++){(0,e[n])()}return r}function O(r){if("function"!=typeof r)throw Error(t(10));return p=r,v({type:o.REPLACE}),E}function g(){var r,n=b;return(r={subscribe:function(r){if("object"!=typeof r||null===r)throw Error(t(11));function e(){r.next&&r.next(h())}return e(),{unsubscribe:n(e)}}})[e]=function(){return this},r}v({type:o.INIT});var E=((c={dispatch:v,subscribe:b,getState:h,replaceReducer:O})[e]=g,c);return E},Object.defineProperty(r,"__esModule",{value:!0})}));
  • proofratings/trunk/inc/class-proofratings-admin.php

    r2629279 r2633166  
    4343     */
    4444    public function __construct() {
     45        include_once dirname( __FILE__ ) . '/class-proofratings-generate-style.php';
    4546        include_once dirname( __FILE__ ) . '/class-proofratings-settings.php';
     47
    4648        $this->settings_page = WP_ProofRatings_Settings::instance();
     49        $this->analytics = include_once dirname( __FILE__ ) . '/class-proofratings-analytics.php';
    4750       
    4851        add_action( 'init', [$this, 'register_your_domain']);
    4952        add_action( 'admin_menu', [ $this, 'admin_menu' ] );
    5053        add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
    51         add_action( "updated_option", [ $this, 'generate_css' ], 10, 3 );
    5254    }
    5355
     
    7173
    7274    /**
    73      * Generate styles
    74      */
    75     public function generate_css($old_value, $value, $option) {
    76         if ( !isset($_POST['option_page']) || 'proofratings' != $_POST['option_page'] ) {
    77             return;
    78         }
    79 
    80         $postdata = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
    81        
    82         $widget_settings = wp_parse_args($postdata['proofratings_widget_settings'], [
    83             'proofratings_font' => 'inherit',
    84         ]);
    85        
    86         ob_start();
    87 
    88         if ( $widget_settings['proofratings_font'] ) {
    89             echo ":root {\n";
    90                 printf("\t--proofratingsFont: %s;\n", $widget_settings['proofratings_font']);
    91             echo "}\n\n";
    92         }
    93 
    94         $badges_square = get_proofratings_badges_square();
    95         if ( $badges_square->customize == 'yes' ) {
    96             echo ".proofratings-widget.proofratings-widget-square {\n";
    97                 if ( $badges_square->star_color ) {
    98                     printf("\t--themeColor: %s;\n", $badges_square->star_color);
    99                 }
    100 
    101                 if ( $badges_square->text_color ) {
    102                     printf("\t--textColor: %s;\n", $badges_square->text_color);
    103                 }
    104 
    105                 if ( $badges_square->background ) {
    106                     printf("\tbackground-color: %s;\n", $badges_square->background);
    107                 }
    108 
    109                 if ( $badges_square->shadow == 'yes' ) {                   
    110                     if ( $badges_square->shadow_color ) {
    111                         printf("\t--shadowColor: %s;\n", $badges_square->shadow_color);
    112                     }
    113                 }
    114 
    115             echo "}\n\n";
    116 
    117             if ( $badges_square->shadow == 'yes' ) {
    118                 echo ".proofratings-widget.proofratings-widget-square:hover {\n";
    119                     if ( $badges_square->star_color ) {
    120                         printf("\t--borderColor: %s;\n", $badges_square->star_color);
    121                     }
    122 
    123                     if ( $badges_square->shadow_hover_color ) {
    124                         printf("\t--shadowColor: %s;\n", $badges_square->shadow_hover_color);
    125                     }
    126                 echo "}\n\n";
    127             }
    128 
    129             if ( $badges_square->shadow == 'no' ) {
    130                 echo ".proofratings-widget.proofratings-widget-square, .proofratings-widget.proofratings-widget-square:hover {\n";
    131                     echo "\t--borderColor: transparent;\n";
    132                     echo "\t--shadowColor: transparent;\n";
    133                 echo "}\n\n";
    134             }
    135         }
    136 
    137         $badges_rectangle = get_proofratings_badges_rectangle();
    138         if ( $badges_rectangle->customize == 'yes' ) {
    139             echo ".proofratings-widget.proofratings-widget-rectangle {\n";
    140                 if ( $badges_rectangle->star_color ) {
    141                     printf("\t--themeColor: %s;\n", $badges_rectangle->star_color);
    142                 }
    143 
    144                 if ( $badges_rectangle->icon_color ) {
    145                     printf("\t--iconColor: %s;\n", $badges_rectangle->icon_color);
    146                 }
    147 
    148                 if ( $badges_rectangle->text_color ) {
    149                     printf("\t--textColor: %s;\n", $badges_rectangle->text_color);
    150                 }
    151 
    152                 if ( $badges_rectangle->review_count_textcolor ) {
    153                     printf("\t--reviewCountTextColor: %s;\n", $badges_rectangle->review_count_textcolor);
    154                 }
    155 
    156                 if ( $badges_rectangle->background ) {
    157                     printf("\tbackground-color: %s;\n", $badges_rectangle->background);
    158                 }
    159 
    160                 if ( $badges_rectangle->shadow == 'yes' ) {                 
    161                     if ( $badges_rectangle->shadow_color ) {
    162                         printf("\t--shadowColor: %s;\n", $badges_rectangle->shadow_color);
    163                     }
    164                 }
    165 
    166             echo "}\n\n";
    167 
    168             if ( $badges_rectangle->shadow == 'yes' ) {
    169                 echo ".proofratings-widget.proofratings-widget-rectangle:hover {\n";
    170                     if ( $badges_rectangle->star_color ) {
    171                         printf("\t--borderColor: %s;\n", $badges_rectangle->star_color);
    172                     }
    173 
    174                     if ( $badges_rectangle->shadow_hover_color ) {
    175                         printf("\t--shadowColor: %s;\n", $badges_rectangle->shadow_hover_color);
    176                     }
    177                 echo "}\n\n";
    178             }
    179 
    180             if ( $badges_rectangle->shadow == 'no' ) {
    181                 echo ".proofratings-widget.proofratings-widget-rectangle, .proofratings-widget.proofratings-widget-rectangle:hover {\n";
    182                     echo "\t--borderColor: transparent;\n";
    183                     echo "\t--shadowColor: transparent;\n";
    184                 echo "}\n\n";
    185             }
    186         }
    187 
    188         $overall_rectangle = get_proofratings_overall_ratings_rectangle();
    189         if ( $overall_rectangle->customize == 'yes' ) {
    190             echo ".proofratings-badge.proofratings-badge-rectangle {\n";
    191                 if ( $overall_rectangle->star_color ) {
    192                     printf("\t--star_color: %s;\n", $overall_rectangle->star_color);
    193                 }
    194                
    195                 if ( $overall_rectangle->rating_color ) {
    196                     printf("\t--rating_color: %s;\n", $overall_rectangle->rating_color);
    197                 }
    198 
    199                 if ( $overall_rectangle->review_text_color ) {
    200                     printf("\t--review_text_color: %s;\n", $overall_rectangle->review_text_color);
    201                 }
    202 
    203                 if ( $overall_rectangle->review_background ) {
    204                     printf("\t--review_background: %s;\n", $overall_rectangle->review_background);
    205                 }
    206 
    207                 if ( $overall_rectangle->background_color ) {
    208                     printf("\t--background_color: %s;\n", $overall_rectangle->background_color);
    209                 }
    210 
    211                 if ( $overall_rectangle->shadow == 'no') {
    212                     printf("\t--shadow_color: transparent!important;\n");
    213                     printf("\t--shadow_hover: transparent!important;\n");
    214                 } else {
    215                     if ( $overall_rectangle->shadow_color ) {
    216                         printf("\t--shadow_color: %s;\n", $overall_rectangle->shadow_color);
    217                     }
    218                    
    219                     if ( $overall_rectangle->shadow_hover ) {
    220                         printf("\t--shadow_hover: %s;\n", $overall_rectangle->shadow_hover);
    221                     }
    222                 }
    223             echo "}\n\n";
    224 
    225             echo ".proofratings-badge.proofratings-badge-rectangle.badge-float {\n";
    226                 if ( $overall_rectangle->shadow_color ) {
    227                     printf("\t--shadow_color: %s;\n", $overall_rectangle->shadow_color);
    228                 }
    229                
    230                 if ( $overall_rectangle->shadow_hover ) {
    231                     printf("\t--shadow_hover: %s;\n", $overall_rectangle->shadow_hover);
    232                 }
    233             echo "}\n\n";
    234         }
    235 
    236         $overall_narrow = get_proofratings_overall_ratings_narrow();
    237         if ( $overall_narrow->customize == 'yes' ) {
    238             echo ".proofratings-badge.proofratings-badge-narrow {\n";
    239                 if ( $overall_narrow->star_color ) {
    240                     printf("\t--star_color: %s;\n", $overall_narrow->star_color);
    241                 }
    242                
    243                 if ( $overall_narrow->rating_color ) {
    244                     printf("\t--rating_color: %s;\n", $overall_narrow->rating_color);
    245                 }
    246 
    247                 if ( $overall_narrow->review_text_color ) {
    248                     printf("\t--review_text_color: %s;\n", $overall_narrow->review_text_color);
    249                 }
    250 
    251                 if ( $overall_narrow->review_background ) {
    252                     printf("\t--review_background: %s;\n", $overall_narrow->review_background);
    253                 }
    254 
    255                 if ( $overall_narrow->background_color ) {
    256                     printf("\t--background_color: %s;\n", $overall_narrow->background_color);
    257                 }
    258 
    259                 if ( $overall_narrow->shadow == 'no') {
    260                     printf("\t--shadow_color: transparent!important;\n");
    261                     printf("\t--shadow_hover: transparent!important;\n");
    262                 } else {
    263                     if ( $overall_narrow->shadow_color ) {
    264                         printf("\t--shadow_color: %s;\n", $overall_narrow->shadow_color);
    265                     }
    266    
    267                     if ( $overall_narrow->shadow_hover ) {
    268                         printf("\t--shadow_hover: %s;\n", $overall_narrow->shadow_hover);
    269                     }
    270                 }
    271 
    272             echo "}\n\n";
    273 
    274             echo ".proofratings-badge.proofratings-badge-narrow.badge-float {\n";
    275                 if ( $overall_narrow->shadow_color ) {
    276                     printf("\t--shadow_color: %s;\n", $overall_narrow->shadow_color);
    277                 }
    278 
    279                 if ( $overall_narrow->shadow_hover ) {
    280                     printf("\t--shadow_hover: %s;\n", $overall_narrow->shadow_hover);
    281                 }
    282             echo "}\n\n";
    283         }
    284        
    285 
    286         $badges_popup = get_proofratings_badges_popup();
    287         if ( $badges_popup->customize == 'yes' ) {
    288             echo ".proofratings-badges-popup .proofratings-widget {\n";
    289                 if ( $badges_popup->star_color ) {
    290                     printf("\t--themeColor: %s;\n", $badges_popup->star_color);
    291                 }
    292 
    293                 if ( $badges_popup->text_color ) {
    294                     printf("\t--reviewCountTextColor: %s;\n", $badges_popup->reviewCountTextColor);
    295                 }
    296 
    297                 if ( $badges_popup->review_text_background ) {
    298                     printf("\t--review_text_background: %s;\n", $badges_popup->review_text_background);
    299                 }
    300 
    301                 if ( $badges_popup->view_review_color ) {
    302                     printf("\t--view_review_color: %s;\n", $badges_popup->view_review_color);
    303                 }
    304 
    305                 if ( $badges_popup->rating_color ) {
    306                     printf("\t--rating_color: %s;\n", $badges_popup->rating_color);
    307                 }
    308             echo "}\n\n";
    309         }
    310 
    311         $banner_badge = get_proofratings_overall_ratings_cta_banner();
    312 
    313         if ($banner_badge->customize == 'yes' ) {
    314             echo ".proofratings-banner-badge {\n";
    315                 if ( $banner_badge->star_color ) {
    316                     printf("\t--star_color: %s;\n", $banner_badge->star_color);
    317                 }
    318 
    319                 if ( $banner_badge->number_review_text_color ) {
    320                     printf("\t--reviewCountTextcolor: %s;\n", $banner_badge->number_review_text_color);
    321                 }
    322                
    323                 if ( $banner_badge->background_color ) {
    324                     printf("\t--backgroundColor: %s;\n", $banner_badge->background_color);
    325                 }
    326 
    327                 if ( $banner_badge->rating_text_color ) {
    328                     printf("\t--rating_text_color: %s;\n", $banner_badge->rating_text_color);
    329                 }
    330 
    331                 if ( $banner_badge->review_rating_background_color ) {
    332                     printf("\t--review_rating_background_color: %s;\n", $banner_badge->review_rating_background_color);
    333                 }
    334             echo "}\n\n";
    335         }
    336 
    337         echo ".proofratings-banner-badge .proofratings-button.button1 {\n";
    338             if ( $banner_badge->button1_shape == 'round' ) {
    339                 printf("\t--radius: 100px;\n");
    340             }
    341 
    342             if ( $banner_badge->button1_textcolor ) {
    343                 printf("\t--textColor: %s;\n", $banner_badge->button1_textcolor);
    344             }
    345 
    346             if ( $banner_badge->button1_hover_textcolor ) {
    347                 printf("\t--textHoverColor: %s;\n", $banner_badge->button1_hover_textcolor);
    348             }
    349 
    350             if ( $banner_badge->button1_background_color ) {
    351                 printf("\t--backgroundColor: %s;\n", $banner_badge->button1_background_color);
    352             }
    353 
    354             if ( $banner_badge->button1_hover_background_color ) {
    355                 printf("\t--backgroundHoverColor: %s;\n", $banner_badge->button1_hover_background_color);
    356             }
    357 
    358             if ( $banner_badge->button1_border == 'yes' ) {
    359                 if ( $banner_badge->button1_border_color ) {
    360                     printf("\t--borderColor: %s;\n", $banner_badge->button1_border_color);
    361                 }
    362                
    363                 if ( $banner_badge->button1_hover_border_color ) {
    364                     printf("\t--borderHoverColor: %s;\n", $banner_badge->button1_hover_border_color);
    365                 }
    366             }
    367         echo "}\n\n";
    368        
    369         echo ".proofratings-banner-badge .proofratings-button.button2 {\n";
    370             if ( $banner_badge->button2_shape == 'round' ) {
    371                 printf("\t--radius: 100px;\n");
    372             }
    373 
    374             if ( $banner_badge->button2_textcolor ) {
    375                 printf("\t--textColor: %s;\n", $banner_badge->button2_textcolor);
    376             }
    377 
    378             if ( $banner_badge->button2_hover_textcolor ) {
    379                 printf("\t--textHoverColor: %s;\n", $banner_badge->button2_hover_textcolor);
    380             }
    381 
    382             if ( $banner_badge->button2_background_color ) {
    383                 printf("\t--backgroundColor: %s;\n", $banner_badge->button2_background_color);
    384             }
    385 
    386             if ( $banner_badge->button2_hover_background_color ) {
    387                 printf("\t--backgroundHoverColor: %s;\n", $banner_badge->button2_hover_background_color);
    388             }
    389 
    390             if ( $banner_badge->button2_border == 'yes' ) {
    391                 if ( $banner_badge->button2_border_color ) {
    392                     printf("\t--borderColor: %s;\n", $banner_badge->button2_border_color);
    393                 }
    394                
    395                 if ( $banner_badge->button2_hover_border_color ) {
    396                     printf("\t--borderHoverColor: %s;\n", $banner_badge->button2_hover_border_color);
    397                 }
    398             }
    399         echo "}\n\n";
    400        
    401            
    402         $styles = ob_get_clean();
    403 
    404 
    405         file_put_contents(wp_upload_dir()['basedir'] . '/proofratings-generated.css', $styles);
    406     }
    407 
    408     /**
    40975     * Add menu page
    41076     */
    41177    public function admin_menu() {
    412        
    413         $setting_output = 'awaiting';
     78        $proofratings_status = get_proofratings_current_status();
    41479
    415         $proofratings_status = get_proofratings_current_status();
    416         if ( !$proofratings_status || 'not_registered' == $proofratings_status->status) {
    417             $setting_output = 'account_inactive_output';
    418         }
    419        
     80        $main_screen = [$this->settings_page, 'awaiting'];
    42081        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
    421             $setting_output = 'output';
     82            $main_screen = [$this->analytics, 'output'];
    42283        }
    42384
    424         add_menu_page(__('Proofratings', 'proofratings'), __('Proofratings', 'proofratings'), 'manage_options', 'proofratings', [$this->settings_page, $setting_output], 'dashicons-star-filled', 25);
     85        if ( !$proofratings_status || 'not_registered' == $proofratings_status->status) {
     86            $main_screen = [$this->settings_page, 'account_inactive_output'];           
     87        }
     88
     89        if ( $proofratings_status && 'pause' == $proofratings_status->status) {
     90            $main_screen = [$this->settings_page, 'pause'];
     91        }
     92
     93        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
     94            $main_screen = [$this->analytics, 'output'];
     95        }
     96
     97        add_menu_page(__('Proofratings', 'proofratings'), __('Proofratings', 'proofratings'), 'manage_options', 'proofratings', $main_screen, 'dashicons-star-filled', 25);
     98
     99        if (isset($proofratings_status->status) && $proofratings_status->status == 'active' ) {
     100            add_submenu_page('proofratings', __('Proofratings Analytics', 'proofratings'), __('Analytics', 'proofratings'), 'manage_options', 'proofratings', [$this->analytics, 'output']);
     101            add_submenu_page('proofratings', __('Proofratings Widgets', 'proofratings'), __('Widgets', 'proofratings'), 'manage_options', 'proofratings-analytics', [$this->settings_page, 'output']);
     102        }
    425103    }
    426104
     
    428106     * Enqueues CSS and JS assets.
    429107     */
    430     public function admin_enqueue_scripts() {   
     108    public function admin_enqueue_scripts() {      
    431109        $screen = get_current_screen();
    432         if ( in_array( $screen->id, [ 'toplevel_page_proofratings' ] ) ) {
     110        if ( in_array( $screen->id, [ 'toplevel_page_proofratings', 'proofratings_page_proofratings-analytics' ] ) ) {
    433111            wp_enqueue_style( 'didact-gothic', 'https://fonts.googleapis.com/css2?family=Didact+Gothic&display=swap', [], PROOFRATINGS_VERSION);
    434112            wp_enqueue_style( 'proofratings-frontend', PROOFRATINGS_PLUGIN_URL . '/assets/css/proofratings.css', ['wp-color-picker'], PROOFRATINGS_VERSION);
  • proofratings/trunk/inc/class-proofratings-settings.php

    r2632433 r2633166  
    175175        ?>
    176176        <div class="wrap proofratings-settings-wrap">
    177             <h1 class="wp-heading-inline"><?php _e('Proofratings Settings', 'proofratings') ?></h1>
     177            <h1 class="wp-heading-inline"><?php _e('Proofrating Status', 'proofratings') ?></h1>
    178178            <hr class="wp-header-end">
    179179            <h2 class="nav-tab-wrapper">
     
    186186        </div>
    187187        <?php
    188     }   
     188    }
     189
     190    /**
     191     * Shows the plugin's settings page.
     192     */
     193    public function pause() {
     194        ?>
     195        <div class="wrap proofratings-settings-wrap">
     196            <h1 class="wp-heading-inline"><?php _e('Proofrating Status', 'proofratings') ?></h1>
     197            <hr class="wp-header-end">
     198            <h2 class="nav-tab-wrapper">
     199                <a href="#proofratings-pause-tab" class="nav-tab"><?php _e('Pause', 'proofratings'); ?></a>
     200            </h2>
     201
     202            <div id="proofratings-pause-tab" class="settings_panel">
     203                <h3><?php _e('Your account has been paused', 'proofratings') ?></h3>
     204            </div>
     205        </div>
     206        <?php
     207    }
    189208
    190209    /**
Note: See TracChangeset for help on using the changeset viewer.