Changeset 2789381 for gdpr-cache-scripts-styles
- Timestamp:
- 09/23/2022 03:04:29 PM (4 years ago)
- Location:
- gdpr-cache-scripts-styles
- Files:
-
- 25 added
- 7 edited
-
assets/screenshot-3.png (modified) (previous)
-
tags/1.0.3 (added)
-
tags/1.0.3/LICENSE (added)
-
tags/1.0.3/constants.php (added)
-
tags/1.0.3/includes (added)
-
tags/1.0.3/includes/admin (added)
-
tags/1.0.3/includes/admin/actions.php (added)
-
tags/1.0.3/includes/admin/options.php (added)
-
tags/1.0.3/includes/libs (added)
-
tags/1.0.3/includes/libs/cache.php (added)
-
tags/1.0.3/includes/libs/scanner.php (added)
-
tags/1.0.3/includes/libs/utils.php (added)
-
tags/1.0.3/includes/libs/worker.php (added)
-
tags/1.0.3/plugin.php (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/scripts (added)
-
tags/1.0.3/scripts/sortable.js (added)
-
tags/1.0.3/start.php (added)
-
tags/1.0.3/styles (added)
-
tags/1.0.3/styles/admin.css (added)
-
tags/1.0.3/templates (added)
-
tags/1.0.3/templates/admin-options.php (added)
-
trunk/constants.php (modified) (2 diffs)
-
trunk/includes/admin/options.php (modified) (1 diff)
-
trunk/includes/libs/cache.php (modified) (1 diff)
-
trunk/plugin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/scripts (added)
-
trunk/scripts/sortable.js (added)
-
trunk/styles (added)
-
trunk/styles/admin.css (added)
-
trunk/templates/admin-options.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gdpr-cache-scripts-styles/trunk/constants.php
r2788227 r2789381 17 17 */ 18 18 define( 'GDPR_CACHE_PATH', plugin_dir_path( GDPR_CACHE_PLUGIN_FILE ) ); 19 20 /** 21 * Absolute URL to the current plugins base folder, with trailing slash. Used 22 * to enqueue scripts that are shipped with this plugin. 23 * 24 * @var string 25 */ 26 define( 'GDPR_CACHE_PLUGIN_URL', plugin_dir_url( GDPR_CACHE_PLUGIN_FILE ) ); 19 27 20 28 /** … … 51 59 * in TTF fonts being used. 52 60 * 53 * @see https://developers.google.com/fonts/docs/technical_considerations61 * @see https://developers.google.com/fonts/docs/technical_considerations 54 62 * 55 63 * @since 1.0.1 -
gdpr-cache-scripts-styles/trunk/includes/admin/options.php
r2788227 r2789381 77 77 */ 78 78 function render_admin_page() { 79 // Flush plugin cache when the Options Page is opened. 80 wp_cache_delete( 'data', 'gdpr-cache' ); 81 79 82 require GDPR_CACHE_PATH . 'templates/admin-options.php'; 80 83 } -
gdpr-cache-scripts-styles/trunk/includes/libs/cache.php
r2788227 r2789381 217 217 'expires' => time() + $expiration, 218 218 'file' => $file, 219 'type' => get_url_type( $url ), 219 220 ]; 220 221 -
gdpr-cache-scripts-styles/trunk/plugin.php
r2789331 r2789381 12 12 * Plugin URI: https://github.com/divimode/gdpr-cache-script-styles 13 13 * Description: Caches external scripts and styles and serves them from your local website to make it more compliant with GDPR regulations 14 * Version: 1.0. 214 * Version: 1.0.3 15 15 * Author: Divimode 16 16 * Author URI: https://divimode.com/ … … 46 46 * @var string 47 47 */ 48 const GDPR_CACHE_VERSION = '1.0. 2';48 const GDPR_CACHE_VERSION = '1.0.3'; 49 49 50 50 /** -
gdpr-cache-scripts-styles/trunk/readme.txt
r2789366 r2789381 4 4 Tested up to: 6.0.2 5 5 Requires PHP: 7.2 6 Stable tag: 1.0. 26 Stable tag: 1.0.3 7 7 License: GPL v2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 121 121 == Changelog == 122 122 123 = 1.0.3 = 124 125 * New: Display file-type of cached assets in the plugin's option page. 126 * New: Also in the plugin's option page - allow sorting of the "Cached Assets" list. 127 * Improve: Flush the plugins internal cache when opening the options page. 128 123 129 = 1.0.2 = 124 130 -
gdpr-cache-scripts-styles/trunk/templates/admin-options.php
r2788227 r2789381 10 10 // Exit if accessed directly. 11 11 defined( 'ABSPATH' ) || exit; 12 13 wp_enqueue_script( 'gdpr-sortable', GDPR_CACHE_PLUGIN_URL . 'scripts/sortable.js' ); 14 wp_enqueue_style( 'gdpr-sortable', GDPR_CACHE_PLUGIN_URL . 'styles/admin.css' ); 12 15 13 16 $assets = get_cached_data(); … … 33 36 foreach ( $assets as $url => $item ) { 34 37 $status_label = ''; 38 $local_url = ''; 35 39 $item_status = get_asset_status( $url ); 40 $item_type = isset( $item['type'] ) ? $item['type'] : ''; 41 42 if ( ! $item_type ) { 43 $item_type = get_url_type( $url ); 44 } 36 45 37 46 if ( 'valid' !== $item_status ) { … … 44 53 $status_label = $status_labels[ $item_status ]; 45 54 } 55 if ( in_array( $item_status, [ 'valid', 'expired' ] ) ) { 56 $local_url = build_cache_file_url( $item['file'] ); 57 } 46 58 $counts['all'] ++; 47 59 $counts[ $item_status ] ++; … … 51 63 'status' => $item_status, 52 64 'status_label' => $status_label, 65 'type' => $item_type, 66 'local_url' => $local_url, 53 67 'created' => gmdate( 'Y-m-d H:i', $item['created'] ), 54 68 'expires' => gmdate( 'Y-m-d H:i', $item['expires'] ), … … 61 75 } 62 76 77 $item_type = get_url_type( $url ); 63 78 $item_status = 'enqueued'; 64 79 $counts['all'] ++; … … 69 84 'status' => $item_status, 70 85 'status_label' => $status_labels[ $item_status ], 86 'type' => $item_type, 87 'local_url' => '', 71 88 'created' => '', 72 89 'expires' => '', … … 84 101 85 102 ?> 86 <div class="wrap" >103 <div class="wrap" id="gdpr-cache"> 87 104 <h1><?php esc_html_e( 'GDPR Cache Options', 'gdpr-cache' ); ?></h1> 88 105 … … 131 148 </p> 132 149 <?php else : ?> 133 <table class="wp-list-table widefat fixed striped table-view-list ">150 <table class="wp-list-table widefat fixed striped table-view-list sortable"> 134 151 <thead> 135 152 <tr> 136 <th class="asset-url"><?php esc_html_e( 'URL', 'gdpr-cache' ); ?></th> 137 <th 138 class="asset-status" style="width:100px" 139 ><?php esc_html_e( 'Status', 'gdpr-cache' ); ?></th> 140 <th 141 class="asset-created" style="width:125px" 142 ><?php esc_html_e( 'Created', 'gdpr-cache' ); ?></th> 143 <th 144 class="asset-expires" style="width:125px" 145 ><?php esc_html_e( 'Expires', 'gdpr-cache' ); ?></th> 153 <th class="asset-url"> 154 <?php esc_html_e( 'URL', 'gdpr-cache' ); ?> 155 </th> 156 <th class="asset-type"> 157 <?php esc_html_e( 'Type', 'gdpr-cache' ); ?> 158 </th> 159 <th class="asset-status"> 160 <?php esc_html_e( 'Status', 'gdpr-cache' ); ?> 161 </th> 162 <th class="asset-created"> 163 <?php esc_html_e( 'Created', 'gdpr-cache' ); ?> 164 165 </th> 166 <th class="asset-expires"> 167 <?php esc_html_e( 'Expires', 'gdpr-cache' ); ?> 168 </th> 146 169 </tr> 147 170 </thead> … … 149 172 <tr class="status-<?php echo esc_attr( $item['status'] ); ?>"> 150 173 <td class="asset-url"><?php echo esc_html( $item['url'] ); ?></td> 174 <td class="asset-type"><?php echo esc_html( $item['type'] ); ?></td> 151 175 <td class="asset-status"> 152 <?php echo esc_html( $item['status_label'] ); ?> 176 <?php if ( $item['local_url'] ): ?> 177 <a 178 href="<?php echo esc_url( $item['local_url'] ); ?>" 179 title="<?php esc_attr_e( 'Open the cached file in a new window', 'gdpr-cache' ); ?>" 180 target="_blank" 181 > 182 <?php echo esc_html( $item['status_label'] ); ?> 183 </a> 184 <?php else: ?> 185 <?php echo esc_html( $item['status_label'] ); ?> 186 <?php endif; ?> 153 187 </td> 154 188 <td class="asset-created"><?php echo esc_html( $item['created'] ); ?></td> … … 159 193 <?php endif; ?> 160 194 </div> 161 162 <style>163 .subsubsub {164 margin-bottom: 12px165 }166 167 .subsubsub li + li:before {168 content: '|';169 padding: 0 2px;170 }171 172 .subsubsub .count-all .status {173 font-weight: bold;174 }175 176 .widefat .asset-status {177 vertical-align: middle;178 text-align: center;179 }180 181 .status-valid .asset-status {182 background: #c8e6c940;183 color: #005005;184 }185 186 .status-expired .asset-status {187 background: #ffecb340;188 color: #c56000;189 }190 191 .status-missing .asset-status {192 background: #ffccbc40;193 color: #9f0000;194 }195 196 .status-enqueued .asset-status {197 background: #e1bee740;198 color: #38006b;199 }200 </style>
Note: See TracChangeset
for help on using the changeset viewer.