· 5 years ago · May 22, 2020, 09:16 PM
1<?php
2
3/*
4 List:
5 1. Globals
6 2. Wordpress
7 3. Plugins
8 4. Custom script
9 5. Theme
10 6. API management
11 */
12
13
14/* -------------------------------------*/
15/* ------------ PHP SESSION ------------*/
16/* -------------------------------------*/
17@session_start();
18
19
20
21/* ----------------------------------*/
22/* ------------ GLOBALS ------------*/
23/* ----------------------------------*/
24global $themeSetup;
25$themeSetup = [
26
27 'authBaseURL' => 'https://id.kulekon.cz',
28 'apiBaseURL' => 'https://armex.kulekon.cz',
29
30 // Global theme settings from WP admin
31 'options' => [],
32
33 // API Keys
34 'googleMapsAPIKey' => 'AIzaSyBjk3-RlhrIrCjL1V1ofJxdJr0AwRrWbIw',
35
36 // Loaded parts
37 'loadedGoogleMaps' => false,
38];
39
40
41// Load global variables
42include_once "functions/acf/acfReadSpecificOptionsPage.php";
43add_action('acf/init', 'acfReadSpecificOptionsPage', 10, 0);
44
45/* -------------------------------------*/
46/* ------------ WP: TWEAKS ------------*/
47/* -------------------------------------*/
48
49// Fix non-ASCII characters in uploaded files
50include_once "functions/wpTweaks/removeNonAsciiCharsFromFileUpload.php";
51add_filter('sanitize_file_name', 'removeNonAsciiCharsFromFileUpload', 10);
52
53// Remove WP embeds
54include_once "functions/wpTweaks/removeWPEmbed.php";
55removeWPEmbed();
56
57
58/* -------------------------------------------*/
59/* ------------ WP: ADMIN TWEAKS ------------*/
60/* -------------------------------------------*/
61
62// Fix non-ASCII characters in uploaded files
63include_once "functions/wpAdmin/customAdminCss.php";
64addAdminCustomCss();
65
66
67/* ------------------------------------------------*/
68/* ------------ WP: ADD CUSTOM MENUS ------------*/
69/* ------------------------------------------------*/
70
71// Register "headerMenu" menu
72include_once "functions/wpMenus/registerCustomMenus.php";
73add_action('init', 'registerHeaderMenu');
74
75
76/* --------------------------------------------------------------*/
77/* ------------ WP: CUSTOM POST TYPES & TAXONOMIES ------------*/
78/* --------------------------------------------------------------*/
79
80// Add custom post types
81include_once "functions/customPostTypes/registerCustomPostTypes.php";
82//customPostTypeRegister_colorThemes();
83customPostTypeRegister_employees();
84
85// Add custom taxonomies
86//include_once "functions/customPostTypes/registerCustomCategories.php";
87//customCategory_teamGroups();
88
89
90/* --------------------------------------*/
91/* ------------ PLUGIN: ACF ------------*/
92/* --------------------------------------*/
93
94// Add local ACF plugin
95include_once "functions/acf/acfLocal.php";
96addAcfLocal();
97
98// Add local ACF Extended plugin
99include_once "functions/acf/acfExtendedLocal.php";
100addAcfExtendedLocal();
101
102// Add theme options page
103include_once "functions/acf/acfOptionsPage.php";
104addOptionsPage();
105
106// Add ACF custom google maps key
107include_once "functions/acf/acfGoogleMapsKey.php";
108add_action('acf/init', 'customGoogleMapsKey');
109
110
111/* --------------------------------------------------*/
112/* ------------ PLUGIN: CONTACT FORM 7 ------------*/
113/* --------------------------------------------------*/
114
115// Fix formatting and styles of contact form 7
116include_once "functions/contactForm7/removeStylesAndPadding.php";
117removeStylesAndPadding();
118
119
120/* -------------------------------------------------*/
121/* ------------ CUSTOM: IMAGE HELPERS ------------*/
122/* -------------------------------------------------*/
123
124// Add Aqua Resizer
125include_once "functions/imageHelpers/customImageResizer.php";
126addAquaResizer();
127
128
129/* -------------------------------------------------*/
130/* ------------ API Management ------------*/
131/* -------------------------------------------------*/
132
133// API helper functions
134include_once "functions/armexAPI/requestBuilder.php";
135
136// Basic API authorization
137include_once "functions/armexAPI/auth/requestAPIToken.php";
138include_once "functions/armexAPI/auth/checkValidToken.php";
139checkValidToken();
140
141// Different API methods
142include_once "functions/armexAPI/shared/requestNews_multiple.php";
143include_once "functions/armexAPI/shared/requestNews_single.php";
144include_once "functions/armexAPI/shared/requestNewsImageMeta_single.php";
145include_once "functions/armexAPI/shared/requestNewsImage_single.php";