' . __( 'Github', 'simple-embed-code' ) . '' ), array( '' . __( 'Support', 'simple-embed-code' ) . '' ), array( '' . __( 'Donate', 'simple-embed-code' ) . '' ), array( '' . str_repeat( '', 5 ) . '' ), ); } return $links; } add_filter( 'plugin_row_meta', 'sec_plugin_meta', 10, 2 ); /** * Modify actions links. * * Add or remove links for the actions listed against this plugin * * @version 1.1 * @param string $actions Current actions. * @param string $plugin_file The plugin. * @return string Actions, now with deactivation removed! */ function sec_action_links( $actions, $plugin_file ) { // Make sure we only perform actions for this specific plugin! if ( strpos( $plugin_file, 'simple-code-embed.php' ) !== false ) { // Add link to the settings page. if ( current_user_can( 'manage_options' ) ) { array_unshift( $actions, '' . __( 'Settings', 'simple-embed-code' ) . '' ); } } return $actions; } add_filter( 'plugin_action_links', 'sec_action_links', 10, 2 ); /** * WordPress Requirements Check * * Deactivate the plugin if certain requirements are not met. * * @version 1.1 */ function sec_requirements_check() { $reason = ''; // Grab the plugin details. $plugins = get_plugins(); $name = $plugins[ CODE_EMBED_PLUGIN_BASE ]['Name']; // Check for a fork. if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) ) { /* translators: 1: The plugin name. */ $reason .= '
  • ' . 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 ) . '
  • '; } // If a requirement is not met, output the message and stop the plugin. if ( '' !== $reason ) { // Deactivate this plugin. deactivate_plugins( PLUGIN_NAME_PLUGIN_BASE ); // Set up a message and output it via wp_die. /* translators: 1: The plugin name. */ $message = '

    ' . sprintf( __( '%1$s has been deactivated', 'simple-embed-code' ), $name ) . '

    ' . __( 'Reason:', 'simple-embed-code' ) . '

    '; $allowed = array( 'p' => array(), 'b' => array(), 'ul' => array(), 'li' => array(), ); wp_die( wp_kses( $message, $allowed ), '', array( 'back_link' => true ) ); } } add_action( 'admin_init', 'sec_requirements_check' );