' . __( 'Github', 'no-self-ping' ) . '' ), array( '' . __( 'Support', 'no-self-ping' ) . '' ), array( '' . __( 'Donate', 'no-self-ping' ) . '' ), array( '' . str_repeat( '', 5 ) . '' ), ); } return $links; } add_filter( 'plugin_row_meta', 'nsp_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 nsp_action_links( $actions, $plugin_file ) { // Make sure we only perform actions for this specific plugin! if ( strpos( $plugin_file, 'no-self-ping.php' ) !== false ) { // Add link to the settings page. if ( current_user_can( 'manage_options' ) ) { array_unshift( $actions, '' . __( 'Settings', 'no-self-ping' ) . '' ); } } return $actions; } add_filter( 'plugin_action_links', 'nsp_action_links', 10, 2 ); /** * WordPress Fork Check * * Deactivate the plugin if an unsupported fork of WordPress is detected. * * @version 1.0 */ function nsp_fork_check() { // Check for a fork. if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) ) { // Grab the plugin details. $plugins = get_plugins(); $name = $plugins[ NO_SELF_PING_PLUGIN_BASE ]['Name']; // Deactivate this plugin. deactivate_plugins( NO_SELF_PING_PLUGIN_BASE ); // Set up a message and output it via wp_die. /* translators: 1: The plugin name. */ $message = '
' . sprintf( __( '%1$s has been deactivated', 'no-self-ping' ), $name ) . '
' . __( 'Reason:', 'no-self-ping' ) . '
'; /* translators: 1: The plugin name. */ $message .= '' . sprintf( __( 'The author of %1$s will not provide any support until the above are resolved.', 'no-self-ping' ), $name ) . '
'; $allowed = array( 'p' => array(), 'b' => array(), 'ul' => array(), 'li' => array(), ); wp_die( wp_kses( $message, $allowed ), '', array( 'back_link' => true ) ); } } add_action( 'admin_init', 'nsp_fork_check' );