Inline Related Posts - Version 3.0.1

Version Description

Release Date - 2021-03-10

  • Links Update
  • Added : Right sidebar on option panel.
  • Tested with WP 5.7 Plugin updated and supported.
Download this release

Release Info

Developer IntellyWP
Plugin Icon 128x128 Inline Related Posts
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

assets/css/style.css CHANGED
@@ -1,154 +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
  }
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
  }
includes/admin/settings.php CHANGED
@@ -1,417 +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();
361
- $irp->Form->helps=FALSE;
362
- }
363
-
364
- function irp_notice_pro_features() {
365
- global $irp;
366
-
367
- ?>
368
- <br/>
369
- <div class="message updated below-h2" style="max-width:600px;">
370
- <div style="height:10px;"></div>
371
- <?php
372
- $i=1;
373
- while($irp->Lang->H('Notice.ProHeader'.$i)) {
374
- $irp->Lang->P('Notice.ProHeader'.$i);
375
- echo '<br/>';
376
- ++$i;
377
- }
378
- $i=1;
379
- ?>
380
- <br/>
381
- <?php
382
- /*
383
- $options = array('public' => TRUE, '_builtin' => FALSE);
384
- $q=get_post_types($options, 'names');
385
- if(is_array($q) && count($q)>0) {
386
- sort($q);
387
- $q=implode(', ', $q);
388
- $q='(<b>'.$q.'</b>)';
389
- } else {
390
- $q='';
391
- }*/
392
-
393
- while($irp->Lang->H('Notice.ProFeature'.$i)) { ?>
394
- <div style="clear:both; margin-top: 2px;"></div>
395
- <div style="float:left; vertical-align:middle; height:24px; margin-right:5px;">
396
- <img src="<?php echo IRP_PLUGIN_IMAGES?>tick.png" />
397
- </div>
398
- <div style="float:left; vertical-align:middle; height:24px;">
399
- <?php $irp->Lang->P('Notice.ProFeature'.$i)?>
400
- </div>
401
- <?php ++$i;
402
- }
403
- ?>
404
- <div style="clear:both;"></div>
405
- <div style="height:10px;"></div>
406
- <div style="float:right;">
407
- <?php
408
- $url=IRP_INTELLYWP_SITE.IRP_PLUGIN_SLUG.'/?utm_source=free-users&utm_medium=irp-cta&utm_campaign=IRP';
409
- ?>
410
- <a href="<?php echo $url?>" target="_blank">
411
- <b><?php $irp->Lang->P('Notice.ProCTA')?></b>
412
- </a>
413
- </div>
414
- <div style="height:10px; clear:both;"></div>
415
- </div>
416
- <br/>
417
- <?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/ui/Form.php CHANGED
@@ -1,455 +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() { ?>
126
- </form>
127
- <div style="clear:both;"></div>
128
- <?php }
129
-
130
- public function divStarts($args=array()) {
131
- $defaults=array();
132
- $other=$this->getTextArgs($args, $defaults);
133
- ?>
134
- <div <?php echo $other?>>
135
- <?php }
136
- public function divEnds() { ?>
137
- </div>
138
- <div style="clear:both;"></div>
139
- <?php }
140
-
141
- public function p($message, $v1=NULL, $v2=NULL, $v3=NULL, $v4=NULL, $v5=NULL) {
142
- global $irp;
143
- ?>
144
- <p style="font-weight:bold;">
145
- <?php
146
- $irp->Lang->P($message, $v1, $v2, $v3, $v4, $v5);
147
- if($irp->Lang->H($message.'Subtitle')) { ?>
148
- <br/>
149
- <span style="font-weight:normal;">
150
- <i><?php $irp->Lang->P($message.'Subtitle', $v1, $v2, $v3, $v4, $v5)?></i>
151
- </span>
152
- <?php } ?>
153
- </p>
154
- <?php }
155
-
156
- public function textarea($name, $value='', $args=NULL) {
157
- if(is_array($value) && isset($value[$name])) {
158
- $value=$value[$name];
159
- }
160
- $defaults=array('rows'=>10, 'class'=>'irp-textarea');
161
- $other=$this->getTextArgs($args, $defaults);
162
-
163
- $args=array('class'=>'irp-label', 'style'=>'width:auto;');
164
- $this->newline=TRUE;
165
- $this->leftInput($name, $args);
166
- ?>
167
- <textarea dir="ltr" dirname="ltr" id="<?php echo $name ?>" name="<?php echo $name?>" <?php echo $other?> ><?php echo $value ?></textarea>
168
- <?php
169
- $this->newline=FALSE;
170
- $this->rightInput($name, $args);
171
- }
172
-
173
- public function number($name, $value='', $options=NULL) {
174
- if(!$options) {
175
- $options=array();
176
- }
177
- $options['type']='number';
178
- $options['autocomplete']='off';
179
- $options['style']='width:100px;';
180
- if(!isset($options['min'])) {
181
- $options['min']=0;
182
- }
183
- //if(!isset($options['step'])) {
184
- // $options['step']=1;
185
- //}
186
- return $this->text($name, $value, $options);
187
- }
188
- public function text($name, $value='', $options=NULL) {
189
- if(is_array($value) && isset($value[$name])) {
190
- $value=$value[$name];
191
- }
192
- $type='text';
193
- if(isset($options['type'])) {
194
- $type=$options['type'];
195
- }
196
- $defaults=array('class'=>'irp-'.$type);
197
- $other=$this->getTextArgs($options, $defaults, 'type');
198
-
199
- $args=array('class'=>'irp-label');
200
- $this->leftInput($name, $args);
201
- ?>
202
- <input type="<?php echo $type?>" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
203
- <?php
204
- $this->rightInput($name, $args);
205
- }
206
-
207
- public function hidden($name, $value='', $args=NULL) {
208
- if(is_array($value) && isset($value[$name])) {
209
- $value=$value[$name];
210
- }
211
- $defaults=array();
212
- $other=$this->getTextArgs($args, $defaults);
213
- ?>
214
- <input type="hidden" id="<?php echo $name ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php echo $other?> />
215
- <?php }
216
-
217
- public function nonce($action=-1, $name='_wpnonce', $referer=true, $echo=true) {
218
- wp_nonce_field($action, $name, $referer, $echo);
219
- }
220
-
221
- public function colorSelect($name, $value, $options, $multiple=FALSE, $args=NULL) {
222
- $array=array();
223
- foreach($options as $k=>$v) {
224
- $color=(isset($v['color']) ? $v['color'] : '');
225
- $fontColor=(isset($v['fontColor']) ? $v['fontColor'] : 'white');
226
- $style='';
227
- if($color!='') {
228
- if($style!='') {
229
- $style.='; ';
230
- }
231
- $style.='background-color:'.$color;
232
- }
233
- if($fontColor!='') {
234
- if($style!='') {
235
- $style.='; ';
236
- }
237
- $style.='color:'.$fontColor.'; font-weight:bold';
238
- }
239
- $v['id']=$color;
240
- $v['name']=$k;
241
- $v['style']=$style;
242
- $array[]=$v;
243
- }
244
- if($args) {
245
- $args=array();
246
- }
247
- $args['class']='irpColorSelect';
248
- return $this->select($name, $value, $array, $multiple, $args);
249
- }
250
- public function select($name, $value, $options, $multiple=FALSE, $args=NULL) {
251
- global $irp;
252
- if(is_array($value) && isset($value[$name])) {
253
- $value=$value[$name];
254
- }
255
- $defaults=array('class'=>'irp-select');
256
- $other=$this->getTextArgs($args, $defaults);
257
-
258
- if(!is_array($value)) {
259
- $value=array($value);
260
- }
261
- if(is_string($options)) {
262
- $options=explode(',', $options);
263
- }
264
- if(is_array($options) && count($options)>0) {
265
- if(is_string($options[0]) || !isset($options[0][$this->selectIdField])) {
266
- //this is a normal array so I use the values for "id" field and the "name" into the txt file
267
- $temp=array();
268
- foreach($options as $v) {
269
- $item=array();
270
- $item[$this->selectIdField]=$v;
271
- $item['name']=$v;
272
- if($irp->Lang->H($this->prefix.'.'.$name.'.'.$v)) {
273
- $item['name']=$irp->Lang->L($this->prefix.'.'.$name.'.'.$v);
274
- }
275
- $temp[]=$item;
276
- }
277
- $options=$temp;
278
- }
279
- }
280
-
281
- $args=array('class'=>'irp-label');
282
- $this->leftInput($name, $args);
283
- ?>
284
- <select id="<?php echo $name ?>" name="<?php echo $name?><?php echo ($multiple ? '[]' : '')?>" <?php echo ($multiple ? 'multiple' : '')?> <?php echo $other?> >
285
- <?php
286
- foreach($options as $v) {
287
- $style='';
288
- if(isset($v['style'])) {
289
- $style=$v['style'];
290
- }
291
-
292
- $selected='';
293
- if(in_array($v[$this->selectIdField], $value)) {
294
- $selected=' selected="selected"';
295
- }
296
- ?>
297
- <option value="<?php echo $v[$this->selectIdField]?>" <?php echo $selected?> style="<?php echo $style?>"><?php echo $v['name']?></option>
298
- <?php } ?>
299
- </select>
300
- <?php
301
- $this->rightInput($name, $args);
302
- }
303
-
304
- public function submit($value='', $args=NULL) {
305
- global $irp;
306
- $defaults=array();
307
- $other=$this->getTextArgs($args, $defaults);
308
- if($value=='') {
309
- $value='Send';
310
- }
311
- $this->newline();
312
- ?>
313
- <input type="submit" class="button-primary irp-button irp-submit" value="<?php $irp->Lang->P($value)?>" <?php echo $other?>/>
314
- <?php }
315
-
316
- public function delete($id, $action='delete', $args=NULL) {
317
- global $irp;
318
- $defaults=array();
319
- $other=$this->getTextArgs($args, $defaults);
320
- ?>
321
- <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 ?>&amp;irp_nonce=<?php echo esc_attr(wp_create_nonce('irp_delete')); ?>';" <?php echo $other?> />
322
- &nbsp;
323
- <?php
324
- }
325
-
326
- public function radio($name, $current=1, $value=1, $args=NULL) {
327
- if(!is_array($args)) {
328
- $args=array();
329
- }
330
- $args['radio']=TRUE;
331
- $args['id']=$name.'_'.$value;
332
- return $this->checkbox($name, $current, $value, $args);
333
- }
334
- public function checkbox($name, $current=1, $value=1, $args=NULL) {
335
- global $irp;
336
- if(is_array($current) && isset($current[$name])) {
337
- $current=$current[$name];
338
- }
339
-
340
- /*
341
- $defaults=array('class'=>'irp-checkbox', 'style'=>'margin:0px; margin-right:4px;');
342
- if($this->premium && !$irp->License->hasPremium()) {
343
- $defaults['disabled']='disabled';
344
- $value='';
345
- }
346
- */
347
- if(!is_array($args)) {
348
- $args=array();
349
- }
350
-
351
- $label=$name;
352
- $type='checkbox';
353
- if(isset($args['radio']) && $args['radio']) {
354
- $type='radio';
355
- $label.='_'.$value;
356
- }
357
-
358
- $defaults=array(
359
- 'class'=>'irp-checkbox'
360
- , 'style'=>'margin:0px; margin-right:4px;'
361
- , 'id'=>$name
362
- );
363
- $other=$this->getTextArgs($args, $defaults, 'radio,label,type');
364
- $prev=$this->leftLabels;
365
- $this->leftLabels=FALSE;
366
-
367
- $label=(isset($args['label']) ? $args['label'] : $this->prefix.'.'.$label);
368
- $id=(isset($args['id']) ? $args['id'] : $name);
369
- $args=array(
370
- 'class'=>''
371
- , 'style'=>'margin-top:-1px;'
372
- , 'label'=>$label
373
- , 'id'=>$id
374
- );
375
- $this->leftInput($name, $args);
376
- ?>
377
- <input type="<?php echo $type ?>" name="<?php echo $name?>" value="<?php echo $value?>" <?php echo($current==$value ? 'checked="checked"' : '') ?> <?php echo $other?> >
378
- <?php
379
- $this->rightInput($name, $args);
380
- $this->leftLabels=$prev;
381
- }
382
-
383
- public function checkText($nameActive, $nameText, $value) {
384
- global $irp;
385
-
386
- $args=array('class'=>'irp-hideShow irp-checkbox'
387
- , 'irp-hideIfTrue'=>'false'
388
- , 'irp-hideShow'=>$nameText.'Text');
389
- $this->checkbox($nameActive, $value, 1, $args);
390
- ?>
391
- <div id="<?php echo $nameText?>Text" style="float:left;">
392
- <?php
393
- $prev=$this->labels;
394
- $this->labels=FALSE;
395
- $args=array();
396
- $this->text($nameText, $value, $args);
397
- $this->labels=$prev;
398
- ?>
399
- </div>
400
- <?php }
401
-
402
- //create a checkbox with a left select visible only when the checkbox is selected
403
- public function checkSelect($nameActive, $nameArray, $value, $values) {
404
- global $irp;
405
- ?>
406
- <div id="<?php echo $nameArray?>Box" style="float:left;">
407
- <?php
408
- $args=array('class'=>'irp-hideShow irp-checkbox'
409
- , 'irp-hideIfTrue'=>'false'
410
- , 'irp-hideShow'=>$nameArray.'Tags');
411
- $this->checkbox($nameActive, $value, 1, $args);
412
- if(TRUE) { ?>
413
- <div id="<?php echo $nameArray?>Tags" style="float:left;">
414
- <?php
415
- $prev=$this->labels;
416
- $this->labels=FALSE;
417
- $args=array('class'=>'irp-select irpLineTags');
418
- $this->select($nameArray, $value, $values, TRUE, $args);
419
- $this->labels=$prev;
420
- ?>
421
- </div>
422
- <?php } ?>
423
- </div>
424
- <?php
425
- $this->newline();
426
- }
427
-
428
- public function br() { ?>
429
- <br/>
430
- <?php }
431
- public function tag($overridePremium=FALSE) {
432
- global $irp;
433
- /*
434
- $premium=($overridePremium || $this->premium);
435
- if((!$overridePremium && !$this->tags) || $irp->License->hasPremium() || ($this->onlyPremium && !$premium)) return;
436
-
437
- $tagClass='irp-tag-free';
438
- $tagText='FREE';
439
- if($premium) {
440
- $tagClass='irp-tag-premium';
441
- $tagText='<a href="'.irp_PAGE_PREMIUM.'" target="_new">PRO</a>';
442
- }
443
- */
444
-
445
- if(!$this->tags || !$this->tagNew) {
446
- return;
447
- }
448
-
449
- $tagClass='irp-tag-free';
450
- $tagText='NEW!';
451
- ?>
452
- <div style="float:left;" class="irp-tag <?php echo $tagClass?>"><?php echo $tagText?></div>
453
- <?php
454
- }
 
 
 
455
  }
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 ?>&amp;irp_nonce=<?php echo esc_attr(wp_create_nonce('irp_delete')); ?>';" <?php echo $other?> />
325
+ &nbsp;
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,185 +1,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 showTabs($defaultTab) {
146
- global $irp;
147
- $tab=$irp->Check->of('tab', $defaultTab);
148
- if($tab==IRP_TAB_DOCS) {
149
- $irp->Utils->redirect(IRP_TAB_DOCS_URI);
150
- }
151
-
152
- ?>
153
- <h2 class="nav-tab-wrapper" style="float:left; width:97%;">
154
- <?php
155
- foreach ($this->tabs as $k=>$v) {
156
- $active = ($tab==$k ? 'nav-tab-active' : '');
157
- ?>
158
- <a style="float:left; margin-left:10px;" class="nav-tab <?php echo $active?>" href="?page=<?php echo IRP_PLUGIN_SLUG?>&tab=<?php echo $k?>"><?php echo $v?></a>
159
- <?php
160
- }
161
- ?>
162
- <style>
163
- .starrr {display:inline-block}
164
- .starrr i{font-size:16px;padding:0 1px;cursor:pointer;color:#2ea2cc;}
165
- </style>
166
- <div style="float:right; display:none;" id="rate-box">
167
- <span style="font-weight:700; font-size:13px; color:#555;"><?php $irp->Lang->P('Rate us')?></span>
168
- <div id="irp-rate" class="starrr" data-connected-input="irp-rate-rank"></div>
169
- <input type="hidden" id="irp-rate-rank" name="irp-rate-rank" value="5" />
170
- <?php $irp->Utils->twitter('intellywp') ?>
171
- </div>
172
- <script>
173
- jQuery(function() {
174
- jQuery(".starrr").starrr();
175
- jQuery('#irp-rate').on('starrr:change', function(e, value){
176
- var url='https://wordpress.org/support/view/plugin-reviews/<?php echo IRP_PLUGIN_SLUG?>?rate=5#postform';
177
- window.open(url);
178
- });
179
- jQuery('#rate-box').show();
180
- });
181
- </script>
182
- </h2>
183
- <div style="clear:both;"></div>
184
- <?php }
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <h2 class="nav-tab-wrapper" style="float:left; width:97%;">
203
+ <?php
204
+ foreach ($this->tabs as $k=>$v) {
205
+ $active = ($tab==$k ? 'nav-tab-active' : '');
206
+ ?>
207
+ <a style="float:left; margin-left:10px;" class="nav-tab <?php echo $active?>" href="?page=<?php echo IRP_PLUGIN_SLUG?>&tab=<?php echo $k?>"><?php echo $v?></a>
208
+ <?php
209
+ }
210
+ ?>
211
+ <style>
212
+ .starrr {display:inline-block}
213
+ .starrr i{font-size:16px;padding:0 1px;cursor:pointer;color:#2ea2cc;}
214
+ </style>
215
+ <div style="float:right; display:none;" id="rate-box">
216
+ <span style="font-weight:700; font-size:13px; color:#555;"><?php $irp->Lang->P('Rate us')?></span>
217
+ <div id="irp-rate" class="starrr" data-connected-input="irp-rate-rank"></div>
218
+ <input type="hidden" id="irp-rate-rank" name="irp-rate-rank" value="5" />
219
+ <?php $irp->Utils->twitter('intellywp') ?>
220
+ </div>
221
+ <script>
222
+ jQuery(function() {
223
+ jQuery(".starrr").starrr();
224
+ jQuery('#irp-rate').on('starrr:change', function(e, value){
225
+ var url='https://wordpress.org/support/view/plugin-reviews/<?php echo IRP_PLUGIN_SLUG?>?rate=5#postform';
226
+ window.open(url);
227
+ });
228
+ jQuery('#rate-box').show();
229
+ });
230
+ </script>
231
+ </h2>
232
+ <div style="clear:both;"></div>
233
+ <?php }
234
+ }
index.php CHANGED
@@ -2,17 +2,17 @@
2
  /*
3
  Plugin Name: Inline Related Posts
4
  Plugin URI: http://intellywp.com/intelly-related-posts/
5
- Description: Finally the plugin to insert INLINE related posts.
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: support@intellywp.com
9
- Version: 3.0.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.0');
16
  define('IRP_PLUGIN_AUTHOR', 'IntellyWP');
17
  define('IRP_PLUGIN_ROOT', dirname(__FILE__).'/');
18
  define('IRP_PLUGIN_IMAGES', plugins_url( 'assets/images/', __FILE__ ));
2
  /*
3
  Plugin Name: Inline Related Posts
4
  Plugin URI: http://intellywp.com/intelly-related-posts/
5
+ Description: Inline Related Posts AUTOMATICALLY inserts related posts INSIDE your content, capturing immediately the reader's attention
6
  Author: IntellyWP
7
  Author URI: http://intellywp.com/
8
  Email: support@intellywp.com
9
+ Version: 3.0.1
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.1');
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
@@ -161,10 +161,41 @@ 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
  YouHaveThePremiumVersion1=You have installed the PREMIUM version of this plugin, please click <a href="{0}">here</a> to have access at all the features.
165
  YouHaveThePremiumVersion2=You can deactivate the "<b>Inline Related Posts</b>" plugin and only still active the "<b>Inline Related Posts PRO</b>" plugin
166
 
167
  Settings.marginTop=CSS margin-top
168
  Settings.marginBottom=CSS margin-bottom
169
  GuruInfo=Below some GURU info (useful to request support at support@intellywp.com)
170
- XdebugException=XdebugException: please contact our support at support@intellywp.com. Few hours and we will help you, guaranteed :)
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
@@ -1,9 +1,8 @@
1
  === Inline Related Posts ===
2
  Contributors: IntellyWP, data443
3
- Donate link: http://intellywp.com/intelly-related-posts/
4
  Tags: related post,related posts,inline related posts, inside related posts, suggestions, similar post, similar posts, related,contextual, relations, seo, bounce rate, internal links, similarity, related content, inline related post, Zemanta, inline, Related Links, Contextual Related Posts, YARPP recommendation engine, YARPP
5
  Requires at least: 2.7
6
- Tested up to: 5.6
7
 
8
  Inline Related Posts AUTOMATICALLY inserts related posts INSIDE your content, capturing immediately the reader's attention.
9
 
@@ -89,6 +88,13 @@ Absolutely Not! Inline Related Posts is built with lightweight code so you won
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
 
92
  = 3.0.0 =
93
  *Release Date - 2021-01-19*
94
 
1
  === Inline Related Posts ===
2
  Contributors: IntellyWP, data443
 
3
  Tags: related post,related posts,inline related posts, inside related posts, suggestions, similar post, similar posts, related,contextual, relations, seo, bounce rate, internal links, similarity, related content, inline related post, Zemanta, inline, Related Links, Contextual Related Posts, YARPP recommendation engine, YARPP
4
  Requires at least: 2.7
5
+ Tested up to: 5.7
6
 
7
  Inline Related Posts AUTOMATICALLY inserts related posts INSIDE your content, capturing immediately the reader's attention.
8
 
88
 
89
  == Changelog ==
90
 
91
+ = 3.0.1 =
92
+ *Release Date - 2021-03-10*
93
+
94
+ * Links Update
95
+ * Added : Right sidebar on option panel.
96
+ * Tested with WP 5.7 Plugin updated and supported.
97
+
98
  = 3.0.0 =
99
  *Release Date - 2021-01-19*
100