| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' ); |
| 3 |
|
| 4 |
/** |
| 5 |
* Class for deprecated methods from Imagify. |
| 6 |
* |
| 7 |
* @since 1.6.5 |
| 8 |
* @author Grégory Viguier |
| 9 |
* @deprecated |
| 10 |
*/ |
| 11 |
class Imagify_Deprecated { |
| 12 |
|
| 13 |
/** |
| 14 |
* A shorthand to display a message about a deprecated method. |
| 15 |
* |
| 16 |
* @since 1.6.5 |
| 17 |
* @since 1.6.5 Deprecated |
| 18 |
* @author Grégory Viguier |
| 19 |
* @deprecated |
| 20 |
* |
| 21 |
* @param string $method_name The deprecated method. |
| 22 |
*/ |
| 23 |
protected function deprecated_camelcased_method( $method_name ) { |
| 24 |
$class_name = get_class( $this ); |
| 25 |
$new_method_name = preg_replace( '/[A-Z]/', '_$0', $method_name ); |
| 26 |
_deprecated_function( $class_name . '::' . $method_name . '()', '1.6.5', $class_name . '::' . $new_method_name . '()' ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Main Instance. |
| 31 |
* Ensures only one instance of class is loaded or can be loaded. |
| 32 |
* Well, actually it ensures nothing since it's not a full singleton pattern. |
| 33 |
* |
| 34 |
* @since 1.6.5 Deprecated |
| 35 |
* @deprecated |
| 36 |
* |
| 37 |
* @return object Main instance. |
| 38 |
*/ |
| 39 |
public static function instance() { |
| 40 |
_deprecated_function( 'Imagify::instance()', '1.6.5', 'Imagify::get_instance()' ); |
| 41 |
return Imagify::get_instance(); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Get your Imagify account infos. |
| 46 |
* |
| 47 |
* @since 1.6.5 Deprecated |
| 48 |
* @deprecated |
| 49 |
* |
| 50 |
* @return object |
| 51 |
*/ |
| 52 |
public function getUser() { |
| 53 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 54 |
return $this->get_user(); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* Create a user on your Imagify account. |
| 59 |
* |
| 60 |
* @since 1.6.5 Deprecated |
| 61 |
* @deprecated |
| 62 |
* |
| 63 |
* @param array $data All user data. |
| 64 |
* @return object |
| 65 |
*/ |
| 66 |
public function createUser( $data ) { |
| 67 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 68 |
return $this->create_user( $data ); |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Update an existing user on your Imagify account. |
| 73 |
* |
| 74 |
* @since 1.6.5 Deprecated |
| 75 |
* @deprecated |
| 76 |
* |
| 77 |
* @param string $data All user data. |
| 78 |
* @return object |
| 79 |
*/ |
| 80 |
public function updateUser( $data ) { |
| 81 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 82 |
return $this->update_user( $data ); |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Check your Imagify API key status. |
| 87 |
* |
| 88 |
* @since 1.6.5 Deprecated |
| 89 |
* @deprecated |
| 90 |
* |
| 91 |
* @param string $data The license key. |
| 92 |
* @return object |
| 93 |
*/ |
| 94 |
public function getStatus( $data ) { |
| 95 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 96 |
return $this->get_status( $data ); |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Get the Imagify API version. |
| 101 |
* |
| 102 |
* @since 1.6.5 Deprecated |
| 103 |
* @deprecated |
| 104 |
* |
| 105 |
* @return object |
| 106 |
*/ |
| 107 |
public function getApiVersion() { |
| 108 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 109 |
return $this->get_api_version(); |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Get Public Info. |
| 114 |
* |
| 115 |
* @since 1.6.5 Deprecated |
| 116 |
* @deprecated |
| 117 |
* |
| 118 |
* @return object |
| 119 |
*/ |
| 120 |
public function getPublicInfo() { |
| 121 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 122 |
return $this->get_public_info(); |
| 123 |
} |
| 124 |
|
| 125 |
/** |
| 126 |
* Optimize an image from its binary content. |
| 127 |
* |
| 128 |
* @since 1.6.5 Deprecated |
| 129 |
* @deprecated |
| 130 |
* |
| 131 |
* @param string $data All options. |
| 132 |
* @return object |
| 133 |
*/ |
| 134 |
public function uploadImage( $data ) { |
| 135 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 136 |
return $this->upload_image( $data ); |
| 137 |
} |
| 138 |
|
| 139 |
/** |
| 140 |
* Optimize an image from its URL. |
| 141 |
* |
| 142 |
* @since 1.6.5 Deprecated |
| 143 |
* @deprecated |
| 144 |
* |
| 145 |
* @param string $data All options. |
| 146 |
* @return object |
| 147 |
*/ |
| 148 |
public function fetchImage( $data ) { |
| 149 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 150 |
return $this->fetch_image( $data ); |
| 151 |
} |
| 152 |
|
| 153 |
/** |
| 154 |
* Get prices for plans. |
| 155 |
* |
| 156 |
* @since 1.6.5 Deprecated |
| 157 |
* @deprecated |
| 158 |
* |
| 159 |
* @return object |
| 160 |
*/ |
| 161 |
public function getPlansPrices() { |
| 162 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 163 |
return $this->get_plans_prices(); |
| 164 |
} |
| 165 |
|
| 166 |
/** |
| 167 |
* Get prices for packs (One Time). |
| 168 |
* |
| 169 |
* @since 1.6.5 Deprecated |
| 170 |
* @deprecated |
| 171 |
* |
| 172 |
* @return object |
| 173 |
*/ |
| 174 |
public function getPacksPrices() { |
| 175 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 176 |
return $this->get_packs_prices(); |
| 177 |
} |
| 178 |
|
| 179 |
/** |
| 180 |
* Get all prices (packs & plans included). |
| 181 |
* |
| 182 |
* @since 1.6.5 Deprecated |
| 183 |
* @deprecated |
| 184 |
* |
| 185 |
* @return object |
| 186 |
*/ |
| 187 |
public function getAllPrices() { |
| 188 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 189 |
return $this->get_all_prices(); |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Get all prices (packs & plans included). |
| 194 |
* |
| 195 |
* @since 1.6.5 Deprecated |
| 196 |
* @deprecated |
| 197 |
* |
| 198 |
* @param string $coupon A coupon code. |
| 199 |
* @return object |
| 200 |
*/ |
| 201 |
public function checkCouponCode( $coupon ) { |
| 202 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 203 |
return $this->check_coupon_code( $coupon ); |
| 204 |
} |
| 205 |
|
| 206 |
/** |
| 207 |
* Get information about current discount. |
| 208 |
* |
| 209 |
* @since 1.6.5 Deprecated |
| 210 |
* @deprecated |
| 211 |
* |
| 212 |
* @return object |
| 213 |
*/ |
| 214 |
public function checkDiscount() { |
| 215 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 216 |
return $this->check_discount(); |
| 217 |
} |
| 218 |
|
| 219 |
/** |
| 220 |
* Make an HTTP call using curl. |
| 221 |
* |
| 222 |
* @since 1.6.5 Deprecated |
| 223 |
* @deprecated |
| 224 |
* |
| 225 |
* @param string $url The URL to call. |
| 226 |
* @param array $args The request args. |
| 227 |
* @return object |
| 228 |
*/ |
| 229 |
private function httpCall( $url, $args = array() ) { |
| 230 |
$this->deprecated_camelcased_method( __FUNCTION__ ); |
| 231 |
return $this->http_call( $url, $args ); |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
/** |
| 236 |
* Class for deprecated methods from Imagify_Abstract_DB. |
| 237 |
* |
| 238 |
* @since 1.7 |
| 239 |
* @author Grégory Viguier |
| 240 |
* @deprecated |
| 241 |
*/ |
| 242 |
class Imagify_Abstract_DB_Deprecated { |
| 243 |
|
| 244 |
/** |
| 245 |
* Check if the given table exists. |
| 246 |
* |
| 247 |
* @since 1.5 In Imagify_Abstract_DB. |
| 248 |
* @since 1.7 Deprecated. |
| 249 |
* @access public |
| 250 |
* @deprecated |
| 251 |
* |
| 252 |
* @param string $table The table name. |
| 253 |
* @return bool True if the table name exists. |
| 254 |
*/ |
| 255 |
public function table_exists( $table ) { |
| 256 |
_deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.7.0', 'Imagify_DB::table_exists( $table )' ); |
| 257 |
|
| 258 |
return Imagify_DB::table_exists( $table ); |
| 259 |
} |
| 260 |
|
| 261 |
/** |
| 262 |
* Main Instance. |
| 263 |
* Ensures only one instance of class is loaded or can be loaded. |
| 264 |
* Well, actually it ensures nothing since it's not a full singleton pattern. |
| 265 |
* |
| 266 |
* @since 1.5 In Imagify_NGG_DB. |
| 267 |
* @since 1.7 Deprecated. |
| 268 |
* @access public |
| 269 |
* @author Jonathan Buttigieg |
| 270 |
* @deprecated |
| 271 |
* |
| 272 |
* @return object Main instance. |
| 273 |
*/ |
| 274 |
public static function instance() { |
| 275 |
_deprecated_function( 'Imagify_Abstract_DB::instance()', '1.6.5', 'Imagify_Abstract_DB::get_instance()' ); |
| 276 |
|
| 277 |
return self::get_instance(); |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
/** |
| 282 |
* Class for deprecated methods from Imagify_Abstract_Attachment. |
| 283 |
* |
| 284 |
* @since 1.7 |
| 285 |
* @author Grégory Viguier |
| 286 |
* @deprecated |
| 287 |
*/ |
| 288 |
class Imagify_Abstract_Attachment_Deprecated { |
| 289 |
|
| 290 |
/** |
| 291 |
* Maybe backup a file. |
| 292 |
* |
| 293 |
* @since 1.6.6 In Imagify_AS3CF_Attachment. |
| 294 |
* @since 1.6.8 Deprecated. |
| 295 |
* @author Grégory Viguier |
| 296 |
* @deprecated |
| 297 |
* |
| 298 |
* @param string $attachment_path The file path. |
| 299 |
* @return bool|null True on success. False on failure. Null if backup is not needed. |
| 300 |
*/ |
| 301 |
protected function maybe_backup( $attachment_path ) { |
| 302 |
_deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.6.8', 'imagify_backup_file()' ); |
| 303 |
|
| 304 |
$result = imagify_backup_file( $attachment_path ); |
| 305 |
|
| 306 |
if ( false === $result ) { |
| 307 |
return null; |
| 308 |
} |
| 309 |
|
| 310 |
return ! is_wp_error( $result ); |
| 311 |
} |
| 312 |
} |
| 313 |
|
| 314 |
/** |
| 315 |
* Class for deprecated methods from Imagify_AS3CF. |
| 316 |
* |
| 317 |
* @since 1.7 |
| 318 |
* @author Grégory Viguier |
| 319 |
* @deprecated |
| 320 |
*/ |
| 321 |
class Imagify_AS3CF_Deprecated { |
| 322 |
|
| 323 |
/** |
| 324 |
* Tell if the attachment has a supported mime type. |
| 325 |
* |
| 326 |
* @since 1.6.6 In Imagify_AS3CF. |
| 327 |
* @since 1.6.8 Deprecated. |
| 328 |
* @see imagify_is_attachment_mime_type_supported() |
| 329 |
* @author Grégory Viguier |
| 330 |
* @deprecated |
| 331 |
* |
| 332 |
* @param int $post_id The attachment ID. |
| 333 |
* @return bool |
| 334 |
*/ |
| 335 |
public function is_mime_type_supported( $post_id ) { |
| 336 |
_deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.6.8', 'imagify_is_attachment_mime_type_supported( $post_id )' ); |
| 337 |
|
| 338 |
return imagify_is_attachment_mime_type_supported( $post_id ); |
| 339 |
} |
| 340 |
} |
| 341 |
|
| 342 |
/** |
| 343 |
* Class for deprecated methods from Imagify_Notices. |
| 344 |
* |
| 345 |
* @since 1.7 |
| 346 |
* @author Grégory Viguier |
| 347 |
* @deprecated |
| 348 |
*/ |
| 349 |
class Imagify_Notices_Deprecated { |
| 350 |
|
| 351 |
/** |
| 352 |
* Include the view file. |
| 353 |
* |
| 354 |
* @since 1.6.10 In Imagify_Notices |
| 355 |
* @since 1.7 Deprecated |
| 356 |
* @author Grégory Viguier |
| 357 |
* @deprecated |
| 358 |
* |
| 359 |
* @param string $view The view ID. |
| 360 |
* @param mixed $data Some data to pass to the view. |
| 361 |
*/ |
| 362 |
public function render_view( $view, $data = array() ) { |
| 363 |
_deprecated_function( get_class( $this ) . '::' . __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->print_template( \'notice-\' . $view, $data )' ); |
| 364 |
|
| 365 |
Imagify_Views::get_instance()->print_template( 'notice-' . $view, $data ); |
| 366 |
} |
| 367 |
} |
| 368 |
|
| 369 |
if ( class_exists( 'WpeCommon' ) ) : |
| 370 |
|
| 371 |
/** |
| 372 |
* Change the limit for the number of posts: WP Engine limits SQL queries size to 2048 octets (16384 characters). |
| 373 |
* |
| 374 |
* @since 1.4.7 |
| 375 |
* @since 1.6.7 Deprecated. |
| 376 |
* @author Jonathan Buttigieg |
| 377 |
* @deprecated |
| 378 |
* |
| 379 |
* @return int |
| 380 |
*/ |
| 381 |
function _imagify_wengine_unoptimized_attachment_limit() { |
| 382 |
_deprecated_function( __FUNCTION__ . '()', '1.6.7', '_imagify_wpengine_unoptimized_attachment_limit()' ); |
| 383 |
return _imagify_wpengine_unoptimized_attachment_limit(); |
| 384 |
} |
| 385 |
|
| 386 |
endif; |
| 387 |
|
| 388 |
if ( function_exists( 'emr_delete_current_files' ) ) : |
| 389 |
|
| 390 |
/** |
| 391 |
* Re-Optimize an attachment after replace it with Enable Media Replace. |
| 392 |
* |
| 393 |
* @since 1.0 |
| 394 |
* @since 1.6.9 Deprecated. |
| 395 |
* @author Jonathan Buttigieg |
| 396 |
* @deprecated |
| 397 |
* |
| 398 |
* @param string $guid A post guid. |
| 399 |
*/ |
| 400 |
function _imagify_optimize_enable_media_replace( $guid ) { |
| 401 |
global $wpdb; |
| 402 |
|
| 403 |
_deprecated_function( __FUNCTION__ . '()', '1.6.9', 'imagify_enable_media_replace()->optimize()' ); |
| 404 |
|
| 405 |
$attachment_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s';", $guid ) ); |
| 406 |
|
| 407 |
if ( ! $attachment_id ) { |
| 408 |
return; |
| 409 |
} |
| 410 |
|
| 411 |
$attachment = get_imagify_attachment( 'wp', $attachment_id, 'enable-media-replace-upload-done' ); |
| 412 |
|
| 413 |
// Stop if the attachment wasn't optimized yet by Imagify. |
| 414 |
if ( ! $attachment->get_data() ) { |
| 415 |
return; |
| 416 |
} |
| 417 |
|
| 418 |
$optimization_level = $attachment->get_optimization_level(); |
| 419 |
|
| 420 |
// Remove old optimization data. |
| 421 |
$attachment->delete_imagify_data(); |
| 422 |
|
| 423 |
// Optimize it!!!!! |
| 424 |
$attachment->optimize( $optimization_level ); |
| 425 |
} |
| 426 |
|
| 427 |
endif; |
| 428 |
|
| 429 |
/** |
| 430 |
* Include Admin Bar Profile informations styles in front. |
| 431 |
* |
| 432 |
* @since 1.2 |
| 433 |
* @since 1.6.10 Deprecated. |
| 434 |
* @deprecated |
| 435 |
*/ |
| 436 |
function _imagify_admin_bar_styles() { |
| 437 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Assets::get_instance()->enqueue_styles_and_scripts_frontend()' ); |
| 438 |
|
| 439 |
if ( ! is_admin() ) { |
| 440 |
Imagify_Assets::get_instance()->enqueue_styles_and_scripts_frontend(); |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
/** |
| 445 |
* Make an absolute path relative to WordPress' root folder. |
| 446 |
* Also works for files from registered symlinked plugins. |
| 447 |
* |
| 448 |
* @since 1.6.8 |
| 449 |
* @since 1.6.10 Deprecated. Don't laugh. |
| 450 |
* @author Grégory Viguier |
| 451 |
* @deprecated |
| 452 |
* |
| 453 |
* @param string $file_path An absolute path. |
| 454 |
* @return string A relative path. Can return the absolute path in case of a failure. |
| 455 |
*/ |
| 456 |
function imagify_make_file_path_replative( $file_path ) { |
| 457 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'imagify_make_file_path_relative( $file_path )' ); |
| 458 |
|
| 459 |
return imagify_make_file_path_relative( $file_path ); |
| 460 |
} |
| 461 |
|
| 462 |
if ( is_admin() && ( function_exists( 'as3cf_init' ) || function_exists( 'as3cf_pro_init' ) ) ) : |
| 463 |
|
| 464 |
/** |
| 465 |
* Returns the main instance of the Imagify_AS3CF class. |
| 466 |
* |
| 467 |
* @since 1.6.6 |
| 468 |
* @since 1.6.12 Deprecated. |
| 469 |
* @author Grégory Viguier |
| 470 |
* @deprecated |
| 471 |
* |
| 472 |
* @return object The Imagify_AS3CF instance. |
| 473 |
*/ |
| 474 |
function imagify_as3cf() { |
| 475 |
_deprecated_function( __FUNCTION__ . '()', '1.6.12', 'Imagify_AS3CF::get_instance()' ); |
| 476 |
|
| 477 |
return Imagify_AS3CF::get_instance(); |
| 478 |
} |
| 479 |
|
| 480 |
endif; |
| 481 |
|
| 482 |
if ( function_exists( 'enable_media_replace' ) ) : |
| 483 |
|
| 484 |
/** |
| 485 |
* Returns the main instance of the Imagify_Enable_Media_Replace class. |
| 486 |
* |
| 487 |
* @since 1.6.9 |
| 488 |
* @since 1.6.12 Deprecated. |
| 489 |
* @author Grégory Viguier |
| 490 |
* @deprecated |
| 491 |
* |
| 492 |
* @return object The Imagify_Enable_Media_Replace instance. |
| 493 |
*/ |
| 494 |
function imagify_enable_media_replace() { |
| 495 |
_deprecated_function( __FUNCTION__ . '()', '1.6.12', 'Imagify_Enable_Media_Replace::get_instance()' ); |
| 496 |
|
| 497 |
return Imagify_Enable_Media_Replace::get_instance(); |
| 498 |
} |
| 499 |
|
| 500 |
endif; |
| 501 |
|
| 502 |
if ( class_exists( 'C_NextGEN_Bootstrap' ) && class_exists( 'Mixin' ) && get_site_option( 'ngg_options' ) ) : |
| 503 |
|
| 504 |
/** |
| 505 |
* Returns the main instance of the Imagify_NGG class. |
| 506 |
* |
| 507 |
* @since 1.6.5 |
| 508 |
* @since 1.6.12 Deprecated. |
| 509 |
* @author Grégory Viguier |
| 510 |
* @deprecated |
| 511 |
* |
| 512 |
* @return object The Imagify_NGG instance. |
| 513 |
*/ |
| 514 |
function imagify_ngg() { |
| 515 |
_deprecated_function( __FUNCTION__ . '()', '1.6.12', 'Imagify_NGG::get_instance()' ); |
| 516 |
|
| 517 |
return Imagify_NGG::get_instance(); |
| 518 |
} |
| 519 |
|
| 520 |
/** |
| 521 |
* Returns the main instance of the Imagify_NGG_DB class. |
| 522 |
* |
| 523 |
* @since 1.6.5 |
| 524 |
* @since 1.6.12 Deprecated. |
| 525 |
* @author Jonathan Buttigieg |
| 526 |
* @deprecated |
| 527 |
* |
| 528 |
* @return object The Imagify_NGG_DB instance. |
| 529 |
*/ |
| 530 |
function imagify_ngg_db() { |
| 531 |
_deprecated_function( __FUNCTION__ . '()', '1.6.12', 'Imagify_NGG_DB::get_instance()' ); |
| 532 |
|
| 533 |
return Imagify_NGG_DB::get_instance(); |
| 534 |
} |
| 535 |
|
| 536 |
/** |
| 537 |
* Delete the Imagify data when an image is deleted. |
| 538 |
* |
| 539 |
* @since 1.5 |
| 540 |
* @since 1.6.13 Deprecated. |
| 541 |
* @author Jonathan Buttigieg |
| 542 |
* @deprecated |
| 543 |
* |
| 544 |
* @param int $image_id An image ID. |
| 545 |
*/ |
| 546 |
function _imagify_ngg_delete_picture( $image_id ) { |
| 547 |
_deprecated_function( __FUNCTION__ . '()', '1.6.13', 'Imagify_NGG_DB::get_instance()->delete( $image_id )' ); |
| 548 |
|
| 549 |
Imagify_NGG_DB::get_instance()->delete( $image_id ); |
| 550 |
} |
| 551 |
|
| 552 |
/** |
| 553 |
* Create the Imagify table needed for NGG compatibility. |
| 554 |
* |
| 555 |
* @since 1.5 |
| 556 |
* @since 1.7 Deprecated. |
| 557 |
* @author Jonathan Buttigieg |
| 558 |
* @deprecated |
| 559 |
*/ |
| 560 |
function _imagify_create_ngg_table() { |
| 561 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_NGG_DB::get_instance()->maybe_upgrade_table()' ); |
| 562 |
|
| 563 |
Imagify_NGG_DB::get_instance()->maybe_upgrade_table(); |
| 564 |
} |
| 565 |
|
| 566 |
/** |
| 567 |
* Update all Imagify stats for NGG Bulk Optimization. |
| 568 |
* |
| 569 |
* @since 1.5 |
| 570 |
* @since 1.7 Deprecated. |
| 571 |
* @author Jonathan Buttigieg |
| 572 |
* @deprecated |
| 573 |
*/ |
| 574 |
function _imagify_ngg_update_bulk_stats() { |
| 575 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'imagify_ngg_bulk_page_data()' ); |
| 576 |
|
| 577 |
if ( empty( $_GET['page'] ) || imagify_get_ngg_bulk_screen_slug() !== $_GET['page'] ) { // WPCS: CSRF ok. |
| 578 |
return; |
| 579 |
} |
| 580 |
|
| 581 |
add_filter( 'imagify_count_attachments' , 'imagify_ngg_count_attachments' ); |
| 582 |
add_filter( 'imagify_count_optimized_attachments' , 'imagify_ngg_count_optimized_attachments' ); |
| 583 |
add_filter( 'imagify_count_error_attachments' , 'imagify_ngg_count_error_attachments' ); |
| 584 |
add_filter( 'imagify_count_unoptimized_attachments' , 'imagify_ngg_count_unoptimized_attachments' ); |
| 585 |
add_filter( 'imagify_percent_optimized_attachments' , 'imagify_ngg_percent_optimized_attachments' ); |
| 586 |
add_filter( 'imagify_count_saving_data' , 'imagify_ngg_count_saving_data', 8 ); |
| 587 |
} |
| 588 |
|
| 589 |
endif; |
| 590 |
|
| 591 |
/** |
| 592 |
* Combine two arrays with some specific keys. |
| 593 |
* We use this function to combine the result of 2 SQL queries. |
| 594 |
* |
| 595 |
* @since 1.4.5 |
| 596 |
* @since 1.6.7 Added the $keep_keys_order parameter. |
| 597 |
* @since 1.6.13 Deprecated. |
| 598 |
* @deprecated |
| 599 |
* |
| 600 |
* @param array $keys An array of keys. |
| 601 |
* @param array $values An array of arrays like array( 'id' => id, 'value' => value ). |
| 602 |
* @param int $keep_keys_order Set to true to return an array ordered like $keys instead of $values. |
| 603 |
* @return array The combined arrays. |
| 604 |
*/ |
| 605 |
function imagify_query_results_combine( $keys, $values, $keep_keys_order = false ) { |
| 606 |
_deprecated_function( __FUNCTION__ . '()', '1.6.13', 'Imagify_DB::combine_query_results( $keys, $values, $keep_keys_order )' ); |
| 607 |
|
| 608 |
return Imagify_DB::combine_query_results( $keys, $values, $keep_keys_order ); |
| 609 |
} |
| 610 |
|
| 611 |
/** |
| 612 |
* A helper to retrieve all values from one or several post metas, given a list of post IDs. |
| 613 |
* The $wpdb cache is flushed to save memory. |
| 614 |
* |
| 615 |
* @since 1.6.7 |
| 616 |
* @since 1.6.13 Deprecated. |
| 617 |
* @author Grégory Viguier |
| 618 |
* @deprecated |
| 619 |
* |
| 620 |
* @param array $metas An array of meta names like: |
| 621 |
* array( |
| 622 |
* 'key1' => 'meta_name_1', |
| 623 |
* 'key2' => 'meta_name_2', |
| 624 |
* 'key3' => 'meta_name_3', |
| 625 |
* ) |
| 626 |
* If a key contains 'data', the results will be unserialized. |
| 627 |
* @param array $ids An array of post IDs. |
| 628 |
* @return array An array of arrays of results like: |
| 629 |
* array( |
| 630 |
* 'key1' => array( post_id_1 => 'result_1', post_id_2 => 'result_2', post_id_3 => 'result_3' ), |
| 631 |
* 'key2' => array( post_id_1 => 'result_4', post_id_3 => 'result_5' ), |
| 632 |
* 'key3' => array( post_id_1 => 'result_6', post_id_2 => 'result_7' ), |
| 633 |
* ) |
| 634 |
*/ |
| 635 |
function imagify_get_wpdb_metas( $metas, $ids ) { |
| 636 |
_deprecated_function( __FUNCTION__ . '()', '1.6.13', 'Imagify_DB::get_metas( $metas, $ids )' ); |
| 637 |
|
| 638 |
return Imagify_DB::get_metas( $metas, $ids ); |
| 639 |
} |
| 640 |
|
| 641 |
/** |
| 642 |
* Get all mime types which could be optimized by Imagify. |
| 643 |
* |
| 644 |
* @since 1.3 |
| 645 |
* @since 1.7 Deprecated. |
| 646 |
* @deprecated |
| 647 |
* |
| 648 |
* @return array $mime_type The mime type. |
| 649 |
*/ |
| 650 |
function get_imagify_mime_type() { |
| 651 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'imagify_get_mime_types()' ); |
| 652 |
|
| 653 |
return imagify_get_mime_types(); |
| 654 |
} |
| 655 |
|
| 656 |
/** |
| 657 |
* Planning cron. |
| 658 |
* If the task is not programmed, it is automatically triggered. |
| 659 |
* |
| 660 |
* @since 1.4.2 |
| 661 |
* @since 1.7 Deprecated. |
| 662 |
* @deprecated |
| 663 |
*/ |
| 664 |
function _imagify_rating_scheduled() { |
| 665 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Cron_Rating::get_instance()->schedule_event()' ); |
| 666 |
|
| 667 |
Imagify_Cron_Rating::get_instance()->schedule_event(); |
| 668 |
} |
| 669 |
|
| 670 |
/** |
| 671 |
* Save the user images count to display it later in a notice message to ask him to rate Imagify on WordPress.org. |
| 672 |
* |
| 673 |
* @since 1.4.2 |
| 674 |
* @since 1.7 Deprecated. |
| 675 |
* @deprecated |
| 676 |
*/ |
| 677 |
function _do_imagify_rating_cron() { |
| 678 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Cron_Rating::get_instance()->do_event()' ); |
| 679 |
|
| 680 |
Imagify_Cron_Rating::get_instance()->do_event(); |
| 681 |
} |
| 682 |
|
| 683 |
/** |
| 684 |
* Adds weekly interval for cron jobs. |
| 685 |
* |
| 686 |
* @since 1.6 |
| 687 |
* @since 1.7 Deprecated. |
| 688 |
* @author Remy Perona |
| 689 |
* @deprecated |
| 690 |
* |
| 691 |
* @param Array $schedules An array of intervals used by cron jobs. |
| 692 |
* @return Array Updated array of intervals. |
| 693 |
*/ |
| 694 |
function imagify_purge_cron_schedule( $schedules ) { |
| 695 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Cron_Library_Size::get_instance()->maybe_add_recurrence( $schedules )' ); |
| 696 |
|
| 697 |
return Imagify_Cron_Library_Size::get_instance()->do_event( $schedules ); |
| 698 |
} |
| 699 |
|
| 700 |
/** |
| 701 |
* Planning cron task to update weekly the size of the images and the size of images uploaded by month. |
| 702 |
* If the task is not programmed, it is automatically triggered. |
| 703 |
* |
| 704 |
* @since 1.6 |
| 705 |
* @since 1.7 Deprecated. |
| 706 |
* @author Remy Perona |
| 707 |
* @deprecated |
| 708 |
*/ |
| 709 |
function _imagify_update_library_size_calculations_scheduled() { |
| 710 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Cron_Library_Size::get_instance()->schedule_event()' ); |
| 711 |
|
| 712 |
Imagify_Cron_Library_Size::get_instance()->schedule_event(); |
| 713 |
} |
| 714 |
|
| 715 |
/** |
| 716 |
* Cron task to update weekly the size of the images and the size of images uploaded by month. |
| 717 |
* |
| 718 |
* @since 1.6 |
| 719 |
* @since 1.7 Deprecated. |
| 720 |
* @author Remy Perona |
| 721 |
* @deprecated |
| 722 |
*/ |
| 723 |
function _do_imagify_update_library_size_calculations() { |
| 724 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Cron_Library_Size::get_instance()->do_event()' ); |
| 725 |
|
| 726 |
Imagify_Cron_Library_Size::get_instance()->do_event(); |
| 727 |
} |
| 728 |
|
| 729 |
if ( is_admin() ) : |
| 730 |
|
| 731 |
/** |
| 732 |
* Add some CSS on the whole administration. |
| 733 |
* |
| 734 |
* @since 1.0 |
| 735 |
* @since 1.6.10 Deprecated. |
| 736 |
* @deprecated |
| 737 |
*/ |
| 738 |
function _imagify_admin_print_styles() { |
| 739 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Assets::get_instance()->enqueue_styles_and_scripts()' ); |
| 740 |
|
| 741 |
Imagify_Assets::get_instance()->enqueue_styles_and_scripts(); |
| 742 |
} |
| 743 |
|
| 744 |
/** |
| 745 |
* Add Intercom on Options page an Bulk Optimization. |
| 746 |
* |
| 747 |
* @since 1.0 |
| 748 |
* @since 1.6.10 Deprecated. |
| 749 |
* @deprecated |
| 750 |
*/ |
| 751 |
function _imagify_admin_print_intercom() { |
| 752 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Assets::get_instance()->print_support_script()' ); |
| 753 |
|
| 754 |
Imagify_Assets::get_instance()->print_support_script(); |
| 755 |
} |
| 756 |
|
| 757 |
/** |
| 758 |
* Add Intercom on Options page an Bulk Optimization |
| 759 |
* |
| 760 |
* @since 1.5 |
| 761 |
* @since 1.6.10 Deprecated. |
| 762 |
* @author Jonathan Buttigieg |
| 763 |
* @deprecated |
| 764 |
*/ |
| 765 |
function _imagify_ngg_admin_print_intercom() { |
| 766 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Assets::get_instance()->print_support_script()' ); |
| 767 |
|
| 768 |
$current_screen = get_current_screen(); |
| 769 |
|
| 770 |
if ( isset( $current_screen ) && false !== strpos( $current_screen->base, '_page_imagify-ngg-bulk-optimization' ) ) { |
| 771 |
Imagify_Assets::get_instance()->print_support_script(); |
| 772 |
} |
| 773 |
} |
| 774 |
|
| 775 |
/** |
| 776 |
* A helper to deprecate old admin notice functions. |
| 777 |
* |
| 778 |
* @since 1.6.10 |
| 779 |
* @author Grégory Viguier |
| 780 |
* @see Imagify_Notices::notices() |
| 781 |
* @deprecated |
| 782 |
* |
| 783 |
* @param string $function The function to deprecate. |
| 784 |
* @param string $notice_id The notice to deprecate. |
| 785 |
*/ |
| 786 |
function _imagify_deprecate_old_notice( $function, $notice_id ) { |
| 787 |
_deprecated_function( $function . '()', '1.6.10' ); |
| 788 |
|
| 789 |
$notices = Imagify_Notices::get_instance(); |
| 790 |
$callback = 'display_' . str_replace( '-', '_', $notice_id ); |
| 791 |
$data = method_exists( $notices, $callback ) ? call_user_func( array( $notices, $callback ) ) : false; |
| 792 |
|
| 793 |
if ( $data ) { |
| 794 |
Imagify_Views::get_instance()->print_template( 'notice-' . $notice_id, $data ); |
| 795 |
} |
| 796 |
} |
| 797 |
|
| 798 |
/** |
| 799 |
* This warning is displayed when the API key is empty. |
| 800 |
* |
| 801 |
* @since 1.0 |
| 802 |
* @since 1.6.10 Deprecated. |
| 803 |
* @author Jonathan Buttigieg |
| 804 |
* @deprecated |
| 805 |
*/ |
| 806 |
function _imagify_warning_empty_api_key_notice() { |
| 807 |
_imagify_deprecate_old_notice( __FUNCTION__, 'welcome-steps' ); |
| 808 |
} |
| 809 |
|
| 810 |
/** |
| 811 |
* This warning is displayed when the API key is empty. |
| 812 |
* |
| 813 |
* @since 1.0 |
| 814 |
* @since 1.6.10 Deprecated. |
| 815 |
* @author Jonathan Buttigieg |
| 816 |
* @deprecated |
| 817 |
*/ |
| 818 |
function _imagify_warning_wrong_api_key_notice() { |
| 819 |
_imagify_deprecate_old_notice( __FUNCTION__, 'wrong-api-key' ); |
| 820 |
} |
| 821 |
|
| 822 |
/** |
| 823 |
* This warning is displayed when some plugins may conflict with Imagify. |
| 824 |
* |
| 825 |
* @since 1.0 |
| 826 |
* @since 1.6.10 Deprecated. |
| 827 |
* @author Jonathan Buttigieg |
| 828 |
* @deprecated |
| 829 |
*/ |
| 830 |
function _imagify_warning_plugins_to_deactivate_notice() { |
| 831 |
_imagify_deprecate_old_notice( __FUNCTION__, 'plugins-to-deactivate' ); |
| 832 |
} |
| 833 |
|
| 834 |
/** |
| 835 |
* This notice is displayed when external HTTP requests are blocked via the WP_HTTP_BLOCK_EXTERNAL constant. |
| 836 |
* |
| 837 |
* @since 1.0 |
| 838 |
* @since 1.6.10 Deprecated. |
| 839 |
* @author Jonathan Buttigieg |
| 840 |
* @deprecated |
| 841 |
*/ |
| 842 |
function _imagify_http_block_external_notice() { |
| 843 |
_imagify_deprecate_old_notice( __FUNCTION__, 'http-block-external' ); |
| 844 |
} |
| 845 |
|
| 846 |
/** |
| 847 |
* This warning is displayed when the grid view is active on the library. |
| 848 |
* |
| 849 |
* @since 1.0.2 |
| 850 |
* @since 1.6.10 Deprecated. |
| 851 |
* @author Jonathan Buttigieg |
| 852 |
* @deprecated |
| 853 |
*/ |
| 854 |
function _imagify_warning_grid_view_notice() { |
| 855 |
_imagify_deprecate_old_notice( __FUNCTION__, 'grid-view' ); |
| 856 |
} |
| 857 |
|
| 858 |
/** |
| 859 |
* This warning is displayed to warn the user that its quota is consumed for the current month. |
| 860 |
* |
| 861 |
* @since 1.1.1 |
| 862 |
* @since 1.6.10 Deprecated. |
| 863 |
* @author Jonathan Buttigieg |
| 864 |
* @deprecated |
| 865 |
*/ |
| 866 |
function _imagify_warning_over_quota_notice() { |
| 867 |
_imagify_deprecate_old_notice( __FUNCTION__, 'over-quota' ); |
| 868 |
} |
| 869 |
|
| 870 |
/** |
| 871 |
* This warning is displayed if the backup folder is not writable. |
| 872 |
* |
| 873 |
* @since 1.6.8 |
| 874 |
* @since 1.6.10 Deprecated. |
| 875 |
* @author Grégory Viguier |
| 876 |
* @deprecated |
| 877 |
*/ |
| 878 |
function _imagify_warning_backup_folder_not_writable_notice() { |
| 879 |
_imagify_deprecate_old_notice( __FUNCTION__, 'backup-folder-not-writable' ); |
| 880 |
} |
| 881 |
|
| 882 |
/** |
| 883 |
* Add a message about WP Rocket on the "Bulk Optimization" screen. |
| 884 |
* |
| 885 |
* @since 1.6.10 Deprecated. |
| 886 |
* @author Jonathan Buttigieg |
| 887 |
* @deprecated |
| 888 |
*/ |
| 889 |
function _imagify_rocket_notice() { |
| 890 |
_imagify_deprecate_old_notice( __FUNCTION__, 'rocket' ); |
| 891 |
} |
| 892 |
|
| 893 |
/** |
| 894 |
* This notice is displayed to rate the plugin after 100 optimization & 7 days after the first installation. |
| 895 |
* |
| 896 |
* @since 1.4.2 |
| 897 |
* @since 1.6.10 Deprecated. |
| 898 |
* @author Jonathan Buttigieg |
| 899 |
* @deprecated |
| 900 |
*/ |
| 901 |
function _imagify_rating_notice() { |
| 902 |
_imagify_deprecate_old_notice( __FUNCTION__, 'rating' ); |
| 903 |
} |
| 904 |
|
| 905 |
/** |
| 906 |
* Stop the rating cron when the notice is dismissed. |
| 907 |
* |
| 908 |
* @since 1.6.10 Deprecated. |
| 909 |
* @deprecated |
| 910 |
* |
| 911 |
* @param string $notice The notice name. |
| 912 |
*/ |
| 913 |
function _imagify_clear_scheduled_rating( $notice ) { |
| 914 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::get_instance()->clear_scheduled_rating( $notice )' ); |
| 915 |
|
| 916 |
Imagify_Notices::get_instance()->clear_scheduled_rating( $notice ); |
| 917 |
} |
| 918 |
|
| 919 |
/** |
| 920 |
* Process a dismissed notice. |
| 921 |
* |
| 922 |
* @since 1.0 |
| 923 |
* @since 1.6.10 Deprecated. |
| 924 |
* @author Jonathan Buttigieg |
| 925 |
* @deprecated |
| 926 |
*/ |
| 927 |
function _do_admin_post_imagify_dismiss_notice() { |
| 928 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::get_instance()->admin_post_dismiss_notice()' ); |
| 929 |
|
| 930 |
Imagify_Notices::get_instance()->admin_post_dismiss_notice(); |
| 931 |
} |
| 932 |
|
| 933 |
/** |
| 934 |
* Disable a plugin which can be in conflict with Imagify |
| 935 |
* |
| 936 |
* @since 1.2 |
| 937 |
* @since 1.6.10 Deprecated. |
| 938 |
* @author Jonathan Buttigieg |
| 939 |
* @deprecated |
| 940 |
*/ |
| 941 |
function _imagify_deactivate_plugin() { |
| 942 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::get_instance()->deactivate_plugin()' ); |
| 943 |
|
| 944 |
Imagify_Notices::get_instance()->deactivate_plugin(); |
| 945 |
} |
| 946 |
|
| 947 |
/** |
| 948 |
* Renew a dismissed Imagify notice. |
| 949 |
* |
| 950 |
* @since 1.0 |
| 951 |
* @since 1.6.10 Deprecated. |
| 952 |
* @deprecated |
| 953 |
* |
| 954 |
* @param string $notice A notice ID. |
| 955 |
* @param int $user_id A user ID. |
| 956 |
* @return void |
| 957 |
*/ |
| 958 |
function imagify_renew_notice( $notice, $user_id = 0 ) { |
| 959 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::renew_notice( $notice, $user_id )' ); |
| 960 |
|
| 961 |
Imagify_Notices::renew_notice( $notice, $user_id ); |
| 962 |
} |
| 963 |
|
| 964 |
/** |
| 965 |
* Dismiss an Imagify notice. |
| 966 |
* |
| 967 |
* @since 1.0 |
| 968 |
* @since 1.6.10 Deprecated. |
| 969 |
* @deprecated |
| 970 |
* |
| 971 |
* @param string $notice A notice ID. |
| 972 |
* @param int $user_id A user ID. |
| 973 |
* @return void |
| 974 |
*/ |
| 975 |
function imagify_dismiss_notice( $notice, $user_id = 0 ) { |
| 976 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::dismiss_notice( $notice, $user_id )' ); |
| 977 |
|
| 978 |
Imagify_Notices::dismiss_notice( $notice, $user_id ); |
| 979 |
} |
| 980 |
|
| 981 |
/** |
| 982 |
* Tell if an Imagify notice is dismissed. |
| 983 |
* |
| 984 |
* @since 1.6.5 |
| 985 |
* @since 1.6.10 Deprecated. |
| 986 |
* @author Grégory Viguier |
| 987 |
* @deprecated |
| 988 |
* |
| 989 |
* @param string $notice A notice ID. |
| 990 |
* @param int $user_id A user ID. |
| 991 |
* @return bool |
| 992 |
*/ |
| 993 |
function imagify_notice_is_dismissed( $notice, $user_id = 0 ) { |
| 994 |
_deprecated_function( __FUNCTION__ . '()', '1.6.10', 'Imagify_Notices::notice_is_dismissed( $notice, $user_id )' ); |
| 995 |
|
| 996 |
return Imagify_Notices::notice_is_dismissed( $notice, $user_id ); |
| 997 |
} |
| 998 |
|
| 999 |
/** |
| 1000 |
* Process all thumbnails of a specific image with Imagify with the manual method. |
| 1001 |
* |
| 1002 |
* @since 1.0 |
| 1003 |
* @since 1.6.11 Deprecated. |
| 1004 |
* @author Jonathan Buttigieg |
| 1005 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_upload_callback() |
| 1006 |
* @deprecated |
| 1007 |
*/ |
| 1008 |
function _do_admin_post_imagify_manual_upload() { |
| 1009 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_upload_callback()' ); |
| 1010 |
|
| 1011 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_upload_callback(); |
| 1012 |
} |
| 1013 |
|
| 1014 |
/** |
| 1015 |
* Process all thumbnails of a specific image with Imagify with a different optimization level. |
| 1016 |
* |
| 1017 |
* @since 1.0 |
| 1018 |
* @since 1.6.11 Deprecated. |
| 1019 |
* @author Jonathan Buttigieg |
| 1020 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_override_upload_callback() |
| 1021 |
* @deprecated |
| 1022 |
*/ |
| 1023 |
function _do_admin_post_imagify_manual_override_upload() { |
| 1024 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_override_upload_callback()' ); |
| 1025 |
|
| 1026 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_manual_override_upload_callback(); |
| 1027 |
} |
| 1028 |
|
| 1029 |
/** |
| 1030 |
* Process one or some thumbnails that are not optimized yet. |
| 1031 |
* |
| 1032 |
* @since 1.6.10 |
| 1033 |
* @since 1.6.11 Deprecated. |
| 1034 |
* @author Grégory Viguier |
| 1035 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_optimize_missing_sizes_callback() |
| 1036 |
* @deprecated |
| 1037 |
*/ |
| 1038 |
function _do_admin_post_imagify_optimize_missing_sizes() { |
| 1039 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_optimize_missing_sizes_callback()' ); |
| 1040 |
|
| 1041 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_optimize_missing_sizes_callback(); |
| 1042 |
} |
| 1043 |
|
| 1044 |
/** |
| 1045 |
* Process a restoration to the original attachment. |
| 1046 |
* |
| 1047 |
* @since 1.0 |
| 1048 |
* @since 1.6.11 Deprecated. |
| 1049 |
* @author Jonathan Buttigieg |
| 1050 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_restore_upload_callback() |
| 1051 |
* @deprecated |
| 1052 |
*/ |
| 1053 |
function _do_admin_post_imagify_restore_upload() { |
| 1054 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_restore_upload_callback()' ); |
| 1055 |
|
| 1056 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_restore_upload_callback(); |
| 1057 |
} |
| 1058 |
|
| 1059 |
/** |
| 1060 |
* Process all thumbnails of a specific image with Imagify with the bulk method. |
| 1061 |
* |
| 1062 |
* @since 1.0 |
| 1063 |
* @since 1.6.11 Deprecated. |
| 1064 |
* @author Jonathan Buttigieg |
| 1065 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_bulk_upload_callback() |
| 1066 |
* @deprecated |
| 1067 |
*/ |
| 1068 |
function _do_wp_ajax_imagify_bulk_upload() { |
| 1069 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_bulk_upload_callback()' ); |
| 1070 |
|
| 1071 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_bulk_upload_callback(); |
| 1072 |
} |
| 1073 |
|
| 1074 |
/** |
| 1075 |
* Optimize image on picture uploading with async request. |
| 1076 |
* |
| 1077 |
* @since 1.5 |
| 1078 |
* @since 1.6.11 Deprecated. |
| 1079 |
* @author Julio Potier |
| 1080 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_upload_new_media_callback() |
| 1081 |
* @deprecated |
| 1082 |
*/ |
| 1083 |
function _do_admin_post_async_optimize_upload_new_media() { |
| 1084 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_upload_new_media_callback()' ); |
| 1085 |
|
| 1086 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_upload_new_media_callback(); |
| 1087 |
} |
| 1088 |
|
| 1089 |
/** |
| 1090 |
* Optimize image on picture editing (resize, crop...) with async request. |
| 1091 |
* |
| 1092 |
* @since 1.4 |
| 1093 |
* @since 1.6.11 Deprecated. |
| 1094 |
* @author Julio Potier |
| 1095 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_save_image_editor_file_callback() |
| 1096 |
* @deprecated |
| 1097 |
*/ |
| 1098 |
function _do_admin_post_async_optimize_save_image_editor_file() { |
| 1099 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_save_image_editor_file_callback()' ); |
| 1100 |
|
| 1101 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_async_optimize_save_image_editor_file_callback(); |
| 1102 |
} |
| 1103 |
|
| 1104 |
/** |
| 1105 |
* Get all unoptimized attachment ids. |
| 1106 |
* |
| 1107 |
* @since 1.0 |
| 1108 |
* @since 1.6.11 Deprecated. |
| 1109 |
* @author Jonathan Buttigieg |
| 1110 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_get_unoptimized_attachment_ids_callback() |
| 1111 |
* @deprecated |
| 1112 |
*/ |
| 1113 |
function _do_wp_ajax_imagify_get_unoptimized_attachment_ids() { |
| 1114 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_get_unoptimized_attachment_ids_callback()' ); |
| 1115 |
|
| 1116 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_get_unoptimized_attachment_ids_callback(); |
| 1117 |
} |
| 1118 |
|
| 1119 |
/** |
| 1120 |
* Check if the backup directory is writable. |
| 1121 |
* This is used to display an error message in the plugin's settings page. |
| 1122 |
* |
| 1123 |
* @since 1.6.8 |
| 1124 |
* @since 1.6.11 Deprecated. |
| 1125 |
* @author Grégory Viguier |
| 1126 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_check_backup_dir_is_writable_callback() |
| 1127 |
* @deprecated |
| 1128 |
*/ |
| 1129 |
function _do_wp_ajax_imagify_check_backup_dir_is_writable() { |
| 1130 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_check_backup_dir_is_writable_callback()' ); |
| 1131 |
|
| 1132 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_check_backup_dir_is_writable_callback(); |
| 1133 |
} |
| 1134 |
|
| 1135 |
/** |
| 1136 |
* Create a new Imagify account. |
| 1137 |
* |
| 1138 |
* @since 1.0 |
| 1139 |
* @since 1.6.11 Deprecated. |
| 1140 |
* @author Jonathan Buttigieg |
| 1141 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_signup_callback() |
| 1142 |
* @deprecated |
| 1143 |
*/ |
| 1144 |
function _do_wp_ajax_imagify_signup() { |
| 1145 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_signup_callback()' ); |
| 1146 |
|
| 1147 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_signup_callback(); |
| 1148 |
} |
| 1149 |
|
| 1150 |
/** |
| 1151 |
* Process an API key check validity. |
| 1152 |
* |
| 1153 |
* @since 1.0 |
| 1154 |
* @since 1.6.11 Deprecated. |
| 1155 |
* @author Jonathan Buttigieg |
| 1156 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_check_api_key_validity_callback() |
| 1157 |
* @deprecated |
| 1158 |
*/ |
| 1159 |
function _do_wp_ajax_imagify_check_api_key_validity() { |
| 1160 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_check_api_key_validity_callback()' ); |
| 1161 |
|
| 1162 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_check_api_key_validity_callback(); |
| 1163 |
} |
| 1164 |
|
| 1165 |
/** |
| 1166 |
* Get admin bar profile output. |
| 1167 |
* |
| 1168 |
* @since 1.2.3 |
| 1169 |
* @since 1.6.11 Deprecated. |
| 1170 |
* @author Jonathan Buttigieg |
| 1171 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_get_admin_bar_profile_callback() |
| 1172 |
* @deprecated |
| 1173 |
*/ |
| 1174 |
function _do_wp_ajax_imagify_get_admin_bar_profile() { |
| 1175 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_get_admin_bar_profile_callback()' ); |
| 1176 |
|
| 1177 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_get_admin_bar_profile_callback(); |
| 1178 |
} |
| 1179 |
|
| 1180 |
/** |
| 1181 |
* Get pricings from API for Onetime and Plans at the same time. |
| 1182 |
* |
| 1183 |
* @since 1.6 |
| 1184 |
* @since 1.6.11 Deprecated. |
| 1185 |
* @author Geoffrey Crofte |
| 1186 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_get_prices_callback() |
| 1187 |
* @deprecated |
| 1188 |
*/ |
| 1189 |
function _imagify_get_prices_from_api() { |
| 1190 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_get_prices_callback()' ); |
| 1191 |
|
| 1192 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_get_prices_callback(); |
| 1193 |
} |
| 1194 |
|
| 1195 |
/** |
| 1196 |
* Check Coupon code on modal popin. |
| 1197 |
* |
| 1198 |
* @since 1.6 |
| 1199 |
* @since 1.6.11 Deprecated. |
| 1200 |
* @author Geoffrey Crofte |
| 1201 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_check_coupon_callback() |
| 1202 |
* @deprecated |
| 1203 |
*/ |
| 1204 |
function _imagify_check_coupon_code() { |
| 1205 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_check_coupon_callback()' ); |
| 1206 |
|
| 1207 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_check_coupon_callback(); |
| 1208 |
} |
| 1209 |
|
| 1210 |
/** |
| 1211 |
* Get current discount promotion to display information on payment modal. |
| 1212 |
* |
| 1213 |
* @since 1.6.3 |
| 1214 |
* @since 1.6.11 Deprecated. |
| 1215 |
* @author Geoffrey Crofte |
| 1216 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_get_discount_callback() |
| 1217 |
* @deprecated |
| 1218 |
*/ |
| 1219 |
function _imagify_get_discount() { |
| 1220 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_get_discount_callback()' ); |
| 1221 |
|
| 1222 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_get_discount_callback(); |
| 1223 |
} |
| 1224 |
|
| 1225 |
/** |
| 1226 |
* Get estimated sizes from the WordPress library. |
| 1227 |
* |
| 1228 |
* @since 1.6 |
| 1229 |
* @since 1.6.11 Deprecated. |
| 1230 |
* @author Geoffrey Crofte |
| 1231 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_get_images_counts_callback() |
| 1232 |
* @deprecated |
| 1233 |
*/ |
| 1234 |
function _imagify_get_estimated_sizes() { |
| 1235 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_get_images_counts_callback()' ); |
| 1236 |
|
| 1237 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_get_images_counts_callback(); |
| 1238 |
} |
| 1239 |
|
| 1240 |
/** |
| 1241 |
* Estimate sizes and update the options values for them. |
| 1242 |
* |
| 1243 |
* @since 1.6 |
| 1244 |
* @since 1.6.11 Deprecated. |
| 1245 |
* @author Remy Perona |
| 1246 |
* @see Imagify_Admin_Ajax_Post::get_instance()->imagify_update_estimate_sizes_callback() |
| 1247 |
* @deprecated |
| 1248 |
*/ |
| 1249 |
function _imagify_update_estimate_sizes() { |
| 1250 |
_deprecated_function( __FUNCTION__ . '()', '1.6.11', 'Imagify_Admin_Ajax_Post::get_instance()->imagify_update_estimate_sizes_callback()' ); |
| 1251 |
|
| 1252 |
Imagify_Admin_Ajax_Post::get_instance()->imagify_update_estimate_sizes_callback(); |
| 1253 |
} |
| 1254 |
|
| 1255 |
/** |
| 1256 |
* Fix the capability for our capacity filter hook |
| 1257 |
* |
| 1258 |
* @since 1.0 |
| 1259 |
* @since 1.7 Deprecated. |
| 1260 |
* @author Jonathan |
| 1261 |
* @deprecated |
| 1262 |
*/ |
| 1263 |
function _imagify_correct_capability_for_options_page() { |
| 1264 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->get_capability()' ); |
| 1265 |
|
| 1266 |
return Imagify_Settings::get_instance()->get_capability(); |
| 1267 |
} |
| 1268 |
|
| 1269 |
/** |
| 1270 |
* Tell to WordPress to be confident with our setting, we are clean! |
| 1271 |
* |
| 1272 |
* @since 1.0 |
| 1273 |
* @since 1.7 Deprecated. |
| 1274 |
* @author Jonathan |
| 1275 |
* @deprecated |
| 1276 |
*/ |
| 1277 |
function _imagify_register_setting() { |
| 1278 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->register()' ); |
| 1279 |
|
| 1280 |
Imagify_Settings::get_instance()->register(); |
| 1281 |
} |
| 1282 |
|
| 1283 |
/** |
| 1284 |
* Filter specific options before its value is (maybe) serialized and updated. |
| 1285 |
* |
| 1286 |
* @since 1.0 |
| 1287 |
* @since 1.7 Deprecated. |
| 1288 |
* @author Jonathan |
| 1289 |
* @deprecated |
| 1290 |
* |
| 1291 |
* @param mixed $value The new option value. |
| 1292 |
* @param mixed $old_value The old option value. |
| 1293 |
* @return array The new option value. |
| 1294 |
*/ |
| 1295 |
function _imagify_pre_update_option( $value, $old_value ) { |
| 1296 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->sanitize_and_validate( $value )' ); |
| 1297 |
|
| 1298 |
return Imagify_Settings::get_instance()->sanitize_and_validate( $value ); |
| 1299 |
} |
| 1300 |
|
| 1301 |
/** |
| 1302 |
* If the user clicked the "Save & Go to Bulk Optimizer" button, set a redirection to the bulk optimizer. |
| 1303 |
* We use this hook because it can be triggered even if the option value hasn't changed. |
| 1304 |
* |
| 1305 |
* @since 1.6.8 |
| 1306 |
* @since 1.7 Deprecated. |
| 1307 |
* @author Grégory Viguier |
| 1308 |
* @deprecated |
| 1309 |
* |
| 1310 |
* @param mixed $value The new, unserialized option value. |
| 1311 |
* @param mixed $old_value The old option value. |
| 1312 |
* @return mixed The option value. |
| 1313 |
*/ |
| 1314 |
function _imagify_maybe_set_redirection_before_save_options( $value, $old_value ) { |
| 1315 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->maybe_set_redirection( $value, $old_value )' ); |
| 1316 |
|
| 1317 |
return Imagify_Settings::get_instance()->maybe_set_redirection( $value, $old_value ); |
| 1318 |
} |
| 1319 |
|
| 1320 |
/** |
| 1321 |
* Used to launch some actions after saving the network options. |
| 1322 |
* |
| 1323 |
* @since 1.6.5 |
| 1324 |
* @since 1.7 Deprecated. |
| 1325 |
* @author Grégory Viguier |
| 1326 |
* @deprecated |
| 1327 |
* |
| 1328 |
* @param string $option Name of the network option. |
| 1329 |
* @param mixed $value Current value of the network option. |
| 1330 |
* @param mixed $old_value Old value of the network option. |
| 1331 |
*/ |
| 1332 |
function _imagify_after_save_network_options( $option, $value, $old_value ) { |
| 1333 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->after_save_network_options( $option, $value, $old_value )' ); |
| 1334 |
|
| 1335 |
Imagify_Settings::get_instance()->after_save_network_options( $option, $value, $old_value ); |
| 1336 |
} |
| 1337 |
|
| 1338 |
/** |
| 1339 |
* Used to launch some actions after saving the options. |
| 1340 |
* |
| 1341 |
* @since 1.0 |
| 1342 |
* @since 1.5 Used to redirect user to Bulk Optimizer (if requested). |
| 1343 |
* @since 1.6.8 Not used to redirect user to Bulk Optimizer anymore: see _imagify_maybe_set_redirection_before_save_options(). |
| 1344 |
* @since 1.7 Deprecated. |
| 1345 |
* @author Jonathan |
| 1346 |
* @deprecated |
| 1347 |
* |
| 1348 |
* @param mixed $old_value The old option value. |
| 1349 |
* @param mixed $value The new option value. |
| 1350 |
*/ |
| 1351 |
function _imagify_after_save_options( $old_value, $value ) { |
| 1352 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->after_save_options( $old_value, $value )' ); |
| 1353 |
|
| 1354 |
Imagify_Settings::get_instance()->after_save_options( $old_value, $value ); |
| 1355 |
} |
| 1356 |
|
| 1357 |
/** |
| 1358 |
* `options.php` do not handle site options. Let's use `admin-post.php` for multisite installations. |
| 1359 |
* |
| 1360 |
* @since 1.0 |
| 1361 |
* @since 1.7 Deprecated. |
| 1362 |
* @deprecated |
| 1363 |
*/ |
| 1364 |
function _imagify_update_site_option_on_network() { |
| 1365 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Settings::get_instance()->update_site_option_on_network()' ); |
| 1366 |
|
| 1367 |
Imagify_Settings::get_instance()->update_site_option_on_network(); |
| 1368 |
} |
| 1369 |
|
| 1370 |
/** |
| 1371 |
* Display the plan chooser section. |
| 1372 |
* |
| 1373 |
* @since 1.6 |
| 1374 |
* @since 1.7 Deprecated. |
| 1375 |
* @author Geoffrey |
| 1376 |
* @deprecated |
| 1377 |
* |
| 1378 |
* @return string HTML. |
| 1379 |
*/ |
| 1380 |
function get_imagify_new_to_imagify() { |
| 1381 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'imagify_get_template( \'part-new-to-imagify\' )' ); |
| 1382 |
|
| 1383 |
return imagify_get_template( 'part-new-to-imagify' ); |
| 1384 |
} |
| 1385 |
|
| 1386 |
/** |
| 1387 |
* Get the payment modal HTML. |
| 1388 |
* |
| 1389 |
* @since 1.6 |
| 1390 |
* @since 1.6.3 Include discount banners. |
| 1391 |
* @since 1.7 Deprecated. |
| 1392 |
* @author Geoffrey |
| 1393 |
* @deprecated |
| 1394 |
*/ |
| 1395 |
function imagify_payment_modal() { |
| 1396 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->print_template( \'modal-payment\' )' ); |
| 1397 |
|
| 1398 |
Imagify_Views::get_instance()->print_template( 'modal-payment' ); |
| 1399 |
} |
| 1400 |
|
| 1401 |
/** |
| 1402 |
* Print the discount banner used inside Payment Modal. |
| 1403 |
* |
| 1404 |
* @since 1.6.3 |
| 1405 |
* @since 1.7 Deprecated. |
| 1406 |
* @author Geoffrey Crofte |
| 1407 |
* @deprecated |
| 1408 |
*/ |
| 1409 |
function imagify_print_discount_banner() { |
| 1410 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->print_template( \'part-discount-banner\' )' ); |
| 1411 |
|
| 1412 |
Imagify_Views::get_instance()->print_template( 'part-discount-banner' ); |
| 1413 |
} |
| 1414 |
|
| 1415 |
/** |
| 1416 |
* Return the formatted price present in pricing tables. |
| 1417 |
* |
| 1418 |
* @since 1.6 |
| 1419 |
* @since 1.7 Deprecated. |
| 1420 |
* @author Geoffrey |
| 1421 |
* @deprecated |
| 1422 |
* |
| 1423 |
* @param float $value The price value. |
| 1424 |
* @return string The markuped price. |
| 1425 |
*/ |
| 1426 |
function get_imagify_price_table_format( $value ) { |
| 1427 |
_deprecated_function( __FUNCTION__ . '()', '1.7' ); |
| 1428 |
|
| 1429 |
$v = explode( '.', (string) $value ); |
| 1430 |
|
| 1431 |
return '<span class="imagify-price-big">' . $v[0] . '</span> <span class="imagify-price-mini">.' . ( strlen( $v[1] ) === 1 ? $v[1] . '0' : $v[1] ) . '</span>'; |
| 1432 |
} |
| 1433 |
|
| 1434 |
/** |
| 1435 |
* Add submenu in menu "Settings". |
| 1436 |
* |
| 1437 |
* @since 1.0 |
| 1438 |
* @since 1.7 Deprecated. |
| 1439 |
* @deprecated |
| 1440 |
*/ |
| 1441 |
function _imagify_settings_menu() { |
| 1442 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->add_network_menus()' ); |
| 1443 |
|
| 1444 |
Imagify_Views::get_instance()->add_network_menus(); |
| 1445 |
} |
| 1446 |
|
| 1447 |
/** |
| 1448 |
* Add submenu in menu "Media". |
| 1449 |
* |
| 1450 |
* @since 1.0 |
| 1451 |
* @since 1.7 Deprecated. |
| 1452 |
* @deprecated |
| 1453 |
*/ |
| 1454 |
function _imagify_bulk_optimization_menu() { |
| 1455 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->add_site_menus()' ); |
| 1456 |
|
| 1457 |
Imagify_Views::get_instance()->add_site_menus(); |
| 1458 |
} |
| 1459 |
|
| 1460 |
/** |
| 1461 |
* The main settings page. |
| 1462 |
* |
| 1463 |
* @since 1.0 |
| 1464 |
* @since 1.7 Deprecated. |
| 1465 |
* @deprecated |
| 1466 |
*/ |
| 1467 |
function _imagify_display_options_page() { |
| 1468 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->display_settings_page()' ); |
| 1469 |
|
| 1470 |
Imagify_Views::get_instance()->display_settings_page(); |
| 1471 |
} |
| 1472 |
|
| 1473 |
/** |
| 1474 |
* The bulk optimization page. |
| 1475 |
* |
| 1476 |
* @since 1.0 |
| 1477 |
* @since 1.7 Deprecated. |
| 1478 |
* @deprecated |
| 1479 |
*/ |
| 1480 |
function _imagify_display_bulk_page() { |
| 1481 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->display_bulk_page()' ); |
| 1482 |
|
| 1483 |
Imagify_Views::get_instance()->display_bulk_page(); |
| 1484 |
} |
| 1485 |
|
| 1486 |
/** |
| 1487 |
* Add link to the plugin configuration pages. |
| 1488 |
* |
| 1489 |
* @since 1.0 |
| 1490 |
* |
| 1491 |
* @param array $actions An array of action links. |
| 1492 |
* @return array |
| 1493 |
*/ |
| 1494 |
function _imagify_plugin_action_links( $actions ) { |
| 1495 |
_deprecated_function( __FUNCTION__ . '()', '1.7', 'Imagify_Views::get_instance()->plugin_action_links( $actions )' ); |
| 1496 |
|
| 1497 |
return Imagify_Views::get_instance()->plugin_action_links( $actions ); |
| 1498 |
} |
| 1499 |
|
| 1500 |
endif; |
| 1501 |
|