Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
the loaded recognize.
*
* For example:
* The class Ai1ec_Html_Helper can be loaded as
* - html.helper ( the path to the file )
* - Ai1ec_Html_Helper ( needed by Autoload )
*
* @param $class string the original name of the class.
* @param $file string the file
*
* @return array An array of strings with the availables names.
*/
protected function _generate_loader_names( $class, $file, $folder_name ) {
$names = array( $class );
// Remove the extension.
$file = substr( $file, 0, strrpos( $file , '.' ) );
$file = strtr( $file, array( '//' => '/' ) );
// Get just the meaningful data.
$relative_path_position = strrpos( // offset of base directory
$file,
DIRECTORY_SEPARATOR . $folder_name . DIRECTORY_SEPARATOR
);
$file = substr(
$file,
strpos( // cut to app|lib|vendor|...
$file,
DIRECTORY_SEPARATOR,
$relative_path_position + strlen( $folder_name ) + 2
)
);
$names[] = str_replace(
DIRECTORY_SEPARATOR,
'.',
trim( $file, DIRECTORY_SEPARATOR )
);
return $names;
}
/**
* Translate the key to the actual class name if any
*
* @param $key string Key requested to initialize
*
* @return array|null Array of the class, or null if none is found
*/
public function resolve_class_name( $key ) {
if ( ! isset( $this->_paths[$key] ) ) {
return null;
}
return $this->_paths[$key];
}
/**
* Update cache if object was modified
*
* @return void Destructor does not return
*/
public function __destruct() {
if ( $this->_modified ) {
$this->_cache( $this->_paths );
}
}
/**
* Convenience wrapper to detect internal extension file path.
*
* @param string $path Absolute path to extension base directory.
*
* @return bool Success loading extension classes.
*/
public function register_extension_map( $path ) {
return $this->register_map( $this->_get_cache_file_path( $path ) );
}
/**
* Register external class map to use in loading sequence
*
* @param string $file Path to class map
*
* @return bool Success loading it
*/
public function register_map( $file ) {
if (
isset( $this->_registered[$file] ) && (
! defined( 'AI1EC_DEBUG' ) ||
! AI1EC_DEBUG
)
) {
return true;
}
if ( ! is_file( $file ) ) {
return false;
}
$entries = ( require $file );
foreach ( $entries['1class_map'] as $class_name => $properties ) {
$this->_paths[$class_name] = $properties;
}
$this->_registered[$file] = true;
return true;
}
/**
* Constructor
*
* Initialize the loader creating the map of available classes, if the
* AI1EC_DEBUG constants is true the list is regenerated
*
* @throws Exception if the map is invalid
*
* @return void Constructor does not return
*/
public function __construct( $base_path ) {
$this->_base_path = $base_path;
$this->_prefix = explode( '_', __CLASS__ );
$this->_prefix = $this->_prefix[0];
$class_map = $this->_cache( $base_path );
if (
! is_array( $class_map ) ||
defined( 'AI1EC_DEBUG' ) && AI1EC_DEBUG
) {
if ( ! defined( 'AI1EC_DEBUG' ) || ! AI1EC_DEBUG ) {
// using generic `Ai1ec_Exception` as others are, potentially,
// not resolved at this time.
throw new Ai1ec_Exception(
'Generated class map is invalid: ' .
var_export( $class_map, true ) .
'. Please delete lib/bootstrap/loader-map.php (if it exists), make ' .
'sure lib/bootstrap/ is writable by the web server, and enable ' .
'debug mode by setting AI1EC_DEBUG to true (then back to false ' .
'when done).'
);
}
$class_map = $this->collect_classes();
}
$this->_paths = $class_map;
}
/**
* Method to get cache file path given path to plugin.
*
* @param string $path Path to plugin directory.
*
* @return string Absolute path to loader cache file.
*/
protected function _get_cache_file_path( $path ) {
return $path . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR .
'bootstrap' . DIRECTORY_SEPARATOR . 'loader-map.php';
}
}