Plugin Directory

Changeset 1472151


Ignore:
Timestamp:
08/11/2016 09:48:15 AM (10 years ago)
Author:
VortexThemes
Message:

2.7.6 RELEASE

Location:
rating-system
Files:
153 added
3 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • rating-system/trunk/Changelog.md

    r1298069 r1472151  
     1## [2.7.6]
     2### Fixed ip and cookie tracking.
     3### Fixed custom text when voting.
     4### Removed ReduxFramework.
     5### Removed some options.
    16## [2.7.3]
    27### Fixed Custom text being displayed when cancelling vote.
  • rating-system/trunk/admin/vortexlikedislike.php

    r1338933 r1472151  
    11<?php
    22
    3     if ( ! class_exists( 'Redux' ) ) {
     3    if ( ! class_exists( 'Sse' ) ) {
    44        return;
    55    }
     
    1212   
    1313    $args = array(
    14         // TYPICAL -> Change these values as you need/desire
    15         'opt_name'             => $opt_name,
    16         // This is where your data is stored in the database and also becomes your global variable name.
    17         'display_name'         => 'Rating System',
    18         // Name that appears at the top of your panel
    19         'display_version'      => '2.7.5',
    20         // Version that appears at the top of your panel
    21         'menu_type'            => 'menu',
    22         //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)
    23         'allow_sub_menu'       => true,
    24         // Show the sections below the admin menu item or not
    25         'menu_title'           => __( 'Rating System', $domain ),
    26         'page_title'           => __( 'Rating System', $domain),
    27         // You will need to generate a Google API key to use this feature.
    28         // Please visit: https://developers.google.com/fonts/docs/developer_api#Auth
    29         'google_api_key'       => '',
    30         // Set it you want google fonts to update weekly. A google_api_key value is required.
    31         'google_update_weekly' => false,
    32         // Must be defined to add google fonts to the typography module
    33         'async_typography'     => true,
    34         // Use a asynchronous font on the front end or font string
    35         //'disable_google_fonts_link' => true,                    // Disable this in case you want to create your own google fonts loader
    36         'admin_bar'            => false,
    37         // Show the panel pages on the admin bar
    38         'admin_bar_icon'       => 'dashicons-portfolio',
    39         // Choose an icon for the admin bar menu
    40         'admin_bar_priority'   => 50,
    41         // Choose an priority for the admin bar menu
    42         'global_variable'      => '',
    43         // Set a different name for your global variable other than the opt_name
    44         'dev_mode'             => false,
    45         // Show the time the page took to load, etc
    46         'update_notice'        => false,
    47         // If dev_mode is enabled, will notify developer of updated versions available in the GitHub Repo
    48         'customizer'           => false,
    49         // Enable basic customizer support
    50         //'open_expanded'     => true,                    // Allow you to start the panel in an expanded way initially.
    51         //'disable_save_warn' => true,                    // Disable the save warning when a user changes a field
    52 
    53         // OPTIONAL -> Give you extra features
    54         'page_priority'        => null,
    55         // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
    56         'page_parent'          => 'themes.php',
    57         // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
    58         'page_permissions'     => 'manage_options',
    59         // Permissions needed to access the options panel.
    60         'menu_icon'            => '',
    61         // Specify a custom URL to an icon
    62         'last_tab'             => '',
    63         // Force your panel to always open to a specific tab (by id)
    64         'page_icon'            => 'icon-themes',
    65         // Icon displayed in the admin panel next to your menu_title
    66         'page_slug'            => 'rating_system_options',
    67         // Page slug used to denote the panel
    68         'save_defaults'        => true,
    69         // On load save the defaults to DB before user clicks save or not
    70         'default_show'         => false,
    71         // If true, shows the default value next to each field that is not the default value.
    72         'default_mark'         => '',
    73         // What to print by the field's title if the value shown is default. Suggested: *
    74         'show_import_export'   => false,
    75         'forced_dev_mode_off'   => false,
    76         // Shows the Import/Export panel when not used as a field.
    77 
    78         // CAREFUL -> These options are for advanced use only
    79         'transient_time'       => 60 * MINUTE_IN_SECONDS,
    80         'output'               => true,
    81         // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
    82         'output_tag'           => true,
    83         // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
    84         // 'footer_credit'     => '',                   // Disable the footer credit of Redux. Please leave if you can help it.
    85 
    86         // FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
    87         'database'             => '',
    88         // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
    89 
    90         'use_cdn'              => true,
    91         // If you prefer not to use the CDN for Select2, Ace Editor, and others, you may download the Redux Vendor Support plugin yourself and run locally or embed it in your code.
    92 
    93         //'compiler'             => true,
    94 
    95         // HINTS
    96         'hints'                => array(
    97             'icon'          => 'el el-question-sign',
    98             'icon_position' => 'right',
    99             'icon_color'    => 'lightgray',
    100             'icon_size'     => 'normal',
    101             'tip_style'     => array(
    102                 'color'   => 'light',
    103                 'shadow'  => true,
    104                 'rounded' => false,
    105                 'style'   => '',
    106             ),
    107             'tip_position'  => array(
    108                 'my' => 'top left',
    109                 'at' => 'bottom right',
    110             ),
    111             'tip_effect'    => array(
    112                 'show' => array(
    113                     'effect'   => 'slide',
    114                     'duration' => '500',
    115                     'event'    => 'mouseover',
    116                 ),
    117                 'hide' => array(
    118                     'effect'   => 'slide',
    119                     'duration' => '500',
    120                     'event'    => 'click mouseleave',
    121                 ),
    122             ),
    123         )
     14        "page-title"=>"Rating System",
     15        "menu-title"=>"Rating System",
     16        "capability"=>'manage_options',
     17        "menu-slug"=>$opt_name,
     18        "icon"=>"dashicons-admin-generic",
     19        "position"=>"81" // set your owm possition
    12420    );
    125 
    126     // SOCIAL ICONS -> Setup custom links in the footer for quick links in your panel footer icons.
    127     $args['share_icons'][] = array(
    128         'url'   => 'https://github.com/AlexAlexandru/rating-system',
    129         'title' => 'Visit us on GitHub',
    130         'icon'  => 'el el-github'
    131         //'img'   => '', // You can use icon OR img. IMG needs to be a full URL.
    132     );
    133 
    134     if ( ! isset( $args['global_variable'] ) || $args['global_variable'] !== false ) {
    135         if ( ! empty( $args['global_variable'] ) ) {
    136             $v = $args['global_variable'];
    137         } else {
    138             $v = str_replace( '-', '_', $args['opt_name'] );
    139         }
    140         $args['intro_text'] = '';
    141     } else {
    142         $args['intro_text'] = '';
    143     }
    144 
    145     // Add content after the form.
    146     $args['footer_text'] = '';
    147 
    148     Redux::setArgs( $opt_name, $args );
    149 
     21   
     22    Sse::setArgs($opt_name,$args);
     23   
    15024    // -> START Basic Fields
    151     Redux::setSection( $opt_name, array(
     25    Sse::setSection( $opt_name, array(
    15226        'title'  => __( 'Settings for posts and pages', $domain ),
    15327        'id'     => 'basic',
     
    293167            'subtitle' => __('Turn on this if you want like button only.',$domain),
    294168            'default'  => false,
    295             )/*,array(
    296             'id'       => 'v-switch-tooltip',
    297             'type'     => 'switch',
    298             'required' => array('v-switch-posts','equals','1'),
    299             'title'    => __('Enable tooltips', $domain),
    300             'default'  => false,
    301             )*/,array(
     169            ),array(
    302170            'id'       => 'v-switch-anon',
    303171            'type'     => 'switch',
     
    316184            ),array(
    317185                'id'          => 'vortex-buttons-size',
    318                 'type'        => 'typography',
     186                'type'        => 'number',
    319187                'required' => array('v-switch-posts','equals','1'),
    320188                'title'       => __('Buttons size', $domain),
    321                 'google'      => false,
    322                 'font-backup' => false,
    323                 'font-size'   => true,
    324                 'text-align'  => false,
    325                 'font-weight' => false,
    326                 'line-height' => false,
    327                 'font-style'  => false,
    328                 'font-family' => false,
    329                 'color'       => false,
    330                 'output'      => array('.vortex-container-like , .vortex-container-dislike'),
    331                 'units'       =>'px',
    332                 'subtitle'    => __('Here you can change the buttons size with a preview.', $domain),
    333                 'default'     => array(
    334                     'font-size'   => '16px',
    335                 ),
    336                 'preview'     => array(
    337                      'text'      => __('The buttons will have the same size as this text.You can use this as a preview for the size.',$domain),
    338                 )
     189                'subtitle'    => __('Here you can change the buttons size in pixels(px).', $domain),
     190                'default'     => "16",
    339191            ),array(
    340192                'id'       => 'v_default_color',
    341193                'type'     => 'color',
    342194                'required' => array('v-switch-posts','equals','1'),
    343                 'output'   => array('.vortex-p-like, .vortex-p-dislike'),
    344195                'title'    => __('Default color', $domain),
    345196                'subtitle' => __('Default color of buttons', $domain),
    346                 'validate' => 'color',
    347197                'default'  => '#828384',
    348198            ),array(
     
    351201                'required' => array('v-switch-posts','equals','1'),
    352202                'title'    => __('Like button ',$domain),
    353                 'output'   => array('.vortex-p-like:hover'),
    354203                'subtitle' => __('Like button mouse over color', $domain),
    355                 'validate' => 'color',
    356204                'default'  => '#4898D6',
    357205            ),array(
     
    359207                'type'     => 'color',
    360208                'required' => array('v-switch-posts','equals','1'),
    361                 'output'   => array('.vortex-p-like-active'),
    362209                'title'    => __('Like button ', $domain),
    363210                'subtitle' => __('Like button active color', $domain),
    364                 'validate' => 'color',
    365211                'default'  => '#1B7FCC',
    366212            ),array(
     
    368214                'type'     => 'color',
    369215                'required' => array('v-switch-posts','equals','1'),
    370                 'output'   => array('.vortex-p-dislike:hover'),
    371216                'title'    => __('Dislike button ', $domain),
    372217                'subtitle' => __('Dislike button mouse over color', $domain),
    373                 'validate' => 'color',
    374218                'default'  => '#0a0101',
    375219            ),array(
     
    377221                'type'     => 'color',
    378222                'required' => array('v-switch-posts','equals','1'),
    379                 'output'   => array('.vortex-p-dislike-active'),
    380223                'title'    => __('Dislike button ', $domain),
    381224                'subtitle' => __('Dislike button active color', $domain),
    382                 'validate' => 'color',
    383225                'default'  => '#0a0101',
    384226            ),array(
     
    400242            'data'     => 'post_types',
    401243            ),array(
    402                 'id'       => 'v_start_post_like',
    403                 'type'     => 'text',
    404                 'required' => array('v-switch-posts','equals','1'),
    405                 'title'    => __('Number of likes by default', $domain),
    406                 'subtitle' => __('Number of likes by default to new post.', $domain),
    407                 'validate' => 'numeric',
    408                 'default'  => '0'
    409             ),array(
    410                 'id'       => 'v_start_post_dislike',
    411                 'type'     => 'text',
    412                 'required' => array('v-switch-posts','equals','1'),
    413                 'title'    => __('Number of dislikes by default', $domain),
    414                 'subtitle' => __('Number of dislikes by default to new post.', $domain),
    415                 'validate' => 'numeric',
    416                 'default'  => '0'
    417             ),array(
    418244                'id'       => 'v_custom_text',
    419245                'type'     => 'switch',
     
    425251                'id'       => 'v_custom_text_post_like',
    426252                'type'     => 'text',
    427                 'validate' => 'no_html',
    428253                'required' => array(array('v-switch-posts','equals','1'),array('v_custom_text','equals','1')),
    429254                'title'    => __('Custom text for like', $domain),
     
    432257                'id'       => 'v_custom_text_post_dislike',
    433258                'type'     => 'text',
    434                 'validate' => 'no_html',
    435259                'required' => array(array('v-switch-posts','equals','1'),array('v_custom_text','equals','1')),
    436260                'title'    => __('Custom text for dislike', $domain),
     
    469293                'title'    => __('Number of dislikes:', $domain),
    470294                'subtitle' => __('Auto delete post at a given number of dislikes', $domain),
    471                 'validate' => 'numeric',
    472295                'default'  => '10'
    473296            )
     
    477300    ) );
    478301   
    479         Redux::setSection( $opt_name, array(
     302        Sse::setSection( $opt_name, array(
    480303        'title'  => __( 'Settings for comments', $domain ),
    481304        'id'     => 'comments',
     
    590413            'default'  => false,
    591414            ),array(
    592             'id'       => 'v-switch-order-comment',
    593             'type'     => 'switch',
    594             'required' => array('v-switch-comments','equals','1'),
    595             'title'    => __('Order comments', $domain),
    596             'subtitle' => __('Order comments by the number of likes they have.No Epoch support.',$domain),
    597             'default'  => false,
    598             ),array(
    599415            'id'       => 'v-switch-dislike-comment',
    600416            'type'     => 'switch',
     
    620436            ),array(
    621437                'id'          => 'vortex-buttons-size-comment',
    622                 'type'        => 'typography',
     438                'type'        => 'number',
    623439                'required' => array('v-switch-comments','equals','1'),
    624440                'title'       => __('Buttons size', $domain),
    625                 'google'      => false,
    626                 'font-backup' => false,
    627                 'font-size'   => true,
    628                 'text-align'  => false,
    629                 'font-weight' => false,
    630                 'line-height' => false,
    631                 'font-style'  => false,
    632                 'font-family' => false,
    633                 'color'       => false,
    634                 'units'       =>'px',
    635                 'subtitle'    => __('Here you can change the buttons size with a preview.',$domain),
    636                 'default'     => array(
    637                     'font-size'   => '16px',
    638                 ),
    639                 'preview'     => array(
    640                      'text'      => __('The buttons will have the same size as this text.You can use this as a preview for the size.',$domain),
    641                 )
     441                'subtitle'    => __('Here you can change the buttons size in pixels (px).',$domain),
     442                'default'     => "16",
    642443            ),array(
    643444                'id'       => 'v_default_color_comment',
     
    646447                'title'    => __('Default color', $domain),
    647448                'subtitle' => __('Default color of buttons', $domain),
    648                 'validate' => 'color',
    649449                'default'  => '#828384',
    650450            ),array(
     
    654454                'title'    => __('Like button ', $domain),
    655455                'subtitle' => __('Like button mouse over color',$domain),
    656                 'validate' => 'color',
    657456                'default'  => '#4898D6',
    658457            ),array(
     
    662461                'title'    => __('Like button ', $domain),
    663462                'subtitle' => __('Like button active color', $domain),
    664                 'validate' => 'color',
    665463                'default'  => '#1B7FCC',
    666464            ),array(
     
    670468                'title'    => __('Dislike button ', $domain),
    671469                'subtitle' => __('Dislike button mouse over color', $domain),
    672                 'validate' => 'color',
    673470                'default'  => '#0a0101',
    674471            ),array(
     
    678475                'title'    => __('Dislike button ', $domain),
    679476                'subtitle' => __('Dislike button active color',$domain),
    680                 'validate' => 'color',
    681477                'default'  => '#0a0101',
    682478            ),array(
     
    698494            'data'     => 'post_types',
    699495            ),array(
    700                 'id'       => 'v_start_comment_like',
    701                 'type'     => 'text',
    702                 'required' => array('v-switch-comments','equals','1'),
    703                 'title'    => __('Number of likes by default', $domain),
    704                 'subtitle' => __('Number of likes by default to new comment.', $domain),
    705                 'validate' => 'numeric',
    706                 'default'  => '0'
    707             ),array(
    708                 'id'       => 'v_start_comment_dislike',
    709                 'type'     => 'text',
    710                 'required' => array('v-switch-comments','equals','1'),
    711                 'title'    => __('Number of dislikes by default', $domain),
    712                 'subtitle' => __('Number of dislikes by default to new comment.', $domain),
    713                 'validate' => 'numeric',
    714                 'default'  => '0'
    715             ),array(
    716496                'id'       => 'v_custom_text_com',
    717497                'type'     => 'switch',
     
    723503                'id'       => 'v_custom_text_com_like',
    724504                'type'     => 'text',
    725                 'validate' => 'no_html',
    726505                'required' => array(array('v-switch-comments','equals','1'),array('v_custom_text_com','equals','1')),
    727506                'title'    => __('Custom text for like', $domain),
     
    730509                'id'       => 'v_custom_text_com_dislike',
    731510                'type'     => 'text',
    732                 'validate' => 'no_html',
    733511                'required' => array(array('v-switch-comments','equals','1'),array('v_custom_text_com','equals','1')),
    734512                'title'    => __('Custom text for dislike', $domain),
     
    752530        ));
    753531
    754         Redux::setSection( $opt_name, array(
     532        Sse::setSection( $opt_name, array(
    755533        'title'  => __( 'Translation', $domain ),
    756534        'id'     => 'translation',
    757535        'desc'   => __( 'Here you can translate some basic text.', $domain ),
    758         'icon'   => 'el el-home',
    759536            'fields' => array(
    760537                array(
     
    763540                    'title'    => __('Singular like  for widget', $domain),
    764541                    'subtitle' => __('This appers next to the number of likes in the widget only when the likes equals to 1.', $domain),
    765                     'validate' => 'text',
    766542                    'default'  => 'like'
    767543                ),array(
     
    770546                    'title'    => __('Plural like  for widget', $domain),
    771547                    'subtitle' => __('This appers next to the number of likes in the widget only when the likes is equals to 2 or bigger.', $domain),
    772                     'validate' => 'text',
    773548                    'default'  => 'likes'
    774549                ),array(
     
    777552                    'title'    => __('Require user to login', $domain),
    778553                    'subtitle' => __('This appears when the user is not logged in and the anonymous user voting is not allowed.', $domain),
    779                     'validate' => 'text',
    780554                    'default'  => 'You must be logged in to vote.'
    781                 ),/*array(
    782                     'id'       => 'v-like-text-yes',
    783                     'type'     => 'text',
    784                     'title'    => __('Tooltip already liked text', $domain),
    785                     'validate' => 'text',
    786                     'default'  => 'Unlike'
    787                 ),array(
    788                     'id'       => 'v-dislike-text',
    789                     'type'     => 'text',
    790                     'title'    => __('Tooltip disliked text', $domain),
    791                     'validate' => 'text',
    792                     'default'  => 'I dislike this'
    793                 ),array(
    794                     'id'       => 'v-dislike-yes',
    795                     'type'     => 'text',
    796                     'title'    => __('Tooltip already disliked text', $domain),
    797                     'validate' => 'text',
    798                     'default'  => 'Undislike'
    799                 )*/
     555                )
    800556            )
    801557        ));
    802         if ( file_exists( dirname( __FILE__ ) . '/../documentation.md' ) ) {
    803             $section = array(
    804                 'icon'   => 'el el-list-alt',
    805                 'title'  => __( 'Documentation', 'redux-framework-demo' ),
    806                 'fields' => array(
    807                     array(
    808                         'id'       => '17',
    809                         'type'     => 'raw',
    810                         'markdown' => true,
    811                         'content_path' => dirname( __FILE__ ) . '/../documentation.md', // FULL PATH, not relative please
    812                         //'content' => 'Raw content here',
    813                     ),
    814                 ),
    815             );
    816             Redux::setSection( $opt_name, $section );
     558       
     559        if(file_exists(plugin_dir_path(__FILE__).'documentation.html')){
     560            Sse::setSection( $opt_name, array(
     561            'title'  => __( 'Documentation', $domain ),
     562            'id'     => 'documentation',
     563            'fields' => array(),
     564            'html'   => plugin_dir_path(__FILE__).'documentation.html',
     565            ));
    817566        }
  • rating-system/trunk/buddypress.php

    r1338338 r1472151  
    11<?php
    2 global $vortex_like_dislike;
     2$vortex_like_dislike = get_option("vortex_like_dislike");
    33function vortex_system_add_dislike_class_buddypress($id){
    4                 global $vortex_like_dislike;
     4                $vortex_like_dislike = get_option("vortex_like_dislike");
    55           
    66                if(is_user_logged_in()){
     
    3838function vortex_system_dislike_counter_buddypress($id){
    3939           
    40             global $vortex_like_dislike;
     40            $vortex_like_dislike = get_option("vortex_like_dislike");
    4141            if ($vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_dislike_class_buddypress($id) == 'vortex-p-dislike-active'){
    4242                if(!$vortex_like_dislike['v-switch-anon-counter'] || is_user_logged_in()){
     
    6464
    6565function vortex_system_add_like_class_buddypress($id){
    66                 global $vortex_like_dislike;
     66                $vortex_like_dislike = get_option("vortex_like_dislike");
    6767               
    6868                if(is_user_logged_in()){
     
    100100function vortex_system_like_counter_buddypress($id){
    101101           
    102             global $vortex_like_dislike;
     102            $vortex_like_dislike = get_option("vortex_like_dislike");
    103103            if ($vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_like_class_buddypress($id) == 'vortex-p-like-active'){
    104104                if(!$vortex_like_dislike['v-switch-anon-counter'] || is_user_logged_in()){
     
    113113
    114114function vortex_buddypress_render($id){
    115     global $vortex_like_dislike;
     115    $vortex_like_dislike = get_option("vortex_like_dislike");
    116116           
    117117            if(!$vortex_like_dislike['v-switch-dislike']){
     
    163163}
    164164
    165 global $vortex_like_dislike;
     165$vortex_like_dislike = get_option("vortex_like_dislike");
    166166if($vortex_like_dislike['v_button_visibility'][1] && $vortex_like_dislike['v_button_visibility'][2] ){
    167167                add_filter('bp_get_activity_content_body','vortex_buddypress_after');
  • rating-system/trunk/comments.php

    r1338933 r1472151  
    11<?php
    22
    3 global $vortex_like_dislike;
     3$vortex_like_dislike = get_option("vortex_like_dislike");
    44
    55if($vortex_like_dislike['v-switch-comments']){
     
    88        function vortex_system_comment_like_button(){
    99               
    10                 global $vortex_like_dislike;
     10                $vortex_like_dislike = get_option("vortex_like_dislike");
    1111               
    1212                $nonce = $_POST['nonce'];
     
    128128                }
    129129           
    130                 global $vortex_like_dislike;
     130                $vortex_like_dislike = get_option("vortex_like_dislike");
    131131                if(!$vortex_like_dislike['v-switch-anon-comment'] && !is_user_logged_in()){
    132132                    exit();
     
    238238   
    239239        function vortex_system_add_dislike_class_comment(){
    240                 global $vortex_like_dislike;
     240                $vortex_like_dislike = get_option("vortex_like_dislike");
    241241                $id = get_comment_ID();
    242242                if(is_user_logged_in()){
     
    263263
    264264        function vortex_system_add_like_class_comment(){
    265                 global $vortex_like_dislike;
     265                $vortex_like_dislike = get_option("vortex_like_dislike");
    266266                $id = get_comment_ID();
    267267                if(is_user_logged_in()){
     
    310310       
    311311        function vortex_system_get_like_icon_comment(){
    312             global $vortex_like_dislike;
     312            $vortex_like_dislike = get_option("vortex_like_dislike");
    313313           
    314314            if($vortex_like_dislike['v_button_style_comment'] == '1'){
     
    345345       
    346346        function vortex_system_get_dislike_icon_comment(){
    347             global $vortex_like_dislike;
     347            $vortex_like_dislike = get_option("vortex_like_dislike");
    348348           
    349349            if($vortex_like_dislike['v_button_style_comment'] == '1'){
     
    382382        function vortex_system_dislike_counter_comment(){
    383383           
    384             global $vortex_like_dislike;
    385             if ($vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_dislike_class_comment() == 'vortex-p-dislike-active-comment'){
     384            $vortex_like_dislike = get_option("vortex_like_dislike");
     385            if ($vortex_like_dislike['v_custom_text_com'] && $vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_dislike_class_comment() == 'vortex-p-dislike-active-comment'){
    386386                if(!$vortex_like_dislike['v-switch-anon-counter-comment'] || is_user_logged_in()){
    387387                    return '<span class="vortex-p-dislike-counter-comment '.get_comment_ID(). '">'.$vortex_like_dislike['v_custom_text_com_dislike'].'</span>';
     
    400400        function vortex_system_like_counter_comment(){
    401401           
    402             global $vortex_like_dislike;
    403             if ($vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_like_class_comment() == 'vortex-p-like-active-comment'){
     402            $vortex_like_dislike = get_option("vortex_like_dislike");
     403           
     404            if ($vortex_like_dislike['v_custom_text_com'] && $vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_like_class_comment() == 'vortex-p-like-active-comment'){
    404405                if(!$vortex_like_dislike['v-switch-anon-counter-comment'] || is_user_logged_in()){
    405406                    return  '<span  class="vortex-p-like-counter-comment '. get_comment_ID().'">'.$vortex_like_dislike['v_custom_text_com_like'].'</span>';
     
    412413       
    413414        function vortex_button_align_comment(){
    414             global $vortex_like_dislike;
     415            $vortex_like_dislike = get_option("vortex_like_dislike");
    415416           
    416417            if($vortex_like_dislike['vortex-button-align-comment'] == '1'){
     
    425426        function vortex_render_for_comments($dislike = true){
    426427           
    427             global $vortex_like_dislike;
     428            $vortex_like_dislike = get_option("vortex_like_dislike");
    428429           
    429430            if(!$vortex_like_dislike['v-switch-dislike-comment'] && $dislike){
     
    443444    function vortex_system_insert_comments(){
    444445
    445     global $vortex_like_dislike;
     446    $vortex_like_dislike = get_option("vortex_like_dislike");
    446447
    447448        function vortex_system_before_comment($comment_text){
    448449           
    449             global $vortex_like_dislike;
     450            $vortex_like_dislike = get_option("vortex_like_dislike");
    450451           
    451452            if(!empty($vortex_like_dislike['v_exclude_category_comment'])){
     
    469470        function vortex_system_after_comment($comment_text){
    470471           
    471             global $vortex_like_dislike;
     472            $vortex_like_dislike = get_option("vortex_like_dislike");
    472473           
    473474            if(!empty($vortex_like_dislike['v_exclude_post_types'])){
     
    506507       
    507508    function vortex_print_styles_comments(){
    508         global $vortex_like_dislike;
     509        $vortex_like_dislike = get_option("vortex_like_dislike");
    509510        ?>
    510         <style>.vortex-container-like-comment,.vortex-container-dislike-comment{font-size:<?php echo $vortex_like_dislike['vortex-buttons-size-comment']['font-size']?>}.vortex-p-like-comment, .vortex-p-dislike-comment{color:<?php echo $vortex_like_dislike['v_default_color_comment'] ?>;}.vortex-p-like-comment:hover{color:<?php echo $vortex_like_dislike['v_like_color_comment'] ?>;}.vortex-p-like-active-comment{color: <?php echo $vortex_like_dislike['v_like_active_color_comment'] ?>;}.vortex-p-dislike-comment:hover{color: <?php echo $vortex_like_dislike['v_dislike_color_comment'] ?>;}.vortex-p-dislike-active-comment{color: <?php echo $vortex_like_dislike['v_dislike_active_color_comment'] ?>;}</style>
     511        <style type="text/css">
     512        .vortex-container-like-comment,
     513        .vortex-container-dislike-comment{font-size:<?php echo esc_html($vortex_like_dislike['vortex-buttons-size-comment'])?>px;}
     514        .vortex-p-like-comment,
     515        .vortex-p-dislike-comment{color:<?php echo esc_html($vortex_like_dislike['v_default_color_comment'])?>;}
     516        .vortex-p-like-comment:hover{color:<?php echo esc_html($vortex_like_dislike['v_like_color_comment'])?>;}
     517        .vortex-p-like-active-comment{color:<?php echo esc_html($vortex_like_dislike['v_like_active_color_comment'])?>;}
     518        .vortex-p-dislike-comment:hover{color:<?php echo esc_html($vortex_like_dislike['v_dislike_color_comment'])?>;}
     519        .vortex-p-dislike-active-comment{color:<?php echo esc_html($vortex_like_dislike['v_dislike_active_color_comment'])?>;}
     520        </style>
    511521        <?php
    512522    }
     
    514524       
    515525    function vortex_system_styles_scripts_comments(){
    516         global $vortex_like_dislike;
     526        $vortex_like_dislike = get_option("vortex_like_dislike");
    517527           
    518528            if(is_user_logged_in() || $vortex_like_dislike['v-switch-anon-comment']){
     
    552562       
    553563        function vortex_epoch_css(){
    554             global $vortex_like_dislike;
     564            $vortex_like_dislike = get_option("vortex_like_dislike");
    555565            echo "<link rel='stylesheet' href='".plugin_dir_url( __FILE__ ).'assets/css/style.css'."' type='text/css' media='all'>";
    556566            ?>
     
    686696        }
    687697        function vortex_print_styles_comments(){
    688         global $vortex_like_dislike;
     698        $vortex_like_dislike = get_option("vortex_like_dislike");
    689699        ?>
    690700        <style>.vortex-container-like-comment,.vortex-container-dislike-comment{font-size:<?php echo $vortex_like_dislike['vortex-buttons-size-comment']['font-size']?>}.vortex-p-like-comment, .vortex-p-dislike-comment{color:<?php echo $vortex_like_dislike['v_default_color_comment'] ?>;}.vortex-p-like-comment:hover{color:<?php echo $vortex_like_dislike['v_like_color_comment'] ?>;}.vortex-p-like-active-comment{color: <?php echo $vortex_like_dislike['v_like_active_color_comment'] ?>;}.vortex-p-dislike-comment:hover{color: <?php echo $vortex_like_dislike['v_dislike_color_comment'] ?>;}.vortex-p-dislike-active-comment{color: <?php echo $vortex_like_dislike['v_dislike_active_color_comment'] ?>;}</style>
     
    694704       
    695705    function vortex_system_styles_scripts_comments(){
    696         global $vortex_like_dislike;
     706        $vortex_like_dislike = get_option("vortex_like_dislike");
    697707           
    698708            if(is_user_logged_in() || $vortex_like_dislike['v-switch-anon-comment']){
     
    739749            function vortex_system_columns_comments( $columns ) {
    740750               
    741                 global $vortex_like_dislike;
     751                $vortex_like_dislike = get_option("vortex_like_dislike");
    742752                $domain = 'vortex_system_ld';
    743753                $columns['likes'] = '<span class="dashicons dashicons-thumbs-up"></span>';
     
    789799            }
    790800        }
    791 
    792     if($vortex_like_dislike['v-switch-order-comment']){
    793         function vortex_system_order_comments($comments) {
    794             unset($comments);
    795             global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
    796 
    797         if ( !(is_single() || is_page() || $withcomments) || empty($post) )
    798             return;
    799 
    800         if ( empty($file) )
    801             $file = '/comments.php';
    802 
    803         $req = get_option('require_name_email');
    804 
    805         /*
    806          * Comment author information fetched from the comment cookies.
    807          */
    808         $commenter = wp_get_current_commenter();
    809 
    810         /*
    811          * The name of the current comment author escaped for use in attributes.
    812          * Escaped by sanitize_comment_cookies().
    813          */
    814         $comment_author = $commenter['comment_author'];
    815 
    816         /*
    817          * The email address of the current comment author escaped for use in attributes.
    818          * Escaped by sanitize_comment_cookies().
    819          */
    820         $comment_author_email = $commenter['comment_author_email'];
    821 
    822         /*
    823          * The url of the current comment author escaped for use in attributes.
    824          */
    825         $comment_author_url = esc_url($commenter['comment_author_url']);
    826 
    827         $comment_args = array(
    828             'order'   => 'DESC',
    829             'orderby' => 'meta_value_num',
    830             'meta_key' => 'vortex_system_likes',
    831             'status'  => 'approve',
    832             'post_id' => $post->ID,
    833         );
    834 
    835         if ( $user_ID ) {
    836             $comment_args['include_unapproved'] = array( $user_ID );
    837         } elseif ( ! empty( $comment_author_email ) ) {
    838             $comment_args['include_unapproved'] = array( $comment_author_email );
    839         }
    840 
    841         $comments = get_comments( $comment_args );
    842         return $comments;
    843         }   
    844         add_filter ('comments_array', 'vortex_system_order_comments');
    845     }
     801   
    846802}
  • rating-system/trunk/epoch.php

    r1338338 r1472151  
    22
    33        function vortex_system_add_dislike_class_comment_epoch($id){
    4                 global $vortex_like_dislike;
     4                $vortex_like_dislike = get_option("vortex_like_dislike");
    55           
    66                if(is_user_logged_in()){
     
    2626
    2727        function vortex_system_add_like_class_comment_epoch($id){
    28                 global $vortex_like_dislike;
     28                $vortex_like_dislike = get_option("vortex_like_dislike");
    2929               
    3030                if(is_user_logged_in()){
     
    7474        function vortex_system_dislike_counter_comment_epoch($id){
    7575           
    76             global $vortex_like_dislike;
     76            $vortex_like_dislike = get_option("vortex_like_dislike");
    7777            if ($vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_dislike_class_comment_epoch($id) == 'vortex-p-dislike-active-comment'){
    7878                if(!$vortex_like_dislike['v-switch-anon-counter-comment'] || is_user_logged_in()){
     
    8686        function vortex_system_like_counter_comment_epoch($id){
    8787           
    88             global $vortex_like_dislike;
     88            $vortex_like_dislike = get_option("vortex_like_dislike");
    8989            if ($vortex_like_dislike['v_custom_text_com_keep'] && vortex_system_add_like_class_comment_epoch($id) == 'vortex-p-like-active-comment'){
    9090                if(!$vortex_like_dislike['v-switch-anon-counter-comment'] || is_user_logged_in()){
     
    105105function vortex_render_for_comments_epoch($id){
    106106           
    107             global $vortex_like_dislike;
     107            $vortex_like_dislike = get_option("vortex_like_dislike");
    108108
    109109            if(!$vortex_like_dislike['v-switch-dislike-comment']){
  • rating-system/trunk/metabox.php

    r1338338 r1472151  
    2828        $post_types['page'] = 'page';
    2929       
    30         global $vortex_like_dislike;
     30        $vortex_like_dislike = get_option("vortex_like_dislike");
    3131       
    3232        $array = array();
  • rating-system/trunk/posts-pages.php

    r1338338 r1472151  
    11<?php
    2 global $vortex_like_dislike;
    3    
     2$vortex_like_dislike = get_option("vortex_like_dislike");
     3
    44    if($vortex_like_dislike['v-switch-posts']){
    55
     
    88        function vortex_system_like_button() {
    99               
    10                 global $vortex_like_dislike;
     10                $vortex_like_dislike = get_option("vortex_like_dislike");
    1111               
    1212                $nonce = $_POST['nonce'];
     
    3737                   
    3838                    $user_key = 'vortex_system_user_'.$user_ip;
     39                   
     40                        if(vortex_ra_read_cookie('likepost',$post_id) == 'found'){
     41                                    $response = array(
     42                                        'likes'    => "exit"
     43                                    );
     44                                   
     45                                    echo json_encode($response);
     46                                    exit();
     47                        }
     48                   
     49                        if(vortex_ra_read_cookie('dislikepost',$post_id) == 'found'){
     50                                    $response = array(
     51                                        'dislikes'     => "exit"
     52                                    );
     53                                   
     54                                    echo json_encode($response);
     55                                    exit();
     56                        }
    3957                   
    4058                }else wp_die();
     
    6987                $login_number = apply_filters('vortex_login_number',1);
    7088                $logout_number = apply_filters('vortex_logout_number',1);
     89               
     90                    if(!is_user_logged_in() && $vortex_like_dislike['v-switch-anon']){
     91                        if($current_user_liked == 'noliked'){
     92                                $response = array(
     93                                    'likes'    => "exit",
     94                            );
     95                                   
     96                            echo json_encode($response);
     97                            exit();
     98                        }
     99
     100                       
     101                        if($current_user_liked == 'nodisliked'){
     102                                $response = array(
     103                                    'dislikes'     => "exit",
     104                            );
     105                                   
     106                            echo json_encode($response);
     107                            exit();
     108                        }
     109                    }
     110               
    71111                //END custom
    72                 if($current_user_liked == 'liked' && $disliked_value == 'nodisliked' || vortex_ra_read_cookie('dislikepost',$post_id) == 'found' && vortex_ra_read_cookie('likepost',$post_id) == 'notfound'){
     112                if($current_user_liked == 'liked' && $disliked_value == 'nodisliked'){
    73113                    $current_likes = get_post_meta($post_id,$likes,true);
    74114                    if(!is_user_logged_in()){
     
    88128                    do_action("vortex_post_dislike",'+likes','-dislikes',$current_user_id,$post_id);
    89129                    /*
    90                     global $vortex_like_dislike;
     130                    $vortex_like_dislike = get_option("vortex_like_dislike");
    91131                    if($vortex_like_dislike['v-switch-tooltip']){
    92132                        $response = array(
     
    121161                    exit();
    122162                   
    123                 }elseif($current_user_liked == 'liked' || vortex_ra_read_cookie('likepost',$post_id) == 'notfound'){
     163                }elseif($current_user_liked == 'liked'){
    124164                    //he likes the post add +1 to likes
    125165                    //change the liked value so when he clicks again we can undo his vote
     
    134174                    do_action("vortex_post_dislike",'+likes','nothing',$current_user_id,$post_id);
    135175                   
    136                 }elseif($current_user_liked == 'noliked' || vortex_ra_read_cookie('likepost',$post_id) == 'found'){
     176                }elseif($current_user_liked == 'noliked' ){
    137177                    //he doesn't like the post anymore let's undo his vote and change his meta so we can add his vote back
    138178                    //if he changes his mind
     
    191231               
    192232               
    193                 global $vortex_like_dislike;
     233                $vortex_like_dislike = get_option("vortex_like_dislike");
    194234               
    195235                if(!$vortex_like_dislike['v-switch-anon'] && !is_user_logged_in()){
     
    212252                   
    213253                    $user_key = 'vortex_system_user_'.$user_ip;
     254                   
     255                   
     256                        if(vortex_ra_read_cookie('dislikepost',$post_id) == 'found'){
     257                                    $response = array(
     258                                        'dislikes'     => "exit"
     259                                    );
     260                                   
     261                                    echo json_encode($response);
     262                                    exit();
     263                        }
     264                       
     265                            if(vortex_ra_read_cookie('likepost',$post_id) == 'found'){
     266                                    $response = array(
     267                                        'likes'    => "exit"
     268                                    );
     269                                   
     270                                    echo json_encode($response);
     271                                    exit();
     272                        }
     273                   
    214274                   
    215275                }else wp_die();     
     
    248308                //END custom
    249309               
    250                 if($current_user_disliked == 'disliked' && $liked_value == 'noliked' || vortex_ra_read_cookie('likepost',$post_id) == 'found' && vortex_ra_read_cookie('dislikepost',$post_id) == 'notfound'){
     310                if(!is_user_logged_in() && $vortex_like_dislike['v-switch-anon']){
     311                        if($current_user_liked == 'noliked'){
     312                                $response = array(
     313                                    'likes'    => "exit",
     314                            );
     315                                   
     316                            echo json_encode($response);
     317                            exit();
     318                        }
     319                       
     320                        if($current_user_liked == 'nodisliked'){
     321                                $response = array(
     322                                    'dislikes'     => "exit",
     323                            );
     324                                   
     325                            echo json_encode($response);
     326                            exit();
     327                        }
     328                   
     329                    }
     330                   
     331                if($current_user_disliked == 'disliked' && $liked_value == 'noliked'){
    251332                   
    252333                    $current_likes = get_post_meta($post_id,$likes,true);
     
    291372                    exit();
    292373                   
    293                 }elseif($current_user_disliked == 'disliked' || vortex_ra_read_cookie('dislikepost',$post_id) == 'notfound'){
     374                }elseif($current_user_disliked == 'disliked'){
    294375                    //he likes the post add +1 to likes
    295376                    //change the liked value so when he clicks again we can undo his vote
     
    308389                    }
    309390                   
    310                 }elseif($current_user_disliked == 'nodisliked' || vortex_ra_read_cookie('dislikepost',$post_id) == 'found'){
     391                }elseif($current_user_disliked == 'nodisliked'){
    311392                    //he doesn't like the post anymore let's undo his vote and change his meta so we can add his vote back
    312393                    //if he changes his mind
     
    356437
    357438        function vortex_system_add_dislike_class(){
    358                 global $vortex_like_dislike;
     439                $vortex_like_dislike = get_option("vortex_like_dislike");
    359440            if(function_exists('bbp_get_reply_id')){
    360441                if(bbp_get_reply_id() != null){
     
    389470
    390471        function vortex_system_add_like_class(){
    391                 global $vortex_like_dislike;
     472                $vortex_like_dislike = get_option("vortex_like_dislike");
    392473                if(function_exists('bbp_get_reply_id')){
    393474                if(bbp_get_reply_id() != null){
     
    461542       
    462543        function vortex_system_get_like_icon(){
    463             global $vortex_like_dislike;
     544            $vortex_like_dislike = get_option("vortex_like_dislike");
    464545           
    465546            if($vortex_like_dislike['v_button_style'] == '1'){
     
    497578       
    498579        function vortex_system_get_dislike_icon(){
    499             global $vortex_like_dislike;
     580            $vortex_like_dislike = get_option("vortex_like_dislike");
    500581           
    501582            if($vortex_like_dislike['v_button_style'] == '1'){
     
    533614       
    534615        function vortex_button_align(){
    535             global $vortex_like_dislike;
     616            $vortex_like_dislike = get_option("vortex_like_dislike");
    536617
    537618            if($vortex_like_dislike['vortex-button-align'] == '1'){
     
    554635                $id = get_the_ID();
    555636            }
    556             global $vortex_like_dislike;
    557             if ($vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_dislike_class() == 'vortex-p-dislike-active'){
     637            $vortex_like_dislike = get_option("vortex_like_dislike");
     638            if ($vortex_like_dislike['v_custom_text'] && $vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_dislike_class() == 'vortex-p-dislike-active'){
    558639                if(!$vortex_like_dislike['v-switch-anon-counter'] || is_user_logged_in()){
    559640                    return '<span class="vortex-p-dislike-counter '.$id. '">'.$vortex_like_dislike['v_custom_text_post_dislike'].'</span>';
     
    597678            }
    598679           
    599             global $vortex_like_dislike;
    600             if ($vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_like_class() == 'vortex-p-like-active'){
     680            $vortex_like_dislike = get_option("vortex_like_dislike");
     681            if ($vortex_like_dislike['v_custom_text'] && $vortex_like_dislike['v_custom_text_post_keep'] && vortex_system_add_like_class() == 'vortex-p-like-active'){
    601682                if(!$vortex_like_dislike['v-switch-anon-counter'] || is_user_logged_in()){
    602683                    return  '<span  class="vortex-p-like-counter '. $id.'">'.$vortex_like_dislike['v_custom_text_post_like'].'</span>';
     
    611692        function vortex_render_for_posts($dislike = true , $counter = true){
    612693           
    613             global $vortex_like_dislike;
     694            $vortex_like_dislike = get_option("vortex_like_dislike");
    614695            $like_counter = "";
    615696            if(function_exists('bbp_get_reply_id')){
     
    647728            function vortex_system_columns( $columns ) {
    648729               
    649                 global $vortex_like_dislike;
     730                $vortex_like_dislike = get_option("vortex_like_dislike");
    650731                $domain = 'vortex_system_ld';
    651732                $columns['likes'] = '<span class="dashicons dashicons-thumbs-up"></span>';
     
    696777
    697778            function vortex_system_sortable_columns( $columns ) {
    698                 global $vortex_like_dislike;
     779                $vortex_like_dislike = get_option("vortex_like_dislike");
    699780               
    700781                $columns['likes'] = 'likes';
     
    718799        $post_types = get_post_types( $args, $output, $operator );
    719800
    720         global $vortex_like_dislike;
     801        $vortex_like_dislike = get_option("vortex_like_dislike");
    721802       
    722803        $post_types['post'] = 'post';
     
    750831       
    751832        function vortex_system_before_post($content){
    752             global $vortex_like_dislike;
     833            $vortex_like_dislike = get_option("vortex_like_dislike");
    753834           
    754835            if(!empty($vortex_like_dislike['v_exclude_category'])){
     
    789870   
    790871        function vortex_system_after_post($content){
    791             global $vortex_like_dislike;
     872            $vortex_like_dislike = get_option("vortex_like_dislike");
    792873            if(function_exists('bbp_get_reply_id')){
    793874                if(bbp_get_reply_id() != null){
     
    825906            }else return $content;
    826907        }
    827         global $vortex_like_dislike;
     908        $vortex_like_dislike = get_option("vortex_like_dislike");
    828909        if(!post_password_required()){
    829910            if($vortex_like_dislike['v_button_visibility'][1] && $vortex_like_dislike['v_button_visibility'][2] ){
    830911                add_filter('the_content','vortex_system_before_post');
    831912                add_filter('the_content','vortex_system_after_post');
    832                 if($vortex_like_dislike['v_enable_bbpress'] && is_plugin_active( 'bbpress/bbpress.php' )){
     913                if($vortex_like_dislike['v_enable_bbpress']){
    833914                    add_filter('bbp_get_reply_content','vortex_system_before_post');
    834915                    add_filter('bbp_get_reply_content','vortex_system_after_post');
     
    836917            }elseif($vortex_like_dislike['v_button_visibility'][1]){
    837918                add_filter('the_content','vortex_system_before_post');
    838                 if($vortex_like_dislike['v_enable_bbpress'] && is_plugin_active( 'bbpress/bbpress.php' )){
     919                if($vortex_like_dislike['v_enable_bbpress']){
    839920                    add_filter('bbp_get_reply_content','vortex_system_before_post');
    840921                }
    841922            }elseif($vortex_like_dislike['v_button_visibility'][2]){
    842923                add_filter('the_content','vortex_system_after_post');
    843                 if($vortex_like_dislike['v_enable_bbpress'] && is_plugin_active( 'bbpress/bbpress.php' )){
     924                if($vortex_like_dislike['v_enable_bbpress']){
    844925                    add_filter('bbp_get_reply_content','vortex_system_after_post');
    845926                }
     
    850931    add_action('wp','vortex_system_insert');
    851932    function vortex_system_styles_scripts(){
    852         global $vortex_like_dislike;
     933        $vortex_like_dislike = get_option("vortex_like_dislike");
    853934           
    854935            if(is_user_logged_in() || $vortex_like_dislike['v-switch-anon']){
     
    886967    }
    887968    add_action('wp_enqueue_scripts','vortex_system_styles_scripts');
     969   
     970    function vortex_print_styles(){
     971        $vortex_like_dislike = get_option('vortex_like_dislike');
     972       
     973        ?>
     974        <style type="text/css">
     975        .vortex-container-like,
     976        .vortex-container-dislike {
     977            font-size: <?php echo esc_html($vortex_like_dislike['vortex-buttons-size']);?>px !important;   
     978        }
     979        .vortex-p-like,
     980        .vortex-p-dislike{
     981            color:<?php echo esc_html($vortex_like_dislike['v_default_color']); ?>!important;
     982        }
     983        .vortex-p-like:hover{
     984            color:<?php echo esc_html($vortex_like_dislike['v_like_color']); ?>!important;
     985        }
     986        .vortex-p-like-active{
     987            color:<?php echo esc_html($vortex_like_dislike['v_like_active_color']); ?>!important;
     988        }
     989        .vortex-p-dislike:hover{
     990            color:<?php echo esc_html($vortex_like_dislike['v_dislike_color']); ?>!important;
     991        }
     992        .vortex-p-dislike-active{
     993            color:<?php echo esc_html($vortex_like_dislike['v_dislike_active_color']); ?>!important;
     994        }
     995        </style>
     996       
     997        <?php
     998    }
     999    add_action('wp_print_styles','vortex_print_styles');
    8881000}
  • rating-system/trunk/rating-system.php

    r1338933 r1472151  
    44* Plugin URI: http://github.com/AlexAlexandru/rating-system
    55* Description: The simple way to add like or dislike buttons.
    6 * Version: 2.7.5
     6* Version: 2.7.6
    77* Author: AlexAlexandru
    88* Author URI: https://github.com/AlexAlexandru
     
    2929
    3030function vortex_ra_cookie($name,$postid,$name2){
    31     if(vortex_ra_read_cookie($name2,$postid) == 'found' && vortex_ra_read_cookie($name,$postid) == 'notfound'){
    32 
    33         $decode2 = json_decode($_COOKIE[$name2]);
    34         $decode2 = array_diff($decode2, array($postid));
    35         $encode2 = json_encode(array_values($decode2));
    36         setcookie($name2,$encode2,time()+ 2419200,'/',COOKIE_DOMAIN,is_ssl(),true);
    37        
    38         if(!isset($_COOKIE[$name])){
    39             $decode = array();
    40         }else{
    41             $decode = json_decode($_COOKIE[$name]);
    42         }
    43 
    44         array_push($decode,$postid);
    45         $encode = json_encode($decode);
    46         setcookie($name,$encode,time()+ 2419200,'/',COOKIE_DOMAIN,is_ssl(),true);
    47        
    48     }elseif(!isset($_COOKIE[$name])){
     31    if(!isset($_COOKIE[$name])){
    4932        $array = json_encode(array($postid));
    5033        setcookie($name,$array,time()+ 2419200,'/',COOKIE_DOMAIN,is_ssl(),true);
     
    5538            $encode = json_encode($decode);
    5639            setcookie($name,$encode,time()+ 2419200,'/',COOKIE_DOMAIN,is_ssl(),true);
    57         }else{
    58             $decode = json_decode($_COOKIE[$name]);
    59             $decode = array_diff($decode, array($postid));
    60             $encode = json_encode(array_values($decode));
    61             setcookie($name,$encode,time()+ 2419200,'/',COOKIE_DOMAIN,is_ssl(),true);
    62         }
    63     }
    64 }
    65 
    66 function vortex_rating_require_tgmpa(){
    67     //tgmpa
    68 include(plugin_dir_path( __FILE__).'tgmpa/class-tgm-plugin-activation.php');
    69 add_action( 'tgmpa_register', 'vortex_register_plugin' );
    70 
    71 function vortex_register_plugin() {
    72 
    73     $plugins = array(
    74         array(
    75             'name'      => 'Redux Framework',
    76             'slug'      => 'redux-framework',
    77             'required'  => true,
    78         ),
    79     );
    80 
    81     $config = array(
    82         'id'           => 'vortex-tgmpa',                 // Unique ID for hashing notices for multiple instances of TGMPA.
    83         'default_path' => '',                      // Default absolute path to bundled plugins.
    84         'menu'         => 'vortex-install-plugins', // Menu slug.
    85         'parent_slug'  => 'plugins.php',            // Parent menu slug.
    86         'capability'   => 'edit_plugins',    // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
    87         'has_notices'  => true,                    // Show admin notices or not.
    88         'dismissable'  => false,                    // If false, a user cannot dismiss the nag message.
    89         'dismiss_msg'  => __('Rating System','vortex_system_ld'), // If 'dismissable' is false, this message will be output at top of nag.
    90         'is_automatic' => false,                   // Automatically activate plugins after installation or not.
    91         'message'      => '',                      // Message to output right before the plugins table.
    92        
    93        
    94         'strings'      => array(
    95             'page_title'                      => __( 'Install Required Plugins', 'theme-slug' ),
    96             'menu_title'                      => __( 'Install Plugins', 'theme-slug' ),
    97             'installing'                      => __( 'Installing Plugin: %s', 'theme-slug' ), // %s = plugin name.
    98             'oops'                            => __( 'Something went wrong with the plugin API.', 'theme-slug' ),
    99             'notice_can_install_required'     => _n_noop(
    100                 'This plugin requires the following plugin: %1$s.',
    101                 'This plugin requires the following plugins: %1$s.',
    102                 'theme-slug'
    103             ), // %1$s = plugin name(s).
    104             'notice_can_install_recommended'  => _n_noop(
    105                 'This plugin recommends the following plugin: %1$s.',
    106                 'This plugin recommends the following plugins: %1$s.',
    107                 'theme-slug'
    108             ), // %1$s = plugin name(s).
    109             'notice_cannot_install'           => _n_noop(
    110                 'Sorry, but you do not have the correct permissions to install the %1$s plugin.',
    111                 'Sorry, but you do not have the correct permissions to install the %1$s plugins.',
    112                 'theme-slug'
    113             ), // %1$s = plugin name(s).
    114             'notice_ask_to_update'            => _n_noop(
    115                 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this plugin: %1$s.',
    116                 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this plugin: %1$s.',
    117                 'theme-slug'
    118             ), // %1$s = plugin name(s).
    119             'notice_ask_to_update_maybe'      => _n_noop(
    120                 'There is an update available for: %1$s.',
    121                 'There are updates available for the following plugins: %1$s.',
    122                 'theme-slug'
    123             ), // %1$s = plugin name(s).
    124             'notice_cannot_update'            => _n_noop(
    125                 'Sorry, but you do not have the correct permissions to update the %1$s plugin.',
    126                 'Sorry, but you do not have the correct permissions to update the %1$s plugins.',
    127                 'theme-slug'
    128             ), // %1$s = plugin name(s).
    129             'notice_can_activate_required'    => _n_noop(
    130                 'The following required plugin is currently inactive: %1$s.',
    131                 'The following required plugins are currently inactive: %1$s.',
    132                 'theme-slug'
    133             ), // %1$s = plugin name(s).
    134             'notice_can_activate_recommended' => _n_noop(
    135                 'The following recommended plugin is currently inactive: %1$s.',
    136                 'The following recommended plugins are currently inactive: %1$s.',
    137                 'theme-slug'
    138             ), // %1$s = plugin name(s).
    139             'notice_cannot_activate'          => _n_noop(
    140                 'Sorry, but you do not have the correct permissions to activate the %1$s plugin.',
    141                 'Sorry, but you do not have the correct permissions to activate the %1$s plugins.',
    142                 'theme-slug'
    143             ), // %1$s = plugin name(s).
    144             'install_link'                    => _n_noop(
    145                 'Begin installing plugin',
    146                 'Begin installing plugins',
    147                 'theme-slug'
    148             ),
    149             'update_link'                     => _n_noop(
    150                 'Begin updating plugin',
    151                 'Begin updating plugins',
    152                 'theme-slug'
    153             ),
    154             'activate_link'                   => _n_noop(
    155                 'Begin activating plugin',
    156                 'Begin activating plugins',
    157                 'theme-slug'
    158             ),
    159         ),
    160        
    161     );
    162 
    163     tgmpa( $plugins, $config );
    164 }
    165 }
    166 add_action('plugins_loaded','vortex_rating_require_tgmpa');
     40        }
     41    }
     42}
    16743
    16844//require all usefull stuffs
    16945function vortex_systen_main_function(){
    17046
    171     if(!function_exists('is_plugin_active')){
    172         include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    173     }
    17447    if(class_exists('myCRED_Hook')){
    17548        include(plugin_dir_path( __FILE__ ).'mycredcomments.php');
     
    18558    }
    18659   
    187     if(function_exists('is_plugin_active')){
    188         if(is_plugin_active('redux-framework/redux-framework.php')){
     60        $vortex_like_dislike = get_option('vortex_like_dislike');
    18961            load_plugin_textdomain( 'vortex_system_ld', FALSE, basename(plugin_dir_path( __FILE__ )). '/languages' );
    190             $reduxoption = plugin_dir_path( __FILE__).'admin/vortexlikedislike.php';
    191             $reduxframework = plugin_dir_path(plugin_dir_path( __FILE__ )).'redux-framework/ReduxCore/framework.php';
    192        
    193                 if ( !class_exists( 'ReduxFramework' ) && file_exists($reduxframework) ) {
    194                     include($reduxframework);
     62            $sse = plugin_dir_path( __FILE__).'admin/framework/autoload.php';
     63            $options = plugin_dir_path( __FILE__).'admin/vortexlikedislike.php';
     64       
     65                if ( !class_exists( 'Sse' ) && file_exists($sse) ) {
     66                    include($sse);
    19567                };
    196                 if ( !isset( $vortex_like_dislike ) && file_exists($reduxoption) ) {
    197                     include($reduxoption);
     68               
     69                if ( file_exists($options) ) {
     70                    include($options);
    19871                };
    199    
     72
    20073                //donation button
    20174                function vortex_system_donation_button(){
     
    20881                        ';
    20982                }
    210                 add_action('redux/vortex_like_dislike/panel/before','vortex_system_donation_button');
    211                 add_action('redux/vortex_like_dislike/panel/after','vortex_system_donation_button');
    212                
    213                 Redux::init('vortex_like_dislike');
    214                
    215                 global $vortex_like_dislike;
    216                
     83                add_action('sse_footer_vortex_like_dislike','vortex_system_donation_button');
     84
     85            $vortex_like_dislike = get_option("vortex_like_dislike");
     86           
    21787                if($vortex_like_dislike['v-switch-posts'] && isset($vortex_like_dislike['v-switch-posts'])){
    21888                    include(plugin_dir_path( __FILE__ ).'posts-pages.php');
     
    22393                if($vortex_like_dislike['v-switch-comments'] && isset($vortex_like_dislike['v-switch-comments'])){
    22494                    include(plugin_dir_path( __FILE__ ).'comments.php');
    225                 }
    226                
    227                 //add custom fields when comment is submited
    228                 add_action('comment_post', 'vortex_system_add_likes_dislikes_comments');
    229                 function vortex_system_add_likes_dislikes_comments($comment_ID) {
    230                     global $vortex_like_dislike;
    231                     $likes = 0;
    232                     $dislikes = 0;
    233                    
    234                     if(isset($vortex_like_dislike['v_start_comment_like'])){
    235                         $likes = $vortex_like_dislike['v_start_comment_like'];
    236                     }
    237                    
    238                     if(isset($vortex_like_dislike['v_start_comment_dislike'])){
    239                         $dislikes = $vortex_like_dislike['v_start_comment_dislike'];
    240                     }
    241                     add_comment_meta($comment_ID, 'vortex_system_likes', $likes, true);
    242                     add_comment_meta($comment_ID, 'vortex_system_dislikes', $dislikes, true);
    243                 }
    244 
    245                 //add custom fields when post is published
    246                 add_action( 'publish_post', 'post_published_notification' );
    247                 function post_published_notification( $ID ) {
    248                     global $vortex_like_dislike;
    249                     $likes = 0;
    250                     $dislikes = 0;
    251                    
    252                     if(isset($vortex_like_dislike['v_start_post_like'])){
    253                         $likes = $vortex_like_dislike['v_start_post_like'];
    254                     }
    255                    
    256                     if(isset($vortex_like_dislike['v_start_post_dislike'])){
    257                         $dislikes = $vortex_like_dislike['v_start_post_dislike'];
    258                     }
    259                     add_post_meta($ID, 'vortex_system_likes', $likes, true);
    260                     add_post_meta($ID, 'vortex_system_dislikes', $dislikes, true);
    261                 }
    262             }       
    263     }   
     95                }   
    26496}
    26597
  • rating-system/trunk/readme.txt

    r1340008 r1472151  
    44Tags: like, dislike, voting, rating, upvote, downvote, ajax, interactive, widget, comments, post, posts, page, widgets, jquery, custom post type, dashbord, bbpress
    55Requires at least: 4.1
    6 Tested up to: 4.4.1
    7 Stable tag: 2.7.5
     6Tested up to: 4.5.3
     7Stable tag: 2.7.6
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1212
    1313== Description ==
    14 * ATTENTION!YOU NEED [REDUX FRAMEWORK](https://wordpress.org/plugins/redux-framework/)(FREE PLUGIN) INSTALLED AND ACTIVATED FOR THIS PLUGIN TO WORK.
    1514* Support for custom post type(WooCommerce etc). &#10004;
    1615* Support for bbPress. &#10004;
     
    2726* Shortcode [rating-system-posts](You must have turned on like or dislike for posts and pages and if you want you can disable display buttons on). &#10004;
    2827* Shortcode [rating-system-posts-disable-dislike](Displays only the like button, the above also applies here). &#10004;
    29 * Sort comments by likes. &#10004;
    3028* Check the screenshots tab we have a lot of cool features.
    3129* If you finds bugs or need support go to the support tab.
     
    108106>
    109107== Changelog ==
     108= 2.7.6 =
     109* Fixed ip and cookie tracking.
     110* Fixed custom text when voting.
     111* Removed ReduxFramework.
     112* Removed some options.
    110113= 2.7.5 =
    111114* Fixed comments rating errors.
Note: See TracChangeset for help on using the changeset viewer.