| @@ -6,14 +6,8 @@ | ||
| 6 | 6 | * |
| 7 | 7 | * @package simple-embed-code |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -// Exit if accessed directly. | |
| 11 | - | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | - exit; | |
| 14 | -} | |
| 15 | - | |
| 16 | 10 | /** |
| 17 | 11 | * Add meta to plugin details |
| 18 | 12 | * |
| 19 | 13 | * Add options to plugin meta line |
| @@ -67,44 +61,35 @@ | ||
| 67 | 61 | |
| 68 | 62 | add_filter( 'plugin_action_links', 'sec_action_links', 10, 2 ); |
| 69 | 63 | |
| 70 | 64 | /** |
| 71 | - * WordPress Requirements Check | |
| 65 | + * WordPress Fork Check | |
| 72 | 66 | * |
| 73 | - * Deactivate the plugin if certain requirements are not met. | |
| 67 | + * Deactivate the plugin if an unsupported fork of WordPress is detected. | |
| 74 | 68 | * |
| 75 | - * @version 1.1 | |
| 69 | + * @version 1.0 | |
| 76 | 70 | */ |
| 77 | -function sec_requirements_check() { | |
| 71 | +function sec_fork_check() { | |
| 78 | 72 | |
| 79 | - $reason = ''; | |
| 80 | - | |
| 81 | - // Grab the plugin details. | |
| 82 | - | |
| 83 | - $plugins = get_plugins(); | |
| 84 | - $name = $plugins[ CODE_EMBED_PLUGIN_BASE ]['Name']; | |
| 85 | - | |
| 86 | 73 | // Check for a fork. |
| 87 | 74 | |
| 88 | 75 | if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) ) { |
| 89 | 76 | |
| 90 | - /* translators: 1: The plugin name. */ | |
| 91 | - $reason .= '<li>' . sprintf( __( 'A fork of WordPress was detected. %1$s has not been tested on this fork and, as a consequence, the author will not provide any support.', 'simple-embed-code' ), $name ) . '</li>'; | |
| 77 | + // Grab the plugin details. | |
| 92 | 78 | |
| 93 | - } | |
| 79 | + $plugins = get_plugins(); | |
| 80 | + $name = $plugins[ CODE_EMBED_PLUGIN_BASE ]['Name']; | |
| 94 | 81 | |
| 95 | - // If a requirement is not met, output the message and stop the plugin. | |
| 96 | - | |
| 97 | - if ( '' !== $reason ) { | |
| 98 | - | |
| 99 | 82 | // Deactivate this plugin. |
| 100 | 83 | |
| 101 | - deactivate_plugins( PLUGIN_NAME_PLUGIN_BASE ); | |
| 84 | + deactivate_plugins( CODE_EMBED_PLUGIN_BASE ); | |
| 102 | 85 | |
| 103 | 86 | // Set up a message and output it via wp_die. |
| 104 | 87 | |
| 105 | 88 | /* translators: 1: The plugin name. */ |
| 106 | - $message = '<p><b>' . sprintf( __( '%1$s has been deactivated', 'simple-embed-code' ), $name ) . '</b></p><p>' . __( 'Reason:', 'simple-embed-code' ) . '</p><ul>' . $reason . '</ul>'; | |
| 89 | + $message = '<p><b>' . sprintf( __( '%1$s has been deactivated', 'simple-embed-code' ), $name ) . '</b></p><p>' . __( 'Reason:', 'simple-embed-code' ) . '</p>'; | |
| 90 | + /* translators: 1: The plugin name. */ | |
| 91 | + $message .= '<ul><li>' . __( 'A fork of WordPress was detected.', 'simple-embed-code' ) . '</li></ul><p>' . sprintf( __( 'The author of %1$s will not provide any support until the above are resolved.', 'simple-embed-code' ), $name ) . '</p>'; | |
| 107 | 92 | |
| 108 | 93 | $allowed = array( |
| 109 | 94 | 'p' => array(), |
| 110 | 95 | 'b' => array(), |
| @@ -115,5 +100,5 @@ | ||
| 115 | 100 | wp_die( wp_kses( $message, $allowed ), '', array( 'back_link' => true ) ); |
| 116 | 101 | } |
| 117 | 102 | } |
| 118 | 103 | |
| 119 | -add_action( 'admin_init', 'sec_requirements_check' ); | |
| 104 | +add_action( 'admin_init', 'sec_fork_check' ); | |