| @@ -1,23 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | 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 | 3 | |
| 16 | 4 | /* |
| 17 | 5 | Plugin Name: Embed Privacy |
| 18 | 6 | Description: Embed Privacy prevents from loading external embeds directly and lets the user control which one should be loaded. |
| 19 | -Version: 1.1.3 | |
| 7 | +Version: 0.1 | |
| 20 | 8 | Author: Epiphyt |
| 21 | 9 | Author URI: https://epiph.yt |
| 22 | 10 | License: GPL2 |
| 23 | 11 | License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| @@ -38,12 +26,12 @@ | ||
| 38 | 26 | along with Fury. If not, see https://www.gnu.org/licenses/gpl-2.0.html. |
| 39 | 27 | */ |
| 40 | 28 | |
| 41 | 29 | // exit if ABSPATH is not defined |
| 42 | -defined( 'ABSPATH' ) || exit; | |
| 30 | +\defined( 'ABSPATH' ) || exit; | |
| 43 | 31 | |
| 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__ ) ); | |
| 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__ ) ); | |
| 46 | 34 | |
| 47 | 35 | /** |
| 48 | 36 | * Autoload all necessary classes. |
| 49 | 37 | * |
| @@ -48,26 +36,24 @@ | ||
| 48 | 36 | * Autoload all necessary classes. |
| 49 | 37 | * |
| 50 | 38 | * @param string $class The class name of the autoloaded class |
| 51 | 39 | */ |
| 52 | -spl_autoload_register( function( $class ) { | |
| 53 | - $path = explode( '\\', $class ); | |
| 54 | - $filename = str_replace( '_', '-', strtolower( array_pop( $path ) ) ); | |
| 55 | - $class = str_replace( | |
| 40 | +\spl_autoload_register( function( string $class ) { | |
| 41 | + $path = \explode( '\\', $class ); | |
| 42 | + $filename = \str_replace( '_', '-', \strtolower( \array_pop( $path ) ) ); | |
| 43 | + $class = \str_replace( | |
| 56 | 44 | [ 'epiphyt\embed_privacy\\', '\\', '_' ], |
| 57 | 45 | [ '', '/', '-' ], |
| 58 | - strtolower( $class ) | |
| 46 | + \strtolower( $class ) | |
| 59 | 47 | ); |
| 60 | - $class = str_replace( $filename, 'class-' . $filename, $class ); | |
| 48 | + $class = \str_replace( $filename, 'class-' . $filename, $class ); | |
| 61 | 49 | $maybe_file = __DIR__ . '/inc/' . $class . '.php'; |
| 62 | 50 | |
| 63 | - if ( file_exists( $maybe_file ) ) { | |
| 51 | + if ( \file_exists( $maybe_file ) ) { | |
| 64 | 52 | require_once( __DIR__ . '/inc/' . $class . '.php' ); |
| 65 | 53 | } |
| 66 | 54 | } ); |
| 67 | 55 | |
| 68 | -Embed_Privacy_Widget_Output_Filter::get_instance(); | |
| 69 | -$embed_privacy = Embed_Privacy::get_instance(); | |
| 70 | -$embed_privacy->set_plugin_file( __FILE__ ); | |
| 56 | +$embed_privacy = new Embed_Privacy(); | |
| 71 | 57 | |
| 72 | -register_activation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] ); | |
| 73 | -register_deactivation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] ); | |
| 58 | +\register_activation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] ); | |
| 59 | +\register_deactivation_hook( __FILE__, [ $embed_privacy, 'clear_embed_cache' ] ); | |