plugin_basename example

<?php echo esc_html( $message ); ?></p> </body> </html> <?php         if ( $deactivate ) {
            $plugins = get_option( 'active_plugins' );
            $akismet = plugin_basename( AKISMET__PLUGIN_DIR . 'akismet.php' );
            $update  = false;
            foreach ( $plugins as $i => $plugin ) {
                if ( $plugin === $akismet ) {
                    $plugins[$i] = false;
                    $update = true;
                }
            }

            if ( $update ) {
                update_option( 'active_plugins', array_filter( $plugins ) );
            }
        }
if ( empty( $_POST['plugin'] ) || empty( $_POST['slug'] ) ) {
        wp_send_json_error(
            array(
                'slug'         => '',
                'errorCode'    => 'no_plugin_specified',
                'errorMessage' => __( 'No plugin specified.' ),
            )
        );
    }

    $plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );

    $status = array(
        'update'     => 'plugin',
        'slug'       => sanitize_key( wp_unslash( $_POST['slug'] ) ),
        'oldVersion' => '',
        'newVersion' => '',
    );

    if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) {
        $status['errorMessage'] = __( 'Sorry, you are not allowed to update plugins for this site.' );
        wp_send_json_error( $status );
    }
// Site Wide Only is the old header for Network.     if ( ! $plugin_data['Network'] && $plugin_data['_sitewide'] ) {
        /* translators: 1: Site Wide Only: true, 2: Network: true */
        _deprecated_argument( __FUNCTION__, '3.0.0', sprintf( __( 'The %1$s plugin header is deprecated. Use %2$s instead.' ), '<code>Site Wide Only: true</code>', '<code>Network: true</code>' ) );
        $plugin_data['Network'] = $plugin_data['_sitewide'];
    }
    $plugin_data['Network'] = ( 'true' === strtolower( $plugin_data['Network'] ) );
    unset( $plugin_data['_sitewide'] );

    // If no text domain is defined fall back to the plugin slug.     if ( ! $plugin_data['TextDomain'] ) {
        $plugin_slug = dirname( plugin_basename( $plugin_file ) );
        if ( '.' !== $plugin_slug && ! str_contains( $plugin_slug, '/' ) ) {
            $plugin_data['TextDomain'] = $plugin_slug;
        }
    }

    if ( $markup || $translate ) {
        $plugin_data = _get_plugin_data_markup_translate( $plugin_file$plugin_data$markup$translate );
    } else {
        $plugin_data['Title']      = $plugin_data['Name'];
        $plugin_data['AuthorName'] = $plugin_data['Author'];
    }

    
$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );

    if ( ! empty( $plugin ) && str_starts_with( $plugin$mu_plugin_dir ) ) {
        $url = WPMU_PLUGIN_URL;
    } else {
        $url = WP_PLUGIN_URL;
    }

    $url = set_url_scheme( $url );

    if ( ! empty( $plugin ) && is_string( $plugin ) ) {
        $folder = dirname( plugin_basename( $plugin ) );
        if ( '.' !== $folder ) {
            $url .= '/' . ltrim( $folder, '/' );
        }
    }

    if ( $path && is_string( $path ) ) {
        $url .= '/' . ltrim( $path, '/' );
    }

    /** * Filters the URL to the plugins directory. * * @since 2.8.0 * * @param string $url The complete URL to the plugins directory including scheme and path. * @param string $path Path relative to the URL to the plugins directory. Blank string * if no path is specified. * @param string $plugin The plugin file path to be relative to. Blank string if no plugin * is specified. */

function register_activation_hook( $file$callback ) {
    $file = plugin_basename( $file );
    add_action( 'activate_' . $file$callback );
}

/** * Sets the deactivation hook for a plugin. * * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is * called. In the name of this hook, PLUGINNAME is replaced with the name * of the plugin, including the optional subdirectory. For example, when the * plugin is located in wp-content/plugins/sampleplugin/sample.php, then * the name of this hook will become 'deactivate_sampleplugin/sample.php'. * * When the plugin consists of only one file and is (as by default) located at * wp-content/plugins/sample.php the name of this hook will be * 'deactivate_sample.php'. * * @since 2.0.0 * * @param string $file The filename of the plugin including the path. * @param callable $callback The function hooked to the 'deactivate_PLUGIN' action. */

    public function validate_plugin_param( $file ) {
        if ( ! is_string( $file ) || ! preg_match( '/' . self::PATTERN . '/u', $file ) ) {
            return false;
        }

        $validated = validate_file( plugin_basename( $file ) );

        return 0 === $validated;
    }

    /** * Sanitizes the "plugin" parameter to be a proper plugin file with ".php" appended. * * @since 5.5.0 * * @param string $file The plugin file parameter. * @return string */

function wp_skip_paused_plugins( array $plugins ) {
    $paused_plugins = wp_paused_plugins()->get_all();

    if ( empty( $paused_plugins ) ) {
        return $plugins;
    }

    foreach ( $plugins as $index => $plugin ) {
        list( $plugin ) = explode( '/', plugin_basename( $plugin ) );

        if ( array_key_exists( $plugin$paused_plugins ) ) {
            unset( $plugins[ $index ] );

            // Store list of paused plugins for displaying an admin notice.             $GLOBALS['_paused_plugins'][ $plugin ] = $paused_plugins[ $plugin ];
        }
    }

    return $plugins;
}

add_action( 'rightnow_end', array( 'Akismet_Admin', 'rightnow_stats' ) );
        add_action( 'manage_comments_nav', array( 'Akismet_Admin', 'check_for_spam_button' ) );
        add_action( 'admin_action_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) );
        add_action( 'wp_ajax_akismet_recheck_queue', array( 'Akismet_Admin', 'recheck_queue' ) );
        add_action( 'wp_ajax_comment_author_deurl', array( 'Akismet_Admin', 'remove_comment_author_url' ) );
        add_action( 'wp_ajax_comment_author_reurl', array( 'Akismet_Admin', 'add_comment_author_url' ) );
        add_action( 'jetpack_auto_activate_akismet', array( 'Akismet_Admin', 'connect_jetpack_user' ) );

        add_filter( 'plugin_action_links', array( 'Akismet_Admin', 'plugin_action_links' ), 10, 2 );
        add_filter( 'comment_row_actions', array( 'Akismet_Admin', 'comment_row_action' ), 10, 2 );
        
        add_filter( 'plugin_action_links_'.plugin_basename( plugin_dir_path( __FILE__ ) . 'akismet.php'), array( 'Akismet_Admin', 'admin_plugin_settings_link' ) );
        
        add_filter( 'wxr_export_skip_commentmeta', array( 'Akismet_Admin', 'exclude_commentmeta_from_export' ), 10, 3 );
        
        add_filter( 'all_plugins', array( 'Akismet_Admin', 'modify_plugin_description' ) );

        // priority=1 because we need ours to run before core's comment anonymizer runs, and that's registered at priority=10         add_filter( 'wp_privacy_personal_data_erasers', array( 'Akismet_Admin', 'register_personal_data_eraser' ), 1 );
    }

    public static function admin_init() {
        if ( get_option( 'Activated_Akismet' ) ) {
            

global $pagenow$wp_importers$hook_suffix$plugin_page$typenow$taxnow;

$page_hook = null;

$editing = false;

if ( isset( $_GET['page'] ) ) {
    $plugin_page = wp_unslash( $_GET['page'] );
    $plugin_page = plugin_basename( $plugin_page );
}

if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
    $typenow = $_REQUEST['post_type'];
} else {
    $typenow = '';
}

if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
    $taxnow = $_REQUEST['taxonomy'];
} else {
    
Home | Imprint | This part of the site doesn't use cookies.