Changeset 3289489
- Timestamp:
- 05/08/2025 02:21:02 AM (11 months ago)
- Location:
- dashcommerce/trunk
- Files:
-
- 18 edited
-
dashcommerce.php (modified) (2 diffs)
-
features/diagnostics/class-diagnostics.php (modified) (5 diffs)
-
languages/dashcommerce-da_DK.mo (modified) (previous)
-
languages/dashcommerce-da_DK.po (modified) (1 diff)
-
languages/dashcommerce-de_DE.mo (modified) (previous)
-
languages/dashcommerce-de_DE.po (modified) (1 diff)
-
languages/dashcommerce-en_US.mo (modified) (previous)
-
languages/dashcommerce-en_US.po (modified) (1 diff)
-
languages/dashcommerce-es_ES.mo (modified) (previous)
-
languages/dashcommerce-es_ES.po (modified) (1 diff)
-
languages/dashcommerce-it_IT.mo (modified) (previous)
-
languages/dashcommerce-it_IT.po (modified) (1 diff)
-
languages/dashcommerce-pt_BR.mo (modified) (previous)
-
languages/dashcommerce-pt_BR.po (modified) (1 diff)
-
languages/dashcommerce.pot (modified) (1 diff)
-
options/class-account.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
tables/class-table-diagnostics.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dashcommerce/trunk/dashcommerce.php
r3286617 r3289489 12 12 * Plugin Name: DashCommerce - Support, Checkup, Optimization, AI, Reports & Analytics 13 13 * Description: Keep your website healthy and efficient with DashCommerce. 14 * Version: 1.3. 414 * Version: 1.3.5 15 15 * Author: DashCommerce 16 16 * License: GPL v2 … … 74 74 */ 75 75 function dashcommerce_load_text_domain() { 76 load_plugin_textdomain( 'dashcommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 76 $supported_languages = array(); 77 78 $language_dir = plugin_dir_path( __FILE__ ) . 'languages/'; 79 80 if ( is_dir( $language_dir ) ) { 81 $files = scandir( $language_dir ); 82 83 foreach ( $files as $file ) { 84 $is_mo_language_file = preg_match( '/^dashcommerce-([a-z]{2}_[A-Z]{2})\.po$/', $file, $matches ); 85 86 $locale = $matches[1]; 87 88 $language_code = explode( '_', $locale )[0]; 89 90 if ( $is_mo_language_file ) { 91 $supported_languages[ $language_code ] = 'languages/dashcommerce-' . $locale . '.mo'; 92 } 93 } 94 } 95 96 $current_language = explode( '_', get_locale() )[0]; // Extract base language (e.g., 'en', 'pt'). 97 98 $target_language = 'en'; 99 100 if ( array_key_exists( $current_language, $supported_languages ) ) { 101 $target_language = $current_language; 102 } 103 104 $target_file = plugin_dir_path( __FILE__ ) . $supported_languages[ $target_language ]; 105 106 load_textdomain( 'dashcommerce', $target_file ); 77 107 } 78 108 -
dashcommerce/trunk/features/diagnostics/class-diagnostics.php
r3286617 r3289489 210 210 </div> 211 211 212 <!-- this modal will be used for brazilian users only -->213 212 <div id="dashcommerce-diagnostics-phone-modal" class="dashcommerce-modal"> 214 213 <div class="dashcommerce-modal-content" style="position: relative;"> … … 262 261 <div style="height: 140px; display: flex; flex-grow: 1; flex-basis: 0; padding: 20px;"> 263 262 <?php 264 $diagnosis_list = $this->db->get_diagnosis_list( 1 ); 265 266 if ( isset( $diagnosis_list ) && isset( $diagnosis_list[0] ) ) { 267 $last_diagnosis = $diagnosis_list[0]; 268 263 $last_diagnosis = $this->db->get_latest_diagnosis(); 264 265 if ( isset( $last_diagnosis ) ) { 269 266 $score = $last_diagnosis['score']; 270 267 … … 303 300 304 301 <div style="display: flex; flex-direction: column; justify-content: center; align-items: center; flex: 0 0 auto; padding-top: 20px;"> 305 <div> 306 <?php esc_html_e( 'DIAGNOSE_NOW_DESC', 'dashcommerce' ); ?> 307 </div> 308 309 <button class="button dashcommerce-button" id="dashcommerce-diagnostics-request-diagnosis" style="margin: 10px 0;"> 310 <?php esc_html_e( 'DIAGNOSE_NOW', 'dashcommerce' ); ?> 311 </button> 302 <?php 303 if ( $this->check_diag_older_12h( $last_diagnosis ) ) { 304 ?> 305 <div> 306 <?php esc_html_e( 'DIAGNOSE_NOW_DESC', 'dashcommerce' ); ?> 307 </div> 308 309 <button class="button dashcommerce-button" id="dashcommerce-diagnostics-request-diagnosis" style="margin: 10px 0;"> 310 <?php esc_html_e( 'DIAGNOSE_NOW', 'dashcommerce' ); ?> 311 </button> 312 <?php 313 } else { 314 ?> 315 <div> 316 <?php esc_html_e( 'DIAGNOSE_NOW_DESC_CANNOT', 'dashcommerce' ); ?> 317 </div> 318 319 <button class="button dashcommerce-button" id="dashcommerce-diagnostics-request-diagnosis" style="margin: 10px 0;" disabled title="<?php esc_html_e( 'DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP', 'dashcommerce' ); ?>"> 320 <?php esc_html_e( 'DIAGNOSE_NOW', 'dashcommerce' ); ?> 321 </button> 322 <?php 323 } 324 ?> 312 325 313 326 <div> … … 600 613 601 614 /** 602 * Returns an assoc with the score history .615 * Returns an assoc with the score history for the chart. 603 616 */ 604 617 public function get_score_history() { … … 915 928 wp_die(); 916 929 } 930 931 /** 932 * Checks if a diagnosis is older than 12 hours. 933 * 934 * @param array $diagnosis The diagnosis assoc. 935 * 936 * @return bool 937 */ 938 private function check_diag_older_12h( $diagnosis ) { 939 if ( ! isset( $diagnosis ) || ! isset( $diagnosis['id'] ) ) { 940 return true; 941 } 942 943 $now_gmt = time(); 944 945 $diag_time_gmt = (int) $diagnosis['id']; 946 947 $twelve_hours_ago_gmt = $now_gmt - ( 12 * 60 * 60 ); 948 949 return $diag_time_gmt < $twelve_hours_ago_gmt; 950 } 917 951 } 918 952 -
dashcommerce/trunk/languages/dashcommerce-da_DK.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Modtag via WhatsApp" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "Du har allerede diagnosticeret din hjemmeside i de sidste 12 timer. Kom tilbage senere for at udføre en anden Health Check." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "Du kan udføre en Health Check hver 12. time." -
dashcommerce/trunk/languages/dashcommerce-de_DE.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Über WhatsApp erhalten" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "Sie haben Ihre Website in den letzten 12 Stunden bereits diagnostiziert. Kommen Sie später zurück, um einen weiteren Health Check durchzuführen." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "Sie können alle 12 Stunden einen Health Check durchführen." -
dashcommerce/trunk/languages/dashcommerce-en_US.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Receive via WhatsApp" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "You have already diagnosed your site in the last 12 hours. Please come back later to perform another Health Check." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "You can perform a Health Check every 12 hours." -
dashcommerce/trunk/languages/dashcommerce-es_ES.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Recibir por WhatsApp" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "Ya has diagnosticado tu sitio en las últimas 12 horas. Vuelve más tarde para realizar otro chequeo de salud." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "Puedes realizar un chequeo de salud cada 12 horas." -
dashcommerce/trunk/languages/dashcommerce-it_IT.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Ricevi su WhatsApp" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "Hai già diagnosticato il tuo sito nelle ultime 12 ore. Torna più tardi per eseguire un altro controllo sanitario." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "Puoi eseguire un controllo sanitario ogni 12 ore." -
dashcommerce/trunk/languages/dashcommerce-pt_BR.po
r3275268 r3289489 720 720 msgid "RECEIVE_VIA_WHATSAPP" 721 721 msgstr "📞 Receber no WhatsApp" 722 723 msgid "DIAGNOSE_NOW_DESC_CANNOT" 724 msgstr "Você já diagnosticou seu site nas últimas 12 horas. Volte mais tarde para realizar outro Health Check." 725 726 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 727 msgstr "Você pode realizar um Health Check a cada 12 horas." -
dashcommerce/trunk/languages/dashcommerce.pot
r3275268 r3289489 719 719 msgid "RECEIVE_VIA_WHATSAPP" 720 720 msgstr "" 721 722 msgid "DIAGNOSE_NOW_DESC_CANNOT" 723 msgstr "" 724 725 msgid "DIAGNOSE_NOW_DESC_CANNOT_TOOLTIP" 726 msgstr "" -
dashcommerce/trunk/options/class-account.php
r3275268 r3289489 148 148 global $dashcommerce_table_diagnostics; 149 149 150 $diagnosis_list = $dashcommerce_table_diagnostics->get_diagnosis_list( 1 ); 151 152 if ( isset( $diagnosis_list ) && isset( $diagnosis_list[0] ) ) { 153 $last_diagnosis = $diagnosis_list[0]; 154 150 $last_diagnosis = $dashcommerce_table_diagnostics->get_latest_diagnosis(); 151 152 if ( isset( $last_diagnosis ) ) { 155 153 $last_diag_score = $last_diagnosis['score']; 156 154 $last_diag_data = $last_diagnosis['content']; … … 184 182 ); 185 183 186 $a = $this->backend->register_activation( $data ); 187 188 null; 184 $this->backend->register_activation( $data ); 189 185 } 190 186 -
dashcommerce/trunk/readme.txt
r3286617 r3289489 4 4 Requires at least: WordPress 5.0 5 5 Tested up to: 6.8 6 Stable tag: 1.3. 46 Stable tag: 1.3.5 7 7 Requires PHP: 7.0.0 8 8 License: GPL v2 -
dashcommerce/trunk/tables/class-table-diagnostics.php
r3275268 r3289489 124 124 $row['content'] = json_decode( $row['content'], true ); 125 125 126 $latest = $this->get_ diagnosis_list( 1 )[0];126 $latest = $this->get_latest_diagnosis(); 127 127 128 128 if ( $latest['id'] === $row['id'] ) { … … 175 175 return 0 === $results || '0' === $results; 176 176 } 177 178 /** 179 * Gets the latest diagnosis. 180 * 181 * @return array|null An associative array with the list of diagnosis, each having the fields `id` and `score` 182 */ 183 public function get_latest_diagnosis() { 184 $list = $this->get_diagnosis_list( 1 ); 185 186 if ( ! isset( $list ) || ! isset( $list[0] ) ) { 187 return null; 188 } 189 190 return $list[0]; 191 } 177 192 } 178 193
Note: See TracChangeset
for help on using the changeset viewer.