$this->description = get_bloginfo('description');
$this->theme = new Theme();
$this->multisite = false;
}
/**
* Executed for all types of sites: both multisite and "regular"
* @internal
*/
protected function init() {
$this->url = home_url();
$this->home_url = $this->url;
$this->site_url = site_url();
$this->rdf = get_bloginfo('rdf_url');
$this->rss = get_bloginfo('rss_url');
$this->rss2 = get_bloginfo('rss2_url');
$this->atom = get_bloginfo('atom_url');
$this->language = get_locale();
$this->charset = get_bloginfo('charset');
$this->pingback = $this->pingback_url = get_bloginfo('pingback_url');
}
/**
* Returns the language attributes that you're looking for
* @return string
*/
public function language_attributes() {
return get_language_attributes();
}
/**
*
*
* @param string $field
* @return mixed
*/
public function __get( $field ) {
if ( !isset($this->$field) ) {
if ( is_multisite() ) {
$this->description = get_bloginfo('description');
$this->theme = new Theme();
$this->multisite = false;
}
/**
* Executed for all types of sites: both multisite and "regular"
* @internal
*/
protected function init() {
$this->url = home_url();
$this->home_url = $this->url;
$this->site_url = site_url();
$this->rdf = get_bloginfo('rdf_url');
$this->rss = get_bloginfo('rss_url');
$this->rss2 = get_bloginfo('rss2_url');
$this->atom = get_bloginfo('atom_url');
$this->language = get_locale();
$this->charset = get_bloginfo('charset');
$this->pingback = $this->pingback_url = get_bloginfo('pingback_url');
}
/**
* Returns the language attributes that you're looking for
* @return string
*/
public function language_attributes() {
return get_language_attributes();
}
/**
*
*
* @param string $field
* @return mixed
*/
public function __get( $field ) {
if ( !isset($this->$field) ) {
if ( is_multisite() ) {
/**
* Constructs a Timber\Site object
* @example
* ```php
* //multisite setup
* $site = new Timber\Site(1);
* $site_two = new Timber\Site("My Cool Site");
* //non-multisite
* $site = new Timber\Site();
* ```
* @param string|int $site_name_or_id
*/
public function __construct( $site_name_or_id = null ) {
if ( is_multisite() ) {
$blog_id = self::switch_to_blog($site_name_or_id);
$this->init();
$this->init_as_multisite($blog_id);
restore_current_blog();
} else {
$this->init();
$this->init_as_singlesite();
}
}
/**
* Switches to the blog requested in the request
* @param string|integer|null $site_name_or_id
* @return integer with the ID of the new blog
*/
protected static function switch_to_blog( $site_name_or_id ) {
if ( $site_name_or_id === null ) {
$site_name_or_id = get_current_blog_id();
}
$info = get_blog_details($site_name_or_id);
switch_to_blog($info->blog_id);
return $info->blog_id;
}
/**
* @internal
$instance->register(new StreamsServiceProvider);
$instance['request'] = static function () {
return new Request();
};
$instance['events'] = static function () {
return new EventDispatcher();
};
$instance['platform'] = static function ($c) {
return new Platform($c);
};
$instance['translator'] = static function () {
return new Translator();
};
$instance['site'] = static function () {
return new Site();
};
$instance['menu'] = static function () {
return new Menu();
};
$instance['messages'] = static function () {
return new Messages();
};
$instance['page'] = static function ($c) {
return new Page($c);
};
$instance['document'] = static function () {
return new Document();
};
// Make sure that nobody modifies the original collection by making it a factory.
$instance['outlines'] = $instance->factory(static function ($c) {
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
$this->preset_styles_init();
// Load theme text domains
$domain = $this->details()->get('configuration.gantry.engine', 'nucleus');
$lookup = '/engines/' . $domain . '/languages';
if (!file_exists(GANTRY5_PATH . $lookup)) {
$lookup = '/engines/wordpress/' . $domain . '/languages';
}
$lookup = basename(GANTRY5_PATH) . $lookup;
if (\load_plugin_textdomain($domain, false, $lookup) === false) {
\add_filter('plugin_locale', 'modify_gantry5_locale', 10, 2);
\load_plugin_textdomain($domain, false, $lookup);
\remove_filter('plugin_locale', 'modify_gantry5_locale', 10);
}
$domain = $this->details()->get('configuration.theme.textdomain', $this->name);
\load_theme_textdomain($domain, $this->path . '/languages');
$this->url = $gantry['site']->theme->link;
$gantry['configuration'] = 'default';
$gantry->fireEvent('theme.init');
}
/**
* @see AbstractTheme::setTwigLoaderPaths()
*
* @param LoaderInterface $loader
* @return FilesystemLoader
*/
protected function setTwigLoaderPaths(LoaderInterface $loader)
{
$loader = parent::setTwigLoaderPaths($loader);
if ($loader) {
// TODO: right now we are replacing all paths; we need to do better, but there are some issues with this call.
$loader->setPaths(static::getTwigPaths());
}
/** @var Environment|null */
protected $renderer;
/**
* Construct theme object.
*
* @param string $path
* @param string $name
*/
public function __construct($path, $name = null)
{
if (!is_dir($path)) {
throw new \LogicException('Theme not found!');
}
$this->name = $name ?: Gantry::basename($path);
$this->path = $path;
$this->init();
}
/**
* Get context for render().
*
* @param array $context
* @return array
*/
public function getContext(array $context)
{
$context['theme'] = $this;
return $context;
}
/**
* Define twig environment.
*
* @param Environment $twig
* @param LoaderInterface $loader
class_exists('\\Gantry\\Framework\\Gantry') or die;
// Define the template.
class GantryTheme extends \Gantry\Framework\Theme
{
}
// Initialize theme stream.
$gantry['platform']->set(
'streams.gantry-theme.prefixes',
array('' => array(
"gantry-themes://{$gantry['theme.name']}/custom",
"gantry-themes://{$gantry['theme.name']}",
"gantry-themes://{$gantry['theme.name']}/common"
))
);
// Define Gantry services.
$gantry['theme'] = function ($c) {
return new GantryTheme($c['theme.path'], $c['theme.name']);
};
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
if (!$gantry) {
return;
}
if (!$gantry->isCompatible($requiredGantryVersion)) {
$current_theme = wp_get_theme();
$error = sprintf(__('Please upgrade Gantry 5 Framework to v%s (or later) before using %s theme!', 'g5_akuatik'), strtoupper($requiredGantryVersion), $current_theme->get('Name'));
if(is_admin()) {
add_action('admin_notices', function () use ($error) {
echo '<div class="error"><p>' . $error . '</p></div>';
});
} else {
wp_die($error);
}
}
/** @var \Gantry\Framework\Theme $theme */
$theme = $gantry['theme'];
// Theme helper files that can contain useful methods or filters
$helpers = array(
'includes/helper.php', // General helper file
);
foreach ($helpers as $file) {
if (!$filepath = locate_template($file)) {
trigger_error(sprintf(__('Error locating %s for inclusion', 'g5_akuatik'), $file), E_USER_ERROR);
}
require $filepath;
}
@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );
* @since 2.1.0
*
* @global WP_Locale $wp_locale WordPress date and time locale object.
*/
$GLOBALS['wp_locale'] = new WP_Locale();
/**
* WordPress Locale Switcher object for switching locales.
*
* @since 4.7.0
*
* @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
*/
$GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
$GLOBALS['wp_locale_switcher']->init();
// Load the functions for the active theme, for both parent and child theme if applicable.
foreach ( wp_get_active_and_valid_themes() as $theme ) {
if ( file_exists( $theme . '/functions.php' ) ) {
include $theme . '/functions.php';
}
}
unset( $theme );
/**
* Fires after the theme is loaded.
*
* @since 3.0.0
*/
do_action( 'after_setup_theme' );
// Create an instance of WP_Site_Health so that Cron events may fire.
if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
}
WP_Site_Health::get_instance();
// Set up current user.
$GLOBALS['wp']->init();
// Enable WP-DEBUG mode************************************
define( 'WP_DEBUG', true );
// Enable Debug logging to the /wp-content/debug.log file***
// define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings*******************
define( 'WP_DEBUG_DISPLAY', true );
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/* Fixes "Add media button not working", see http://www.carnfieldwebdesign.co.uk/blog/wordpress-fix-add-media-button-not-working/ */
define('CONCATENATE_SCRIPTS', false );
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
* Initialize error reporting to a known set of levels.
*
* This will be adapted in wp_debug_mode() located in wp-includes/load.php based on WP_DEBUG.
* @see https://www.php.net/manual/en/errorfunc.constants.php List of known error levels.
*/
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
}
/*
* If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
* doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
* of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
* and /blog/ is WordPress(b).
*
* If neither set of conditions is true, initiate loading the setup process.
*/
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
/** The config file resides in ABSPATH */
require_once ABSPATH . 'wp-config.php';
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
/** The config file resides one level above ABSPATH but is not part of another installation */
require_once dirname( ABSPATH ) . '/wp-config.php';
} else {
// A config file doesn't exist.
define( 'WPINC', 'wp-includes' );
require_once ABSPATH . WPINC . '/version.php';
require_once ABSPATH . WPINC . '/compat.php';
require_once ABSPATH . WPINC . '/load.php';
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';