Version Description
Release Date - 2021-05-20
- IWP-178 Additonal refactoring
- IWP-188 make "FAQ & Docs" tab open in new browser tab
Download this release
Release Info
Developer | IntellyWP |
Plugin | Inline Related Posts |
Version | 3.0.4 |
Comparing to | |
See all releases |
Code changes from version 3.0.2 to 3.0.4
- assets/css/style.css +162 -162
- assets/js/button-mce.js +44 -44
- includes/actions.php +22 -95
- includes/admin/button-mce.php +134 -134
- includes/admin/settings.php +437 -437
- includes/classes/html/HTMLContext.php +563 -563
- includes/classes/ui/Form.php +457 -457
- includes/classes/ui/Tabs.php +243 -234
- includes/core.php +334 -334
- index.php +2 -2
- languages/Lang.txt +201 -201
- readme.txt +12 -0
assets/css/style.css
CHANGED
@@ -1,163 +1,163 @@
|
|
1 |
-
._irp {
|
2 |
-
background-color: #efc439;
|
3 |
-
border-radius: 2px;
|
4 |
-
color: #fff;
|
5 |
-
display: inline-block;
|
6 |
-
font-size: 12px;
|
7 |
-
padding: 0 2px;
|
8 |
-
line-height: 14px;
|
9 |
-
vertical-align: baseline;
|
10 |
-
}
|
11 |
-
|
12 |
-
.irp-tag {
|
13 |
-
display: inline-block;
|
14 |
-
line-height: 13px;
|
15 |
-
padding: 0 3px;
|
16 |
-
color: white;
|
17 |
-
font-size: 10px;
|
18 |
-
font-weight: normal;
|
19 |
-
width:25px;
|
20 |
-
margin-top:3px;
|
21 |
-
margin-right:5px;
|
22 |
-
text-align:center;
|
23 |
-
-webkit-border-radius: 2px;
|
24 |
-
border-radius: 2px;
|
25 |
-
vertical-align: baseline;
|
26 |
-
}
|
27 |
-
.irp-tag-free {
|
28 |
-
/*background-color: #edb802;*/
|
29 |
-
background-color: #16a765;
|
30 |
-
}
|
31 |
-
.irp-tag-premium {
|
32 |
-
/*background-color: #edb802;*/
|
33 |
-
background-color: #4986e7;
|
34 |
-
opacity: 0.7;
|
35 |
-
filter: alpha(opacity=70);
|
36 |
-
}
|
37 |
-
.irp-tag-premium a {
|
38 |
-
color:white;
|
39 |
-
text-decoration:none;
|
40 |
-
}
|
41 |
-
.irp-button {
|
42 |
-
margin-right:5px!important;
|
43 |
-
}
|
44 |
-
|
45 |
-
.irp-textarea {
|
46 |
-
font-family:"Courier New", Courier, mono;
|
47 |
-
font-size:12px;
|
48 |
-
color:#555;
|
49 |
-
background-color:#f8f8f8;
|
50 |
-
width:550px;
|
51 |
-
height:350px;
|
52 |
-
}
|
53 |
-
|
54 |
-
.irp-form {
|
55 |
-
float:left;
|
56 |
-
padding:5px;
|
57 |
-
}
|
58 |
-
.irp-form input, .irp-form label {
|
59 |
-
float:left;
|
60 |
-
}
|
61 |
-
.irp-text {
|
62 |
-
width: 400px;
|
63 |
-
}
|
64 |
-
.irp-label {
|
65 |
-
width: 200px;
|
66 |
-
margin: 0px;
|
67 |
-
background-color: transparent;
|
68 |
-
}
|
69 |
-
.irp-label-disabled {
|
70 |
-
/*color:#A8A8A8;*/
|
71 |
-
opacity: 0.7;
|
72 |
-
filter: alpha(opacity=70);
|
73 |
-
}
|
74 |
-
.irp-checkbox {
|
75 |
-
margin:0px;
|
76 |
-
}
|
77 |
-
.irp-checkbox:disabled {
|
78 |
-
background-color: #f8f8f8;
|
79 |
-
}
|
80 |
-
.irp-select {
|
81 |
-
|
82 |
-
}
|
83 |
-
.irp-form-newline {
|
84 |
-
clear:both;
|
85 |
-
margin-bottom:5px;
|
86 |
-
}
|
87 |
-
|
88 |
-
img.irp-help {
|
89 |
-
cursor: pointer;
|
90 |
-
float: left;
|
91 |
-
margin-right: 10px;
|
92 |
-
}
|
93 |
-
|
94 |
-
.irp-qtip {
|
95 |
-
font-size: 14px !important;
|
96 |
-
line-height: 18px !important;
|
97 |
-
}
|
98 |
-
|
99 |
-
i.mce-i-icon {
|
100 |
-
font: 400 20px/1 dashicons;
|
101 |
-
padding: 0;
|
102 |
-
vertical-align: top;
|
103 |
-
speak: none;
|
104 |
-
-webkit-font-smoothing: antialiased;
|
105 |
-
-moz-osx-font-smoothing: grayscale;
|
106 |
-
margin-left: -2px;
|
107 |
-
padding-right: 2px
|
108 |
-
}
|
109 |
-
|
110 |
-
i.irp-own-icon {
|
111 |
-
background-image: url('../images/repeat.png');
|
112 |
-
}
|
113 |
-
|
114 |
-
.irp-box-error {
|
115 |
-
background: #fff;
|
116 |
-
border-left: 4px solid #dd3d36;
|
117 |
-
margin: 5px 0 15px;
|
118 |
-
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
119 |
-
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
120 |
-
padding: 1px 12px;
|
121 |
-
}
|
122 |
-
.irp-box-warning {
|
123 |
-
background: #fff;
|
124 |
-
border-left: 4px solid #ffba00;
|
125 |
-
margin: 5px 0 15px;
|
126 |
-
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
127 |
-
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
128 |
-
padding: 1px 12px;
|
129 |
-
}
|
130 |
-
.irp-box-success {
|
131 |
-
background: #fff;
|
132 |
-
border-left: 4px solid #7ad03a;
|
133 |
-
margin: 5px 0 15px;
|
134 |
-
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
135 |
-
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
136 |
-
padding: 1px 12px;
|
137 |
-
}
|
138 |
-
.irp-box-info {
|
139 |
-
background: #fff;
|
140 |
-
border-left: 4px solid #00a0d2;
|
141 |
-
margin: 5px 0 15px;
|
142 |
-
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
143 |
-
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
144 |
-
padding: 1px 12px;
|
145 |
-
}
|
146 |
-
|
147 |
-
.select2-chosen .irpColorSelectItem {
|
148 |
-
padding-bottom:0px!important;
|
149 |
-
padding-top:0px!important;
|
150 |
-
}
|
151 |
-
.irpColorSelectItem {
|
152 |
-
padding: 5px;
|
153 |
-
width: 100%;
|
154 |
-
}
|
155 |
-
|
156 |
-
#irp-sidebar li {
|
157 |
-
margin: 0px!important;
|
158 |
-
margin-left: 20px!important;;
|
159 |
-
}
|
160 |
-
.irp-plugin-widget {
|
161 |
-
padding: 10px;
|
162 |
-
border: 2px dashed red;
|
163 |
}
|
1 |
+
._irp {
|
2 |
+
background-color: #efc439;
|
3 |
+
border-radius: 2px;
|
4 |
+
color: #fff;
|
5 |
+
display: inline-block;
|
6 |
+
font-size: 12px;
|
7 |
+
padding: 0 2px;
|
8 |
+
line-height: 14px;
|
9 |
+
vertical-align: baseline;
|
10 |
+
}
|
11 |
+
|
12 |
+
.irp-tag {
|
13 |
+
display: inline-block;
|
14 |
+
line-height: 13px;
|
15 |
+
padding: 0 3px;
|
16 |
+
color: white;
|
17 |
+
font-size: 10px;
|
18 |
+
font-weight: normal;
|
19 |
+
width:25px;
|
20 |
+
margin-top:3px;
|
21 |
+
margin-right:5px;
|
22 |
+
text-align:center;
|
23 |
+
-webkit-border-radius: 2px;
|
24 |
+
border-radius: 2px;
|
25 |
+
vertical-align: baseline;
|
26 |
+
}
|
27 |
+
.irp-tag-free {
|
28 |
+
/*background-color: #edb802;*/
|
29 |
+
background-color: #16a765;
|
30 |
+
}
|
31 |
+
.irp-tag-premium {
|
32 |
+
/*background-color: #edb802;*/
|
33 |
+
background-color: #4986e7;
|
34 |
+
opacity: 0.7;
|
35 |
+
filter: alpha(opacity=70);
|
36 |
+
}
|
37 |
+
.irp-tag-premium a {
|
38 |
+
color:white;
|
39 |
+
text-decoration:none;
|
40 |
+
}
|
41 |
+
.irp-button {
|
42 |
+
margin-right:5px!important;
|
43 |
+
}
|
44 |
+
|
45 |
+
.irp-textarea {
|
46 |
+
font-family:"Courier New", Courier, mono;
|
47 |
+
font-size:12px;
|
48 |
+
color:#555;
|
49 |
+
background-color:#f8f8f8;
|
50 |
+
width:550px;
|
51 |
+
height:350px;
|
52 |
+
}
|
53 |
+
|
54 |
+
.irp-form {
|
55 |
+
float:left;
|
56 |
+
padding:5px;
|
57 |
+
}
|
58 |
+
.irp-form input, .irp-form label {
|
59 |
+
float:left;
|
60 |
+
}
|
61 |
+
.irp-text {
|
62 |
+
width: 400px;
|
63 |
+
}
|
64 |
+
.irp-label {
|
65 |
+
width: 200px;
|
66 |
+
margin: 0px;
|
67 |
+
background-color: transparent;
|
68 |
+
}
|
69 |
+
.irp-label-disabled {
|
70 |
+
/*color:#A8A8A8;*/
|
71 |
+
opacity: 0.7;
|
72 |
+
filter: alpha(opacity=70);
|
73 |
+
}
|
74 |
+
.irp-checkbox {
|
75 |
+
margin:0px;
|
76 |
+
}
|
77 |
+
.irp-checkbox:disabled {
|
78 |
+
background-color: #f8f8f8;
|
79 |
+
}
|
80 |
+
.irp-select {
|
81 |
+
|
82 |
+
}
|
83 |
+
.irp-form-newline {
|
84 |
+
clear:both;
|
85 |
+
margin-bottom:5px;
|
86 |
+
}
|
87 |
+
|
88 |
+
img.irp-help {
|
89 |
+
cursor: pointer;
|
90 |
+
float: left;
|
91 |
+
margin-right: 10px;
|
92 |
+
}
|
93 |
+
|
94 |
+
.irp-qtip {
|
95 |
+
font-size: 14px !important;
|
96 |
+
line-height: 18px !important;
|
97 |
+
}
|
98 |
+
|
99 |
+
i.mce-i-icon {
|
100 |
+
font: 400 20px/1 dashicons;
|
101 |
+
padding: 0;
|
102 |
+
vertical-align: top;
|
103 |
+
speak: none;
|
104 |
+
-webkit-font-smoothing: antialiased;
|
105 |
+
-moz-osx-font-smoothing: grayscale;
|
106 |
+
margin-left: -2px;
|
107 |
+
padding-right: 2px
|
108 |
+
}
|
109 |
+
|
110 |
+
i.irp-own-icon {
|
111 |
+
background-image: url('../images/repeat.png');
|
112 |
+
}
|
113 |
+
|
114 |
+
.irp-box-error {
|
115 |
+
background: #fff;
|
116 |
+
border-left: 4px solid #dd3d36;
|
117 |
+
margin: 5px 0 15px;
|
118 |
+
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
119 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
120 |
+
padding: 1px 12px;
|
121 |
+
}
|
122 |
+
.irp-box-warning {
|
123 |
+
background: #fff;
|
124 |
+
border-left: 4px solid #ffba00;
|
125 |
+
margin: 5px 0 15px;
|
126 |
+
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
127 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
128 |
+
padding: 1px 12px;
|
129 |
+
}
|
130 |
+
.irp-box-success {
|
131 |
+
background: #fff;
|
132 |
+
border-left: 4px solid #7ad03a;
|
133 |
+
margin: 5px 0 15px;
|
134 |
+
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
135 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
136 |
+
padding: 1px 12px;
|
137 |
+
}
|
138 |
+
.irp-box-info {
|
139 |
+
background: #fff;
|
140 |
+
border-left: 4px solid #00a0d2;
|
141 |
+
margin: 5px 0 15px;
|
142 |
+
-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
143 |
+
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
|
144 |
+
padding: 1px 12px;
|
145 |
+
}
|
146 |
+
|
147 |
+
.select2-chosen .irpColorSelectItem {
|
148 |
+
padding-bottom:0px!important;
|
149 |
+
padding-top:0px!important;
|
150 |
+
}
|
151 |
+
.irpColorSelectItem {
|
152 |
+
padding: 5px;
|
153 |
+
width: 100%;
|
154 |
+
}
|
155 |
+
|
156 |
+
#irp-sidebar li {
|
157 |
+
margin: 0px!important;
|
158 |
+
margin-left: 20px!important;;
|
159 |
+
}
|
160 |
+
.irp-plugin-widget {
|
161 |
+
padding: 10px;
|
162 |
+
border: 2px dashed red;
|
163 |
}
|
assets/js/button-mce.js
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
(function() {
|
2 |
-
tinymce.PluginManager.add('irp_mce_button', function(editor, url) {
|
3 |
-
editor.addButton('irp_mce_button', {
|
4 |
-
title: 'Inline Related Posts PRO'
|
5 |
-
, type: 'menubutton'
|
6 |
-
, icon: 'icon irp-own-icon'
|
7 |
-
, image : url + '/../images/repeat.png'
|
8 |
-
, menu: [
|
9 |
-
{
|
10 |
-
text: 'Inline Related Post'
|
11 |
-
, onclick: function() {
|
12 |
-
var code='[irp]';
|
13 |
-
editor.insertContent(code);
|
14 |
-
}
|
15 |
-
}
|
16 |
-
, {
|
17 |
-
text: 'Custom Related Post'
|
18 |
-
, onclick: function() {
|
19 |
-
editor.windowManager.open({
|
20 |
-
title: 'Choose a post'
|
21 |
-
, width: 350
|
22 |
-
, height: 250
|
23 |
-
, file: ajaxurl+'?action=do_action&irp_action=ui_button_editor&irp_post_type=post'
|
24 |
-
, inline: 1
|
25 |
-
, resizable: false
|
26 |
-
});
|
27 |
-
}
|
28 |
-
}
|
29 |
-
, {
|
30 |
-
text: 'Custom Related Page'
|
31 |
-
, onclick: function() {
|
32 |
-
editor.windowManager.open({
|
33 |
-
title: 'Choose a page'
|
34 |
-
, width: 350
|
35 |
-
, height: 250
|
36 |
-
, file: ajaxurl+'?action=do_action&irp_action=ui_button_editor&irp_post_type=page'
|
37 |
-
, inline: 1
|
38 |
-
, resizable: false
|
39 |
-
});
|
40 |
-
}
|
41 |
-
}
|
42 |
-
]
|
43 |
-
});
|
44 |
-
});
|
45 |
})();
|
1 |
+
(function() {
|
2 |
+
tinymce.PluginManager.add('irp_mce_button', function(editor, url) {
|
3 |
+
editor.addButton('irp_mce_button', {
|
4 |
+
title: 'Inline Related Posts PRO'
|
5 |
+
, type: 'menubutton'
|
6 |
+
, icon: 'icon irp-own-icon'
|
7 |
+
, image : url + '/../images/repeat.png'
|
8 |
+
, menu: [
|
9 |
+
{
|
10 |
+
text: 'Inline Related Post'
|
11 |
+
, onclick: function() {
|
12 |
+
var code='[irp]';
|
13 |
+
editor.insertContent(code);
|
14 |
+
}
|
15 |
+
}
|
16 |
+
, {
|
17 |
+
text: 'Custom Related Post'
|
18 |
+
, onclick: function() {
|
19 |
+
editor.windowManager.open({
|
20 |
+
title: 'Choose a post'
|
21 |
+
, width: 350
|
22 |
+
, height: 250
|
23 |
+
, file: ajaxurl+'?action=do_action&irp_action=ui_button_editor&irp_post_type=post'
|
24 |
+
, inline: 1
|
25 |
+
, resizable: false
|
26 |
+
});
|
27 |
+
}
|
28 |
+
}
|
29 |
+
, {
|
30 |
+
text: 'Custom Related Page'
|
31 |
+
, onclick: function() {
|
32 |
+
editor.windowManager.open({
|
33 |
+
title: 'Choose a page'
|
34 |
+
, width: 350
|
35 |
+
, height: 250
|
36 |
+
, file: ajaxurl+'?action=do_action&irp_action=ui_button_editor&irp_post_type=page'
|
37 |
+
, inline: 1
|
38 |
+
, resizable: false
|
39 |
+
});
|
40 |
+
}
|
41 |
+
}
|
42 |
+
]
|
43 |
+
});
|
44 |
+
});
|
45 |
})();
|
includes/actions.php
CHANGED
@@ -1,31 +1,14 @@
|
|
1 |
<?php
|
2 |
-
/**
|
3 |
-
* Front-end Actions
|
4 |
-
*
|
5 |
-
* @package EDD
|
6 |
-
* @subpackage Functions
|
7 |
-
* @copyright Copyright (c) 2015, Pippin Williamson
|
8 |
-
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
9 |
-
* @since 1.0.8.1
|
10 |
-
*/
|
11 |
-
|
12 |
// Exit if accessed directly
|
13 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
14 |
|
15 |
-
/**
|
16 |
-
* Hooks EDD actions, when present in the $_GET superglobal. Every edd_action
|
17 |
-
* present in $_GET is called using WordPress's do_action function. These
|
18 |
-
* functions are called on init.
|
19 |
-
*
|
20 |
-
* @since 1.0
|
21 |
-
* @return void
|
22 |
-
*/
|
23 |
add_action('init', 'irp_do_action');
|
24 |
add_action('wp_ajax_do_action', 'irp_do_action');
|
25 |
function irp_do_action() {
|
26 |
global $irp;
|
27 |
|
28 |
$action = $irp->Utils->qs('irp_action');
|
|
|
29 |
switch($action) {
|
30 |
case 'ui_button_editor':
|
31 |
call_irp_ui_button_editor($irp);
|
@@ -47,94 +30,38 @@ function irp_do_action() {
|
|
47 |
}
|
48 |
}
|
49 |
|
50 |
-
function call_irp_ui_button_editor($irp)
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
function call_irp_ui_box_preview($irp)
|
62 |
{
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
//}
|
67 |
-
//else {
|
68 |
-
// Replace this with an actual function call
|
69 |
-
irp_find_and_call_func($irp, 'ui_box_preview');
|
70 |
-
//}
|
71 |
}
|
72 |
|
73 |
function call_irp_manager_trackingOn($irp)
|
74 |
{
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
//}
|
79 |
-
//else {
|
80 |
-
// Replace this with an actual function call
|
81 |
-
irp_find_and_call_func($irp, 'manager_trackingOn');
|
82 |
-
//}
|
83 |
}
|
84 |
|
85 |
function call_irp_manager_trackingOff($irp)
|
86 |
{
|
87 |
-
|
88 |
-
|
89 |
-
// $irp->Log->info('Rejected Non-admin call of irp_do_action().');
|
90 |
-
//}
|
91 |
-
//else {
|
92 |
-
// Replace this with an actual function call
|
93 |
-
irp_find_and_call_func($irp, 'manager_trackingOff');
|
94 |
-
//}
|
95 |
-
}
|
96 |
-
|
97 |
-
// Phase one of removing the irp_do_action
|
98 |
-
function irp_find_and_call_func($irp, $action)
|
99 |
-
{
|
100 |
-
$args=array_merge($_GET, $_POST, $_COOKIE, $_SERVER);
|
101 |
-
$name='irp_'.$action;
|
102 |
-
|
103 |
-
if(has_action($name)) {
|
104 |
-
$irp->Log->debug('EXECUTING ACTION=%s', $name);
|
105 |
-
do_action($name, $args);
|
106 |
-
} elseif(function_exists($name)) {
|
107 |
-
$irp->Log->debug('EXECUTING FUNCTION=%s DATA=%s', $name, $args);
|
108 |
-
call_user_func($name, $args);
|
109 |
-
} elseif(strpos($action, '_')!==FALSE) {
|
110 |
-
$pos=strpos($action, '_');
|
111 |
-
$what=substr($action, 0, $pos);
|
112 |
-
$function=substr($action, $pos+1);
|
113 |
-
|
114 |
-
$class=NULL;
|
115 |
-
switch (strtolower($what)) {
|
116 |
-
case 'cron':
|
117 |
-
$class=$irp->Cron;
|
118 |
-
break;
|
119 |
-
case 'tracking':
|
120 |
-
$class=$irp->Tracking;
|
121 |
-
break;
|
122 |
-
case 'properties':
|
123 |
-
$class=$irp->Options;
|
124 |
-
break;
|
125 |
-
}
|
126 |
-
|
127 |
-
if(!$class) {
|
128 |
-
$irp->Log->fatal('NO CLASS FOR=%s IN ACTION=%s', $what, $action);
|
129 |
-
} elseif(!method_exists ($class, $function)) {
|
130 |
-
$irp->Log->fatal('NO METHOD FOR=%s IN CLASS=%s IN ACTION=%s', $function, $what, $action);
|
131 |
-
} else {
|
132 |
-
$irp->Log->debug('METHOD=%s OF CLASS=%s', $function, $what);
|
133 |
-
call_user_func(array($class, $function), $args);
|
134 |
-
}
|
135 |
-
} else {
|
136 |
-
$irp->Log->fatal('NO FUNCTION FOR==%s', $action);
|
137 |
}
|
138 |
}
|
139 |
-
|
140 |
-
?>
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
// Exit if accessed directly
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
add_action('init', 'irp_do_action');
|
6 |
add_action('wp_ajax_do_action', 'irp_do_action');
|
7 |
function irp_do_action() {
|
8 |
global $irp;
|
9 |
|
10 |
$action = $irp->Utils->qs('irp_action');
|
11 |
+
$irp->Log->info('[actions::irp_do_action] Action: %s', $action);
|
12 |
switch($action) {
|
13 |
case 'ui_button_editor':
|
14 |
call_irp_ui_button_editor($irp);
|
30 |
}
|
31 |
}
|
32 |
|
33 |
+
function call_irp_ui_button_editor($irp)
|
34 |
+
{
|
35 |
+
if (current_user_can('edit_posts')
|
36 |
+
|| current_user_can('edit_pages')
|
37 |
+
|| current_user_can('edit_published_posts')
|
38 |
+
|| current_user_can('edit_published_pages')
|
39 |
+
|| current_user_can('edit_others_posts')
|
40 |
+
|| current_user_can('edit_others_pages')
|
41 |
+
|| current_user_can('edit_private_posts')
|
42 |
+
|| current_user_can('edit_private_pages')
|
43 |
+
) {
|
44 |
+
irp_ui_button_editor();
|
45 |
+
}
|
46 |
}
|
47 |
|
48 |
function call_irp_ui_box_preview($irp)
|
49 |
{
|
50 |
+
if (current_user_can('activate_plugins')) {
|
51 |
+
irp_ui_box_preview();
|
52 |
+
}
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
function call_irp_manager_trackingOn($irp)
|
56 |
{
|
57 |
+
if (current_user_can('activate_plugins')) {
|
58 |
+
$irp->Tracking->enableTracking();
|
59 |
+
}
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
function call_irp_manager_trackingOff($irp)
|
63 |
{
|
64 |
+
if (current_user_can('activate_plugins')) {
|
65 |
+
$irp->Tracking->disableTracking();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
}
|
|
|
|
includes/admin/button-mce.php
CHANGED
@@ -1,134 +1,134 @@
|
|
1 |
-
<?php
|
2 |
-
add_action('admin_head', 'irp_add_mce_button');
|
3 |
-
function irp_add_mce_button() {
|
4 |
-
global $typenow;
|
5 |
-
|
6 |
-
if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
if(!in_array($typenow, array('post', 'page'))) {
|
11 |
-
return;
|
12 |
-
}
|
13 |
-
if (get_user_option('rich_editing') == 'true') {
|
14 |
-
add_filter("mce_external_plugins", "irp_add_mce_plugin");
|
15 |
-
add_filter('mce_buttons', 'irp_register_mce_button');
|
16 |
-
}
|
17 |
-
}
|
18 |
-
|
19 |
-
function irp_add_mce_plugin($plugin_array) {
|
20 |
-
$plugin_array['irp_mce_button']=IRP_PLUGIN_ASSETS.'js/button-mce.js';
|
21 |
-
return $plugin_array;
|
22 |
-
}
|
23 |
-
function irp_register_mce_button($buttons) {
|
24 |
-
array_push($buttons, "irp_mce_button");
|
25 |
-
return $buttons;
|
26 |
-
}
|
27 |
-
|
28 |
-
function irp_ui_button_editor() {
|
29 |
-
global $irp;
|
30 |
-
|
31 |
-
$irp->Utils->printScriptCss();
|
32 |
-
$irp->Form->prefix='Editor';
|
33 |
-
$irp->Form->labels=FALSE;
|
34 |
-
|
35 |
-
$args=array('class'=>'wp-admin wp-core-ui admin-bar'
|
36 |
-
, 'style'=>'padding:10px; margin-left:auto; margin-right:auto;');
|
37 |
-
$irp->Form->formStarts('post', '', $args);
|
38 |
-
{
|
39 |
-
?>
|
40 |
-
<p style="text-align:center;"><?php $irp->Lang->P('EditorSubtitle') ?></p>
|
41 |
-
<?php
|
42 |
-
$args = array('post_type' => 'post', 'all' => FALSE);
|
43 |
-
$options = $irp->Utils->query(IRP_QUERY_POSTS_OF_TYPE, $args);
|
44 |
-
$irp->Form->text('irpPostId', '', FALSE);
|
45 |
-
?>
|
46 |
-
<div style="clear:both;"></div>
|
47 |
-
<p style="text-align:right;">
|
48 |
-
<input type="button" id="btnInsert" class="button button-primary irp-button irp-submit" value="<?php $irp->Lang->P('Insert')?>"/>
|
49 |
-
<input type="button" id="btnClose" class="button irp-button" value="<?php $irp->Lang->P('Cancel')?>"/>
|
50 |
-
</p>
|
51 |
-
|
52 |
-
<script>
|
53 |
-
jQuery(function () {
|
54 |
-
jQuery('#btnInsert').click(function () {
|
55 |
-
var editor = top.tinymce.activeEditor;
|
56 |
-
var postId = parseInt(jQuery('#irpPostId').val());
|
57 |
-
var name=jQuery('#select2-chosen-1').text().replace('"', ' ');
|
58 |
-
if(name) {
|
59 |
-
name='name="'+name+'"';
|
60 |
-
}
|
61 |
-
if (postId > 0) {
|
62 |
-
var code = '[irp posts="' + postId + '" '+name+']';
|
63 |
-
editor.insertContent(code);
|
64 |
-
}
|
65 |
-
editor.windowManager.close();
|
66 |
-
});
|
67 |
-
jQuery('#btnClose').click(function () {
|
68 |
-
var editor = top.tinymce.activeEditor;
|
69 |
-
editor.windowManager.close();
|
70 |
-
});
|
71 |
-
/*
|
72 |
-
jQuery("#irpPostId").select2({
|
73 |
-
placeholder: "Type here..."
|
74 |
-
, theme: "classic"
|
75 |
-
, width: '100%'
|
76 |
-
//, maximumSelectionLength: 3
|
77 |
-
});
|
78 |
-
*/
|
79 |
-
var ajaxurl = 'admin-ajax.php';
|
80 |
-
jQuery('#irpPostId').select2({
|
81 |
-
|
82 |
-
ajax: {
|
83 |
-
|
84 |
-
url: ajaxurl,
|
85 |
-
dataType: 'json',
|
86 |
-
|
87 |
-
delay: 250,
|
88 |
-
|
89 |
-
data: function (term, page) {
|
90 |
-
|
91 |
-
return {
|
92 |
-
action: 'irp_list_posts',
|
93 |
-
irp_post_type: '<?php echo esc_attr($_REQUEST['irp_post_type']);?>',
|
94 |
-
q: term,
|
95 |
-
page: page
|
96 |
-
};
|
97 |
-
|
98 |
-
},
|
99 |
-
|
100 |
-
results: function (data, page) {
|
101 |
-
|
102 |
-
page = page || 1;
|
103 |
-
|
104 |
-
return {
|
105 |
-
results: data.items,
|
106 |
-
more: false,
|
107 |
-
};
|
108 |
-
|
109 |
-
},
|
110 |
-
|
111 |
-
cache: true
|
112 |
-
|
113 |
-
},
|
114 |
-
|
115 |
-
placeholder: "Type here to search an item...",
|
116 |
-
minimumInputLength: 3,
|
117 |
-
width: '100%'
|
118 |
-
|
119 |
-
});
|
120 |
-
});
|
121 |
-
</script>
|
122 |
-
|
123 |
-
<style>
|
124 |
-
.select2-results {
|
125 |
-
max-height: 100px;
|
126 |
-
overflow-y: auto;
|
127 |
-
}
|
128 |
-
</style>
|
129 |
-
<?php
|
130 |
-
}
|
131 |
-
$irp->Form->formEnds();
|
132 |
-
exit;
|
133 |
-
}
|
134 |
-
|
1 |
+
<?php
|
2 |
+
add_action('admin_head', 'irp_add_mce_button');
|
3 |
+
function irp_add_mce_button() {
|
4 |
+
global $typenow;
|
5 |
+
|
6 |
+
if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
if(!in_array($typenow, array('post', 'page'))) {
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
if (get_user_option('rich_editing') == 'true') {
|
14 |
+
add_filter("mce_external_plugins", "irp_add_mce_plugin");
|
15 |
+
add_filter('mce_buttons', 'irp_register_mce_button');
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
function irp_add_mce_plugin($plugin_array) {
|
20 |
+
$plugin_array['irp_mce_button']=IRP_PLUGIN_ASSETS.'js/button-mce.js';
|
21 |
+
return $plugin_array;
|
22 |
+
}
|
23 |
+
function irp_register_mce_button($buttons) {
|
24 |
+
array_push($buttons, "irp_mce_button");
|
25 |
+
return $buttons;
|
26 |
+
}
|
27 |
+
|
28 |
+
function irp_ui_button_editor() {
|
29 |
+
global $irp;
|
30 |
+
|
31 |
+
$irp->Utils->printScriptCss();
|
32 |
+
$irp->Form->prefix='Editor';
|
33 |
+
$irp->Form->labels=FALSE;
|
34 |
+
|
35 |
+
$args=array('class'=>'wp-admin wp-core-ui admin-bar'
|
36 |
+
, 'style'=>'padding:10px; margin-left:auto; margin-right:auto;');
|
37 |
+
$irp->Form->formStarts('post', '', $args);
|
38 |
+
{
|
39 |
+
?>
|
40 |
+
<p style="text-align:center;"><?php $irp->Lang->P('EditorSubtitle') ?></p>
|
41 |
+
<?php
|
42 |
+
$args = array('post_type' => 'post', 'all' => FALSE);
|
43 |
+
$options = $irp->Utils->query(IRP_QUERY_POSTS_OF_TYPE, $args);
|
44 |
+
$irp->Form->text('irpPostId', '', FALSE);
|
45 |
+
?>
|
46 |
+
<div style="clear:both;"></div>
|
47 |
+
<p style="text-align:right;">
|
48 |
+
<input type="button" id="btnInsert" class="button button-primary irp-button irp-submit" value="<?php $irp->Lang->P('Insert')?>"/>
|
49 |
+
<input type="button" id="btnClose" class="button irp-button" value="<?php $irp->Lang->P('Cancel')?>"/>
|
50 |
+
</p>
|
51 |
+
|
52 |
+
<script>
|
53 |
+
jQuery(function () {
|
54 |
+
jQuery('#btnInsert').click(function () {
|
55 |
+
var editor = top.tinymce.activeEditor;
|
56 |
+
var postId = parseInt(jQuery('#irpPostId').val());
|
57 |
+
var name=jQuery('#select2-chosen-1').text().replace('"', ' ');
|
58 |
+
if(name) {
|
59 |
+
name='name="'+name+'"';
|
60 |
+
}
|
61 |
+
if (postId > 0) {
|
62 |
+
var code = '[irp posts="' + postId + '" '+name+']';
|
63 |
+
editor.insertContent(code);
|
64 |
+
}
|
65 |
+
editor.windowManager.close();
|
66 |
+
});
|
67 |
+
jQuery('#btnClose').click(function () {
|
68 |
+
var editor = top.tinymce.activeEditor;
|
69 |
+
editor.windowManager.close();
|
70 |
+
});
|
71 |
+
/*
|
72 |
+
jQuery("#irpPostId").select2({
|
73 |
+
placeholder: "Type here..."
|
74 |
+
, theme: "classic"
|
75 |
+
, width: '100%'
|
76 |
+
//, maximumSelectionLength: 3
|
77 |
+
});
|
78 |
+
*/
|
79 |
+
var ajaxurl = 'admin-ajax.php';
|
80 |
+
jQuery('#irpPostId').select2({
|
81 |
+
|
82 |
+
ajax: {
|
83 |
+
|
84 |
+
url: ajaxurl,
|
85 |
+
dataType: 'json',
|
86 |
+
|
87 |
+
delay: 250,
|
88 |
+
|
89 |
+
data: function (term, page) {
|
90 |
+
|
91 |
+
return {
|
92 |
+
action: 'irp_list_posts',
|
93 |
+
irp_post_type: '<?php echo esc_attr($_REQUEST['irp_post_type']);?>',
|
94 |
+
q: term,
|
95 |
+
page: page
|
96 |
+
};
|
97 |
+
|
98 |
+
},
|
99 |
+
|
100 |
+
results: function (data, page) {
|
101 |
+
|
102 |
+
page = page || 1;
|
103 |
+
|
104 |
+
return {
|
105 |
+
results: data.items,
|
106 |
+
more: false,
|
107 |
+
};
|
108 |
+
|
109 |
+
},
|
110 |
+
|
111 |
+
cache: true
|
112 |
+
|
113 |
+
},
|
114 |
+
|
115 |
+
placeholder: "Type here to search an item...",
|
116 |
+
minimumInputLength: 3,
|
117 |
+
width: '100%'
|
118 |
+
|
119 |
+
});
|
120 |
+
});
|
121 |
+
</script>
|
122 |
+
|
123 |
+
<style>
|
124 |
+
.select2-results {
|
125 |
+
max-height: 100px;
|
126 |
+
overflow-y: auto;
|
127 |
+
}
|
128 |
+
</style>
|
129 |
+
<?php
|
130 |
+
}
|
131 |
+
$irp->Form->formEnds();
|
132 |
+
exit;
|
133 |
+
}
|
134 |
+
|
includes/admin/settings.php
CHANGED
@@ -1,437 +1,437 @@
|
|
1 |
-
<?php
|
2 |
-
function irp_ui_tracking($override=FALSE) {
|
3 |
-
global $irp;
|
4 |
-
|
5 |
-
$track=$irp->Utils->qs('track', '');
|
6 |
-
if($track!='') {
|
7 |
-
$track=intval($track);
|
8 |
-
$irp->Options->setTrackingEnable($track);
|
9 |
-
$irp->Tracking->sendTracking(TRUE);
|
10 |
-
}
|
11 |
-
|
12 |
-
$uri=IRP_TAB_SETTINGS_URI.'&track=';
|
13 |
-
if($irp->Options->isTrackingEnable()) {
|
14 |
-
if($override) {
|
15 |
-
$uri.='0';
|
16 |
-
$irp->Options->pushSuccessMessage('EnableAllowTrackingNotice', $uri);
|
17 |
-
}
|
18 |
-
} else {
|
19 |
-
$uri.='1';
|
20 |
-
$irp->Options->pushWarningMessage('DisableAllowTrackingNotice', $uri);
|
21 |
-
}
|
22 |
-
$irp->Options->writeMessages();
|
23 |
-
}
|
24 |
-
function irp_io_first_time() {
|
25 |
-
global $irp;
|
26 |
-
if($irp->Options->isShowActivationNotice()) {
|
27 |
-
$irp->Options->pushSuccessMessage('FirstTimeActivation');
|
28 |
-
$irp->Options->writeMessages();
|
29 |
-
$irp->Options->setShowActivationNotice(FALSE);
|
30 |
-
}
|
31 |
-
}
|
32 |
-
function irp_ui_box_preview() {
|
33 |
-
global $irp;
|
34 |
-
|
35 |
-
$count=$irp->Options->getRewritePostsInBoxCount();
|
36 |
-
$count=$irp->Utils->iqs('rewritePostsInBoxCount', $count);
|
37 |
-
$args=array(
|
38 |
-
'orderby'=>'rand'
|
39 |
-
, 'numberposts'=>$count
|
40 |
-
);
|
41 |
-
|
42 |
-
$days=$irp->Options->getRewritePostsDays();
|
43 |
-
$days=$irp->Utils->iqs('rewritePostsDays', $days);
|
44 |
-
if($days>0) {
|
45 |
-
$args['date_query'] = array(
|
46 |
-
'column' => 'post_date'
|
47 |
-
, 'after' => '- '.$days.' days'
|
48 |
-
);
|
49 |
-
}
|
50 |
-
$posts=get_posts($args);
|
51 |
-
$ids=array();
|
52 |
-
foreach($posts as $p) {
|
53 |
-
$ids[]=$p->ID;
|
54 |
-
}
|
55 |
-
if(count($ids)==0) {
|
56 |
-
echo "<b>No posts available. Check settings and try again</b>";
|
57 |
-
die();
|
58 |
-
}
|
59 |
-
|
60 |
-
$defaults=$irp->Options->getTemplateStyle();
|
61 |
-
$args=$irp->Utils->aqs('template-', $defaults);
|
62 |
-
$args['includeCss']=TRUE;
|
63 |
-
$args['preview']=TRUE;
|
64 |
-
$box=irp_ui_get_box($ids, $args);
|
65 |
-
echo $box;
|
66 |
-
die();
|
67 |
-
}
|
68 |
-
function irp_ui_settings() {
|
69 |
-
global $irp;
|
70 |
-
irp_ui_tracking(FALSE);
|
71 |
-
|
72 |
-
?>
|
73 |
-
<script>
|
74 |
-
var IRP_preview=true;
|
75 |
-
var IRP_labelColor='';
|
76 |
-
var IRP_defaults={};
|
77 |
-
<?php
|
78 |
-
$defaults=$irp->HtmlTemplate->getDefaults();
|
79 |
-
foreach($defaults as $k=>$v) {
|
80 |
-
$buffer='';
|
81 |
-
foreach($v as $kk=>$vv) {
|
82 |
-
if($buffer!='') {
|
83 |
-
$buffer.=', ';
|
84 |
-
}
|
85 |
-
|
86 |
-
if(stripos($kk, 'label')!==FALSE) {
|
87 |
-
$vv=$irp->Lang->L('Settings.Color.'.$vv);
|
88 |
-
} elseif(stripos($kk, 'color')!==FALSE) {
|
89 |
-
$vv=$irp->Options->getColor($vv);
|
90 |
-
}
|
91 |
-
|
92 |
-
$buffer.=$kk.': "'.$vv.'"';
|
93 |
-
}
|
94 |
-
?>
|
95 |
-
IRP_defaults["<?php echo $k?>"]={<?php echo $buffer?>};
|
96 |
-
<?php }
|
97 |
-
?>
|
98 |
-
|
99 |
-
function IRP_changeTheme() {
|
100 |
-
IRP_preview=false;
|
101 |
-
t=IRP_val('template-template');
|
102 |
-
t=IRP_defaults[t];
|
103 |
-
isProTheme=false;
|
104 |
-
console.log(t);
|
105 |
-
jQuery.each(t, function(k,v) {
|
106 |
-
if(IRP_stripos(k, 'color')!==false) {
|
107 |
-
var $k=jQuery('[name=template-'+k+']');
|
108 |
-
$k.select2("val", v);
|
109 |
-
} else if(k=='proTheme') {
|
110 |
-
isProTheme=(v+''.toLowerCase()=='true');
|
111 |
-
}
|
112 |
-
});
|
113 |
-
|
114 |
-
jQuery("[name*='Color']").each(function(i,v) {
|
115 |
-
var $cbo=jQuery(this);
|
116 |
-
$cbo.prop("disabled", isProTheme);
|
117 |
-
$cbo.select2("enable", !isProTheme);
|
118 |
-
});
|
119 |
-
jQuery("[id*='ColorLabel']").each(function(i,v) {
|
120 |
-
var $lbl=jQuery(this);
|
121 |
-
if(IRP_labelColor!='') {
|
122 |
-
IRP_labelColor=$lbl.css('color');
|
123 |
-
}
|
124 |
-
if(isProTheme) {
|
125 |
-
$lbl.css('color', '#ccc');
|
126 |
-
} else {
|
127 |
-
$lbl.css('color', IRP_labelColor);
|
128 |
-
}
|
129 |
-
});
|
130 |
-
jQuery('.irp-submit').prop("disabled", isProTheme);
|
131 |
-
IRP_preview=true;
|
132 |
-
}
|
133 |
-
function IRP_changeRelatedBox() {
|
134 |
-
if(!IRP_preview) {
|
135 |
-
return;
|
136 |
-
}
|
137 |
-
|
138 |
-
var t=IRP_val('template-template');
|
139 |
-
t=IRP_defaults[t].borderColorLabel;
|
140 |
-
jQuery('#template-borderColorLabel').text(t);
|
141 |
-
|
142 |
-
data=IRP_aval('template-');
|
143 |
-
data=jQuery.extend({
|
144 |
-
'action': 'do_action'
|
145 |
-
, 'irp_action': 'ui_box_preview'
|
146 |
-
, 'rewritePostsDays': IRP_val('irpRewritePostsDays')
|
147 |
-
}, data);
|
148 |
-
//console.log(data);
|
149 |
-
|
150 |
-
var request=jQuery.ajax({
|
151 |
-
url: ajaxurl
|
152 |
-
, method: "POST"
|
153 |
-
, data: data
|
154 |
-
, dataType: "html"
|
155 |
-
});
|
156 |
-
|
157 |
-
request.done(function(html) {
|
158 |
-
jQuery("#relatedBoxExample").html(html);
|
159 |
-
});
|
160 |
-
}
|
161 |
-
|
162 |
-
jQuery(function() {
|
163 |
-
IRP_preview=false;
|
164 |
-
var array=['irpRewritePostsDays', 'irpRewritePostsInBoxCount', 'irpRewriteBoxesCount'];
|
165 |
-
for(i=0; i<array.length; i++) {
|
166 |
-
if(jQuery('[name='+array[i]+']').length>0) {
|
167 |
-
jQuery('[name='+array[i]+']').change(function() {
|
168 |
-
IRP_changeRelatedBox();
|
169 |
-
});
|
170 |
-
}
|
171 |
-
}
|
172 |
-
jQuery("[name^='template-']").change(function() {
|
173 |
-
if(!IRP_preview) {
|
174 |
-
return;
|
175 |
-
}
|
176 |
-
|
177 |
-
var $self=jQuery(this);
|
178 |
-
var name=$self.attr('name');
|
179 |
-
if(name=='template-template') {
|
180 |
-
IRP_changeTheme();
|
181 |
-
}
|
182 |
-
IRP_changeRelatedBox();
|
183 |
-
});
|
184 |
-
//IRP_changeTheme();
|
185 |
-
IRP_preview=true;
|
186 |
-
IRP_changeRelatedBox();
|
187 |
-
});
|
188 |
-
</script>
|
189 |
-
<?php
|
190 |
-
|
191 |
-
$irp->Form->prefix='Settings';
|
192 |
-
$irp->Form->helps = FALSE;
|
193 |
-
$irp->Form->formStarts();
|
194 |
-
|
195 |
-
if($irp->Check->nonce('irp_settings')) {
|
196 |
-
|
197 |
-
$irp->Options->resetMaxExecutionTime();
|
198 |
-
$irp->Options->setActive($irp->Utils->iqs('irpActive'));
|
199 |
-
|
200 |
-
$defaults=array(
|
201 |
-
'hasShadow'=>0
|
202 |
-
, 'hasPoweredBy'=>0
|
203 |
-
);
|
204 |
-
$template=$irp->Utils->aqs('template-', $defaults);
|
205 |
-
$irp->Options->setTemplateStyle($template);
|
206 |
-
|
207 |
-
$irp->Options->setMarginTop($irp->Utils->qs('marginTop', '0em'));
|
208 |
-
$irp->Options->setMarginBottom($irp->Utils->qs('marginBottom', '1em'));
|
209 |
-
$irp->Options->setRewriteActive($irp->Utils->iqs('irpRewriteActive'));
|
210 |
-
$irp->Options->setRewriteBoxesCount($irp->Utils->iqs('irpRewriteBoxesCount', 1));
|
211 |
-
//$irp->Options->setRewritePostsInBoxCount($irp->Utils->iqs('irpRewritePostsInBoxCount', 1));
|
212 |
-
$irp->Options->setRewritePostsDays($irp->Utils->iqs('irpRewritePostsDays', 0));
|
213 |
-
$irp->Options->setRewriteThreshold($irp->Utils->iqs('irpRewriteThreshold', 300));
|
214 |
-
$irp->Options->setRewriteAtEnd($irp->Utils->iqs('irpRewriteAtEnd'));
|
215 |
-
|
216 |
-
$irp->Options->setEngineSearch($irp->Utils->iqs('irpEngineSearch', IRP_ENGINE_SEARCH_CATEGORIES_TAGS));
|
217 |
-
|
218 |
-
$options = $irp->Options->getRewritePostTypes();
|
219 |
-
foreach ($options as $k => $template) {
|
220 |
-
$template = intval($irp->Utils->qs('irpRewritePostType_' . $k, 0));
|
221 |
-
$options[$k] = $template;
|
222 |
-
}
|
223 |
-
$irp->Options->setRewritePostTypes($options);
|
224 |
-
|
225 |
-
$options = $irp->Options->getMetaboxPostTypes();
|
226 |
-
foreach ($options as $k => $template) {
|
227 |
-
$template = intval($irp->Utils->qs('metabox_' . $k, 0));
|
228 |
-
$options[$k] = $template;
|
229 |
-
}
|
230 |
-
$irp->Options->setMetaboxPostTypes($options);
|
231 |
-
}
|
232 |
-
|
233 |
-
$c=wp_count_posts()->publish;
|
234 |
-
$t=$irp->Options->getMaxExecutionTime();
|
235 |
-
if($t>0) {?>
|
236 |
-
<p style="width:auto; font-style: italic;"><?php $irp->Lang->P('PreviewSectionMaxTime', $t, $c)?></p>
|
237 |
-
<?php }
|
238 |
-
|
239 |
-
$irp->Form->p('GeneralSection');
|
240 |
-
$args=array(
|
241 |
-
'class'=>'irp-hideShow irp-checkbox'
|
242 |
-
, 'irp-hideIfTrue'=>'false'
|
243 |
-
, 'irp-hideShow'=>'irp-active-box'
|
244 |
-
);
|
245 |
-
$irp->Form->checkbox('irpActive', $irp->Options->isActive(), 1, $args);
|
246 |
-
$args=array(
|
247 |
-
'id'=>'irp-active-box'
|
248 |
-
, 'name'=>'irp-active-box'
|
249 |
-
, 'style'=>'margin-top:10px;'
|
250 |
-
);
|
251 |
-
$irp->Form->divStarts($args);
|
252 |
-
{
|
253 |
-
$template=$irp->Options->getTemplateStyle();
|
254 |
-
$prefix='template-';
|
255 |
-
$irp->Form->text($prefix.'ctaText', $irp->Utils->get($template, 'ctaText'));
|
256 |
-
$options=$irp->HtmlTemplate->getTemplatesNames();
|
257 |
-
$irp->Form->select($prefix.'template', $irp->Utils->get($template, 'template'), $options);
|
258 |
-
$irp->Form->number($prefix.'boxOpacity', $irp->Utils->get($template, 'boxOpacity'));
|
259 |
-
$irp->Form->text('marginTop', $irp->Options->getMarginTop());
|
260 |
-
$irp->Form->text('marginBottom', $irp->Options->getMarginBottom());
|
261 |
-
//$options=array('none', 'capitalize', 'uppercase', 'lowercase');
|
262 |
-
//$irp->Form->select($t.'textTransform', $irp->Utils->get($v, 'textTransform'), $options);
|
263 |
-
$array=array('ctaTextColor', 'postTitleColor', 'boxColor', 'borderColor');
|
264 |
-
$blanks=array('(Default)', '(Default)', '(Trasparent)', '(Without)');
|
265 |
-
for($i=0; $i<count($array); $i++) {
|
266 |
-
$k=$array[$i];
|
267 |
-
$v=$blanks[$i];
|
268 |
-
$colors=$irp->Options->getColors($v);
|
269 |
-
|
270 |
-
$v=$irp->Utils->get($template, $k);
|
271 |
-
$v=$irp->Options->getColor($v);
|
272 |
-
$irp->Form->colorSelect($prefix.$k, $v, $colors);
|
273 |
-
}
|
274 |
-
$array=array('hasShadow', 'hasPoweredBy');
|
275 |
-
foreach($array as $k) {
|
276 |
-
$irp->Form->checkbox($prefix.$k, $irp->Utils->iget($template, $k));
|
277 |
-
}
|
278 |
-
?>
|
279 |
-
<div style="padding-left:10px; padding-right:10px; border:1px dashed #444444">
|
280 |
-
<?php $irp->Form->p('PreviewSection'); ?>
|
281 |
-
<p id="relatedBoxExample" style="width:auto;"></p>
|
282 |
-
</div>
|
283 |
-
<?php
|
284 |
-
$irp->Form->p('RewriteSection');
|
285 |
-
$args=array(
|
286 |
-
'class'=>'irp-hideShow irp-checkbox'
|
287 |
-
, 'irp-hideIfTrue'=>'false'
|
288 |
-
, 'irp-hideShow'=>'irp-rewrite-box'
|
289 |
-
);
|
290 |
-
$irp->Form->checkbox('irpRewriteActive', $irp->Options->isRewriteActive(), 1, $args);
|
291 |
-
$args=array('id'=>'irp-rewrite-box', 'name'=>'irp-rewrite-box', 'style'=>'margin-top:10px;');
|
292 |
-
$irp->Form->divStarts($args);
|
293 |
-
{
|
294 |
-
$options=array();
|
295 |
-
$options[]=array('id'=>1, 'name'=>1);
|
296 |
-
$options[]=array('id'=>2, 'name'=>2);
|
297 |
-
$options[]=array('id'=>3, 'name'=>3);
|
298 |
-
$irp->Form->select('irpRewriteBoxesCount', $irp->Options->getRewriteBoxesCount(), $options);
|
299 |
-
$irp->Form->number('irpRewritePostsDays', $irp->Options->getRewritePostsDays());
|
300 |
-
$irp->Form->number('irpRewriteThreshold', $irp->Options->getRewriteThreshold(), $args);
|
301 |
-
$irp->Form->checkbox('irpRewriteAtEnd', $irp->Options->isRewriteAtEnd());
|
302 |
-
$irp->Form->p('');
|
303 |
-
|
304 |
-
$options=$irp->Options->getRewritePostTypes();
|
305 |
-
$types=$irp->Utils->query(IRP_QUERY_POST_TYPES);
|
306 |
-
foreach($types as $v) {
|
307 |
-
$v=$v['name'];
|
308 |
-
$irp->Form->checkbox('irpRewritePostType_'.$v, $options[$v]);
|
309 |
-
}
|
310 |
-
}
|
311 |
-
$irp->Form->divEnds();
|
312 |
-
|
313 |
-
$irp->Form->p('EngineSection');
|
314 |
-
$irp->Form->divStarts();
|
315 |
-
{
|
316 |
-
$options=array(
|
317 |
-
IRP_ENGINE_SEARCH_CATEGORIES_TAGS
|
318 |
-
, IRP_ENGINE_SEARCH_CATEGORIES
|
319 |
-
, IRP_ENGINE_SEARCH_TAGS
|
320 |
-
);
|
321 |
-
$irp->Form->select('irpEngineSearch', $irp->Options->getEngineSearch(), $options);
|
322 |
-
$options=array();
|
323 |
-
$options[]=array('id'=>'nofollow', 'name'=>'nofollow');
|
324 |
-
$options[]=array('id'=>'dofollow', 'name'=>'dofollow');
|
325 |
-
$k='linkRel';
|
326 |
-
|
327 |
-
$irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
|
328 |
-
$options=array();
|
329 |
-
$options[]=array('id'=>'_blank', 'name'=>'_blank');
|
330 |
-
$options[]=array('id'=>'_self', 'name'=>'_self');
|
331 |
-
$k='linkTarget';
|
332 |
-
$irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
|
333 |
-
}
|
334 |
-
$irp->Form->divEnds();
|
335 |
-
|
336 |
-
$irp->Form->p('MetaboxSection');
|
337 |
-
$irp->Form->divStarts();
|
338 |
-
{
|
339 |
-
$metaboxes=$irp->Options->getMetaboxPostTypes();
|
340 |
-
$types=$irp->Utils->query(IRP_QUERY_POST_TYPES);
|
341 |
-
foreach($types as $template) {
|
342 |
-
$template=$template['name'];
|
343 |
-
$irp->Form->checkbox('metabox_'.$template, $metaboxes[$template]);
|
344 |
-
}
|
345 |
-
}
|
346 |
-
$irp->Form->divEnds();
|
347 |
-
}
|
348 |
-
$irp->Form->divEnds();
|
349 |
-
|
350 |
-
$irp->Form->nonce('irp_settings');
|
351 |
-
irp_notice_pro_features();
|
352 |
-
$args=array('id'=>'boxDontSave', 'style'=>'display:none;');
|
353 |
-
$irp->Form->divStarts($args);
|
354 |
-
{
|
355 |
-
$irp->Form->p('Notice.DontSave');
|
356 |
-
}
|
357 |
-
$irp->Form->divEnds();
|
358 |
-
$irp->Form->submit('Save');
|
359 |
-
|
360 |
-
$irp->Form->formEnds(false);
|
361 |
-
$irp->Form->helps=FALSE;
|
362 |
-
|
363 |
-
$args=array('id'=>'irp-sidebar', 'style'=>'float:left; max-width: 250px; margin-left:10px');
|
364 |
-
$irp->Form->divStarts($args);
|
365 |
-
|
366 |
-
$count=$irp->Tabs->getPluginsCount();
|
367 |
-
$plugins=array();
|
368 |
-
while(count($plugins)<2) {
|
369 |
-
$id=rand(1, $count);
|
370 |
-
if(!isset($plugins[$id])) {
|
371 |
-
$plugins[$id]=$id;
|
372 |
-
}
|
373 |
-
}
|
374 |
-
|
375 |
-
$count=$irp->Tabs->drawContactUsWidget();
|
376 |
-
foreach($plugins as $id) {
|
377 |
-
$count=$irp->Tabs->drawPluginWidget($id);
|
378 |
-
}
|
379 |
-
|
380 |
-
$irp->Form->divEnds();
|
381 |
-
|
382 |
-
}
|
383 |
-
|
384 |
-
function irp_notice_pro_features() {
|
385 |
-
global $irp;
|
386 |
-
|
387 |
-
?>
|
388 |
-
<br/>
|
389 |
-
<div class="message updated below-h2" style="max-width:600px;">
|
390 |
-
<div style="height:10px;"></div>
|
391 |
-
<?php
|
392 |
-
$i=1;
|
393 |
-
while($irp->Lang->H('Notice.ProHeader'.$i)) {
|
394 |
-
$irp->Lang->P('Notice.ProHeader'.$i);
|
395 |
-
echo '<br/>';
|
396 |
-
++$i;
|
397 |
-
}
|
398 |
-
$i=1;
|
399 |
-
?>
|
400 |
-
<br/>
|
401 |
-
<?php
|
402 |
-
/*
|
403 |
-
$options = array('public' => TRUE, '_builtin' => FALSE);
|
404 |
-
$q=get_post_types($options, 'names');
|
405 |
-
if(is_array($q) && count($q)>0) {
|
406 |
-
sort($q);
|
407 |
-
$q=implode(', ', $q);
|
408 |
-
$q='(<b>'.$q.'</b>)';
|
409 |
-
} else {
|
410 |
-
$q='';
|
411 |
-
}*/
|
412 |
-
|
413 |
-
while($irp->Lang->H('Notice.ProFeature'.$i)) { ?>
|
414 |
-
<div style="clear:both; margin-top: 2px;"></div>
|
415 |
-
<div style="float:left; vertical-align:middle; height:24px; margin-right:5px;">
|
416 |
-
<img src="<?php echo IRP_PLUGIN_IMAGES?>tick.png" />
|
417 |
-
</div>
|
418 |
-
<div style="float:left; vertical-align:middle; height:24px;">
|
419 |
-
<?php $irp->Lang->P('Notice.ProFeature'.$i)?>
|
420 |
-
</div>
|
421 |
-
<?php ++$i;
|
422 |
-
}
|
423 |
-
?>
|
424 |
-
<div style="clear:both;"></div>
|
425 |
-
<div style="height:10px;"></div>
|
426 |
-
<div style="float:right;">
|
427 |
-
<?php
|
428 |
-
$url=IRP_INTELLYWP_SITE.IRP_PLUGIN_SLUG.'/?utm_source=free-users&utm_medium=irp-cta&utm_campaign=IRP';
|
429 |
-
?>
|
430 |
-
<a href="<?php echo $url?>" target="_blank">
|
431 |
-
<b><?php $irp->Lang->P('Notice.ProCTA')?></b>
|
432 |
-
</a>
|
433 |
-
</div>
|
434 |
-
<div style="height:10px; clear:both;"></div>
|
435 |
-
</div>
|
436 |
-
<br/>
|
437 |
-
<?php }
|
1 |
+
<?php
|
2 |
+
function irp_ui_tracking($override=FALSE) {
|
3 |
+
global $irp;
|
4 |
+
|
5 |
+
$track=$irp->Utils->qs('track', '');
|
6 |
+
if($track!='') {
|
7 |
+
$track=intval($track);
|
8 |
+
$irp->Options->setTrackingEnable($track);
|
9 |
+
$irp->Tracking->sendTracking(TRUE);
|
10 |
+
}
|
11 |
+
|
12 |
+
$uri=IRP_TAB_SETTINGS_URI.'&track=';
|
13 |
+
if($irp->Options->isTrackingEnable()) {
|
14 |
+
if($override) {
|
15 |
+
$uri.='0';
|
16 |
+
$irp->Options->pushSuccessMessage('EnableAllowTrackingNotice', $uri);
|
17 |
+
}
|
18 |
+
} else {
|
19 |
+
$uri.='1';
|
20 |
+
$irp->Options->pushWarningMessage('DisableAllowTrackingNotice', $uri);
|
21 |
+
}
|
22 |
+
$irp->Options->writeMessages();
|
23 |
+
}
|
24 |
+
function irp_io_first_time() {
|
25 |
+
global $irp;
|
26 |
+
if($irp->Options->isShowActivationNotice()) {
|
27 |
+
$irp->Options->pushSuccessMessage('FirstTimeActivation');
|
28 |
+
$irp->Options->writeMessages();
|
29 |
+
$irp->Options->setShowActivationNotice(FALSE);
|
30 |
+
}
|
31 |
+
}
|
32 |
+
function irp_ui_box_preview() {
|
33 |
+
global $irp;
|
34 |
+
|
35 |
+
$count=$irp->Options->getRewritePostsInBoxCount();
|
36 |
+
$count=$irp->Utils->iqs('rewritePostsInBoxCount', $count);
|
37 |
+
$args=array(
|
38 |
+
'orderby'=>'rand'
|
39 |
+
, 'numberposts'=>$count
|
40 |
+
);
|
41 |
+
|
42 |
+
$days=$irp->Options->getRewritePostsDays();
|
43 |
+
$days=$irp->Utils->iqs('rewritePostsDays', $days);
|
44 |
+
if($days>0) {
|
45 |
+
$args['date_query'] = array(
|
46 |
+
'column' => 'post_date'
|
47 |
+
, 'after' => '- '.$days.' days'
|
48 |
+
);
|
49 |
+
}
|
50 |
+
$posts=get_posts($args);
|
51 |
+
$ids=array();
|
52 |
+
foreach($posts as $p) {
|
53 |
+
$ids[]=$p->ID;
|
54 |
+
}
|
55 |
+
if(count($ids)==0) {
|
56 |
+
echo "<b>No posts available. Check settings and try again</b>";
|
57 |
+
die();
|
58 |
+
}
|
59 |
+
|
60 |
+
$defaults=$irp->Options->getTemplateStyle();
|
61 |
+
$args=$irp->Utils->aqs('template-', $defaults);
|
62 |
+
$args['includeCss']=TRUE;
|
63 |
+
$args['preview']=TRUE;
|
64 |
+
$box=irp_ui_get_box($ids, $args);
|
65 |
+
echo $box;
|
66 |
+
die();
|
67 |
+
}
|
68 |
+
function irp_ui_settings() {
|
69 |
+
global $irp;
|
70 |
+
irp_ui_tracking(FALSE);
|
71 |
+
|
72 |
+
?>
|
73 |
+
<script>
|
74 |
+
var IRP_preview=true;
|
75 |
+
var IRP_labelColor='';
|
76 |
+
var IRP_defaults={};
|
77 |
+
<?php
|
78 |
+
$defaults=$irp->HtmlTemplate->getDefaults();
|
79 |
+
foreach($defaults as $k=>$v) {
|
80 |
+
$buffer='';
|
81 |
+
foreach($v as $kk=>$vv) {
|
82 |
+
if($buffer!='') {
|
83 |
+
$buffer.=', ';
|
84 |
+
}
|
85 |
+
|
86 |
+
if(stripos($kk, 'label')!==FALSE) {
|
87 |
+
$vv=$irp->Lang->L('Settings.Color.'.$vv);
|
88 |
+
} elseif(stripos($kk, 'color')!==FALSE) {
|
89 |
+
$vv=$irp->Options->getColor($vv);
|
90 |
+
}
|
91 |
+
|
92 |
+
$buffer.=$kk.': "'.$vv.'"';
|
93 |
+
}
|
94 |
+
?>
|
95 |
+
IRP_defaults["<?php echo $k?>"]={<?php echo $buffer?>};
|
96 |
+
<?php }
|
97 |
+
?>
|
98 |
+
|
99 |
+
function IRP_changeTheme() {
|
100 |
+
IRP_preview=false;
|
101 |
+
t=IRP_val('template-template');
|
102 |
+
t=IRP_defaults[t];
|
103 |
+
isProTheme=false;
|
104 |
+
console.log(t);
|
105 |
+
jQuery.each(t, function(k,v) {
|
106 |
+
if(IRP_stripos(k, 'color')!==false) {
|
107 |
+
var $k=jQuery('[name=template-'+k+']');
|
108 |
+
$k.select2("val", v);
|
109 |
+
} else if(k=='proTheme') {
|
110 |
+
isProTheme=(v+''.toLowerCase()=='true');
|
111 |
+
}
|
112 |
+
});
|
113 |
+
|
114 |
+
jQuery("[name*='Color']").each(function(i,v) {
|
115 |
+
var $cbo=jQuery(this);
|
116 |
+
$cbo.prop("disabled", isProTheme);
|
117 |
+
$cbo.select2("enable", !isProTheme);
|
118 |
+
});
|
119 |
+
jQuery("[id*='ColorLabel']").each(function(i,v) {
|
120 |
+
var $lbl=jQuery(this);
|
121 |
+
if(IRP_labelColor!='') {
|
122 |
+
IRP_labelColor=$lbl.css('color');
|
123 |
+
}
|
124 |
+
if(isProTheme) {
|
125 |
+
$lbl.css('color', '#ccc');
|
126 |
+
} else {
|
127 |
+
$lbl.css('color', IRP_labelColor);
|
128 |
+
}
|
129 |
+
});
|
130 |
+
jQuery('.irp-submit').prop("disabled", isProTheme);
|
131 |
+
IRP_preview=true;
|
132 |
+
}
|
133 |
+
function IRP_changeRelatedBox() {
|
134 |
+
if(!IRP_preview) {
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
var t=IRP_val('template-template');
|
139 |
+
t=IRP_defaults[t].borderColorLabel;
|
140 |
+
jQuery('#template-borderColorLabel').text(t);
|
141 |
+
|
142 |
+
data=IRP_aval('template-');
|
143 |
+
data=jQuery.extend({
|
144 |
+
'action': 'do_action'
|
145 |
+
, 'irp_action': 'ui_box_preview'
|
146 |
+
, 'rewritePostsDays': IRP_val('irpRewritePostsDays')
|
147 |
+
}, data);
|
148 |
+
//console.log(data);
|
149 |
+
|
150 |
+
var request=jQuery.ajax({
|
151 |
+
url: ajaxurl
|
152 |
+
, method: "POST"
|
153 |
+
, data: data
|
154 |
+
, dataType: "html"
|
155 |
+
});
|
156 |
+
|
157 |
+
request.done(function(html) {
|
158 |
+
jQuery("#relatedBoxExample").html(html);
|
159 |
+
});
|
160 |
+
}
|
161 |
+
|
162 |
+
jQuery(function() {
|
163 |
+
IRP_preview=false;
|
164 |
+
var array=['irpRewritePostsDays', 'irpRewritePostsInBoxCount', 'irpRewriteBoxesCount'];
|
165 |
+
for(i=0; i<array.length; i++) {
|
166 |
+
if(jQuery('[name='+array[i]+']').length>0) {
|
167 |
+
jQuery('[name='+array[i]+']').change(function() {
|
168 |
+
IRP_changeRelatedBox();
|
169 |
+
});
|
170 |
+
}
|
171 |
+
}
|
172 |
+
jQuery("[name^='template-']").change(function() {
|
173 |
+
if(!IRP_preview) {
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
|
177 |
+
var $self=jQuery(this);
|
178 |
+
var name=$self.attr('name');
|
179 |
+
if(name=='template-template') {
|
180 |
+
IRP_changeTheme();
|
181 |
+
}
|
182 |
+
IRP_changeRelatedBox();
|
183 |
+
});
|
184 |
+
//IRP_changeTheme();
|
185 |
+
IRP_preview=true;
|
186 |
+
IRP_changeRelatedBox();
|
187 |
+
});
|
188 |
+
</script>
|
189 |
+
<?php
|
190 |
+
|
191 |
+
$irp->Form->prefix='Settings';
|
192 |
+
$irp->Form->helps = FALSE;
|
193 |
+
$irp->Form->formStarts();
|
194 |
+
|
195 |
+
if($irp->Check->nonce('irp_settings')) {
|
196 |
+
|
197 |
+
$irp->Options->resetMaxExecutionTime();
|
198 |
+
$irp->Options->setActive($irp->Utils->iqs('irpActive'));
|
199 |
+
|
200 |
+
$defaults=array(
|
201 |
+
'hasShadow'=>0
|
202 |
+
, 'hasPoweredBy'=>0
|
203 |
+
);
|
204 |
+
$template=$irp->Utils->aqs('template-', $defaults);
|
205 |
+
$irp->Options->setTemplateStyle($template);
|
206 |
+
|
207 |
+
$irp->Options->setMarginTop($irp->Utils->qs('marginTop', '0em'));
|
208 |
+
$irp->Options->setMarginBottom($irp->Utils->qs('marginBottom', '1em'));
|
209 |
+
$irp->Options->setRewriteActive($irp->Utils->iqs('irpRewriteActive'));
|
210 |
+
$irp->Options->setRewriteBoxesCount($irp->Utils->iqs('irpRewriteBoxesCount', 1));
|
211 |
+
//$irp->Options->setRewritePostsInBoxCount($irp->Utils->iqs('irpRewritePostsInBoxCount', 1));
|
212 |
+
$irp->Options->setRewritePostsDays($irp->Utils->iqs('irpRewritePostsDays', 0));
|
213 |
+
$irp->Options->setRewriteThreshold($irp->Utils->iqs('irpRewriteThreshold', 300));
|
214 |
+
$irp->Options->setRewriteAtEnd($irp->Utils->iqs('irpRewriteAtEnd'));
|
215 |
+
|
216 |
+
$irp->Options->setEngineSearch($irp->Utils->iqs('irpEngineSearch', IRP_ENGINE_SEARCH_CATEGORIES_TAGS));
|
217 |
+
|
218 |
+
$options = $irp->Options->getRewritePostTypes();
|
219 |
+
foreach ($options as $k => $template) {
|
220 |
+
$template = intval($irp->Utils->qs('irpRewritePostType_' . $k, 0));
|
221 |
+
$options[$k] = $template;
|
222 |
+
}
|
223 |
+
$irp->Options->setRewritePostTypes($options);
|
224 |
+
|
225 |
+
$options = $irp->Options->getMetaboxPostTypes();
|
226 |
+
foreach ($options as $k => $template) {
|
227 |
+
$template = intval($irp->Utils->qs('metabox_' . $k, 0));
|
228 |
+
$options[$k] = $template;
|
229 |
+
}
|
230 |
+
$irp->Options->setMetaboxPostTypes($options);
|
231 |
+
}
|
232 |
+
|
233 |
+
$c=wp_count_posts()->publish;
|
234 |
+
$t=$irp->Options->getMaxExecutionTime();
|
235 |
+
if($t>0) {?>
|
236 |
+
<p style="width:auto; font-style: italic;"><?php $irp->Lang->P('PreviewSectionMaxTime', $t, $c)?></p>
|
237 |
+
<?php }
|
238 |
+
|
239 |
+
$irp->Form->p('GeneralSection');
|
240 |
+
$args=array(
|
241 |
+
'class'=>'irp-hideShow irp-checkbox'
|
242 |
+
, 'irp-hideIfTrue'=>'false'
|
243 |
+
, 'irp-hideShow'=>'irp-active-box'
|
244 |
+
);
|
245 |
+
$irp->Form->checkbox('irpActive', $irp->Options->isActive(), 1, $args);
|
246 |
+
$args=array(
|
247 |
+
'id'=>'irp-active-box'
|
248 |
+
, 'name'=>'irp-active-box'
|
249 |
+
, 'style'=>'margin-top:10px;'
|
250 |
+
);
|
251 |
+
$irp->Form->divStarts($args);
|
252 |
+
{
|
253 |
+
$template=$irp->Options->getTemplateStyle();
|
254 |
+
$prefix='template-';
|
255 |
+
$irp->Form->text($prefix.'ctaText', $irp->Utils->get($template, 'ctaText'));
|
256 |
+
$options=$irp->HtmlTemplate->getTemplatesNames();
|
257 |
+
$irp->Form->select($prefix.'template', $irp->Utils->get($template, 'template'), $options);
|
258 |
+
$irp->Form->number($prefix.'boxOpacity', $irp->Utils->get($template, 'boxOpacity'));
|
259 |
+
$irp->Form->text('marginTop', $irp->Options->getMarginTop());
|
260 |
+
$irp->Form->text('marginBottom', $irp->Options->getMarginBottom());
|
261 |
+
//$options=array('none', 'capitalize', 'uppercase', 'lowercase');
|
262 |
+
//$irp->Form->select($t.'textTransform', $irp->Utils->get($v, 'textTransform'), $options);
|
263 |
+
$array=array('ctaTextColor', 'postTitleColor', 'boxColor', 'borderColor');
|
264 |
+
$blanks=array('(Default)', '(Default)', '(Trasparent)', '(Without)');
|
265 |
+
for($i=0; $i<count($array); $i++) {
|
266 |
+
$k=$array[$i];
|
267 |
+
$v=$blanks[$i];
|
268 |
+
$colors=$irp->Options->getColors($v);
|
269 |
+
|
270 |
+
$v=$irp->Utils->get($template, $k);
|
271 |
+
$v=$irp->Options->getColor($v);
|
272 |
+
$irp->Form->colorSelect($prefix.$k, $v, $colors);
|
273 |
+
}
|
274 |
+
$array=array('hasShadow', 'hasPoweredBy');
|
275 |
+
foreach($array as $k) {
|
276 |
+
$irp->Form->checkbox($prefix.$k, $irp->Utils->iget($template, $k));
|
277 |
+
}
|
278 |
+
?>
|
279 |
+
<div style="padding-left:10px; padding-right:10px; border:1px dashed #444444">
|
280 |
+
<?php $irp->Form->p('PreviewSection'); ?>
|
281 |
+
<p id="relatedBoxExample" style="width:auto;"></p>
|
282 |
+
</div>
|
283 |
+
<?php
|
284 |
+
$irp->Form->p('RewriteSection');
|
285 |
+
$args=array(
|
286 |
+
'class'=>'irp-hideShow irp-checkbox'
|
287 |
+
, 'irp-hideIfTrue'=>'false'
|
288 |
+
, 'irp-hideShow'=>'irp-rewrite-box'
|
289 |
+
);
|
290 |
+
$irp->Form->checkbox('irpRewriteActive', $irp->Options->isRewriteActive(), 1, $args);
|
291 |
+
$args=array('id'=>'irp-rewrite-box', 'name'=>'irp-rewrite-box', 'style'=>'margin-top:10px;');
|
292 |
+
$irp->Form->divStarts($args);
|
293 |
+
{
|
294 |
+
$options=array();
|
295 |
+
$options[]=array('id'=>1, 'name'=>1);
|
296 |
+
$options[]=array('id'=>2, 'name'=>2);
|
297 |
+
$options[]=array('id'=>3, 'name'=>3);
|
298 |
+
$irp->Form->select('irpRewriteBoxesCount', $irp->Options->getRewriteBoxesCount(), $options);
|
299 |
+
$irp->Form->number('irpRewritePostsDays', $irp->Options->getRewritePostsDays());
|
300 |
+
$irp->Form->number('irpRewriteThreshold', $irp->Options->getRewriteThreshold(), $args);
|
301 |
+
$irp->Form->checkbox('irpRewriteAtEnd', $irp->Options->isRewriteAtEnd());
|
302 |
+
$irp->Form->p('');
|
303 |
+
|
304 |
+
$options=$irp->Options->getRewritePostTypes();
|
305 |
+
$types=$irp->Utils->query(IRP_QUERY_POST_TYPES);
|
306 |
+
foreach($types as $v) {
|
307 |
+
$v=$v['name'];
|
308 |
+
$irp->Form->checkbox('irpRewritePostType_'.$v, $options[$v]);
|
309 |
+
}
|
310 |
+
}
|
311 |
+
$irp->Form->divEnds();
|
312 |
+
|
313 |
+
$irp->Form->p('EngineSection');
|
314 |
+
$irp->Form->divStarts();
|
315 |
+
{
|
316 |
+
$options=array(
|
317 |
+
IRP_ENGINE_SEARCH_CATEGORIES_TAGS
|
318 |
+
, IRP_ENGINE_SEARCH_CATEGORIES
|
319 |
+
, IRP_ENGINE_SEARCH_TAGS
|
320 |
+
);
|
321 |
+
$irp->Form->select('irpEngineSearch', $irp->Options->getEngineSearch(), $options);
|
322 |
+
$options=array();
|
323 |
+
$options[]=array('id'=>'nofollow', 'name'=>'nofollow');
|
324 |
+
$options[]=array('id'=>'dofollow', 'name'=>'dofollow');
|
325 |
+
$k='linkRel';
|
326 |
+
|
327 |
+
$irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
|
328 |
+
$options=array();
|
329 |
+
$options[]=array('id'=>'_blank', 'name'=>'_blank');
|
330 |
+
$options[]=array('id'=>'_self', 'name'=>'_self');
|
331 |
+
$k='linkTarget';
|
332 |
+
$irp->Form->select($prefix.$k, $irp->Utils->get($template, $k), $options);
|
333 |
+
}
|
334 |
+
$irp->Form->divEnds();
|
335 |
+
|
336 |
+
$irp->Form->p('MetaboxSection');
|
337 |
+
$irp->Form->divStarts();
|
338 |
+
{
|
339 |
+
$metaboxes=$irp->Options->getMetaboxPostTypes();
|
340 |
+
$types=$irp->Utils->query(IRP_QUERY_POST_TYPES);
|
341 |
+
foreach($types as $template) {
|
342 |
+
$template=$template['name'];
|
343 |
+
$irp->Form->checkbox('metabox_'.$template, $metaboxes[$template]);
|
344 |
+
}
|
345 |
+
}
|
346 |
+
$irp->Form->divEnds();
|
347 |
+
}
|
348 |
+
$irp->Form->divEnds();
|
349 |
+
|
350 |
+
$irp->Form->nonce('irp_settings');
|
351 |
+
irp_notice_pro_features();
|
352 |
+
$args=array('id'=>'boxDontSave', 'style'=>'display:none;');
|
353 |
+
$irp->Form->divStarts($args);
|
354 |
+
{
|
355 |
+
$irp->Form->p('Notice.DontSave');
|
356 |
+
}
|
357 |
+
$irp->Form->divEnds();
|
358 |
+
$irp->Form->submit('Save');
|
359 |
+
|
360 |
+
$irp->Form->formEnds(false);
|
361 |
+
$irp->Form->helps=FALSE;
|
362 |
+
|
363 |
+
$args=array('id'=>'irp-sidebar', 'style'=>'float:left; max-width: 250px; margin-left:10px');
|
364 |
+
$irp->Form->divStarts($args);
|
365 |
+
|
366 |
+
$count=$irp->Tabs->getPluginsCount();
|
367 |
+
$plugins=array();
|
368 |
+
while(count($plugins)<2) {
|
369 |
+
$id=rand(1, $count);
|
370 |
+
if(!isset($plugins[$id])) {
|
371 |
+
$plugins[$id]=$id;
|
372 |
+
}
|
373 |
+
}
|
374 |
+
|
375 |
+
$count=$irp->Tabs->drawContactUsWidget();
|
376 |
+
foreach($plugins as $id) {
|
377 |
+
$count=$irp->Tabs->drawPluginWidget($id);
|
378 |
+
}
|
379 |
+
|
380 |
+
$irp->Form->divEnds();
|
381 |
+
|
382 |
+
}
|
383 |
+
|
384 |
+
function irp_notice_pro_features() {
|
385 |
+
global $irp;
|
386 |
+
|
387 |
+
?>
|
388 |
+
<br/>
|
389 |
+
<div class="message updated below-h2" style="max-width:600px;">
|
390 |
+
<div style="height:10px;"></div>
|
391 |
+
<?php
|
392 |
+
$i=1;
|
393 |
+
while($irp->Lang->H('Notice.ProHeader'.$i)) {
|
394 |
+
$irp->Lang->P('Notice.ProHeader'.$i);
|
395 |
+
echo '<br/>';
|
396 |
+
++$i;
|
397 |
+
}
|
398 |
+
$i=1;
|
399 |
+
?>
|
400 |
+
<br/>
|
401 |
+
<?php
|
402 |
+
/*
|
403 |
+
$options = array('public' => TRUE, '_builtin' => FALSE);
|
404 |
+
$q=get_post_types($options, 'names');
|
405 |
+
if(is_array($q) && count($q)>0) {
|
406 |
+
sort($q);
|
407 |
+
$q=implode(', ', $q);
|
408 |
+
$q='(<b>'.$q.'</b>)';
|
409 |
+
} else {
|
410 |
+
$q='';
|
411 |
+
}*/
|
412 |
+
|
413 |
+
while($irp->Lang->H('Notice.ProFeature'.$i)) { ?>
|
414 |
+
<div style="clear:both; margin-top: 2px;"></div>
|
415 |
+
<div style="float:left; vertical-align:middle; height:24px; margin-right:5px;">
|
416 |
+
<img src="<?php echo IRP_PLUGIN_IMAGES?>tick.png" />
|
417 |
+
</div>
|
418 |
+
<div style="float:left; vertical-align:middle; height:24px;">
|
419 |
+
<?php $irp->Lang->P('Notice.ProFeature'.$i)?>
|
420 |
+
</div>
|
421 |
+
<?php ++$i;
|
422 |
+
}
|
423 |
+
?>
|
424 |
+
<div style="clear:both;"></div>
|
425 |
+
<div style="height:10px;"></div>
|
426 |
+
<div style="float:right;">
|
427 |
+
<?php
|
428 |
+
$url=IRP_INTELLYWP_SITE.IRP_PLUGIN_SLUG.'/?utm_source=free-users&utm_medium=irp-cta&utm_campaign=IRP';
|
429 |
+
?>
|
430 |
+
<a href="<?php echo $url?>" target="_blank">
|
431 |
+
<b><?php $irp->Lang->P('Notice.ProCTA')?></b>
|
432 |
+
</a>
|
433 |
+
</div>
|
434 |
+
<div style="height:10px; clear:both;"></div>
|
435 |
+
</div>
|
436 |
+
<br/>
|
437 |
+
<?php }
|
includes/classes/html/HTMLContext.php
CHANGED
@@ -1,564 +1,564 @@
|
|
1 |
-
<?php
|
2 |
-
if (!defined('ABSPATH')) exit;
|
3 |
-
|
4 |
-
class IRP_HTMLContext {
|
5 |
-
var $root; //MainTag
|
6 |
-
var $buffer; //IRP_Stack
|
7 |
-
|
8 |
-
var $uncuttable;
|
9 |
-
var $withoutNextState;
|
10 |
-
var $withoutNextWords;
|
11 |
-
|
12 |
-
var $currentWords;
|
13 |
-
var $lastBoxWords;
|
14 |
-
//last time that the plugin insert the related posts box counter values
|
15 |
-
var $wordsThreshold;
|
16 |
-
var $skipWordsCount=FALSE;
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
$this->clearBuffer();
|
20 |
-
}
|
21 |
-
|
22 |
-
public function setWithoutNextBox() {
|
23 |
-
$this->withoutNextState=TRUE;
|
24 |
-
$this->withoutNextWords=$this->currentWords;
|
25 |
-
}
|
26 |
-
public function isSkipCurrentBox() {
|
27 |
-
$result=FALSE;
|
28 |
-
if($this->withoutNextState) {
|
29 |
-
//if i already had written some words i can unlock the withoutNext lock
|
30 |
-
$result=($this->currentWords<=$this->withoutNextWords);
|
31 |
-
if(!$result) {
|
32 |
-
$this->withoutNextState=FALSE;
|
33 |
-
$this->withoutNextWords=0;
|
34 |
-
}
|
35 |
-
}
|
36 |
-
return $result;
|
37 |
-
}
|
38 |
-
public function clearSkipNext() {
|
39 |
-
$this->withoutNextState=FALSE;
|
40 |
-
$this->withoutNextWords=0;
|
41 |
-
}
|
42 |
-
|
43 |
-
public function setUncuttable($value) {
|
44 |
-
$this->uncuttable=$value;
|
45 |
-
}
|
46 |
-
public function isUncuttable() {
|
47 |
-
return $this->uncuttable;
|
48 |
-
}
|
49 |
-
|
50 |
-
private function clearBuffer() {
|
51 |
-
$this->buffer=new IRP_Stack();
|
52 |
-
$this->uncuttable=FALSE;
|
53 |
-
$this->isParentTable=FALSE;
|
54 |
-
$this->withoutNextState=FALSE;
|
55 |
-
$this->currentWords=0;
|
56 |
-
$this->lastBoxWords=0;
|
57 |
-
$this->withoutNextState=FALSE;
|
58 |
-
$this->withoutNextWords=0;
|
59 |
-
}
|
60 |
-
private function pushTextContent($part, $text, IRP_Stack &$tagsStack) {
|
61 |
-
if(!$part) {
|
62 |
-
$parent=$tagsStack->peek();
|
63 |
-
$part=new IRP_TextContent();
|
64 |
-
$parent->pushTag($part);
|
65 |
-
}
|
66 |
-
$part->append($text);
|
67 |
-
return $part;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function isWriteRelatedBox() {
|
71 |
-
global $irp;
|
72 |
-
if($this->isSkipCurrentBox()) {
|
73 |
-
return FALSE;
|
74 |
-
}
|
75 |
-
if($this->isUncuttable()) {
|
76 |
-
return FALSE;
|
77 |
-
}
|
78 |
-
|
79 |
-
$irp->Log->debug('WriteRelatedBox?');
|
80 |
-
$diff=($this->currentWords-$this->lastBoxWords);
|
81 |
-
$irp->Log->debug('currentWords[%s]-lastBoxWords[%s]=diff[%s]'
|
82 |
-
, $this->currentWords, $this->lastBoxWords, $diff);
|
83 |
-
|
84 |
-
$postLimit=$this->wordsThreshold*($irp->Options->getRewriteBoxesWritten()+1);
|
85 |
-
$irp->Log->debug('wordsThreshold[%s]*(RewriteBoxesWritten[%s]+1)=postLimit[%s]'
|
86 |
-
, $this->wordsThreshold, $irp->Options->getRewriteBoxesWritten(), $postLimit);
|
87 |
-
|
88 |
-
$minLimit=$irp->Options->getRewriteThreshold();
|
89 |
-
$result=($this->currentWords>=$postLimit && $diff>=$minLimit);
|
90 |
-
$irp->Log->debug('(currentWords[%s]>=postLimit[%s]) AND (diff[%s]>=minLimit[%s])=%s'
|
91 |
-
, $this->currentWords, $postLimit
|
92 |
-
, $diff, $minLimit, $result);
|
93 |
-
return $result;
|
94 |
-
}
|
95 |
-
|
96 |
-
function getTagAttribute($fullTag, $name) {
|
97 |
-
$close=strpos($fullTag, '>');
|
98 |
-
$attr=strpos($fullTag, ' '.$name.'=');
|
99 |
-
$result='';
|
100 |
-
if($attr!==FALSE && $close!==FALSE && $attr<$close) {
|
101 |
-
$quote=substr($fullTag, $attr+strlen($name)+2, 1);
|
102 |
-
$text=substr($fullTag, $attr+strlen($name)+3);
|
103 |
-
$end=strpos($text, $quote, 1);
|
104 |
-
if($end!==FALSE) {
|
105 |
-
$result=substr($text, 0, $end);
|
106 |
-
}
|
107 |
-
}
|
108 |
-
return $result;
|
109 |
-
}
|
110 |
-
|
111 |
-
//get the tag name to lower case, could be that is not defined
|
112 |
-
//so this function return '' could also be that
|
113 |
-
function getTagName($fullTag) {
|
114 |
-
global $irp;
|
115 |
-
|
116 |
-
$start=1;
|
117 |
-
$p=strpos($fullTag, ' ');
|
118 |
-
if($p===FALSE) {
|
119 |
-
$p=strpos($fullTag, '/');
|
120 |
-
if($p!==FALSE && $p==1) {
|
121 |
-
$start=2;
|
122 |
-
$p=FALSE;
|
123 |
-
}
|
124 |
-
if($p===FALSE) {
|
125 |
-
$p=strpos($fullTag, '>');
|
126 |
-
if($p===FALSE) {
|
127 |
-
$irp->Log->error('UNABLE TO DECODE TAG %s', $fullTag);
|
128 |
-
return '';
|
129 |
-
}
|
130 |
-
}
|
131 |
-
}
|
132 |
-
$tag=trim(substr($fullTag, $start, $p-$start));
|
133 |
-
$tag=strtolower($tag);
|
134 |
-
return $tag;
|
135 |
-
}
|
136 |
-
function getHtmlTag($fullTag){
|
137 |
-
global $irp;
|
138 |
-
|
139 |
-
$tag=$this->getTagName($fullTag);
|
140 |
-
$tagId=$this->getTagAttribute($fullTag, 'id');
|
141 |
-
$tagClasses=$this->getTagAttribute($fullTag, 'class');
|
142 |
-
if($tagClasses!=='') {
|
143 |
-
$tagClasses=explode(' ', $tagClasses);
|
144 |
-
} else {
|
145 |
-
$tagClasses=array();
|
146 |
-
}
|
147 |
-
|
148 |
-
if($tag=='') {
|
149 |
-
return NULL;
|
150 |
-
}
|
151 |
-
|
152 |
-
$result=new IRP_OtherTag();
|
153 |
-
if(in_array($tag, array('h1','h2','h3','h4','h5','h6'))) {
|
154 |
-
$result=new IRP_BehaviourTag();
|
155 |
-
$result->allowBoxBefore=TRUE;
|
156 |
-
$result->ensureUncuttable=TRUE;
|
157 |
-
$result->ensureWithoutNextBox=TRUE;
|
158 |
-
} elseif(in_array($tag, array('ul', 'ol', 'dl'))) {
|
159 |
-
$result=new IRP_BehaviourTag();
|
160 |
-
$result->ensureWithoutPreviousBox=TRUE;
|
161 |
-
$result->ensureUncuttable=TRUE;
|
162 |
-
$result->allowBoxAfter=TRUE;
|
163 |
-
} elseif(in_array($tag, array('area','base','col','br','command','embed','hr','img','input','link','meta','param','source'))) {
|
164 |
-
$result=new IRP_SingletonTag();
|
165 |
-
} elseif(in_array($tag, array('iframe'))) {
|
166 |
-
$result=new IRP_BehaviourTag();
|
167 |
-
$result->allowBoxBefore=TRUE;
|
168 |
-
$result->ensureUncuttable=TRUE;
|
169 |
-
$result->allowBoxAfter=TRUE;
|
170 |
-
$result->skipWordsCount=TRUE;
|
171 |
-
} elseif(in_array($tag, array('table'))) {
|
172 |
-
$result=new IRP_BehaviourTag();
|
173 |
-
$result->allowBoxBefore=TRUE;
|
174 |
-
$result->ensureUncuttable=TRUE;
|
175 |
-
$result->allowBoxAfter=TRUE;
|
176 |
-
} elseif(in_array($tag, array('span'))) {
|
177 |
-
$result=new IRP_BehaviourTag();
|
178 |
-
$result->ensureWithoutPreviousBox=TRUE;
|
179 |
-
$result->ensureWithoutNextBox=TRUE;
|
180 |
-
} elseif(in_array($tag, array('figure'))) {
|
181 |
-
$result=new IRP_BehaviourTag();
|
182 |
-
$result->ensureWithoutNextBox=TRUE;
|
183 |
-
$result->skipWordsCount=TRUE;
|
184 |
-
$result->ensureUncuttable=TRUE;
|
185 |
-
} elseif(in_array($tag, array('div'))) {
|
186 |
-
$result=new IRP_BehaviourTag();
|
187 |
-
$result->ensureWithoutPreviousBox=TRUE;
|
188 |
-
$result->ensureWithoutNextBox=TRUE;
|
189 |
-
|
190 |
-
$ids=explode('|', 'optinforms-|wpautbox-|wpurp-container-recipe-');
|
191 |
-
if($irp->Utils->startsWith($tagId, $ids)) {
|
192 |
-
$result->skipWordsCount=TRUE;
|
193 |
-
$result->ensureUncuttable=TRUE;
|
194 |
-
}
|
195 |
-
|
196 |
-
$classes=explode('|', 'yuzo_related_post|shareaholic-|wp-caption|wordpress-post-tabs|amp-wp-article-content|title-wrapper|sa-source-wrapper|et_pb_text_inner|wprm-recipe-name|toc_light_blue|ast-oembed-container|depiction|wc-tab|gkblock-3|et_pb_toggle_content|et_pb_module|aawp-product__description|fusion-text|fusion-alert-content|mv-create-instructions|recipe-ingredients-wrap|guide-box|underPostOptin|x-columnize');
|
197 |
-
if($irp->Utils->startsWith($tagClasses, $classes)) {
|
198 |
-
$result->skipWordsCount=TRUE;
|
199 |
-
$result->ensureUncuttable=TRUE;
|
200 |
-
}
|
201 |
-
} elseif(in_array($tag, array('p'))) {
|
202 |
-
$result=new IRP_BehaviourTag();
|
203 |
-
$result->allowBoxBefore=TRUE;
|
204 |
-
$result->allowBoxAfter=TRUE;
|
205 |
-
} elseif(in_array($tag, array('blockquote', 'cite', 'code', 'em', 'pre'))) {
|
206 |
-
$result=new IRP_BehaviourTag();
|
207 |
-
$result->ensureWithoutPreviousBox=TRUE;
|
208 |
-
$result->ensureUncuttable=TRUE;
|
209 |
-
$result->ensureWithoutNextBox=TRUE;
|
210 |
-
} elseif(in_array($tag, array('irp', 'script', 'style'))) {
|
211 |
-
$result=new IRP_BehaviourTag();
|
212 |
-
$result->ensureWithoutPreviousBox=TRUE;
|
213 |
-
$result->ensureUncuttable=TRUE;
|
214 |
-
$result->ensureWithoutNextBox=TRUE;
|
215 |
-
$result->skipWordsCount=TRUE;
|
216 |
-
} elseif(in_array($tag, array('sub', 'sup'))) {
|
217 |
-
$result=new IRP_BehaviourTag();
|
218 |
-
$result->ensureUncuttable=TRUE;
|
219 |
-
}
|
220 |
-
return $result;
|
221 |
-
}
|
222 |
-
|
223 |
-
public function decode($all) {
|
224 |
-
global $irp;
|
225 |
-
|
226 |
-
$this->root=new IRP_MainTag();
|
227 |
-
$this->clearBuffer();
|
228 |
-
|
229 |
-
if(!$all || trim($all)=='') return FALSE;
|
230 |
-
|
231 |
-
//qui sono a ricercare tutti i tag per poi farci delle verifiche
|
232 |
-
$tagsStack=new IRP_Stack();
|
233 |
-
$tagsStack->push($this->root);
|
234 |
-
|
235 |
-
$errors=FALSE;
|
236 |
-
$part=NULL;
|
237 |
-
$previous=0;
|
238 |
-
|
239 |
-
try {
|
240 |
-
do {
|
241 |
-
$less=strpos($all, '<', $previous);
|
242 |
-
if($less===FALSE) {
|
243 |
-
if($previous!=strlen($all)) {
|
244 |
-
$text=$irp->Utils->substrln($all, $previous);
|
245 |
-
$part=$this->pushTextContent($part, $text, $tagsStack);
|
246 |
-
}
|
247 |
-
break;
|
248 |
-
}
|
249 |
-
|
250 |
-
if($previous!=$less) {
|
251 |
-
$text=$irp->Utils->substrln($all, $previous, $less);
|
252 |
-
$part=$this->pushTextContent($part, $text, $tagsStack);
|
253 |
-
}
|
254 |
-
|
255 |
-
$more=strpos($all, '>', $less+1);
|
256 |
-
$another=strpos($all, '<', $less+1);
|
257 |
-
if($more===FALSE) {
|
258 |
-
//only open tag so I considate all as text (in this case is better
|
259 |
-
//to use html code like > or <
|
260 |
-
$text=$irp->Utils->substrln($all, $previous);
|
261 |
-
$part=$this->pushTextContent($part, $text, $tagsStack);
|
262 |
-
break;
|
263 |
-
}
|
264 |
-
|
265 |
-
if($another!==FALSE && $another<$more) {
|
266 |
-
//something like this <bla bla bla <bla bla> so we considerate
|
267 |
-
//from the last < before >
|
268 |
-
$previous=$another;
|
269 |
-
$text=$irp->Utils->substrln($all, $less, $previous);
|
270 |
-
$part=$this->pushTextContent($part, $text, $tagsStack);
|
271 |
-
continue;
|
272 |
-
}
|
273 |
-
|
274 |
-
$previous=$more+1;
|
275 |
-
$text=$irp->Utils->substrln($all, $less, $previous);
|
276 |
-
$parent=$tagsStack->peek();
|
277 |
-
$tag=$this->getOpenTag($text);
|
278 |
-
if($tag) {
|
279 |
-
//detected tag open
|
280 |
-
$part=NULL;
|
281 |
-
$parent->pushTag($tag);
|
282 |
-
if($tag->hasTagContent()) {
|
283 |
-
//this tag contains a content
|
284 |
-
$tagsStack->push($tag);
|
285 |
-
}
|
286 |
-
} else {
|
287 |
-
//detected tag close
|
288 |
-
$tag=$this->getCloseTag($text, $tagsStack);
|
289 |
-
if($tag) {
|
290 |
-
$part=NULL;
|
291 |
-
$compare=$tagsStack->pop();
|
292 |
-
while(!$tagsStack->isEmpty() && $compare!=$tag) {
|
293 |
-
//security check: close each tag until i found my tag
|
294 |
-
$irp->Log->error('WHAT? UNABLE TO FIND OPENED TAG..TRY CLOSING AND RETRYING AGAIN');
|
295 |
-
$compare->closeTag='</'.$compare->tag.'>';
|
296 |
-
$compare=$tagsStack->pop();
|
297 |
-
}
|
298 |
-
if($compare!=$tag) {
|
299 |
-
$irp->Log->error('WHAT? UNABLE TO FIND OPENED TAG');
|
300 |
-
$errors=TRUE;
|
301 |
-
} else {
|
302 |
-
$compare->closeTag=$text;
|
303 |
-
}
|
304 |
-
} else {
|
305 |
-
//simply text
|
306 |
-
$part=$this->pushTextContent($part, $text, $tagsStack);
|
307 |
-
}
|
308 |
-
}
|
309 |
-
}
|
310 |
-
while($previous<strlen($all));
|
311 |
-
} catch(Exception $ex) {
|
312 |
-
$irp->Log->exception($ex);
|
313 |
-
}
|
314 |
-
|
315 |
-
return !$errors;
|
316 |
-
}
|
317 |
-
|
318 |
-
private function getOpenTag($openTag) {
|
319 |
-
global $irp;
|
320 |
-
if($irp->Utils->startsWith($openTag, '</')) {
|
321 |
-
return NULL;
|
322 |
-
}
|
323 |
-
|
324 |
-
$name=$this->getTagName($openTag);
|
325 |
-
$tag=$this->getHtmlTag($openTag);
|
326 |
-
if($tag) {
|
327 |
-
$tag->tag=$name;
|
328 |
-
$tag->openTag=$openTag;
|
329 |
-
}
|
330 |
-
return $tag;
|
331 |
-
}
|
332 |
-
private function getCloseTag($closeTag, IRP_Stack $tagsStack) {
|
333 |
-
global $irp;
|
334 |
-
if(!$irp->Utils->startsWith($closeTag, '</')) {
|
335 |
-
return NULL;
|
336 |
-
}
|
337 |
-
|
338 |
-
$compare=$this->getTagName($closeTag);
|
339 |
-
if($compare=='') return NULL;
|
340 |
-
|
341 |
-
$tos=$tagsStack->peek();
|
342 |
-
if(!$tos || !isset($tos->tag) || strcasecmp($tos->tag, $compare)!=0) {
|
343 |
-
$irp->Log->error('CHECK YOU BODY TAG %s ENDS WITH %s TAG', $tos->tag, $compare);
|
344 |
-
return NULL;
|
345 |
-
}
|
346 |
-
|
347 |
-
$tos->closeTag=$closeTag;
|
348 |
-
return $tos;
|
349 |
-
}
|
350 |
-
|
351 |
-
public function execute($body) {
|
352 |
-
global $irp;
|
353 |
-
if(!$irp->Options->isRewriteActive()) {
|
354 |
-
return $body;
|
355 |
-
}
|
356 |
-
|
357 |
-
$this->decode($body);
|
358 |
-
$this->root->analyseText($this);
|
359 |
-
$t=intval($this->currentWords/($irp->Options->getRewriteBoxesCount()+1));
|
360 |
-
if($t<$irp->Options->getRewriteThreshold()) {
|
361 |
-
$t=$irp->Options->getRewriteThreshold();
|
362 |
-
}
|
363 |
-
/*
|
364 |
-
if($t<$irp->Options->getRewriteThreshold()) {
|
365 |
-
if($irp->Options->isRewriteAtEnd()) {
|
366 |
-
//this avoid to write a box just before the end of the posts
|
367 |
-
//where, due the isRewriteAtEnd flag we will write another box
|
368 |
-
$t=$this->wordsCounter+1;
|
369 |
-
} else {
|
370 |
-
$t=$irp->Options->getRewriteThreshold();
|
371 |
-
}
|
372 |
-
}
|
373 |
-
*/
|
374 |
-
$this->wordsThreshold=$t;
|
375 |
-
|
376 |
-
$this->clearBuffer();
|
377 |
-
$this->root->write($this);
|
378 |
-
|
379 |
-
$result='';
|
380 |
-
foreach($this->buffer->array as $v) {
|
381 |
-
$result.=$v->getText();
|
382 |
-
}
|
383 |
-
return $result;
|
384 |
-
}
|
385 |
-
public function write($text, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
|
386 |
-
global $irp;
|
387 |
-
if(!$text || $text=='') return;
|
388 |
-
$text=$irp->Utils->format($text, $v1, $v2, $v3, $v4, $v5);
|
389 |
-
|
390 |
-
$v=NULL;
|
391 |
-
$new=$this->buffer->isEmpty();
|
392 |
-
if(!$new) {
|
393 |
-
$v=$this->buffer->peek();
|
394 |
-
if(!$v->isBufferText()) {
|
395 |
-
$new=TRUE;
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
if($new) {
|
400 |
-
$v=new IRP_BufferText();
|
401 |
-
$this->buffer->push($v);
|
402 |
-
}
|
403 |
-
$v->appendText($text);
|
404 |
-
}
|
405 |
-
public function writeRelatedBoxIfNeeded() {
|
406 |
-
$result=FALSE;
|
407 |
-
//write the box at the end of the tag only if this is not an <Hn> tag
|
408 |
-
if($this->isWriteRelatedBox()) {
|
409 |
-
$result=$this->writeRelatedBox();
|
410 |
-
}
|
411 |
-
return $result;
|
412 |
-
}
|
413 |
-
public function writeRelatedBox($forceBox=FALSE) {
|
414 |
-
global $irp;
|
415 |
-
|
416 |
-
$written=$irp->Options->getRewriteBoxesWritten();
|
417 |
-
$max=$irp->Options->getRewriteBoxesCount();
|
418 |
-
if(!$forceBox && $written>=$max) {
|
419 |
-
$irp->Log->error('MAX BOX=%s REACHED', $max);
|
420 |
-
return FALSE;
|
421 |
-
}
|
422 |
-
|
423 |
-
$irp->Log->debug('WRITING BOX=%s/%s', $written+1, $max);
|
424 |
-
$result=FALSE;
|
425 |
-
$count=1;//$irp->Options->getRewritePostsInBoxCount();
|
426 |
-
$ids=$irp->Options->getToShowPostsIds($count, TRUE);
|
427 |
-
|
428 |
-
$comment="INLINE RELATED POSTS %s/%s";
|
429 |
-
$comment=sprintf($comment, $written+1, $max);
|
430 |
-
$options=array(
|
431 |
-
'comment'=>$comment
|
432 |
-
, 'shortcode'=>FALSE
|
433 |
-
);
|
434 |
-
$box=irp_ui_get_box($ids, $options);
|
435 |
-
if($box!='') {
|
436 |
-
$this->pushRelatedBox($box);
|
437 |
-
$result=TRUE;
|
438 |
-
} else {
|
439 |
-
$result=FALSE;
|
440 |
-
$irp->Log->error('NO BOX TO WRITE WITH IDS=%s', $ids);
|
441 |
-
}
|
442 |
-
return $result;
|
443 |
-
}
|
444 |
-
//append related-box element to buffer
|
445 |
-
public function pushRelatedBox($box) {
|
446 |
-
global $irp;
|
447 |
-
|
448 |
-
$v=new IRP_BufferBox();
|
449 |
-
$v->appendText($box);
|
450 |
-
$v->currentBoxWords=$this->currentWords;
|
451 |
-
$v->previousBoxWords=$this->lastBoxWords;
|
452 |
-
$this->buffer->push($v);
|
453 |
-
|
454 |
-
$written=$irp->Options->getRewriteBoxesWritten()+1;
|
455 |
-
$irp->Options->setRewriteBoxesWritten($written);
|
456 |
-
$this->lastBoxWords=$v->currentBoxWords;
|
457 |
-
}
|
458 |
-
//remove related-box elements from buffer starting from the end
|
459 |
-
public function popRelatedBox($args=NULL) {
|
460 |
-
global $irp;
|
461 |
-
if($this->buffer->isEmpty()) {
|
462 |
-
return FALSE;
|
463 |
-
}
|
464 |
-
|
465 |
-
$result=FALSE;
|
466 |
-
$defaults=array('last'=>TRUE, 'all'=>FALSE);
|
467 |
-
$args=$irp->Utils->parseArgs($args, $defaults);
|
468 |
-
if($args['last']) {
|
469 |
-
$v=$this->buffer->peek();
|
470 |
-
if($v->isBufferBox()) {
|
471 |
-
$v=$this->buffer->pop();
|
472 |
-
$this->lastBoxWords=$v->previousBoxWords;
|
473 |
-
$result=TRUE;
|
474 |
-
|
475 |
-
$w=$irp->Options->getRewriteBoxesWritten()-1;
|
476 |
-
$irp->Options->setRewriteBoxesWritten($w);
|
477 |
-
}
|
478 |
-
} elseif($args['all']) {
|
479 |
-
$array=array();
|
480 |
-
for($i=0; $i<count($this->buffer->array); $i++) {
|
481 |
-
$v=$this->buffer->array[$i];
|
482 |
-
if($v->isBufferBox()) {
|
483 |
-
$result=TRUE;
|
484 |
-
} else {
|
485 |
-
$array[]=$v;
|
486 |
-
}
|
487 |
-
}
|
488 |
-
$this->buffer->array=$array;
|
489 |
-
$this->lastBoxWords=0;
|
490 |
-
$irp->Options->setRewriteBoxesWritten(0);
|
491 |
-
}
|
492 |
-
return $result;
|
493 |
-
}
|
494 |
-
public function incCounters($text){
|
495 |
-
global $irp;
|
496 |
-
if($this->skipWordsCount) {
|
497 |
-
return;
|
498 |
-
}
|
499 |
-
|
500 |
-
$text=trim($text);
|
501 |
-
$words=explode(' ', $text);
|
502 |
-
$c=0;
|
503 |
-
foreach($words as $w) {
|
504 |
-
$w=trim($w);
|
505 |
-
if($w!='' && strlen($w)>1) {
|
506 |
-
$c++;
|
507 |
-
}
|
508 |
-
}
|
509 |
-
|
510 |
-
$this->currentWords+=$c;
|
511 |
-
$irp->Log->debug('TEXT=[%s] INCREMENT WORDS words[%s]/currentWords[%s]'
|
512 |
-
, $text, $c, $this->currentWords);
|
513 |
-
}
|
514 |
-
}
|
515 |
-
|
516 |
-
class IRP_BufferElement {
|
517 |
-
var $text;
|
518 |
-
public function __construct() {
|
519 |
-
$this->text='';
|
520 |
-
}
|
521 |
-
|
522 |
-
public function getText() {
|
523 |
-
return $this->text;
|
524 |
-
}
|
525 |
-
public function appendText($text) {
|
526 |
-
$this->text.=$text;
|
527 |
-
}
|
528 |
-
|
529 |
-
public function isBufferBox() {
|
530 |
-
return FALSE;
|
531 |
-
}
|
532 |
-
public function isBufferText() {
|
533 |
-
return FALSE;
|
534 |
-
}
|
535 |
-
}
|
536 |
-
class IRP_BufferText extends IRP_BufferElement {
|
537 |
-
public function __construct() {
|
538 |
-
parent::__construct();
|
539 |
-
}
|
540 |
-
|
541 |
-
public function isBufferBox() {
|
542 |
-
return FALSE;
|
543 |
-
}
|
544 |
-
public function isBufferText() {
|
545 |
-
return TRUE;
|
546 |
-
}
|
547 |
-
}
|
548 |
-
class IRP_BufferBox extends IRP_BufferElement {
|
549 |
-
var $currentBoxWords;
|
550 |
-
var $previousBoxWords;
|
551 |
-
|
552 |
-
public function __construct() {
|
553 |
-
parent::__construct();
|
554 |
-
$this->currentBoxWords=0;
|
555 |
-
$this->previousBoxWords=0;
|
556 |
-
}
|
557 |
-
|
558 |
-
public function isBufferBox() {
|
559 |
-
return TRUE;
|
560 |
-
}
|
561 |
-
public function isBufferText() {
|
562 |
-
return FALSE;
|
563 |
-
}
|
564 |
}
|
1 |
+
<?php
|
2 |
+
if (!defined('ABSPATH')) exit;
|
3 |
+
|
4 |
+
class IRP_HTMLContext {
|
5 |
+
var $root; //MainTag
|
6 |
+
var $buffer; //IRP_Stack
|
7 |
+
|
8 |
+
var $uncuttable;
|
9 |
+
var $withoutNextState;
|
10 |
+
var $withoutNextWords;
|
11 |
+
|
12 |
+
var $currentWords;
|
13 |
+
var $lastBoxWords;
|
14 |
+
//last time that the plugin insert the related posts box counter values
|
15 |
+
var $wordsThreshold;
|
16 |
+
var $skipWordsCount=FALSE;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
$this->clearBuffer();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function setWithoutNextBox() {
|
23 |
+
$this->withoutNextState=TRUE;
|
24 |
+
$this->withoutNextWords=$this->currentWords;
|
25 |
+
}
|
26 |
+
public function isSkipCurrentBox() {
|
27 |
+
$result=FALSE;
|
28 |
+
if($this->withoutNextState) {
|
29 |
+
//if i already had written some words i can unlock the withoutNext lock
|
30 |
+
$result=($this->currentWords<=$this->withoutNextWords);
|
31 |
+
if(!$result) {
|
32 |
+
$this->withoutNextState=FALSE;
|
33 |
+
$this->withoutNextWords=0;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
return $result;
|
37 |
+
}
|
38 |
+
public function clearSkipNext() {
|
39 |
+
$this->withoutNextState=FALSE;
|
40 |
+
$this->withoutNextWords=0;
|
41 |
+
}
|
42 |
+
|
43 |
+
public function setUncuttable($value) {
|
44 |
+
$this->uncuttable=$value;
|
45 |
+
}
|
46 |
+
public function isUncuttable() {
|
47 |
+
return $this->uncuttable;
|
48 |
+
}
|
49 |
+
|
50 |
+
private function clearBuffer() {
|
51 |
+
$this->buffer=new IRP_Stack();
|
52 |
+
$this->uncuttable=FALSE;
|
53 |
+
$this->isParentTable=FALSE;
|
54 |
+
$this->withoutNextState=FALSE;
|
55 |
+
$this->currentWords=0;
|
56 |
+
$this->lastBoxWords=0;
|
57 |
+
$this->withoutNextState=FALSE;
|
58 |
+
$this->withoutNextWords=0;
|
59 |
+
}
|
60 |
+
private function pushTextContent($part, $text, IRP_Stack &$tagsStack) {
|
61 |
+
if(!$part) {
|
62 |
+
$parent=$tagsStack->peek();
|
63 |
+
$part=new IRP_TextContent();
|
64 |
+
$parent->pushTag($part);
|
65 |
+
}
|
66 |
+
$part->append($text);
|
67 |
+
return $part;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function isWriteRelatedBox() {
|
71 |
+
global $irp;
|
72 |
+
if($this->isSkipCurrentBox()) {
|
73 |
+
return FALSE;
|
74 |
+
}
|
75 |
+
if($this->isUncuttable()) {
|
76 |
+
return FALSE;
|
77 |
+
}
|
78 |
+
|
79 |
+
$irp->Log->debug('WriteRelatedBox?');
|
80 |
+
$diff=($this->currentWords-$this->lastBoxWords);
|
81 |
+
$irp->Log->debug('currentWords[%s]-lastBoxWords[%s]=diff[%s]'
|
82 |
+
, $this->currentWords, $this->lastBoxWords, $diff);
|
83 |
+
|
84 |
+
$postLimit=$this->wordsThreshold*($irp->Options->getRewriteBoxesWritten()+1);
|
85 |
+
$irp->Log->debug('wordsThreshold[%s]*(RewriteBoxesWritten[%s]+1)=postLimit[%s]'
|
86 |
+
, $this->wordsThreshold, $irp->Options->getRewriteBoxesWritten(), $postLimit);
|
87 |
+
|
88 |
+
$minLimit=$irp->Options->getRewriteThreshold();
|
89 |
+
$result=($this->currentWords>=$postLimit && $diff>=$minLimit);
|
90 |
+
$irp->Log->debug('(currentWords[%s]>=postLimit[%s]) AND (diff[%s]>=minLimit[%s])=%s'
|
91 |
+
, $this->currentWords, $postLimit
|
92 |
+
, $diff, $minLimit, $result);
|
93 |
+
return $result;
|
94 |
+
}
|
95 |
+
|
96 |
+
function getTagAttribute($fullTag, $name) {
|
97 |
+
$close=strpos($fullTag, '>');
|
98 |
+
$attr=strpos($fullTag, ' '.$name.'=');
|
99 |
+
$result='';
|
100 |
+
if($attr!==FALSE && $close!==FALSE && $attr<$close) {
|
101 |
+
$quote=substr($fullTag, $attr+strlen($name)+2, 1);
|
102 |
+
$text=substr($fullTag, $attr+strlen($name)+3);
|
103 |
+
$end=strpos($text, $quote, 1);
|
104 |
+
if($end!==FALSE) {
|
105 |
+
$result=substr($text, 0, $end);
|
106 |
+
}
|
107 |
+
}
|
108 |
+
return $result;
|
109 |
+
}
|
110 |
+
|
111 |
+
//get the tag name to lower case, could be that is not defined
|
112 |
+
//so this function return '' could also be that
|
113 |
+
function getTagName($fullTag) {
|
114 |
+
global $irp;
|
115 |
+
|
116 |
+
$start=1;
|
117 |
+
$p=strpos($fullTag, ' ');
|
118 |
+
if($p===FALSE) {
|
119 |
+
$p=strpos($fullTag, '/');
|
120 |
+
if($p!==FALSE && $p==1) {
|
121 |
+
$start=2;
|
122 |
+
$p=FALSE;
|
123 |
+
}
|
124 |
+
if($p===FALSE) {
|
125 |
+
$p=strpos($fullTag, '>');
|
126 |
+
if($p===FALSE) {
|
127 |
+
$irp->Log->error('UNABLE TO DECODE TAG %s', $fullTag);
|
128 |
+
return '';
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$tag=trim(substr($fullTag, $start, $p-$start));
|
133 |
+
$tag=strtolower($tag);
|
134 |
+
return $tag;
|
135 |
+
}
|
136 |
+
function getHtmlTag($fullTag){
|
137 |
+
global $irp;
|
138 |
+
|
139 |
+
$tag=$this->getTagName($fullTag);
|
140 |
+
$tagId=$this->getTagAttribute($fullTag, 'id');
|
141 |
+
$tagClasses=$this->getTagAttribute($fullTag, 'class');
|
142 |
+
if($tagClasses!=='') {
|
143 |
+
$tagClasses=explode(' ', $tagClasses);
|
144 |
+
} else {
|
145 |
+
$tagClasses=array();
|
146 |
+
}
|
147 |
+
|
148 |
+
if($tag=='') {
|
149 |
+
return NULL;
|
150 |
+
}
|
151 |
+
|
152 |
+
$result=new IRP_OtherTag();
|
153 |
+
if(in_array($tag, array('h1','h2','h3','h4','h5','h6'))) {
|
154 |
+
$result=new IRP_BehaviourTag();
|
155 |
+
$result->allowBoxBefore=TRUE;
|
156 |
+
$result->ensureUncuttable=TRUE;
|
157 |
+
$result->ensureWithoutNextBox=TRUE;
|
158 |
+
} elseif(in_array($tag, array('ul', 'ol', 'dl'))) {
|
159 |
+
$result=new IRP_BehaviourTag();
|
160 |
+
$result->ensureWithoutPreviousBox=TRUE;
|
161 |
+
$result->ensureUncuttable=TRUE;
|
162 |
+
$result->allowBoxAfter=TRUE;
|
163 |
+
} elseif(in_array($tag, array('area','base','col','br','command','embed','hr','img','input','link','meta','param','source'))) {
|
164 |
+
$result=new IRP_SingletonTag();
|
165 |
+
} elseif(in_array($tag, array('iframe'))) {
|
166 |
+
$result=new IRP_BehaviourTag();
|
167 |
+
$result->allowBoxBefore=TRUE;
|
168 |
+
$result->ensureUncuttable=TRUE;
|
169 |
+
$result->allowBoxAfter=TRUE;
|
170 |
+
$result->skipWordsCount=TRUE;
|
171 |
+
} elseif(in_array($tag, array('table'))) {
|
172 |
+
$result=new IRP_BehaviourTag();
|
173 |
+
$result->allowBoxBefore=TRUE;
|
174 |
+
$result->ensureUncuttable=TRUE;
|
175 |
+
$result->allowBoxAfter=TRUE;
|
176 |
+
} elseif(in_array($tag, array('span'))) {
|
177 |
+
$result=new IRP_BehaviourTag();
|
178 |
+
$result->ensureWithoutPreviousBox=TRUE;
|
179 |
+
$result->ensureWithoutNextBox=TRUE;
|
180 |
+
} elseif(in_array($tag, array('figure'))) {
|
181 |
+
$result=new IRP_BehaviourTag();
|
182 |
+
$result->ensureWithoutNextBox=TRUE;
|
183 |
+
$result->skipWordsCount=TRUE;
|
184 |
+
$result->ensureUncuttable=TRUE;
|
185 |
+
} elseif(in_array($tag, array('div'))) {
|
186 |
+
$result=new IRP_BehaviourTag();
|
187 |
+
$result->ensureWithoutPreviousBox=TRUE;
|
188 |
+
$result->ensureWithoutNextBox=TRUE;
|
189 |
+
|
190 |
+
$ids=explode('|', 'optinforms-|wpautbox-|wpurp-container-recipe-');
|
191 |
+
if($irp->Utils->startsWith($tagId, $ids)) {
|
192 |
+
$result->skipWordsCount=TRUE;
|
193 |
+
$result->ensureUncuttable=TRUE;
|
194 |
+
}
|
195 |
+
|
196 |
+
$classes=explode('|', 'yuzo_related_post|shareaholic-|wp-caption|wordpress-post-tabs|amp-wp-article-content|title-wrapper|sa-source-wrapper|et_pb_text_inner|wprm-recipe-name|toc_light_blue|ast-oembed-container|depiction|wc-tab|gkblock-3|et_pb_toggle_content|et_pb_module|aawp-product__description|fusion-text|fusion-alert-content|mv-create-instructions|recipe-ingredients-wrap|guide-box|underPostOptin|x-columnize');
|
197 |
+
if($irp->Utils->startsWith($tagClasses, $classes)) {
|
198 |
+
$result->skipWordsCount=TRUE;
|
199 |
+
$result->ensureUncuttable=TRUE;
|
200 |
+
}
|
201 |
+
} elseif(in_array($tag, array('p'))) {
|
202 |
+
$result=new IRP_BehaviourTag();
|
203 |
+
$result->allowBoxBefore=TRUE;
|
204 |
+
$result->allowBoxAfter=TRUE;
|
205 |
+
} elseif(in_array($tag, array('blockquote', 'cite', 'code', 'em', 'pre'))) {
|
206 |
+
$result=new IRP_BehaviourTag();
|
207 |
+
$result->ensureWithoutPreviousBox=TRUE;
|
208 |
+
$result->ensureUncuttable=TRUE;
|
209 |
+
$result->ensureWithoutNextBox=TRUE;
|
210 |
+
} elseif(in_array($tag, array('irp', 'script', 'style'))) {
|
211 |
+
$result=new IRP_BehaviourTag();
|
212 |
+
$result->ensureWithoutPreviousBox=TRUE;
|
213 |
+
$result->ensureUncuttable=TRUE;
|
214 |
+
$result->ensureWithoutNextBox=TRUE;
|
215 |
+
$result->skipWordsCount=TRUE;
|
216 |
+
} elseif(in_array($tag, array('sub', 'sup'))) {
|
217 |
+
$result=new IRP_BehaviourTag();
|
218 |
+
$result->ensureUncuttable=TRUE;
|
219 |
+
}
|
220 |
+
return $result;
|
221 |
+
}
|
222 |
+
|
223 |
+
public function decode($all) {
|
224 |
+
global $irp;
|
225 |
+
|
226 |
+
$this->root=new IRP_MainTag();
|
227 |
+
$this->clearBuffer();
|
228 |
+
|
229 |
+
if(!$all || trim($all)=='') return FALSE;
|
230 |
+
|
231 |
+
//qui sono a ricercare tutti i tag per poi farci delle verifiche
|
232 |
+
$tagsStack=new IRP_Stack();
|
233 |
+
$tagsStack->push($this->root);
|
234 |
+
|
235 |
+
$errors=FALSE;
|
236 |
+
$part=NULL;
|
237 |
+
$previous=0;
|
238 |
+
|
239 |
+
try {
|
240 |
+
do {
|
241 |
+
$less=strpos($all, '<', $previous);
|
242 |
+
if($less===FALSE) {
|
243 |
+
if($previous!=strlen($all)) {
|
244 |
+
$text=$irp->Utils->substrln($all, $previous);
|
245 |
+
$part=$this->pushTextContent($part, $text, $tagsStack);
|
246 |
+
}
|
247 |
+
break;
|
248 |
+
}
|
249 |
+
|
250 |
+
if($previous!=$less) {
|
251 |
+
$text=$irp->Utils->substrln($all, $previous, $less);
|
252 |
+
$part=$this->pushTextContent($part, $text, $tagsStack);
|
253 |
+
}
|
254 |
+
|
255 |
+
$more=strpos($all, '>', $less+1);
|
256 |
+
$another=strpos($all, '<', $less+1);
|
257 |
+
if($more===FALSE) {
|
258 |
+
//only open tag so I considate all as text (in this case is better
|
259 |
+
//to use html code like > or <
|
260 |
+
$text=$irp->Utils->substrln($all, $previous);
|
261 |
+
$part=$this->pushTextContent($part, $text, $tagsStack);
|
262 |
+
break;
|
263 |
+
}
|
264 |
+
|
265 |
+
if($another!==FALSE && $another<$more) {
|
266 |
+
//something like this <bla bla bla <bla bla> so we considerate
|
267 |
+
//from the last < before >
|
268 |
+
$previous=$another;
|
269 |
+
$text=$irp->Utils->substrln($all, $less, $previous);
|
270 |
+
$part=$this->pushTextContent($part, $text, $tagsStack);
|
271 |
+
continue;
|
272 |
+
}
|
273 |
+
|
274 |
+
$previous=$more+1;
|
275 |
+
$text=$irp->Utils->substrln($all, $less, $previous);
|
276 |
+
$parent=$tagsStack->peek();
|
277 |
+
$tag=$this->getOpenTag($text);
|
278 |
+
if($tag) {
|
279 |
+
//detected tag open
|
280 |
+
$part=NULL;
|
281 |
+
$parent->pushTag($tag);
|
282 |
+
if($tag->hasTagContent()) {
|
283 |
+
//this tag contains a content
|
284 |
+
$tagsStack->push($tag);
|
285 |
+
}
|
286 |
+
} else {
|
287 |
+
//detected tag close
|
288 |
+
$tag=$this->getCloseTag($text, $tagsStack);
|
289 |
+
if($tag) {
|
290 |
+
$part=NULL;
|
291 |
+
$compare=$tagsStack->pop();
|
292 |
+
while(!$tagsStack->isEmpty() && $compare!=$tag) {
|
293 |
+
//security check: close each tag until i found my tag
|
294 |
+
$irp->Log->error('WHAT? UNABLE TO FIND OPENED TAG..TRY CLOSING AND RETRYING AGAIN');
|
295 |
+
$compare->closeTag='</'.$compare->tag.'>';
|
296 |
+
$compare=$tagsStack->pop();
|
297 |
+
}
|
298 |
+
if($compare!=$tag) {
|
299 |
+
$irp->Log->error('WHAT? UNABLE TO FIND OPENED TAG');
|
300 |
+
$errors=TRUE;
|
301 |
+
} else {
|
302 |
+
$compare->closeTag=$text;
|
303 |
+
}
|
304 |
+
} else {
|
305 |
+
//simply text
|
306 |
+
$part=$this->pushTextContent($part, $text, $tagsStack);
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
while($previous<strlen($all));
|
311 |
+
} catch(Exception $ex) {
|
312 |
+
$irp->Log->exception($ex);
|
313 |
+
}
|
314 |
+
|
315 |
+
return !$errors;
|
316 |
+
}
|
317 |
+
|
318 |
+
private function getOpenTag($openTag) {
|
319 |
+
global $irp;
|
320 |
+
if($irp->Utils->startsWith($openTag, '</')) {
|
321 |
+
return NULL;
|
322 |
+
}
|
323 |
+
|
324 |
+
$name=$this->getTagName($openTag);
|
325 |
+
$tag=$this->getHtmlTag($openTag);
|
326 |
+
if($tag) {
|
327 |
+
$tag->tag=$name;
|
328 |
+
$tag->openTag=$openTag;
|
329 |
+
}
|
330 |
+
return $tag;
|
331 |
+
}
|
332 |
+
private function getCloseTag($closeTag, IRP_Stack $tagsStack) {
|
333 |
+
global $irp;
|
334 |
+
if(!$irp->Utils->startsWith($closeTag, '</')) {
|
335 |
+
return NULL;
|
336 |
+
}
|
337 |
+
|
338 |
+
$compare=$this->getTagName($closeTag);
|
339 |
+
if($compare=='') return NULL;
|
340 |
+
|
341 |
+
$tos=$tagsStack->peek();
|
342 |
+
if(!$tos || !isset($tos->tag) || strcasecmp($tos->tag, $compare)!=0) {
|
343 |
+
$irp->Log->error('CHECK YOU BODY TAG %s ENDS WITH %s TAG', $tos->tag, $compare);
|
344 |
+
return NULL;
|
345 |
+
}
|
346 |
+
|
347 |
+
$tos->closeTag=$closeTag;
|
348 |
+
return $tos;
|
349 |
+
}
|
350 |
+
|
351 |
+
public function execute($body) {
|
352 |
+
global $irp;
|
353 |
+
if(!$irp->Options->isRewriteActive()) {
|
354 |
+
return $body;
|
355 |
+
}
|
356 |
+
|
357 |
+
$this->decode($body);
|
358 |
+
$this->root->analyseText($this);
|
359 |
+
$t=intval($this->currentWords/($irp->Options->getRewriteBoxesCount()+1));
|
360 |
+
if($t<$irp->Options->getRewriteThreshold()) {
|
361 |
+
$t=$irp->Options->getRewriteThreshold();
|
362 |
+
}
|
363 |
+
/*
|
364 |
+
if($t<$irp->Options->getRewriteThreshold()) {
|
365 |
+
if($irp->Options->isRewriteAtEnd()) {
|
366 |
+
//this avoid to write a box just before the end of the posts
|
367 |
+
//where, due the isRewriteAtEnd flag we will write another box
|
368 |
+
$t=$this->wordsCounter+1;
|
369 |
+
} else {
|
370 |
+
$t=$irp->Options->getRewriteThreshold();
|
371 |
+
}
|
372 |
+
}
|
373 |
+
*/
|
374 |
+
$this->wordsThreshold=$t;
|
375 |
+
|
376 |
+
$this->clearBuffer();
|
377 |
+
$this->root->write($this);
|
378 |
+
|
379 |
+
$result='';
|
380 |
+
foreach($this->buffer->array as $v) {
|
381 |
+
$result.=$v->getText();
|
382 |
+
}
|
383 |
+
return $result;
|
384 |
+
}
|
385 |
+
public function write($text, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
|
386 |
+
global $irp;
|
387 |
+
if(!$text || $text=='') return;
|
388 |
+
$text=$irp->Utils->format($text, $v1, $v2, $v3, $v4, $v5);
|
389 |
+
|
390 |
+
$v=NULL;
|
391 |
+
$new=$this->buffer->isEmpty();
|
392 |
+
if(!$new) {
|
393 |
+
$v=$this->buffer->peek();
|
394 |
+
if(!$v->isBufferText()) {
|
395 |
+
$new=TRUE;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
if($new) {
|
400 |
+
$v=new IRP_BufferText();
|
401 |
+
$this->buffer->push($v);
|
402 |
+
}
|
403 |
+
$v->appendText($text);
|
404 |
+
}
|
405 |
+
public function writeRelatedBoxIfNeeded() {
|
406 |
+
$result=FALSE;
|
407 |
+
//write the box at the end of the tag only if this is not an <Hn> tag
|
408 |
+
if($this->isWriteRelatedBox()) {
|
409 |
+
$result=$this->writeRelatedBox();
|
410 |
+
}
|
411 |
+
return $result;
|
412 |
+
}
|
413 |
+
public function writeRelatedBox($forceBox=FALSE) {
|
414 |
+
global $irp;
|
415 |
+
|
416 |
+
$written=$irp->Options->getRewriteBoxesWritten();
|
417 |
+
$max=$irp->Options->getRewriteBoxesCount();
|
418 |
+
if(!$forceBox && $written>=$max) {
|
419 |
+
$irp->Log->error('MAX BOX=%s REACHED', $max);
|
420 |
+
return FALSE;
|
421 |
+
}
|
422 |
+
|
423 |
+
$irp->Log->debug('WRITING BOX=%s/%s', $written+1, $max);
|
424 |
+
$result=FALSE;
|
425 |
+
$count=1;//$irp->Options->getRewritePostsInBoxCount();
|
426 |
+
$ids=$irp->Options->getToShowPostsIds($count, TRUE);
|
427 |
+
|
428 |
+
$comment="INLINE RELATED POSTS %s/%s";
|
429 |
+
$comment=sprintf($comment, $written+1, $max);
|
430 |
+
$options=array(
|
431 |
+
'comment'=>$comment
|
432 |
+
, 'shortcode'=>FALSE
|
433 |
+
);
|
434 |
+
$box=irp_ui_get_box($ids, $options);
|
435 |
+
if($box!='') {
|
436 |
+
$this->pushRelatedBox($box);
|
437 |
+
$result=TRUE;
|
438 |
+
} else {
|
439 |
+
$result=FALSE;
|
440 |
+
$irp->Log->error('NO BOX TO WRITE WITH IDS=%s', $ids);
|
441 |
+
}
|
442 |
+
return $result;
|
443 |
+
}
|
444 |
+
//append related-box element to buffer
|
445 |
+
public function pushRelatedBox($box) {
|
446 |
+
global $irp;
|
447 |
+
|
448 |
+
$v=new IRP_BufferBox();
|
449 |
+
$v->appendText($box);
|
450 |
+
$v->currentBoxWords=$this->currentWords;
|
451 |
+
$v->previousBoxWords=$this->lastBoxWords;
|
452 |
+
$this->buffer->push($v);
|
453 |
+
|
454 |
+
$written=$irp->Options->getRewriteBoxesWritten()+1;
|
455 |
+
$irp->Options->setRewriteBoxesWritten($written);
|
456 |
+
$this->lastBoxWords=$v->currentBoxWords;
|
457 |
+
}
|
458 |
+
//remove related-box elements from buffer starting from the end
|
459 |
+
public function popRelatedBox($args=NULL) {
|
460 |
+
global $irp;
|
461 |
+
if($this->buffer->isEmpty()) {
|
462 |
+
return FALSE;
|
463 |
+
}
|
464 |
+
|
465 |
+
$result=FALSE;
|
466 |
+
$defaults=array('last'=>TRUE, 'all'=>FALSE);
|
467 |
+
$args=$irp->Utils->parseArgs($args, $defaults);
|
468 |
+
if($args['last']) {
|
469 |
+
$v=$this->buffer->peek();
|
470 |
+
if($v->isBufferBox()) {
|
471 |
+
$v=$this->buffer->pop();
|
472 |
+
$this->lastBoxWords=$v->previousBoxWords;
|
473 |
+
$result=TRUE;
|
474 |
+
|
475 |
+
$w=$irp->Options->getRewriteBoxesWritten()-1;
|
476 |
+
$irp->Options->setRewriteBoxesWritten($w);
|
477 |
+
}
|
478 |
+
} elseif($args['all']) {
|
479 |
+
$array=array();
|
480 |
+
for($i=0; $i<count($this->buffer->array); $i++) {
|
481 |
+
$v=$this->buffer->array[$i];
|
482 |
+
if($v->isBufferBox()) {
|
483 |
+
$result=TRUE;
|
484 |
+
} else {
|
485 |
+
$array[]=$v;
|
486 |
+
}
|
487 |
+
}
|
488 |
+
$this->buffer->array=$array;
|
489 |
+
$this->lastBoxWords=0;
|
490 |
+
$irp->Options->setRewriteBoxesWritten(0);
|
491 |
+
}
|
492 |
+
return $result;
|
493 |
+
}
|
494 |
+
public function incCounters($text){
|
495 |
+
global $irp;
|
496 |
+
if($this->skipWordsCount) {
|
497 |
+
return;
|
498 |
+
}
|
499 |
+
|
500 |
+
$text=trim($text);
|
501 |
+
$words=explode(' ', $text);
|
502 |
+
$c=0;
|
503 |
+
foreach($words as $w) {
|
504 |
+
$w=trim($w);
|
505 |
+
if($w!='' && strlen($w)>1) {
|
506 |
+
$c++;
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
$this->currentWords+=$c;
|
511 |
+
$irp->Log->debug('TEXT=[%s] INCREMENT WORDS words[%s]/currentWords[%s]'
|
512 |
+
, $text, $c, $this->currentWords);
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
class IRP_BufferElement {
|
517 |
+
var $text;
|
518 |
+
public function __construct() {
|
519 |
+
$this->text='';
|
520 |
+
}
|
521 |
+
|
522 |
+
public function getText() {
|
523 |
+
return $this->text;
|
524 |
+
}
|
525 |
+
public function appendText($text) {
|
526 |
+
$this->text.=$text;
|
527 |
+
}
|
528 |
+
|
529 |
+
public function isBufferBox() {
|
530 |
+
return FALSE;
|
531 |
+
}
|
532 |
+
public function isBufferText() {
|
533 |
+
return FALSE;
|
534 |
+
}
|
535 |
+
}
|
536 |
+
class IRP_BufferText extends IRP_BufferElement {
|
537 |
+
public function __construct() {
|
538 |
+
parent::__construct();
|
539 |
+
}
|
540 |
+
|
541 |
+
public function isBufferBox() {
|
542 |
+
return FALSE;
|
543 |
+
}
|
544 |
+
public function isBufferText() {
|
545 |
+
return TRUE;
|
546 |
+
}
|
547 |
+
}
|
548 |
+
class IRP_BufferBox extends IRP_BufferElement {
|
549 |
+
var $currentBoxWords;
|
550 |
+
var $previousBoxWords;
|
551 |
+
|
552 |
+
public function __construct() {
|
553 |
+
parent::__construct();
|
554 |
+
$this->currentBoxWords=0;
|
555 |
+
$this->previousBoxWords=0;
|
556 |
+
}
|
557 |
+
|
558 |
+
public function isBufferBox() {
|
559 |
+
return TRUE;
|
560 |
+
}
|
561 |
+
public function isBufferText() {
|
562 |
+
return FALSE;
|
563 |
+
}
|
564 |
}
|
includes/classes/ui/Form.php
CHANGED
@@ -1,458 +1,458 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
-
|
5 |
-
class IRP_Form {
|
6 |
-
var $prefix='Form';
|
7 |
-
var $labels=TRUE;
|
8 |
-
var $leftLabels=TRUE;
|
9 |
-
var $newline;
|
10 |
-
var $helps=FALSE;
|
11 |
-
var $selectIdField='id';
|
12 |
-
|
13 |
-
var $tags=FALSE;
|
14 |
-
var $tagNew=FALSE;
|
15 |
-
var $leftTags=FALSE;
|
16 |
-
|
17 |
-
public function __construct() {
|
18 |
-
}
|
19 |
-
|
20 |
-
//args can be a string or an associative array if you want
|
21 |
-
private function getTextArgs($args, $defaults, $excludes=array()) {
|
22 |
-
$result=$args;
|
23 |
-
if(is_string($excludes)) {
|
24 |
-
$excludes=explode(',', $excludes);
|
25 |
-
}
|
26 |
-
if(is_array($result) && count($result)>0) {
|
27 |
-
$result='';
|
28 |
-
foreach($args as $k=>$v) {
|
29 |
-
if(count($excludes)==0 || !in_array($k, $excludes)) {
|
30 |
-
$result.=' '.$k.'="'.$v.'"';
|
31 |
-
}
|
32 |
-
}
|
33 |
-
} elseif(!$args) {
|
34 |
-
$result='';
|
35 |
-
}
|
36 |
-
if(is_array($defaults) && count($defaults)>0) {
|
37 |
-
foreach($defaults as $k=>$v) {
|
38 |
-
if(count($excludes)==0 || !in_array($k, $excludes)) {
|
39 |
-
if(stripos($result, $k.'=')===FALSE) {
|
40 |
-
$result.=' '.$k.'="'.$v.'"';
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
return $result;
|
46 |
-
}
|
47 |
-
|
48 |
-
public function help($name) {
|
49 |
-
global $irp;
|
50 |
-
if(!$this->helps) return;
|
51 |
-
|
52 |
-
$k=$this->prefix.'.'.$name.'.Tooltip';
|
53 |
-
$label=$irp->Lang->L($k);
|
54 |
-
?>
|
55 |
-
<img src="<?php echo IRP_PLUGIN_IMAGES.'question-mark.png'?>" class="irp-help" id="<?php echo $name?>-help" alt="<?php echo esc_attr($label)?>" />
|
56 |
-
<?php
|
57 |
-
}
|
58 |
-
public function label($name, $args='') {
|
59 |
-
global $irp;
|
60 |
-
$defaults=array('class'=>'');
|
61 |
-
$otherText=$this->getTextArgs($args, $defaults, array('label', 'id'));
|
62 |
-
|
63 |
-
$k=$this->prefix.'.'.$name;
|
64 |
-
if(!is_array($args)) {
|
65 |
-
$args=array();
|
66 |
-
}
|
67 |
-
if(isset($args['label']) && $args['label']) {
|
68 |
-
$k=$args['label'];
|
69 |
-
}
|
70 |
-
$label=$irp->Lang->L($k);
|
71 |
-
$for=(isset($args['id']) ? $args['id'] : $name);
|
72 |
-
|
73 |
-
//check if is a mandatory field by checking the .txt language file
|
74 |
-
$k=$this->prefix.'.'.$name.'.check';
|
75 |
-
if($irp->Lang->H($k)) {
|
76 |
-
$label.=' (*)';
|
77 |
-
}
|
78 |
-
|
79 |
-
$aClass='';
|
80 |
-
?>
|
81 |
-
<label for="<?php echo $for?>" <?php echo $otherText?> >
|
82 |
-
<?php if($this->leftTags) {
|
83 |
-
$this->tag();
|
84 |
-
}?>
|
85 |
-
<span style="float:left; margin-right:5px;" class="<?php echo $aClass?>" id="<?PHP echo $for?>Label"><?php echo $label?></span>
|
86 |
-
<?php if(!$this->leftTags) {
|
87 |
-
$this->tag();
|
88 |
-
}?>
|
89 |
-
</label>
|
90 |
-
<?php }
|
91 |
-
|
92 |
-
public function leftInput($name, $args='') {
|
93 |
-
if(!$this->labels) return;
|
94 |
-
|
95 |
-
if($this->leftLabels) {
|
96 |
-
$this->help($name);
|
97 |
-
$this->label($name, $args);
|
98 |
-
}
|
99 |
-
|
100 |
-
if($this->newline) {
|
101 |
-
$this->newline();
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
public function newline() {
|
106 |
-
?><div class="irp-form-newline"></div><?php
|
107 |
-
}
|
108 |
-
|
109 |
-
public function rightInput($name, $args='') {
|
110 |
-
if(!$this->labels) return;
|
111 |
-
if (!$this->leftLabels) {
|
112 |
-
$this->label($name, $args);
|
113 |
-
}
|
114 |
-
$this->newline();
|
115 |
-
}
|
116 |
-
|
117 |
-
public function formStarts($method='post', $action='', $args=NULL) {
|
118 |
-
//$defaults=array('style'=>'margin:1em 0; padding:1px 1em; background:#fff; border:1px solid #ccc;'
|
119 |
-
$defaults=array('class'=>'irp-form');
|
120 |
-
$other=$this->getTextArgs($args, $defaults);
|
121 |
-
?>
|
122 |
-
<form method="<?php echo $method?>" action="<?php echo $action?>" <?php echo $other?> >
|
123 |
-
<?php }
|
124 |
-
|
125 |
-
public function formEnds($clearfix = true) { ?>
|
126 |
-
</form>
|
127 |
-
<?php if ($clearfix == true) : ?>
|
128 |
-
<div style="clear:both;"></div>
|
129 |
-
<?php
|
130 |
-
endif;
|
131 |
-
}
|
132 |
-
|
133 |
-
public function divStarts($args=array()) {
|
134 |
-
$defaults=array();
|
135 |
-
$other=$this->getTextArgs($args, $defaults);
|
136 |
-
?>
|
137 |
-
<div <?php echo $other?>>
|
138 |
-
<?php }
|
139 |
-
public function divEnds() { ?>
|
140 |
-
</div>
|
141 |
-
<div style="clear:both;"></div>
|
142 |
-
<?php }
|
143 |
-
|
144 |
-
public function p($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
|
145 |
-
global $irp;
|
146 |
-
?>
|
147 |
-
<p style="font-weight:bold;">
|
148 |
-
<?php
|
149 |
-
$irp->Lang->P($message, $v1, $v2, $v3, $v4, $v5);
|
150 |
-
if($irp->Lang->H($message.'Subtitle')) { ?>
|
151 |
-
<br/>
|
152 |
-
<span style="font-weight:normal;">
|
153 |
-
<i><?php $irp->Lang->P($message.'Subtitle', $v1, $v2, $v3, $v4, $v5)?></i>
|
154 |
-
</span>
|
155 |
-
<?php } ?>
|
156 |
-
</p>
|
157 |
-
<?php }
|
158 |
-
|
159 |
-
public function textarea($name, $value='', $args=NULL) {
|
160 |
-
if(is_array($value) && isset($value[$name])) {
|
161 |
-
$value=$value[$name];
|
162 |
-
}
|
163 |
-
$defaults=array('rows'=>10, 'class'=>'irp-textarea');
|
164 |
-
$other=$this->getTextArgs($args, $defaults);
|
165 |
-
|
166 |
-
$args=array('class'=>'irp-label', 'style'=>'width:auto;');
|
167 |
-
$this->newline=TRUE;
|
168 |
-
$this->leftInput($name, $args);
|
169 |
-
?>
|
170 |
-
<textarea dir="ltr" dirname="ltr" id="<?php echo $name ?>" name="<?php echo $name?>" <?php echo $other?> ><?php echo $value ?></textarea>
|
171 |
-
<?php
|
172 |
-
$this->newline=FALSE;
|
173 |
-
$this->rightInput($name, $args);
|
174 |
-
}
|
175 |
-
|
176 |
-
public function number($name, $value='', $options=NULL) {
|
177 |
-
if(!$options) {
|
178 |
-
$options=array();
|
179 |
-
}
|
180 |
-
$options['type']='number';
|
181 |
-
$options['autocomplete']='off';
|
182 |
-
$options['style']='width:100px;';
|
183 |
-
if(!isset($options['min'])) {
|
184 |
-
$options['min']=0;
|
185 |
-
}
|
186 |
-
//if(!isset($options['step'])) {
|
187 |
-
// $options['step']=1;
|
188 |
-
//}
|
189 |
-
return $this->text($name, $value, $options);
|
190 |
-
}
|
191 |
-
public function text($name, $value='', $options=NULL) {
|
192 |
-
if(is_array($value) && isset($value[$name])) {
|
193 |
-
$value=$value[$name];
|
194 |
-
}
|
195 |
-
$type='text';
|
196 |
-
if(isset($options['type'])) {
|
197 |
-
$type=$options['type'];
|
198 |
-
}
|
199 |
-
$defaults=array('class'=>'irp-'.$type);
|
200 |
-
$other=$this->getTextArgs($options, $defaults, 'type');
|
201 |
-
|
202 |
-
$args=array('class'=>'irp-label');
|
203 |
-
$this->leftInput($name, $args);
|
204 |
-
?>
|
205 |
-
<input type="<?php echo $type?>" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
|
206 |
-
<?php
|
207 |
-
$this->rightInput($name, $args);
|
208 |
-
}
|
209 |
-
|
210 |
-
public function hidden($name, $value='', $args=NULL) {
|
211 |
-
if(is_array($value) && isset($value[$name])) {
|
212 |
-
$value=$value[$name];
|
213 |
-
}
|
214 |
-
$defaults=array();
|
215 |
-
$other=$this->getTextArgs($args, $defaults);
|
216 |
-
?>
|
217 |
-
<input type="hidden" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
|
218 |
-
<?php }
|
219 |
-
|
220 |
-
public function nonce($action=-1, $name='_wpnonce', $referer=true, $echo=true) {
|
221 |
-
wp_nonce_field($action, $name, $referer, $echo);
|
222 |
-
}
|
223 |
-
|
224 |
-
public function colorSelect($name, $value, $options, $multiple=FALSE, $args=NULL) {
|
225 |
-
$array=array();
|
226 |
-
foreach($options as $k=>$v) {
|
227 |
-
$color=(isset($v['color']) ? $v['color'] : '');
|
228 |
-
$fontColor=(isset($v['fontColor']) ? $v['fontColor'] : 'white');
|
229 |
-
$style='';
|
230 |
-
if($color!='') {
|
231 |
-
if($style!='') {
|
232 |
-
$style.='; ';
|
233 |
-
}
|
234 |
-
$style.='background-color:'.$color;
|
235 |
-
}
|
236 |
-
if($fontColor!='') {
|
237 |
-
if($style!='') {
|
238 |
-
$style.='; ';
|
239 |
-
}
|
240 |
-
$style.='color:'.$fontColor.'; font-weight:bold';
|
241 |
-
}
|
242 |
-
$v['id']=$color;
|
243 |
-
$v['name']=$k;
|
244 |
-
$v['style']=$style;
|
245 |
-
$array[]=$v;
|
246 |
-
}
|
247 |
-
if($args) {
|
248 |
-
$args=array();
|
249 |
-
}
|
250 |
-
$args['class']='irpColorSelect';
|
251 |
-
return $this->select($name, $value, $array, $multiple, $args);
|
252 |
-
}
|
253 |
-
public function select($name, $value, $options, $multiple=FALSE, $args=NULL) {
|
254 |
-
global $irp;
|
255 |
-
if(is_array($value) && isset($value[$name])) {
|
256 |
-
$value=$value[$name];
|
257 |
-
}
|
258 |
-
$defaults=array('class'=>'irp-select');
|
259 |
-
$other=$this->getTextArgs($args, $defaults);
|
260 |
-
|
261 |
-
if(!is_array($value)) {
|
262 |
-
$value=array($value);
|
263 |
-
}
|
264 |
-
if(is_string($options)) {
|
265 |
-
$options=explode(',', $options);
|
266 |
-
}
|
267 |
-
if(is_array($options) && count($options)>0) {
|
268 |
-
if(is_string($options[0]) || !isset($options[0][$this->selectIdField])) {
|
269 |
-
//this is a normal array so I use the values for "id" field and the "name" into the txt file
|
270 |
-
$temp=array();
|
271 |
-
foreach($options as $v) {
|
272 |
-
$item=array();
|
273 |
-
$item[$this->selectIdField]=$v;
|
274 |
-
$item['name']=$v;
|
275 |
-
if($irp->Lang->H($this->prefix.'.'.$name.'.'.$v)) {
|
276 |
-
$item['name']=$irp->Lang->L($this->prefix.'.'.$name.'.'.$v);
|
277 |
-
}
|
278 |
-
$temp[]=$item;
|
279 |
-
}
|
280 |
-
$options=$temp;
|
281 |
-
}
|
282 |
-
}
|
283 |
-
|
284 |
-
$args=array('class'=>'irp-label');
|
285 |
-
$this->leftInput($name, $args);
|
286 |
-
?>
|
287 |
-
<select id="<?php echo $name ?>" name="<?php echo $name?><?php echo ($multiple ? '[]' : '')?>" <?php echo ($multiple ? 'multiple' : '')?> <?php echo $other?> >
|
288 |
-
<?php
|
289 |
-
foreach($options as $v) {
|
290 |
-
$style='';
|
291 |
-
if(isset($v['style'])) {
|
292 |
-
$style=$v['style'];
|
293 |
-
}
|
294 |
-
|
295 |
-
$selected='';
|
296 |
-
if(in_array($v[$this->selectIdField], $value)) {
|
297 |
-
$selected=' selected="selected"';
|
298 |
-
}
|
299 |
-
?>
|
300 |
-
<option value="<?php echo $v[$this->selectIdField]?>" <?php echo $selected?> style="<?php echo $style?>"><?php echo $v['name']?></option>
|
301 |
-
<?php } ?>
|
302 |
-
</select>
|
303 |
-
<?php
|
304 |
-
$this->rightInput($name, $args);
|
305 |
-
}
|
306 |
-
|
307 |
-
public function submit($value='', $args=NULL) {
|
308 |
-
global $irp;
|
309 |
-
$defaults=array();
|
310 |
-
$other=$this->getTextArgs($args, $defaults);
|
311 |
-
if($value=='') {
|
312 |
-
$value='Send';
|
313 |
-
}
|
314 |
-
$this->newline();
|
315 |
-
?>
|
316 |
-
<input type="submit" class="button-primary irp-button irp-submit" value="<?php $irp->Lang->P($value)?>" <?php echo $other?>/>
|
317 |
-
<?php }
|
318 |
-
|
319 |
-
public function delete($id, $action='delete', $args=NULL) {
|
320 |
-
global $irp;
|
321 |
-
$defaults=array();
|
322 |
-
$other=$this->getTextArgs($args, $defaults);
|
323 |
-
?>
|
324 |
-
<input type="button" class="button irp-button" value="<?php $irp->Lang->P('Delete?')?>" onclick="if (confirm('<?php $irp->Lang->P('Are you sure you want to delete?')?>') ) window.location='<?php echo IRP_TAB_BUILDER_URI?>&action=<?php echo $action?>&id=<?php echo $id ?>&irp_nonce=<?php echo esc_attr(wp_create_nonce('irp_delete')); ?>';" <?php echo $other?> />
|
325 |
-
|
326 |
-
<?php
|
327 |
-
}
|
328 |
-
|
329 |
-
public function radio($name, $current=1, $value=1, $args=NULL) {
|
330 |
-
if(!is_array($args)) {
|
331 |
-
$args=array();
|
332 |
-
}
|
333 |
-
$args['radio']=TRUE;
|
334 |
-
$args['id']=$name.'_'.$value;
|
335 |
-
return $this->checkbox($name, $current, $value, $args);
|
336 |
-
}
|
337 |
-
public function checkbox($name, $current=1, $value=1, $args=NULL) {
|
338 |
-
global $irp;
|
339 |
-
if(is_array($current) && isset($current[$name])) {
|
340 |
-
$current=$current[$name];
|
341 |
-
}
|
342 |
-
|
343 |
-
/*
|
344 |
-
$defaults=array('class'=>'irp-checkbox', 'style'=>'margin:0px; margin-right:4px;');
|
345 |
-
if($this->premium && !$irp->License->hasPremium()) {
|
346 |
-
$defaults['disabled']='disabled';
|
347 |
-
$value='';
|
348 |
-
}
|
349 |
-
*/
|
350 |
-
if(!is_array($args)) {
|
351 |
-
$args=array();
|
352 |
-
}
|
353 |
-
|
354 |
-
$label=$name;
|
355 |
-
$type='checkbox';
|
356 |
-
if(isset($args['radio']) && $args['radio']) {
|
357 |
-
$type='radio';
|
358 |
-
$label.='_'.$value;
|
359 |
-
}
|
360 |
-
|
361 |
-
$defaults=array(
|
362 |
-
'class'=>'irp-checkbox'
|
363 |
-
, 'style'=>'margin:0px; margin-right:4px;'
|
364 |
-
, 'id'=>$name
|
365 |
-
);
|
366 |
-
$other=$this->getTextArgs($args, $defaults, 'radio,label,type');
|
367 |
-
$prev=$this->leftLabels;
|
368 |
-
$this->leftLabels=FALSE;
|
369 |
-
|
370 |
-
$label=(isset($args['label']) ? $args['label'] : $this->prefix.'.'.$label);
|
371 |
-
$id=(isset($args['id']) ? $args['id'] : $name);
|
372 |
-
$args=array(
|
373 |
-
'class'=>''
|
374 |
-
, 'style'=>'margin-top:-1px;'
|
375 |
-
, 'label'=>$label
|
376 |
-
, 'id'=>$id
|
377 |
-
);
|
378 |
-
$this->leftInput($name, $args);
|
379 |
-
?>
|
380 |
-
<input type="<?php echo $type ?>" name="<?php echo $name?>" value="<?php echo $value?>" <?php echo($current==$value ? 'checked="checked"' : '') ?> <?php echo $other?> >
|
381 |
-
<?php
|
382 |
-
$this->rightInput($name, $args);
|
383 |
-
$this->leftLabels=$prev;
|
384 |
-
}
|
385 |
-
|
386 |
-
public function checkText($nameActive, $nameText, $value) {
|
387 |
-
global $irp;
|
388 |
-
|
389 |
-
$args=array('class'=>'irp-hideShow irp-checkbox'
|
390 |
-
, 'irp-hideIfTrue'=>'false'
|
391 |
-
, 'irp-hideShow'=>$nameText.'Text');
|
392 |
-
$this->checkbox($nameActive, $value, 1, $args);
|
393 |
-
?>
|
394 |
-
<div id="<?php echo $nameText?>Text" style="float:left;">
|
395 |
-
<?php
|
396 |
-
$prev=$this->labels;
|
397 |
-
$this->labels=FALSE;
|
398 |
-
$args=array();
|
399 |
-
$this->text($nameText, $value, $args);
|
400 |
-
$this->labels=$prev;
|
401 |
-
?>
|
402 |
-
</div>
|
403 |
-
<?php }
|
404 |
-
|
405 |
-
//create a checkbox with a left select visible only when the checkbox is selected
|
406 |
-
public function checkSelect($nameActive, $nameArray, $value, $values) {
|
407 |
-
global $irp;
|
408 |
-
?>
|
409 |
-
<div id="<?php echo $nameArray?>Box" style="float:left;">
|
410 |
-
<?php
|
411 |
-
$args=array('class'=>'irp-hideShow irp-checkbox'
|
412 |
-
, 'irp-hideIfTrue'=>'false'
|
413 |
-
, 'irp-hideShow'=>$nameArray.'Tags');
|
414 |
-
$this->checkbox($nameActive, $value, 1, $args);
|
415 |
-
if(TRUE) { ?>
|
416 |
-
<div id="<?php echo $nameArray?>Tags" style="float:left;">
|
417 |
-
<?php
|
418 |
-
$prev=$this->labels;
|
419 |
-
$this->labels=FALSE;
|
420 |
-
$args=array('class'=>'irp-select irpLineTags');
|
421 |
-
$this->select($nameArray, $value, $values, TRUE, $args);
|
422 |
-
$this->labels=$prev;
|
423 |
-
?>
|
424 |
-
</div>
|
425 |
-
<?php } ?>
|
426 |
-
</div>
|
427 |
-
<?php
|
428 |
-
$this->newline();
|
429 |
-
}
|
430 |
-
|
431 |
-
public function br() { ?>
|
432 |
-
<br/>
|
433 |
-
<?php }
|
434 |
-
public function tag($overridePremium=FALSE) {
|
435 |
-
global $irp;
|
436 |
-
/*
|
437 |
-
$premium=($overridePremium || $this->premium);
|
438 |
-
if((!$overridePremium && !$this->tags) || $irp->License->hasPremium() || ($this->onlyPremium && !$premium)) return;
|
439 |
-
|
440 |
-
$tagClass='irp-tag-free';
|
441 |
-
$tagText='FREE';
|
442 |
-
if($premium) {
|
443 |
-
$tagClass='irp-tag-premium';
|
444 |
-
$tagText='<a href="'.irp_PAGE_PREMIUM.'" target="_new">PRO</a>';
|
445 |
-
}
|
446 |
-
*/
|
447 |
-
|
448 |
-
if(!$this->tags || !$this->tagNew) {
|
449 |
-
return;
|
450 |
-
}
|
451 |
-
|
452 |
-
$tagClass='irp-tag-free';
|
453 |
-
$tagText='NEW!';
|
454 |
-
?>
|
455 |
-
<div style="float:left;" class="irp-tag <?php echo $tagClass?>"><?php echo $tagText?></div>
|
456 |
-
<?php
|
457 |
-
}
|
458 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
+
|
5 |
+
class IRP_Form {
|
6 |
+
var $prefix='Form';
|
7 |
+
var $labels=TRUE;
|
8 |
+
var $leftLabels=TRUE;
|
9 |
+
var $newline;
|
10 |
+
var $helps=FALSE;
|
11 |
+
var $selectIdField='id';
|
12 |
+
|
13 |
+
var $tags=FALSE;
|
14 |
+
var $tagNew=FALSE;
|
15 |
+
var $leftTags=FALSE;
|
16 |
+
|
17 |
+
public function __construct() {
|
18 |
+
}
|
19 |
+
|
20 |
+
//args can be a string or an associative array if you want
|
21 |
+
private function getTextArgs($args, $defaults, $excludes=array()) {
|
22 |
+
$result=$args;
|
23 |
+
if(is_string($excludes)) {
|
24 |
+
$excludes=explode(',', $excludes);
|
25 |
+
}
|
26 |
+
if(is_array($result) && count($result)>0) {
|
27 |
+
$result='';
|
28 |
+
foreach($args as $k=>$v) {
|
29 |
+
if(count($excludes)==0 || !in_array($k, $excludes)) {
|
30 |
+
$result.=' '.$k.'="'.$v.'"';
|
31 |
+
}
|
32 |
+
}
|
33 |
+
} elseif(!$args) {
|
34 |
+
$result='';
|
35 |
+
}
|
36 |
+
if(is_array($defaults) && count($defaults)>0) {
|
37 |
+
foreach($defaults as $k=>$v) {
|
38 |
+
if(count($excludes)==0 || !in_array($k, $excludes)) {
|
39 |
+
if(stripos($result, $k.'=')===FALSE) {
|
40 |
+
$result.=' '.$k.'="'.$v.'"';
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
return $result;
|
46 |
+
}
|
47 |
+
|
48 |
+
public function help($name) {
|
49 |
+
global $irp;
|
50 |
+
if(!$this->helps) return;
|
51 |
+
|
52 |
+
$k=$this->prefix.'.'.$name.'.Tooltip';
|
53 |
+
$label=$irp->Lang->L($k);
|
54 |
+
?>
|
55 |
+
<img src="<?php echo IRP_PLUGIN_IMAGES.'question-mark.png'?>" class="irp-help" id="<?php echo $name?>-help" alt="<?php echo esc_attr($label)?>" />
|
56 |
+
<?php
|
57 |
+
}
|
58 |
+
public function label($name, $args='') {
|
59 |
+
global $irp;
|
60 |
+
$defaults=array('class'=>'');
|
61 |
+
$otherText=$this->getTextArgs($args, $defaults, array('label', 'id'));
|
62 |
+
|
63 |
+
$k=$this->prefix.'.'.$name;
|
64 |
+
if(!is_array($args)) {
|
65 |
+
$args=array();
|
66 |
+
}
|
67 |
+
if(isset($args['label']) && $args['label']) {
|
68 |
+
$k=$args['label'];
|
69 |
+
}
|
70 |
+
$label=$irp->Lang->L($k);
|
71 |
+
$for=(isset($args['id']) ? $args['id'] : $name);
|
72 |
+
|
73 |
+
//check if is a mandatory field by checking the .txt language file
|
74 |
+
$k=$this->prefix.'.'.$name.'.check';
|
75 |
+
if($irp->Lang->H($k)) {
|
76 |
+
$label.=' (*)';
|
77 |
+
}
|
78 |
+
|
79 |
+
$aClass='';
|
80 |
+
?>
|
81 |
+
<label for="<?php echo $for?>" <?php echo $otherText?> >
|
82 |
+
<?php if($this->leftTags) {
|
83 |
+
$this->tag();
|
84 |
+
}?>
|
85 |
+
<span style="float:left; margin-right:5px;" class="<?php echo $aClass?>" id="<?PHP echo $for?>Label"><?php echo $label?></span>
|
86 |
+
<?php if(!$this->leftTags) {
|
87 |
+
$this->tag();
|
88 |
+
}?>
|
89 |
+
</label>
|
90 |
+
<?php }
|
91 |
+
|
92 |
+
public function leftInput($name, $args='') {
|
93 |
+
if(!$this->labels) return;
|
94 |
+
|
95 |
+
if($this->leftLabels) {
|
96 |
+
$this->help($name);
|
97 |
+
$this->label($name, $args);
|
98 |
+
}
|
99 |
+
|
100 |
+
if($this->newline) {
|
101 |
+
$this->newline();
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
public function newline() {
|
106 |
+
?><div class="irp-form-newline"></div><?php
|
107 |
+
}
|
108 |
+
|
109 |
+
public function rightInput($name, $args='') {
|
110 |
+
if(!$this->labels) return;
|
111 |
+
if (!$this->leftLabels) {
|
112 |
+
$this->label($name, $args);
|
113 |
+
}
|
114 |
+
$this->newline();
|
115 |
+
}
|
116 |
+
|
117 |
+
public function formStarts($method='post', $action='', $args=NULL) {
|
118 |
+
//$defaults=array('style'=>'margin:1em 0; padding:1px 1em; background:#fff; border:1px solid #ccc;'
|
119 |
+
$defaults=array('class'=>'irp-form');
|
120 |
+
$other=$this->getTextArgs($args, $defaults);
|
121 |
+
?>
|
122 |
+
<form method="<?php echo $method?>" action="<?php echo $action?>" <?php echo $other?> >
|
123 |
+
<?php }
|
124 |
+
|
125 |
+
public function formEnds($clearfix = true) { ?>
|
126 |
+
</form>
|
127 |
+
<?php if ($clearfix == true) : ?>
|
128 |
+
<div style="clear:both;"></div>
|
129 |
+
<?php
|
130 |
+
endif;
|
131 |
+
}
|
132 |
+
|
133 |
+
public function divStarts($args=array()) {
|
134 |
+
$defaults=array();
|
135 |
+
$other=$this->getTextArgs($args, $defaults);
|
136 |
+
?>
|
137 |
+
<div <?php echo $other?>>
|
138 |
+
<?php }
|
139 |
+
public function divEnds() { ?>
|
140 |
+
</div>
|
141 |
+
<div style="clear:both;"></div>
|
142 |
+
<?php }
|
143 |
+
|
144 |
+
public function p($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
|
145 |
+
global $irp;
|
146 |
+
?>
|
147 |
+
<p style="font-weight:bold;">
|
148 |
+
<?php
|
149 |
+
$irp->Lang->P($message, $v1, $v2, $v3, $v4, $v5);
|
150 |
+
if($irp->Lang->H($message.'Subtitle')) { ?>
|
151 |
+
<br/>
|
152 |
+
<span style="font-weight:normal;">
|
153 |
+
<i><?php $irp->Lang->P($message.'Subtitle', $v1, $v2, $v3, $v4, $v5)?></i>
|
154 |
+
</span>
|
155 |
+
<?php } ?>
|
156 |
+
</p>
|
157 |
+
<?php }
|
158 |
+
|
159 |
+
public function textarea($name, $value='', $args=NULL) {
|
160 |
+
if(is_array($value) && isset($value[$name])) {
|
161 |
+
$value=$value[$name];
|
162 |
+
}
|
163 |
+
$defaults=array('rows'=>10, 'class'=>'irp-textarea');
|
164 |
+
$other=$this->getTextArgs($args, $defaults);
|
165 |
+
|
166 |
+
$args=array('class'=>'irp-label', 'style'=>'width:auto;');
|
167 |
+
$this->newline=TRUE;
|
168 |
+
$this->leftInput($name, $args);
|
169 |
+
?>
|
170 |
+
<textarea dir="ltr" dirname="ltr" id="<?php echo $name ?>" name="<?php echo $name?>" <?php echo $other?> ><?php echo $value ?></textarea>
|
171 |
+
<?php
|
172 |
+
$this->newline=FALSE;
|
173 |
+
$this->rightInput($name, $args);
|
174 |
+
}
|
175 |
+
|
176 |
+
public function number($name, $value='', $options=NULL) {
|
177 |
+
if(!$options) {
|
178 |
+
$options=array();
|
179 |
+
}
|
180 |
+
$options['type']='number';
|
181 |
+
$options['autocomplete']='off';
|
182 |
+
$options['style']='width:100px;';
|
183 |
+
if(!isset($options['min'])) {
|
184 |
+
$options['min']=0;
|
185 |
+
}
|
186 |
+
//if(!isset($options['step'])) {
|
187 |
+
// $options['step']=1;
|
188 |
+
//}
|
189 |
+
return $this->text($name, $value, $options);
|
190 |
+
}
|
191 |
+
public function text($name, $value='', $options=NULL) {
|
192 |
+
if(is_array($value) && isset($value[$name])) {
|
193 |
+
$value=$value[$name];
|
194 |
+
}
|
195 |
+
$type='text';
|
196 |
+
if(isset($options['type'])) {
|
197 |
+
$type=$options['type'];
|
198 |
+
}
|
199 |
+
$defaults=array('class'=>'irp-'.$type);
|
200 |
+
$other=$this->getTextArgs($options, $defaults, 'type');
|
201 |
+
|
202 |
+
$args=array('class'=>'irp-label');
|
203 |
+
$this->leftInput($name, $args);
|
204 |
+
?>
|
205 |
+
<input type="<?php echo $type?>" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
|
206 |
+
<?php
|
207 |
+
$this->rightInput($name, $args);
|
208 |
+
}
|
209 |
+
|
210 |
+
public function hidden($name, $value='', $args=NULL) {
|
211 |
+
if(is_array($value) && isset($value[$name])) {
|
212 |
+
$value=$value[$name];
|
213 |
+
}
|
214 |
+
$defaults=array();
|
215 |
+
$other=$this->getTextArgs($args, $defaults);
|
216 |
+
?>
|
217 |
+
<input type="hidden" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
|
218 |
+
<?php }
|
219 |
+
|
220 |
+
public function nonce($action=-1, $name='_wpnonce', $referer=true, $echo=true) {
|
221 |
+
wp_nonce_field($action, $name, $referer, $echo);
|
222 |
+
}
|
223 |
+
|
224 |
+
public function colorSelect($name, $value, $options, $multiple=FALSE, $args=NULL) {
|
225 |
+
$array=array();
|
226 |
+
foreach($options as $k=>$v) {
|
227 |
+
$color=(isset($v['color']) ? $v['color'] : '');
|
228 |
+
$fontColor=(isset($v['fontColor']) ? $v['fontColor'] : 'white');
|
229 |
+
$style='';
|
230 |
+
if($color!='') {
|
231 |
+
if($style!='') {
|
232 |
+
$style.='; ';
|
233 |
+
}
|
234 |
+
$style.='background-color:'.$color;
|
235 |
+
}
|
236 |
+
if($fontColor!='') {
|
237 |
+
if($style!='') {
|
238 |
+
$style.='; ';
|
239 |
+
}
|
240 |
+
$style.='color:'.$fontColor.'; font-weight:bold';
|
241 |
+
}
|
242 |
+
$v['id']=$color;
|
243 |
+
$v['name']=$k;
|
244 |
+
$v['style']=$style;
|
245 |
+
$array[]=$v;
|
246 |
+
}
|
247 |
+
if($args) {
|
248 |
+
$args=array();
|
249 |
+
}
|
250 |
+
$args['class']='irpColorSelect';
|
251 |
+
return $this->select($name, $value, $array, $multiple, $args);
|
252 |
+
}
|
253 |
+
public function select($name, $value, $options, $multiple=FALSE, $args=NULL) {
|
254 |
+
global $irp;
|
255 |
+
if(is_array($value) && isset($value[$name])) {
|
256 |
+
$value=$value[$name];
|
257 |
+
}
|
258 |
+
$defaults=array('class'=>'irp-select');
|
259 |
+
$other=$this->getTextArgs($args, $defaults);
|
260 |
+
|
261 |
+
if(!is_array($value)) {
|
262 |
+
$value=array($value);
|
263 |
+
}
|
264 |
+
if(is_string($options)) {
|
265 |
+
$options=explode(',', $options);
|
266 |
+
}
|
267 |
+
if(is_array($options) && count($options)>0) {
|
268 |
+
if(is_string($options[0]) || !isset($options[0][$this->selectIdField])) {
|
269 |
+
//this is a normal array so I use the values for "id" field and the "name" into the txt file
|
270 |
+
$temp=array();
|
271 |
+
foreach($options as $v) {
|
272 |
+
$item=array();
|
273 |
+
$item[$this->selectIdField]=$v;
|
274 |
+
$item['name']=$v;
|
275 |
+
if($irp->Lang->H($this->prefix.'.'.$name.'.'.$v)) {
|
276 |
+
$item['name']=$irp->Lang->L($this->prefix.'.'.$name.'.'.$v);
|
277 |
+
}
|
278 |
+
$temp[]=$item;
|
279 |
+
}
|
280 |
+
$options=$temp;
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
$args=array('class'=>'irp-label');
|
285 |
+
$this->leftInput($name, $args);
|
286 |
+
?>
|
287 |
+
<select id="<?php echo $name ?>" name="<?php echo $name?><?php echo ($multiple ? '[]' : '')?>" <?php echo ($multiple ? 'multiple' : '')?> <?php echo $other?> >
|
288 |
+
<?php
|
289 |
+
foreach($options as $v) {
|
290 |
+
$style='';
|
291 |
+
if(isset($v['style'])) {
|
292 |
+
$style=$v['style'];
|
293 |
+
}
|
294 |
+
|
295 |
+
$selected='';
|
296 |
+
if(in_array($v[$this->selectIdField], $value)) {
|
297 |
+
$selected=' selected="selected"';
|
298 |
+
}
|
299 |
+
?>
|
300 |
+
<option value="<?php echo $v[$this->selectIdField]?>" <?php echo $selected?> style="<?php echo $style?>"><?php echo $v['name']?></option>
|
301 |
+
<?php } ?>
|
302 |
+
</select>
|
303 |
+
<?php
|
304 |
+
$this->rightInput($name, $args);
|
305 |
+
}
|
306 |
+
|
307 |
+
public function submit($value='', $args=NULL) {
|
308 |
+
global $irp;
|
309 |
+
$defaults=array();
|
310 |
+
$other=$this->getTextArgs($args, $defaults);
|
311 |
+
if($value=='') {
|
312 |
+
$value='Send';
|
313 |
+
}
|
314 |
+
$this->newline();
|
315 |
+
?>
|
316 |
+
<input type="submit" class="button-primary irp-button irp-submit" value="<?php $irp->Lang->P($value)?>" <?php echo $other?>/>
|
317 |
+
<?php }
|
318 |
+
|
319 |
+
public function delete($id, $action='delete', $args=NULL) {
|
320 |
+
global $irp;
|
321 |
+
$defaults=array();
|
322 |
+
$other=$this->getTextArgs($args, $defaults);
|
323 |
+
?>
|
324 |
+
<input type="button" class="button irp-button" value="<?php $irp->Lang->P('Delete?')?>" onclick="if (confirm('<?php $irp->Lang->P('Are you sure you want to delete?')?>') ) window.location='<?php echo IRP_TAB_BUILDER_URI?>&action=<?php echo $action?>&id=<?php echo $id ?>&irp_nonce=<?php echo esc_attr(wp_create_nonce('irp_delete')); ?>';" <?php echo $other?> />
|
325 |
+
|
326 |
+
<?php
|
327 |
+
}
|
328 |
+
|
329 |
+
public function radio($name, $current=1, $value=1, $args=NULL) {
|
330 |
+
if(!is_array($args)) {
|
331 |
+
$args=array();
|
332 |
+
}
|
333 |
+
$args['radio']=TRUE;
|
334 |
+
$args['id']=$name.'_'.$value;
|
335 |
+
return $this->checkbox($name, $current, $value, $args);
|
336 |
+
}
|
337 |
+
public function checkbox($name, $current=1, $value=1, $args=NULL) {
|
338 |
+
global $irp;
|
339 |
+
if(is_array($current) && isset($current[$name])) {
|
340 |
+
$current=$current[$name];
|
341 |
+
}
|
342 |
+
|
343 |
+
/*
|
344 |
+
$defaults=array('class'=>'irp-checkbox', 'style'=>'margin:0px; margin-right:4px;');
|
345 |
+
if($this->premium && !$irp->License->hasPremium()) {
|
346 |
+
$defaults['disabled']='disabled';
|
347 |
+
$value='';
|
348 |
+
}
|
349 |
+
*/
|
350 |
+
if(!is_array($args)) {
|
351 |
+
$args=array();
|
352 |
+
}
|
353 |
+
|
354 |
+
$label=$name;
|
355 |
+
$type='checkbox';
|
356 |
+
if(isset($args['radio']) && $args['radio']) {
|
357 |
+
$type='radio';
|
358 |
+
$label.='_'.$value;
|
359 |
+
}
|
360 |
+
|
361 |
+
$defaults=array(
|
362 |
+
'class'=>'irp-checkbox'
|
363 |
+
, 'style'=>'margin:0px; margin-right:4px;'
|
364 |
+
, 'id'=>$name
|
365 |
+
);
|
366 |
+
$other=$this->getTextArgs($args, $defaults, 'radio,label,type');
|
367 |
+
$prev=$this->leftLabels;
|
368 |
+
$this->leftLabels=FALSE;
|
369 |
+
|
370 |
+
$label=(isset($args['label']) ? $args['label'] : $this->prefix.'.'.$label);
|
371 |
+
$id=(isset($args['id']) ? $args['id'] : $name);
|
372 |
+
$args=array(
|
373 |
+
'class'=>''
|
374 |
+
, 'style'=>'margin-top:-1px;'
|
375 |
+
, 'label'=>$label
|
376 |
+
, 'id'=>$id
|
377 |
+
);
|
378 |
+
$this->leftInput($name, $args);
|
379 |
+
?>
|
380 |
+
<input type="<?php echo $type ?>" name="<?php echo $name?>" value="<?php echo $value?>" <?php echo($current==$value ? 'checked="checked"' : '') ?> <?php echo $other?> >
|
381 |
+
<?php
|
382 |
+
$this->rightInput($name, $args);
|
383 |
+
$this->leftLabels=$prev;
|
384 |
+
}
|
385 |
+
|
386 |
+
public function checkText($nameActive, $nameText, $value) {
|
387 |
+
global $irp;
|
388 |
+
|
389 |
+
$args=array('class'=>'irp-hideShow irp-checkbox'
|
390 |
+
, 'irp-hideIfTrue'=>'false'
|
391 |
+
, 'irp-hideShow'=>$nameText.'Text');
|
392 |
+
$this->checkbox($nameActive, $value, 1, $args);
|
393 |
+
?>
|
394 |
+
<div id="<?php echo $nameText?>Text" style="float:left;">
|
395 |
+
<?php
|
396 |
+
$prev=$this->labels;
|
397 |
+
$this->labels=FALSE;
|
398 |
+
$args=array();
|
399 |
+
$this->text($nameText, $value, $args);
|
400 |
+
$this->labels=$prev;
|
401 |
+
?>
|
402 |
+
</div>
|
403 |
+
<?php }
|
404 |
+
|
405 |
+
//create a checkbox with a left select visible only when the checkbox is selected
|
406 |
+
public function checkSelect($nameActive, $nameArray, $value, $values) {
|
407 |
+
global $irp;
|
408 |
+
?>
|
409 |
+
<div id="<?php echo $nameArray?>Box" style="float:left;">
|
410 |
+
<?php
|
411 |
+
$args=array('class'=>'irp-hideShow irp-checkbox'
|
412 |
+
, 'irp-hideIfTrue'=>'false'
|
413 |
+
, 'irp-hideShow'=>$nameArray.'Tags');
|
414 |
+
$this->checkbox($nameActive, $value, 1, $args);
|
415 |
+
if(TRUE) { ?>
|
416 |
+
<div id="<?php echo $nameArray?>Tags" style="float:left;">
|
417 |
+
<?php
|
418 |
+
$prev=$this->labels;
|
419 |
+
$this->labels=FALSE;
|
420 |
+
$args=array('class'=>'irp-select irpLineTags');
|
421 |
+
$this->select($nameArray, $value, $values, TRUE, $args);
|
422 |
+
$this->labels=$prev;
|
423 |
+
?>
|
424 |
+
</div>
|
425 |
+
<?php } ?>
|
426 |
+
</div>
|
427 |
+
<?php
|
428 |
+
$this->newline();
|
429 |
+
}
|
430 |
+
|
431 |
+
public function br() { ?>
|
432 |
+
<br/>
|
433 |
+
<?php }
|
434 |
+
public function tag($overridePremium=FALSE) {
|
435 |
+
global $irp;
|
436 |
+
/*
|
437 |
+
$premium=($overridePremium || $this->premium);
|
438 |
+
if((!$overridePremium && !$this->tags) || $irp->License->hasPremium() || ($this->onlyPremium && !$premium)) return;
|
439 |
+
|
440 |
+
$tagClass='irp-tag-free';
|
441 |
+
$tagText='FREE';
|
442 |
+
if($premium) {
|
443 |
+
$tagClass='irp-tag-premium';
|
444 |
+
$tagText='<a href="'.irp_PAGE_PREMIUM.'" target="_new">PRO</a>';
|
445 |
+
}
|
446 |
+
*/
|
447 |
+
|
448 |
+
if(!$this->tags || !$this->tagNew) {
|
449 |
+
return;
|
450 |
+
}
|
451 |
+
|
452 |
+
$tagClass='irp-tag-free';
|
453 |
+
$tagText='NEW!';
|
454 |
+
?>
|
455 |
+
<div style="float:left;" class="irp-tag <?php echo $tagClass?>"><?php echo $tagText?></div>
|
456 |
+
<?php
|
457 |
+
}
|
458 |
}
|
includes/classes/ui/Tabs.php
CHANGED
@@ -1,234 +1,243 @@
|
|
1 |
-
<?php
|
2 |
-
class IRP_Tabs {
|
3 |
-
private $tabs = array();
|
4 |
-
|
5 |
-
function init() {
|
6 |
-
global $irp;
|
7 |
-
if($irp->Utils->isAdminUser()) {
|
8 |
-
add_action('admin_menu', array(&$this, 'attachMenu'));
|
9 |
-
add_filter('plugin_action_links', array(&$this, 'pluginActions'), 10, 2);
|
10 |
-
if($irp->Utils->isPluginPage()) {
|
11 |
-
add_action('admin_enqueue_scripts', array(&$this, 'enqueueScripts'));
|
12 |
-
}
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
function attachMenu() {
|
17 |
-
global $irp;
|
18 |
-
|
19 |
-
if(!$irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
20 |
-
$name='Inline Related Posts';
|
21 |
-
add_submenu_page('options-general.php'
|
22 |
-
, $name, $name
|
23 |
-
, 'manage_options', IRP_PLUGIN_SLUG, array(&$this, 'showTabPage'));
|
24 |
-
}
|
25 |
-
}
|
26 |
-
function pluginActions($links, $file) {
|
27 |
-
global $irp;
|
28 |
-
if($file==IRP_PLUGIN_SLUG.'/index.php'){
|
29 |
-
$settings = "<a href='".IRP_PAGE_SETTINGS."'>" . $irp->Lang->L('Settings') . '</a> ';
|
30 |
-
$url=IRP_INTELLYWP_SITE.IRP_PLUGIN_SLUG.'?utm_source=free-users&utm_medium=irp-plugins&utm_campaign=IRP';
|
31 |
-
$premium = "<a href='".$url."' target='_blank'>" . $irp->Lang->L('PREMIUM') . '</a> ';
|
32 |
-
$links = array_merge(array($settings, $premium), $links);
|
33 |
-
}
|
34 |
-
return $links;
|
35 |
-
}
|
36 |
-
function enqueueScripts() {
|
37 |
-
global $irp;
|
38 |
-
wp_enqueue_script('jquery');
|
39 |
-
wp_enqueue_script('suggest');
|
40 |
-
wp_enqueue_script('jquery-ui-autocomplete');
|
41 |
-
|
42 |
-
$uri='//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css';
|
43 |
-
wp_enqueue_style('font-awesome', $uri);
|
44 |
-
|
45 |
-
$this->wpEnqueueStyle('assets/css/style.css');
|
46 |
-
$this->wpEnqueueStyle('assets/deps/select2-3.5.2/select2.css');
|
47 |
-
$this->wpEnqueueScript('assets/deps/select2-3.5.2/select2.min.js');
|
48 |
-
$this->wpEnqueueScript('assets/deps/starrr/starrr.js');
|
49 |
-
|
50 |
-
$this->wpEnqueueScript('assets/deps/qtip/jquery.qtip.min.js');
|
51 |
-
$this->wpEnqueueScript('assets/js/common.js');
|
52 |
-
}
|
53 |
-
function wpEnqueueStyle($uri, $name='') {
|
54 |
-
if($name=='') {
|
55 |
-
$name=explode('/', $uri);
|
56 |
-
$name=$name[count($name)-1];
|
57 |
-
$dot=strrpos($name, '.');
|
58 |
-
if($dot!==FALSE) {
|
59 |
-
$name=substr($name, 0, $dot);
|
60 |
-
}
|
61 |
-
$name=IRP_PLUGIN_PREFIX.'_'.$name;
|
62 |
-
}
|
63 |
-
|
64 |
-
$v='?v='.IRP_PLUGIN_VERSION;
|
65 |
-
wp_enqueue_style($name, IRP_PLUGIN_URI.$uri.$v);
|
66 |
-
}
|
67 |
-
function wpEnqueueScript($uri, $name='', $version=FALSE) {
|
68 |
-
if($name=='') {
|
69 |
-
$name=explode('/', $uri);
|
70 |
-
$name=$name[count($name)-1];
|
71 |
-
$dot=strrpos($name, '.');
|
72 |
-
if($dot!==FALSE) {
|
73 |
-
$name=substr($name, 0, $dot);
|
74 |
-
}
|
75 |
-
$name=IRP_PLUGIN_PREFIX.'_'.$name;
|
76 |
-
}
|
77 |
-
|
78 |
-
$v='?v='.IRP_PLUGIN_VERSION;
|
79 |
-
$deps=array();
|
80 |
-
wp_enqueue_script($name, IRP_PLUGIN_URI.$uri.$v, $deps, $version, FALSE);
|
81 |
-
}
|
82 |
-
|
83 |
-
function showTabPage() {
|
84 |
-
global $irp;
|
85 |
-
|
86 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
87 |
-
$irp->Options->pushWarningMessage('YouHaveThePremiumVersion', IRP_TAB_SETTINGS_URI);
|
88 |
-
$irp->Options->writeMessages();
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
|
92 |
-
$defaultTab=IRP_TAB_SETTINGS;
|
93 |
-
if($irp->Options->isShowWhatsNew()) {
|
94 |
-
$tab=IRP_TAB_WHATS_NEW;
|
95 |
-
$defaultTab=$tab;
|
96 |
-
$this->tabs[IRP_TAB_WHATS_NEW]=$irp->Lang->L('What\'s New');
|
97 |
-
} else {
|
98 |
-
$tab = $irp->Utils->qs('tab', $defaultTab);
|
99 |
-
$this->tabs[IRP_TAB_SETTINGS] = $irp->Lang->L('Settings');
|
100 |
-
$this->tabs[IRP_TAB_DOCS] = $irp->Lang->L('FAQ & Docs');
|
101 |
-
}
|
102 |
-
|
103 |
-
?>
|
104 |
-
<div class="wrap" style="margin:5px;">
|
105 |
-
<?php
|
106 |
-
$this->showTabs($defaultTab);
|
107 |
-
$header='';
|
108 |
-
switch ($tab) {
|
109 |
-
case IRP_TAB_SETTINGS:
|
110 |
-
$header='Settings';
|
111 |
-
break;
|
112 |
-
case IRP_TAB_WHATS_NEW:
|
113 |
-
$header='';
|
114 |
-
break;
|
115 |
-
}
|
116 |
-
|
117 |
-
if($irp->Lang->H($header.'Title')) { ?>
|
118 |
-
<h2><?php $irp->Lang->P($header . 'Title', IRP_PLUGIN_VERSION) ?></h2>
|
119 |
-
<?php if ($irp->Lang->H($header . 'Subtitle')) { ?>
|
120 |
-
<div><?php $irp->Lang->P($header . 'Subtitle') ?></div>
|
121 |
-
<?php } ?>
|
122 |
-
<div style="clear:both;"></div>
|
123 |
-
<?php }
|
124 |
-
|
125 |
-
if($tab!=IRP_TAB_WHATS_NEW) {
|
126 |
-
irp_ui_first_time();
|
127 |
-
}
|
128 |
-
|
129 |
-
switch ($tab) {
|
130 |
-
case IRP_TAB_SETTINGS:
|
131 |
-
irp_ui_settings();
|
132 |
-
break;
|
133 |
-
case IRP_TAB_WHATS_NEW:
|
134 |
-
irp_ui_whats_new();
|
135 |
-
break;
|
136 |
-
}
|
137 |
-
|
138 |
-
if($irp->Options->isShowWhatsNew()) {
|
139 |
-
$irp->Options->setShowWhatsNew(FALSE);
|
140 |
-
}
|
141 |
-
?>
|
142 |
-
</div>
|
143 |
-
<?php }
|
144 |
-
|
145 |
-
function getPluginsCount() {
|
146 |
-
global $irp;
|
147 |
-
$index=1;
|
148 |
-
while($irp->Lang->H('Plugin'.$index.'.Name')) {
|
149 |
-
$index++;
|
150 |
-
}
|
151 |
-
return $index-1;
|
152 |
-
}
|
153 |
-
function drawPluginWidget($id) {
|
154 |
-
global $irp;
|
155 |
-
?>
|
156 |
-
<div class="irp-plugin-widget">
|
157 |
-
<b><?php $irp->Lang->P('Plugin'.$id.'.Name') ?></b>
|
158 |
-
<br>
|
159 |
-
<i><?php $irp->Lang->P('Plugin'.$id.'.Subtitle') ?></i>
|
160 |
-
<br>
|
161 |
-
<ul style="list-style: circle;">
|
162 |
-
<?php
|
163 |
-
$index=1;
|
164 |
-
while($irp->Lang->H('Plugin'.$id.'.Feature'.$index)) { ?>
|
165 |
-
<li><?php $irp->Lang->P('Plugin'.$id.'.Feature'.$index) ?></li>
|
166 |
-
<?php $index++;
|
167 |
-
} ?>
|
168 |
-
</ul>
|
169 |
-
<a style="float:right;" class="button-primary" href="<?php $irp->Lang->P('Plugin'.$id.'.Permalink') ?>" target="_blank">
|
170 |
-
<?php $irp->Lang->P('PluginCTA')?>
|
171 |
-
</a>
|
172 |
-
<div style="clear:both"></div>
|
173 |
-
</div>
|
174 |
-
<br>
|
175 |
-
<?php }
|
176 |
-
function drawContactUsWidget() {
|
177 |
-
global $irp;
|
178 |
-
?>
|
179 |
-
<b><?php $irp->Lang->P('Sidebar.Title') ?></b>
|
180 |
-
<ul style="list-style: circle;">
|
181 |
-
<?php
|
182 |
-
$index=1;
|
183 |
-
while($irp->Lang->H('Sidebar'.$index.'.Name')) { ?>
|
184 |
-
<li>
|
185 |
-
<a href="<?php $irp->Lang->P('Sidebar'.$index.'.Url')?>" target="_blank">
|
186 |
-
<?php $irp->Lang->P('Sidebar'.$index.'.Name')?>
|
187 |
-
</a>
|
188 |
-
</li>
|
189 |
-
<?php $index++;
|
190 |
-
} ?>
|
191 |
-
</ul>
|
192 |
-
<?php }
|
193 |
-
|
194 |
-
function showTabs($defaultTab) {
|
195 |
-
global $irp;
|
196 |
-
$tab=$irp->Check->of('tab', $defaultTab);
|
197 |
-
if($tab==IRP_TAB_DOCS) {
|
198 |
-
$irp->Utils->redirect(IRP_TAB_DOCS_URI);
|
199 |
-
}
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
$
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
<
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class IRP_Tabs {
|
3 |
+
private $tabs = array();
|
4 |
+
|
5 |
+
function init() {
|
6 |
+
global $irp;
|
7 |
+
if($irp->Utils->isAdminUser()) {
|
8 |
+
add_action('admin_menu', array(&$this, 'attachMenu'));
|
9 |
+
add_filter('plugin_action_links', array(&$this, 'pluginActions'), 10, 2);
|
10 |
+
if($irp->Utils->isPluginPage()) {
|
11 |
+
add_action('admin_enqueue_scripts', array(&$this, 'enqueueScripts'));
|
12 |
+
}
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
function attachMenu() {
|
17 |
+
global $irp;
|
18 |
+
|
19 |
+
if(!$irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
20 |
+
$name='Inline Related Posts';
|
21 |
+
add_submenu_page('options-general.php'
|
22 |
+
, $name, $name
|
23 |
+
, 'manage_options', IRP_PLUGIN_SLUG, array(&$this, 'showTabPage'));
|
24 |
+
}
|
25 |
+
}
|
26 |
+
function pluginActions($links, $file) {
|
27 |
+
global $irp;
|
28 |
+
if($file==IRP_PLUGIN_SLUG.'/index.php'){
|
29 |
+
$settings = "<a href='".IRP_PAGE_SETTINGS."'>" . $irp->Lang->L('Settings') . '</a> ';
|
30 |
+
$url=IRP_INTELLYWP_SITE.IRP_PLUGIN_SLUG.'?utm_source=free-users&utm_medium=irp-plugins&utm_campaign=IRP';
|
31 |
+
$premium = "<a href='".$url."' target='_blank'>" . $irp->Lang->L('PREMIUM') . '</a> ';
|
32 |
+
$links = array_merge(array($settings, $premium), $links);
|
33 |
+
}
|
34 |
+
return $links;
|
35 |
+
}
|
36 |
+
function enqueueScripts() {
|
37 |
+
global $irp;
|
38 |
+
wp_enqueue_script('jquery');
|
39 |
+
wp_enqueue_script('suggest');
|
40 |
+
wp_enqueue_script('jquery-ui-autocomplete');
|
41 |
+
|
42 |
+
$uri='//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css';
|
43 |
+
wp_enqueue_style('font-awesome', $uri);
|
44 |
+
|
45 |
+
$this->wpEnqueueStyle('assets/css/style.css');
|
46 |
+
$this->wpEnqueueStyle('assets/deps/select2-3.5.2/select2.css');
|
47 |
+
$this->wpEnqueueScript('assets/deps/select2-3.5.2/select2.min.js');
|
48 |
+
$this->wpEnqueueScript('assets/deps/starrr/starrr.js');
|
49 |
+
|
50 |
+
$this->wpEnqueueScript('assets/deps/qtip/jquery.qtip.min.js');
|
51 |
+
$this->wpEnqueueScript('assets/js/common.js');
|
52 |
+
}
|
53 |
+
function wpEnqueueStyle($uri, $name='') {
|
54 |
+
if($name=='') {
|
55 |
+
$name=explode('/', $uri);
|
56 |
+
$name=$name[count($name)-1];
|
57 |
+
$dot=strrpos($name, '.');
|
58 |
+
if($dot!==FALSE) {
|
59 |
+
$name=substr($name, 0, $dot);
|
60 |
+
}
|
61 |
+
$name=IRP_PLUGIN_PREFIX.'_'.$name;
|
62 |
+
}
|
63 |
+
|
64 |
+
$v='?v='.IRP_PLUGIN_VERSION;
|
65 |
+
wp_enqueue_style($name, IRP_PLUGIN_URI.$uri.$v);
|
66 |
+
}
|
67 |
+
function wpEnqueueScript($uri, $name='', $version=FALSE) {
|
68 |
+
if($name=='') {
|
69 |
+
$name=explode('/', $uri);
|
70 |
+
$name=$name[count($name)-1];
|
71 |
+
$dot=strrpos($name, '.');
|
72 |
+
if($dot!==FALSE) {
|
73 |
+
$name=substr($name, 0, $dot);
|
74 |
+
}
|
75 |
+
$name=IRP_PLUGIN_PREFIX.'_'.$name;
|
76 |
+
}
|
77 |
+
|
78 |
+
$v='?v='.IRP_PLUGIN_VERSION;
|
79 |
+
$deps=array();
|
80 |
+
wp_enqueue_script($name, IRP_PLUGIN_URI.$uri.$v, $deps, $version, FALSE);
|
81 |
+
}
|
82 |
+
|
83 |
+
function showTabPage() {
|
84 |
+
global $irp;
|
85 |
+
|
86 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
87 |
+
$irp->Options->pushWarningMessage('YouHaveThePremiumVersion', IRP_TAB_SETTINGS_URI);
|
88 |
+
$irp->Options->writeMessages();
|
89 |
+
return;
|
90 |
+
}
|
91 |
+
|
92 |
+
$defaultTab=IRP_TAB_SETTINGS;
|
93 |
+
if($irp->Options->isShowWhatsNew()) {
|
94 |
+
$tab=IRP_TAB_WHATS_NEW;
|
95 |
+
$defaultTab=$tab;
|
96 |
+
$this->tabs[IRP_TAB_WHATS_NEW]=$irp->Lang->L('What\'s New');
|
97 |
+
} else {
|
98 |
+
$tab = $irp->Utils->qs('tab', $defaultTab);
|
99 |
+
$this->tabs[IRP_TAB_SETTINGS] = $irp->Lang->L('Settings');
|
100 |
+
$this->tabs[IRP_TAB_DOCS] = $irp->Lang->L('FAQ & Docs');
|
101 |
+
}
|
102 |
+
|
103 |
+
?>
|
104 |
+
<div class="wrap" style="margin:5px;">
|
105 |
+
<?php
|
106 |
+
$this->showTabs($defaultTab);
|
107 |
+
$header='';
|
108 |
+
switch ($tab) {
|
109 |
+
case IRP_TAB_SETTINGS:
|
110 |
+
$header='Settings';
|
111 |
+
break;
|
112 |
+
case IRP_TAB_WHATS_NEW:
|
113 |
+
$header='';
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
|
117 |
+
if($irp->Lang->H($header.'Title')) { ?>
|
118 |
+
<h2><?php $irp->Lang->P($header . 'Title', IRP_PLUGIN_VERSION) ?></h2>
|
119 |
+
<?php if ($irp->Lang->H($header . 'Subtitle')) { ?>
|
120 |
+
<div><?php $irp->Lang->P($header . 'Subtitle') ?></div>
|
121 |
+
<?php } ?>
|
122 |
+
<div style="clear:both;"></div>
|
123 |
+
<?php }
|
124 |
+
|
125 |
+
if($tab!=IRP_TAB_WHATS_NEW) {
|
126 |
+
irp_ui_first_time();
|
127 |
+
}
|
128 |
+
|
129 |
+
switch ($tab) {
|
130 |
+
case IRP_TAB_SETTINGS:
|
131 |
+
irp_ui_settings();
|
132 |
+
break;
|
133 |
+
case IRP_TAB_WHATS_NEW:
|
134 |
+
irp_ui_whats_new();
|
135 |
+
break;
|
136 |
+
}
|
137 |
+
|
138 |
+
if($irp->Options->isShowWhatsNew()) {
|
139 |
+
$irp->Options->setShowWhatsNew(FALSE);
|
140 |
+
}
|
141 |
+
?>
|
142 |
+
</div>
|
143 |
+
<?php }
|
144 |
+
|
145 |
+
function getPluginsCount() {
|
146 |
+
global $irp;
|
147 |
+
$index=1;
|
148 |
+
while($irp->Lang->H('Plugin'.$index.'.Name')) {
|
149 |
+
$index++;
|
150 |
+
}
|
151 |
+
return $index-1;
|
152 |
+
}
|
153 |
+
function drawPluginWidget($id) {
|
154 |
+
global $irp;
|
155 |
+
?>
|
156 |
+
<div class="irp-plugin-widget">
|
157 |
+
<b><?php $irp->Lang->P('Plugin'.$id.'.Name') ?></b>
|
158 |
+
<br>
|
159 |
+
<i><?php $irp->Lang->P('Plugin'.$id.'.Subtitle') ?></i>
|
160 |
+
<br>
|
161 |
+
<ul style="list-style: circle;">
|
162 |
+
<?php
|
163 |
+
$index=1;
|
164 |
+
while($irp->Lang->H('Plugin'.$id.'.Feature'.$index)) { ?>
|
165 |
+
<li><?php $irp->Lang->P('Plugin'.$id.'.Feature'.$index) ?></li>
|
166 |
+
<?php $index++;
|
167 |
+
} ?>
|
168 |
+
</ul>
|
169 |
+
<a style="float:right;" class="button-primary" href="<?php $irp->Lang->P('Plugin'.$id.'.Permalink') ?>" target="_blank">
|
170 |
+
<?php $irp->Lang->P('PluginCTA')?>
|
171 |
+
</a>
|
172 |
+
<div style="clear:both"></div>
|
173 |
+
</div>
|
174 |
+
<br>
|
175 |
+
<?php }
|
176 |
+
function drawContactUsWidget() {
|
177 |
+
global $irp;
|
178 |
+
?>
|
179 |
+
<b><?php $irp->Lang->P('Sidebar.Title') ?></b>
|
180 |
+
<ul style="list-style: circle;">
|
181 |
+
<?php
|
182 |
+
$index=1;
|
183 |
+
while($irp->Lang->H('Sidebar'.$index.'.Name')) { ?>
|
184 |
+
<li>
|
185 |
+
<a href="<?php $irp->Lang->P('Sidebar'.$index.'.Url')?>" target="_blank">
|
186 |
+
<?php $irp->Lang->P('Sidebar'.$index.'.Name')?>
|
187 |
+
</a>
|
188 |
+
</li>
|
189 |
+
<?php $index++;
|
190 |
+
} ?>
|
191 |
+
</ul>
|
192 |
+
<?php }
|
193 |
+
|
194 |
+
function showTabs($defaultTab) {
|
195 |
+
global $irp;
|
196 |
+
$tab=$irp->Check->of('tab', $defaultTab);
|
197 |
+
if($tab==IRP_TAB_DOCS) {
|
198 |
+
$irp->Utils->redirect(IRP_TAB_DOCS_URI);
|
199 |
+
}
|
200 |
+
?>
|
201 |
+
<h2 class="nav-tab-wrapper" style="float:left; width:97%;">
|
202 |
+
<?php
|
203 |
+
foreach ($this->tabs as $k=>$v) {
|
204 |
+
$active = ($tab==$k ? 'nav-tab-active' : '');
|
205 |
+
$target='_self';
|
206 |
+
|
207 |
+
$styles=array();
|
208 |
+
$styles[]='float:left';
|
209 |
+
$styles[]='margin-left:10px';
|
210 |
+
if($k==IRP_TAB_DOCS) {
|
211 |
+
$target='_blank';
|
212 |
+
$styles[] ='background-color:#F2E49B';
|
213 |
+
}
|
214 |
+
$styles=implode(';', $styles);
|
215 |
+
?>
|
216 |
+
<a target="<?php echo $target ?>" style="<?php echo $styles?>" class="nav-tab <?php echo $active?>" href="?page=<?php echo IRP_PLUGIN_SLUG?>&tab=<?php echo $k?>"><?php echo $v?></a>
|
217 |
+
<?php
|
218 |
+
}
|
219 |
+
?>
|
220 |
+
<style>
|
221 |
+
.starrr {display:inline-block}
|
222 |
+
.starrr i{font-size:16px;padding:0 1px;cursor:pointer;color:#2ea2cc;}
|
223 |
+
</style>
|
224 |
+
<div style="float:right; display:none;" id="rate-box">
|
225 |
+
<span style="font-weight:700; font-size:13px; color:#555;"><?php $irp->Lang->P('Rate us')?></span>
|
226 |
+
<div id="irp-rate" class="starrr" data-connected-input="irp-rate-rank"></div>
|
227 |
+
<input type="hidden" id="irp-rate-rank" name="irp-rate-rank" value="5" />
|
228 |
+
<?php $irp->Utils->twitter('intellywp') ?>
|
229 |
+
</div>
|
230 |
+
<script>
|
231 |
+
jQuery(function() {
|
232 |
+
jQuery(".starrr").starrr();
|
233 |
+
jQuery('#irp-rate').on('starrr:change', function(e, value){
|
234 |
+
var url='https://wordpress.org/support/view/plugin-reviews/<?php echo IRP_PLUGIN_SLUG?>?rate=5#postform';
|
235 |
+
window.open(url);
|
236 |
+
});
|
237 |
+
jQuery('#rate-box').show();
|
238 |
+
});
|
239 |
+
</script>
|
240 |
+
</h2>
|
241 |
+
<div style="clear:both;"></div>
|
242 |
+
<?php }
|
243 |
+
}
|
includes/core.php
CHANGED
@@ -1,335 +1,335 @@
|
|
1 |
-
<?php
|
2 |
-
add_filter('wp_head', 'irp_head');
|
3 |
-
function irp_head() {
|
4 |
-
global $post, $irp;
|
5 |
-
|
6 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
7 |
-
return;
|
8 |
-
}
|
9 |
-
|
10 |
-
$irp->Log->startTime('irp_head');
|
11 |
-
if($irp->Options->getPostShown()===FALSE || is_null($irp->Options->getPostShown())) {
|
12 |
-
$irp->Options->initRelatedPostsIds(NULL);
|
13 |
-
$irp->Options->setPostShown(NULL);
|
14 |
-
if($post && isset($post->ID) && is_single($post->ID)) {
|
15 |
-
$irp->Options->setPostShown($post);
|
16 |
-
$args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
|
17 |
-
$ids=$irp->Manager->getRelatedPostsIds($args);
|
18 |
-
$irp->Options->initRelatedPostsIds($ids);
|
19 |
-
//$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
|
20 |
-
}
|
21 |
-
}
|
22 |
-
$irp->Log->pauseTime();
|
23 |
-
}
|
24 |
-
add_filter('wp_footer', 'irp_footer');
|
25 |
-
//add_filter('admin_footer', 'irp_footer');
|
26 |
-
function irp_footer() {
|
27 |
-
global $irp;
|
28 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
|
32 |
-
$irp->Log->startTime('irp_footer');
|
33 |
-
$array=$irp->Options->getCssStyles();
|
34 |
-
if(count($array)>0) {
|
35 |
-
echo "<style>\n";
|
36 |
-
foreach($array as $v) {
|
37 |
-
echo $v;
|
38 |
-
echo "\n";
|
39 |
-
}
|
40 |
-
echo "</style>\n";
|
41 |
-
}
|
42 |
-
$irp->Log->pauseTime();
|
43 |
-
$irp->Log->stopTime();
|
44 |
-
}
|
45 |
-
|
46 |
-
if(!shortcode_exists('irp')) {
|
47 |
-
add_shortcode('irp', 'irp_shortcode');
|
48 |
-
}
|
49 |
-
function irp_shortcode($atts, $content='') {
|
50 |
-
global $irp, $post;
|
51 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
52 |
-
return $content;
|
53 |
-
}
|
54 |
-
if(!$irp->Options->isActive()) {
|
55 |
-
return '';
|
56 |
-
}
|
57 |
-
|
58 |
-
$default=array(
|
59 |
-
'posts'=>''
|
60 |
-
, 'cats'=>''
|
61 |
-
, 'tags'=>''
|
62 |
-
, 'count'=>1
|
63 |
-
, 'theme'=>''
|
64 |
-
, 'demo'=>FALSE
|
65 |
-
, 'ctaText'=>'default'
|
66 |
-
, 'ctaTextColor'=>'default'
|
67 |
-
, 'postTitleColor'=>'default'
|
68 |
-
, 'boxColor'=>'default'
|
69 |
-
, 'borderColor'=>'default'
|
70 |
-
, 'hasPoweredBy'=>'default'
|
71 |
-
, 'hasShadow'=>'default'
|
72 |
-
, 'defaultsColors'=>FALSE
|
73 |
-
, 'includeCss'=>TRUE
|
74 |
-
);
|
75 |
-
$options=$irp->Utils->shortcodeAtts($default, $atts);
|
76 |
-
if(isset($options['postId'])) {
|
77 |
-
unset($options['postId']);
|
78 |
-
}
|
79 |
-
$options['demo']=$irp->Utils->isTrue($options['demo']);
|
80 |
-
$options['count']=intval($options['count']);
|
81 |
-
if($options['count']<=0) {
|
82 |
-
return '';
|
83 |
-
}
|
84 |
-
|
85 |
-
if($options['posts']=='' && $options['cats']=='' && $options['tags']=='') {
|
86 |
-
//dynamic
|
87 |
-
$ids=$irp->Options->getToShowPostsIds($options['count'], TRUE);
|
88 |
-
} else {
|
89 |
-
if($options['posts']=='current' && $post && isset($post->ID)) {
|
90 |
-
$options['posts']=$post->ID;
|
91 |
-
}
|
92 |
-
//static
|
93 |
-
$ids=$irp->Manager->getRelatedPostsIds($options);
|
94 |
-
}
|
95 |
-
|
96 |
-
$keys=array('ctaText', 'ctaTextColor', 'postTitleColor', 'boxColor', 'borderColor', 'hasPoweredBy', 'hasShadow');
|
97 |
-
foreach($keys as $k) {
|
98 |
-
if($options[$k]=='default') {
|
99 |
-
unset($options[$k]);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
$result=irp_ui_get_box($ids, $options);
|
103 |
-
if($result!='') {
|
104 |
-
$irp->Options->setShortcodeUsed(TRUE);
|
105 |
-
}
|
106 |
-
return $result;
|
107 |
-
}
|
108 |
-
|
109 |
-
function irp_ui_get_box($ids, $options=NULL) {
|
110 |
-
global $irp;
|
111 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
112 |
-
return "";
|
113 |
-
}
|
114 |
-
if(!is_array($ids) || count($ids)==0) {
|
115 |
-
return "";
|
116 |
-
}
|
117 |
-
if(!is_array($options)) {
|
118 |
-
$options=array();
|
119 |
-
}
|
120 |
-
|
121 |
-
$irp->Log->startTime('irp_ui_get_box');
|
122 |
-
$defaults=array(
|
123 |
-
'includeCss'=>TRUE
|
124 |
-
, 'comment'=>''
|
125 |
-
, 'shortcode'=>FALSE
|
126 |
-
, 'preview'=>FALSE
|
127 |
-
, 'theme'=>''
|
128 |
-
, 'demo'=>FALSE
|
129 |
-
, 'array'=>FALSE
|
130 |
-
, 'defaultsColors'=>FALSE
|
131 |
-
);
|
132 |
-
$options=$irp->Utils->parseArgs($options, $defaults);
|
133 |
-
$body='';
|
134 |
-
if($options['shortcode']) {
|
135 |
-
$body='[irpx posts="'.implode(',', $ids).'" comment="'.$options['comment'].'"]';
|
136 |
-
} else {
|
137 |
-
$defaults=$irp->Options->getTemplateStyle();
|
138 |
-
$options=$irp->Utils->parseArgs($options, $defaults);
|
139 |
-
if($options['theme']!='') {
|
140 |
-
$options['template']=$options['theme'];
|
141 |
-
}
|
142 |
-
unset($options['theme']);
|
143 |
-
|
144 |
-
$posts=array();
|
145 |
-
foreach($ids as $postId) {
|
146 |
-
$v=get_post($postId);
|
147 |
-
if($v) {
|
148 |
-
$posts[]=$v;
|
149 |
-
}
|
150 |
-
}
|
151 |
-
if(count($posts)>0) {
|
152 |
-
foreach($posts as $v) {
|
153 |
-
$options['postHref']=get_permalink($v->ID);
|
154 |
-
$options['postTitle']=$v->post_title;
|
155 |
-
|
156 |
-
$options['postImageUrl']='';
|
157 |
-
//$options['postImageWidth']=0;
|
158 |
-
//$options['postImageHeight']=0;
|
159 |
-
$attachmentId=get_post_thumbnail_id($v->ID);
|
160 |
-
if($attachmentId!==FALSE && $attachmentId!=='' && intval($attachmentId)>0) {
|
161 |
-
$array=wp_get_attachment_image_src($attachmentId, 'medium');
|
162 |
-
if($array!==FALSE) {
|
163 |
-
$options['postImageUrl']=$array[0];
|
164 |
-
//$options['postImageWidth']=$array[1];
|
165 |
-
//$options['postImageHeight']=$array[2];
|
166 |
-
}
|
167 |
-
}
|
168 |
-
break;
|
169 |
-
}
|
170 |
-
|
171 |
-
if($irp->Utils->isTrue($options['defaultsColors'])) {
|
172 |
-
$defaults = $irp->HtmlTemplate->getDefaults();
|
173 |
-
$defaults = $defaults[$options['template']];
|
174 |
-
foreach ($defaults as $k => $v) {
|
175 |
-
$options[$k] = $v;
|
176 |
-
}
|
177 |
-
}
|
178 |
-
if($irp->Utils->isTrue($options['demo'])) {
|
179 |
-
$options['postHref']='javascript:void(0);';
|
180 |
-
$options['linkRel']='nofollow';
|
181 |
-
$options['linkTarget']='';
|
182 |
-
//$options['hasShadow']=TRUE;
|
183 |
-
//$options['hasPoweredBy']=1;
|
184 |
-
$ctaText=$irp->Utils->qs('ctaText');
|
185 |
-
if($ctaText!='') {
|
186 |
-
$options['ctaText']=$ctaText;
|
187 |
-
}
|
188 |
-
$postTitle=$irp->Utils->qs('postTitle');
|
189 |
-
$postTitle=str_replace("\\\"", "\"", $postTitle);
|
190 |
-
if($postTitle!='') {
|
191 |
-
$options['postTitle']=$postTitle;
|
192 |
-
}
|
193 |
-
$uri=$irp->Utils->qs('postImageUrl');
|
194 |
-
//$w=$irp->Utils->iqs('postImageWidth');
|
195 |
-
//$h=$irp->Utils->iqs('postImageHeight');
|
196 |
-
if($uri!='') {
|
197 |
-
$options['postImageUrl']=$uri;
|
198 |
-
//$options['postImageWidth']=$w;
|
199 |
-
//$options['postImageHeight']=$h;
|
200 |
-
}
|
201 |
-
} elseif($irp->Utils->isTrue($options['preview'])) {
|
202 |
-
$options['postHref']='javascript:IRP_changeRelatedBox();';
|
203 |
-
$options['linkRel']='nofollow';
|
204 |
-
$options['linkTarget']='';
|
205 |
-
}
|
206 |
-
|
207 |
-
$body=$options;
|
208 |
-
if($options['array']==FALSE) {
|
209 |
-
$body=$irp->HtmlTemplate->html($options['template'], $options, $options);
|
210 |
-
}
|
211 |
-
}
|
212 |
-
}
|
213 |
-
$irp->Log->pauseTime();
|
214 |
-
return $body;
|
215 |
-
}
|
216 |
-
|
217 |
-
/*add_filter('the_content', 'irp_fix_the_content');
|
218 |
-
function irp_fix_the_content($content) {
|
219 |
-
//this is to prevent wrong rewrite of WP of our content
|
220 |
-
$content=str_replace("<p></a></p>", "</a>", $content);
|
221 |
-
$content=str_replace("<p></a>", "</a>", $content);
|
222 |
-
return $content;
|
223 |
-
}*/
|
224 |
-
//add_filter('wp_head', 'irp_the_content');
|
225 |
-
add_filter('the_content', 'irp_the_content', 99999);
|
226 |
-
function irp_the_content($content) {
|
227 |
-
global $irp, $post;
|
228 |
-
|
229 |
-
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
230 |
-
return $content;
|
231 |
-
}
|
232 |
-
|
233 |
-
$irp->Log->startTime('irp_the_content');
|
234 |
-
if(!$post || trim($content)=='') {
|
235 |
-
return $content;
|
236 |
-
}
|
237 |
-
|
238 |
-
if($irp->Options->getPostShown()===FALSE || is_null($irp->Options->getPostShown())) {
|
239 |
-
$irp->Options->initRelatedPostsIds(NULL);
|
240 |
-
$irp->Options->setPostShown(NULL);
|
241 |
-
if($post && isset($post->ID) && is_single($post->ID)) {
|
242 |
-
$irp->Options->setPostShown($post);
|
243 |
-
$args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
|
244 |
-
$ids=$irp->Manager->getRelatedPostsIds($args);
|
245 |
-
$irp->Options->initRelatedPostsIds($ids);
|
246 |
-
//$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
|
247 |
-
}
|
248 |
-
} else {
|
249 |
-
$irp->Options->refreshRelatedPostsIds();
|
250 |
-
}
|
251 |
-
|
252 |
-
if($irp->Options->isPostShownExcluded()) {
|
253 |
-
$irp->Log->error('TheContent: POST UNDEFINED OR POST EXCLUDED');
|
254 |
-
return $content;
|
255 |
-
}
|
256 |
-
|
257 |
-
if(!$irp->Options->isActive() || !$irp->Options->isRewriteActive()) {
|
258 |
-
$irp->Log->error('TheContent: NOT ACTIVE NOT REWRITE ACTIVE');
|
259 |
-
return $content;
|
260 |
-
}
|
261 |
-
if($irp->Options->isShortcodeUsed()) {
|
262 |
-
$irp->Log->error('TheContent: NOT ACTIVE DUE TO SHORTCODE USED');
|
263 |
-
return $content;
|
264 |
-
}
|
265 |
-
if(!$irp->Options->hasRelatedPostsIds()) {
|
266 |
-
$irp->Log->error('TheContent: NOT ACTIVE DUE TO WITHOUT RELATED POSTS');
|
267 |
-
return $content;
|
268 |
-
}
|
269 |
-
|
270 |
-
$body=$content;
|
271 |
-
/*if(strpos($body, '[irp')!==FALSE) {
|
272 |
-
$irp->Log->error('TheContent: SHORTCODE DETECTED');
|
273 |
-
$irp->Options->setShortcodeUsed(TRUE);
|
274 |
-
return;
|
275 |
-
}*/
|
276 |
-
|
277 |
-
$context=new IRP_HTMLContext();
|
278 |
-
$irp->Options->setRewriteBoxesWritten(0);
|
279 |
-
$body=$context->execute($body);
|
280 |
-
$irp->Log->pauseTime();
|
281 |
-
$irp->Log->info('TheContent: BODY SUCCESSULLY CREATED');
|
282 |
-
//$body=apply_filters('the_content', $body);
|
283 |
-
//$post->post_content=$body;
|
284 |
-
return $body;
|
285 |
-
}
|
286 |
-
function irp_ui_first_time() {
|
287 |
-
global $irp;
|
288 |
-
if($irp->Options->isShowActivationNotice()) {
|
289 |
-
//$tcmp->Options->pushSuccessMessage('FirstTimeActivation');
|
290 |
-
//$tcmp->Options->writeMessages();
|
291 |
-
$irp->Options->setShowActivationNotice(FALSE);
|
292 |
-
}
|
293 |
-
}
|
294 |
-
function irp_get_list_posts() {
|
295 |
-
|
296 |
-
global $wpdb;
|
297 |
-
|
298 |
-
$result = array();
|
299 |
-
|
300 |
-
$search = strip_tags(trim($_GET['q']));
|
301 |
-
add_filter('posts_where', function( $where ) use ($search) {
|
302 |
-
$where .= (" AND post_title LIKE '%" . $search . "%'");
|
303 |
-
return $where;
|
304 |
-
});
|
305 |
-
|
306 |
-
$query = array(
|
307 |
-
'posts_per_page' => -1,
|
308 |
-
'post_status' => 'publish',
|
309 |
-
'post_type' => esc_attr($_REQUEST['irp_post_type']),
|
310 |
-
'order' => 'ASC',
|
311 |
-
'orderby' => 'title',
|
312 |
-
'suppress_filters' => false,
|
313 |
-
);
|
314 |
-
|
315 |
-
$posts = get_posts( $query );
|
316 |
-
|
317 |
-
foreach ($posts as $this_post) {
|
318 |
-
|
319 |
-
$post_title = $this_post->post_title;
|
320 |
-
$id = $this_post->ID;
|
321 |
-
|
322 |
-
$result[] = array(
|
323 |
-
'text' => $post_title,
|
324 |
-
'id' => $id,
|
325 |
-
);
|
326 |
-
|
327 |
-
}
|
328 |
-
|
329 |
-
$posts['items'] = $result;
|
330 |
-
echo json_encode($posts);
|
331 |
-
|
332 |
-
die();
|
333 |
-
|
334 |
-
}
|
335 |
add_action( 'wp_ajax_irp_list_posts', 'irp_get_list_posts' );
|
1 |
+
<?php
|
2 |
+
add_filter('wp_head', 'irp_head');
|
3 |
+
function irp_head() {
|
4 |
+
global $post, $irp;
|
5 |
+
|
6 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
7 |
+
return;
|
8 |
+
}
|
9 |
+
|
10 |
+
$irp->Log->startTime('irp_head');
|
11 |
+
if($irp->Options->getPostShown()===FALSE || is_null($irp->Options->getPostShown())) {
|
12 |
+
$irp->Options->initRelatedPostsIds(NULL);
|
13 |
+
$irp->Options->setPostShown(NULL);
|
14 |
+
if($post && isset($post->ID) && is_single($post->ID)) {
|
15 |
+
$irp->Options->setPostShown($post);
|
16 |
+
$args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
|
17 |
+
$ids=$irp->Manager->getRelatedPostsIds($args);
|
18 |
+
$irp->Options->initRelatedPostsIds($ids);
|
19 |
+
//$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
$irp->Log->pauseTime();
|
23 |
+
}
|
24 |
+
add_filter('wp_footer', 'irp_footer');
|
25 |
+
//add_filter('admin_footer', 'irp_footer');
|
26 |
+
function irp_footer() {
|
27 |
+
global $irp;
|
28 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
|
32 |
+
$irp->Log->startTime('irp_footer');
|
33 |
+
$array=$irp->Options->getCssStyles();
|
34 |
+
if(count($array)>0) {
|
35 |
+
echo "<style>\n";
|
36 |
+
foreach($array as $v) {
|
37 |
+
echo $v;
|
38 |
+
echo "\n";
|
39 |
+
}
|
40 |
+
echo "</style>\n";
|
41 |
+
}
|
42 |
+
$irp->Log->pauseTime();
|
43 |
+
$irp->Log->stopTime();
|
44 |
+
}
|
45 |
+
|
46 |
+
if(!shortcode_exists('irp')) {
|
47 |
+
add_shortcode('irp', 'irp_shortcode');
|
48 |
+
}
|
49 |
+
function irp_shortcode($atts, $content='') {
|
50 |
+
global $irp, $post;
|
51 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
52 |
+
return $content;
|
53 |
+
}
|
54 |
+
if(!$irp->Options->isActive()) {
|
55 |
+
return '';
|
56 |
+
}
|
57 |
+
|
58 |
+
$default=array(
|
59 |
+
'posts'=>''
|
60 |
+
, 'cats'=>''
|
61 |
+
, 'tags'=>''
|
62 |
+
, 'count'=>1
|
63 |
+
, 'theme'=>''
|
64 |
+
, 'demo'=>FALSE
|
65 |
+
, 'ctaText'=>'default'
|
66 |
+
, 'ctaTextColor'=>'default'
|
67 |
+
, 'postTitleColor'=>'default'
|
68 |
+
, 'boxColor'=>'default'
|
69 |
+
, 'borderColor'=>'default'
|
70 |
+
, 'hasPoweredBy'=>'default'
|
71 |
+
, 'hasShadow'=>'default'
|
72 |
+
, 'defaultsColors'=>FALSE
|
73 |
+
, 'includeCss'=>TRUE
|
74 |
+
);
|
75 |
+
$options=$irp->Utils->shortcodeAtts($default, $atts);
|
76 |
+
if(isset($options['postId'])) {
|
77 |
+
unset($options['postId']);
|
78 |
+
}
|
79 |
+
$options['demo']=$irp->Utils->isTrue($options['demo']);
|
80 |
+
$options['count']=intval($options['count']);
|
81 |
+
if($options['count']<=0) {
|
82 |
+
return '';
|
83 |
+
}
|
84 |
+
|
85 |
+
if($options['posts']=='' && $options['cats']=='' && $options['tags']=='') {
|
86 |
+
//dynamic
|
87 |
+
$ids=$irp->Options->getToShowPostsIds($options['count'], TRUE);
|
88 |
+
} else {
|
89 |
+
if($options['posts']=='current' && $post && isset($post->ID)) {
|
90 |
+
$options['posts']=$post->ID;
|
91 |
+
}
|
92 |
+
//static
|
93 |
+
$ids=$irp->Manager->getRelatedPostsIds($options);
|
94 |
+
}
|
95 |
+
|
96 |
+
$keys=array('ctaText', 'ctaTextColor', 'postTitleColor', 'boxColor', 'borderColor', 'hasPoweredBy', 'hasShadow');
|
97 |
+
foreach($keys as $k) {
|
98 |
+
if($options[$k]=='default') {
|
99 |
+
unset($options[$k]);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
$result=irp_ui_get_box($ids, $options);
|
103 |
+
if($result!='') {
|
104 |
+
$irp->Options->setShortcodeUsed(TRUE);
|
105 |
+
}
|
106 |
+
return $result;
|
107 |
+
}
|
108 |
+
|
109 |
+
function irp_ui_get_box($ids, $options=NULL) {
|
110 |
+
global $irp;
|
111 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
112 |
+
return "";
|
113 |
+
}
|
114 |
+
if(!is_array($ids) || count($ids)==0) {
|
115 |
+
return "";
|
116 |
+
}
|
117 |
+
if(!is_array($options)) {
|
118 |
+
$options=array();
|
119 |
+
}
|
120 |
+
|
121 |
+
$irp->Log->startTime('irp_ui_get_box');
|
122 |
+
$defaults=array(
|
123 |
+
'includeCss'=>TRUE
|
124 |
+
, 'comment'=>''
|
125 |
+
, 'shortcode'=>FALSE
|
126 |
+
, 'preview'=>FALSE
|
127 |
+
, 'theme'=>''
|
128 |
+
, 'demo'=>FALSE
|
129 |
+
, 'array'=>FALSE
|
130 |
+
, 'defaultsColors'=>FALSE
|
131 |
+
);
|
132 |
+
$options=$irp->Utils->parseArgs($options, $defaults);
|
133 |
+
$body='';
|
134 |
+
if($options['shortcode']) {
|
135 |
+
$body='[irpx posts="'.implode(',', $ids).'" comment="'.$options['comment'].'"]';
|
136 |
+
} else {
|
137 |
+
$defaults=$irp->Options->getTemplateStyle();
|
138 |
+
$options=$irp->Utils->parseArgs($options, $defaults);
|
139 |
+
if($options['theme']!='') {
|
140 |
+
$options['template']=$options['theme'];
|
141 |
+
}
|
142 |
+
unset($options['theme']);
|
143 |
+
|
144 |
+
$posts=array();
|
145 |
+
foreach($ids as $postId) {
|
146 |
+
$v=get_post($postId);
|
147 |
+
if($v) {
|
148 |
+
$posts[]=$v;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if(count($posts)>0) {
|
152 |
+
foreach($posts as $v) {
|
153 |
+
$options['postHref']=get_permalink($v->ID);
|
154 |
+
$options['postTitle']=$v->post_title;
|
155 |
+
|
156 |
+
$options['postImageUrl']='';
|
157 |
+
//$options['postImageWidth']=0;
|
158 |
+
//$options['postImageHeight']=0;
|
159 |
+
$attachmentId=get_post_thumbnail_id($v->ID);
|
160 |
+
if($attachmentId!==FALSE && $attachmentId!=='' && intval($attachmentId)>0) {
|
161 |
+
$array=wp_get_attachment_image_src($attachmentId, 'medium');
|
162 |
+
if($array!==FALSE) {
|
163 |
+
$options['postImageUrl']=$array[0];
|
164 |
+
//$options['postImageWidth']=$array[1];
|
165 |
+
//$options['postImageHeight']=$array[2];
|
166 |
+
}
|
167 |
+
}
|
168 |
+
break;
|
169 |
+
}
|
170 |
+
|
171 |
+
if($irp->Utils->isTrue($options['defaultsColors'])) {
|
172 |
+
$defaults = $irp->HtmlTemplate->getDefaults();
|
173 |
+
$defaults = $defaults[$options['template']];
|
174 |
+
foreach ($defaults as $k => $v) {
|
175 |
+
$options[$k] = $v;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
if($irp->Utils->isTrue($options['demo'])) {
|
179 |
+
$options['postHref']='javascript:void(0);';
|
180 |
+
$options['linkRel']='nofollow';
|
181 |
+
$options['linkTarget']='';
|
182 |
+
//$options['hasShadow']=TRUE;
|
183 |
+
//$options['hasPoweredBy']=1;
|
184 |
+
$ctaText=$irp->Utils->qs('ctaText');
|
185 |
+
if($ctaText!='') {
|
186 |
+
$options['ctaText']=$ctaText;
|
187 |
+
}
|
188 |
+
$postTitle=$irp->Utils->qs('postTitle');
|
189 |
+
$postTitle=str_replace("\\\"", "\"", $postTitle);
|
190 |
+
if($postTitle!='') {
|
191 |
+
$options['postTitle']=$postTitle;
|
192 |
+
}
|
193 |
+
$uri=$irp->Utils->qs('postImageUrl');
|
194 |
+
//$w=$irp->Utils->iqs('postImageWidth');
|
195 |
+
//$h=$irp->Utils->iqs('postImageHeight');
|
196 |
+
if($uri!='') {
|
197 |
+
$options['postImageUrl']=$uri;
|
198 |
+
//$options['postImageWidth']=$w;
|
199 |
+
//$options['postImageHeight']=$h;
|
200 |
+
}
|
201 |
+
} elseif($irp->Utils->isTrue($options['preview'])) {
|
202 |
+
$options['postHref']='javascript:IRP_changeRelatedBox();';
|
203 |
+
$options['linkRel']='nofollow';
|
204 |
+
$options['linkTarget']='';
|
205 |
+
}
|
206 |
+
|
207 |
+
$body=$options;
|
208 |
+
if($options['array']==FALSE) {
|
209 |
+
$body=$irp->HtmlTemplate->html($options['template'], $options, $options);
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
$irp->Log->pauseTime();
|
214 |
+
return $body;
|
215 |
+
}
|
216 |
+
|
217 |
+
/*add_filter('the_content', 'irp_fix_the_content');
|
218 |
+
function irp_fix_the_content($content) {
|
219 |
+
//this is to prevent wrong rewrite of WP of our content
|
220 |
+
$content=str_replace("<p></a></p>", "</a>", $content);
|
221 |
+
$content=str_replace("<p></a>", "</a>", $content);
|
222 |
+
return $content;
|
223 |
+
}*/
|
224 |
+
//add_filter('wp_head', 'irp_the_content');
|
225 |
+
add_filter('the_content', 'irp_the_content', 99999);
|
226 |
+
function irp_the_content($content) {
|
227 |
+
global $irp, $post;
|
228 |
+
|
229 |
+
if($irp->Plugin->isActive(IRP_PLUGINS_INTELLY_RELATED_POSTS_PRO)) {
|
230 |
+
return $content;
|
231 |
+
}
|
232 |
+
|
233 |
+
$irp->Log->startTime('irp_the_content');
|
234 |
+
if(!$post || trim($content)=='') {
|
235 |
+
return $content;
|
236 |
+
}
|
237 |
+
|
238 |
+
if($irp->Options->getPostShown()===FALSE || is_null($irp->Options->getPostShown())) {
|
239 |
+
$irp->Options->initRelatedPostsIds(NULL);
|
240 |
+
$irp->Options->setPostShown(NULL);
|
241 |
+
if($post && isset($post->ID) && is_single($post->ID)) {
|
242 |
+
$irp->Options->setPostShown($post);
|
243 |
+
$args=array('postId'=>$post->ID, 'shuffle'=>TRUE, 'count'=>-1);
|
244 |
+
$ids=$irp->Manager->getRelatedPostsIds($args);
|
245 |
+
$irp->Options->initRelatedPostsIds($ids);
|
246 |
+
//$irp->Log->info('POST ID=%s IS SHOWN, RELATED POSTS=%s', $post->ID, $ids);
|
247 |
+
}
|
248 |
+
} else {
|
249 |
+
$irp->Options->refreshRelatedPostsIds();
|
250 |
+
}
|
251 |
+
|
252 |
+
if($irp->Options->isPostShownExcluded()) {
|
253 |
+
$irp->Log->error('TheContent: POST UNDEFINED OR POST EXCLUDED');
|
254 |
+
return $content;
|
255 |
+
}
|
256 |
+
|
257 |
+
if(!$irp->Options->isActive() || !$irp->Options->isRewriteActive()) {
|
258 |
+
$irp->Log->error('TheContent: NOT ACTIVE NOT REWRITE ACTIVE');
|
259 |
+
return $content;
|
260 |
+
}
|
261 |
+
if($irp->Options->isShortcodeUsed()) {
|
262 |
+
$irp->Log->error('TheContent: NOT ACTIVE DUE TO SHORTCODE USED');
|
263 |
+
return $content;
|
264 |
+
}
|
265 |
+
if(!$irp->Options->hasRelatedPostsIds()) {
|
266 |
+
$irp->Log->error('TheContent: NOT ACTIVE DUE TO WITHOUT RELATED POSTS');
|
267 |
+
return $content;
|
268 |
+
}
|
269 |
+
|
270 |
+
$body=$content;
|
271 |
+
/*if(strpos($body, '[irp')!==FALSE) {
|
272 |
+
$irp->Log->error('TheContent: SHORTCODE DETECTED');
|
273 |
+
$irp->Options->setShortcodeUsed(TRUE);
|
274 |
+
return;
|
275 |
+
}*/
|
276 |
+
|
277 |
+
$context=new IRP_HTMLContext();
|
278 |
+
$irp->Options->setRewriteBoxesWritten(0);
|
279 |
+
$body=$context->execute($body);
|
280 |
+
$irp->Log->pauseTime();
|
281 |
+
$irp->Log->info('TheContent: BODY SUCCESSULLY CREATED');
|
282 |
+
//$body=apply_filters('the_content', $body);
|
283 |
+
//$post->post_content=$body;
|
284 |
+
return $body;
|
285 |
+
}
|
286 |
+
function irp_ui_first_time() {
|
287 |
+
global $irp;
|
288 |
+
if($irp->Options->isShowActivationNotice()) {
|
289 |
+
//$tcmp->Options->pushSuccessMessage('FirstTimeActivation');
|
290 |
+
//$tcmp->Options->writeMessages();
|
291 |
+
$irp->Options->setShowActivationNotice(FALSE);
|
292 |
+
}
|
293 |
+
}
|
294 |
+
function irp_get_list_posts() {
|
295 |
+
|
296 |
+
global $wpdb;
|
297 |
+
|
298 |
+
$result = array();
|
299 |
+
|
300 |
+
$search = strip_tags(trim($_GET['q']));
|
301 |
+
add_filter('posts_where', function( $where ) use ($search) {
|
302 |
+
$where .= (" AND post_title LIKE '%" . $search . "%'");
|
303 |
+
return $where;
|
304 |
+
});
|
305 |
+
|
306 |
+
$query = array(
|
307 |
+
'posts_per_page' => -1,
|
308 |
+
'post_status' => 'publish',
|
309 |
+
'post_type' => esc_attr($_REQUEST['irp_post_type']),
|
310 |
+
'order' => 'ASC',
|
311 |
+
'orderby' => 'title',
|
312 |
+
'suppress_filters' => false,
|
313 |
+
);
|
314 |
+
|
315 |
+
$posts = get_posts( $query );
|
316 |
+
|
317 |
+
foreach ($posts as $this_post) {
|
318 |
+
|
319 |
+
$post_title = $this_post->post_title;
|
320 |
+
$id = $this_post->ID;
|
321 |
+
|
322 |
+
$result[] = array(
|
323 |
+
'text' => $post_title,
|
324 |
+
'id' => $id,
|
325 |
+
);
|
326 |
+
|
327 |
+
}
|
328 |
+
|
329 |
+
$posts['items'] = $result;
|
330 |
+
echo json_encode($posts);
|
331 |
+
|
332 |
+
die();
|
333 |
+
|
334 |
+
}
|
335 |
add_action( 'wp_ajax_irp_list_posts', 'irp_get_list_posts' );
|
index.php
CHANGED
@@ -6,13 +6,13 @@ Description: Inline Related Posts AUTOMATICALLY inserts related posts INSIDE you
|
|
6 |
Author: IntellyWP
|
7 |
Author URI: http://intellywp.com/
|
8 |
Email: support@intellywp.com
|
9 |
-
Version: 3.0.
|
10 |
*/
|
11 |
define('IRP_PLUGIN_PREFIX', 'IRP_');
|
12 |
define('IRP_PLUGIN_FILE',__FILE__);
|
13 |
define('IRP_PLUGIN_SLUG', 'intelly-related-posts');
|
14 |
define('IRP_PLUGIN_NAME', 'Inline Related Posts');
|
15 |
-
define('IRP_PLUGIN_VERSION', '3.0.
|
16 |
define('IRP_PLUGIN_AUTHOR', 'IntellyWP');
|
17 |
define('IRP_PLUGIN_ROOT', dirname(__FILE__).'/');
|
18 |
define('IRP_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
|
6 |
Author: IntellyWP
|
7 |
Author URI: http://intellywp.com/
|
8 |
Email: support@intellywp.com
|
9 |
+
Version: 3.0.4
|
10 |
*/
|
11 |
define('IRP_PLUGIN_PREFIX', 'IRP_');
|
12 |
define('IRP_PLUGIN_FILE',__FILE__);
|
13 |
define('IRP_PLUGIN_SLUG', 'intelly-related-posts');
|
14 |
define('IRP_PLUGIN_NAME', 'Inline Related Posts');
|
15 |
+
define('IRP_PLUGIN_VERSION', '3.0.4');
|
16 |
define('IRP_PLUGIN_AUTHOR', 'IntellyWP');
|
17 |
define('IRP_PLUGIN_ROOT', dirname(__FILE__).'/');
|
18 |
define('IRP_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
|
languages/Lang.txt
CHANGED
@@ -1,201 +1,201 @@
|
|
1 |
-
#en_US
|
2 |
-
PluginLimit.Line1=In this FREE version you can insert up to N.{0} different Tracking Code (remaining N.{1})
|
3 |
-
PluginLimit.Line2=If you need more Tracking Code or more features please buy our PREMIUM version <a href="{0}" target="_blank"><b>HERE</b></a>
|
4 |
-
Editor.Add=Tracking Code "#{0} ({1})" successfully stored.
|
5 |
-
Button.Add=Add a new Tracking Code
|
6 |
-
Button.BuyPRO=Buy PREMIUM
|
7 |
-
|
8 |
-
Feedback.email=Contact email
|
9 |
-
Feedback.email.check=Please specify a valid email
|
10 |
-
Feedback.body=Feedback
|
11 |
-
Feedback.body.check=Please specify your feedback
|
12 |
-
Feedback.track=Send also track information (this can be very useful for us to solve your issue)
|
13 |
-
FeedbackSuccess=Feedback successfully sent. We will reply you ASAP.
|
14 |
-
FeedbackError=Errors sending feedback. Please email us at aleste@intellywp.com
|
15 |
-
|
16 |
-
AboutNotice=Thank you for trying our amazing plugin. Now you are able to quickly track what you need. Feel free to contact us using our feedback form or our email <a href="mailto:aleste@intellywp.com">aleste@intellywp.com</a>
|
17 |
-
AboutTitle=We make Intelly plugins for your Intelly site
|
18 |
-
ManagerTitle=Tracking Code Manager FREE
|
19 |
-
ManagerSubtitle=<b>WARNING</b> This does not filter your HTML code for errors or for malicious scripts. Use it at your own risk.
|
20 |
-
SettingsTitle=Inline Related Posts (v.{0})
|
21 |
-
FaqTitle=F.A.Q. Frequently Asked Question
|
22 |
-
FeedbackHeader=Are you looking for new features? Send us a feedback
|
23 |
-
AboutText1=We are Stefan and Alex, two guys in love with Wordpress, coding and marketing! Our company IntellyWP is an idea to bring Intelly ideas to your Intelly site ;)
|
24 |
-
AboutText2=Feel free to reach us by the feedback form below.
|
25 |
-
|
26 |
-
CodeDeleteNotice=Tracking code "#{0} ({1})" successfully deleted
|
27 |
-
CodeUpdateNotice=Tracking code "#{0} ({1})" successfully updated
|
28 |
-
CodeAddNotice=Tracking code "#{0} ({1})" successfully added
|
29 |
-
|
30 |
-
FreeLicenseReached=You have reached the FREE version limit. Please buy the PREMIUM version or delete unused tracking code and create new ones.
|
31 |
-
EditTitle=Edit tracking code
|
32 |
-
EditSubtitle=Edit the information that you need and click "Save"
|
33 |
-
AddTitle=New tracking code
|
34 |
-
AddSubtitle=Fill in the information and click "Save"
|
35 |
-
EnableAllowTrackingNotice1=Currently we receive plugin usage information. It allows us to have a BETTER development so many many thanks from the development team.
|
36 |
-
EnableAllowTrackingNotice2=If you want to stop tracking please click <a href="{0}">HERE :(</a>
|
37 |
-
DisableAllowTrackingNotice1=Seems that you are not allowing us to receive plugin usage information. It allows us to have a BETTER development without collecting any sensitive-data.
|
38 |
-
DisableAllowTrackingNotice2=Please allow us to receive this information clicking <a href="{0}">HERE :)</a> once enabled you can disallow them in the About tab.
|
39 |
-
DisableAllowTrackingNotice3=Welcome on board from the IntellyWP team and many thanks for choosing our products!
|
40 |
-
|
41 |
-
Editor.active=Active?
|
42 |
-
Editor.name=Name
|
43 |
-
Editor.code=Paste your Tracking Code here
|
44 |
-
Editor.position.0=Before </HEAD>
|
45 |
-
Editor.position.1=After <BODY>
|
46 |
-
Editor.position.2=Before </BODY>
|
47 |
-
Editor.position=Position inside the code
|
48 |
-
Editor.includeEverywhereActive=Include in the whole website (pages, posts and archives)
|
49 |
-
Editor.includeCategoriesActive=Include in posts with specific categories
|
50 |
-
Editor.includeTagsActive=Include in posts with specific tags
|
51 |
-
Editor.includePostsOfTypeActive=Include in "<b>{0}</b>"
|
52 |
-
Editor.exceptCategoriesActive=Exclude in posts with specific categories
|
53 |
-
Editor.exceptTagsActive=Exclude in posts with specific tags
|
54 |
-
Editor.exceptPostsOfTypeActive=Exclude in "<b>{0}</b>"
|
55 |
-
Editor.includeLastPostsActive=Include in latest posts (specify the number of posts)
|
56 |
-
|
57 |
-
DeactivateSuccess=License key "{0}" successfully deactivated
|
58 |
-
DeactivateError=Errors deactivating key. Network problem??
|
59 |
-
ActivateSuccess1=License key "{0}" successfully activated
|
60 |
-
ActivateSuccess2=CONGRATS...YOU ARE NOW A PREMIUM MEMBER! :)
|
61 |
-
ActivateError=Errors activating key. Network problem or wrong activation key.
|
62 |
-
|
63 |
-
LicenseSection=License information
|
64 |
-
LicenseSectionSubtitle=Insert the activation key received by email in the text below to see all the settings
|
65 |
-
MetaboxSection=Metabox integration
|
66 |
-
MetaboxSectionSubtitle=You will display a metabox to disable the plugin in a specific post or page.
|
67 |
-
License.metabox=In "<b>{0}</b>"
|
68 |
-
License.key=Insert the activation key received by email
|
69 |
-
EmptyTrackingList=Your tracking code list is empty, please <a href="{0}">CLICK HERE</a> to create new ones.
|
70 |
-
|
71 |
-
Notice.ProHeader1=Do you like this plugin?
|
72 |
-
Notice.ProHeader2=Using the <b>PREMIUM</b> version you can also include/exclude tracking code:
|
73 |
-
Notice.ProFeature1=In your custom post type {0}
|
74 |
-
Notice.ProFeature2=In the latest post
|
75 |
-
Notice.ProFeature3=In specific categories
|
76 |
-
Notice.ProFeature4=In specific tags
|
77 |
-
|
78 |
-
QuestionActiveOn=Do you want to activate this code?
|
79 |
-
QuestionActiveOff=Do you want to deactivate this code?
|
80 |
-
|
81 |
-
GeneralSection=Style Settings
|
82 |
-
GeneralSectionSubtitle=Just few settings and Kaboooom!!
|
83 |
-
RewriteSection=Plugin Settings
|
84 |
-
RewriteSectionSubtitle=Set the plugin's behavior.
|
85 |
-
EngineSection=Engine Settings
|
86 |
-
EngineSectionSubtitle=Choose how the plugin discovers similar posts
|
87 |
-
PreviewSection=Real time preview
|
88 |
-
PreviewSectionSubtitle=Change any above settings to refresh preview OR <a href="javascript:IRP_changeRelatedBox()">REFRESH HERE</a>
|
89 |
-
PreviewSectionMaxTime=With these settings the plugin has ran in max {0} milliseconds with {1} different posts. Enjoy! :)
|
90 |
-
Settings.irpActive=Active?
|
91 |
-
Settings.irpText=Related text
|
92 |
-
Settings.irpBackgroundColor=Background Color
|
93 |
-
Settings.irpBorderColor=Border Color
|
94 |
-
Settings.irpRewriteActive=Insert in already existing posts?
|
95 |
-
Settings.irpRewriteBoxesCount=How many boxes per single post?
|
96 |
-
Settings.irpRewritePostsInBoxCount=Max posts per box N.
|
97 |
-
Settings.irpRewriteThreshold=Interval between the boxes <i>(minimum N° words)</i>
|
98 |
-
Settings.irpRewriteAtEnd=Insert a box at the end of the post? (if needed)
|
99 |
-
Settings.irpRewritePostType=Use on <b>{0}</b>
|
100 |
-
Settings.irpRewritePostsDays=Only posts of last N. days<br /><i>(set zero for no limits)</i>
|
101 |
-
Settings.irpEngineSearch=Search similar posts
|
102 |
-
Settings.irpEngineSearch.0=Using categories and tags
|
103 |
-
Settings.irpEngineSearch.1=Using only categories
|
104 |
-
Settings.irpEngineSearch.2=Using only tags
|
105 |
-
Settings.irpShowPoweredBy=Display "Powered by" text<br/><i>(and show us some love :)</i>
|
106 |
-
Settings.irpTemplate=Box template
|
107 |
-
Settings.irpTemplateBackgroundColor=Background color
|
108 |
-
Settings.irpTemplateBorderColor=Left border color
|
109 |
-
Settings.irpTemplateShadow=Shadow?
|
110 |
-
Settings.irpTemplateRelatedTextColor=Related Text Color
|
111 |
-
Settings.template-linkRel=Link "rel" attribute
|
112 |
-
Settings.template-linkTarget=Link "target" attribute
|
113 |
-
Settings.key=Activation key
|
114 |
-
|
115 |
-
TemplateName=Example template "{0}"
|
116 |
-
FirstTimeActivation=Thank you for activating our plugin. This is the page settings where you need to start to configure it. You will see this box only the first time.
|
117 |
-
Settings.metabox=Integrate in <b>"{0}"</b>
|
118 |
-
EditorSubtitle=Select the item that you want to insert into the box automatically created by the Intelly Related Posts
|
119 |
-
Faq.Question1=Why should I use this plugin?
|
120 |
-
Faq.Response1=Because it will increase the page views on your site, improving engagement and reducing your bounce rate.
|
121 |
-
Faq.Question2=Can I use the Inline related Posts plugin along with another Related posts plugin?
|
122 |
-
Faq.Response2=Yes you can! Our plugin puts fancy boxes INSIDE the content, not at the end of it.
|
123 |
-
Faq.Question3=Will this plugin break the structure of my content?
|
124 |
-
Faq.Response3=NOPE. Our algorithm knows HTML tags and avoid placing the boxes in the wrong place!
|
125 |
-
Faq.Question4=Will this plugin slow my website?
|
126 |
-
Faq.Response4=Absolutely Not! Inline Related Posts is built with lightweight code and you won’t notice any difference in speed using it.
|
127 |
-
|
128 |
-
EasySection=Easy Configuration
|
129 |
-
CoolSection=Cool Configuration (are you ready?)
|
130 |
-
Settings.template-ctaText=Related text or Call-To-Action
|
131 |
-
Settings.template-textTransform=Text transform
|
132 |
-
Settings.template-useDefaults=Use template colors schema
|
133 |
-
Settings.template-ctaTextColor=Related Text Color
|
134 |
-
Settings.template-ctaTextColorHover=Related Text Color Hover
|
135 |
-
Settings.template-ctaBoxColor=Related Box Color
|
136 |
-
Settings.template-ctaBoxColorHover=Related Box Color Hover
|
137 |
-
Settings.template-boxColor=Box Background Color
|
138 |
-
Settings.template-boxColorHover=Box Color Hover
|
139 |
-
Settings.template-postTitleColor=Post Title Color
|
140 |
-
Settings.template-postTitleColorHover=Post Title Color Hover
|
141 |
-
Settings.template-borderColor=Border Color
|
142 |
-
Settings.template-borderColorHover=Border Color Hover
|
143 |
-
Settings.template-useHoverDefaults=Use template hover colors schema
|
144 |
-
Settings.template-template=Theme
|
145 |
-
Settings.template-hasShadow=Display border shadow
|
146 |
-
Settings.template-hasPoweredBy=Display "Powered by" text <i>(and show us some love :)</i>
|
147 |
-
Settings.template-boxOpacity=Initial opacity %
|
148 |
-
Settings.Color.border=Border Color
|
149 |
-
Settings.Color.arrow=Arrow background Color
|
150 |
-
Settings.Color.hover=Hover Box background Color
|
151 |
-
Settings.Color.button=Button Color
|
152 |
-
Notice.DontSave=Please <a href="{0}">Buy PREMIUM</a> to use this theme
|
153 |
-
|
154 |
-
Notice.ProHeader1=Do you like this plugin?
|
155 |
-
Notice.ProHeader2=With <b>PREMIUM</b> version you can have awesome features like:
|
156 |
-
Notice.ProFeature1=Configure UNLIMITED Inline Related Boxes
|
157 |
-
Notice.ProFeature2=Premium box themes with featured images
|
158 |
-
Notice.ProFeature3=Configure hover effect with different colors
|
159 |
-
Notice.ProFeature4=24/7 World champion support
|
160 |
-
Notice.ProFeature5=FREE IntellyTrust: Solve your problem in 48h
|
161 |
-
Notice.ProFeature6=100 seconds Install & Forget
|
162 |
-
Notice.ProCTA=Check all premium features now ››
|
163 |
-
|
164 |
-
Sidebar.Title=How to contact us?
|
165 |
-
Sidebar1.Name=IntellyWP (homepage)
|
166 |
-
Sidebar1.Url=https://intellywp.com
|
167 |
-
Sidebar2.Name=Our plugins
|
168 |
-
Sidebar2.Url=https://intellywp.com/plugins
|
169 |
-
Sidebar3.Name=Contact support
|
170 |
-
Sidebar3.Url=http://intellywp.com/support
|
171 |
-
Sidebar4.Name=Like us on Facebook
|
172 |
-
Sidebar4.Url=https://www.facebook.com/intellywp/
|
173 |
-
Sidebar5.Name=Follow us on Twitter
|
174 |
-
Sidebar5.Url=https://twitter.com/intellywp
|
175 |
-
Sidebar6.Name=Rate us on Wordpress
|
176 |
-
Sidebar6.Url=https://wordpress.org/support/plugin/intelly-related-posts/reviews/#postform
|
177 |
-
|
178 |
-
Plugin1.Name=Tracking Code Manager
|
179 |
-
Plugin1.Permalink=https://wordpress.org/plugins/tracking-code-manager/
|
180 |
-
Plugin1.Subtitle=A plugin to manage ALL your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads.
|
181 |
-
Plugin2.Name=Welcome Bar
|
182 |
-
Plugin2.Permalink=https://wordpress.org/plugins/intelly-welcome-bar/
|
183 |
-
Plugin2.Subtitle=Increase engagement and drive specific offers to the visitors coming from a specific traffic source. As seen on BetaList and ProductHunt.
|
184 |
-
Plugin3.Name=Post's Footer Manager
|
185 |
-
Plugin3.Permalink=https://wordpress.org/plugins/intelly-posts-footer-manager
|
186 |
-
Plugin3.Subtitle=Clean the mess after your content! Organize your post's footer, insert what you want, order elements, create groups for specific categories.
|
187 |
-
Plugin4.Name=Evergreen Countdown Timer
|
188 |
-
Plugin4.Permalink=https://wordpress.org/plugins/intelly-countdown/
|
189 |
-
Plugin4.Subtitle=Evergreen Countdown is a plugin built for marketers that need a reliable solution to use scarcity on their websites and landing pages.
|
190 |
-
Plugin5.Name=GDPR Framework
|
191 |
-
Plugin5.Permalink=https://wordpress.org/plugins/gdpr-framework/
|
192 |
-
Plugin5.Subtitle=A plugin that gives you a simple and elegant interface to handle Data Subject Access Requests (DSARs) and more.
|
193 |
-
PluginCTA=See more..
|
194 |
-
|
195 |
-
YouHaveThePremiumVersion1=You have installed the PREMIUM version of this plugin, please click <a href="{0}">here</a> to have access at all the features.
|
196 |
-
YouHaveThePremiumVersion2=You can deactivate the "<b>Inline Related Posts</b>" plugin and only still active the "<b>Inline Related Posts PRO</b>" plugin
|
197 |
-
|
198 |
-
Settings.marginTop=CSS margin-top
|
199 |
-
Settings.marginBottom=CSS margin-bottom
|
200 |
-
GuruInfo=Below some GURU info (useful to request support at support@intellywp.com)
|
201 |
-
XdebugException=XdebugException: please contact our support at support@intellywp.com. Few hours and we will help you, guaranteed :)
|
1 |
+
#en_US
|
2 |
+
PluginLimit.Line1=In this FREE version you can insert up to N.{0} different Tracking Code (remaining N.{1})
|
3 |
+
PluginLimit.Line2=If you need more Tracking Code or more features please buy our PREMIUM version <a href="{0}" target="_blank"><b>HERE</b></a>
|
4 |
+
Editor.Add=Tracking Code "#{0} ({1})" successfully stored.
|
5 |
+
Button.Add=Add a new Tracking Code
|
6 |
+
Button.BuyPRO=Buy PREMIUM
|
7 |
+
|
8 |
+
Feedback.email=Contact email
|
9 |
+
Feedback.email.check=Please specify a valid email
|
10 |
+
Feedback.body=Feedback
|
11 |
+
Feedback.body.check=Please specify your feedback
|
12 |
+
Feedback.track=Send also track information (this can be very useful for us to solve your issue)
|
13 |
+
FeedbackSuccess=Feedback successfully sent. We will reply you ASAP.
|
14 |
+
FeedbackError=Errors sending feedback. Please email us at aleste@intellywp.com
|
15 |
+
|
16 |
+
AboutNotice=Thank you for trying our amazing plugin. Now you are able to quickly track what you need. Feel free to contact us using our feedback form or our email <a href="mailto:aleste@intellywp.com">aleste@intellywp.com</a>
|
17 |
+
AboutTitle=We make Intelly plugins for your Intelly site
|
18 |
+
ManagerTitle=Tracking Code Manager FREE
|
19 |
+
ManagerSubtitle=<b>WARNING</b> This does not filter your HTML code for errors or for malicious scripts. Use it at your own risk.
|
20 |
+
SettingsTitle=Inline Related Posts (v.{0})
|
21 |
+
FaqTitle=F.A.Q. Frequently Asked Question
|
22 |
+
FeedbackHeader=Are you looking for new features? Send us a feedback
|
23 |
+
AboutText1=We are Stefan and Alex, two guys in love with Wordpress, coding and marketing! Our company IntellyWP is an idea to bring Intelly ideas to your Intelly site ;)
|
24 |
+
AboutText2=Feel free to reach us by the feedback form below.
|
25 |
+
|
26 |
+
CodeDeleteNotice=Tracking code "#{0} ({1})" successfully deleted
|
27 |
+
CodeUpdateNotice=Tracking code "#{0} ({1})" successfully updated
|
28 |
+
CodeAddNotice=Tracking code "#{0} ({1})" successfully added
|
29 |
+
|
30 |
+
FreeLicenseReached=You have reached the FREE version limit. Please buy the PREMIUM version or delete unused tracking code and create new ones.
|
31 |
+
EditTitle=Edit tracking code
|
32 |
+
EditSubtitle=Edit the information that you need and click "Save"
|
33 |
+
AddTitle=New tracking code
|
34 |
+
AddSubtitle=Fill in the information and click "Save"
|
35 |
+
EnableAllowTrackingNotice1=Currently we receive plugin usage information. It allows us to have a BETTER development so many many thanks from the development team.
|
36 |
+
EnableAllowTrackingNotice2=If you want to stop tracking please click <a href="{0}">HERE :(</a>
|
37 |
+
DisableAllowTrackingNotice1=Seems that you are not allowing us to receive plugin usage information. It allows us to have a BETTER development without collecting any sensitive-data.
|
38 |
+
DisableAllowTrackingNotice2=Please allow us to receive this information clicking <a href="{0}">HERE :)</a> once enabled you can disallow them in the About tab.
|
39 |
+
DisableAllowTrackingNotice3=Welcome on board from the IntellyWP team and many thanks for choosing our products!
|
40 |
+
|
41 |
+
Editor.active=Active?
|
42 |
+
Editor.name=Name
|
43 |
+
Editor.code=Paste your Tracking Code here
|
44 |
+
Editor.position.0=Before </HEAD>
|
45 |
+
Editor.position.1=After <BODY>
|
46 |
+
Editor.position.2=Before </BODY>
|
47 |
+
Editor.position=Position inside the code
|
48 |
+
Editor.includeEverywhereActive=Include in the whole website (pages, posts and archives)
|
49 |
+
Editor.includeCategoriesActive=Include in posts with specific categories
|
50 |
+
Editor.includeTagsActive=Include in posts with specific tags
|
51 |
+
Editor.includePostsOfTypeActive=Include in "<b>{0}</b>"
|
52 |
+
Editor.exceptCategoriesActive=Exclude in posts with specific categories
|
53 |
+
Editor.exceptTagsActive=Exclude in posts with specific tags
|
54 |
+
Editor.exceptPostsOfTypeActive=Exclude in "<b>{0}</b>"
|
55 |
+
Editor.includeLastPostsActive=Include in latest posts (specify the number of posts)
|
56 |
+
|
57 |
+
DeactivateSuccess=License key "{0}" successfully deactivated
|
58 |
+
DeactivateError=Errors deactivating key. Network problem??
|
59 |
+
ActivateSuccess1=License key "{0}" successfully activated
|
60 |
+
ActivateSuccess2=CONGRATS...YOU ARE NOW A PREMIUM MEMBER! :)
|
61 |
+
ActivateError=Errors activating key. Network problem or wrong activation key.
|
62 |
+
|
63 |
+
LicenseSection=License information
|
64 |
+
LicenseSectionSubtitle=Insert the activation key received by email in the text below to see all the settings
|
65 |
+
MetaboxSection=Metabox integration
|
66 |
+
MetaboxSectionSubtitle=You will display a metabox to disable the plugin in a specific post or page.
|
67 |
+
License.metabox=In "<b>{0}</b>"
|
68 |
+
License.key=Insert the activation key received by email
|
69 |
+
EmptyTrackingList=Your tracking code list is empty, please <a href="{0}">CLICK HERE</a> to create new ones.
|
70 |
+
|
71 |
+
Notice.ProHeader1=Do you like this plugin?
|
72 |
+
Notice.ProHeader2=Using the <b>PREMIUM</b> version you can also include/exclude tracking code:
|
73 |
+
Notice.ProFeature1=In your custom post type {0}
|
74 |
+
Notice.ProFeature2=In the latest post
|
75 |
+
Notice.ProFeature3=In specific categories
|
76 |
+
Notice.ProFeature4=In specific tags
|
77 |
+
|
78 |
+
QuestionActiveOn=Do you want to activate this code?
|
79 |
+
QuestionActiveOff=Do you want to deactivate this code?
|
80 |
+
|
81 |
+
GeneralSection=Style Settings
|
82 |
+
GeneralSectionSubtitle=Just few settings and Kaboooom!!
|
83 |
+
RewriteSection=Plugin Settings
|
84 |
+
RewriteSectionSubtitle=Set the plugin's behavior.
|
85 |
+
EngineSection=Engine Settings
|
86 |
+
EngineSectionSubtitle=Choose how the plugin discovers similar posts
|
87 |
+
PreviewSection=Real time preview
|
88 |
+
PreviewSectionSubtitle=Change any above settings to refresh preview OR <a href="javascript:IRP_changeRelatedBox()">REFRESH HERE</a>
|
89 |
+
PreviewSectionMaxTime=With these settings the plugin has ran in max {0} milliseconds with {1} different posts. Enjoy! :)
|
90 |
+
Settings.irpActive=Active?
|
91 |
+
Settings.irpText=Related text
|
92 |
+
Settings.irpBackgroundColor=Background Color
|
93 |
+
Settings.irpBorderColor=Border Color
|
94 |
+
Settings.irpRewriteActive=Insert in already existing posts?
|
95 |
+
Settings.irpRewriteBoxesCount=How many boxes per single post?
|
96 |
+
Settings.irpRewritePostsInBoxCount=Max posts per box N.
|
97 |
+
Settings.irpRewriteThreshold=Interval between the boxes <i>(minimum N° words)</i>
|
98 |
+
Settings.irpRewriteAtEnd=Insert a box at the end of the post? (if needed)
|
99 |
+
Settings.irpRewritePostType=Use on <b>{0}</b>
|
100 |
+
Settings.irpRewritePostsDays=Only posts of last N. days<br /><i>(set zero for no limits)</i>
|
101 |
+
Settings.irpEngineSearch=Search similar posts
|
102 |
+
Settings.irpEngineSearch.0=Using categories and tags
|
103 |
+
Settings.irpEngineSearch.1=Using only categories
|
104 |
+
Settings.irpEngineSearch.2=Using only tags
|
105 |
+
Settings.irpShowPoweredBy=Display "Powered by" text<br/><i>(and show us some love :)</i>
|
106 |
+
Settings.irpTemplate=Box template
|
107 |
+
Settings.irpTemplateBackgroundColor=Background color
|
108 |
+
Settings.irpTemplateBorderColor=Left border color
|
109 |
+
Settings.irpTemplateShadow=Shadow?
|
110 |
+
Settings.irpTemplateRelatedTextColor=Related Text Color
|
111 |
+
Settings.template-linkRel=Link "rel" attribute
|
112 |
+
Settings.template-linkTarget=Link "target" attribute
|
113 |
+
Settings.key=Activation key
|
114 |
+
|
115 |
+
TemplateName=Example template "{0}"
|
116 |
+
FirstTimeActivation=Thank you for activating our plugin. This is the page settings where you need to start to configure it. You will see this box only the first time.
|
117 |
+
Settings.metabox=Integrate in <b>"{0}"</b>
|
118 |
+
EditorSubtitle=Select the item that you want to insert into the box automatically created by the Intelly Related Posts
|
119 |
+
Faq.Question1=Why should I use this plugin?
|
120 |
+
Faq.Response1=Because it will increase the page views on your site, improving engagement and reducing your bounce rate.
|
121 |
+
Faq.Question2=Can I use the Inline related Posts plugin along with another Related posts plugin?
|
122 |
+
Faq.Response2=Yes you can! Our plugin puts fancy boxes INSIDE the content, not at the end of it.
|
123 |
+
Faq.Question3=Will this plugin break the structure of my content?
|
124 |
+
Faq.Response3=NOPE. Our algorithm knows HTML tags and avoid placing the boxes in the wrong place!
|
125 |
+
Faq.Question4=Will this plugin slow my website?
|
126 |
+
Faq.Response4=Absolutely Not! Inline Related Posts is built with lightweight code and you won’t notice any difference in speed using it.
|
127 |
+
|
128 |
+
EasySection=Easy Configuration
|
129 |
+
CoolSection=Cool Configuration (are you ready?)
|
130 |
+
Settings.template-ctaText=Related text or Call-To-Action
|
131 |
+
Settings.template-textTransform=Text transform
|
132 |
+
Settings.template-useDefaults=Use template colors schema
|
133 |
+
Settings.template-ctaTextColor=Related Text Color
|
134 |
+
Settings.template-ctaTextColorHover=Related Text Color Hover
|
135 |
+
Settings.template-ctaBoxColor=Related Box Color
|
136 |
+
Settings.template-ctaBoxColorHover=Related Box Color Hover
|
137 |
+
Settings.template-boxColor=Box Background Color
|
138 |
+
Settings.template-boxColorHover=Box Color Hover
|
139 |
+
Settings.template-postTitleColor=Post Title Color
|
140 |
+
Settings.template-postTitleColorHover=Post Title Color Hover
|
141 |
+
Settings.template-borderColor=Border Color
|
142 |
+
Settings.template-borderColorHover=Border Color Hover
|
143 |
+
Settings.template-useHoverDefaults=Use template hover colors schema
|
144 |
+
Settings.template-template=Theme
|
145 |
+
Settings.template-hasShadow=Display border shadow
|
146 |
+
Settings.template-hasPoweredBy=Display "Powered by" text <i>(and show us some love :)</i>
|
147 |
+
Settings.template-boxOpacity=Initial opacity %
|
148 |
+
Settings.Color.border=Border Color
|
149 |
+
Settings.Color.arrow=Arrow background Color
|
150 |
+
Settings.Color.hover=Hover Box background Color
|
151 |
+
Settings.Color.button=Button Color
|
152 |
+
Notice.DontSave=Please <a href="{0}">Buy PREMIUM</a> to use this theme
|
153 |
+
|
154 |
+
Notice.ProHeader1=Do you like this plugin?
|
155 |
+
Notice.ProHeader2=With <b>PREMIUM</b> version you can have awesome features like:
|
156 |
+
Notice.ProFeature1=Configure UNLIMITED Inline Related Boxes
|
157 |
+
Notice.ProFeature2=Premium box themes with featured images
|
158 |
+
Notice.ProFeature3=Configure hover effect with different colors
|
159 |
+
Notice.ProFeature4=24/7 World champion support
|
160 |
+
Notice.ProFeature5=FREE IntellyTrust: Solve your problem in 48h
|
161 |
+
Notice.ProFeature6=100 seconds Install & Forget
|
162 |
+
Notice.ProCTA=Check all premium features now ››
|
163 |
+
|
164 |
+
Sidebar.Title=How to contact us?
|
165 |
+
Sidebar1.Name=IntellyWP (homepage)
|
166 |
+
Sidebar1.Url=https://intellywp.com
|
167 |
+
Sidebar2.Name=Our plugins
|
168 |
+
Sidebar2.Url=https://intellywp.com/plugins
|
169 |
+
Sidebar3.Name=Contact support
|
170 |
+
Sidebar3.Url=http://intellywp.com/support
|
171 |
+
Sidebar4.Name=Like us on Facebook
|
172 |
+
Sidebar4.Url=https://www.facebook.com/intellywp/
|
173 |
+
Sidebar5.Name=Follow us on Twitter
|
174 |
+
Sidebar5.Url=https://twitter.com/intellywp
|
175 |
+
Sidebar6.Name=Rate us on Wordpress
|
176 |
+
Sidebar6.Url=https://wordpress.org/support/plugin/intelly-related-posts/reviews/#postform
|
177 |
+
|
178 |
+
Plugin1.Name=Tracking Code Manager
|
179 |
+
Plugin1.Permalink=https://wordpress.org/plugins/tracking-code-manager/
|
180 |
+
Plugin1.Subtitle=A plugin to manage ALL your tracking code and conversion pixels. Compatible with Facebook Ads, Google Adwords, WooCommerce, Easy Digital Downloads.
|
181 |
+
Plugin2.Name=Welcome Bar
|
182 |
+
Plugin2.Permalink=https://wordpress.org/plugins/intelly-welcome-bar/
|
183 |
+
Plugin2.Subtitle=Increase engagement and drive specific offers to the visitors coming from a specific traffic source. As seen on BetaList and ProductHunt.
|
184 |
+
Plugin3.Name=Post's Footer Manager
|
185 |
+
Plugin3.Permalink=https://wordpress.org/plugins/intelly-posts-footer-manager
|
186 |
+
Plugin3.Subtitle=Clean the mess after your content! Organize your post's footer, insert what you want, order elements, create groups for specific categories.
|
187 |
+
Plugin4.Name=Evergreen Countdown Timer
|
188 |
+
Plugin4.Permalink=https://wordpress.org/plugins/intelly-countdown/
|
189 |
+
Plugin4.Subtitle=Evergreen Countdown is a plugin built for marketers that need a reliable solution to use scarcity on their websites and landing pages.
|
190 |
+
Plugin5.Name=GDPR Framework
|
191 |
+
Plugin5.Permalink=https://wordpress.org/plugins/gdpr-framework/
|
192 |
+
Plugin5.Subtitle=A plugin that gives you a simple and elegant interface to handle Data Subject Access Requests (DSARs) and more.
|
193 |
+
PluginCTA=See more..
|
194 |
+
|
195 |
+
YouHaveThePremiumVersion1=You have installed the PREMIUM version of this plugin, please click <a href="{0}">here</a> to have access at all the features.
|
196 |
+
YouHaveThePremiumVersion2=You can deactivate the "<b>Inline Related Posts</b>" plugin and only still active the "<b>Inline Related Posts PRO</b>" plugin
|
197 |
+
|
198 |
+
Settings.marginTop=CSS margin-top
|
199 |
+
Settings.marginBottom=CSS margin-bottom
|
200 |
+
GuruInfo=Below some GURU info (useful to request support at support@intellywp.com)
|
201 |
+
XdebugException=XdebugException: please contact our support at support@intellywp.com. Few hours and we will help you, guaranteed :)
|
readme.txt
CHANGED
@@ -87,6 +87,18 @@ Absolutely Not! Inline Related Posts is built with lightweight code so you won
|
|
87 |
9. Another Box Theme of Inline Related Posts PRO. Check other PREMIUM feature <a href="https://intellywp.com/intelly-related-posts/">here</a>. (https://intellywp.com/intelly-related-posts/)
|
88 |
|
89 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
= 3.0.2 =
|
91 |
*Release Date - 2021-05-07*
|
92 |
|
87 |
9. Another Box Theme of Inline Related Posts PRO. Check other PREMIUM feature <a href="https://intellywp.com/intelly-related-posts/">here</a>. (https://intellywp.com/intelly-related-posts/)
|
88 |
|
89 |
== Changelog ==
|
90 |
+
|
91 |
+
= 3.0.4 =
|
92 |
+
*Release Date - 2021-05-20*
|
93 |
+
|
94 |
+
* IWP-178 Additonal refactoring
|
95 |
+
* IWP-188 make "FAQ & Docs" tab open in new browser tab
|
96 |
+
|
97 |
+
= 3.0.3 =
|
98 |
+
*Release Date - 2021-05-08*
|
99 |
+
|
100 |
+
* IWP-170 Additional code rationalization & Performance changes, TinyMCE Editor resolution
|
101 |
+
|
102 |
= 3.0.2 =
|
103 |
*Release Date - 2021-05-07*
|
104 |
|