-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsite-functionality.php
More file actions
executable file
·96 lines (77 loc) · 2.93 KB
/
site-functionality.php
File metadata and controls
executable file
·96 lines (77 loc) · 2.93 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
<?php
/**
* Plugin Name: Site Functions
* Description: Custom functions for site
* Author: Patrizia Lutz
* Author URI: https://patrizia-lutz.tech
* Text Domain: site-functionality
* Domain Path: /languages
* Version: 1.0.1
* Requires at least: 5.8
* Requires PHP: 7.2
*
* @package Site_Functionality
*/
namespace Site_Functionality;
// Your code starts here.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Plugin Directory
*
* @since 0.1.0
*/
define( 'SITE_CORE_DIR', dirname( __FILE__ ) );
define( 'SITE_CORE_DIR_URI', plugin_dir_url( __FILE__ ) );
if ( class_exists( '\Dotenv\Dotenv' ) ) {
$dotenv = \Dotenv\Dotenv::createImmutable( __DIR__ );
$dotenv->safeLoad();
}
const PLUGIN = 'site-functionality';
const VERSION = '1.0.1';
function site_functionality_init() {
load_plugin_textdomain( 'site-functionality', false, SITE_CORE_DIR . '/languages' );
include_once SITE_CORE_DIR . '/src/helpers.php';
include_once SITE_CORE_DIR . '/src/filters.php';
include_once SITE_CORE_DIR . '/src/security.php';
include_once SITE_CORE_DIR . '/src/util/util.php';
// include_once( SITE_CORE_DIR . '/src/api/graphql.php' );
include_once SITE_CORE_DIR . '/src/abstracts/class-base.php';
include_once SITE_CORE_DIR . '/blocks/blocks.php';
include_once SITE_CORE_DIR . '/src/admin/admin.php';
$admin = new Admin\Admin( VERSION, PLUGIN );
include_once SITE_CORE_DIR . '/src/class-template-loader.php';
include_once SITE_CORE_DIR . '/src/abstracts/class-post-type.php';
include_once SITE_CORE_DIR . '/src/abstracts/class-taxonomy.php';
include_once SITE_CORE_DIR . '/src/api/class-rest-api.php';
include_once SITE_CORE_DIR . '/src/post-types/class-post-types.php';
include_once SITE_CORE_DIR . '/src/taxonomies/class-taxonomies.php';
include_once SITE_CORE_DIR . '/src/custom-fields/class-custom-fields.php';
include_once SITE_CORE_DIR . '/src/integration/contact-form-7/contact-form-7.php';
$restAPI = new API\RestAPI( VERSION, PLUGIN );
$postTypes = new PostTypes\PostTypes( VERSION, PLUGIN );
$taxonomies = new Taxonomies\Taxonomies( VERSION, PLUGIN );
$customFields = new CustomFields\CustomFields( VERSION, PLUGIN );
$cf7 = new Integration\ContactForm7\ContactForm7( VERSION, PLUGIN );
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\site_functionality_init' );
/**
* The function provides access to the class methods.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* @return object
*/
// function site_functionality_init() {
// return Site_Functions::instance();
// }
function site_functionality_activate() {
\flush_rewrite_rules();
}
\register_activation_hook( __FILE__, __NAMESPACE__ . '\site_functionality_activate', );
function site_functionality_deactivate() {
\flush_rewrite_rules();
}
\register_deactivation_hook( __FILE__, __NAMESPACE__ . '\site_functionality_deactivate' );