Version Description
- Opt-in remote assets
Download this release
Release Info
Developer | jureham |
Plugin | WordPress Related Posts |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5 to 1.5.2
- config.php +44 -4
- readme.txt +12 -1
- settings.php +122 -14
- static/css/dashboard.css +7 -0
- static/img/check.png +0 -0
- static/js/dashboard.js +6 -9
- static/js/themes.js +3 -3
- static/settings.js.php +0 -20
- versions.php +16 -0
- wp_related_posts.php +69 -61
config.php
CHANGED
@@ -25,6 +25,8 @@ define("WP_RP_CTR_BASE_URL", "http://d.related-posts.com/");
|
|
25 |
define("WP_RP_CTR_REPORT_URL", "http://t.related-posts.com/pageview/?");
|
26 |
define("WP_RP_CTR_PAGEVIEW_FILE", "js/pageview.js");
|
27 |
|
|
|
|
|
28 |
|
29 |
global $wp_rp_options, $wp_rp_meta;
|
30 |
$wp_rp_options = false;
|
@@ -76,7 +78,8 @@ function wp_rp_fetch_blog_credentials() {
|
|
76 |
$options = array(
|
77 |
'timeout' => 10
|
78 |
);
|
79 |
-
|
|
|
80 |
if (wp_remote_retrieve_response_code($response) == 200) {
|
81 |
$body = wp_remote_retrieve_body($response);
|
82 |
if ($body) {
|
@@ -84,6 +87,7 @@ function wp_rp_fetch_blog_credentials() {
|
|
84 |
if ($doc && $doc->status === 'ok') {
|
85 |
$wp_rp_meta['blog_id'] = $doc->data->blog_id;
|
86 |
$wp_rp_meta['auth_key'] = $doc->data->auth_key;
|
|
|
87 |
update_option('wp_rp_meta', $wp_rp_meta);
|
88 |
}
|
89 |
}
|
@@ -124,14 +128,16 @@ function wp_rp_install() {
|
|
124 |
'first_version' => WP_RP_VERSION,
|
125 |
'new_user' => true,
|
126 |
'show_upgrade_tooltip' => false,
|
127 |
-
'
|
|
|
|
|
128 |
);
|
129 |
|
130 |
$wp_rp_options = array(
|
131 |
'related_posts_title' => __('Related Posts', 'wp_related_posts'),
|
132 |
'related_posts_title_tag' => 'h3',
|
133 |
'missing_rp_algorithm' => 'random',
|
134 |
-
'missing_rp_title' => __('
|
135 |
'display_excerpt' => false,
|
136 |
'excerpt_max_length' => 200,
|
137 |
'max_related_posts' => 5,
|
@@ -148,13 +154,47 @@ function wp_rp_install() {
|
|
148 |
'default_thumbnail_path' => false,
|
149 |
'theme_name' => 'vertical-m.css',
|
150 |
'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS,
|
151 |
-
'ctr_dashboard_enabled'
|
|
|
|
|
152 |
);
|
153 |
|
154 |
update_option('wp_rp_meta', $wp_rp_meta);
|
155 |
update_option('wp_rp_options', $wp_rp_options);
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
function wp_rp_migrate_1_4() {
|
159 |
global $wpdb;
|
160 |
|
25 |
define("WP_RP_CTR_REPORT_URL", "http://t.related-posts.com/pageview/?");
|
26 |
define("WP_RP_CTR_PAGEVIEW_FILE", "js/pageview.js");
|
27 |
|
28 |
+
define("WP_RP_BANNER_FILE", "js/welcome.js");
|
29 |
+
|
30 |
|
31 |
global $wp_rp_options, $wp_rp_meta;
|
32 |
$wp_rp_options = false;
|
78 |
$options = array(
|
79 |
'timeout' => 10
|
80 |
);
|
81 |
+
|
82 |
+
$response = wp_remote_get(WP_RP_CTR_BASE_URL . 'register/?blog_url=' . get_bloginfo('wpurl') . ($wp_rp_meta['new_user'] ? '&new' : ''), $options);
|
83 |
if (wp_remote_retrieve_response_code($response) == 200) {
|
84 |
$body = wp_remote_retrieve_body($response);
|
85 |
if ($body) {
|
87 |
if ($doc && $doc->status === 'ok') {
|
88 |
$wp_rp_meta['blog_id'] = $doc->data->blog_id;
|
89 |
$wp_rp_meta['auth_key'] = $doc->data->auth_key;
|
90 |
+
$wp_rp_meta['new_user'] = false;
|
91 |
update_option('wp_rp_meta', $wp_rp_meta);
|
92 |
}
|
93 |
}
|
128 |
'first_version' => WP_RP_VERSION,
|
129 |
'new_user' => true,
|
130 |
'show_upgrade_tooltip' => false,
|
131 |
+
'show_install_tooltip' => true,
|
132 |
+
'show_ctr_banner' => true,
|
133 |
+
'show_blogger_network' => true
|
134 |
);
|
135 |
|
136 |
$wp_rp_options = array(
|
137 |
'related_posts_title' => __('Related Posts', 'wp_related_posts'),
|
138 |
'related_posts_title_tag' => 'h3',
|
139 |
'missing_rp_algorithm' => 'random',
|
140 |
+
'missing_rp_title' => __('Other Posts', 'wp_related_posts'),
|
141 |
'display_excerpt' => false,
|
142 |
'excerpt_max_length' => 200,
|
143 |
'max_related_posts' => 5,
|
154 |
'default_thumbnail_path' => false,
|
155 |
'theme_name' => 'vertical-m.css',
|
156 |
'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS,
|
157 |
+
'ctr_dashboard_enabled' => false,
|
158 |
+
'include_promotionail_link' => false,
|
159 |
+
'enable_themes' => false
|
160 |
);
|
161 |
|
162 |
update_option('wp_rp_meta', $wp_rp_meta);
|
163 |
update_option('wp_rp_options', $wp_rp_options);
|
164 |
}
|
165 |
|
166 |
+
function wp_rp_migrate_1_5_2() { # Silent release
|
167 |
+
$wp_rp_meta = get_option('wp_rp_meta');
|
168 |
+
|
169 |
+
$wp_rp_meta['show_install_tooltip'] = false;
|
170 |
+
$wp_rp_meta['version'] = '1.5.2.1';
|
171 |
+
|
172 |
+
update_option('wp_rp_meta', $wp_rp_meta);
|
173 |
+
}
|
174 |
+
function wp_rp_migrate_1_5_1() {
|
175 |
+
$wp_rp_options = get_option('wp_rp_options');
|
176 |
+
$wp_rp_meta = get_option('wp_rp_meta');
|
177 |
+
|
178 |
+
$wp_rp_options['enable_themes'] = true;
|
179 |
+
$wp_rp_meta['version'] = '1.5.2';
|
180 |
+
|
181 |
+
update_option('wp_rp_options', $wp_rp_options);
|
182 |
+
update_option('wp_rp_meta', $wp_rp_meta);
|
183 |
+
}
|
184 |
+
function wp_rp_migrate_1_5() {
|
185 |
+
$wp_rp_options = get_option('wp_rp_options');
|
186 |
+
$wp_rp_meta = get_option('wp_rp_meta');
|
187 |
+
|
188 |
+
$wp_rp_meta['show_blogger_network'] = false;
|
189 |
+
$wp_rp_meta['version'] = '1.5.1';
|
190 |
+
|
191 |
+
$wp_rp_options['include_promotionail_link'] = false;
|
192 |
+
$wp_rp_options['ctr_dashboard_enabled'] = !!$wp_rp_options['ctr_dashboard_enabled'];
|
193 |
+
|
194 |
+
update_option('wp_rp_options', $wp_rp_options);
|
195 |
+
update_option('wp_rp_meta', $wp_rp_meta);
|
196 |
+
}
|
197 |
+
|
198 |
function wp_rp_migrate_1_4() {
|
199 |
global $wpdb;
|
200 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: Related,Posts
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LB3MVPLUAWCY6
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.2
|
7 |
-
Stable tag: 1.5
|
8 |
|
9 |
WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
|
10 |
|
@@ -12,6 +12,10 @@ WordPress Related Posts Plugin will generate a related posts via WordPress tags,
|
|
12 |
|
13 |
WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
|
14 |
|
|
|
|
|
|
|
|
|
15 |
== Installation ==
|
16 |
|
17 |
1. Upload the folder WPRP to the `/wp-content/plugins/` directory
|
@@ -26,6 +30,13 @@ WordPress Related Posts Plugin will generate a related posts via WordPress tags,
|
|
26 |
|
27 |
== Changelog ==
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
= 1.5 =
|
30 |
* Pageview statistics in settings
|
31 |
* Custom CSS
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LB3MVPLUAWCY6
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.4.2
|
7 |
+
Stable tag: 1.5.2
|
8 |
|
9 |
WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
|
10 |
|
12 |
|
13 |
WordPress Related Posts Plugin will generate a related posts via WordPress tags, and add the related posts to feed.
|
14 |
|
15 |
+
Quickly increase engagement with your posts by adding Related Posts at the bottom of your content. This plugin also delivers statistics about Pageviews and Clicks*. Supports different styles, thumbnails and is fully customizable.
|
16 |
+
|
17 |
+
* Real time traffic analytics are provided via third party service.
|
18 |
+
|
19 |
== Installation ==
|
20 |
|
21 |
1. Upload the folder WPRP to the `/wp-content/plugins/` directory
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
= 1.5.2 =
|
34 |
+
* Opt-in remote assets
|
35 |
+
|
36 |
+
= 1.5.1 =
|
37 |
+
* Bugfixes
|
38 |
+
* Help promote our plugin option added
|
39 |
+
|
40 |
= 1.5 =
|
41 |
* Pageview statistics in settings
|
42 |
* Custom CSS
|
settings.php
CHANGED
@@ -6,14 +6,20 @@
|
|
6 |
|
7 |
function wp_rp_display_tooltips() {
|
8 |
$meta = wp_rp_get_meta();
|
|
|
9 |
|
10 |
if ($meta['show_upgrade_tooltip']) {
|
11 |
-
global $wp_rp_meta;
|
12 |
$meta['show_upgrade_tooltip'] = false;
|
13 |
update_option('wp_rp_meta', $meta);
|
14 |
$wp_rp_meta = $meta;
|
15 |
|
16 |
add_action('admin_enqueue_scripts', 'wp_rp_load_upgrade_tooltip');
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
}
|
19 |
function wp_rp_load_upgrade_tooltip() {
|
@@ -30,6 +36,20 @@ function wp_rp_print_upgrade_tooltip() {
|
|
30 |
wp_rp_print_tooltip($content);
|
31 |
}
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
function wp_rp_print_tooltip($content) {
|
34 |
?>
|
35 |
<script type="text/javascript">
|
@@ -99,6 +119,19 @@ function wp_rp_settings_styles() {
|
|
99 |
wp_enqueue_style("wp_rp_dashaboard_style", plugins_url("static/css/dashboard.css", __FILE__));
|
100 |
}
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
function wp_rp_settings_page()
|
103 |
{
|
104 |
global $wp_rp_empty_options;
|
@@ -129,7 +162,9 @@ function wp_rp_settings_page()
|
|
129 |
'related_posts_title_tag' => isset($postdata['wp_rp_related_posts_title_tag']) ? $postdata['wp_rp_related_posts_title_tag'] : 'h3',
|
130 |
'thumbnail_use_attached' => isset($postdata['wp_rp_thumbnail_use_attached']),
|
131 |
'thumbnail_use_custom' => isset($postdata['wp_rp_thumbnail_use_custom']) && $postdata['wp_rp_thumbnail_use_custom'] === 'yes',
|
132 |
-
'ctr_dashboard_enabled' => isset($postdata['wp_rp_ctr_dashboard_enabled'])
|
|
|
|
|
133 |
);
|
134 |
|
135 |
if(!isset($postdata['wp_rp_not_on_categories'])) {
|
@@ -195,11 +230,6 @@ function wp_rp_settings_page()
|
|
195 |
$theme_custom_css = $options['theme_custom_css'];
|
196 |
|
197 |
include(dirname(__FILE__) . '/static/settings.js.php');
|
198 |
-
|
199 |
-
if ($meta['new_user']) {
|
200 |
-
$meta['new_user'] = false;
|
201 |
-
update_option('wp_rp_meta', $meta);
|
202 |
-
}
|
203 |
?>
|
204 |
|
205 |
<input type="hidden" id="wp_rp_json_url" value="<?php esc_attr_e(WP_RP_STATIC_BASE_URL . WP_RP_STATIC_JSON_PATH); ?>" />
|
@@ -228,6 +258,73 @@ function wp_rp_settings_page()
|
|
228 |
<div id="message" class="updated fade"><p><?php echo $message ?>.</p></div>
|
229 |
<?php endif; ?>
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=wordpress-related-posts">
|
232 |
<?php if (wp_rp_statistics_supported()): ?>
|
233 |
<h2><?php _e("Statistics",'wp_related_posts');?></h2>
|
@@ -237,7 +334,7 @@ function wp_rp_settings_page()
|
|
237 |
<img src="<?php echo plugins_url("static/img/arrow.png", __FILE__); ?>" class="arrow" />
|
238 |
<?php endif; ?>
|
239 |
<label>
|
240 |
-
<input name="wp_rp_ctr_dashboard_enabled" type="checkbox" value="yes" <?php
|
241 |
<span><?php _e("Turn statistics on",'wp_related_posts');?> </span>
|
242 |
</label>
|
243 |
</div>
|
@@ -291,9 +388,15 @@ function wp_rp_settings_page()
|
|
291 |
|
292 |
<h3>Theme Settings <small style="color: #c33;">(new)</small></h3>
|
293 |
<table class="form-table">
|
294 |
-
<tr id="wp_rp_theme_options_wrap"
|
295 |
<th scope="row">Select Theme:</th>
|
296 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
</tr>
|
298 |
<tr id="wp_rp_theme_custom_css_wrap" style="display: none; ">
|
299 |
<th scope="row"></th>
|
@@ -439,14 +542,19 @@ function wp_rp_settings_page()
|
|
439 |
<tr valign="top">
|
440 |
<td>
|
441 |
<label>
|
442 |
-
|
443 |
-
|
444 |
</label>
|
445 |
(or add `<?php wp_related_posts()?>` to your single post template)
|
446 |
<br />
|
447 |
<label>
|
448 |
-
|
449 |
-
|
|
|
|
|
|
|
|
|
|
|
450 |
</label>
|
451 |
</td>
|
452 |
</tr>
|
6 |
|
7 |
function wp_rp_display_tooltips() {
|
8 |
$meta = wp_rp_get_meta();
|
9 |
+
global $wp_rp_meta;
|
10 |
|
11 |
if ($meta['show_upgrade_tooltip']) {
|
|
|
12 |
$meta['show_upgrade_tooltip'] = false;
|
13 |
update_option('wp_rp_meta', $meta);
|
14 |
$wp_rp_meta = $meta;
|
15 |
|
16 |
add_action('admin_enqueue_scripts', 'wp_rp_load_upgrade_tooltip');
|
17 |
+
} else if ($meta['show_install_tooltip']) {
|
18 |
+
$meta['show_install_tooltip'] = false;
|
19 |
+
update_option('wp_rp_meta', $meta);
|
20 |
+
$wp_rp_meta = $meta;
|
21 |
+
|
22 |
+
add_action('admin_enqueue_scripts', 'wp_rp_load_install_tooltip');
|
23 |
}
|
24 |
}
|
25 |
function wp_rp_load_upgrade_tooltip() {
|
36 |
wp_rp_print_tooltip($content);
|
37 |
}
|
38 |
|
39 |
+
function wp_rp_load_install_tooltip() {
|
40 |
+
if (version_compare(get_bloginfo('version'), '3.3', '<')) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
wp_enqueue_style('wp-pointer');
|
45 |
+
wp_enqueue_script('wp-pointer');
|
46 |
+
add_action('admin_print_footer_scripts', 'wp_rp_print_install_tooltip');
|
47 |
+
}
|
48 |
+
function wp_rp_print_install_tooltip() {
|
49 |
+
$content = "<h3>Thanks for installing Related Posts plugin!</h3><p>To experience the full power of Related Posts, go to settings and turn Statistics on!</p>";
|
50 |
+
wp_rp_print_tooltip($content);
|
51 |
+
}
|
52 |
+
|
53 |
function wp_rp_print_tooltip($content) {
|
54 |
?>
|
55 |
<script type="text/javascript">
|
119 |
wp_enqueue_style("wp_rp_dashaboard_style", plugins_url("static/css/dashboard.css", __FILE__));
|
120 |
}
|
121 |
|
122 |
+
function wp_rp_ajax_blogger_network_submit_callback() {
|
123 |
+
$meta = wp_rp_get_meta();
|
124 |
+
|
125 |
+
$meta['show_blogger_network'] = false;
|
126 |
+
update_option('wp_rp_meta', $meta);
|
127 |
+
|
128 |
+
echo 'ok';
|
129 |
+
|
130 |
+
die();
|
131 |
+
}
|
132 |
+
|
133 |
+
add_action('wp_ajax_blogger_network_submit', 'wp_rp_ajax_blogger_network_submit_callback');
|
134 |
+
|
135 |
function wp_rp_settings_page()
|
136 |
{
|
137 |
global $wp_rp_empty_options;
|
162 |
'related_posts_title_tag' => isset($postdata['wp_rp_related_posts_title_tag']) ? $postdata['wp_rp_related_posts_title_tag'] : 'h3',
|
163 |
'thumbnail_use_attached' => isset($postdata['wp_rp_thumbnail_use_attached']),
|
164 |
'thumbnail_use_custom' => isset($postdata['wp_rp_thumbnail_use_custom']) && $postdata['wp_rp_thumbnail_use_custom'] === 'yes',
|
165 |
+
'ctr_dashboard_enabled' => isset($postdata['wp_rp_ctr_dashboard_enabled']),
|
166 |
+
'include_promotionail_link' => isset($postdata['wp_rp_include_promotionail_link']),
|
167 |
+
'enable_themes' => isset($postdata['wp_rp_enable_themes'])
|
168 |
);
|
169 |
|
170 |
if(!isset($postdata['wp_rp_not_on_categories'])) {
|
230 |
$theme_custom_css = $options['theme_custom_css'];
|
231 |
|
232 |
include(dirname(__FILE__) . '/static/settings.js.php');
|
|
|
|
|
|
|
|
|
|
|
233 |
?>
|
234 |
|
235 |
<input type="hidden" id="wp_rp_json_url" value="<?php esc_attr_e(WP_RP_STATIC_BASE_URL . WP_RP_STATIC_JSON_PATH); ?>" />
|
258 |
<div id="message" class="updated fade"><p><?php echo $message ?>.</p></div>
|
259 |
<?php endif; ?>
|
260 |
|
261 |
+
<?php if ($meta['show_blogger_network']): ?>
|
262 |
+
<form action="https://docs.google.com/a/zemanta.com/spreadsheet/formResponse?formkey=dDEyTlhraEd0dnRwVVFMX19LRW8wbWc6MQ&ifq" method="POST" id="wp_rp_blogger_network_form" target="wp_rp_blogger_network_hidden_iframe">
|
263 |
+
<input type="hidden" name="pageNumber" value="0" />
|
264 |
+
<input type="hidden" name="backupCache" />
|
265 |
+
<input type="hidden" name="entry.2.single" value="<?php echo get_bloginfo('wpurl'); ?>">
|
266 |
+
|
267 |
+
<h2>Blogger networks</h2>
|
268 |
+
|
269 |
+
<table class="form-table"><tbody>
|
270 |
+
<tr valign="top">
|
271 |
+
<th scope="row"><label for="wp_rp_blogger_network_kind">I want to exchange traffic with</label></th>
|
272 |
+
<td width="1%">
|
273 |
+
<select name="entry.0.group" id="wp_rp_blogger_network_kind">
|
274 |
+
<option value="Automotive" />Automotive bloggers</option>
|
275 |
+
<option value="Beauty & Style" />Beauty & Style bloggers</option>
|
276 |
+
<option value="Business" />Business bloggers</option>
|
277 |
+
<option value="Consumer Tech" />Consumer Tech bloggers</option>
|
278 |
+
<option value="Enterprise Tech" />Enterprise Tech bloggers</option>
|
279 |
+
<option value="Entertainment" />Entertainment bloggers</option>
|
280 |
+
<option value="Family & Parenting" />Family & Parenting bloggers</option>
|
281 |
+
<option value="Food & Drink" />Food & Drink bloggers</option>
|
282 |
+
<option value="Graphic Arts" />Graphic Arts bloggers</option>
|
283 |
+
<option value="Healthy Living" />Healthy Living bloggers</option>
|
284 |
+
<option value="Home & Shelter" />Home & Shelter bloggers</option>
|
285 |
+
<option value="Lifestyle & Hobby" />Lifestyle & Hobby bloggers</option>
|
286 |
+
<option value="Men's Lifestyle" />Men's Lifestyle bloggers</option>
|
287 |
+
<option value="Personal Finance" />Personal Finance bloggers</option>
|
288 |
+
<option value="Women's Lifestyle" />Women's Lifestyle bloggers</option>
|
289 |
+
</select>
|
290 |
+
</td>
|
291 |
+
<td rowspan="2" valign="middle"><div id="wp_rp_blogger_network_thankyou"><img src="<?php echo plugins_url("static/img/check.png", __FILE__); ?>" width="30" height="22" />Thanks for showing interest.<br/>We'll contact you by email soon.</div></td>
|
292 |
+
</tr>
|
293 |
+
<tr valign="top">
|
294 |
+
<th scope="row"><label for="wp_rp_blogger_network_email">My email is:</label></th>
|
295 |
+
<td><input type="email" name="entry.1.single" value="" id="wp_rp_blogger_network_email" required="required" /></td>
|
296 |
+
</tr>
|
297 |
+
<tr valign="top">
|
298 |
+
<th scope="row"></th>
|
299 |
+
<td><input type="submit" name="submit" value="Submit" id="wp_rp_blogger_network_submit" /></td>
|
300 |
+
</tbody></table>
|
301 |
+
|
302 |
+
<script type="text/javascript">
|
303 |
+
jQuery(function($) {
|
304 |
+
var submit = $('#wp_rp_blogger_network_submit'),
|
305 |
+
email_input = $('#wp_rp_blogger_network_email'),
|
306 |
+
email_regex = /^[^@]+@[^@]+$/;
|
307 |
+
$('#wp_rp_blogger_network_form').submit(function(event) {
|
308 |
+
if(!email_regex.test(email_input.val())) {
|
309 |
+
event.preventDefault();
|
310 |
+
email_input.animate({backgroundColor: '#faa'}).focus();
|
311 |
+
return;
|
312 |
+
}
|
313 |
+
email_input.css({backgroundColor: ''});
|
314 |
+
submit.addClass('disabled');
|
315 |
+
setTimeout(function() { submit.attr('disabled', true); }, 0);
|
316 |
+
$('#wp_rp_blogger_network_hidden_iframe').load(function() {
|
317 |
+
submit.attr('disabled', false).removeClass('disabled');
|
318 |
+
$('#wp_rp_blogger_network_thankyou').fadeIn('slow');
|
319 |
+
$.post(ajaxurl, {action: 'blogger_network_submit'});
|
320 |
+
});
|
321 |
+
});
|
322 |
+
});
|
323 |
+
</script>
|
324 |
+
</form>
|
325 |
+
<iframe id="wp_rp_blogger_network_hidden_iframe" name="wp_rp_blogger_network_hidden_iframe" style="display: none"></iframe>
|
326 |
+
<?php endif; ?>
|
327 |
+
|
328 |
<form method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=wordpress-related-posts">
|
329 |
<?php if (wp_rp_statistics_supported()): ?>
|
330 |
<h2><?php _e("Statistics",'wp_related_posts');?></h2>
|
334 |
<img src="<?php echo plugins_url("static/img/arrow.png", __FILE__); ?>" class="arrow" />
|
335 |
<?php endif; ?>
|
336 |
<label>
|
337 |
+
<input name="wp_rp_ctr_dashboard_enabled" type="checkbox" value="yes" <?php checked($options['ctr_dashboard_enabled']); ?> />
|
338 |
<span><?php _e("Turn statistics on",'wp_related_posts');?> </span>
|
339 |
</label>
|
340 |
</div>
|
388 |
|
389 |
<h3>Theme Settings <small style="color: #c33;">(new)</small></h3>
|
390 |
<table class="form-table">
|
391 |
+
<tr id="wp_rp_theme_options_wrap">
|
392 |
<th scope="row">Select Theme:</th>
|
393 |
+
<td>
|
394 |
+
<label>
|
395 |
+
<input name="wp_rp_enable_themes" type="checkbox" id="wp_rp_enable_themes" value="yes"<?php checked($options["enable_themes"]); ?> />
|
396 |
+
<?php _e("Enable Themes (Loaded from external service)",'wp_related_posts'); ?>
|
397 |
+
</label>
|
398 |
+
<div class="theme-list"></div>
|
399 |
+
</td>
|
400 |
</tr>
|
401 |
<tr id="wp_rp_theme_custom_css_wrap" style="display: none; ">
|
402 |
<th scope="row"></th>
|
542 |
<tr valign="top">
|
543 |
<td>
|
544 |
<label>
|
545 |
+
<input name="wp_rp_on_single_post" type="checkbox" id="wp_rp_on_single_post" value="yes" <?php checked($options['on_single_post']); ?>>
|
546 |
+
<?php _e("Auto Insert Related Posts",'wp_related_posts');?>
|
547 |
</label>
|
548 |
(or add `<?php wp_related_posts()?>` to your single post template)
|
549 |
<br />
|
550 |
<label>
|
551 |
+
<input name="wp_rp_on_rss" type="checkbox" id="wp_rp_on_rss" value="yes"<?php checked($options['on_rss']); ?>>
|
552 |
+
<?php _e("Display Related Posts in Feed",'wp_related_posts');?>
|
553 |
+
</label>
|
554 |
+
<br />
|
555 |
+
<label>
|
556 |
+
<input name="wp_rp_include_promotionail_link" type="checkbox" id="wp_rp_include_promotionail_link" value="yes"<?php checked($options['include_promotionail_link']); ?> />
|
557 |
+
<?php _e('Help Promote This Plugin', 'wp_related_posts'); ?>
|
558 |
</label>
|
559 |
</td>
|
560 |
</tr>
|
static/css/dashboard.css
CHANGED
@@ -30,3 +30,10 @@
|
|
30 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.message.enable {color: #82c1cb;}
|
31 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.message.unavailable {color: #848484; display: none; padding-top: 20px;}
|
32 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.option-enable img.arrow {width: 83px; height: 51px; margin-bottom: -40px; margin-right: 1em;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.message.enable {color: #82c1cb;}
|
31 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.message.unavailable {color: #848484; display: none; padding-top: 20px;}
|
32 |
#wp_rp_wrap div#wp_rp_statistics_wrap div.option-enable img.arrow {width: 83px; height: 51px; margin-bottom: -40px; margin-right: 1em;}
|
33 |
+
|
34 |
+
#wp_rp_blogger_network_form { background: #f7f7f7; padding: 20px; margin: 30px 0px; border: 1px solid #e1e1e1; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
|
35 |
+
#wp_rp_blogger_network_form h2 { font-size: 19px; line-height: 20px; padding-top: 0px; }
|
36 |
+
#wp_rp_blogger_network_submit { background-color: #8ac6d0; border-color: #57aab8; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; color: white; padding: 7px 25px; font-size: 14px; text-shadow: 1px 1px 1px #666; }
|
37 |
+
#wp_rp_blogger_network_submit.disabled { background-color: #ddd; border-color: #bababa; }
|
38 |
+
#wp_rp_blogger_network_thankyou { font-size: 14px; display: none; }
|
39 |
+
#wp_rp_blogger_network_thankyou img { float: left; margin: 10px; }
|
static/img/check.png
ADDED
Binary file
|
static/js/dashboard.js
CHANGED
@@ -1,9 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
updating
|
6 |
-
|
7 |
-
set_update_interval(response.data.update_interval);ul.find('.ctr .num').html(response.data.ctr+'%');ul.find('.pageviews .num').html(response.data.pageviews);ul.find('.clicks .num').html(response.data.clicks);updating=false;});};if(dashboard_url){if(!blog_id||!auth_key){display_error();return;}
|
8 |
-
update_dashboard(true);update_interval=setInterval(update_dashboard,2000);}
|
9 |
-
var em=$("<em>(don't forget to save the changes)</em>").css({'display':'none','color':'red'}),span=$('#wp_rp_statistics_wrap .option-enable span'),label=span.parent(),label_position=label.position(),img=label.parent().find('img'),img_position=img.position(),ctr_checkbox=label.find('input'),initial_ctr_checkbox_value=ctr_checkbox[0].checked;label.css({'position':'absolute','top':label_position.top+'px','left':label_position.left+'px'});img.css({'position':'absolute','top':img_position.top+'px','left':img_position.left+'px'});span.append(em);ctr_checkbox.change(function(){if(this.checked!==initial_ctr_checkbox_value){em.show();}else{em.hide();}});});}(jQuery));
|
1 |
+
(function(a){var e=function(b,c){a.each(c,function(a,c){b=b.replace(RegExp("{{ *"+a+" *}}"),c)});return b};a(function(){var b=a("#wp_rp_statistics_wrap"),c=a("#wp_rp_dashboard_url").val(),h=a("#wp_rp_blog_id").val(),i=a("#wp_rp_auth_key").val();update_interval=req_timeout=null;update_interval_sec=2E3;update_interval_error_sec=3E4;updating=!1;ul=null;set_update_interval=function(a){a||(a=update_interval_sec);clearInterval(update_interval);0<a&&(update_interval=setInterval(update_dashboard,a))};display_error=
|
2 |
+
function(b){var n=a("#wp_rp_statistics_wrap");b||n.find(".unavailable").slideDown();set_update_interval(update_interval_error_sec);updating=!1};create_dashboard=function(){ul=a('<ul class="statistics" />');b.find(".unavailable").slideUp();ul.append(e('<li class="{{class}}"><h4>{{ title}}<span>{{range}}</span></h4><p class="num"></p><div class="overlay"><p>{{description}}</p></div></li>',{"class":"ctr",title:"click-through rate",description:"Number of clicks on a Related Post divided by the number of times the post was shown to readers. Tip: Using thumbnails will generally rise Click-through Rates.",
|
3 |
+
range:"last 30 days"}));ul.append(e('<li class="{{class}}"><h4>{{ title}}<span>{{range}}</span></h4><p class="num"></p><div class="overlay"><p>{{description}}</p></div></li>',{"class":"pageviews",title:"page views",description:"Number of times the page (usually post) was loaded to readers.",range:"last 30 days"}));ul.append(e('<li class="{{class}}"><h4>{{ title}}<span>{{range}}</span></h4><p class="num"></p><div class="overlay"><p>{{description}}</p></div></li>',{"class":"clicks",title:"clicks",description:"Number of times a reader has clicked on one of the Related Posts.",
|
4 |
+
range:"last 30 days"}));ul.hide();b.append(ul);ul.slideDown()};update_dashboard=function(b){updating||(updating=!0,req_timeout=setTimeout(function(){display_error(!b)},2E3),a.getJSON(c+"pageviews/?callback=?",{blog_id:h,auth_key:i},function(a){clearTimeout(req_timeout);!a||"ok"!==a.status||!a.data?display_error(!b):(ul||create_dashboard(),set_update_interval(a.data.update_interval),ul.find(".ctr .num").html(a.data.ctr+"%"),ul.find(".pageviews .num").html(a.data.pageviews),ul.find(".clicks .num").html(a.data.clicks),
|
5 |
+
updating=!1)}))};if(c){if(!h||!i){display_error();return}update_dashboard(!0);update_interval=setInterval(update_dashboard,2E3)}var f=a("<em>(don't forget to save the changes)</em>").css({display:"none",color:"red"}),j=a("#wp_rp_statistics_wrap .option-enable span"),d=j.parent(),k=d.position(),g=d.parent().find("img"),l=g.position(),m=d.find("input"),p=m[0].checked;d.css({position:"absolute",top:k.top+"px",left:k.left+"px"});g.length&&g.css({position:"absolute",top:l.top+"px",left:l.left+"px"});j.append(f);
|
6 |
+
m.change(function(){this.checked!==p?f.show():f.hide()})})})(jQuery);
|
|
|
|
|
|
static/js/themes.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
1 |
+
(function(a){a(function(){var d=a("#wp_rp_theme_options_wrap"),i=a("#wp_rp_json_url").val(),j=a("#wp_rp_version").val(),e=a("#wp_rp_theme_selected").val(),f=null,g=function(){var a=document.createElement("script"),c=document.getElementsByTagName("body").item(0);a.type="text/javascript";a.src=i+"themes.js?plv="+j;c.appendChild(a)},h=function(b){var c=a("#wp_rp_theme_custom_css_wrap");"custom.css"===b?c.show():c.hide()};window.wp_rp_themes_cb=function(b){if(b&&b.themes&&(f=b.themes)){var c=d.find("div.theme-list");
|
2 |
+
c.empty();a.each(f,function(a,b){c.append("<label><input "+(b.location===e?'checked="checked"':"")+' class="theme-option" type="radio" name="wp_rp_theme_name" value="'+b.location+'" /> '+b.name+"</label><br />")});c.on("click change","input.theme-option",function(){a(this).prop("checked")&&h(a(this).val())});d.show();h(e)}};a("#wp_rp_enable_themes:checked").length&&g();a("#wp_rp_enable_themes").change(function(){a("#wp_rp_enable_themes:checked").length?g():a("#wp_rp_theme_options_wrap div.theme-list").empty()});
|
3 |
+
(!window.localStorage||!window.localStorage.wp_wp_survey_1)&&a("#wp-rp-survey").show();a("#wp-rp-survey .close, #wp-rp-survey .link").click(function(){a("#wp-rp-survey").fadeOut();window.localStorage&&(window.localStorage.wp_wp_survey_1="close")})})})(jQuery);
|
static/settings.js.php
CHANGED
@@ -50,23 +50,3 @@
|
|
50 |
}
|
51 |
}
|
52 |
</script>
|
53 |
-
|
54 |
-
<script type="text/javascript">
|
55 |
-
|
56 |
-
var _gaq = _gaq || [];
|
57 |
-
_gaq.push(['_setAccount', 'UA-34712447-1']);
|
58 |
-
_gaq.push(['_trackPageview']);
|
59 |
-
<?php if($meta['new_user']) : ?>
|
60 |
-
_gaq.push(['_trackEvent', 'wp_related_posts', 'new_user', 'new_user', 0, true]);
|
61 |
-
<?php endif; ?>
|
62 |
-
_gaq.push(['_trackEvent', 'wp_related_posts', 'settings_loaded_wp_version', '<?php bloginfo('version'); ?>', 0, true]);
|
63 |
-
_gaq.push(['_trackEvent', 'wp_related_posts', 'settings_loaded_wp_language', '<?php bloginfo('language'); ?>', 0, true]);
|
64 |
-
_gaq.push(['_trackEvent', 'wp_related_posts', 'settings_loaded_wp_plugin_version', '<?php $plugin_data = get_plugin_data(__FILE__); echo $plugin_data['Version'];?>', 0, true]);
|
65 |
-
|
66 |
-
(function() {
|
67 |
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
68 |
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
69 |
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
70 |
-
})();
|
71 |
-
|
72 |
-
</script>
|
50 |
}
|
51 |
}
|
52 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
versions.php
CHANGED
@@ -1,4 +1,19 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
/* ************************* */
|
4 |
/* Version 1.5 */
|
@@ -27,6 +42,7 @@
|
|
27 |
wp_rp_thumbnail_featured -> thumbnail_use_custom bool : `true` -> use image from custom field, `false` -> use featured image
|
28 |
|
29 |
+ wp_rp_theme_custom_css -> theme_custom_css string : user defined custom css for related posts
|
|
|
30 |
|
31 |
- wp_rp_version -> meta.version
|
32 |
- wp_rp_log_new_user -> meta.new_user
|
1 |
<?php
|
2 |
+
/* ************************* */
|
3 |
+
/* Version 1.5.1 */
|
4 |
+
/* ************************* */
|
5 |
+
|
6 |
+
/* Settings:
|
7 |
+
|
8 |
+
ctr_dashboard_enabled bool : show CTR statistics in dashboard
|
9 |
+
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Meta options:
|
13 |
+
|
14 |
+
+ show_blogger_network bool : show a banner for submitting email and blogger network
|
15 |
+
|
16 |
+
*/
|
17 |
|
18 |
/* ************************* */
|
19 |
/* Version 1.5 */
|
42 |
wp_rp_thumbnail_featured -> thumbnail_use_custom bool : `true` -> use image from custom field, `false` -> use featured image
|
43 |
|
44 |
+ wp_rp_theme_custom_css -> theme_custom_css string : user defined custom css for related posts
|
45 |
+
+ ctr_dashboard_enabled "yes" | false : whether to show CTR statistics in dashboard or not. We fucked up here, we must normalize this in the next version.
|
46 |
|
47 |
- wp_rp_version -> meta.version
|
48 |
- wp_rp_log_new_user -> meta.new_user
|
wp_related_posts.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
-
Version: 1.5
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Generate a related posts list via tags of WordPress
|
7 |
Author: Jure Ham
|
8 |
Author URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
9 |
*/
|
10 |
|
11 |
-
define('WP_RP_VERSION', '1.5');
|
12 |
|
13 |
include_once(dirname(__FILE__) . '/config.php');
|
14 |
|
@@ -122,30 +122,33 @@ function wp_rp_fetch_posts_and_title() {
|
|
122 |
|
123 |
$title = $options["related_posts_title"];
|
124 |
$related_posts = wp_rp_fetch_related_posts($limitclause);
|
|
|
125 |
|
126 |
-
if (!$related_posts) {
|
127 |
-
$missing_rp_algorithm = $options["missing_rp_algorithm"];
|
128 |
$title = $options["missing_rp_title"];
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
138 |
}
|
139 |
-
}
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
|
|
|
149 |
}
|
150 |
|
151 |
return array(
|
@@ -213,7 +216,6 @@ function wp_rp_should_exclude() {
|
|
213 |
return false;
|
214 |
}
|
215 |
|
216 |
-
|
217 |
function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
218 |
global $wpdb, $post;
|
219 |
|
@@ -224,66 +226,72 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
224 |
$meta = wp_rp_get_meta();
|
225 |
|
226 |
$output = "";
|
|
|
|
|
227 |
|
228 |
$posts_and_title = wp_rp_fetch_posts_and_title();
|
229 |
$related_posts = $posts_and_title['posts'];
|
230 |
$title = $posts_and_title['title'];
|
231 |
|
232 |
-
$theme_name = $options['theme_name'];
|
233 |
-
|
234 |
-
if ($options["display_thumbnail"]) {
|
235 |
-
$theme_url = WP_RP_STATIC_BASE_URL . WP_RP_STATIC_THEMES_THUMBS_PATH . $theme_name;
|
236 |
-
} else {
|
237 |
-
$theme_url = WP_RP_STATIC_BASE_URL . WP_RP_STATIC_THEMES_PATH . $theme_name;
|
238 |
-
}
|
239 |
|
240 |
if ($related_posts) {
|
241 |
$output = wp_rp_generate_related_posts_list_items($related_posts);
|
242 |
-
|
243 |
-
$output = '<li>' . $title . '</li>';
|
244 |
-
$title = "";
|
245 |
-
}
|
246 |
|
247 |
-
|
|
|
|
|
|
|
248 |
|
249 |
-
|
250 |
-
if ($before_title) {
|
251 |
-
if ($title != '') {
|
252 |
-
$output = $before_title . $title . $after_title . $output;
|
253 |
}
|
254 |
-
}
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
257 |
}
|
258 |
}
|
259 |
|
260 |
-
if ($
|
261 |
-
$
|
262 |
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
265 |
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
276 |
|
277 |
if ($options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key']) {
|
278 |
-
$
|
279 |
-
window._wp_rp_blog_id = "' . esc_js($meta['blog_id']) . '";
|
280 |
window._wp_rp_ajax_img_src_url = "' . esc_js(WP_RP_CTR_REPORT_URL) . '";
|
281 |
window._wp_rp_post_id = ' . esc_js($post->ID) . ';
|
282 |
-
window._wp_rp_thumbnails = ' . ($options["display_thumbnail"] ? 'true' : 'false') . ';
|
283 |
-
|
284 |
-
<script type="text/javascript" src="' . esc_attr(WP_RP_STATIC_BASE_URL . WP_RP_CTR_PAGEVIEW_FILE) . '"></script>';
|
285 |
}
|
286 |
|
|
|
|
|
|
|
287 |
|
288 |
-
return $output;
|
289 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
+
Version: 1.5.2
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Generate a related posts list via tags of WordPress
|
7 |
Author: Jure Ham
|
8 |
Author URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
9 |
*/
|
10 |
|
11 |
+
define('WP_RP_VERSION', '1.5.2');
|
12 |
|
13 |
include_once(dirname(__FILE__) . '/config.php');
|
14 |
|
122 |
|
123 |
$title = $options["related_posts_title"];
|
124 |
$related_posts = wp_rp_fetch_related_posts($limitclause);
|
125 |
+
$missing_rp_algorithm = $options["missing_rp_algorithm"];
|
126 |
|
127 |
+
if (!$related_posts && $missing_rp_algorithm === "text") {
|
|
|
128 |
$title = $options["missing_rp_title"];
|
129 |
+
$related_posts = false;
|
130 |
+
} else {
|
131 |
+
if (!$related_posts) {
|
132 |
+
$title = $options["missing_rp_title"];
|
133 |
+
|
134 |
+
if ($missing_rp_algorithm === "commented") {
|
135 |
+
$related_posts = wp_rp_fetch_most_commented_posts($limitclause);
|
136 |
+
} else if ($missing_rp_algorithm === "popularity" && function_exists('akpc_most_popular')) {
|
137 |
+
$related_posts = wp_rp_fetch_most_popular_posts($limitclause);
|
138 |
+
} else {
|
139 |
+
$related_posts = wp_rp_fetch_random_posts($limit);
|
140 |
+
}
|
141 |
}
|
|
|
142 |
|
143 |
+
// fill related posts with random posts if there not enough posts found
|
144 |
+
if(empty($related_posts) || sizeof($related_posts) < $limit) {
|
145 |
+
$src_posts = !is_array($related_posts) ? array() : $related_posts;
|
146 |
+
$exclude_ids = array_map(create_function('$p', 'return $p->ID;'), $src_posts);
|
147 |
+
$random_posts = wp_rp_fetch_random_posts($limit - sizeof($src_posts), $exclude_ids);
|
148 |
|
149 |
+
if(!empty($random_posts))
|
150 |
+
$related_posts = array_merge($src_posts, $random_posts);
|
151 |
+
}
|
152 |
}
|
153 |
|
154 |
return array(
|
216 |
return false;
|
217 |
}
|
218 |
|
|
|
219 |
function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
220 |
global $wpdb, $post;
|
221 |
|
226 |
$meta = wp_rp_get_meta();
|
227 |
|
228 |
$output = "";
|
229 |
+
$output_script = "";
|
230 |
+
$promotional_link = '';
|
231 |
|
232 |
$posts_and_title = wp_rp_fetch_posts_and_title();
|
233 |
$related_posts = $posts_and_title['posts'];
|
234 |
$title = $posts_and_title['title'];
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
if ($related_posts) {
|
238 |
$output = wp_rp_generate_related_posts_list_items($related_posts);
|
239 |
+
$output = '<ul class="related_post wp_rp">' . $output . '</ul>';
|
|
|
|
|
|
|
240 |
|
241 |
+
if ($options['include_promotionail_link']) {
|
242 |
+
$promotional_link = ' <a target="_blank" rel="nofollow" title="WordPress Related Posts" href="http://related-posts.com/welcome2/" class="wp_rp_welcome" onclick="return window._wp_rp_show_banner && window._wp_rp_show_banner(event)">[?]</a>';
|
243 |
+
$output .= '<div id="wp_rp_popup_holder"></div>';
|
244 |
+
$output .= '<script async type="text/javascript" src="' . esc_attr(WP_RP_STATIC_BASE_URL . WP_RP_BANNER_FILE) . '"></script>';
|
245 |
|
246 |
+
$output_script .= 'window._wp_rp_static_base_url = "' . WP_RP_STATIC_BASE_URL . '";';
|
|
|
|
|
|
|
247 |
}
|
248 |
+
}
|
249 |
+
|
250 |
+
if ($title != '') {
|
251 |
+
if ($before_title) {
|
252 |
+
$output = $before_title . $title . $after_title . $output;
|
253 |
+
} else {
|
254 |
+
$title_tag = $options["related_posts_title_tag"];
|
255 |
+
$output = '<' . $title_tag . ' class="related_post_title">' . $title . $promotional_link . '</' . $title_tag . '>' . $output;
|
256 |
}
|
257 |
}
|
258 |
|
259 |
+
if ($options['enable_themes']) {
|
260 |
+
$theme_name = $options['theme_name'];
|
261 |
|
262 |
+
if ($options["display_thumbnail"]) {
|
263 |
+
$theme_url = WP_RP_STATIC_BASE_URL . WP_RP_STATIC_THEMES_THUMBS_PATH . $theme_name;
|
264 |
+
} else {
|
265 |
+
$theme_url = WP_RP_STATIC_BASE_URL . WP_RP_STATIC_THEMES_PATH . $theme_name;
|
266 |
+
}
|
267 |
|
268 |
+
if ($theme_name === 'custom.css') {
|
269 |
+
$theme_custom_css = $options['theme_custom_css'];
|
270 |
+
|
271 |
+
$output .= '<style>' . $theme_custom_css . '</style>';
|
272 |
+
}
|
273 |
+
|
274 |
+
$output_script .= 'setTimeout(function () {
|
275 |
+
var link = document.createElement("link");
|
276 |
+
link.rel = "stylesheet";
|
277 |
+
link.href = "' . esc_js($theme_url) . '";
|
278 |
+
link.type = "text/css";
|
279 |
+
document.getElementsByTagName("body")[0].appendChild(link);
|
280 |
+
}, 1);';
|
281 |
+
}
|
282 |
|
283 |
if ($options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key']) {
|
284 |
+
$output_script .= 'window._wp_rp_blog_id = "' . esc_js($meta['blog_id']) . '";
|
|
|
285 |
window._wp_rp_ajax_img_src_url = "' . esc_js(WP_RP_CTR_REPORT_URL) . '";
|
286 |
window._wp_rp_post_id = ' . esc_js($post->ID) . ';
|
287 |
+
window._wp_rp_thumbnails = ' . ($options["display_thumbnail"] ? 'true' : 'false') . ';';
|
288 |
+
|
289 |
+
$output .= '<script type="text/javascript" src="' . esc_attr(WP_RP_STATIC_BASE_URL . WP_RP_CTR_PAGEVIEW_FILE) . '"></script>';
|
290 |
}
|
291 |
|
292 |
+
if ($output_script) {
|
293 |
+
$output_script = '<script type="text/javascript">' . $output_script . '</script>';
|
294 |
+
}
|
295 |
|
296 |
+
return $output . $output_script;
|
297 |
}
|