-
Notifications
You must be signed in to change notification settings - Fork 1
/
stt2-extension-add-terms.php
193 lines (166 loc) · 6.14 KB
/
stt2-extension-add-terms.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
/*
Plugin Name: STT2 Extension Add Terms
Plugin URI: http://www.jevuska.com/2015/06/28/injeksi-manual-keyword-add-onsextension-plugin-seo-searchterms-tagging-2/
Description: Manage your terms better, add terms into single post manually, get terms via referrer, and save them as post meta. Search the terms that relevant of post content as well as WordPress search default algorithm.
Author: Jevuska
Author URI: http://www.jevuska.com
Version: 1.2.1
Text Domain: stt2extat
License: GPL version 2 - http://www.gnu.org/licenses/gpl-2.0.html
** update: April 23, 2016
* :: required latest version of WordPress, min.version 4.4
* :: required latest version PHP Server, min.version 7.0
* :: required browser JavaScript enabled
* :: Add terms into single post manually
* :: Add terms via referrer
* :: All terms will be saved as postmeta
* :: Search the terms that match post content as well as WordPress search default algorithm
* STT2 Extension Add Terms is free software: you can copy and distribute verbatim copies
* of this license document, changing it is allowed.
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License.
* STT2 Extension Add Terms is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with STT2 Extension Add Terms. If not, see <http://www.gnu.org/licenses/>.
* @package STT2EXTAT
* @category Core
* @author Jevuska
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Initial_STT2EXTAT' ) ) :
final class Initial_STT2EXTAT {
private static $instance;
/**
* Fires when the Initial_STT2EXTAT instance is initialized.
*
* @since 1.0
*
* add instance load_textdomain
* @since 1.0.2
*/
public static function instance()
{
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Initial_STT2EXTAT ) ) :
self::$instance = new Initial_STT2EXTAT;
self::$instance->setup_constants();
self::$instance->includes();
self::$instance->load_textdomain();
define( 'STT2EXTAT_RUNNING', true );
endif;
return self::$instance;
}
/**
* setup constants
*
* @since 1.0
*
* Add define STT2EXTAT_PLUGIN_BASENAME
*
* @since 1.0.2
*
*/
public function setup_constants()
{
if ( ! defined( 'STT2EXTAT_VER' ) )
define( 'STT2EXTAT_VER', '1.2.1' );
if ( ! defined( 'STT2EXTAT_DB_VER' ) )
define( 'STT2EXTAT_DB_VER', '1.1' );
if ( ! defined( 'STT2EXTAT_PLUGIN_FILE' ) )
define( 'STT2EXTAT_PLUGIN_FILE', __FILE__ );
if ( ! defined( 'STT2EXTAT_PLUGIN_BASENAME' ) )
define( 'STT2EXTAT_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
if ( ! defined( 'STT2EXTAT_PLUGIN_URL' ) )
define( 'STT2EXTAT_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
if ( ! defined( 'STT2EXTAT_PLUGIN_PATH' ) )
define( 'STT2EXTAT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
if ( ! defined( 'STT2EXTAT_PATH_LIB' ) )
define( 'STT2EXTAT_PATH_LIB', STT2EXTAT_PLUGIN_PATH . 'lib/' );
if ( ! defined( 'STT2EXTAT_PATH_LIB_ADMIN' ) )
define( 'STT2EXTAT_PATH_LIB_ADMIN', STT2EXTAT_PATH_LIB . 'admin/' );
if ( ! defined( 'STT2EXTAT_PATH_LIB_INCLUDES' ) )
define( 'STT2EXTAT_PATH_LIB_INCLUDES', STT2EXTAT_PATH_LIB . 'includes/' );
if ( ! defined( 'STT2EXTAT_PATH_LIB_CONTENT' ) )
define( 'STT2EXTAT_PATH_LIB_CONTENT', STT2EXTAT_PATH_LIB . 'content/' );
}
/**
* all functions and filters
*
* @since 1.0
*
* remove some hooks files, and add their function
* into one files - hook-functions.php
*
* @since 1.0.3
*
* global stt2extat_data
*
* @since 1.1.0
*
*/
private function includes()
{
global $stt2extat_settings, $stt2extat_sanitize, $stt2extat_data;
require_once( STT2EXTAT_PATH_LIB . 'settings.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'functions.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'class-stt2extat-query.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'class-stt2extat-sanitize.php' );
$stt2extat_settings = stt2extat_settings();
$stt2extat_sanitize = stt2extat__sanitize();
$stt2extat_data = stt2extat_data();
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'widgets.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'class-stt2extat-load.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'hook.php' );
require_once( STT2EXTAT_PATH_LIB_CONTENT . 'plugin/class-stt2extat-searchexcerpt.php' );
if ( is_admin() ) :
//defined function wp_get_current_user
require_once( ABSPATH . 'wp-includes/pluggable.php' );
require_once( STT2EXTAT_PATH_LIB_ADMIN . 'class-stt2extat-admin.php' );
if ( current_user_can( 'manage_options' ) ) :
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'class-stt2extat-table.php' );
require_once( STT2EXTAT_PATH_LIB_INCLUDES . 'template-functions.php' );
require_once( STT2EXTAT_PATH_LIB_ADMIN . 'class-stt2extat-setup.php' );
endif;
endif;
require_once STT2EXTAT_PATH_LIB . 'install.php';
}
/**
* internationalize plugin
*
* @since 1.0.2
*
*/
public function load_textdomain()
{
$domain = 'stt2extat';
$lang_dir = apply_filters( 'stt2extat_lang_dir', wp_normalize_path( STT2EXTAT_PATH_LIB_CONTENT . 'languages/' ) );
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
$mofile = sprintf( '%1$s-%2$s.mo', $domain, $locale );
$mofile_local = $lang_dir . $mofile;
$mofile_global = trailingslashit( WP_LANG_DIR ) . $domain . '/' . $mofile;
if ( file_exists( $mofile_global ) ) :
load_textdomain( $domain, $mofile_global );
elseif ( file_exists( $mofile_local ) ) :
load_textdomain( $domain, $mofile_local );
else :
load_plugin_textdomain( $domain, false, $lang_dir );
endif;
}
}
endif;
/**
* STT2EXTAT
*
* @since 1.0
*
*/
function STT2EXTAT()
{
return Initial_STT2EXTAT::instance();
}
STT2EXTAT();
?>