| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace JP\CC\Admin; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
|
| 11 |
class Footer_Templates { |
| 12 |
|
| 13 |
public static function fields() { |
| 14 |
?> |
| 15 |
<script type="text/html" id="tmpl-jp-cc-field-section"> |
| 16 |
<div class="jp-cc-field-section {{data.classes}}"> |
| 17 |
<# _.each(data.fields, function(field) { #> |
| 18 |
{{{field}}} |
| 19 |
<# }); #> |
| 20 |
</div> |
| 21 |
</script> |
| 22 |
|
| 23 |
<script type="text/html" id="tmpl-jp-cc-field-wrapper"> |
| 24 |
<div class="jp-cc-field jp-cc-field-{{data.type}} {{data.id}}-wrapper {{data.classes}}" data-id="{{data.id}}"> |
| 25 |
<label for="{{data.id}}">{{data.label}}</label> |
| 26 |
{{{data.field}}} |
| 27 |
<# if (data.desc) { #> |
| 28 |
<span class="jp-cc-desc desc">{{data.desc}}</span> |
| 29 |
<# } #> |
| 30 |
</div> |
| 31 |
</script> |
| 32 |
|
| 33 |
<script type="text/html" id="tmpl-jp-cc-field-heading"> |
| 34 |
<h3 class="jp-cc-field-heading">{{data.desc}}</h3> |
| 35 |
</script> |
| 36 |
|
| 37 |
<script type="text/html" id="tmpl-jp-cc-field-separator"> |
| 38 |
<hr {{{data.meta}}}/> |
| 39 |
</script> |
| 40 |
|
| 41 |
<script type="text/html" id="tmpl-jp-cc-field-text"> |
| 42 |
<input type="text" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 43 |
</script> |
| 44 |
|
| 45 |
<script type="text/html" id="tmpl-jp-cc-field-link"> |
| 46 |
<button type="button" class="dashicons dashicons-admin-generic button"></button> |
| 47 |
<input type="text" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 48 |
</script> |
| 49 |
|
| 50 |
<script type="text/html" id="tmpl-jp-cc-field-range"> |
| 51 |
<input type="range" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 52 |
</script> |
| 53 |
|
| 54 |
<script type="text/html" id="tmpl-jp-cc-field-search"> |
| 55 |
<input type="search" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 56 |
</script> |
| 57 |
|
| 58 |
<script type="text/html" id="tmpl-jp-cc-field-number"> |
| 59 |
<input type="number" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 60 |
</script> |
| 61 |
|
| 62 |
<script type="text/html" id="tmpl-jp-cc-field-email"> |
| 63 |
<input type="email" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 64 |
</script> |
| 65 |
|
| 66 |
<script type="text/html" id="tmpl-jp-cc-field-url"> |
| 67 |
<input type="url" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 68 |
</script> |
| 69 |
|
| 70 |
<script type="text/html" id="tmpl-jp-cc-field-tel"> |
| 71 |
<input type="tel" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 72 |
</script> |
| 73 |
|
| 74 |
<script type="text/html" id="tmpl-jp-cc-field-password"> |
| 75 |
<input type="password" placeholder="{{data.placeholder}}" class="{{data.size}}-text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 76 |
</script> |
| 77 |
|
| 78 |
<script type="text/html" id="tmpl-jp-cc-field-textarea"> |
| 79 |
<textarea name="{{data.name}}" id="{{data.id}}" class="{{data.size}}-text" {{{data.meta}}}>{{data.value}}</textarea> |
| 80 |
</script> |
| 81 |
|
| 82 |
<script type="text/html" id="tmpl-jp-cc-field-editor"> |
| 83 |
<textarea name="{{data.name}}" id="{{data.id}}" class="jp-cc-wpeditor {{data.size}}-text" {{{data.meta}}}>{{data.value}}</textarea> |
| 84 |
</script> |
| 85 |
|
| 86 |
<script type="text/html" id="tmpl-jp-cc-field-hidden"> |
| 87 |
<input type="hidden" class="{{data.classes}}" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" {{{data.meta}}} /> |
| 88 |
</script> |
| 89 |
|
| 90 |
<script type="text/html" id="tmpl-jp-cc-field-select"> |
| 91 |
<select id="{{data.id}}" name="{{data.name}}" data-allow-clear="true" {{{data.meta}}}> |
| 92 |
<# _.each(data.options, function(option, key) { |
| 93 |
|
| 94 |
if (option.options !== undefined && option.options.length) { #> |
| 95 |
|
| 96 |
<optgroup label="{{option.label}}"> |
| 97 |
|
| 98 |
<# _.each(option.options, function(option, key) { #> |
| 99 |
<option value="{{option.value}}" {{{option.meta}}}>{{option.label}}</option> |
| 100 |
<# }); #> |
| 101 |
|
| 102 |
</optgroup> |
| 103 |
|
| 104 |
<# } else { #> |
| 105 |
<option value="{{option.value}}" {{{option.meta}}}>{{option.label}}</option> |
| 106 |
<# } |
| 107 |
}); #> |
| 108 |
</select> |
| 109 |
</script> |
| 110 |
|
| 111 |
<script type="text/html" id="tmpl-jp-cc-field-checkbox"> |
| 112 |
<input type="checkbox" id="{{data.id}}" name="{{data.name}}" value="1" {{{data.meta}}} /> |
| 113 |
</script> |
| 114 |
|
| 115 |
<script type="text/html" id="tmpl-jp-cc-field-multicheck"> |
| 116 |
<ul class="jp-cc-field-mulitcheck-list"> |
| 117 |
<# _.each(data.options, function(option, key) { #> |
| 118 |
<li> |
| 119 |
<input type="checkbox" id="{{data.id}}_{{key}}" name="{{data.name}}[{{option.value}}]" value="1" {{{option.meta}}} /> |
| 120 |
<label for="{{data.id}}_{{key}}">{{option.label}}</label> |
| 121 |
</li> |
| 122 |
<# }); #> |
| 123 |
</ul> |
| 124 |
</script> |
| 125 |
|
| 126 |
<script type="text/html" id="tmpl-jp-cc-field-rangeslider"> |
| 127 |
<input type="text" id="{{data.id}}" name="{{data.name}}" value="{{data.value}}" class="popmake-range-manual jp-cc-range-manual" {{{data.meta}}} /> |
| 128 |
<span class="range-value-unit regular-text">{{data.unit}}</span> |
| 129 |
</script> |
| 130 |
|
| 131 |
<?php |
| 132 |
} |
| 133 |
|
| 134 |
public static function helpers() { |
| 135 |
?> |
| 136 |
<script type="text/html" id="tmpl-jp-cc-modal"> |
| 137 |
<div id="{{data.id}}" class="jp-cc-modal-background {{data.classes}}" role="dialog" aria-hidden="true" aria-labelledby="{{data.id}}-title" aria-describedby="{{data.id}}-description" {{{data.meta}}}> |
| 138 |
|
| 139 |
<div class="jp-cc-modal-wrap"> |
| 140 |
|
| 141 |
<form class="jp-cc-form"> |
| 142 |
|
| 143 |
<div class="jp-cc-modal-header"> |
| 144 |
|
| 145 |
<# if (data.title.length) { #> |
| 146 |
<span id="{{data.id}}-title" class="jp-cc-modal-title">{{data.title}}</span> |
| 147 |
<# } #> |
| 148 |
|
| 149 |
<button type="button" class="jp-cc-modal-close" aria-label="<?php _e( 'Close', 'content-control' ); ?>"></button> |
| 150 |
|
| 151 |
</div> |
| 152 |
|
| 153 |
<# if (data.description.length) { #> |
| 154 |
<span id="{{data.id}}-description" class="screen-reader-text">{{data.description}}</span> |
| 155 |
<# } #> |
| 156 |
|
| 157 |
<div class="jp-cc-modal-content"> |
| 158 |
{{{data.content}}} |
| 159 |
</div> |
| 160 |
|
| 161 |
<# if (data.save_button || data.cancel_button) { #> |
| 162 |
|
| 163 |
<div class="jp-cc-modal-footer submitbox"> |
| 164 |
|
| 165 |
<# if (data.cancel_button) { #> |
| 166 |
<div class="cancel"> |
| 167 |
<button type="button" class="submitdelete no-button" href="#">{{data.cancel_button}}</button> |
| 168 |
</div> |
| 169 |
<# } #> |
| 170 |
|
| 171 |
<# if (data.save_button) { #> |
| 172 |
<div class="jp-cc-submit"> |
| 173 |
<span class="spinner"></span> |
| 174 |
<button class="button button-primary">{{data.save_button}}</button> |
| 175 |
</div> |
| 176 |
<# } #> |
| 177 |
|
| 178 |
</div> |
| 179 |
|
| 180 |
<# } #> |
| 181 |
|
| 182 |
</form> |
| 183 |
|
| 184 |
</div> |
| 185 |
|
| 186 |
</div> |
| 187 |
</script> |
| 188 |
|
| 189 |
<script type="text/html" id="tmpl-jp-cc-tabs"> |
| 190 |
<div class="jp-cc-tabs-container {{data.classes}}" {{data.meta}}> |
| 191 |
|
| 192 |
<ul class="tabs"> |
| 193 |
<# _.each(data.tabs, function(tab, key) { #> |
| 194 |
<li class="tab"> |
| 195 |
<a href="#{{data.id + '_' + key}}">{{tab.label}}</a> |
| 196 |
</li> |
| 197 |
<# }); #> |
| 198 |
</ul> |
| 199 |
|
| 200 |
<# _.each(data.tabs, function(tab, key) { #> |
| 201 |
<div id="{{data.id + '_' + key}}" class="tab-content"> |
| 202 |
{{{tab.content}}} |
| 203 |
</div> |
| 204 |
<# }); #> |
| 205 |
|
| 206 |
</div> |
| 207 |
</script> |
| 208 |
|
| 209 |
<script type="text/html" id="tmpl-jp-cc-shortcode"> |
| 210 |
[{{{data.tag}}} {{{data.meta}}}] |
| 211 |
</script> |
| 212 |
|
| 213 |
<script type="text/html" id="tmpl-jp-cc-shortcode-w-content"> |
| 214 |
[{{{data.tag}}} {{{data.meta}}}]{{{data.content}}}[/{{{data.tag}}}] |
| 215 |
</script> |
| 216 |
<?php |
| 217 |
} |
| 218 |
|
| 219 |
public static function restrictions() { |
| 220 |
?> |
| 221 |
|
| 222 |
<script type="text/html" id="tmpl-jp-cc-restriction-table-row"> |
| 223 |
<tr data-index="{{data.index}}"> |
| 224 |
<th scope="row" class="check-column"> |
| 225 |
<label class="screen-reader-text" for="cb-select-{{data.index}}"> |
| 226 |
<?php _e( 'Select restriction', 'content-control' ); ?> |
| 227 |
</label> |
| 228 |
<input id="cb-select-{{data.index}}" type="checkbox" name="restriction[]" value="{{data.index}}"> |
| 229 |
<div class="locked-indicator"></div> |
| 230 |
</th> |
| 231 |
<td><i class="dashicons dashicons-menu"></i></td> |
| 232 |
<td> |
| 233 |
<strong> |
| 234 |
<a href="#{{data.index}}" class="edit_restriction row-title"> |
| 235 |
{{data.title}} |
| 236 |
</a> |
| 237 |
</strong> |
| 238 |
<input type="hidden" class="jp_cc_restriction" name="jp_cc_settings[restrictions][]" value='{{JSON.stringify(data)}}' /> |
| 239 |
<div class="row-actions"> |
| 240 |
<span class="edit"> |
| 241 |
<button type="button" class="edit_restriction no-button link-button" aria-label="<?php echo _x( 'Edit “{{data.title}}”', 'Edit button label for restriction table', 'content-control' ); ?>"><?php _e( 'Edit', 'content-control' ); ?></button> | |
| 242 |
</span> |
| 243 |
<span class="trash"> |
| 244 |
<button type="button" class="remove_restriction no-button link-button delete-button" aria-label="<?php echo _x( 'Delete “{{data.title}}!”', 'Trash button label for restriction table', 'content-control' ); ?>"><?php _e( 'Trash', 'content-control' ); ?></button> | |
| 245 |
</span> |
| 246 |
</div> |
| 247 |
</td> |
| 248 |
<td> |
| 249 |
<# switch (data.who) { |
| 250 |
case '' : print("<strong><?php _e( 'Everyone', 'content-control' ); ?></strong>"); |
| 251 |
break; |
| 252 |
case 'logged_out' : print("<strong><?php _e( 'Logged Out Users', 'content-control' ); ?></strong>"); |
| 253 |
break; |
| 254 |
case 'logged_in' : |
| 255 |
print("<strong><?php _e( 'Logged In Users', 'content-control' ); ?></strong>: "); |
| 256 |
if (Object.keys(data.roles).length !== 0) { |
| 257 |
var roles = [] |
| 258 |
for (key in data.roles) { |
| 259 |
roles.push(key.charAt(0).toUpperCase() + key.slice(1)); |
| 260 |
} |
| 261 |
print(roles.join(', ')); |
| 262 |
} else { |
| 263 |
print("<?php _e( 'All Users', 'content-control' ); ?>"); |
| 264 |
} |
| 265 |
break; |
| 266 |
} #> |
| 267 |
<!--<br/> |
| 268 |
<small>All Pages OR All Posts with Tag: XYZ</small>--> |
| 269 |
</td> |
| 270 |
</tr> |
| 271 |
</script> |
| 272 |
<?php |
| 273 |
} |
| 274 |
|
| 275 |
public static function conditions_editor() { |
| 276 |
?> |
| 277 |
<script type="text/html" id="tmpl-jp-cc-field-conditions"> |
| 278 |
<# |
| 279 |
print(JPCC.conditions.template.editor({ |
| 280 |
groups: data.value |
| 281 |
})); |
| 282 |
#> |
| 283 |
</script> |
| 284 |
|
| 285 |
<script type="text/html" id="tmpl-jp-cc-condition-editor"> |
| 286 |
<div class="facet-builder <# if (data.groups && data.groups.length) { print('has-conditions'); } #>"> |
| 287 |
<p> |
| 288 |
<strong> |
| 289 |
<?php _e( 'Apply this restriction if the user views content that is:', 'content-control' ); ?> |
| 290 |
<?php /* printf( '%2$s<i class="dashicons dashicons-editor-help" title="%1$s"></i>%3$s', |
| 291 |
__( 'Learn more about restriction content conditions', 'content-control' ), |
| 292 |
'<a href="http://docs.wppopupmaker.com/article/140-conditions" target="_blank">', |
| 293 |
'</a>' |
| 294 |
); */ ?> |
| 295 |
</strong> |
| 296 |
</p> |
| 297 |
|
| 298 |
<p><?php _e( 'When users visit your site, the plugin will check the viewed content against your selection below and permit or deny access.', 'content-control' ); ?></p> |
| 299 |
|
| 300 |
|
| 301 |
<section class="jp-cc-alert-box" style="display:none"></section> |
| 302 |
<div class="facet-groups condition-groups"> |
| 303 |
<# |
| 304 |
_.each(data.groups, function (group, group_ID) { |
| 305 |
print(JPCC.conditions.template.group({ |
| 306 |
index: group_ID, |
| 307 |
facets: group |
| 308 |
})); |
| 309 |
}); |
| 310 |
#> |
| 311 |
</div> |
| 312 |
<div class="no-facet-groups"> |
| 313 |
<label for="jp-cc-first-condition"><?php _e( 'Choose a content type to get started.', 'content-control' ); ?></label> |
| 314 |
<div class="jp-cc-field select jpselect2 jp-cc-facet-target"> |
| 315 |
<button type="button" class="jp-cc-not-operand" aria-label="<?php _e( 'Enable the Not Operand', 'content-control' ); ?>"> |
| 316 |
<span class="is"><?php _e( 'Is', 'content-control' ); ?></span> |
| 317 |
<span class="not"><?php _e( 'Is Not', 'content-control' ); ?></span> |
| 318 |
<input type="checkbox" id="jp-cc-first-facet-operand" value="1" /> |
| 319 |
</button> |
| 320 |
<# print(JPCC.conditions.template.selectbox({id: 'jp-cc-first-condition', name: ""})); #> |
| 321 |
</div> |
| 322 |
</div> |
| 323 |
</div> |
| 324 |
</script> |
| 325 |
|
| 326 |
<script type="text/html" id="tmpl-jp-cc-condition-group"> |
| 327 |
|
| 328 |
<div class="facet-group-wrap" data-index="{{data.index}}"> |
| 329 |
<section class="facet-group"> |
| 330 |
<div class="facet-list"> |
| 331 |
<# |
| 332 |
_.each(data.facets, function (facet) { |
| 333 |
print(JPCC.conditions.template.facet(facet)); |
| 334 |
}); |
| 335 |
#> |
| 336 |
</div> |
| 337 |
<div class="add-or"> |
| 338 |
<button type="button" class="add add-facet no-button" aria-label="<?php _ex( 'Add another OR condition', 'aria-label for add new OR condition button', 'content-control' ); ?>"><?php _e( 'or', 'content-control' ); ?></button> |
| 339 |
</div> |
| 340 |
</section> |
| 341 |
<p class="and"> |
| 342 |
<button type="button" class="add-facet no-button" aria-label="<?php _ex( 'Add another AND condition group', 'aria-label for add new AND condition button', 'content-control' ); ?>"><?php _e( 'and', 'content-control' ); ?></button> |
| 343 |
</p> |
| 344 |
</div> |
| 345 |
</script> |
| 346 |
|
| 347 |
<script type="text/html" id="tmpl-jp-cc-condition-facet"> |
| 348 |
<div class="facet" data-index="{{data.index}}" data-target="{{data.target}}"> |
| 349 |
<i class="or"><?php _e( 'or', 'content-control' ); ?></i> |
| 350 |
<div class="facet-col jp-cc-field jp-cc-facet-target select jpselect2 <# if (typeof data.not_operand !== 'undefined' && data.not_operand == '1') print('not-operand-checked'); #>"> |
| 351 |
<button type="button" class="jp-cc-not-operand" aria-label="<?php _e( 'Enable the Not Operand', 'content-control' ); ?>"> |
| 352 |
<span class="is"><?php _e( 'Is', 'content-control' ); ?></span> |
| 353 |
<span class="not"><?php _e( 'Is Not', 'content-control' ); ?></span> |
| 354 |
<input type="checkbox" name="conditions[{{data.group}}][{{data.index}}][not_operand]" value="1" <# if (typeof data.not_operand !== 'undefined') print(JPCC.checked(data.not_operand, true, true)); #> /> |
| 355 |
</button> |
| 356 |
<# print(JPCC.conditions.template.selectbox({index: data.index, group: data.group, value: data.target})); #> |
| 357 |
</div> |
| 358 |
|
| 359 |
<div class="facet-settings"> |
| 360 |
<# |
| 361 |
print(JPCC.conditions.template.settings(data, data.settings)); |
| 362 |
#> |
| 363 |
</div> |
| 364 |
|
| 365 |
<div class="facet-actions"> |
| 366 |
<button type="button" class="remove remove-facet dashicons dashicons-dismiss no-button" aria-label="<?php _e( 'Remove Condition', 'content-control' ); ?>"></button> |
| 367 |
</div> |
| 368 |
</div> |
| 369 |
</script> |
| 370 |
<?php |
| 371 |
} |
| 372 |
|
| 373 |
} |
| 374 |
|