KroneMultimedia /
plugin-flattable
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Plugin Name: KMM Flattable |
||||
| 4 | * Description: This is a short description of what the plugin does. |
||||
| 5 | * Plugin URI: http://github.com/KroneMultiMedia/plugin-flattable |
||||
| 6 | * Version: v9.9.9 |
||||
| 7 | * Author: Krone.at |
||||
| 8 | * Author URI: http://www.krone.at |
||||
| 9 | * Licence: MIT |
||||
| 10 | * Text Domain: kmm-flattable |
||||
| 11 | * Domain Path: /languages |
||||
| 12 | */ |
||||
| 13 | |||||
| 14 | namespace KMM\Flattable; |
||||
| 15 | |||||
| 16 | use KMM\Flattable\Core; |
||||
| 17 | |||||
| 18 | if ( ! function_exists( 'add_filter' ) ) { |
||||
| 19 | return; |
||||
| 20 | } |
||||
| 21 | |||||
| 22 | |||||
| 23 | /** |
||||
| 24 | * Ensure that autoload is already loaded or loads it if available. |
||||
| 25 | * |
||||
| 26 | * @param string $class_name |
||||
| 27 | * |
||||
| 28 | * @return bool |
||||
| 29 | */ |
||||
| 30 | function ensure_class_loaded( $class_name ) { |
||||
| 31 | |||||
| 32 | $class_exists = class_exists( $class_name ); |
||||
| 33 | $autoload_found = file_exists( __DIR__ . '/vendor/autoload.php' ); |
||||
| 34 | |||||
| 35 | // If the class does not exist, and the vendor file is there |
||||
| 36 | // maybe the plugin was installed separately via Composer, let's try to load autoload |
||||
| 37 | if ( ! $class_exists && $autoload_found ) { |
||||
| 38 | @require_once __DIR__ . '/vendor/autoload.php'; |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | return $class_exists || ( $autoload_found && class_exists( $class_name ) ); |
||||
| 42 | } |
||||
| 43 | |||||
| 44 | // Exit if classes are not available |
||||
| 45 | if ( ! ensure_class_loaded( __NAMESPACE__ . '\Core' ) ) { |
||||
| 46 | return; |
||||
| 47 | } |
||||
| 48 | |||||
| 49 | add_action( 'plugins_loaded', __NAMESPACE__ . '\main' ); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 50 | |||||
| 51 | |||||
| 52 | /** |
||||
| 53 | * @wp-hook plugins_loaded |
||||
| 54 | */ |
||||
| 55 | function main() { |
||||
| 56 | new Core(); |
||||
| 57 | |||||
| 58 | if ( is_admin() ) { |
||||
|
0 ignored issues
–
show
The function
is_admin was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 59 | // Backend |
||||
| 60 | |||||
| 61 | // TODO: register your backend-code here... |
||||
| 62 | |||||
| 63 | } else { |
||||
| 64 | // Frontend |
||||
| 65 | |||||
| 66 | // TODO: register frontend-code here... |
||||
| 67 | } |
||||
| 68 | |||||
| 69 | } |
||||
| 70 |