Plugin Directory

Changeset 3140987


Ignore:
Timestamp:
08/25/2024 08:13:28 AM (7 months ago)
Author:
mjplugins2
Message:

Version 0.0.5

Location:
better-business-reviews
Files:
34 added
11 edited

Legend:

Unmodified
Added
Removed
  • better-business-reviews/trunk/admin/css/settings.css

    r3124390 r3140987  
    4949}
    5050
    51 .brtpmj_input{
    52     min-width: 95%;
    53     width: 95%;
     51.brtpmj_input {
     52    min-width: 75%;
     53    width: 75%;
    5454    border-radius: 0 !important;
    55 }
     55  }
    5656
    5757#brtpmj_admin_sync_progress{
     
    6666    color: forestgreen;
    6767}
     68.brtpmj_adm_btn {
     69    background: #00b67a;
     70    border: none;
     71    color: #fff;
     72    padding: 0px 10px;
     73    height: 30px;
     74    cursor: pointer;
     75  }
     76  #license_key_better-business-revi {
     77    min-width: 75%;
     78    width: 75%;
     79    border-radius: 0 !important;
     80    background: #fff;
     81    border: 1px solid #8c8f94;
     82    height: 30px;
     83  }
     84  .brtpmj_btn, #brtpmj_activate_license {
     85    border: none;
     86    color: #fff;
     87    background: #207196;
     88    height: 30px;
     89    padding: 0 20px;
     90    cursor: pointer;
     91  }
     92  .brtpmj_shortcode {
     93    background: #fff;
     94    padding: 5px 10px;
     95  }
     96  .brtpmj_info {
     97    padding-top: 20px;
     98    display: flex;
     99  }
     100
     101  .brtpmj_get_pro {
     102    color: #fff;
     103    text-decoration: none;
     104    float: right;
     105    background: #207196;
     106    padding: 10px 20px;
     107    font-size: 16px;
     108    margin: -7.5px;
     109  }
     110  .brtpmj_get_pro:hover {
     111    background: #00b67a;
     112    color: #fff;
     113  }
  • better-business-reviews/trunk/admin/settings.php

    r3124390 r3140987  
    2323                    ?>
    2424                    <div class="brtpmj_setting-container">
    25                    
    26                         <h2 class="brtpmj_admin_heading">General Settings</h2>
    27                        
    28                         <p style="text-align: center;"> Use Shortcode <strong>[brtpmj_reviews]</strong> to load reviews from the below business profile.</p>
    29                        
     25                        <h2 class="brtpmj_admin_heading">General Settings <a href="https://mediajedi.com/product/trust-pilot-wordpress-plugin/" class="brtpmj_get_pro" target="_blank">Display More Reviews with PRO Plugin</a></h2>
    3026                        <div class="brtpmj_inner-container">
    3127                            <div class="brtpmj_col-1">
     
    3531                                <?php $brtpmj_url = get_option('brtpmj_url'); ?>
    3632                                <input type="text" name="brtpmj_url" id="brtpmj_url" class="brtpmj_input" value="<?php echo esc_url( $brtpmj_url ); ?>">
     33                                <input type="submit" name="brtpmj_settings_submit" class="brtpmj_adm_btn" value="Fetch Your Reviews"/>
     34                                <div class="brtpmj_info">
     35                                    <span id="brtpmj_admin_sync_progress"><img src="<?php echo esc_url( $brtpmj_plugin_url ); ?>/assets/bbr-loading-icon.gif"> Fetching Your Reviews...</span>
     36                                    <span id="brtpmj_admin_sync_status"></span>
     37                                </div>
    3738                            </div>                             
    3839                        </div>
    39                        
    40                     </div>
    41                    
    42                     <div class="brtpmj_admin_save">
    43                         <input type="submit" name="brtpmj_settings_submit" class="button-primary" value="Sync"/>
    44                         <span id="brtpmj_admin_sync_progress"><img src="<?php echo esc_url( $brtpmj_plugin_url ); ?>/assets/bbr-loading-icon.gif"> Fetching Your Reviews...</span>
    45                         <span id="brtpmj_admin_sync_status"></span>
    4640                    </div>
    4741                </form>
     42            </div>
     43            <div class="brtpmj_setting-container">
     44           
     45                <h2 class="brtpmj_admin_heading">Shortcodes</h2>
     46                <div class="brtpmj_inner-container">
     47                    <div class="brtpmj_col-1">
     48                        <label>List Layout (Default)</label>   
     49                    </div>
     50                    <div class="brtpmj_col-2">
     51                    <span class="brtpmj_shortcode">[brtpmj_reviews]</span>
     52                    </div>                             
     53                </div>
     54                <div class="brtpmj_inner-container">
     55                    <div class="brtpmj_col-1">
     56                        <label>Grid Layout</label> 
     57                    </div>
     58                    <div class="brtpmj_col-2">
     59                    <span class="brtpmj_shortcode">[brtpmj_reviews layout="grid"]</span>
     60                    </div>                             
     61                </div>
     62                <div class="brtpmj_inner-container">
     63                    <div class="brtpmj_col-1">
     64                        <label>Carousel Layout</label> 
     65                    </div>
     66                    <div class="brtpmj_col-2">
     67                    <span class="brtpmj_shortcode">[brtpmj_reviews layout="carousel"]</span>
     68                    </div>                             
     69                </div>
     70                <div class="brtpmj_inner-container">
     71                    <div class="brtpmj_col-1">
     72                        <label>Post Limit (PRO)</label>
     73                    </div>
     74                    <div class="brtpmj_col-2">
     75                        <span class="brtpmj_shortcode">[brtpmj_reviews limit="8"]</span>
     76                    </div>                             
     77                </div>
     78                <div class="brtpmj_inner-container">
     79                    <div class="brtpmj_col-1">
     80                        <label>Minimum Stars (PRO)</label> 
     81                    </div>
     82                    <div class="brtpmj_col-2">
     83                        <span class="brtpmj_shortcode">[brtpmj_reviews min_stars="4"]</span>
     84                    </div>                             
     85                </div>
    4886            </div>
    4987        </div>
  • better-business-reviews/trunk/admin/sync.php

    r3124390 r3140987  
    3434                $args = array(
    3535                    "method"            => "GET",
    36                     "timeout"           => 10,
     36                    "timeout"           => 20,
    3737                    "Referrer Policy"   => "origin-when-cross-origin",
    3838                    "headers" => array(
     
    5353                        $data = json_decode($response['body']);
    5454                       
    55                         $pageProps = $data->pageProps;
     55                        if(isset($data->pageProps)){
    5656                       
    57                         // busines unit
    58                         $unit               = $pageProps->businessUnit;
    59                         $displayName        = sanitize_text_field( $unit->displayName );
    60                         $identifyingName    = sanitize_text_field( $unit->identifyingName );
    61                         $numberOfReviews    = sanitize_text_field( $unit->numberOfReviews );
    62                         $score              = sanitize_text_field( $unit->trustScore );
    63                         $profileImageUrl    = sanitize_text_field( $unit->profileImageUrl );
    64                         $stars              = sanitize_text_field( $unit->stars );
    65                        
    66                         // Add to options
    67                         update_option('brtpmj_bu_displayname', $displayName);
    68                         update_option('brtpmj_bu_identifyingname', $identifyingName);
    69                         update_option('brtpmj_bu_numberofreviews', $numberOfReviews);
    70                         update_option('brtpmj_bu_score', $score);
    71                         update_option('brtpmj_bu_profileimageurl', $profileImageUrl);
    72                         update_option('brtpmj_bu_stars', $stars);
    73                        
    74                         // Reviews - insert custom posts
    75                         $reviews = $pageProps->reviews;
    76                        
    77                         if(is_array($reviews)){
     57                            $pageProps = $data->pageProps;
    7858                           
    79                             $reversed_array_reviews = array_reverse($reviews);
     59                            // busines unit
     60                            $unit               = $pageProps->businessUnit;
     61                            $displayName        = sanitize_text_field( $unit->displayName );
     62                            $identifyingName    = sanitize_text_field( $unit->identifyingName );
     63                            $numberOfReviews    = sanitize_text_field( $unit->numberOfReviews );
     64                            $score              = sanitize_text_field( $unit->trustScore );
     65                            $profileImageUrl    = sanitize_text_field( $unit->profileImageUrl );
     66                            $stars              = sanitize_text_field( $unit->stars );
    8067                           
    81                             // let's remove past entries first
    82                             $current_reviews = get_posts(array(
    83                                 'numberposts'   =>  -1,
    84                                 'status'        => 'any',
    85                                 'post_type'     =>  'brtpmj_review'
    86                             ));
    87                             foreach($current_reviews as $cr){
    88                                 wp_delete_post($cr->ID, true);
    89                             }
     68                            // Add to options
     69                            update_option('brtpmj_bu_displayname', $displayName);
     70                            update_option('brtpmj_bu_identifyingname', $identifyingName);
     71                            update_option('brtpmj_bu_numberofreviews', $numberOfReviews);
     72                            update_option('brtpmj_bu_score', $score);
     73                            update_option('brtpmj_bu_profileimageurl', $profileImageUrl);
     74                            update_option('brtpmj_bu_stars', $stars);
    9075                           
    91                             // insert new reviews
    92                             $inserted = 0;
     76                            // Reviews - insert custom posts
     77                            $reviews = $pageProps->reviews;
    9378                           
    94                             foreach($reversed_array_reviews as $review){
    95                                 $title      = sanitize_text_field( $review->title );
    96                                 $text       = sanitize_text_field( $review->text );
    97                                 $rating     = sanitize_text_field( $review->rating );
     79                            if(is_array($reviews)){
    9880                               
    99                                 $reviewDate = date('Y-m-d', strtotime( sanitize_text_field( $review->dates->publishedDate ) ));
     81                                $reversed_array_reviews = array_reverse($reviews);
    10082                               
    101                                 $consumer   = $review->consumer;
    102                                 $cName      = sanitize_text_field( $consumer->displayName );
    103                                 $cimage     = sanitize_text_field( $consumer->imageUrl );
    104                                
    105                                 $initials_img = '';
    106                                 if(!$cimage || $cimage == ''){
    107                                     preg_match_all('/\b\w/', $cName, $matches);
    108                                     $initials_img = '<span>' . implode( $matches[0] ) . '</span>';
    109                                 }
    110                                 else{
    111                                     $initials_img = '<img src="' . $cimage . '">';
     83                                // let's remove past entries first
     84                                $current_reviews = get_posts(array(
     85                                    'numberposts'   =>  -1,
     86                                    'status'        => 'any',
     87                                    'post_type'     =>  'brtpmj_review'
     88                                ));
     89                                foreach($current_reviews as $cr){
     90                                    wp_delete_post($cr->ID, true);
    11291                                }
    11392                               
    114                                 $post_args = array(
    115                                     'post_title'    =>  $title,
    116                                     'post_type'     =>  'brtpmj_review',
    117                                     'post_status'   =>  'publish',
    118                                     'post_content'  =>  $text
    119                                 );
     93                                // insert new reviews
     94                                $inserted = 0;
    12095                               
    121                                 $id = wp_insert_post($post_args);
    122                                
    123                                 if(!is_wp_error($id)){
     96                                foreach($reversed_array_reviews as $review){
     97                                    $title      = sanitize_text_field( $review->title );
     98                                    $text       = sanitize_text_field( $review->text );
     99                                    $rating     = sanitize_text_field( $review->rating );
    124100                                   
    125                                     update_post_meta($id, 'rating', $rating);
    126                                     update_post_meta($id, 'reviewDate', $reviewDate);
    127                                     update_post_meta($id, 'cName', $cName);
    128                                     update_post_meta($id, 'cimage', $initials_img);
     101                                    $reviewDate = date('Y-m-d', strtotime( sanitize_text_field( $review->dates->publishedDate ) ));
    129102                                   
    130                                     $inserted++;
     103                                    $consumer   = $review->consumer;
     104                                    $cName      = sanitize_text_field( $consumer->displayName );
     105                                    $cimage     = sanitize_text_field( $consumer->imageUrl );
     106                                   
     107                                    $initials_img = '';
     108                                    if(!$cimage || $cimage == ''){
     109                                        preg_match_all('/\b\w/', $cName, $matches);
     110                                        $initials_img = '<span>' . implode( $matches[0] ) . '</span>';
     111                                    }
     112                                    else{
     113                                        $initials_img = '<img src="' . $cimage . '">';
     114                                    }
     115                                   
     116                                    $post_args = array(
     117                                        'post_title'    =>  $title,
     118                                        'post_type'     =>  'brtpmj_review',
     119                                        'post_status'   =>  'publish',
     120                                        'post_content'  =>  $text
     121                                    );
     122                                   
     123                                    $id = wp_insert_post($post_args);
     124                                   
     125                                    if(!is_wp_error($id)){
     126                                       
     127                                        update_post_meta($id, 'rating', $rating);
     128                                        update_post_meta($id, 'reviewDate', $reviewDate);
     129                                        update_post_meta($id, 'cName', $cName);
     130                                        update_post_meta($id, 'cimage', $initials_img);
     131                                       
     132                                        $inserted++;
     133                                       
     134                                    }
    131135                                   
    132136                                }
    133137                               
     138                                $brtpmj_res_array['success'] = 1;
     139                                $brtpmj_res_array['inserted_count'] = $inserted;
     140                               
    134141                            }
    135142                           
    136                             $brtpmj_res_array['success'] = 1;
    137                             $brtpmj_res_array['inserted_count'] = $inserted;
    138                            
     143                        }
     144                        else{
     145                            $brtpmj_res_array['error'] = __("Error getting reviews. Please make sure to enter correct profile URL.", "better-business-reviews");
    139146                        }
    140147                       
    141148                    }
    142149                    else{
    143                         $brtpmj_res_array['error'] = __("Error getting reviews. Empty Body!", "better-business-reviews");
     150                        $brtpmj_res_array['error'] = __("Error getting reviews. Empty Body! Please try again.", "better-business-reviews");
    144151                    }
    145152                   
    146153                }
    147154                else {
    148                     $brtpmj_res_array['error'] = __("Error getting reviews. No response!", "better-business-reviews");
     155                    $brtpmj_res_array['error'] = __("Error getting reviews. No response! Please try again.", "better-business-reviews");
    149156                }
    150157               
  • better-business-reviews/trunk/better-business-reviews.php

    r3127804 r3140987  
    33* Plugin Name: Better Business Reviews - Trustpilot WordPress Plugin.
    44* Description: Display your business reviews from a Trustpilot profile.
    5 * Version: 0.0.4
    6 * Author: Media Jedi
     5* Version: 0.0.5
     6* Author: Better Business Reviews
    77* Author URI: https://www.mediajedi.com/product/trust-pilot-wordpress-plugin/
    88* License: GPLv2 or later
     
    2121       
    2222        define ( 'BRTPMJ_PLUGIN_DIR', plugin_dir_path(__FILE__ ) );
    23         define ( 'BRTPMJ_PLUGIN_VER', '0.0.4' );
     23        define ( 'BRTPMJ_PLUGIN_VER', '0.0.5' );
    2424       
    2525        global $brtpmj_plugin_url, $brtpmj_api_url;
     
    8080            BRTPMJ_PLUGIN_VER
    8181        );
     82        wp_register_style(
     83            'brtpmj-grid-style',
     84            plugin_dir_url( __FILE__ ) . 'css/grid.css',
     85            [],
     86            BRTPMJ_PLUGIN_VER
     87        );
     88        wp_register_style(
     89            'brtpmj-carousel-style',
     90            plugin_dir_url( __FILE__ ) . 'css/carousel.css',
     91            [],
     92            BRTPMJ_PLUGIN_VER
     93        );
     94        wp_register_script(
     95            'brtpmj-carousel-script',
     96            plugins_url('js/carousel.js',__FILE__ ),
     97            array('jquery'),
     98            BRTPMJ_PLUGIN_VER
     99        );
    82100    }
    83101}
  • better-business-reviews/trunk/css/style.css

    r3124390 r3140987  
    4646    padding: 15px;
    4747    border-radius: 8px;
     48    break-inside: avoid;
    4849}
    4950.brtpmj_sr_author_overview{
  • better-business-reviews/trunk/readme.txt

    r3131178 r3140987  
    44Requires at least: 6.0
    55Tested up to: 6.6
    6 Stable tag: 0.0.4
     6Stable tag: 0.0.5
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    6767
    6868== Screenshots ==
    69 1. Sample reviews from a Trustpilot account
    70 2. Plugin Settings
    71 3. Importing reviews from a Trustpilot account
    72 4. Success message after import
     691. Plugin Settings
     702. List Layout
     713. Grid Layout
     724. Carousel Layout
    7373
    7474== Changelog ==
     75
     76= 0.0.5 =
     77* 2024-08-25
     78* Added grid layout.
     79* Added carousel layout.
     80* Added new setting section.
    7581
    7682= 0.0.4 =
  • better-business-reviews/trunk/shortcode.php

    r3124390 r3140987  
    1515        if( !is_admin() ){ // only run when in front-end
    1616           
     17            // parameters
     18            $layout = 'list';
     19            $container_class = '';
     20
     21            if(isset($atts['layout'])) {
     22                $layout = sanitize_text_field($atts['layout']);
     23            }
     24           
    1725            wp_enqueue_style('brtpmj-style');
    1826            wp_enqueue_script('brtpmj-script');
     27
     28            if($layout == 'grid') {
     29                $container_class = ' brtpmj_grid_container';
     30                wp_enqueue_style('brtpmj-grid-style');
     31            }
     32            if($layout == 'carousel') {
     33                $container_class = ' carousel';
     34                wp_enqueue_style('brtpmj-carousel-style');
     35                wp_enqueue_script('brtpmj-carousel-script');
     36            }
    1937           
    2038            global $brtpmj_plugin_url;
     
    5068                    $initials_img   = get_post_meta($review->ID, 'cimage', true);
    5169                   
    52                     $rvw_html .= '<div class="brtpmj_single_rvw">
     70                    $rvw_html .= '<div class="brtpmj_single_rvw' . ($layout == 'carousel' ? ' carousel-item' : '') . '">
    5371                                   
    5472                        <div class="brtpmj_sr_author_overview">
     
    90108                    </p>';
    91109                   
    92             $html .= '<div class="brtpmj_all_reviews">' . $rvw_html . '</div>';
    93            
    94                
     110            $html .= '<div class="' . ($layout == 'carousel' ? 'carousel-container': '') . '">';
     111            $html .= '<div class="brtpmj_all_reviews' . $container_class .'">' . $rvw_html . '</div>';
     112
     113            if($layout == 'carousel') {
     114                $html .= '
     115                    <div class="carousel-nav" data-index="0">
     116                        <button class="slider-btn slider-prev">&#10094;</button>
     117                        <button class="slider-btn slider-next">&#10095;</button>
     118                    </div>
     119                ';
     120            }
     121            $html .= '</div>';
    95122           
    96123            $html .= '</div>';
Note: See TracChangeset for help on using the changeset viewer.