-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstants.php
More file actions
102 lines (84 loc) · 2.99 KB
/
Constants.php
File metadata and controls
102 lines (84 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* Copyright (c) 2021. Geniem Oy
*/
namespace TMS\Theme\Base;
/**
* Class Constants
*
* This class controls all theme constants.
*
* @package TMS\Theme\Base
*/
class Constants implements Interfaces\Controller {
/**
* Constructor
*/
public function __construct() {
$this->define();
}
/**
* Define theme constants.
*/
private function define() {
// Define the stylesheet path.
if ( ! defined( 'DPT_STYLESHEET_DIR' ) ) {
define( 'DPT_STYLESHEET_DIR', \get_stylesheet_directory() );
}
// Define the asset path.
if ( ! defined( 'DPT_ASSET_CACHE_URI' ) ) {
define( 'DPT_ASSET_CACHE_URI', DPT_STYLESHEET_DIR . '/assets/dist' );
}
// Returns /app/themes/{current theme} -- no need to reference other domains here.
$themes_root = \get_stylesheet_directory_uri();
// Define the assets' path.
if ( ! defined( 'DPT_ASSETS_URI' ) ) {
define( 'DPT_ASSETS_URI', $themes_root . '/assets' );
}
// Define the assets' dist path.
if ( ! defined( 'DPT_ASSET_URI' ) ) {
define( 'DPT_ASSET_URI', $themes_root . '/assets/dist' );
}
// Set Polylang active state. Use this to check if Polylang plugin is active.
if ( ! defined( 'DPT_PLL_ACTIVE' ) ) {
define( 'DPT_PLL_ACTIVE', function_exists( 'pll_languages_list' ) );
}
// Set Advanced Custom Fields active state. Use this to check if Advanced Custom Fields plugin is active.
if ( ! defined( 'DPT_ACF_ACTIVE' ) ) {
define( 'DPT_ACF_ACTIVE', class_exists( 'acf' ) );
}
// Get the theme version number from the empty theme stylesheet
if ( ! defined( 'DPT_THEME_VERSION' ) ) {
$version = wp_get_theme()->get( 'Version' );
define( 'DPT_THEME_VERSION', $version );
}
// Define whether lazyloading is on.
if ( ! defined( 'DPT_LAZYLOADING' ) ) {
define( 'DPT_LAZYLOADING', true );
}
if ( ! defined( 'PIRKANMAA_EVENTS_API_URL' ) ) {
define( 'PIRKANMAA_EVENTS_API_URL', 'https://pirkanmaaevents.fi/api/v2/' );
}
if ( ! defined( 'PIRKANMAA_EVENTZ_API_URL' ) ) {
define( 'PIRKANMAA_EVENTZ_API_URL', env( 'PIRKANMAA_EVENTZ_API_URL' ) ?? '' );
}
if ( ! defined( 'PIRKANMAA_EVENTZ_API_KEY' ) ) {
define( 'PIRKANMAA_EVENTZ_API_KEY', env( 'PIRKANMAA_EVENTZ_API_KEY' ) ?? '' );
}
// tms-theme-base Color Theme Default.
if ( ! defined( 'DEFAULT_THEME_COLOR' ) ) {
define( 'DEFAULT_THEME_COLOR', env( 'DEFAULT_THEME_COLOR' ) ?? 'tunnelma' );
}
// Enable redipress fallback.
if ( ! defined( 'REDIPRESS_FALLBACK' ) ) {
define( 'REDIPRESS_FALLBACK', true );
}
}
/**
* Add hooks and filters from this controller
*
* @return void
*/
public function hooks() : void {
}
}