Changeset 2318858
- Timestamp:
- 06/05/2020 09:29:47 AM (6 years ago)
- Location:
- cloudimage/trunk
- Files:
-
- 7 edited
-
README.txt (modified) (2 diffs)
-
admin/class-cloudimage-admin.php (modified) (1 diff)
-
admin/css/cloudimage-admin.css (modified) (1 diff)
-
admin/partials/cloudimage-admin-display.php (modified) (2 diffs)
-
cloudimage.php (modified) (2 diffs)
-
includes/class-cloudimage.php (modified) (1 diff)
-
public/class-cloudimage-public.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cloudimage/trunk/README.txt
r2306989 r2318858 6 6 Tested up to: 5.4.0 7 7 Requires PHP: 5.6 8 Stable tag: 2. 8.98 Stable tag: 2.9.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 265 265 * Instagram widget fix 266 266 267 = 2.9.0 = 268 * Add options to choose if plugin should work when user is logged in 269 267 270 == Upgrade Notice == 268 271 * Upgrading from version 1 to 2 can show you warnings in the admin section -
cloudimage/trunk/admin/class-cloudimage-admin.php
r2292739 r2318858 169 169 170 170 $valid['cloudimage_use_js_powered_mode'] = empty($input['use_js_powered_mode']) ? 0 : 1; 171 $valid['cloudimage_use_for_logged_in_users'] = empty($input['use_for_logged_in_users']) ? 0 : 1; 171 172 172 173 return $valid; -
cloudimage/trunk/admin/css/cloudimage-admin.css
r2300710 r2318858 364 364 } 365 365 366 #cloudimage-current-mode {366 #cloudimage-current-mode, #cloudimage-user-mode { 367 367 display: inline-block; 368 368 font-size: 18px; -
cloudimage/trunk/admin/partials/cloudimage-admin-display.php
r2300710 r2318858 20 20 $domain = $options['cloudimage_domain']; 21 21 $use_js_powered_mode = $options['cloudimage_use_js_powered_mode']; 22 $use_for_logged_in_users = $options['cloudimage_use_for_logged_in_users']; 23 22 24 ?> 23 25 … … 137 139 </tr> 138 140 141 <!-- Use if user is logged in --> 142 <tr id="use-for-logged-in-users"> 143 <th scope="row" class="titledesc"> 144 <label for="<?php echo $this->plugin_name; ?>-use_for_logged_in_users"> 145 <div id="cloudimage-user-mode"><?php esc_attr_e('Use when logged in', 'cloudimage'); ?></div> 146 <div class="tooltip">? 147 <span class="tooltiptext"><?php esc_attr_e('Use Cloudimage even the user is logged-in. You need to adapt to your need in some scenarious, it is better to save CDN bandwidth.', 'cloudimage') ?></span> 148 </div> 149 </label> 150 </th> 151 152 <td class="forminp forminp-text"> 153 <label class="switch"> 154 <input type="checkbox" id="<?php echo $this->plugin_name; ?>-use_for_logged_in_users" 155 name="<?php echo $this->plugin_name; ?>[use_for_logged_in_users]" <?php checked($use_for_logged_in_users, 1); ?> > 156 <span class="slider round"></span> 157 </label> 158 159 </td> 160 </tr> 161 139 162 </tbody> 140 163 </table> -
cloudimage/trunk/cloudimage.php
r2306989 r2318858 12 12 * Plugin Name: Cloudimage - Responsive Images as a Service 13 13 * Description: The easiest way to <strong>deliver lightning fast images</strong> to your users. 14 * Version: 2. 8.914 * Version: 2.9.0 15 15 * Author: Cloudimage 16 16 * Author URI: https://cloudimage.io … … 30 30 * Start at version 1.0.0 31 31 */ 32 define('CLOUDIMAGE_VERSION', '2. 8.9');32 define('CLOUDIMAGE_VERSION', '2.9.0'); 33 33 34 34 /** -
cloudimage/trunk/includes/class-cloudimage.php
r2306989 r2318858 83 83 $this->version = CLOUDIMAGE_VERSION; 84 84 } else { 85 $this->version = '2. 8.9';85 $this->version = '2.9.0'; 86 86 } 87 87 $this->plugin_name = 'cloudimage'; -
cloudimage/trunk/public/class-cloudimage-public.php
r2306989 r2318858 69 69 private $cloudimage_skip_classes; 70 70 71 /** 72 * Define if Cloudimage optimization should work when user is logged-in 73 * 74 * @since 2.9.0 75 * @access private 76 * @var int $cloudimage_use_in_admin 0 or 1 regarding is optimization should work when users are logged in 77 */ 78 private $cloudimage_use_for_logged_in_users; 71 79 72 80 /** … … 90 98 $this->cloudimage_domain = $this->cloudimage_options['cloudimage_domain']; 91 99 $this->cloudimage_use_js_powered_mode = $this->cloudimage_options['cloudimage_use_js_powered_mode']; 100 101 $cloudimage_use_for_logged_in_users = isset($this->cloudimage_options['cloudimage_use_for_logged_in_users']) ? $this->cloudimage_options['cloudimage_use_for_logged_in_users'] : 0; 102 $this->cloudimage_use_for_logged_in_users = $cloudimage_use_for_logged_in_users; 92 103 } 93 104 … … 143 154 public function filter_cloudimage_wp_get_attachment_url($url, $post_id) 144 155 { 145 if ($this->is_dev || !$this->cloudimage_domain || is_admin() || is_user_logged_in()) { 156 # Check if we need to perform the optimization for the current user state (logged in or not) 157 $logged_in_user = $this->cloudimage_check_logged_user(); 158 159 if ($this->is_dev || !$this->cloudimage_domain || $logged_in_user) { 146 160 return $url; 147 161 } … … 171 185 public function filter_cloudimage_wp_calculate_image_srcset($sources, $size_array, $image_src, $image_meta, $attachment_id) 172 186 { 173 if ($this->is_dev || !$this->cloudimage_domain || is_admin() || is_user_logged_in()) { 174 187 # Check if we need to perform the optimization for the current user state (logged in or not) 188 $logged_in_user = $this->cloudimage_check_logged_user(); 189 190 if ($this->is_dev || !$this->cloudimage_domain || $logged_in_user) { 191 # Return original sources 175 192 return $sources; 176 193 } … … 228 245 public function filter_cloudimage_image_downsize($short_cut, $id, $size) 229 246 { 230 if ($short_cut || $this->is_dev || !$this->cloudimage_domain || $this->cloudimage_use_js_powered_mode || is_admin() || is_user_logged_in()) { 247 # Check if we need to perform the optimization for the current user state (logged in or not) 248 $logged_in_user = $this->cloudimage_check_logged_user(); 249 250 if ($short_cut || $this->is_dev || !$this->cloudimage_domain || $this->cloudimage_use_js_powered_mode || $logged_in_user) { 231 251 return false; 232 252 } … … 895 915 public function cloudimage_buffer_start() 896 916 { 897 if ($this->cloudimage_use_js_powered_mode && !is_admin() && !is_user_logged_in()) { 917 # Check if we need to perform the optimization for the current user state (logged in or not) 918 $logged_in_user = $this->cloudimage_check_logged_user(); 919 920 if ($this->cloudimage_use_js_powered_mode && !$logged_in_user) { 898 921 ob_start([$this, 'filter_cloudimage_the_content']); 899 922 } … … 912 935 return str_replace("/v7/", "/", $url); 913 936 } 937 938 /** 939 * Function to return if we need to perform optimization with Cloudimage 940 * 941 * @return bool 942 * 943 * @since 2.9.0 944 */ 945 public function cloudimage_check_logged_user() 946 { 947 if ((is_admin() || is_user_logged_in()) && !$this->cloudimage_use_for_logged_in_users) { 948 return 1; 949 } 950 951 return 0; 952 } 914 953 }
Note: See TracChangeset
for help on using the changeset viewer.