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