forked from WebberZone/contextual-related-posts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contextual-related-posts.php
163 lines (140 loc) · 4.63 KB
/
contextual-related-posts.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
<?php
/**
* Contextual Related Posts.
*
* Contextual Related Posts is the best related posts plugin for WordPress that
* allows you to display a list of related posts on your website and in your feed.
*
* @package Contextual_Related_Posts
* @author Ajay D'Souza
* @license GPL-2.0+
* @link https://webberzone.com
* @copyright 2009-2019 Ajay D'Souza
*
* @wordpress-plugin
* Plugin Name: Contextual Related Posts
* Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
* Description: Display a set of related posts on your website or in your feed. Increase reader retention and reduce bounce rates
* Version: 2.7.0
* Author: WebberZone
* Author URI: https://webberzone.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: contextual-related-posts
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/WebberZone/contextual-related-posts/
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
*
* @since 2.3.0
*
* @var string Plugin Root File
*/
if ( ! defined( 'CRP_PLUGIN_FILE' ) ) {
define( 'CRP_PLUGIN_FILE', __FILE__ );
}
/**
* Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
*
* @since 2.3.0
*
* @var string Plugin folder path
*/
if ( ! defined( 'CRP_PLUGIN_DIR' ) ) {
define( 'CRP_PLUGIN_DIR', plugin_dir_path( CRP_PLUGIN_FILE ) );
}
/**
* Holds the filesystem directory path (with trailing slash) for Contextual Related Posts.
*
* @since 2.3.0
*
* @var string Plugin folder URL
*/
if ( ! defined( 'CRP_PLUGIN_URL' ) ) {
define( 'CRP_PLUGIN_URL', plugin_dir_url( CRP_PLUGIN_FILE ) );
}
/**
* Maximum words to match in the content.
*
* @since 2.3.0
*
* @var int Maximum number of words to match.
*/
if ( ! defined( 'CRP_MAX_WORDS' ) ) {
define( 'CRP_MAX_WORDS', 500 );
}
/*
*----------------------------------------------------------------------------
* CRP modules & includes
*----------------------------------------------------------------------------
*/
require_once CRP_PLUGIN_DIR . 'includes/admin/default-settings.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/register-settings.php';
require_once CRP_PLUGIN_DIR . 'includes/plugin-activator.php';
require_once CRP_PLUGIN_DIR . 'includes/i10n.php';
require_once CRP_PLUGIN_DIR . 'includes/output-generator.php';
require_once CRP_PLUGIN_DIR . 'includes/media.php';
require_once CRP_PLUGIN_DIR . 'includes/tools.php';
require_once CRP_PLUGIN_DIR . 'includes/header.php';
require_once CRP_PLUGIN_DIR . 'includes/content.php';
require_once CRP_PLUGIN_DIR . 'includes/main-query.php';
require_once CRP_PLUGIN_DIR . 'includes/modules/manual-posts.php';
require_once CRP_PLUGIN_DIR . 'includes/modules/shortcode.php';
require_once CRP_PLUGIN_DIR . 'includes/modules/taxonomies.php';
require_once CRP_PLUGIN_DIR . 'includes/modules/exclusions.php';
require_once CRP_PLUGIN_DIR . 'includes/modules/class-crp-widget.php';
/*
*----------------------------------------------------------------------------
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------
*/
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
require_once CRP_PLUGIN_DIR . 'includes/admin/admin.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/settings-page.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/save-settings.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/help-tab.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/modules/tools.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/modules/loader.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/modules/metabox.php';
require_once CRP_PLUGIN_DIR . 'includes/admin/modules/cache.php';
} // End if.
/*
*----------------------------------------------------------------------------
* Deprecated functions
*----------------------------------------------------------------------------
*/
require_once CRP_PLUGIN_DIR . 'includes/deprecated.php';
/**
* Global variable holding the current settings for Contextual Related Posts
*
* @since 1.8.10
*
* @var array
*/
global $crp_settings;
$crp_settings = crp_get_settings();
/**
* Get Settings.
*
* Retrieves all plugin settings
*
* @since 2.6.0
* @return array Contextual Related Posts settings
*/
function crp_get_settings() {
$settings = get_option( 'crp_settings' );
/**
* Settings array
*
* Retrieves all plugin settings
*
* @since 2.0.0
* @param array $settings Settings array
*/
return apply_filters( 'crp_get_settings', $settings );
}