/home/techb158/primomovers.ca/wp-content/plugins/polylang/src
Edit: /home/techb158/primomovers.ca/wp-content/plugins/polylang/src/class-polylang.php (8537B)
upgrade() ) { // If the version is too old
return;
}
}
} else {
// In some edge cases, it's possible that no options were found in the database.
$options['version'] = POLYLANG_VERSION;
}
/**
* Filter the model class to use
* /!\ this filter is fired *before* the $polylang object is available
*
* @since 1.5
*
* @param string $class either PLL_Model or PLL_Admin_Model
*/
$class = apply_filters( 'pll_model', PLL_SETTINGS || self::is_wizard() ? 'PLL_Admin_Model' : 'PLL_Model' );
/** @var PLL_Model $model */
$model = new $class( $options );
if ( ! $model->has_languages() ) {
/**
* Fires when no language has been defined yet
* Used to load overridden textdomains
*
* @since 1.2
*/
do_action( 'pll_no_language_defined' );
}
$class = '';
if ( PLL_SETTINGS ) {
$class = 'PLL_Settings';
} elseif ( PLL_ADMIN ) {
$class = 'PLL_Admin';
} elseif ( self::is_rest_request() ) {
$class = 'PLL_REST_Request';
} elseif ( $model->has_languages() ) {
$class = 'PLL_Frontend';
}
/**
* Filters the class to use to instantiate the $polylang object
*
* @since 2.6
*
* @param string $class A class name.
*/
$class = apply_filters( 'pll_context', $class );
if ( ! empty( $class ) ) {
/** @phpstan-var class-string
$class */
$this->init_context( $class, $model );
}
}
/**
* Polylang initialization.
* Setups the Polylang Context, loads the modules and init Polylang.
*
* @since 3.6
*
* @param string $class The class name.
* @param PLL_Model $model Instance of PLL_Model.
* @return PLL_Base
*
* @phpstan-param class-string $class
* @phpstan-return TPLLClass
*/
public function init_context( string $class, PLL_Model $model ): PLL_Base {
global $polylang;
$links_model = $model->get_links_model();
$polylang = new $class( $links_model );
/**
* Fires after Polylang's model init.
* This is the best place to register a custom table (see `PLL_Model`'s constructor).
* /!\ This hook is fired *before* the $polylang object is available.
* /!\ The languages are also not available yet.
*
* @since 3.4
*
* @param PLL_Model $model Polylang model.
*/
do_action( 'pll_model_init', $model );
$model->maybe_create_language_terms();
/**
* Fires after the $polylang object is created and before the API is loaded
*
* @since 2.0
*
* @param object $polylang
*/
do_action_ref_array( 'pll_pre_init', array( &$polylang ) );
// Loads the API
require_once POLYLANG_DIR . '/src/api.php';
// Loads the modules.
$load_scripts = require POLYLANG_DIR . '/src/modules/module-build.php';
foreach ( $load_scripts as $load_script ) {
require_once POLYLANG_DIR . "/src/modules/{$load_script}/load.php";
}
$polylang->init();
/**
* Fires after the $polylang object and the API is loaded
*
* @since 1.7
*
* @param object $polylang
*/
do_action_ref_array( 'pll_init', array( &$polylang ) );
return $polylang;
}
}