Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../vendor/otgs/ui
File: loader.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Load the shared OTGS UI library, on demand.
[2] Fix | Delete
*
[3] Fix | Delete
* =================
[4] Fix | Delete
* Usage
[5] Fix | Delete
* =================
[6] Fix | Delete
* $vendor_path = [ path to the root of your relative vendor directory housing this repository, no training slash ]
[7] Fix | Delete
* $vendor_url = [ URL of the root of your relative vendor directory housing this repository, no trailing slash ]
[8] Fix | Delete
* require_once( $vendor_path . '/otgs/ui/loader.php' );
[9] Fix | Delete
* otgs_ui_initialize( $vendor_path . '/otgs/ui', $vendor_url . '/otgs/ui' );
[10] Fix | Delete
*
[11] Fix | Delete
* =================
[12] Fix | Delete
* Restrictions
[13] Fix | Delete
* =================
[14] Fix | Delete
* - Assets are registered at init:1: doing it earlier will cause problems with core assets registered at init:0
[15] Fix | Delete
* - Their handles are stored in constants that you can use as dependencies, on assets registered after init:-100.
[16] Fix | Delete
*
[17] Fix | Delete
* @package otgs/ui
[18] Fix | Delete
*/
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* OTGS UI version - increase after every major update.
[22] Fix | Delete
*/
[23] Fix | Delete
$otg_ui_version = 109;
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* =================
[27] Fix | Delete
* || WARNING ||
[28] Fix | Delete
* =================
[29] Fix | Delete
*
[30] Fix | Delete
* DO NOT EDIT below this line.
[31] Fix | Delete
*/
[32] Fix | Delete
[33] Fix | Delete
global $otg_ui_versions;
[34] Fix | Delete
[35] Fix | Delete
if ( ! isset( $otg_ui_versions ) ) {
[36] Fix | Delete
$otg_ui_versions = array();
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
if ( ! isset( $otg_ui_versions[ $otg_ui_version ] ) ) {
[40] Fix | Delete
// Initialize the path to this version.
[41] Fix | Delete
$otg_ui_versions[ $otg_ui_version ] = array(
[42] Fix | Delete
'path' => wp_normalize_path( dirname( __FILE__ ) ),
[43] Fix | Delete
);
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
[47] Fix | Delete
if ( ! function_exists( 'otgs_ui_initialize' ) ) {
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* @param string $vendor_path Path to the root of your relative vendor directory housing this repository (no trailing slash).
[51] Fix | Delete
* @param string $vendor_url URL of the root of your relative vendor directory housing this repository, no trailing slash.
[52] Fix | Delete
*/
[53] Fix | Delete
function otgs_ui_initialize( $vendor_path, $vendor_url ) {
[54] Fix | Delete
global $otg_ui_versions;
[55] Fix | Delete
[56] Fix | Delete
// Make sure we compare with the canonical path.
[57] Fix | Delete
if ( is_link( $vendor_path ) ) {
[58] Fix | Delete
$vendor_path = readlink( $vendor_path );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
$vendor_path = wp_normalize_path( $vendor_path );
[62] Fix | Delete
$vendor_path = untrailingslashit( $vendor_path );
[63] Fix | Delete
$vendor_url = untrailingslashit( $vendor_url );
[64] Fix | Delete
[65] Fix | Delete
// Save the url in the version with a matching path.
[66] Fix | Delete
foreach ( $otg_ui_versions as $version => $data ) {
[67] Fix | Delete
if ( $otg_ui_versions[ $version ]['path'] === $vendor_path ) {
[68] Fix | Delete
$otg_ui_versions[ $version ]['url'] = $vendor_url;
[69] Fix | Delete
break;
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
if ( ! function_exists( 'otgs_ui_plugins_loaded' ) ) {
[76] Fix | Delete
/**
[77] Fix | Delete
* Function hooked to the `plugins_loaded` action as early as possible.
[78] Fix | Delete
*/
[79] Fix | Delete
function otgs_ui_plugins_loaded() {
[80] Fix | Delete
global $otg_ui_versions;
[81] Fix | Delete
[82] Fix | Delete
// Find the latest version.
[83] Fix | Delete
$latest = 0;
[84] Fix | Delete
foreach ( $otg_ui_versions as $version => $data ) {
[85] Fix | Delete
if ( $version > $latest ) {
[86] Fix | Delete
$latest = $version;
[87] Fix | Delete
}
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
if ( $latest > 0 ) {
[91] Fix | Delete
// Require all the available classes: we need to overcome autoloaders!!
[92] Fix | Delete
require_once $otg_ui_versions[ $latest ]['path'] . '/src/php/OTGS_Assets_Handles.php';
[93] Fix | Delete
require_once $otg_ui_versions[ $latest ]['path'] . '/src/php/OTGS_Assets_Store.php';
[94] Fix | Delete
require_once $otg_ui_versions[ $latest ]['path'] . '/src/php/OTGS_UI_Assets.php';
[95] Fix | Delete
require_once $otg_ui_versions[ $latest ]['path'] . '/src/php/OTGS_UI_Loader.php';
[96] Fix | Delete
[97] Fix | Delete
// Initialize the assets loader with its assets and store dependencies.
[98] Fix | Delete
$assets_store = new OTGS_Assets_Store();
[99] Fix | Delete
$assets = new OTGS_UI_Assets( $otg_ui_versions[ $latest ]['url'] . '/dist', $assets_store );
[100] Fix | Delete
$loader = new OTGS_UI_Loader( $assets_store, $assets );
[101] Fix | Delete
$loader->load();
[102] Fix | Delete
}
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
add_action( 'plugins_loaded', 'otgs_ui_plugins_loaded', -PHP_INT_MAX );
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function