Changeset 3049173
- Timestamp:
- 03/11/2024 01:46:41 PM (2 years ago)
- Location:
- cardealer/trunk
- Files:
-
- 7 edited
-
cardealer.php (modified) (1 diff)
-
includes/checkup/bill_class_diagnose.php (modified) (4 diffs)
-
includes/functions/functions.php (modified) (2 diffs)
-
includes/functions/health.php (modified) (4 diffs)
-
includes/help/help.php (modified) (1 diff)
-
includes/templates/template-single.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cardealer/trunk/cardealer.php
r3041283 r3049173 3 3 Plugin URI: http://cardealerplugin.com 4 4 Description: Car Dealer Plugin for Car Dealer agency. 5 Version: 4.1 35 Version: 4.14 6 6 Text Domain: cardealer 7 7 Domain Path: /language -
cardealer/trunk/includes/checkup/bill_class_diagnose.php
r3041276 r3049173 47 47 $this->plugin_slug = $plugin_slug; 48 48 $this->global_variable_has_errors = $this->bill_check_errors_today(); 49 //die(gettype($this->global_variable_has_errors)); 49 50 $this->global_variable_memory = $this->check_memory(); 50 51 $this->global_plugin_slug = $plugin_slug; 51 52 add_action("admin_notices", [$this, "show_dismissible_notification"]); 52 53 add_action("admin_notices", [$this, "show_dismissible_notification2"]); 53 add_action("admin_bar_menu", [$this, "add_site_health_link_to_admin_toolbar"], 999); 54 add_action("admin_head", [$this,"custom_help_tab"]); 54 // 2024 55 if($this->global_variable_has_errors) 56 add_action("admin_bar_menu", [$this, "add_site_health_link_to_admin_toolbar"], 999); 57 58 add_action("admin_head", [$this,"custom_help_tab"]); 55 59 $memory = $this->global_variable_memory; 56 60 if ( … … 89 93 { 90 94 try { 91 92 95 // PHP $memory["limit"] 93 96 if(!function_exists('ini_get')){ 94 97 $wpmemory["msg_type"] = "notok"; 95 return ;98 return $wpmemory; 96 99 } 97 100 else{ 98 101 $wpmemory["limit"] = (int) ini_get("memory_limit"); 99 102 } 100 101 if(!function_exists('memory_get_usage')){ 103 if (!is_numeric($wpmemory["limit"])) { 102 104 $wpmemory["msg_type"] = "notok"; 103 return; 104 } 105 else{ 106 $wpmemory["usage"] = memory_get_usage(); 107 } 108 109 if ($wpmemory["usage"] == 0) { 110 $wpmemory["msg_type"] = "notok"; 111 return; 112 } 113 else{ 114 $wpmemory["usage"] = round($wpmemory["usage"] / 1024 / 1024, 0); 115 } 116 117 /* 118 $wpmemory["usage"] = function_exists("memory_get_usage") 119 ? round(memory_get_usage() / 1024 / 1024, 0) 120 : 0; 121 */ 122 123 124 if (!defined("WP_MEMORY_LIMIT")) { 125 $wpmemory["wp_limit"] = 40; 126 define('WP_MEMORY_LIMIT', '40M'); 127 } else { 128 $wp_memory_limit = WP_MEMORY_LIMIT; 129 $wp_memory_limit = rtrim($wp_memory_limit, 'M'); 130 $wpmemory["wp_limit"] = (int) $wp_memory_limit; 131 } 132 133 105 return $wpmemory; 106 } 134 107 if ($wpmemory["limit"] > 9999999) { 135 108 // $wpmemory['msg_type'] = 'notok(5)'; … … 137 110 $wpmemory["wp_limit"] / 1024 / 1024; 138 111 } 139 112 // usage 113 if(!function_exists('memory_get_usage')){ 114 $wpmemory["msg_type"] = "notok"; 115 return $wpmemory; 116 } 117 else{ 118 $wpmemory["usage"] = memory_get_usage(); 119 } 140 120 if ($wpmemory["usage"] < 1) { 141 121 $wpmemory["msg_type"] = "notok"; 142 return; 143 } 144 145 /* 146 if (!defined("WP_MEMORY_LIMIT")) { 147 $wpmemory["msg_type"] = "notok"; 148 return; 149 } 150 151 $wpmemory["wp_limit"] = trim(WP_MEMORY_LIMIT); 152 153 if ($wpmemory["wp_limit"] > 9999999) { 154 $wpmemory["wp_limit"] = $wpmemory["wp_limit"] / 1024 / 1024; 155 } 156 */ 157 158 159 122 return $wpmemory; 123 } 124 else{ 125 $wpmemory["usage"] = round($wpmemory["usage"] / 1024 / 1024, 0); 126 } 160 127 if (!is_numeric($wpmemory["usage"])) { 161 128 $wpmemory["msg_type"] = "notok"; 162 return; 163 } 164 165 166 167 168 if (!is_numeric($wpmemory["limit"])) { 169 $wpmemory["msg_type"] = "notok"; 170 return; 171 } 172 173 //if ($wpmemory["limit"] > 9999999) { 174 // $wpmemory["limit"] = $wpmemory["limit"] / 1024 / 1024; 175 // } 176 177 178 179 if ($wpmemory["usage"] < 1) { 180 $wpmemory["msg_type"] = "notok"; 181 return; 182 } 183 184 //$wplimit = $wpmemory["wp_limit"]; 185 //$wplimit = substr($wplimit, 0, strlen($wplimit) - 1); 186 //$wpmemory["wp_limit"] = $wplimit; 187 188 189 129 return $wpmemory; 130 } 131 // WP 132 if (!defined("WP_MEMORY_LIMIT")) { 133 $wpmemory["wp_limit"] = 40; 134 //define('WP_MEMORY_LIMIT', '40M'); 135 } else { 136 $wp_memory_limit = WP_MEMORY_LIMIT; 137 // $wp_memory_limit = rtrim($wp_memory_limit, 'M'); 138 $wpmemory["wp_limit"] = (int) $wp_memory_limit; 139 } 190 140 $wpmemory["percent"] = $wpmemory["usage"] / $wpmemory["wp_limit"]; 191 141 $wpmemory["color"] = "font-weight:normal;"; … … 198 148 $wpmemory["free"] = $wpmemory["wp_limit"] - $wpmemory["usage"]; 199 149 $wpmemory["msg_type"] = "ok"; 200 201 150 } catch (Exception $e) { 202 151 $wpmemory["msg_type"] = "notok"; 203 return ;152 return $wpmemory; 204 153 } 205 154 return $wpmemory; 206 155 } 156 157 158 207 159 public function bill_check_errors_today() 208 160 { -
cardealer/trunk/includes/functions/functions.php
r3041276 r3049173 100 100 */ 101 101 102 103 function cardealer_check_memory() 102 function cardealer_check_memory() { 103 // global $memory; 104 $memory["color"] = "font-weight:normal;"; 105 try { 106 107 // PHP $memory["limit"] 108 if(!function_exists('ini_get')){ 109 $memory["msg_type"] = "notok"; 110 return $memory; 111 } 112 else{ 113 $memory["limit"] = (int) ini_get("memory_limit"); 114 } 115 116 if (!is_numeric($memory["limit"])) { 117 $memory["msg_type"] = "notok"; 118 return $memory; 119 } else { 120 if ($memory["limit"] > 9999999) { 121 $memory["limit"] = 122 $memory["limit"] / 1024 / 1024; 123 } 124 } 125 126 127 // usage 128 if(!function_exists('memory_get_usage')){ 129 $memory["msg_type"] = "notok"; 130 return $memory; 131 } 132 else{ 133 // $bill_install_memory["usage"] = round(memory_get_usage() / 1024 / 1024, 0); 134 $memory["usage"] = (int) memory_get_usage(); 135 } 136 137 138 if ($memory["usage"] < 1) { 139 $memory["msg_type"] = "notok"; 140 return $memory; 141 } 142 else{ 143 $memory["usage"] = round($memory["usage"] / 1024 / 1024, 0); 144 145 } 146 147 if (!is_numeric($memory["usage"])) { 148 $memory["msg_type"] = "notok"; 149 return $memory; 150 } 151 152 153 // WP 154 if (!defined("WP_MEMORY_LIMIT")) { 155 $memory['wp_limit'] = 40; 156 } else { 157 $memory['wp_limit'] = (int) WP_MEMORY_LIMIT; 158 159 } 160 161 $memory["percent"] = 162 $memory["usage"] / $memory["wp_limit"]; 163 $memory["color"] = "font-weight:normal;"; 164 if ($memory["percent"] > 0.7) { 165 $memory["color"] = "font-weight:bold;color:#E66F00"; 166 } 167 if ($memory["percent"] > 0.85) { 168 $memory["color"] = "font-weight:bold;color:red"; 169 } 170 $memory["msg_type"] = "ok"; 171 return $memory; 172 } catch (Exception $e) { 173 $memory["msg_type"] = "notok(7)"; 174 return $memory; 175 } 176 } 177 178 179 function cardealer_check_memory_old() 104 180 { 105 181 global $cardealer_memory; … … 164 240 if (!defined("WP_MEMORY_LIMIT")) { 165 241 $cardealer_memory['wp_limit'] = 40; 242 define('WP_MEMORY_LIMIT', '40M'); 166 243 } else { 167 168 $cardealer_memory['wp_limit'] = (int) rtrim(WP_MEMORY_LIMIT, 'M'); 244 $cardealer_memory["wp_limit"] = (int) WP_MEMORY_LIMIT; 245 } 246 247 if (!defined("WP_MEMORY_LIMIT")) { 248 $memory["wp_limit"] = 40; 249 define('WP_MEMORY_LIMIT', '40M'); 250 } else { 251 $wp_memory_limit = WP_MEMORY_LIMIT; 252 $wp_memory_limit = rtrim($wp_memory_limit, 'M'); 253 $memory["wp_limit"] = (int) $wp_memory_limit; 169 254 } 170 255 -
cardealer/trunk/includes/functions/health.php
r2818519 r3049173 14 14 global $cardealer_memory_result; 15 15 16 $memory['usage'] = function_exists('memory_get_usage') ? round(memory_get_usage() / 1024 / 1024, 0) : 0; 17 if (!is_numeric($memory['usage'])) { 18 $sbb_memory = 'Unable to Check!'; 16 $memory = cardealer_check_memory(); 17 18 if (isset($memory["msg_type"]) && $memory["msg_type"] == "notok"){ 19 $memory = 'Unable to Check!'; 19 20 return; 21 } 22 23 if (preg_match('/(\d+)\s*([A-Za-z]+)$/', WP_MEMORY_LIMIT, $matches)) { 24 $mb = $matches[2]; 25 } else { 26 $mb = 'M'; 20 27 } 21 if ($memory['usage'] < 1) { 22 return; 23 } 24 $mb = 'MB'; 25 if (defined("WP_MEMORY_LIMIT")) { 26 $memory['wp_limit'] = trim(WP_MEMORY_LIMIT); 27 $wplimit = $memory['wp_limit']; 28 $wplimit = substr($wplimit, 0, strlen($wplimit) - 1); 29 $memory['wp_limit'] = $wplimit; 30 } else { 31 $memory['wp_limit'] = 'Not defined!'; 32 $mb = ''; 33 } 28 34 29 ob_start(); 35 30 echo 'Current memory WordPress Limit: ' . esc_attr($memory['wp_limit']) . esc_attr($mb) . … … 47 42 { 48 43 $tests['direct']['memory_plugin'] = array( 49 'label' => __('My Memory Test', 'antihacker'),44 'label' => esc_attr__('My Memory Test', 'cardealer'), 50 45 'test' => 'cardealer_memory_test', 51 46 ); … … 56 51 add_filter('site_status_tests', 'cardealer_add_memory_test'); 57 52 } 58 59 53 function cardealer_memory_test() 60 54 { … … 62 56 $result = array( 63 57 'badge' => array( 64 'label' => __('Critical', ' antihacker'), // Performance58 'label' => __('Critical', 'cardealer'), // Performance 65 59 'color' => 'red', // orange', 66 60 ), 67 61 'test' => 'Bill_plugin', 68 62 'status' => 'critical', 69 'label' => __('Low WordPress Memory Limit in wp-config file', ' antihacker'),63 'label' => __('Low WordPress Memory Limit in wp-config file', 'cardealer'), 70 64 'description' => $cardealer_memory_result . ' ' . sprintf( 71 65 '<p>%s</p>', -
cardealer/trunk/includes/help/help.php
r2818186 r3049173 59 59 $myhelpdemo .= esc_attr__("If you want to import demo data, download the demo data from this link:","cardealer"); 60 60 $myhelpdemo .= '<br />'; 61 $myhelpdemo .= 'http ://cardealerplugin.com/demo-data/download-demo.php';61 $myhelpdemo .= 'https://cardealerplugin.com/demo-data/download-demo.php'; 62 62 $myhelpdemo .= '<br /><br />'; 63 63 $myhelpdemo .= esc_attr__("After download:","cardealer"); -
cardealer/trunk/includes/templates/template-single.php
r2924372 r3049173 4 4 * @copyright 2017 5 5 */ 6 ?> 7 <script type="text/javascript"> 8 function goBack() { 9 window.history.back(); 6 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 7 8 function cardealer_add_custom_js_to_header() { 9 ?> 10 <script type="text/javascript"> 11 function goBack() { 12 window.history.back(); 13 } 14 </script> 15 <?php 10 16 } 11 </script> 12 <?php 13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 17 add_action('wp_head', 'cardealer_add_custom_js_to_header'); 18 19 14 20 $my_theme = strtolower(wp_get_theme()); 15 21 if ($my_theme == 'twenty fourteen') -
cardealer/trunk/readme.txt
r3041283 r3049173 4 4 Tags: car Dealer, car Seller, auto seller, auto dealer, car-dealer 5 5 Requires at least: 6.0 6 Tested up to: 6. 46 Tested up to: 6.5 7 7 Stable tag: 4.13 8 8 License: GPLv2 or later … … 151 151 152 152 == Changelog == 153 4.14 2024-03-11 Improvements (memory control) , site errors and Single Car Page. 153 154 4.12/13 2024-02-26 Small Improvements (memory control). 154 155 4.11 2024-01-09 Added Pesos Chilenos Coin.
Note: See TracChangeset
for help on using the changeset viewer.