| 1 |
<?php // User Submitted Posts - Plugin Settings |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) die(); |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
function usp_add_options_page() { |
| 8 |
|
| 9 |
add_options_page(USP_PLUGIN, __('Submitted Posts', 'usp'), 'manage_options', 'user-submitted-posts', 'usp_render_form'); |
| 10 |
|
| 11 |
} |
| 12 |
add_action('admin_menu', 'usp_add_options_page'); |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
function usp_init() { |
| 17 |
|
| 18 |
register_setting('usp_plugin_options', 'usp_options', 'usp_validate_options'); |
| 19 |
|
| 20 |
} |
| 21 |
add_action('admin_init', 'usp_init'); |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
function usp_plugin_action_links($links, $file) { |
| 26 |
|
| 27 |
if ($file === USP_FILE && current_user_can('manage_options')) { |
| 28 |
|
| 29 |
$settings = '<a href="'. admin_url('options-general.php?page=user-submitted-posts') .'">'. esc_html__('Settings', 'usp') .'</a>'; |
| 30 |
|
| 31 |
array_unshift($links, $settings); |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
if ($file === USP_FILE) { |
| 36 |
|
| 37 |
$pro_href = 'https://plugin-planet.com/usp-pro/'; |
| 38 |
$pro_title = esc_attr__('Get USP Pro for unlimited forms', 'usp'); |
| 39 |
$pro_text = esc_html__('Go Pro', 'usp'); |
| 40 |
$pro_style = 'padding:2px 4px;font-weight:bold;border:1px solid #00CCCC;border-radius:2px;background-color:#fff;'; |
| 41 |
|
| 42 |
$pro = '<a target="_blank" rel="noopener noreferrer" href="'. $pro_href .'" title="'. $pro_title .'" style="'. $pro_style .'">'. $pro_text .'</a>'; |
| 43 |
|
| 44 |
array_unshift($links, $pro); |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
return $links; |
| 49 |
|
| 50 |
} |
| 51 |
add_filter('plugin_action_links', 'usp_plugin_action_links', 10, 2); |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
function add_usp_links($links, $file) { |
| 56 |
|
| 57 |
if ($file === USP_FILE) { |
| 58 |
|
| 59 |
$home_href = 'https://plugin-planet.com/usp-pro/'; |
| 60 |
$home_title = esc_attr__('Get USP Pro for unlimited forms', 'usp'); |
| 61 |
$home_text = esc_html__('Go Pro', 'usp'); |
| 62 |
|
| 63 |
$links[] = '<strong><a target="_blank" rel="noopener noreferrer" href="'. $home_href .'" title="'. $home_title .'">'. $home_text .'</a></strong>'; |
| 64 |
|
| 65 |
$rate_href = 'https://wordpress.org/support/plugin/user-submitted-posts/reviews/?rate=5#new-post'; |
| 66 |
$rate_title = esc_attr__('Give USP a 5-star rating at WordPress.org', 'usp'); |
| 67 |
$rate_text = esc_html__('Rate this plugin »', 'usp'); |
| 68 |
|
| 69 |
$links[] = '<a target="_blank" rel="noopener noreferrer" href="'. $rate_href .'" title="'. $rate_title .'">'. $rate_text .'</a>'; |
| 70 |
|
| 71 |
} |
| 72 |
|
| 73 |
return $links; |
| 74 |
|
| 75 |
} |
| 76 |
add_filter('plugin_row_meta', 'add_usp_links', 10, 2); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
function usp_admin_footer_text($text) { |
| 81 |
|
| 82 |
$screen_id = usp_get_current_screen_id(); |
| 83 |
|
| 84 |
$ids = array('settings_page_user-submitted-posts/user-submitted-posts'); |
| 85 |
|
| 86 |
if ($screen_id && apply_filters('usp_admin_footer_text', in_array($screen_id, $ids))) { |
| 87 |
|
| 88 |
$text = __('Like this plugin? Give it a', 'usp'); |
| 89 |
|
| 90 |
$text .= ' <a target="_blank" rel="noopener noreferrer" href="https://wordpress.org/support/plugin/user-submitted-posts/reviews/?rate=5#new-post">'; |
| 91 |
|
| 92 |
$text .= __('� |
| 93 |
� |
| 94 |
� |
| 95 |
� |
| 96 |
� |
| 97 |
rating »', 'usp') .'</a>'; |
| 98 |
|
| 99 |
} |
| 100 |
|
| 101 |
return $text; |
| 102 |
|
| 103 |
} |
| 104 |
add_filter('admin_footer_text', 'usp_admin_footer_text', 10, 1); |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
function usp_get_current_screen_id() { |
| 109 |
|
| 110 |
if (!function_exists('get_current_screen')) require_once ABSPATH .'/wp-admin/includes/screen.php'; |
| 111 |
|
| 112 |
$screen = get_current_screen(); |
| 113 |
|
| 114 |
if ($screen && property_exists($screen, 'id')) return $screen->id; |
| 115 |
|
| 116 |
return false; |
| 117 |
|
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
function usp_get_current_screen_post_type() { |
| 123 |
|
| 124 |
if (!function_exists('get_current_screen')) require_once ABSPATH .'/wp-admin/includes/screen.php'; |
| 125 |
|
| 126 |
$screen = get_current_screen(); |
| 127 |
|
| 128 |
if ($screen && property_exists($screen, 'post_type')) return $screen->post_type; |
| 129 |
|
| 130 |
return false; |
| 131 |
|
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
function usp_filter_safe_styles($styles) { |
| 137 |
|
| 138 |
$styles[] = 'display'; |
| 139 |
|
| 140 |
return $styles; |
| 141 |
|
| 142 |
} |
| 143 |
add_filter('safe_style_css', 'usp_filter_safe_styles'); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
function usp_compare_version() { |
| 148 |
|
| 149 |
global $usp_options; |
| 150 |
|
| 151 |
$usp_options = get_option('usp_options'); |
| 152 |
|
| 153 |
$version_current = intval(USP_VERSION); |
| 154 |
$version_previous = isset($usp_options['usp_version']) ? intval($usp_options['usp_version']) : $version_current; |
| 155 |
|
| 156 |
if ($version_current > $version_previous) { |
| 157 |
|
| 158 |
$usp_options['version_alert'] = 0; |
| 159 |
$usp_options['usp_version'] = $version_current; |
| 160 |
|
| 161 |
} else { |
| 162 |
|
| 163 |
$usp_options['usp_version'] = $version_previous; |
| 164 |
|
| 165 |
} |
| 166 |
|
| 167 |
update_option('usp_options', $usp_options); |
| 168 |
|
| 169 |
} |
| 170 |
add_action('admin_init', 'usp_compare_version'); |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
function usp_post_type() { |
| 175 |
|
| 176 |
$post_type = array( |
| 177 |
|
| 178 |
'post' => array( |
| 179 |
'value' => 'post', |
| 180 |
'label' => esc_html__('WP Post (recommended)', 'usp'), |
| 181 |
), |
| 182 |
'page' => array( |
| 183 |
'value' => 'page', |
| 184 |
'label' => esc_html__('WP Page', 'usp'), |
| 185 |
), |
| 186 |
); |
| 187 |
|
| 188 |
return apply_filters('usp_post_type_options', $post_type); |
| 189 |
|
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
function usp_form_version() { |
| 195 |
|
| 196 |
$form_version = array( |
| 197 |
|
| 198 |
'current' => array( |
| 199 |
'value' => 'current', |
| 200 |
'label' => esc_html__('HTML5 Form + Default CSS', 'usp') .' <span class="mm-item-caption">'. esc_html__('(Recommended)', 'usp') .'</span>', |
| 201 |
), |
| 202 |
'disable' => array( |
| 203 |
'value' => 'disable', |
| 204 |
'label' => esc_html__('HTML5 Form + Disable CSS', 'usp') .' <span class="mm-item-caption">'. esc_html__('(Provide your own styles)', 'usp') .'</span>', |
| 205 |
), |
| 206 |
'custom' => array( |
| 207 |
'value' => 'custom', |
| 208 |
'label' => esc_html__('Custom Form + Custom CSS', 'usp') .' <span class="mm-item-caption">'. esc_html__('(Provide your own form template & styles)', 'usp') .'</span>', |
| 209 |
), |
| 210 |
); |
| 211 |
|
| 212 |
return $form_version; |
| 213 |
|
| 214 |
} |
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
function usp_image_display() { |
| 219 |
|
| 220 |
$image_display = array( |
| 221 |
|
| 222 |
'before' => array( |
| 223 |
'value' => 'before', |
| 224 |
'label' => esc_html__('Before post content', 'usp') |
| 225 |
), |
| 226 |
'after' => array( |
| 227 |
'value' => 'after', |
| 228 |
'label' => esc_html__('After post content', 'usp') |
| 229 |
), |
| 230 |
'disable' => array( |
| 231 |
'value' => 'disable', |
| 232 |
'label' => esc_html__('Do not display', 'usp') |
| 233 |
), |
| 234 |
); |
| 235 |
|
| 236 |
return $image_display; |
| 237 |
|
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
function usp_email_display() { |
| 243 |
|
| 244 |
$email_display = array( |
| 245 |
|
| 246 |
'before' => array( |
| 247 |
'value' => 'before', |
| 248 |
'label' => esc_html__('Before post content', 'usp') |
| 249 |
), |
| 250 |
'after' => array( |
| 251 |
'value' => 'after', |
| 252 |
'label' => esc_html__('After post content', 'usp') |
| 253 |
), |
| 254 |
'disable' => array( |
| 255 |
'value' => 'disable', |
| 256 |
'label' => esc_html__('Do not display', 'usp') |
| 257 |
), |
| 258 |
); |
| 259 |
|
| 260 |
return $email_display; |
| 261 |
|
| 262 |
} |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
function usp_name_display() { |
| 267 |
|
| 268 |
$name_display = array( |
| 269 |
|
| 270 |
'before' => array( |
| 271 |
'value' => 'before', |
| 272 |
'label' => esc_html__('Before post content', 'usp') |
| 273 |
), |
| 274 |
'after' => array( |
| 275 |
'value' => 'after', |
| 276 |
'label' => esc_html__('After post content', 'usp') |
| 277 |
), |
| 278 |
'disable' => array( |
| 279 |
'value' => 'disable', |
| 280 |
'label' => esc_html__('Do not display', 'usp') |
| 281 |
), |
| 282 |
); |
| 283 |
|
| 284 |
return $name_display; |
| 285 |
|
| 286 |
} |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
function usp_url_display() { |
| 291 |
|
| 292 |
$url_display = array( |
| 293 |
|
| 294 |
'before' => array( |
| 295 |
'value' => 'before', |
| 296 |
'label' => esc_html__('Before post content', 'usp') |
| 297 |
), |
| 298 |
'after' => array( |
| 299 |
'value' => 'after', |
| 300 |
'label' => esc_html__('After post content', 'usp') |
| 301 |
), |
| 302 |
'disable' => array( |
| 303 |
'value' => 'disable', |
| 304 |
'label' => esc_html__('Do not display', 'usp') |
| 305 |
), |
| 306 |
); |
| 307 |
|
| 308 |
return $url_display; |
| 309 |
|
| 310 |
} |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
function usp_custom_display() { |
| 315 |
|
| 316 |
$custom_display = array( |
| 317 |
|
| 318 |
'before' => array( |
| 319 |
'value' => 'before', |
| 320 |
'label' => esc_html__('Before post content', 'usp') |
| 321 |
), |
| 322 |
'after' => array( |
| 323 |
'value' => 'after', |
| 324 |
'label' => esc_html__('After post content', 'usp') |
| 325 |
), |
| 326 |
'disable' => array( |
| 327 |
'value' => 'disable', |
| 328 |
'label' => esc_html__('Do not display', 'usp') |
| 329 |
), |
| 330 |
); |
| 331 |
|
| 332 |
return $custom_display; |
| 333 |
|
| 334 |
} |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
function usp_recaptcha_version() { |
| 339 |
|
| 340 |
$recaptcha_version = array( |
| 341 |
|
| 342 |
2 => array( |
| 343 |
'value' => 2, |
| 344 |
'label' => esc_html__('v2 (I’m not a robot)', 'usp') |
| 345 |
), |
| 346 |
3 => array( |
| 347 |
'value' => 3, |
| 348 |
'label' => esc_html__('v3 (Hidden reCaptcha)', 'usp') |
| 349 |
), |
| 350 |
); |
| 351 |
|
| 352 |
return $recaptcha_version; |
| 353 |
|
| 354 |
} |
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
function usp_form_field_options($args) { |
| 359 |
|
| 360 |
global $usp_options; |
| 361 |
|
| 362 |
$name = isset($args[0]) ? $args[0] : ''; |
| 363 |
$label = isset($args[1]) ? $args[1] : ''; |
| 364 |
|
| 365 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 366 |
|
| 367 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 368 |
$selected_optn = ($option === 'optn') ? 'selected="selected"' : ''; |
| 369 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 370 |
|
| 371 |
$output = '<tr>'; |
| 372 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 373 |
$output .= '<td>'; |
| 374 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 375 |
|
| 376 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable and require', 'usp') .'</option>'; |
| 377 |
$output .= '<option '. $selected_optn .' value="optn">'. esc_html__('Enable but do not require', 'usp') .'</option>'; |
| 378 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable this field', 'usp') .'</option>'; |
| 379 |
|
| 380 |
$output .= '</select>'; |
| 381 |
$output .= '</td>'; |
| 382 |
$output .= '</tr>'; |
| 383 |
|
| 384 |
return $output; |
| 385 |
|
| 386 |
} |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
function usp_form_field_options_custom($field) { |
| 391 |
|
| 392 |
global $usp_options; |
| 393 |
|
| 394 |
if ($field === '1') { |
| 395 |
|
| 396 |
$name = 'custom_field'; |
| 397 |
$label = esc_html__('Custom Field 1', 'usp'); |
| 398 |
|
| 399 |
} else { |
| 400 |
|
| 401 |
$name = 'custom_field_2'; |
| 402 |
$label = esc_html__('Custom Field 2', 'usp'); |
| 403 |
|
| 404 |
} |
| 405 |
|
| 406 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 407 |
|
| 408 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 409 |
$selected_optn = ($option === 'optn') ? 'selected="selected"' : ''; |
| 410 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 411 |
|
| 412 |
$output = '<tr>'; |
| 413 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 414 |
$output .= '<td>'; |
| 415 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 416 |
|
| 417 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable and require', 'usp') .'</option>'; |
| 418 |
$output .= '<option '. $selected_optn .' value="optn">'. esc_html__('Enable but do not require', 'usp') .'</option>'; |
| 419 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable this field', 'usp') .'</option>'; |
| 420 |
|
| 421 |
$output .= '</select>'; |
| 422 |
$output .= '</td>'; |
| 423 |
$output .= '</tr>'; |
| 424 |
|
| 425 |
return $output; |
| 426 |
|
| 427 |
} |
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
function usp_form_field_options_captcha() { |
| 432 |
|
| 433 |
global $usp_options; |
| 434 |
|
| 435 |
$name = 'usp_captcha'; |
| 436 |
$label = esc_html__('Challenge Question', 'usp'); |
| 437 |
|
| 438 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 439 |
|
| 440 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 441 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 442 |
|
| 443 |
$output = '<tr>'; |
| 444 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 445 |
$output .= '<td>'; |
| 446 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 447 |
|
| 448 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable and require', 'usp') .'</option>'; |
| 449 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable this field', 'usp') .'</option>'; |
| 450 |
|
| 451 |
$output .= '</select>'; |
| 452 |
$output .= '</td>'; |
| 453 |
$output .= '</tr>'; |
| 454 |
|
| 455 |
return $output; |
| 456 |
|
| 457 |
} |
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
function usp_form_field_options_recaptcha() { |
| 462 |
|
| 463 |
global $usp_options; |
| 464 |
|
| 465 |
$name = 'usp_recaptcha'; |
| 466 |
$label = esc_html__('Google reCaptcha', 'usp'); |
| 467 |
|
| 468 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 469 |
|
| 470 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 471 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 472 |
|
| 473 |
$output = '<tr>'; |
| 474 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 475 |
$output .= '<td>'; |
| 476 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 477 |
|
| 478 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable and require', 'usp') .'</option>'; |
| 479 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable this field', 'usp') .'</option>'; |
| 480 |
|
| 481 |
$output .= '</select>'; |
| 482 |
$output .= '</td>'; |
| 483 |
$output .= '</tr>'; |
| 484 |
|
| 485 |
return $output; |
| 486 |
|
| 487 |
} |
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
function usp_form_field_options_turnstile() { |
| 492 |
|
| 493 |
global $usp_options; |
| 494 |
|
| 495 |
$name = 'usp_turnstile'; |
| 496 |
$label = esc_html__('Cloudflare Turnstile', 'usp'); |
| 497 |
|
| 498 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 499 |
|
| 500 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 501 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 502 |
|
| 503 |
$output = '<tr>'; |
| 504 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 505 |
$output .= '<td>'; |
| 506 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 507 |
|
| 508 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable and require', 'usp') .'</option>'; |
| 509 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable this field', 'usp') .'</option>'; |
| 510 |
|
| 511 |
$output .= '</select>'; |
| 512 |
$output .= '</td>'; |
| 513 |
$output .= '</tr>'; |
| 514 |
|
| 515 |
return $output; |
| 516 |
|
| 517 |
} |
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
function usp_form_field_options_images() { |
| 522 |
|
| 523 |
global $usp_options; |
| 524 |
|
| 525 |
$name = 'usp_images'; |
| 526 |
$label = esc_html__('Image Uploads', 'usp'); |
| 527 |
|
| 528 |
$option = isset($usp_options[$name]) ? $usp_options[$name] : ''; |
| 529 |
|
| 530 |
$selected_show = ($option === 'show') ? 'selected="selected"' : ''; |
| 531 |
$selected_hide = ($option === 'hide') ? 'selected="selected"' : ''; |
| 532 |
|
| 533 |
$output = '<tr>'; |
| 534 |
$output .= '<th scope="row"><label class="description" for="usp_options['. esc_attr($name) .']">'. esc_html($label) .'</label></th>'; |
| 535 |
$output .= '<td>'; |
| 536 |
$output .= '<select name="usp_options['. esc_attr($name) .']" id="usp_options['. esc_attr($name) .']">'; |
| 537 |
|
| 538 |
$output .= '<option '. $selected_show .' value="show">'. esc_html__('Enable', 'usp') .'</option>'; |
| 539 |
$output .= '<option '. $selected_hide .' value="hide">'. esc_html__('Disable', 'usp') .'</option>'; |
| 540 |
|
| 541 |
$output .= '</select>'; |
| 542 |
$output .= '</td>'; |
| 543 |
$output .= '</tr>'; |
| 544 |
|
| 545 |
return $output; |
| 546 |
|
| 547 |
} |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
function usp_form_display_options() { |
| 552 |
|
| 553 |
global $usp_options; |
| 554 |
|
| 555 |
$radio_setting = isset($usp_options['usp_form_version']) ? $usp_options['usp_form_version'] : ''; |
| 556 |
|
| 557 |
$form_styles = usp_form_version(); |
| 558 |
|
| 559 |
$output = ''; |
| 560 |
|
| 561 |
foreach ($form_styles as $form_style) { |
| 562 |
|
| 563 |
$label = isset($form_style['label']) ? $form_style['label'] : ''; |
| 564 |
$value = isset($form_style['value']) ? $form_style['value'] : ''; |
| 565 |
|
| 566 |
$checked = (!empty($radio_setting) && $radio_setting === $value) ? 'checked="checked"' : ''; |
| 567 |
|
| 568 |
$class = ($value === 'custom') ? 'usp-custom-form' : 'usp-form'; |
| 569 |
|
| 570 |
$output .= '<div class="mm-radio-inputs">'; |
| 571 |
$output .= '<input type="radio" name="usp_options[usp_form_version]" class="'. $class .'" value="'. esc_attr($value) .'" '. $checked .' /> '. $label; |
| 572 |
$output .= '</div>'; |
| 573 |
|
| 574 |
} |
| 575 |
|
| 576 |
return $output; |
| 577 |
|
| 578 |
} |
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
function usp_post_type_options() { |
| 583 |
|
| 584 |
global $usp_options; |
| 585 |
|
| 586 |
$usp_post_type = usp_post_type(); |
| 587 |
|
| 588 |
$selected_option = isset($usp_options['usp_post_type']) ? $usp_options['usp_post_type'] : 'post'; |
| 589 |
|
| 590 |
$select_options = '<select name="usp_options[usp_post_type]">'; |
| 591 |
|
| 592 |
foreach($usp_post_type as $k => $v) { |
| 593 |
|
| 594 |
$selected = selected($selected_option === $k, true, false); |
| 595 |
|
| 596 |
$value = isset($v['value']) ? $v['value'] : null; |
| 597 |
$label = isset($v['label']) ? $v['label'] : null; |
| 598 |
|
| 599 |
$select_options .= '<option value="'. $value .'"'. $selected .'>'. $label .'</option>'; |
| 600 |
|
| 601 |
} |
| 602 |
|
| 603 |
$select_options .= '</select>'; |
| 604 |
|
| 605 |
return $select_options; |
| 606 |
|
| 607 |
} |
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
function usp_post_status_options() { |
| 612 |
|
| 613 |
global $usp_options; |
| 614 |
|
| 615 |
$approved = isset($usp_options['number-approved']) ? intval($usp_options['number-approved']) : -1; |
| 616 |
|
| 617 |
$output = '<select id="usp_options[number-approved]" name="usp_options[number-approved]">'; |
| 618 |
|
| 619 |
foreach (range(-2, 20) as $v) { |
| 620 |
|
| 621 |
if ($v === -2) $k = esc_html__('Draft', 'usp'); |
| 622 |
elseif ($v === -1) $k = esc_html__('Pending (default)', 'usp'); |
| 623 |
elseif ($v === 0) $k = esc_html__('Publish immediately', 'usp'); |
| 624 |
elseif ($v === 1) $k = esc_html__('Publish after 1 approved post', 'usp'); |
| 625 |
else $k = esc_html__('Publish after ', 'usp') . $v . esc_html__(' approved posts', 'usp'); |
| 626 |
|
| 627 |
$selected = selected($v, $approved, false); |
| 628 |
|
| 629 |
$output .= '<option '. $selected .' value="'. $v .'">'. $k .'</option>'; |
| 630 |
|
| 631 |
} |
| 632 |
|
| 633 |
$output .= '</select>'; |
| 634 |
|
| 635 |
return $output; |
| 636 |
|
| 637 |
} |
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
function usp_post_category_options() { |
| 642 |
|
| 643 |
global $usp_options; |
| 644 |
|
| 645 |
$options = isset($usp_options['categories']) ? $usp_options['categories'] : array(); |
| 646 |
|
| 647 |
$cats = get_categories(array('parent' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0)); |
| 648 |
|
| 649 |
if (empty($cats)) return; |
| 650 |
|
| 651 |
$usp_cats = array(); |
| 652 |
|
| 653 |
$output = '<div class="mm-item-desc">'. esc_html__('Select categories to include in the Category field:', 'usp') .'</div>'; |
| 654 |
$output .= '<ul class="usp-category-options">'; |
| 655 |
|
| 656 |
foreach ($cats as $c) { |
| 657 |
|
| 658 |
// parents |
| 659 |
|
| 660 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c->term_id) .'" '. checked(true, in_array($c->term_id, $options), false) .'> '; |
| 661 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c->term_id)) .'" title="Cat ID: '. esc_attr($c->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c->name) .'</a></label></li>'; |
| 662 |
|
| 663 |
$usp_cats['c'][] = array('id' => esc_attr($c->term_id), 'c1' => array()); |
| 664 |
$children = get_terms('category', array('parent' => esc_attr($c->term_id), 'hide_empty' => 0)); |
| 665 |
|
| 666 |
if (!empty($children)) { |
| 667 |
|
| 668 |
$output .= '<li><ul>'; |
| 669 |
|
| 670 |
foreach ($children as $c1) { |
| 671 |
|
| 672 |
// children |
| 673 |
|
| 674 |
$usp_cats['c'][]['c1'][] = array('id' => esc_attr($c1->term_id), 'c2' => array()); |
| 675 |
$grandchildren = get_terms('category', array('parent' => esc_attr($c1->term_id), 'hide_empty' => 0)); |
| 676 |
|
| 677 |
if (!empty($grandchildren)) { |
| 678 |
|
| 679 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c1->term_id) .'" '. checked(true, in_array($c1->term_id, $options), false) .'> '; |
| 680 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c1->term_id)) .'" title="Cat ID: '. esc_attr($c1->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c1->name) .'</a></label>'; |
| 681 |
$output .= '<ul>'; |
| 682 |
|
| 683 |
foreach ($grandchildren as $c2) { |
| 684 |
|
| 685 |
// grandchildren |
| 686 |
|
| 687 |
$usp_cats['c'][]['c1'][]['c2'][] = array('id' => esc_attr($c2->term_id), 'c3' => array()); |
| 688 |
$great_grandchildren = get_terms('category', array('parent' => esc_attr($c2->term_id), 'hide_empty' => 0)); |
| 689 |
|
| 690 |
if (!empty($great_grandchildren)) { |
| 691 |
|
| 692 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c2->term_id) .'" '. checked(true, in_array($c2->term_id, $options), false) .'> '; |
| 693 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c2->term_id)) .'" title="Cat ID: '. esc_attr($c2->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c2->name) .'</a></label>'; |
| 694 |
$output .= '<ul>'; |
| 695 |
|
| 696 |
foreach ($great_grandchildren as $c3) { |
| 697 |
|
| 698 |
// great enkelkinder |
| 699 |
|
| 700 |
$usp_cats['c'][]['c1'][]['c2'][]['c3'][] = array('id' => esc_attr($c3->term_id), 'c4' => array()); |
| 701 |
$great_great_grandchildren = get_terms('category', array('parent' => esc_attr($c3->term_id), 'hide_empty' => 0)); |
| 702 |
|
| 703 |
if (!empty($great_great_grandchildren)) { |
| 704 |
|
| 705 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c3->term_id) .'" '. checked(true, in_array($c3->term_id, $options), false) .'> '; |
| 706 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c3->term_id)) .'" title="Cat ID: '. esc_attr($c3->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c3->name) .'</a></label>'; |
| 707 |
$output .= '<ul>'; |
| 708 |
|
| 709 |
foreach ($great_great_grandchildren as $c4) { |
| 710 |
|
| 711 |
// great great grandchildren |
| 712 |
|
| 713 |
$usp_cats['c'][]['c1'][]['c2'][]['c3'][]['c4'][] = array('id' => esc_attr($c4->term_id)); |
| 714 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c4->term_id) .'" '. checked(true, in_array($c4->term_id, $options), false) .'> '; |
| 715 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c4->term_id)) .'" title="Cat ID: '. esc_attr($c4->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c4->name) .'</a></label></li>'; |
| 716 |
|
| 717 |
} |
| 718 |
$output .= '</ul></li>'; // great great grandchildren |
| 719 |
|
| 720 |
} else { |
| 721 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c3->term_id) .'" '. checked(true, in_array($c3->term_id, $options), false) .'> '; |
| 722 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c3->term_id)) .'" title="Cat ID: '. esc_attr($c3->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c3->name) .'</a></label></li>'; |
| 723 |
} |
| 724 |
} |
| 725 |
$output .= '</ul></li>'; // great grandchildren |
| 726 |
} else { |
| 727 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c2->term_id) .'" '. checked(true, in_array($c2->term_id, $options), false) .'> '; |
| 728 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c2->term_id)) .'" title="Cat ID: '. esc_attr($c2->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c2->name) .'</a></label></li>'; |
| 729 |
} |
| 730 |
} |
| 731 |
$output .= '</ul></li>'; // grandchildren |
| 732 |
} else { |
| 733 |
$output .= '<li><input type="checkbox" name="usp_options[categories][]" id="usp_options[categories][]" value="'. esc_attr($c1->term_id) .'" '. checked(true, in_array($c1->term_id, $options), false) .'> '; |
| 734 |
$output .= '<label for="usp_options[categories][]"><a href="'. esc_url(get_category_link($c1->term_id)) .'" title="Cat ID: '. esc_attr($c1->term_id) .'" target="_blank" rel="noopener noreferrer">'. esc_html($c1->name) .'</a></label></li>'; |
| 735 |
} |
| 736 |
} |
| 737 |
$output .= '</ul></li>'; // children |
| 738 |
} |
| 739 |
} |
| 740 |
|
| 741 |
$output .= '</ul>'; // parents |
| 742 |
|
| 743 |
return $output; |
| 744 |
|
| 745 |
} |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
function usp_post_author_options() { |
| 750 |
|
| 751 |
global $usp_options, $wpdb; |
| 752 |
|
| 753 |
$user_count = count_users(); |
| 754 |
|
| 755 |
$user_total = isset($user_count['total_users']) ? intval($user_count['total_users']) : 1; |
| 756 |
|
| 757 |
$user_max = apply_filters('usp_max_users', 200); |
| 758 |
|
| 759 |
$limit = ($user_total > $user_max) ? $user_max : $user_total; |
| 760 |
|
| 761 |
if (is_multisite()) { |
| 762 |
|
| 763 |
$args = array('blog_id' => get_current_blog_id(), 'number' => $limit); |
| 764 |
|
| 765 |
$user_query = new WP_User_Query($args); |
| 766 |
|
| 767 |
$users = $user_query->get_results(); |
| 768 |
|
| 769 |
} else { |
| 770 |
|
| 771 |
$query = "SELECT ID, display_name FROM {$wpdb->users} LIMIT %d"; |
| 772 |
|
| 773 |
$users = $wpdb->get_results($wpdb->prepare($query, $limit)); |
| 774 |
|
| 775 |
} |
| 776 |
|
| 777 |
$output = '<select id="usp_options[author]" name="usp_options[author]">'; |
| 778 |
|
| 779 |
foreach($users as $user) { |
| 780 |
|
| 781 |
$selected = isset($usp_options['author']) ? selected($usp_options['author'], $user->ID, false) : ''; |
| 782 |
|
| 783 |
$output .= '<option '. $selected .'value="'. esc_attr($user->ID) .'">'. esc_html($user->display_name) .'</option>'; |
| 784 |
|
| 785 |
} |
| 786 |
|
| 787 |
$output .= '</select>'; |
| 788 |
|
| 789 |
return $output; |
| 790 |
|
| 791 |
} |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
function usp_auto_display_options($item) { |
| 796 |
|
| 797 |
global $usp_options; |
| 798 |
|
| 799 |
$usp_image_display = usp_image_display(); |
| 800 |
$usp_email_display = usp_email_display(); |
| 801 |
$usp_name_display = usp_name_display(); |
| 802 |
$usp_url_display = usp_url_display(); |
| 803 |
$usp_custom_display = usp_custom_display(); |
| 804 |
|
| 805 |
if ($item === 'images') { |
| 806 |
|
| 807 |
$array = $usp_image_display; |
| 808 |
$key = 'auto_display_images'; |
| 809 |
|
| 810 |
} elseif ($item === 'email') { |
| 811 |
|
| 812 |
$array = $usp_email_display; |
| 813 |
$key = 'auto_display_email'; |
| 814 |
|
| 815 |
} elseif ($item === 'name') { |
| 816 |
|
| 817 |
$array = $usp_name_display; |
| 818 |
$key = 'auto_display_name'; |
| 819 |
|
| 820 |
} elseif ($item === 'url') { |
| 821 |
|
| 822 |
$array = $usp_url_display; |
| 823 |
$key = 'auto_display_url'; |
| 824 |
|
| 825 |
} elseif ($item === 'custom') { |
| 826 |
|
| 827 |
$array = $usp_custom_display; |
| 828 |
$key = 'auto_display_custom'; |
| 829 |
|
| 830 |
} elseif ($item === 'custom_2') { |
| 831 |
|
| 832 |
$array = $usp_custom_display; |
| 833 |
$key = 'auto_display_custom_2'; |
| 834 |
|
| 835 |
} |
| 836 |
|
| 837 |
$radio_setting = isset($usp_options[$key]) ? $usp_options[$key] : ''; |
| 838 |
|
| 839 |
$output = ''; |
| 840 |
|
| 841 |
foreach ($array as $arr) { |
| 842 |
|
| 843 |
$label = isset($arr['label']) ? $arr['label'] : ''; |
| 844 |
$value = isset($arr['value']) ? $arr['value'] : ''; |
| 845 |
|
| 846 |
$checked = (!empty($radio_setting) && $radio_setting === $value) ? 'checked="checked"' : ''; |
| 847 |
|
| 848 |
$output .= '<div class="mm-radio-inputs">'; |
| 849 |
$output .= '<input type="radio" name="usp_options['. esc_attr($key) .']" value="'. esc_attr($value) .'" '. $checked .' /> '. esc_html($label); |
| 850 |
$output .= '</div>'; |
| 851 |
|
| 852 |
} |
| 853 |
|
| 854 |
return $output; |
| 855 |
|
| 856 |
} |
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
function usp_form_field_recaptcha() { |
| 861 |
|
| 862 |
global $usp_options; |
| 863 |
|
| 864 |
$version = isset($usp_options['recaptcha_version']) ? $usp_options['recaptcha_version'] : 2; |
| 865 |
|
| 866 |
$output = '<select id="usp_options[recaptcha_version]" name="usp_options[recaptcha_version]">'; |
| 867 |
|
| 868 |
foreach(usp_recaptcha_version() as $option) { |
| 869 |
|
| 870 |
$option_value = isset($option['value']) ? $option['value'] : ''; |
| 871 |
$option_label = isset($option['label']) ? $option['label'] : ''; |
| 872 |
|
| 873 |
$output .= '<option '. selected($option_value, $version, false) .' value="'. esc_attr($option_value) .'">'. esc_attr($option_label) .'</option>'; |
| 874 |
|
| 875 |
} |
| 876 |
|
| 877 |
$output .= '</select>'; |
| 878 |
|
| 879 |
return $output; |
| 880 |
|
| 881 |
} |
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
function usp_add_defaults() { |
| 886 |
|
| 887 |
$currentUser = wp_get_current_user(); |
| 888 |
|
| 889 |
$admin_mail = get_bloginfo('admin_email'); |
| 890 |
|
| 891 |
$tmp = get_option('usp_options'); |
| 892 |
|
| 893 |
if ((isset($tmp['default_options']) && $tmp['default_options'] == '1') || (!is_array($tmp))) { |
| 894 |
|
| 895 |
$arr = array( |
| 896 |
'usp_version' => USP_VERSION, |
| 897 |
'version_alert' => 0, |
| 898 |
'default_options' => 0, |
| 899 |
'author' => $currentUser->ID, |
| 900 |
'categories' => array(get_option('default_category')), |
| 901 |
'multiple-cats' => false, |
| 902 |
'number-approved' => -1, |
| 903 |
'redirect-url' => '', |
| 904 |
'error-message' => esc_html__('There was an error. Please check required fields and try again.', 'usp'), |
| 905 |
'min-images' => 0, |
| 906 |
'max-images' => 1, |
| 907 |
'min-image-height' => 0, |
| 908 |
'min-image-width' => 0, |
| 909 |
'max-image-height' => 2500, |
| 910 |
'max-image-width' => 2500, |
| 911 |
'usp_name' => 'show', |
| 912 |
'usp_url' => 'show', |
| 913 |
'usp_email' => 'hide', |
| 914 |
'usp_title' => 'show', |
| 915 |
'usp_tags' => 'show', |
| 916 |
'usp_category' => 'show', |
| 917 |
'usp_images' => 'hide', |
| 918 |
'upload-message' => esc_html__('Please select your image(s) to upload.', 'usp'), |
| 919 |
'usp_question' => '1 + 1 =', |
| 920 |
'usp_response' => '2', |
| 921 |
'usp_casing' => 0, |
| 922 |
'usp_captcha' => 'show', |
| 923 |
'usp_content' => 'show', |
| 924 |
'success-message' => esc_html__('Success! Thank you for your submission.', 'usp'), |
| 925 |
'usp_form_version' => 'current', |
| 926 |
'usp_email_alerts' => 1, |
| 927 |
'usp_email_html' => 0, |
| 928 |
'usp_email_address' => $admin_mail, |
| 929 |
'usp_email_from' => $admin_mail, |
| 930 |
'usp_use_author' => 0, |
| 931 |
'usp_use_url' => 0, |
| 932 |
'usp_use_email' => 0, |
| 933 |
'usp_use_cat' => 0, |
| 934 |
'usp_use_cat_id' => '', |
| 935 |
'usp_include_js' => 1, |
| 936 |
'usp_display_url' => '', |
| 937 |
'usp_form_content' => '', |
| 938 |
'usp_existing_tags' => 0, |
| 939 |
'usp_richtext_editor' => 0, |
| 940 |
'usp_featured_images' => 0, |
| 941 |
'usp_add_another' => '', |
| 942 |
'disable_required' => 0, |
| 943 |
'titles_unique' => 0, |
| 944 |
'enable_shortcodes' => 0, |
| 945 |
'disable_ip_tracking' => 0, |
| 946 |
'email_alert_subject' => '', |
| 947 |
'email_alert_message' => '', |
| 948 |
'auto_display_images' => 'disable', |
| 949 |
'auto_display_email' => 'disable', |
| 950 |
'auto_display_name' => 'disable', |
| 951 |
'auto_display_url' => 'disable', |
| 952 |
'auto_image_markup' => '<a href="%%full%%"><img src="%%thumb%%" width="%%width%%" height="%%height%%" alt="%%title%%" style="display:inline-block;"></a> ', |
| 953 |
'auto_email_markup' => '<p><a href="mailto:%%email%%">'. esc_html__('Email', 'usp') .'</a></p>', |
| 954 |
'auto_name_markup' => '<p>%%author%%</p>', |
| 955 |
'auto_url_markup' => '<p><a href="%%url%%">'. esc_html__('URL', 'usp') .'</a></p>', |
| 956 |
'logged_in_users' => 0, |
| 957 |
'disable_author' => 0, |
| 958 |
'recaptcha_public' => '', |
| 959 |
'recaptcha_private' => '', |
| 960 |
'recaptcha_version' => 2, |
| 961 |
'usp_recaptcha' => 'hide', |
| 962 |
'usp_post_type' => 'post', |
| 963 |
'custom_field' => 'hide', |
| 964 |
'custom_name' => 'usp_custom_field', |
| 965 |
'custom_label' => esc_html__('Custom Field 1', 'usp'), |
| 966 |
'custom_field_2' => 'hide', |
| 967 |
'custom_name_2' => 'usp_custom_field_2', |
| 968 |
'custom_label_2' => esc_html__('Custom Field 2', 'usp'), |
| 969 |
'auto_display_custom' => 'disable', |
| 970 |
'auto_custom_markup' => '<p>%%custom_label%% : %%custom_name%% : %%custom_value%%</p>', |
| 971 |
'auto_display_custom_2' => 'disable', |
| 972 |
'auto_custom_markup_2' => '<p>%%custom_label_2%% : %%custom_name_2%% : %%custom_value_2%%</p>', |
| 973 |
'custom_checkbox' => false, |
| 974 |
'custom_checkbox_name' => 'usp_custom_checkbox', |
| 975 |
'custom_checkbox_text' => 'I agree the to the terms.', |
| 976 |
'custom_checkbox_err' => 'Custom checkbox required', |
| 977 |
'custom_checkbox_req' => true, |
| 978 |
'turnstile_site_key' => '', |
| 979 |
'turnstile_secret_key' => '', |
| 980 |
'usp_turnstile' => 'hide' |
| 981 |
); |
| 982 |
|
| 983 |
update_option('usp_options', $arr); |
| 984 |
|
| 985 |
} |
| 986 |
|
| 987 |
} |
| 988 |
|
| 989 |
|
| 990 |
|
| 991 |
function usp_delete_plugin_options() { |
| 992 |
|
| 993 |
delete_option('usp_options'); |
| 994 |
delete_option('user-submitted-posts-dismiss-notice'); |
| 995 |
|
| 996 |
} |
| 997 |
|
| 998 |
|
| 999 |
|
| 1000 |
function usp_update_category_option($option_name, $old_value, $value) { |
| 1001 |
|
| 1002 |
usp_clear_cookies(); |
| 1003 |
|
| 1004 |
} |
| 1005 |
add_action('updated_option', 'usp_update_category_option', 10, 3); |
| 1006 |
|
| 1007 |
|
| 1008 |
|
| 1009 |
function usp_validate_options($input) { |
| 1010 |
|
| 1011 |
global $usp_options; |
| 1012 |
|
| 1013 |
if (!isset($input['version_alert'])) $input['version_alert'] = null; |
| 1014 |
$input['version_alert'] = ($input['version_alert'] == 1 ? 1 : 0); |
| 1015 |
|
| 1016 |
if (!isset($input['default_options'])) $input['default_options'] = null; |
| 1017 |
$input['default_options'] = ($input['default_options'] == 1 ? 1 : 0); |
| 1018 |
|
| 1019 |
if (isset($input['categories'])) $input['categories'] = is_array($input['categories']) && !empty($input['categories']) ? array_unique($input['categories']) : array(get_option('default_category')); |
| 1020 |
|
| 1021 |
$input['number-approved'] = is_numeric($input['number-approved']) ? intval($input['number-approved']) : -1; |
| 1022 |
|
| 1023 |
$input['min-images'] = is_numeric($input['min-images']) ? intval($input['min-images']) : $input['max-images']; |
| 1024 |
$input['max-images'] = (is_numeric($input['max-images']) && ($usp_options['min-images'] <= abs($input['max-images']))) ? intval($input['max-images']) : $usp_options['max-images']; |
| 1025 |
|
| 1026 |
$input['min-image-height'] = is_numeric($input['min-image-height']) ? intval($input['min-image-height']) : $usp_options['min-image-height']; |
| 1027 |
$input['min-image-width'] = is_numeric($input['min-image-width']) ? intval($input['min-image-width']) : $usp_options['min-image-width']; |
| 1028 |
|
| 1029 |
$input['max-image-height'] = (is_numeric($input['max-image-height']) && ($usp_options['min-image-height'] <= $input['max-image-height'])) ? intval($input['max-image-height']) : $usp_options['max-image-height']; |
| 1030 |
$input['max-image-width'] = (is_numeric($input['max-image-width']) && ($usp_options['min-image-width'] <= $input['max-image-width'])) ? intval($input['max-image-width']) : $usp_options['max-image-width']; |
| 1031 |
|
| 1032 |
$usp_form_version = usp_form_version(); |
| 1033 |
if (!isset($input['usp_form_version'])) $input['usp_form_version'] = null; |
| 1034 |
if (!array_key_exists($input['usp_form_version'], $usp_form_version)) $input['usp_form_version'] = null; |
| 1035 |
|
| 1036 |
$usp_image_display = usp_image_display(); |
| 1037 |
if (!isset($input['auto_display_images'])) $input['auto_display_images'] = null; |
| 1038 |
if (!array_key_exists($input['auto_display_images'], $usp_image_display)) $input['auto_display_images'] = null; |
| 1039 |
|
| 1040 |
$usp_email_display = usp_email_display(); |
| 1041 |
if (!isset($input['auto_display_email'])) $input['auto_display_email'] = null; |
| 1042 |
if (!array_key_exists($input['auto_display_email'], $usp_email_display)) $input['auto_display_email'] = null; |
| 1043 |
|
| 1044 |
$usp_url_display = usp_url_display(); |
| 1045 |
if (!isset($input['auto_display_url'])) $input['auto_display_url'] = null; |
| 1046 |
if (!array_key_exists($input['auto_display_url'], $usp_url_display)) $input['auto_display_url'] = null; |
| 1047 |
|
| 1048 |
$usp_custom_display = usp_custom_display(); |
| 1049 |
if (!isset($input['auto_display_custom'])) $input['auto_display_custom'] = null; |
| 1050 |
if (!array_key_exists($input['auto_display_custom'], $usp_custom_display)) $input['auto_display_custom'] = null; |
| 1051 |
|
| 1052 |
if (!isset($input['auto_display_custom_2'])) $input['auto_display_custom_2'] = null; |
| 1053 |
if (!array_key_exists($input['auto_display_custom_2'], $usp_custom_display)) $input['auto_display_custom_2'] = null; |
| 1054 |
|
| 1055 |
$usp_post_type = usp_post_type(); |
| 1056 |
if (!isset($input['usp_post_type'])) $input['usp_post_type'] = null; |
| 1057 |
if (!array_key_exists($input['usp_post_type'], $usp_post_type)) $input['usp_post_type'] = null; |
| 1058 |
|
| 1059 |
$usp_recaptcha_version = usp_recaptcha_version(); |
| 1060 |
if (!isset($input['recaptcha_version'])) $input['recaptcha_version'] = null; |
| 1061 |
if (!array_key_exists($input['recaptcha_version'], $usp_recaptcha_version)) $input['recaptcha_version'] = null; |
| 1062 |
|
| 1063 |
if (isset($input['author'])) $input['author'] = wp_filter_nohtml_kses($input['author']); else $input['author'] = null; |
| 1064 |
if (isset($input['usp_name'])) $input['usp_name'] = wp_filter_nohtml_kses($input['usp_name']); else $input['usp_name'] = null; |
| 1065 |
if (isset($input['usp_url'])) $input['usp_url'] = wp_filter_nohtml_kses($input['usp_url']); else $input['usp_url'] = null; |
| 1066 |
if (isset($input['usp_email'])) $input['usp_email'] = wp_filter_nohtml_kses($input['usp_email']); else $input['usp_email'] = null; |
| 1067 |
if (isset($input['usp_title'])) $input['usp_title'] = wp_filter_nohtml_kses($input['usp_title']); else $input['usp_title'] = null; |
| 1068 |
if (isset($input['usp_tags'])) $input['usp_tags'] = wp_filter_nohtml_kses($input['usp_tags']); else $input['usp_tags'] = null; |
| 1069 |
if (isset($input['usp_category'])) $input['usp_category'] = wp_filter_nohtml_kses($input['usp_category']); else $input['usp_category'] = null; |
| 1070 |
if (isset($input['usp_images'])) $input['usp_images'] = wp_filter_nohtml_kses($input['usp_images']); else $input['usp_images'] = null; |
| 1071 |
if (isset($input['usp_question'])) $input['usp_question'] = wp_filter_nohtml_kses($input['usp_question']); else $input['usp_question'] = null; |
| 1072 |
if (isset($input['usp_captcha'])) $input['usp_captcha'] = wp_filter_nohtml_kses($input['usp_captcha']); else $input['usp_captcha'] = null; |
| 1073 |
if (isset($input['usp_content'])) $input['usp_content'] = wp_filter_nohtml_kses($input['usp_content']); else $input['usp_content'] = null; |
| 1074 |
if (isset($input['usp_email_address'])) $input['usp_email_address'] = wp_filter_nohtml_kses($input['usp_email_address']); else $input['usp_email_address'] = null; |
| 1075 |
if (isset($input['usp_email_from'])) $input['usp_email_from'] = wp_filter_nohtml_kses($input['usp_email_from']); else $input['usp_email_from'] = null; |
| 1076 |
if (isset($input['usp_use_cat_id'])) $input['usp_use_cat_id'] = wp_filter_nohtml_kses($input['usp_use_cat_id']); else $input['usp_use_cat_id'] = null; |
| 1077 |
if (isset($input['usp_display_url'])) $input['usp_display_url'] = wp_filter_nohtml_kses($input['usp_display_url']); else $input['usp_display_url'] = null; |
| 1078 |
if (isset($input['redirect-url'])) $input['redirect-url'] = wp_filter_nohtml_kses($input['redirect-url']); else $input['redirect-url'] = null; |
| 1079 |
if (isset($input['email_alert_subject'])) $input['email_alert_subject'] = wp_filter_nohtml_kses($input['email_alert_subject']); else $input['email_alert_subject'] = null; |
| 1080 |
if (isset($input['recaptcha_public'])) $input['recaptcha_public'] = wp_filter_nohtml_kses($input['recaptcha_public']); else $input['recaptcha_public'] = null; |
| 1081 |
if (isset($input['recaptcha_private'])) $input['recaptcha_private'] = wp_filter_nohtml_kses($input['recaptcha_private']); else $input['recaptcha_private'] = null; |
| 1082 |
if (isset($input['usp_recaptcha'])) $input['usp_recaptcha'] = wp_filter_nohtml_kses($input['usp_recaptcha']); else $input['usp_recaptcha'] = null; |
| 1083 |
if (isset($input['usp_turnstile'])) $input['usp_turnstile'] = wp_filter_nohtml_kses($input['usp_turnstile']); else $input['usp_turnstile'] = null; |
| 1084 |
if (isset($input['turnstile_site_key'])) $input['turnstile_site_key'] = wp_filter_nohtml_kses($input['turnstile_site_key']); else $input['turnstile_site_key'] = null; |
| 1085 |
if (isset($input['turnstile_secret_key'])) $input['turnstile_secret_key'] = wp_filter_nohtml_kses($input['turnstile_secret_key']); else $input['turnstile_secret_key'] = null; |
| 1086 |
if (isset($input['custom_field'])) $input['custom_field'] = wp_filter_nohtml_kses($input['custom_field']); else $input['custom_field'] = null; |
| 1087 |
if (isset($input['custom_name'])) $input['custom_name'] = wp_filter_nohtml_kses($input['custom_name']); else $input['custom_name'] = null; |
| 1088 |
if (isset($input['custom_label'])) $input['custom_label'] = wp_filter_nohtml_kses($input['custom_label']); else $input['custom_label'] = null; |
| 1089 |
if (isset($input['custom_field_2'])) $input['custom_field_2'] = wp_filter_nohtml_kses($input['custom_field_2']); else $input['custom_field_2'] = null; |
| 1090 |
if (isset($input['custom_name_2'])) $input['custom_name_2'] = wp_filter_nohtml_kses($input['custom_name_2']); else $input['custom_name_2'] = null; |
| 1091 |
if (isset($input['custom_label_2'])) $input['custom_label_2'] = wp_filter_nohtml_kses($input['custom_label_2']); else $input['custom_label_2'] = null; |
| 1092 |
if (isset($input['custom_checkbox_name'])) $input['custom_checkbox_name'] = wp_filter_nohtml_kses($input['custom_checkbox_name']); else $input['custom_checkbox_name'] = null; |
| 1093 |
if (isset($input['custom_checkbox_err'])) $input['custom_checkbox_err'] = wp_filter_nohtml_kses($input['custom_checkbox_err']); else $input['custom_checkbox_err'] = null; |
| 1094 |
|
| 1095 |
if (isset($input['usp_featured_image_default'])) $input['usp_featured_image_default'] = wp_filter_nohtml_kses($input['usp_featured_image_default']); else $input['usp_featured_image_default'] = null; |
| 1096 |
|
| 1097 |
// dealing with kses |
| 1098 |
|
| 1099 |
global $allowedposttags; |
| 1100 |
|
| 1101 |
$default_allowedposttags = $allowedposttags; |
| 1102 |
|
| 1103 |
$allowed_atts = array( |
| 1104 |
'align' => array(), |
| 1105 |
'class' => array(), |
| 1106 |
'type' => array(), |
| 1107 |
'id' => array(), |
| 1108 |
'dir' => array(), |
| 1109 |
'lang' => array(), |
| 1110 |
'style' => array(), |
| 1111 |
'xml:lang' => array(), |
| 1112 |
'src' => array(), |
| 1113 |
'alt' => array(), |
| 1114 |
'href' => array(), |
| 1115 |
'rel' => array(), |
| 1116 |
'rev' => array(), |
| 1117 |
'target' => array(), |
| 1118 |
'novalidate' => array(), |
| 1119 |
'type' => array(), |
| 1120 |
'value' => array(), |
| 1121 |
'name' => array(), |
| 1122 |
'tabindex' => array(), |
| 1123 |
'action' => array(), |
| 1124 |
'method' => array(), |
| 1125 |
'for' => array(), |
| 1126 |
'width' => array(), |
| 1127 |
'height' => array(), |
| 1128 |
'data' => array(), |
| 1129 |
'data-rel' => array(), |
| 1130 |
'title' => array(), |
| 1131 |
); |
| 1132 |
$allowedposttags['form'] = $allowed_atts; |
| 1133 |
$allowedposttags['label'] = $allowed_atts; |
| 1134 |
$allowedposttags['input'] = $allowed_atts; |
| 1135 |
$allowedposttags['textarea'] = $allowed_atts; |
| 1136 |
$allowedposttags['style'] = $allowed_atts; |
| 1137 |
$allowedposttags['strong'] = $allowed_atts; |
| 1138 |
$allowedposttags['small'] = $allowed_atts; |
| 1139 |
$allowedposttags['table'] = $allowed_atts; |
| 1140 |
$allowedposttags['span'] = $allowed_atts; |
| 1141 |
$allowedposttags['abbr'] = $allowed_atts; |
| 1142 |
$allowedposttags['code'] = $allowed_atts; |
| 1143 |
$allowedposttags['pre'] = $allowed_atts; |
| 1144 |
$allowedposttags['div'] = $allowed_atts; |
| 1145 |
$allowedposttags['img'] = $allowed_atts; |
| 1146 |
$allowedposttags['h1'] = $allowed_atts; |
| 1147 |
$allowedposttags['h2'] = $allowed_atts; |
| 1148 |
$allowedposttags['h3'] = $allowed_atts; |
| 1149 |
$allowedposttags['h4'] = $allowed_atts; |
| 1150 |
$allowedposttags['h5'] = $allowed_atts; |
| 1151 |
$allowedposttags['h6'] = $allowed_atts; |
| 1152 |
$allowedposttags['ol'] = $allowed_atts; |
| 1153 |
$allowedposttags['ul'] = $allowed_atts; |
| 1154 |
$allowedposttags['li'] = $allowed_atts; |
| 1155 |
$allowedposttags['em'] = $allowed_atts; |
| 1156 |
$allowedposttags['hr'] = $allowed_atts; |
| 1157 |
$allowedposttags['br'] = $allowed_atts; |
| 1158 |
$allowedposttags['tr'] = $allowed_atts; |
| 1159 |
$allowedposttags['td'] = $allowed_atts; |
| 1160 |
$allowedposttags['p'] = $allowed_atts; |
| 1161 |
$allowedposttags['a'] = $allowed_atts; |
| 1162 |
$allowedposttags['b'] = $allowed_atts; |
| 1163 |
$allowedposttags['i'] = $allowed_atts; |
| 1164 |
|
| 1165 |
$allowedposttags = apply_filters('usp_allowed_tags', $allowedposttags, $allowed_atts); |
| 1166 |
|
| 1167 |
if (isset($input['usp_form_content'])) $input['usp_form_content'] = wp_kses_post($input['usp_form_content'], $allowedposttags); else $input['usp_form_content'] = null; |
| 1168 |
if (isset($input['error-message'])) $input['error-message'] = wp_kses_post($input['error-message'], $allowedposttags); else $input['error-message'] = null; |
| 1169 |
if (isset($input['upload-message'])) $input['upload-message'] = wp_kses_post($input['upload-message'], $allowedposttags); else $input['upload-message'] = null; |
| 1170 |
if (isset($input['success-message'])) $input['success-message'] = wp_kses_post($input['success-message'], $allowedposttags); else $input['success-message'] = null; |
| 1171 |
if (isset($input['usp_add_another'])) $input['usp_add_another'] = wp_kses_post($input['usp_add_another'], $allowedposttags); else $input['usp_add_another'] = null; |
| 1172 |
if (isset($input['email_alert_message'])) $input['email_alert_message'] = wp_kses_post($input['email_alert_message'], $allowedposttags); else $input['email_alert_message'] = null; |
| 1173 |
if (isset($input['auto_image_markup'])) $input['auto_image_markup'] = wp_kses_post($input['auto_image_markup'], $allowedposttags); else $input['auto_image_markup'] = null; |
| 1174 |
if (isset($input['auto_email_markup'])) $input['auto_email_markup'] = wp_kses_post($input['auto_email_markup'], $allowedposttags); else $input['auto_email_markup'] = null; |
| 1175 |
if (isset($input['auto_url_markup'])) $input['auto_url_markup'] = wp_kses_post($input['auto_url_markup'], $allowedposttags); else $input['auto_url_markup'] = null; |
| 1176 |
if (isset($input['auto_custom_markup'])) $input['auto_custom_markup'] = wp_kses_post($input['auto_custom_markup'], $allowedposttags); else $input['auto_custom_markup'] = null; |
| 1177 |
if (isset($input['auto_custom_markup_2'])) $input['auto_custom_markup_2'] = wp_kses_post($input['auto_custom_markup_2'], $allowedposttags); else $input['auto_custom_markup_2'] = null; |
| 1178 |
|
| 1179 |
if (isset($input['custom_checkbox_text'])) { |
| 1180 |
|
| 1181 |
$input['custom_checkbox_text'] = wp_kses_post($input['custom_checkbox_text'], $allowedposttags); |
| 1182 |
$input['custom_checkbox_text'] = str_replace('script', '', $input['custom_checkbox_text']); |
| 1183 |
|
| 1184 |
} else { |
| 1185 |
|
| 1186 |
$input['custom_checkbox_text'] = null; |
| 1187 |
|
| 1188 |
} |
| 1189 |
|
| 1190 |
$allowedposttags = $default_allowedposttags; |
| 1191 |
|
| 1192 |
if (!isset($input['usp_casing'])) $input['usp_casing'] = null; |
| 1193 |
$input['usp_casing'] = ($input['usp_casing'] == 1 ? 1 : 0); |
| 1194 |
|
| 1195 |
if (!isset($input['usp_email_alerts'])) $input['usp_email_alerts'] = null; |
| 1196 |
$input['usp_email_alerts'] = ($input['usp_email_alerts'] == 1 ? 1 : 0); |
| 1197 |
|
| 1198 |
if (!isset($input['usp_email_html'])) $input['usp_email_html'] = null; |
| 1199 |
$input['usp_email_html'] = ($input['usp_email_html'] == 1 ? 1 : 0); |
| 1200 |
|
| 1201 |
if (!isset($input['usp_use_author'])) $input['usp_use_author'] = null; |
| 1202 |
$input['usp_use_author'] = ($input['usp_use_author'] == 1 ? 1 : 0); |
| 1203 |
|
| 1204 |
if (!isset($input['usp_use_url'])) $input['usp_use_url'] = null; |
| 1205 |
$input['usp_use_url'] = ($input['usp_use_url'] == 1 ? 1 : 0); |
| 1206 |
|
| 1207 |
if (!isset($input['usp_use_email'])) $input['usp_use_email'] = null; |
| 1208 |
$input['usp_use_email'] = ($input['usp_use_email'] == 1 ? 1 : 0); |
| 1209 |
|
| 1210 |
if (!isset($input['usp_use_cat'])) $input['usp_use_cat'] = null; |
| 1211 |
$input['usp_use_cat'] = ($input['usp_use_cat'] == 1 ? 1 : 0); |
| 1212 |
|
| 1213 |
if (!isset($input['usp_include_js'])) $input['usp_include_js'] = null; |
| 1214 |
$input['usp_include_js'] = ($input['usp_include_js'] == 1 ? 1 : 0); |
| 1215 |
|
| 1216 |
if (!isset($input['usp_existing_tags'])) $input['usp_existing_tags'] = null; |
| 1217 |
$input['usp_existing_tags'] = ($input['usp_existing_tags'] == 1 ? 1 : 0); |
| 1218 |
|
| 1219 |
if (!isset($input['usp_richtext_editor'])) $input['usp_richtext_editor'] = null; |
| 1220 |
$input['usp_richtext_editor'] = ($input['usp_richtext_editor'] == 1 ? 1 : 0); |
| 1221 |
|
| 1222 |
if (!isset($input['usp_featured_images'])) $input['usp_featured_images'] = null; |
| 1223 |
$input['usp_featured_images'] = ($input['usp_featured_images'] == 1 ? 1 : 0); |
| 1224 |
|
| 1225 |
if (!isset($input['disable_required'])) $input['disable_required'] = null; |
| 1226 |
$input['disable_required'] = ($input['disable_required'] == 1 ? 1 : 0); |
| 1227 |
|
| 1228 |
if (!isset($input['titles_unique'])) $input['titles_unique'] = null; |
| 1229 |
$input['titles_unique'] = ($input['titles_unique'] == 1 ? 1 : 0); |
| 1230 |
|
| 1231 |
if (!isset($input['enable_shortcodes'])) $input['enable_shortcodes'] = null; |
| 1232 |
$input['enable_shortcodes'] = ($input['enable_shortcodes'] == 1 ? 1 : 0); |
| 1233 |
|
| 1234 |
if (!isset($input['disable_ip_tracking'])) $input['disable_ip_tracking'] = null; |
| 1235 |
$input['disable_ip_tracking'] = ($input['disable_ip_tracking'] == 1 ? 1 : 0); |
| 1236 |
|
| 1237 |
if (!isset($input['logged_in_users'])) $input['logged_in_users'] = null; |
| 1238 |
$input['logged_in_users'] = ($input['logged_in_users'] == 1 ? 1 : 0); |
| 1239 |
|
| 1240 |
if (!isset($input['disable_author'])) $input['disable_author'] = null; |
| 1241 |
$input['disable_author'] = ($input['disable_author'] == 1 ? 1 : 0); |
| 1242 |
|
| 1243 |
if (!isset($input['custom_checkbox'])) $input['custom_checkbox'] = null; |
| 1244 |
$input['custom_checkbox'] = ($input['custom_checkbox'] == 1 ? 1 : 0); |
| 1245 |
|
| 1246 |
if (!isset($input['custom_checkbox_req'])) $input['custom_checkbox_req'] = null; |
| 1247 |
$input['custom_checkbox_req'] = ($input['custom_checkbox_req'] == 1 ? 1 : 0); |
| 1248 |
|
| 1249 |
if (!isset($input['multiple-cats'])) $input['multiple-cats'] = null; |
| 1250 |
$input['multiple-cats'] = ($input['multiple-cats'] == 1 ? 1 : 0); |
| 1251 |
|
| 1252 |
return apply_filters('usp_input_validate', $input); |
| 1253 |
|
| 1254 |
} |
| 1255 |
|
| 1256 |
// |
| 1257 |
|
| 1258 |
function usp_admin_notice() { |
| 1259 |
|
| 1260 |
if (usp_get_current_screen_id() === 'settings_page_user-submitted-posts') { |
| 1261 |
|
| 1262 |
if (!usp_check_date_expired() && !usp_dismiss_notice_check()) { |
| 1263 |
|
| 1264 |
?> |
| 1265 |
|
| 1266 |
<div class="notice notice-success notice-lh"> |
| 1267 |
<p> |
| 1268 |
<strong><?php esc_html_e('☀️ Summer Sale!', 'usp'); ?></strong> |
| 1269 |
<?php esc_html_e('Take 35% OFF any of our', 'usp'); ?> |
| 1270 |
<a target="_blank" rel="noopener noreferrer" href="https://plugin-planet.com/"><?php esc_html_e('Pro WordPress plugins', 'usp'); ?></a> |
| 1271 |
<?php esc_html_e('and', 'usp'); ?> |
| 1272 |
<a target="_blank" rel="noopener noreferrer" href="https://books.perishablepress.com/"><?php esc_html_e('books', 'usp'); ?></a>. |
| 1273 |
<?php esc_html_e('Apply code', 'usp'); ?> <code>SUMMER</code> <?php esc_html_e('at checkout. Sale ends 9/20/2026.', 'usp'); ?> |
| 1274 |
<?php echo usp_dismiss_notice_link(); ?> |
| 1275 |
</p> |
| 1276 |
</div> |
| 1277 |
|
| 1278 |
<?php |
| 1279 |
|
| 1280 |
} |
| 1281 |
|
| 1282 |
} |
| 1283 |
|
| 1284 |
} |
| 1285 |
add_action('admin_notices', 'usp_admin_notice'); |
| 1286 |
|
| 1287 |
function usp_dismiss_notice_activate() { |
| 1288 |
|
| 1289 |
delete_option('user-submitted-posts-dismiss-notice'); |
| 1290 |
|
| 1291 |
} |
| 1292 |
|
| 1293 |
function usp_dismiss_notice_version() { |
| 1294 |
|
| 1295 |
$version_current = USP_VERSION; |
| 1296 |
|
| 1297 |
$version_previous = get_option('user-submitted-posts-dismiss-notice'); |
| 1298 |
|
| 1299 |
$version_previous = ($version_previous) ? $version_previous : $version_current; |
| 1300 |
|
| 1301 |
if (version_compare($version_current, $version_previous, '>')) { |
| 1302 |
|
| 1303 |
delete_option('user-submitted-posts-dismiss-notice'); |
| 1304 |
|
| 1305 |
} |
| 1306 |
|
| 1307 |
} |
| 1308 |
add_action('admin_init', 'usp_dismiss_notice_version'); |
| 1309 |
|
| 1310 |
function usp_dismiss_notice_check() { |
| 1311 |
|
| 1312 |
$check = get_option('user-submitted-posts-dismiss-notice'); |
| 1313 |
|
| 1314 |
return ($check) ? true : false; |
| 1315 |
|
| 1316 |
} |
| 1317 |
|
| 1318 |
function usp_dismiss_notice_save() { |
| 1319 |
|
| 1320 |
if (isset($_GET['dismiss-notice-verify']) && wp_verify_nonce($_GET['dismiss-notice-verify'], 'usp_dismiss_notice')) { |
| 1321 |
|
| 1322 |
if (!current_user_can('manage_options')) exit; |
| 1323 |
|
| 1324 |
$result = update_option('user-submitted-posts-dismiss-notice', USP_VERSION, false); |
| 1325 |
|
| 1326 |
$result = $result ? 'true' : 'false'; |
| 1327 |
|
| 1328 |
$location = admin_url('options-general.php?page=user-submitted-posts&dismiss-notice='. $result); |
| 1329 |
|
| 1330 |
wp_redirect($location); |
| 1331 |
|
| 1332 |
exit; |
| 1333 |
|
| 1334 |
} |
| 1335 |
|
| 1336 |
} |
| 1337 |
add_action('admin_init', 'usp_dismiss_notice_save'); |
| 1338 |
|
| 1339 |
function usp_dismiss_notice_link() { |
| 1340 |
|
| 1341 |
$nonce = wp_create_nonce('usp_dismiss_notice'); |
| 1342 |
|
| 1343 |
$href = add_query_arg(array('dismiss-notice-verify' => $nonce), admin_url('options-general.php?page=user-submitted-posts')); |
| 1344 |
|
| 1345 |
$label = esc_html__('Dismiss', 'usp'); |
| 1346 |
|
| 1347 |
return '<a class="usp-dismiss-notice" href="'. esc_url($href) .'">'. esc_html($label) .'</a>'; |
| 1348 |
|
| 1349 |
} |
| 1350 |
|
| 1351 |
function usp_check_date_expired() { |
| 1352 |
|
| 1353 |
$expires = apply_filters('usp_check_date_expired', '2026-09-20'); |
| 1354 |
|
| 1355 |
return (new DateTime() > new DateTime($expires)) ? true : false; |
| 1356 |
|
| 1357 |
} |
| 1358 |
|