Changeset 3126638
- Timestamp:
- 07/27/2024 09:26:18 PM (20 months ago)
- Location:
- dashcommerce/trunk
- Files:
-
- 3 added
- 2 deleted
- 12 edited
-
assets/js (added)
-
assets/js/chart.umd.js (added)
-
dashcommerce.php (modified) (2 diffs)
-
env (deleted)
-
features/analytics/class-analytics-charts.php (modified) (2 diffs)
-
features/analytics/class-analytics-tabs.php (modified) (1 diff)
-
features/analytics/class-analytics-values.php (modified) (1 diff)
-
features/analytics/class-analytics.php (modified) (1 diff)
-
features/api/class-api.php (modified) (1 diff)
-
features/product-metabox/class-product-metabox.php (modified) (1 diff)
-
features/settings-page/class-settings-page.php (modified) (1 diff)
-
languages/compile.cmd (deleted)
-
readme.txt (modified) (2 diffs)
-
styles.css (modified) (1 diff)
-
tables/class-access-logs.php (modified) (3 diffs)
-
utils/class-environment.php (added)
-
utils/class-utils.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dashcommerce/trunk/dashcommerce.php
r3116743 r3126638 12 12 * Plugin Name: DashCommerce 13 13 * Description: DashCommerce plugin for WordPress. 14 * Version: 1.2. 014 * Version: 1.2.1 15 15 * Author: DashCommerce 16 16 * License: GPL v2 … … 42 42 } 43 43 44 require_once plugin_dir_path( __FILE__ ) . 'utils/class-environment.php'; 44 45 require_once plugin_dir_path( __FILE__ ) . 'features/settings-page/class-settings-page.php'; 45 46 require_once plugin_dir_path( __FILE__ ) . 'features/product-metabox/class-product-metabox.php'; -
dashcommerce/trunk/features/analytics/class-analytics-charts.php
r3116743 r3126638 1 1 <?php // phpcs:ignore 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 } 6 2 7 /** 3 8 * This file is part of the DashCommerce Plugin for WordPress. … … 48 53 49 54 ?> 50 <style>51 table {52 border-collapse: collapse; /* Shared borders */53 width: max-content;54 line-height: 1.2; /* Tighter line spacing */55 }56 th, td {57 padding: 2px; /* Reduced padding */58 border: 1px solid #ccc; /* Thinner borders */59 }60 </style>61 62 55 <div> 63 <table >56 <table class="dashcommerce-utm-table"> 64 57 <thead> 65 58 <tr> -
dashcommerce/trunk/features/analytics/class-analytics-tabs.php
r3098201 r3126638 1 1 <?php // phpcs:ignore 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 } 6 2 7 /** 3 8 * This file is part of the DashCommerce Plugin for WordPress. -
dashcommerce/trunk/features/analytics/class-analytics-values.php
r3116743 r3126638 1 1 <?php // phpcs:ignore 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 } 6 2 7 /** 3 8 * This file is part of the DashCommerce Plugin for WordPress. -
dashcommerce/trunk/features/analytics/class-analytics.php
r3116743 r3126638 1 1 <?php // phpcs:ignore 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 } 6 2 7 /** 3 8 * This file is part of the DashCommerce Plugin for WordPress. -
dashcommerce/trunk/features/api/class-api.php
r3116743 r3126638 161 161 'env' => $this->utils->get_env(), 162 162 'timezone' => $this->utils->get_wp_timezone(), 163 'has_woo' => $this->utils->is_woocommerce_active(), 163 164 ), 164 165 'settings' => $this->settings->get_settings(), -
dashcommerce/trunk/features/product-metabox/class-product-metabox.php
r3116743 r3126638 222 222 try { 223 223 $result = $dashcommerce_utils->http_get( 224 $dashcommerce_env['EP_GENERATE_PRODUCT_DESC RIPTION'],224 $dashcommerce_env['EP_GENERATE_PRODUCT_DESC'], 225 225 array( 226 226 'language' => $language, -
dashcommerce/trunk/features/settings-page/class-settings-page.php
r3116743 r3126638 404 404 } 405 405 406 $home = home_url();407 408 406 try { 409 407 $result = $dashcommerce_utils->http_post( -
dashcommerce/trunk/readme.txt
r3116743 r3126638 3 3 Tags: e-commerce, dashcommerce, description generation, ai 4 4 Requires at least: WordPress 5.0 5 Tested up to: 6. 4.36 Stable tag: 1.2. 05 Tested up to: 6.5.5 6 Stable tag: 1.2.1 7 7 Requires PHP: 8.1 8 8 License: GPL v2 … … 27 27 - - To save a user-provided OpenAI API key, which is used to access the AI-related features of the plugin. 28 28 - This plugin relies, indirectly and through our own API, on the OpenAI API for AI-related features. Their Privacy Policy is available at https://openai.com/enterprise-privacy 29 - This plugin records data related to the accesses to your website. This data is used to provide analytics and statistics. 29 30 30 31 - For support, visit https://dashcommerce.app/contact or contact info@dashcommerce.app. -
dashcommerce/trunk/styles.css
r3098201 r3126638 98 98 display: none; 99 99 } 100 101 .dashcommerce-utm-table { 102 border-collapse: collapse; /* Shared borders */ 103 width: max-content; 104 line-height: 1.2; /* Tighter line spacing */ 105 } 106 107 .dashcommerce-utm-table th, td { 108 padding: 2px; /* Reduced padding */ 109 border: 1px solid #ccc; /* Thinner borders */ 110 } -
dashcommerce/trunk/tables/class-access-logs.php
r3116743 r3126638 1 1 <?php // phpcs:ignore 2 3 if ( ! defined( 'ABSPATH' ) ) { 4 exit; // Exit if accessed directly. 5 } 2 6 3 7 /** … … 141 145 arsort( $page_counts ); 142 146 143 if ( count( $page_counts ) > 9 ) { 144 $top_items = array_slice( $page_counts, 0, 9, true ); 145 $other_items = array_slice( $page_counts, 9, null, true ); 146 $others_sum = array_sum( $other_items ); 147 148 $top_items['others'] = $others_sum; 149 150 return $top_items; 151 } else { 152 return $page_counts; 153 } 147 return $page_counts; 154 148 } 155 149 … … 222 216 * Checks if the access logs table is empty. 223 217 * 224 * @return bool True if the table is empty, falseotherwise.218 * @return bool `true` if the table is empty, `false` otherwise. 225 219 */ 226 220 public function is_empty() { -
dashcommerce/trunk/utils/class-utils.php
r3116743 r3126638 21 21 public function __construct() { 22 22 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); 23 } 24 25 /** 26 * Reference to global variable dashcommerce_env. It should be defined in load_environment(). 23 24 global $dashcommerce_env; 25 26 $this->env = $dashcommerce_env; 27 } 28 29 /** 30 * Reference to global variable dashcommerce_env, which contains the plugin's environment variables. 27 31 * 28 32 * @var array … … 186 190 return false; 187 191 } 188 }189 190 /**191 * Loads environment variables from a .env file.192 *193 * This function reads the contents of a .env file located at the specified path and sets the environment variables accordingly.194 * Each line in the .env file should be in the format "NAME=VALUE", where NAME is the name of the environment variable and VALUE is its corresponding value.195 * Lines starting with '#' are considered comments and are ignored.196 * If an environment variable with the same name already exists in $_SERVER or $_ENV, it will not be overwritten.197 *198 * @return void199 */200 public function load_environment() {201 global $dashcommerce_env;202 203 $env_path = __DIR__ . '/../env/.env';204 205 if ( ! file_exists( $env_path ) ) {206 return;207 }208 209 $lines = file( $env_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );210 211 foreach ( $lines as $line ) {212 if ( strpos( trim( $line ), '#' ) === 0 ) {213 continue;214 }215 216 list($name, $value) = explode( '=', $line, 2 );217 $name = trim( $name );218 $value = trim( $value );219 220 if ( ! isset( $dashcommerce_env ) ) {221 $dashcommerce_env = array();222 }223 224 if ( ! array_key_exists( $name, $dashcommerce_env ) ) {225 $dashcommerce_env[ $name ] = $value;226 }227 }228 229 $this->env = $dashcommerce_env;230 192 } 231 193 … … 598 560 599 561 $dashcommerce_utils = new Dashcommerce_Utils(); 600 601 $dashcommerce_utils->load_environment();
Note: See TracChangeset
for help on using the changeset viewer.