-
Notifications
You must be signed in to change notification settings - Fork 7
/
templates-patterns-collection.php
executable file
·97 lines (84 loc) · 2.58 KB
/
templates-patterns-collection.php
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
<?php
/**
* Plugin Name: Starter Sites & Templates by Neve
* Description: This plugin gives you access to 100+ templates and ready-to-use starter sites. Neve theme is used for all the designs.
* Version: 1.2.15
* Author: Themeisle
* Author URI: https://themeisle.com
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
* Text Domain: templates-patterns-collection
* Domain Path: /languages
* WordPress Available: yes
* Requires License: no
*
* @package templates-patterns-collection
*/
add_action( 'init', 'ti_tpc_load_textdomain' );
add_action( 'init', 'ti_tpc_flush_premalinks' );
/**
* Flush the permalinks after import
*
*/
function ti_tpc_flush_premalinks() {
$flash_rules = get_transient( 'ti_tpc_should_flush_permalinks' );
if ( $flash_rules !== 'yes' ) {
return false;
}
flush_rewrite_rules();
delete_transient( 'ti_tpc_should_flush_permalinks' );
return true;
}
add_filter( 'themeisle_sdk_products', 'tpc_load_sdk' );
/**
* Filter products array.
*
* @param array $products products array.
*
* @return array
*/
function tpc_load_sdk( $products ) {
$products[] = __FILE__;
return $products;
}
/**
* Load the localisation file.
*/
function ti_tpc_load_textdomain() {
load_plugin_textdomain( 'templates-patterns-collection', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
define( 'TIOB_VERSION', '1.2.15' );
define( 'TIOB_URL', plugin_dir_url( __FILE__ ) );
define( 'TIOB_PATH', dirname( __FILE__ ) . '/' );
define( 'TIOB_BASENAME', plugin_basename( __FILE__ ) );
$autoload_path = __DIR__ . '/vendor/autoload.php';
if ( is_file( $autoload_path ) ) {
require_once $autoload_path;
}
add_action( 'init', 'ti_tpc_run', 999 );
function ti_tpc_run() {
if ( ! defined( 'TI_ONBOARDING_DISABLED' ) ) {
define( 'TI_ONBOARDING_DISABLED', false );
}
if ( class_exists( 'WP_CLI' ) ) {
require_once 'includes/WP_Cli.php';
}
define(
'TIOB_FEATURES',
array(
'new_menu' => true,
)
);
\TIOB\Main::instance();
}
function ti_tpc_activation_redirect( $product ) {
// If the installation time is not set, it means TPC is installed for the first time.
if ( empty( get_option( 'templates_patterns_collection_install' ) ) ) {
update_option( 'tpc_obd_new_user', 'yes' );
}
if ( ( current_action() === 'activated_plugin' && $product === TIOB_BASENAME ) || current_action() === 'switch_theme' ) {
add_option( 'tpc_maybe_run_onboarding', true );
}
}
add_action( 'activated_plugin', 'ti_tpc_activation_redirect' );
add_action( 'switch_theme', 'ti_tpc_activation_redirect' );