includes/class-freemius.php
private function _find_caller_plugin_file( $is_init = false ) {
            // Try to load the cached value of the file path.
            if ( isset( $this->_storage->plugin_main_file ) ) {
                $plugin_main_file = $this->_storage->plugin_main_file;
                if ( isset( $plugin_main_file->path ) ) {
                    $absolute_path = $this->get_absolute_path( $plugin_main_file->path );
                    if ( file_exists( $absolute_path ) ) {
                        return $absolute_path;
                    }
                }
            }

            /**
             * @since 1.2.1
             *
             * `clear_module_main_file_cache()` is clearing the plugin's cached path on
             * deactivation. Therefore, if any plugin/theme was initiating `Freemius`
             * with that plugin's slug, it was overriding the empty plugin path with a wrong path.
             *
             * So, we've added a special mechanism with a 2nd layer of cache that uses `prev_path`
             * when the class instantiator isn't the module.
             */
            if ( ! $is_init ) {
                // Fetch prev path cache.
                if ( isset( $this->_storage->plugin_main_file ) &&
                     isset( $this->_storage->plugin_main_file->prev_path )
                ) {
                    $absolute_path = $this->get_absolute_path( $this->_storage->plugin_main_file->prev_path );
                    if ( file_exists( $absolute_path ) ) {
                        return $absolute_path;
                    }
                }

                wp_die(
                    $this->get_text_inline( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.', 'failed-finding-main-path' ) .
                    " Module: {$this->_slug}; SDK: " . WP_FS__SDK_VERSION . ";",
                    $this->get_text_inline( 'Error', 'error' ),
                    array( 'back_link' => true )
                );
            }

            /**
             * @since 1.2.1
             *
             * Only the original instantiator that calls dynamic_init can modify the module's path.
             */
            // Find caller module.
            $id_slug_type_path_map            = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
            $this->_storage->plugin_main_file = (object) array(
                'path' => $id_slug_type_path_map[ $this->_module_id ]['path'],
            );

            return $this->get_absolute_path( $id_slug_type_path_map[ $this->_module_id ]['path'] );
        }
private function _find_caller_plugin_file( $is_init = false ) {
            // Try to load the cached value of the file path.
            if ( isset( $this->_storage->plugin_main_file ) ) {
                $plugin_main_file = $this->_storage->plugin_main_file;
                if ( isset( $plugin_main_file->path ) ) {
                    $absolute_path = $this->get_absolute_path( $plugin_main_file->path );
                    if ( file_exists( $absolute_path ) ) {
                        return $absolute_path;
                    }
                }
            }

            /**
             * @since 1.2.1
             *
             * `clear_module_main_file_cache()` is clearing the plugin's cached path on
             * deactivation. Therefore, if any plugin/theme was initiating `Freemius`
             * with that plugin's slug, it was overriding the empty plugin path with a wrong path.
             *
             * So, we've added a special mechanism with a 2nd layer of cache that uses `prev_path`
             * when the class instantiator isn't the module.
             */
            if ( ! $is_init ) {
                // Fetch prev path cache.
                if ( isset( $this->_storage->plugin_main_file ) &&
                     isset( $this->_storage->plugin_main_file->prev_path )
                ) {
                    $absolute_path = $this->get_absolute_path( $this->_storage->plugin_main_file->prev_path );
                    if ( file_exists( $absolute_path ) ) {
                        return $absolute_path;
                    }
                }

                wp_die(
                    $this->get_text_inline( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.', 'failed-finding-main-path' ) .
                    " Module: {$this->_slug}; SDK: " . WP_FS__SDK_VERSION . ";",
                    $this->get_text_inline( 'Error', 'error' ),
                    array( 'back_link' => true )
                );
            }

            /**
             * @since 1.2.1
             *
             * Only the original instantiator that calls dynamic_init can modify the module's path.
             */
            // Find caller module.
            $id_slug_type_path_map            = self::$_accounts->get_option( 'id_slug_type_path_map', array() );
            $this->_storage->plugin_main_file = (object) array(
                'path' => $id_slug_type_path_map[ $this->_module_id ]['path'],
            );

            return $this->get_absolute_path( $id_slug_type_path_map[ $this->_module_id ]['path'] );
        }
private function _find_caller_plugin_file ( $ is_init = false ) { // Try to load the cached value of the file path.
 if ( isset ( $ this -> _storage -> plugin_main_file ) ) { $ plugin_main_file = $ this -> _storage -> plugin_main_file ; if ( isset ( $ plugin_main_file -> path ) ) { $ absolute_path = $ this -> get_absolute_path ( $ plugin_main_file -> path ) ; if ( file_exists ( $ absolute_path ) ) { return $ absolute_path ; } } } /**
             * @since 1.2.1
             *
             * `clear_module_main_file_cache()` is clearing the plugin's cached path on
             * deactivation. Therefore, if any plugin/theme was initiating `Freemius`
             * with that plugin's slug, it was overriding the empty plugin path with a wrong path.
             *
             * So, we've added a special mechanism with a 2nd layer of cache that uses `prev_path`
             * when the class instantiator isn't the module.
             */ if ( ! $ is_init ) { // Fetch prev path cache.
 if ( isset ( $ this -> _storage -> plugin_main_file ) && isset ( $ this -> _storage -> plugin_main_file -> prev_path ) ) { $ absolute_path = $ this -> get_absolute_path ( $ this -> _storage -> plugin_main_file -> prev_path ) ; if ( file_exists ( $ absolute_path ) ) { return $ absolute_path ; } } wp_die ( $ this -> get_text_inline ( 'Freemius SDK couldn\'t find the plugin\'s main file. Please contact sdk@freemius.com with the current error.' , 'failed-finding-main-path' ) . " Module: {$this->_slug}; SDK: " . WP_FS__SDK_VERSION . ";" , $ this -> get_text_inline ( 'Error' , 'error' ) , array ( 'back_link' => true ) ) ; } /**
             * @since 1.2.1
             *
             * Only the original instantiator that calls dynamic_init can modify the module's path.
             */ // Find caller module.
 $ id_slug_type_path_map = self :: $ _accounts -> get_option ( 'id_slug_type_path_map' , array ( ) ) ; $ this -> _storage -> plugin_main_file = ( object ) array ( 'path' => $ id_slug_type_path_map [ $ this -> _module_id ] [ 'path' ] , ) ; return $ this -> get_absolute_path ( $ id_slug_type_path_map [ $ this -> _module_id ] [ 'path' ] ) ; }
Leverage backtrace to find caller plugin file path.

@author Vova Feldman (@svovaf)
@since  1.0.6

@param  bool $is_init Is initiation sequence.

@return string
Leverage backtrace to find caller plugin file path .