includes/class-freemius.php
static function get_current_page() {
            if ( ! isset( self::$_pagenow ) ) {
                global $pagenow;
                if ( empty( $pagenow ) && is_admin() && is_multisite() ) {
                    /**
                     * It appears that `$pagenow` is not yet initialized in some network admin pages when this method
                     * is called, so initialize it here using some pieces of code from `wp-includes/vars.php`.
                     *
                     * @author Leo Fajardo (@leorw)
                     * @since 2.2.3
                     */
                    if ( is_network_admin() ) {
                        preg_match( '#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    } else if ( is_user_admin() ) {
                        preg_match( '#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    } else {
                        preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    }

                    $pagenow = $self_matches[1];
                    $pagenow = trim( $pagenow, '/' );
                    $pagenow = preg_replace( '#\?.*?$#', '', $pagenow );
                    if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
                        $pagenow = 'index.php';
                    } else {
                        preg_match( '#(.*?)(/|$)#', $pagenow, $self_matches );
                        $pagenow = strtolower( $self_matches[1] );
                        if ( '.php' !== substr($pagenow, -4, 4) )
                            $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
                    }
                }

                self::$_pagenow = $pagenow;

                if ( self::is_ajax() &&
                     'admin-ajax.php' === $pagenow
                ) {
                    $referer = fs_get_raw_referer();

                    if ( is_string( $referer ) ) {
                        $parts = explode( '?', $referer );

                        self::$_pagenow = basename( $parts[0] );
                    }
                }
            }

            return self::$_pagenow;
        }
static function get_current_page() {
            if ( ! isset( self::$_pagenow ) ) {
                global $pagenow;
                if ( empty( $pagenow ) && is_admin() && is_multisite() ) {
                    /**
                     * It appears that `$pagenow` is not yet initialized in some network admin pages when this method
                     * is called, so initialize it here using some pieces of code from `wp-includes/vars.php`.
                     *
                     * @author Leo Fajardo (@leorw)
                     * @since 2.2.3
                     */
                    if ( is_network_admin() ) {
                        preg_match( '#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    } else if ( is_user_admin() ) {
                        preg_match( '#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    } else {
                        preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
                    }

                    $pagenow = $self_matches[1];
                    $pagenow = trim( $pagenow, '/' );
                    $pagenow = preg_replace( '#\?.*?$#', '', $pagenow );
                    if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
                        $pagenow = 'index.php';
                    } else {
                        preg_match( '#(.*?)(/|$)#', $pagenow, $self_matches );
                        $pagenow = strtolower( $self_matches[1] );
                        if ( '.php' !== substr($pagenow, -4, 4) )
                            $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
                    }
                }

                self::$_pagenow = $pagenow;

                if ( self::is_ajax() &&
                     'admin-ajax.php' === $pagenow
                ) {
                    $referer = fs_get_raw_referer();

                    if ( is_string( $referer ) ) {
                        $parts = explode( '?', $referer );

                        self::$_pagenow = basename( $parts[0] );
                    }
                }
            }

            return self::$_pagenow;
        }
static function get_current_page ( ) { if ( ! isset ( self :: $ _pagenow ) ) { global $ pagenow ; if ( empty ( $ pagenow ) && is_admin ( ) && is_multisite ( ) ) { /**
                     * It appears that `$pagenow` is not yet initialized in some network admin pages when this method
                     * is called, so initialize it here using some pieces of code from `wp-includes/vars.php`.
                     *
                     * @author Leo Fajardo (@leorw)
                     * @since 2.2.3
                     */ if ( is_network_admin ( ) ) { preg_match ( '#/wp-admin/network/?(.*?)$#i' , $ _SERVER [ 'PHP_SELF' ] , $ self_matches ) ; } else if ( is_user_admin ( ) ) { preg_match ( '#/wp-admin/user/?(.*?)$#i' , $ _SERVER [ 'PHP_SELF' ] , $ self_matches ) ; } else { preg_match ( '#/wp-admin/?(.*?)$#i' , $ _SERVER [ 'PHP_SELF' ] , $ self_matches ) ; } $ pagenow = $ self_matches [ 1 ] ; $ pagenow = trim ( $ pagenow , '/' ) ; $ pagenow = preg_replace ( '#\?.*?$#' , '' , $ pagenow ) ; if ( '' === $ pagenow || 'index' === $ pagenow || 'index.php' === $ pagenow ) { $ pagenow = 'index.php' ; } else { preg_match ( '#(.*?)(/|$)#' , $ pagenow , $ self_matches ) ; $ pagenow = strtolower ( $ self_matches [ 1 ] ) ; if ( '.php' !== substr ( $ pagenow , - 4 , 4 ) ) $ pagenow .= '.php' ; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
 } } self :: $ _pagenow = $ pagenow ; if ( self :: is_ajax ( ) && 'admin-ajax.php' === $ pagenow ) { $ referer = fs_get_raw_referer ( ) ; if ( is_string ( $ referer ) ) { $ parts = explode ( '?' , $ referer ) ; self :: $ _pagenow = basename ( $ parts [ 0 ] ) ; } } } return self :: $ _pagenow ; }
Get current page or the referer if executing a WP AJAX request.

@author Vova Feldman (@svovaf)
@since  1.2.1.8

@return string
Get current page or the referer if executing a WP AJAX request .