Plugin Directory

Changeset 2069172


Ignore:
Timestamp:
04/16/2019 08:00:42 AM (7 years ago)
Author:
avisverifies
Message:

Version: 2.0.0 / 15/04/2019

  • Fix Back-office and template
  • Additional Rich Snippets code (Review)
  • Bug Correction in Back-office
Location:
netreviews/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • netreviews/trunk/changelog.txt

    r2057037 r2069172  
     1Version: 2.0.0 / 15/04/2019
     2- Fix Back-office and template
     3- Additional Rich Snippets code (Review)
     4- Bug Correction in Back-office
     5
     6
    17Version: 1.9.5 / 18/03/2019
    28- Back-office user and translations fix
  • netreviews/trunk/functions.php

    r2057037 r2069172  
    55function ntav_update_version_plugin()
    66{
    7     ntav_updateValue('MODVERSION', '1.9.5');
     7    ntav_updateValue('MODVERSION', '2.0.0');
    88}
    99
     
    698698        `name` varchar(25) NOT NULL,
    699699        `value` text NOT NULL,
    700         `lang_code` varchar(100),
     700        `lang_code` varchar(25),
    701701        PRIMARY KEY (`id`)
    702702        ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=25");
     
    10921092    return $listImgBo;
    10931093}
     1094
     1095
     1096/**
     1097 * We retrieve the info for the "Review" Property (Rich Snippets)
     1098 * @return array (Reviews)
     1099 */
     1100function ntav_getReviewsRS($idproduct){
     1101        global $wpdb;
     1102        $WpmlEnable = ntav_getWpmlEnable();
     1103        if($WpmlEnable == 'yes'){
     1104            $my_current_lang = apply_filters( 'wpml_current_language', NULL );
     1105        } else {$my_current_lang='';}
     1106
     1107        $query = $wpdb->get_results("SELECT customer_name,DATE_FORMAT(FROM_UNIXTIME(horodate), '%d-%m-%Y') as Newhorodate,review,rate FROM " . $wpdb->prefix . "netreviews_products_reviews WHERE ref_product = $idproduct and lang = '$my_current_lang' ORDER BY horodate DESC LIMIT 0,5");
     1108    return $query;
     1109}
  • netreviews/trunk/i18n/languages/av-de_DE.po

    r2051358 r2069172  
    404404msgid "Are you using WPML plugin?"
    405405msgstr "Nutzen Sie das WPML Plugin aus?"
     406
     407msgid "Please, insert your secret key and website id, corresponding to the backoffice of each shop language."
     408msgstr "Bitte überprüfen Sie Ihren Kundenbereich in der Sprache, die Sie konfigurieren möchten, um Ihre Anmeldedaten anzuzeigen."
  • netreviews/trunk/i18n/languages/av-es_ES.po

    r2051358 r2069172  
    409409msgid "Are you using WPML plugin?"
    410410msgstr "¿Utiliza el plugin WPML?"
     411
     412msgid "Please, insert your secret key and website id, corresponding to the backoffice of each shop language."
     413msgstr "Por favor, inserte la clave secreta y el idwebsite correspondiente al back-office de cada lengua"
  • netreviews/trunk/i18n/languages/av-fr_FR.po

    r2051358 r2069172  
    422422msgid "Are you using WPML plugin?"
    423423msgstr "Est-ce que vous utilisez le plugin WPML?"
     424
     425msgid "Please, insert your secret key and website id, corresponding to the backoffice of each shop language."
     426msgstr "S'il vous plait, inserer le idwebsite et secretkey de la plataforme Avis Verifies que vous voulez configurer"
  • netreviews/trunk/i18n/languages/av-it_IT.po

    r2057037 r2069172  
    409409msgid "Are you using WPML plugin?"
    410410msgstr "Usi un plugin WPML?"
     411
     412msgid "Please, insert your secret key and website id, corresponding to the backoffice of each shop language."
     413msgstr "Per favore, inserisci chiave segreta ed id website corrispondenti al backoffice della lingua di ciascun shop."
  • netreviews/trunk/i18n/languages/av-pt_PT.po

    r2051358 r2069172  
    439439msgid "Are you using WPML plugin?"
    440440msgstr "Você está usando o plugin WPML?"
     441
     442msgid "Please, insert your secret key and website id, corresponding to the backoffice of each shop language."
     443msgstr "Por favor verifique no seu espaço cliente a língua que deseja utilizar para o seu acesso."
  • netreviews/trunk/includes/av_backoffice.php

    r2057037 r2069172  
    77require_once(ABSPATH . 'wp-admin/admin.php');
    88require_once(ABSPATH . 'wp-admin/admin-header.php');
     9
     10ntav_columns_if_not_exists();
     11
    912global $wc_product_attributes;
    1013$av_link = wp_upload_dir();
     
    8386<?php
    8487$WPML_config = '';
     88$s_keyArray = array();
     89$id_webArray = array();
    8590
    8691if(is_plugin_active('wpml-string-translation/plugin.php') && is_plugin_active('wpml-translation-management/plugin.php')){
     
    172177if($wpmlActive == 'yes'){
    173178
    174     $s_keyArray = array();
    175     $id_webArray = array();
     179
     180
    176181    foreach ($WPML_config as $key => $value) {
    177182
     
    325330
    326331      <?php if(!empty($WPML_config)){ echo '<label class="WPMLConfig">'; _e('Are you using WPML plugin?','av'); echo '</label>'; ?>
     332
    327333        <div class="items form-group">
     334
    328335
    329336        <input id="yesWPML" type="radio" name="WPML" value="yes" <?php if($wpmlActive !=NULL && $wpmlActive=='yes'): echo 'checked' ; endif; ?> onclick="displayWPML()" /><?php _e('Yes', 'av'); ?>
     
    332339        </div>
    333340        <?php } ?>
     341
    334342        <?php if(!empty($WPML_config)) :?>
     343
     344            <u><p class="paragraphsecretkeyWpml"><?php _e('Please, insert your secret key and website id, corresponding to the backoffice of each shop language.', 'av'); ?></p></u>         
     345                     
     346                       
    335347       <?php foreach ($WPML_config as $key => $value) { ?>
    336                 <?php $lang = explode(".", $value);?>
     348
     349                <?php $lang = explode(".", $value); ?>
    337350           <div class="elem divsecretkeyWPML" style="display: none;">
    338                     <p class="paragraphsecretkey"><?php _e('Please check your customer area on ', 'av');
    339                         echo " <b>";
    340                         _e('verified-reviews.co.uk', 'av');
    341                         echo "</b> ";
    342                         _e(' to see your login data.', 'av'); ?></p>
    343                    
     351 
    344352                    <div class="form-group">
    345353                        <label for="s_key"><b><?php _e('Secret Key : ', 'av'); ?></b></label><input
     
    677685            }
    678686            elementWithoutWPML.style.display="none";
     687            document.getElementsByClassName('paragraphsecretkeyWpml')[0].style.display = "block";
    679688        }
    680689
     
    689698        }
    690699        wpmlConfigButton.style.display = "block";
     700        document.getElementsByClassName('paragraphsecretkeyWpml')[0].style.display = "none";
    691701        }
    692702    }
  • netreviews/trunk/includes/av_product_tab.php

    r2051358 r2069172  
    66if($WpmlEnable == 'yes'){
    77$my_current_lang = apply_filters( 'wpml_current_language', NULL );
     8}
     9else{
     10    $my_current_lang ='';
    811}
    912// On calcule l'url à utiliser pour la fonctionnalité Avis Utile (API)
     
    3538$getNote = round(ntav_get_netreviews_average($id_product, $my_current_lang), 1);
    3639$countByRate = ntav_get_netreviews_countByRate($id_product,$my_current_lang);
    37 
    3840
    3941
     
    119121    <input type="hidden" id="av_id_product" value="<?php echo $id_product ?>"/>
    120122    <input type="hidden" id="avisVarifiesAjaxUrl" value="<?php echo $avisAjaxUrl ?>"/>
    121     <input type="hidden" id="wpml_Lang" value = "<?php echo $my_current_lang?>">
     123    <input type="hidden" id="wpml_Lang" value = "<?php echo $my_current_lang?>"/>
    122124
    123125
     
    264266        </script>
    265267
    266     </div> <!-- end netreviews tab -->
    267 
    268 
     268    </div>
     269</div> <!-- end netreviews tab -->
    269270
    270271    <!-- NETREVIEWS - END -->
  • netreviews/trunk/includes/css/av_backoffice.css

    r2051358 r2069172  
    540540}
    541541
     542.panelaccordionconfig .paragraphsecretkeyWpml {
     543font-size: 17px;
     544}
     545
    542546.panelaccordionconfig .infos {
    543547    margin-left: 1%;
  • netreviews/trunk/netreviews.php

    r2057037 r2069172  
    11<?php
     2
    23
    34/**
     
    89 * Description: We provide you with a solution that enables you to collect customer reviews about your website and products which will show on your
    910 * website and on a attestation which will increase the credibility of published reviews.
    10  * Version: 1.9.5
     11 * Version: 2.0.0
    1112 * Author: NetReviews SAS <contact@avis-verifies.com>
    1213 * Author URI: www.avis-verifies.com
     
    411412function ntav_netreviews_loop_rating()
    412413{
    413    
    414     $my_current_lang = apply_filters( 'wpml_current_language', NULL );
     414 
    415415    global $product;
     416    $WpmlEnable = ntav_getWpmlEnable();
     417
    416418    // Si on recupere le produit et que le module est actif
    417419    if (isset($product) && ntav_getConfig('IS_ACTIVE','non') == 1) {
     420
     421$id_product = $product->get_id();
     422if($WpmlEnable == 'yes'){
     423global $sitepress;
     424$id_product = icl_object_id( get_the_id(), 'post', true, $sitepress->get_default_language() ); //Will display the ID of the original post for WPML plugin
     425$my_current_lang = apply_filters( 'wpml_current_language', NULL );
     426}
     427else{
     428    $my_current_lang  = '';
     429}
     430 
    418431        // recuperation de la moyenne d'avis
    419         $average = ntav_get_netreviews_average($product->get_id(),$my_current_lang);
     432        $average = ntav_get_netreviews_average($id_product,$my_current_lang);
    420433        $stars = ntav_addStars($average);
    421434
     
    439452add_action('netreviews_product_rating', 'ntav_netreviews_product_rating');
    440453add_action('woocommerce_single_product_summary', 'ntav_netreviews_product_rating', 31);
     454
     455$WpmlEnable = ntav_getWpmlEnable();
     456
     457if($WpmlEnable == 'yes'){
    441458$my_current_lang = apply_filters( 'wpml_current_language', NULL );
     459}else{$my_current_lang = '';}
    442460
    443461// fonction affichant les étoiles dans la description rapide et rajoute des rich snippet produit si c'est configure (activation rich snippet et microdata selectionne)
    444462function ntav_netreviews_product_rating()
    445463{
     464
    446465global $product;
    447466global $sitepress;
    448467
    449468$WpmlEnable = ntav_getWpmlEnable();
     469
     470   
     471    if (isset($product) && ntav_getConfig('IS_ACTIVE','non') == 1) {
    450472
    451473$id_product = $product->get_id();
     
    454476$my_current_lang = apply_filters( 'wpml_current_language', NULL );
    455477}
    456 
    457 
    458    
    459     if (isset($product) && ntav_getConfig('IS_ACTIVE','non') == 1) {
    460         $count = ntav_get_netreviews_count($id_product,$my_current_lang);
    461         $average = ntav_get_netreviews_average($id_product,$my_current_lang);
     478else{$my_current_lang='';}
     479
     480        $id = get_permalink($product->get_id());
     481        $count = ntav_get_netreviews_count($id_product, $my_current_lang);
     482        $average = ntav_get_netreviews_average($id_product, $my_current_lang);
    462483        $stars = ntav_addStars($average);
    463 
     484        $reviews = ntav_getReviewsRS($id_product);
    464485        if (!empty($average)) {
    465486
     
    482503                    $html .= ' <meta itemprop="bestRating" content="5"/>';
    483504                    $html .= '</span>';
     505                        foreach ($reviews as $value) {
     506                            $html .= '<div itemprop="review" itemscope itemtype="http://schema.org/Review">';
     507                            $html .= '<span itemprop="author" content="'. urldecode($value->customer_name).'"></span>';
     508                            $html .= '<meta itemprop="datePublished" content="'. $value->Newhorodate .'"> </meta>';
     509                            $html .= ' <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">';
     510                                $html .= '<meta itemprop="worstRating" content = "1">';
     511                                $html .= '<meta itemprop="ratingValue" content ="'.$value->rate.'"></meta>';
     512                                $html .= '<meta itemprop="bestRating" content = "5">';
     513                            $html .= ' </div>';
     514                            $html .= '<meta itemprop="description" content= "'.urldecode($value->review).'"> </meta>';
     515                             $html .= '</div>';
     516                        }
    484517                    $html .= '<div class="netreviewsclear"></div>';
    485518                    $html .= '</div>';
     
    514547function ntav_netreviews_jsonld_product($product = null)
    515548{
    516 $my_current_lang = apply_filters( 'wpml_current_language', NULL );
     549global $sitepress;
     550
     551$WpmlEnable = ntav_getWpmlEnable();
     552
     553
    517554
    518555    if (!is_object($product)) {
     
    520557    }
    521558    if (!empty($product) && (is_object($product))) {
    522         $id = get_permalink($product->get_id());
    523         $count = ntav_get_netreviews_count($product->get_id(),$my_current_lang);
    524         $average = ntav_get_netreviews_average($product->get_id(),$my_current_lang);
     559
     560        $id_product = $product->get_id();
     561        if($WpmlEnable == 'yes'){
     562        $id_product = icl_object_id( get_the_id(), 'post', true, $sitepress->get_default_language() ); //Will display the ID of the original post for WPML plugin
     563        $my_current_lang = apply_filters( 'wpml_current_language', NULL );
     564        }else {$my_current_lang = '';}
     565        $id = get_permalink($id_product);
     566        $count = ntav_get_netreviews_count($id_product,$my_current_lang);
     567        $average = ntav_get_netreviews_average($id_product, $my_current_lang);
     568        $reviews = ntav_getReviewsRS($id_product);
     569
     570        $i=0;
    525571        $markup = '';
    526572        if ($count > 0 && $average > 0) {
     
    535581            $markup .= '"ratingCount":"' . $count . '",';
    536582            $markup .= '"reviewCount":"' . $count . '"';
    537             $markup .= '}';
     583            $markup .= '},';
     584            $markup .= '"review":[';
     585       
     586            foreach ($reviews as $value) {
     587                $markup .= '{';
     588                $markup .= '"@type":"Review",';
     589                $markup .= '"author":"'. urldecode($value->customer_name) .'",';
     590                $markup .= '"datePublished":"'. $value->Newhorodate .'",';
     591                $markup .= '"description":"'. urldecode($value->review) .'",';
     592                  $markup .= '"reviewRating":';
     593                    $markup .= '{';
     594                        $markup .= '"@type":"Rating",';
     595                        $markup .= '"bestRating": "5",';
     596                        $markup .= '"ratingValue":"' . $value->rate . '",';
     597                        $markup .= '"worstRating": "1"';
     598                    $markup .= '}';
     599                      $i++;
     600                      if($i != count($reviews)){
     601                             $markup .= '},';
     602                        }
     603                        else{
     604                            $markup .= '}';
     605                        }
     606            }
     607              $markup .=']';
    538608            $markup .= '}';
    539609            $markup .= '</script>';
    540610        }
     611
     612
    541613        echo $markup;
    542614    }
     
    593665{
    594666    global $wpdb;
    595     $my_current_lang = apply_filters( 'wpml_current_language', NULL );
    596 
     667    $WpmlEnable = ntav_getWpmlEnable();
     668if($WpmlEnable == 'yes'){
     669$my_current_lang = apply_filters( 'wpml_current_language', NULL );
     670}else{$my_current_lang = '';}
     671   
    597672    if (ntav_getConfig('SCRIPTFLOAT_ALLOWED',$my_current_lang) == 'yes') {
    598673        $widget = ntav_get_widget_floating();
     
    689764    }
    690765
     766     // Ajouter lang_code sur Table config (WPML)
     767    $result4 = $wpdb->get_results("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA =  '" . $wpdb->dbname . "' AND TABLE_NAME =  '" . $wpdb->prefix . "netreviews_configuration' AND COLUMN_NAME =  'lang_code'");
     768    if(empty($result4)){
     769         $wpdb->query("ALTER TABLE " . $wpdb->prefix . "netreviews_configuration ADD  (`lang_code` varchar(25));");
     770    }
     771
    691772}
    692773
  • netreviews/trunk/readme.txt

    r2057037 r2069172  
    5757
    5858== Changelog ==
     59
     60Version: 2.0.0 / 15/04/2019
     61- Fix Back-office and template
     62- Additional Rich Snippets code (Review)
     63- Bug Correction in Back-office
     64
    5965
    6066Version: 1.9.5 / 18/03/2019
Note: See TracChangeset for help on using the changeset viewer.