PluginProbe
Embed Privacy / 1.1.3
Embed Privacy v1.1.3
1.14.0 1.13.0 trunk 0.1 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.10 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 All 68 releases
embed-privacy / embed-privacy.php

embed-privacy.php in Embed Privacy 1.1.3, at embed-privacy.php

74 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace epiphyt\Embed_Privacy;
3 use function array_pop;
4 use function define;
5 use function defined;
6 use function explode;
7 use function file_exists;
8 use function plugin_dir_path;
9 use function plugin_dir_url;
10 use function register_activation_hook;
11 use function register_deactivation_hook;
12 use function spl_autoload_register;
13 use function str_replace;
14 use function strtolower;
15
16 /*
17 Plugin Name: Embed Privacy
18 Description: Embed Privacy prevents from loading external embeds directly and lets the user control which one should be loaded.
19 Version: 1.1.3
20 Author: Epiphyt
21 Author URI: https://epiph.yt
22 License: GPL2
23 License URI: https://www.gnu.org/licenses/gpl-2.0.html
24 Text Domain: embed-privacy
25 Domain Path: /languages
26
27 Embed Privacy is free software: you can redistribute it and/or modify
28 it under the terms of the GNU General Public License as published by
29 the Free Software Foundation, either version 2 of the License, or
30 any later version.
31
32 Embed Privacy is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35 GNU General Public License for more details.
36
37 You should have received a copy of the GNU General Public License
38 along with Fury. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
39 */
40
41 // exit if ABSPATH is not defined
42 defined( 'ABSPATH' ) || exit;
43
44 if ( ! defined( 'EPI_EMBED_PRIVACY_BASE' ) ) define( 'EPI_EMBED_PRIVACY_BASE', plugin_dir_path( __FILE__ ) );
45 if ( ! defined( 'EPI_EMBED_PRIVACY_URL' ) ) define( 'EPI_EMBED_PRIVACY_URL', plugin_dir_url( __FILE__ ) );
46
47 /**
48 * Autoload all necessary classes.
49 *
50 * @param string $class The class name of the autoloaded class
51 */
52 spl_autoload_register( function( $class ) {
53 $path = explode( '\\', $class );
54 $filename = str_replace( '_', '-', strtolower( array_pop( $path ) ) );
55 $class = str_replace(
56 [ 'epiphyt\embed_privacy\\', '\\', '_' ],
57 [ '', '/', '-' ],
58 strtolower( $class )
59 );
60 $class = str_replace( $filename, 'class-' . $filename, $class );
61 $maybe_file = __DIR__ . '/inc/' . $class . '.php';
62
63 if ( file_exists( $maybe_file ) ) {
64 require_once( __DIR__ . '/inc/' . $class . '.php' );
65 }
66 } );
67
68 Embed_Privacy_Widget_Output_Filter::get_instance();
69 $embed_privacy = Embed_Privacy::get_instance();
70 $embed_privacy->set_plugin_file( __FILE__ );
71
72 register_activation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] );
73 register_deactivation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] );
74