PluginProbe
Gumlet – Image optimization with Resize, Compression, Lazy load, Caching & CDN delivery / 1.4.3
Gumlet – Image optimization with Resize, Compression, Lazy load, Caching & CDN delivery v1.4.3
1.4.3 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.40 1.1.41 All 116 releases
gumlet / gumlet.php

gumlet.php in Gumlet – Image optimization with Resize, Compression, Lazy load, Caching & CDN delivery 1.4.3, at gumlet.php

72 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WordPress plugin for gumlet service.
4 *
5 * @package gumlet-wordpress
6 * @author adityapatadia
7 * @license BSD-2
8 *
9 * @wordpress-plugin
10 *
11 * Plugin Name: Gumlet
12 * Plugin URI: https://github.com/gumlet/wordpress-plugin
13 * Description: A WordPress plugin to automatically load all your existing (and future) WordPress images via the <a href="http://www.gumlet.com" target="_blank">Gumlet</a> service for smaller, faster, and better looking images.
14 * Version: 1.4.3
15 * Requires at least: 6.0
16 * Requires PHP: 7.4
17 * Author: Gumlet
18 * Text Domain: gumlet
19 * Author URI: https://www.gumlet.com
20 */
21
22 ini_set('pcre.backtrack_limit', '20971520');
23
24 if (!defined('GUMLET_DEBUG')) {
25 define('GUMLET_DEBUG', isset($_GET['GUMLET_DEBUG']) ? $_GET['GUMLET_DEBUG'] : false);
26 }
27
28 if (GUMLET_DEBUG) {
29 error_reporting(E_ALL);
30 ini_set('display_errors', 1);
31 }
32
33 include('includes/compability.php');
34 include('includes/logger.php');
35 include('includes/gumlet-html-fragment.php');
36 include('includes/class-gumlet.php');
37 include('includes/options-page.php');
38
39
40 function gumlet_plugin_admin_action_links($links, $file)
41 {
42 if ($file === plugin_basename(__FILE__)) {
43 $settings_link = '<a href="options-general.php?page=gumlet-options">Settings</a>';
44 array_unshift($links, $settings_link);
45 }
46 return $links;
47 }
48
49 add_filter('plugin_action_links', 'gumlet_plugin_admin_action_links', 10, 2);
50
51 register_activation_hook(__FILE__, 'gumlet_plugin_activate');
52
53 function gumlet_plugin_activate()
54 {
55 // plugin activation code here...
56 if (!get_option('gumlet_settings')) {
57 update_option('gumlet_settings', ["lazy_load" => 1, "original_images" => 1, "auto_compress"=> 1, "server_webp"=> 0, "auto_resize" => 1]);
58 }
59 }
60
61 // Register oEmbed provider
62 function gumlet_oembed_provider_img() {
63 if ( ! function_exists( 'wp_oembed_add_provider' ) ) {
64
65 require_once ABSPATH . WPINC . '/embed.php';
66 }
67 wp_oembed_add_provider( '#https?://play\.gumlet\.io/embed/.*#i', 'https://api.gumlet.com/v1/oembed', true );
68 wp_oembed_add_provider( '#https?://gumlet\.tv/watch/.*#i', 'https://api.gumlet.com/v1/oembed', true );
69 }
70
71 add_action( 'init', 'gumlet_oembed_provider_img' );
72