| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! function_exists('hmvc_download_file')) |
| 4 |
{ |
| 5 |
/** |
| 6 |
* @deprecated 2.0 Use wmvc_download_file() |
| 7 |
* @see wmvc_download_file() |
| 8 |
*/ |
| 9 |
function hmvc_download_file($url, $save_file_loc, $data = array()) |
| 10 |
{ |
| 11 |
return wmvc_download_file($url, $save_file_loc, $data); |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
if ( ! function_exists('hmvc_current_edit_url')) |
| 16 |
{ |
| 17 |
/** |
| 18 |
* @deprecated 2.0 Use wmvc_current_edit_url() |
| 19 |
* @see wmvc_current_edit_url() |
| 20 |
*/ |
| 21 |
function hmvc_current_edit_url() |
| 22 |
{ |
| 23 |
return wmvc_current_edit_url(); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
if ( ! function_exists('hmvc_api_call')) |
| 28 |
{ |
| 29 |
/** |
| 30 |
* @deprecated 2.0 Use wmvc_api_call() |
| 31 |
* @see wmvc_api_call() |
| 32 |
*/ |
| 33 |
function hmvc_api_call($method, $url, $data, $headers = false) |
| 34 |
{ |
| 35 |
return wmvc_api_call($method, $url, $data, $headers); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
if ( ! function_exists('echo_js')) |
| 41 |
{ |
| 42 |
/** |
| 43 |
* @deprecated 2.0 Use wmvc_echo_js() |
| 44 |
* @see wmvc_echo_js() |
| 45 |
*/ |
| 46 |
function echo_js($str) |
| 47 |
{ |
| 48 |
$str = str_replace("'", "\'", trim($str)); |
| 49 |
$str = str_replace('"', '\"', $str); |
| 50 |
|
| 51 |
echo $str; |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
if ( ! function_exists('_js')) |
| 56 |
{ |
| 57 |
/** |
| 58 |
* @deprecated 2.0 Use wmvc_js() |
| 59 |
* @see wmvc_js() |
| 60 |
*/ |
| 61 |
function _js($str) |
| 62 |
{ |
| 63 |
$str = str_replace("\\", "", trim($str)); |
| 64 |
$str = str_replace("'", "\'", trim($str)); |
| 65 |
$str = str_replace('"', '\"', $str); |
| 66 |
|
| 67 |
return $str; |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
if ( ! function_exists('dump')) |
| 72 |
{ |
| 73 |
/** |
| 74 |
* @deprecated 2.0 Use wmvc_dump() |
| 75 |
* @see wmvc_dump() |
| 76 |
*/ |
| 77 |
function dump($var) |
| 78 |
{ |
| 79 |
echo '<pre>'; |
| 80 |
var_dump($var); |
| 81 |
echo '</pre>'; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
if ( ! function_exists('resolve_ip')) |
| 86 |
{ |
| 87 |
/** |
| 88 |
* @deprecated 2.0 Use wmvc_resolve_ip() |
| 89 |
* @see wmvc_resolve_ip() |
| 90 |
*/ |
| 91 |
function resolve_ip($ip) |
| 92 |
{ |
| 93 |
if($ip == 'DISABLED') |
| 94 |
return $ip; |
| 95 |
|
| 96 |
if (filter_var($ip, FILTER_VALIDATE_IP)) { |
| 97 |
// $ip is a valid IP address" |
| 98 |
} else { |
| 99 |
return ''; |
| 100 |
} |
| 101 |
|
| 102 |
if($ip == '::1') |
| 103 |
{ |
| 104 |
return $ip.', local'; |
| 105 |
} |
| 106 |
|
| 107 |
$str = '<a target="_blank" href="https://whatismyipaddress.com/ip/'.$ip.'">'.$ip.'</a>'; |
| 108 |
|
| 109 |
return $str; |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
if ( ! function_exists('stringify_attributes')) |
| 114 |
{ |
| 115 |
/** |
| 116 |
* Stringify attributes for use in html tags. |
| 117 |
* |
| 118 |
* @since 1.0 |
| 119 |
* @deprecated 2.0 Use wmvc_stringify_attributes() |
| 120 |
* @see wmvc_stringify_attributes() |
| 121 |
* |
| 122 |
* Helper function used to convert an array or object of |
| 123 |
* attributes to a string |
| 124 |
* |
| 125 |
* @param mixed |
| 126 |
* @return string |
| 127 |
*/ |
| 128 |
function stringify_attributes($attributes, $js = FALSE) |
| 129 |
{ |
| 130 |
if (is_object($attributes) && count($attributes) > 0) |
| 131 |
{ |
| 132 |
$attributes = (array) $attributes; |
| 133 |
} |
| 134 |
|
| 135 |
if (is_array($attributes)) |
| 136 |
{ |
| 137 |
$atts = ''; |
| 138 |
if (count($attributes) === 0) |
| 139 |
{ |
| 140 |
return $atts; |
| 141 |
} |
| 142 |
foreach ($attributes as $key => $val) |
| 143 |
{ |
| 144 |
if ($js) |
| 145 |
{ |
| 146 |
$atts .= $key.'='.$val.','; |
| 147 |
} |
| 148 |
else |
| 149 |
{ |
| 150 |
$atts .= ' '.$key.'="'.$val.'"'; |
| 151 |
} |
| 152 |
} |
| 153 |
return rtrim($atts, ','); |
| 154 |
} |
| 155 |
elseif (is_string($attributes) && strlen($attributes) > 0) |
| 156 |
{ |
| 157 |
return ' '.$attributes; |
| 158 |
} |
| 159 |
|
| 160 |
return $attributes; |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
if ( ! function_exists('anchor')) |
| 165 |
{ |
| 166 |
/** |
| 167 |
* Anchor Link |
| 168 |
* |
| 169 |
* Creates an anchor based on the local URL. |
| 170 |
* |
| 171 |
* @deprecated 2.0 Use wmvc_anchor() |
| 172 |
* @see wmvc_anchor() |
| 173 |
* |
| 174 |
* @param string the URL |
| 175 |
* @param string the link title |
| 176 |
* @param mixed any attributes |
| 177 |
* @return string |
| 178 |
*/ |
| 179 |
function anchor($uri = '', $title = '', $attributes = '') |
| 180 |
{ |
| 181 |
$title = (string) $title; |
| 182 |
|
| 183 |
$site_url = is_array($uri) |
| 184 |
? site_url($uri) |
| 185 |
: (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri)); |
| 186 |
|
| 187 |
if ($title === '') |
| 188 |
{ |
| 189 |
$title = $site_url; |
| 190 |
} |
| 191 |
|
| 192 |
if ($attributes !== '') |
| 193 |
{ |
| 194 |
$attributes = stringify_attributes($attributes); |
| 195 |
} |
| 196 |
|
| 197 |
return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>'; |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
if ( ! function_exists('btn_edit')) |
| 202 |
{ |
| 203 |
/** |
| 204 |
* @deprecated 2.0 Use wmvc_btn_edit() |
| 205 |
* @see wmvc_btn_edit() |
| 206 |
*/ |
| 207 |
function btn_edit($uri) |
| 208 |
{ |
| 209 |
return anchor($uri, '<i class="glyphicon glyphicon-pencil"></i>', array('class'=>'btn btn-success btn-xs')); |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
|
| 214 |
if ( ! function_exists('btn_read')) |
| 215 |
{ |
| 216 |
/** |
| 217 |
* @deprecated 2.0 Use wmvc_btn_read() |
| 218 |
* @see wmvc_btn_read() |
| 219 |
*/ |
| 220 |
function btn_read($uri, $title=NULL) |
| 221 |
{ |
| 222 |
if(empty($title))$title=__('Read', 'wmvc_win'); |
| 223 |
|
| 224 |
return anchor($uri, '<i class="glyphicon glyphicon-search"></i> '.$title, array('class'=>'btn btn-primary btn-xs')); |
| 225 |
} |
| 226 |
} |
| 227 |
|
| 228 |
if ( ! function_exists('btn_open')) |
| 229 |
{ |
| 230 |
/** |
| 231 |
* @deprecated 2.0 Use wmvc_btn_open() |
| 232 |
* @see wmvc_btn_open() |
| 233 |
*/ |
| 234 |
function btn_open($uri, $target=NULL) |
| 235 |
{ |
| 236 |
if($target === NULL) |
| 237 |
$target = '_blank'; |
| 238 |
|
| 239 |
return anchor($uri, '<i class="glyphicon glyphicon-search"></i>', array('class'=>'btn btn-primary btn-xs', 'target'=>$target, 'title'=>__('Open details', 'wmvc_win'))); |
| 240 |
} |
| 241 |
} |
| 242 |
|
| 243 |
if ( ! function_exists('btn_open_ajax')) |
| 244 |
{ |
| 245 |
/** |
| 246 |
* @deprecated 2.0 Use wmvc_btn_open_ajax() |
| 247 |
* @see wmvc_btn_open_ajax() |
| 248 |
*/ |
| 249 |
function btn_open_ajax($uri, $target=NULL) |
| 250 |
{ |
| 251 |
if($target === NULL) |
| 252 |
$target = '_blank'; |
| 253 |
|
| 254 |
return anchor($uri, '<i class="glyphicon glyphicon-search"></i>', array('class'=>'btn btn-primary btn-xs popup-with-form-ajax', 'target'=>$target, 'title'=>__('Open details', 'wmvc_win'))); |
| 255 |
} |
| 256 |
} |
| 257 |
|
| 258 |
if ( ! function_exists('btn_delete_noconfirm')) |
| 259 |
{ |
| 260 |
/** |
| 261 |
* @deprecated 2.0 Use wmvc_btn_delete_noconfirm() |
| 262 |
* @see wmvc_btn_delete_noconfirm() |
| 263 |
*/ |
| 264 |
function btn_delete_noconfirm($uri) |
| 265 |
{ |
| 266 |
return anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array('class'=>'btn btn-danger btn-xs delete_button')); |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
if ( ! function_exists('btn_delete')) |
| 272 |
{ |
| 273 |
/** |
| 274 |
* @deprecated 2.0 Use wmvc_btn_delete() |
| 275 |
* @see wmvc_btn_delete() |
| 276 |
*/ |
| 277 |
function btn_delete($uri, $confirm_question = TRUE, $title='') |
| 278 |
{ |
| 279 |
$target = ''; |
| 280 |
if(isset($_GET['popup'])) |
| 281 |
{ |
| 282 |
$target = ''; |
| 283 |
} |
| 284 |
|
| 285 |
if($confirm_question) |
| 286 |
{ |
| 287 |
return anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array( 'target' => $target, 'title' => $title, 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-danger btn-xs delete_button')); |
| 288 |
} |
| 289 |
else |
| 290 |
{ |
| 291 |
return anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array( 'target' => $target, 'title' => $title, 'class'=>'btn btn-danger btn-xs delete_button')); |
| 292 |
} |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
|
| 297 |
if ( ! function_exists('btn_save')) |
| 298 |
{ |
| 299 |
/** |
| 300 |
* @deprecated 2.0 Use wmvc_btn_save() |
| 301 |
* @see wmvc_btn_save() |
| 302 |
*/ |
| 303 |
function btn_save($uri, $empty = '-empty') |
| 304 |
{ |
| 305 |
$target = ''; |
| 306 |
if(isset($_GET['popup'])) |
| 307 |
{ |
| 308 |
$target = ''; |
| 309 |
} |
| 310 |
|
| 311 |
return anchor($uri, '<i class="glyphicon glyphicon-heart'.$empty.'"></i> ', array( 'target' => $target, 'class'=>'btn btn-danger btn-xs save_button', 'title'=>__('Save as Favourite for further analysis', 'wmvc_win'))); |
| 312 |
} |
| 313 |
} |
| 314 |
|
| 315 |
if ( ! function_exists('btn_block')) |
| 316 |
{ |
| 317 |
/** |
| 318 |
* @deprecated 2.0 Use wmvc_btn_block() |
| 319 |
* @see wmvc_btn_block() |
| 320 |
*/ |
| 321 |
function btn_block($uri, $confirm_question = FALSE, $title='') |
| 322 |
{ |
| 323 |
$target = ''; |
| 324 |
if(isset($_GET['popup'])) |
| 325 |
{ |
| 326 |
$target = '_blank'; |
| 327 |
} |
| 328 |
|
| 329 |
if($confirm_question) |
| 330 |
{ |
| 331 |
return anchor($uri, '<i class="glyphicon glyphicon-lock"></i> ', array( 'target' => $target, 'title' => $title, 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-warning btn-xs block_button')); |
| 332 |
} |
| 333 |
else |
| 334 |
{ |
| 335 |
return anchor($uri, '<i class="glyphicon glyphicon-lock"></i> ', array( 'target' => $target, 'title' => $title, 'class'=>'btn btn-warning btn-xs block_button')); |
| 336 |
} |
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
if ( ! function_exists('btn_view')) |
| 341 |
{ |
| 342 |
/** |
| 343 |
* @deprecated 2.0 Use wmvc_btn_view() |
| 344 |
* @see wmvc_btn_view() |
| 345 |
*/ |
| 346 |
function btn_view($uri, $confirm_question = FALSE, $title='') |
| 347 |
{ |
| 348 |
if($confirm_question) |
| 349 |
{ |
| 350 |
return anchor($uri, '<i class="glyphicon glyphicon-search"></i> ', array( 'title' => $title, 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-info btn-xs')); |
| 351 |
} |
| 352 |
else |
| 353 |
{ |
| 354 |
return anchor($uri, '<i class="glyphicon glyphicon-search"></i> ', array( 'title' => $title, 'class'=>'btn btn-info btn-xs')); |
| 355 |
} |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 359 |
if ( ! function_exists('btn_hide')) |
| 360 |
{ |
| 361 |
/** |
| 362 |
* @deprecated 2.0 Use wmvc_btn_hide() |
| 363 |
* @see wmvc_btn_hide() |
| 364 |
*/ |
| 365 |
function btn_hide($uri) |
| 366 |
{ |
| 367 |
$target = ''; |
| 368 |
if(isset($_GET['popup'])) |
| 369 |
{ |
| 370 |
$target = '_blank'; |
| 371 |
} |
| 372 |
|
| 373 |
return anchor($uri, '<i class="glyphicon glyphicon-eye-close"></i> ', array( 'target' => $target, 'class'=>'btn btn-default btn-xs', 'title'=>__('Define hide rules', 'wmvc_win'))); |
| 374 |
} |
| 375 |
} |
| 376 |
|
| 377 |
|
| 378 |
if ( ! function_exists('get_file_extension')) |
| 379 |
{ |
| 380 |
/** |
| 381 |
* @deprecated 2.0 Use wmvc_get_file_extension() |
| 382 |
* @see wmvc_get_file_extension() |
| 383 |
*/ |
| 384 |
function get_file_extension($filepath) |
| 385 |
{ |
| 386 |
return substr($filepath, strrpos($filepath, '.')+1); |
| 387 |
} |
| 388 |
} |
| 389 |
|
| 390 |
if ( ! function_exists('character_hard_limiter')) |
| 391 |
{ |
| 392 |
/** |
| 393 |
* @deprecated 2.0 Use wmvc_character_hard_limiter() |
| 394 |
* @see wmvc_character_hard_limiter() |
| 395 |
*/ |
| 396 |
function character_hard_limiter($string, $max_len) |
| 397 |
{ |
| 398 |
if(strlen($string)>$max_len) |
| 399 |
{ |
| 400 |
return substr($string, 0, $max_len-3).'...'; |
| 401 |
} |
| 402 |
|
| 403 |
return $string; |
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
if ( ! function_exists('wmvc_echo_js')) |
| 408 |
{ |
| 409 |
function wmvc_echo_js($str) |
| 410 |
{ |
| 411 |
$str = str_replace("'", "\'", trim($str)); |
| 412 |
$str = str_replace('"', '\"', $str); |
| 413 |
|
| 414 |
echo $str; |
| 415 |
} |
| 416 |
} |
| 417 |
|
| 418 |
if ( ! function_exists('wmvc_js')) |
| 419 |
{ |
| 420 |
function wmvc_js($str) |
| 421 |
{ |
| 422 |
$str = str_replace("\\", "", trim($str)); |
| 423 |
$str = str_replace("'", "\'", trim($str)); |
| 424 |
$str = str_replace('"', '\"', $str); |
| 425 |
|
| 426 |
return $str; |
| 427 |
} |
| 428 |
} |
| 429 |
|
| 430 |
if ( ! function_exists('wmvc_dump')) |
| 431 |
{ |
| 432 |
function wmvc_dump($var) |
| 433 |
{ |
| 434 |
echo '<pre>'; |
| 435 |
var_dump($var); |
| 436 |
echo '</pre>'; |
| 437 |
} |
| 438 |
} |
| 439 |
|
| 440 |
|
| 441 |
if ( ! function_exists('wmvc_resolve_ip')) |
| 442 |
{ |
| 443 |
function wmvc_resolve_ip($ip) |
| 444 |
{ |
| 445 |
if($ip == 'DISABLED') |
| 446 |
return $ip; |
| 447 |
|
| 448 |
if (filter_var($ip, FILTER_VALIDATE_IP)) { |
| 449 |
// $ip is a valid IP address" |
| 450 |
} else { |
| 451 |
return ''; |
| 452 |
} |
| 453 |
|
| 454 |
if($ip == '::1') |
| 455 |
{ |
| 456 |
return $ip.', local'; |
| 457 |
} |
| 458 |
|
| 459 |
$str = '<a target="_blank" href="https://whatismyipaddress.com/ip/'.$ip.'">'.$ip.'</a>'; |
| 460 |
|
| 461 |
return $str; |
| 462 |
} |
| 463 |
} |
| 464 |
|
| 465 |
/** |
| 466 |
* Stringify attributes for use in html tags. |
| 467 |
* |
| 468 |
* Helper function used to convert an array or object of |
| 469 |
* attributes to a string |
| 470 |
* |
| 471 |
* @param mixed |
| 472 |
* @return string |
| 473 |
*/ |
| 474 |
if ( ! function_exists('wmvc_stringify_attributes')) |
| 475 |
{ |
| 476 |
function wmvc_stringify_attributes($attributes, $js = FALSE) |
| 477 |
{ |
| 478 |
if (is_object($attributes) && count($attributes) > 0) |
| 479 |
{ |
| 480 |
$attributes = (array) $attributes; |
| 481 |
} |
| 482 |
|
| 483 |
if (is_array($attributes)) |
| 484 |
{ |
| 485 |
$atts = ''; |
| 486 |
if (count($attributes) === 0) |
| 487 |
{ |
| 488 |
return $atts; |
| 489 |
} |
| 490 |
foreach ($attributes as $key => $val) |
| 491 |
{ |
| 492 |
if ($js) |
| 493 |
{ |
| 494 |
$atts .= $key.'='.$val.','; |
| 495 |
} |
| 496 |
else |
| 497 |
{ |
| 498 |
$atts .= ' '.$key.'="'.$val.'"'; |
| 499 |
} |
| 500 |
} |
| 501 |
return rtrim($atts, ','); |
| 502 |
} |
| 503 |
elseif (is_string($attributes) && strlen($attributes) > 0) |
| 504 |
{ |
| 505 |
return ' '.$attributes; |
| 506 |
} |
| 507 |
|
| 508 |
return $attributes; |
| 509 |
} |
| 510 |
} |
| 511 |
|
| 512 |
if ( ! function_exists('wmvc_anchor')) |
| 513 |
{ |
| 514 |
/** |
| 515 |
* Anchor Link |
| 516 |
* |
| 517 |
* Creates an anchor based on the local URL. |
| 518 |
* |
| 519 |
* @param string the URL |
| 520 |
* @param string the link title |
| 521 |
* @param mixed any attributes |
| 522 |
* @return string |
| 523 |
*/ |
| 524 |
function wmvc_anchor($uri = '', $title = '', $attributes = '') |
| 525 |
{ |
| 526 |
$title = (string) $title; |
| 527 |
|
| 528 |
$site_url = is_array($uri) |
| 529 |
? site_url($uri) |
| 530 |
: (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri)); |
| 531 |
|
| 532 |
if ($title === '') |
| 533 |
{ |
| 534 |
$title = $site_url; |
| 535 |
} |
| 536 |
|
| 537 |
if ($attributes !== '') |
| 538 |
{ |
| 539 |
$attributes = wmvc_stringify_attributes($attributes); |
| 540 |
} |
| 541 |
|
| 542 |
return '<a href="'.esc_url($site_url).'"'.wp_kses_post($attributes).'>'.wp_kses_post($title).'</a>'; |
| 543 |
} |
| 544 |
} |
| 545 |
|
| 546 |
|
| 547 |
if ( ! function_exists('wmvc_btn_edit')) |
| 548 |
{ |
| 549 |
function wmvc_btn_edit($uri) |
| 550 |
{ |
| 551 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-pencil"></i>', array('class'=>'btn btn-success btn-xs')); |
| 552 |
} |
| 553 |
} |
| 554 |
|
| 555 |
if ( ! function_exists('wmvc_btn_read')) |
| 556 |
{ |
| 557 |
function wmvc_btn_read($uri, $title=NULL) |
| 558 |
{ |
| 559 |
if(empty($title))$title=__('Read', 'wmvc_win'); |
| 560 |
|
| 561 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-search"></i> '.esc_html($title), array('class'=>'btn btn-primary btn-xs')); |
| 562 |
} |
| 563 |
} |
| 564 |
|
| 565 |
if ( ! function_exists('wmvc_btn_open')) |
| 566 |
{ |
| 567 |
function wmvc_btn_open($uri, $target=NULL) |
| 568 |
{ |
| 569 |
if($target === NULL) |
| 570 |
$target = '_blank'; |
| 571 |
|
| 572 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-search"></i>', array('class'=>'btn btn-primary btn-xs', 'target'=>esc_html($target), 'title'=>esc_html__('Open details', 'wmvc_win'))); |
| 573 |
} |
| 574 |
} |
| 575 |
|
| 576 |
if ( ! function_exists('wmvc_btn_open_ajax')) |
| 577 |
{ |
| 578 |
function wmvc_btn_open_ajax($uri, $target=NULL) |
| 579 |
{ |
| 580 |
if($target === NULL) |
| 581 |
$target = '_blank'; |
| 582 |
|
| 583 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-search"></i>', array('class'=>'btn btn-primary btn-xs popup-with-form-ajax', 'target'=>esc_html($target), 'title'=>esc_html__('Open details', 'wmvc_win'))); |
| 584 |
} |
| 585 |
} |
| 586 |
|
| 587 |
if ( ! function_exists('wmvc_btn_delete_noconfirm')) |
| 588 |
{ |
| 589 |
function wmvc_btn_delete_noconfirm($uri) |
| 590 |
{ |
| 591 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array('class'=>'btn btn-danger btn-xs delete_button')); |
| 592 |
} |
| 593 |
} |
| 594 |
|
| 595 |
|
| 596 |
if ( ! function_exists('wmvc_btn_delete')) |
| 597 |
{ |
| 598 |
function wmvc_btn_delete($uri, $confirm_question = TRUE, $title='') |
| 599 |
{ |
| 600 |
$target = ''; |
| 601 |
if(isset($_GET['popup'])) |
| 602 |
{ |
| 603 |
$target = ''; |
| 604 |
} |
| 605 |
|
| 606 |
if($confirm_question) |
| 607 |
{ |
| 608 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array( 'target' => esc_html($target), 'title' => esc_html($title), 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-danger btn-xs delete_button action_confirm')); |
| 609 |
} |
| 610 |
else |
| 611 |
{ |
| 612 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-remove"></i> ', array( 'target' => esc_html($target), 'title' => esc_html($title), 'class'=>'btn btn-danger btn-xs delete_button')); |
| 613 |
} |
| 614 |
} |
| 615 |
} |
| 616 |
|
| 617 |
if ( ! function_exists('wmvc_btn_save')) |
| 618 |
{ |
| 619 |
function wmvc_btn_save($uri, $empty = '-empty') |
| 620 |
{ |
| 621 |
$target = ''; |
| 622 |
if(isset($_GET['popup'])) |
| 623 |
{ |
| 624 |
$target = ''; |
| 625 |
} |
| 626 |
|
| 627 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-heart'.esc_attr($empty).'"></i> ', array( 'target' => esc_html($target), 'class'=>'btn btn-danger btn-xs save_button', 'title'=>esc_html__('Save', 'wmvc_win'))); |
| 628 |
} |
| 629 |
} |
| 630 |
|
| 631 |
if ( ! function_exists('wmvc_btn_block')) |
| 632 |
{ |
| 633 |
function wmvc_btn_block($uri, $confirm_question = FALSE, $title='') |
| 634 |
{ |
| 635 |
$target = ''; |
| 636 |
if(isset($_GET['popup'])) |
| 637 |
{ |
| 638 |
$target = '_blank'; |
| 639 |
} |
| 640 |
|
| 641 |
if($confirm_question) |
| 642 |
{ |
| 643 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-lock"></i> ', array( 'target' => esc_attr($target), 'title' => esc_html($title), 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-warning btn-xs block_button action_block')); |
| 644 |
} |
| 645 |
else |
| 646 |
{ |
| 647 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-lock"></i> ', array( 'target' => esc_attr($target), 'title' => esc_html($title), 'class'=>'btn btn-warning btn-xs block_button')); |
| 648 |
} |
| 649 |
} |
| 650 |
} |
| 651 |
|
| 652 |
if ( ! function_exists('wmvc_btn_view')) |
| 653 |
{ |
| 654 |
function wmvc_btn_view($uri, $confirm_question = FALSE, $title='') |
| 655 |
{ |
| 656 |
if($confirm_question) |
| 657 |
{ |
| 658 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-search"></i> ', array( 'title' => esc_html($title), 'onclick' => 'return confirm(\''.__('Are you sure?', 'wmvc_win').'\')', 'class'=>'btn btn-info btn-xs')); |
| 659 |
} |
| 660 |
else |
| 661 |
{ |
| 662 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-search"></i> ', array( 'title' => esc_html($title), 'class'=>'btn btn-info btn-xs')); |
| 663 |
} |
| 664 |
} |
| 665 |
} |
| 666 |
|
| 667 |
if ( ! function_exists('wmvc_btn_hide')) |
| 668 |
{ |
| 669 |
function wmvc_btn_hide($uri) |
| 670 |
{ |
| 671 |
$target = ''; |
| 672 |
if(isset($_GET['popup'])) |
| 673 |
{ |
| 674 |
$target = '_blank'; |
| 675 |
} |
| 676 |
|
| 677 |
return wmvc_anchor($uri, '<i class="glyphicon glyphicon-eye-close"></i> ', array( 'target' => esc_attr($target), 'class'=>'btn btn-default btn-xs', 'title'=>esc_html__('Define hide rules', 'wmvc_win'))); |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
if ( ! function_exists('wmvc_get_file_extension')) |
| 682 |
{ |
| 683 |
function wmvc_get_file_extension($filepath) |
| 684 |
{ |
| 685 |
return substr($filepath, strrpos($filepath, '.')+1); |
| 686 |
} |
| 687 |
} |
| 688 |
|
| 689 |
|
| 690 |
if ( ! function_exists('wmvc_character_hard_limiter')) |
| 691 |
{ |
| 692 |
function wmvc_character_hard_limiter($string, $max_len) |
| 693 |
{ |
| 694 |
if(strlen($string)>$max_len) |
| 695 |
{ |
| 696 |
return substr($string, 0, $max_len-3).'...'; |
| 697 |
} |
| 698 |
|
| 699 |
return $string; |
| 700 |
} |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
if(!function_exists('wmvc_count')) { |
| 705 |
function wmvc_count($mixed='') { |
| 706 |
$count = 0; |
| 707 |
|
| 708 |
if(!empty($mixed) && (is_array($mixed))) { |
| 709 |
$count = count($mixed); |
| 710 |
} else if(!empty($mixed) && function_exists('is_countable') && version_compare(PHP_VERSION, '7.3', '<') && is_countable($mixed)) { |
| 711 |
$count = count($mixed); |
| 712 |
} |
| 713 |
else if(!empty($mixed) && is_object($mixed)) { |
| 714 |
$count = 1; |
| 715 |
} |
| 716 |
return $count; |
| 717 |
} |
| 718 |
} |
| 719 |
|
| 720 |
function wmvc_is_user_in_role( $user, $role ) { |
| 721 |
return in_array( $role, $user->roles ); |
| 722 |
} |
| 723 |
|
| 724 |
function wmvc_is_logged_user() |
| 725 |
{ |
| 726 |
$current_user = wp_get_current_user(); |
| 727 |
if ( 0 == $current_user->ID ) { |
| 728 |
return false; |
| 729 |
} else { |
| 730 |
// Logged in. |
| 731 |
return true; |
| 732 |
} |
| 733 |
} |
| 734 |
|
| 735 |
function wmvc_get_current_user_role() { |
| 736 |
if( is_user_logged_in() ) { |
| 737 |
$user = wp_get_current_user(); |
| 738 |
$role = ( array ) $user->roles; |
| 739 |
return $role[0]; |
| 740 |
} else { |
| 741 |
return ''; |
| 742 |
} |
| 743 |
} |
| 744 |
|
| 745 |
function wmvc_user_in_role($role) |
| 746 |
{ |
| 747 |
if(!wmvc_is_logged_user()) |
| 748 |
return false; |
| 749 |
|
| 750 |
$current_user = wp_get_current_user(); |
| 751 |
|
| 752 |
return wmvc_is_user_in_role( $current_user, $role ); |
| 753 |
} |
| 754 |
|
| 755 |
function wmvc_character_limiter($text, $limit) |
| 756 |
{ |
| 757 |
if(is_array($text)) |
| 758 |
$text = 'Array( '. join(', ', $text).' )'; |
| 759 |
|
| 760 |
if(strlen($text) > $limit) |
| 761 |
{ |
| 762 |
return substr($text, 0, $limit-4).'...'; |
| 763 |
} |
| 764 |
|
| 765 |
return $text; |
| 766 |
} |
| 767 |
|
| 768 |
function wmvc_show_data($field_name, &$db_value = NULL, $default = '', $xss_clean = TRUE, $skip_post = FALSE) |
| 769 |
{ |
| 770 |
if(!$skip_post && isset($_POST[$field_name])) |
| 771 |
{ |
| 772 |
if($xss_clean === FALSE) |
| 773 |
return stripslashes($_POST[$field_name]); |
| 774 |
|
| 775 |
return wmvc_xss_clean(stripslashes($_POST[$field_name])); |
| 776 |
} |
| 777 |
|
| 778 |
if(is_array($db_value)) |
| 779 |
{ |
| 780 |
if(isset($db_value[$field_name])) |
| 781 |
{ |
| 782 |
if($xss_clean === FALSE) |
| 783 |
return $db_value[$field_name]; |
| 784 |
|
| 785 |
return wmvc_xss_clean($db_value[$field_name]); |
| 786 |
} |
| 787 |
else |
| 788 |
{ |
| 789 |
return $default; |
| 790 |
} |
| 791 |
} |
| 792 |
|
| 793 |
if(is_object($db_value)) |
| 794 |
{ |
| 795 |
if(isset($db_value->$field_name)) |
| 796 |
{ |
| 797 |
if($xss_clean === FALSE) |
| 798 |
return $db_value->$field_name; |
| 799 |
|
| 800 |
return wmvc_xss_clean($db_value->$field_name); |
| 801 |
} |
| 802 |
else |
| 803 |
{ |
| 804 |
return $default; |
| 805 |
} |
| 806 |
} |
| 807 |
|
| 808 |
if(!empty($db_value)) |
| 809 |
{ |
| 810 |
if($xss_clean === FALSE) |
| 811 |
return $db_value; |
| 812 |
|
| 813 |
return wmvc_xss_clean($db_value); |
| 814 |
} |
| 815 |
|
| 816 |
if($xss_clean === FALSE) |
| 817 |
return $default; |
| 818 |
|
| 819 |
return wmvc_xss_clean($default); |
| 820 |
} |
| 821 |
|
| 822 |
|
| 823 |
/* |
| 824 |
<select class="form-control" name="<?php echo 'control_operator_'.$i_fieldnum; ?>"> |
| 825 |
<option value="CONTAINS">CONTAINS</option> |
| 826 |
<option value="NOT_CONTAINS">NOT_CONTAINS</option> |
| 827 |
</select> |
| 828 |
*/ |
| 829 |
function wmvc_select_option($field_name, $options = array(), $selected = NULL, $extra=NULL, $empty_text = NULL, $empty_val = '') |
| 830 |
{ |
| 831 |
$output = '<select name="'.$field_name.'" '.$extra.' >'; |
| 832 |
|
| 833 |
if(!is_null($empty_text)) |
| 834 |
$output.= '<option value="'.esc_attr($empty_val).'">'.esc_html($empty_text).'</option>'; |
| 835 |
|
| 836 |
if(is_array($options) && count($options) > 0) |
| 837 |
foreach($options as $key=>$val) |
| 838 |
{ |
| 839 |
$output.= '<option value="'.$key.'" '.($selected==$key?'selected':'').'>'.$val.'</option>'; |
| 840 |
} |
| 841 |
|
| 842 |
$output.= '</select>'; |
| 843 |
|
| 844 |
return $output; |
| 845 |
} |
| 846 |
|
| 847 |
function wmvc_upload_media($field_name, $image_id) |
| 848 |
{ |
| 849 |
static $media_element_counter = 0; |
| 850 |
|
| 851 |
$media_element_counter++; |
| 852 |
|
| 853 |
$img_field = $field_name.'_'.$media_element_counter; |
| 854 |
|
| 855 |
wp_enqueue_script( 'wpmediaelement' ); |
| 856 |
wp_enqueue_media(); |
| 857 |
|
| 858 |
?> |
| 859 |
<div id="<?php echo esc_attr($field_name); ?>meta-box-id" class="postbox-upload"> |
| 860 |
<?php |
| 861 |
// Get WordPress' media upload URL |
| 862 |
$upload_link = '#'; |
| 863 |
|
| 864 |
// Get the image src |
| 865 |
$your_img_src = wp_get_attachment_image_src( $image_id, 'full' ); |
| 866 |
|
| 867 |
// For convenience, see if the array is valid |
| 868 |
$you_have_img = is_array( $your_img_src ); |
| 869 |
?> |
| 870 |
|
| 871 |
<!-- Your image container, which can be manipulated with js --> |
| 872 |
<div class="custom-img-container"> |
| 873 |
<?php if ( $you_have_img ) : ?> |
| 874 |
<img src="<?php echo esc_html($your_img_src[0]); ?>" alt="<?php echo esc_attr__('thumb', 'wmvc_win');?>" style="max-width:100%;" class="thumbnail"/> |
| 875 |
<?php endif; ?> |
| 876 |
</div> |
| 877 |
|
| 878 |
<?php //if(sw_user_in_role('administrator')): ?> |
| 879 |
<!-- Your add & remove image links --> |
| 880 |
<p class="hide-if-no-js"> |
| 881 |
<a class="button button-primary upload-custom-img <?php if ( $you_have_img ) { echo 'hidden'; } ?>" |
| 882 |
href="<?php echo esc_url($upload_link) ?>"> |
| 883 |
<?php echo esc_html__('Select image','wmvc_win') ?> |
| 884 |
</a> |
| 885 |
<a class="button button-secondary delete-custom-img <?php if ( ! $you_have_img ) { echo 'hidden'; } ?>" |
| 886 |
href="#"> |
| 887 |
<?php echo esc_html__('Remove image','wmvc_win') ?> |
| 888 |
</a> |
| 889 |
</p> |
| 890 |
<?php //endif; ?> |
| 891 |
|
| 892 |
<!-- A hidden input to set and post the chosen image id --> |
| 893 |
<input class="logo_image_id" type="hidden" id="<?php echo esc_html(esc_html($field_name)); ?>" name="<?php echo esc_html($field_name); ?>" value="<?php echo esc_html($image_id); ?>" /> |
| 894 |
</div> |
| 895 |
|
| 896 |
<?php |
| 897 |
$custom_js =''; |
| 898 |
$custom_js .=" jQuery(function($) { |
| 899 |
if( typeof jQuery.fn.wpMediaElement == 'function') |
| 900 |
$('#".esc_js($field_name)."meta-box-id.postbox-upload').wpMediaElement(); |
| 901 |
});"; |
| 902 |
|
| 903 |
echo "<script>".$custom_js."</script>"; |
| 904 |
|
| 905 |
?> |
| 906 |
|
| 907 |
<?php |
| 908 |
} |
| 909 |
|
| 910 |
function wmvc_upload_file($field_name, $file_id) |
| 911 |
{ |
| 912 |
static $media_element_counter = 0; |
| 913 |
|
| 914 |
$media_element_counter++; |
| 915 |
|
| 916 |
$img_field = $field_name.'_'.$media_element_counter; |
| 917 |
|
| 918 |
wp_enqueue_script( 'wpmediaelement' ); |
| 919 |
wp_enqueue_media(); |
| 920 |
|
| 921 |
?> |
| 922 |
<div id="<?php echo esc_attr($field_name); ?>meta-box-id" class="postbox-upload"> |
| 923 |
<?php |
| 924 |
// Get WordPress' media upload URL |
| 925 |
$upload_link = '#'; |
| 926 |
|
| 927 |
// Get the file src |
| 928 |
|
| 929 |
// Get the file src |
| 930 |
$your_file_src = get_attached_file(intval( $file_id)); |
| 931 |
|
| 932 |
// For convenience, see if the array is valid |
| 933 |
$you_have_file = false; |
| 934 |
if($your_file_src) |
| 935 |
$you_have_file = basename($your_file_src); |
| 936 |
|
| 937 |
?> |
| 938 |
|
| 939 |
<!-- Your file container, which can be manipulated with js --> |
| 940 |
<div class="custom-img-container"> |
| 941 |
<?php if ( $you_have_file ) : ?> |
| 942 |
<?php echo esc_html($you_have_file); ?> |
| 943 |
<?php endif; ?> |
| 944 |
</div> |
| 945 |
|
| 946 |
<?php //if(sw_user_in_role('administrator')): ?> |
| 947 |
<!-- Your add & remove file links --> |
| 948 |
<p class="hide-if-no-js"> |
| 949 |
<a class="upload-custom-img <?php if ( $you_have_file ) { echo 'hidden'; } ?>" |
| 950 |
href="<?php echo esc_url($upload_link) ?>"> |
| 951 |
<?php echo esc_html__('Select file','wmvc_win') ?> |
| 952 |
</a> |
| 953 |
<a class="delete-custom-img <?php if ( ! $you_have_file ) { echo 'hidden'; } ?>" |
| 954 |
href="#"> |
| 955 |
<?php echo esc_html__('Remove file','wmvc_win') ?> |
| 956 |
</a> |
| 957 |
</p> |
| 958 |
<?php //endif; ?> |
| 959 |
|
| 960 |
<!-- A hidden input to set and post the chosen file id --> |
| 961 |
<input class="file_id" type="hidden" id="<?php echo esc_html($field_name); ?>" name="<?php echo esc_html($field_name); ?>" value="<?php echo esc_html($file_id); ?>" /> |
| 962 |
</div> |
| 963 |
|
| 964 |
<?php |
| 965 |
$custom_js =''; |
| 966 |
$custom_js .=" jQuery(function($) { |
| 967 |
if( typeof jQuery.fn.wpMediaElement == 'function') |
| 968 |
$('#".esc_js($field_name)."meta-box-id.postbox-upload').wpMediaElement({'imgIdInputSelector':'.file_id','isfileUpload':'true'}); |
| 969 |
});"; |
| 970 |
|
| 971 |
echo "<script>".$custom_js."</script>"; |
| 972 |
|
| 973 |
?> |
| 974 |
|
| 975 |
<?php |
| 976 |
} |
| 977 |
|
| 978 |
function wmvc_upload_multiple($field_name, $image_ids='') |
| 979 |
{ |
| 980 |
static $media_element_counter = 0; |
| 981 |
|
| 982 |
$media_element_counter++; |
| 983 |
|
| 984 |
$img_field = $field_name.'_'.$media_element_counter; |
| 985 |
|
| 986 |
wp_enqueue_script( 'wpmediamultiple' ); |
| 987 |
wp_enqueue_script( 'jquery-ui-mouse' ); |
| 988 |
wp_enqueue_media(); |
| 989 |
|
| 990 |
?> |
| 991 |
<div id="<?php echo esc_attr($field_name); ?>meta-box-id" class="postbox-upload-multiple"> |
| 992 |
<?php |
| 993 |
// Get WordPress' media upload URL |
| 994 |
$upload_link = '#'; |
| 995 |
|
| 996 |
|
| 997 |
// Get the image src |
| 998 |
|
| 999 |
$your_img_src = array(); |
| 1000 |
|
| 1001 |
foreach(explode(',', $image_ids) as $image_id) |
| 1002 |
{ |
| 1003 |
if(is_numeric($image_id)){ |
| 1004 |
if(false) |
| 1005 |
$your_img_src[$image_id] = wp_get_attachment_image_src( $image_id, 'full' ); |
| 1006 |
|
| 1007 |
$your_img_src[$image_id] = wp_get_attachment_url( $image_id, 'full' ); |
| 1008 |
} |
| 1009 |
} |
| 1010 |
|
| 1011 |
|
| 1012 |
// For convenience, see if the array is valid |
| 1013 |
$you_have_img = count($your_img_src) > 0; |
| 1014 |
?> |
| 1015 |
|
| 1016 |
<!-- Your image container, which can be manipulated with js --> |
| 1017 |
<div class="custom-img-container winter_mvc-media"> |
| 1018 |
<?php if($you_have_img)foreach($your_img_src as $image_id => $img_src) : ?> |
| 1019 |
<?php |
| 1020 |
|
| 1021 |
$filetype = wp_check_filetype(str_replace(WP_CONTENT_URL, WP_CONTENT_DIR, $img_src)); |
| 1022 |
if(strpos($filetype['type'], 'video') !== FALSE):?> |
| 1023 |
<div class="winter_mvc-media-card" data-media-id="<?php echo esc_attr($image_id);?>"> |
| 1024 |
<video src="<?php echo esc_html($img_src); ?>" controls alt="<?php echo esc_attr__('thumb', 'wmvc_win');?>" style="max-width:100%;" class="thumbnail"></video> |
| 1025 |
<a href="#" class="remove"></a> |
| 1026 |
<span href="#" class="move"><span class="dashicons dashicons-editor-expand"></span></span> |
| 1027 |
</div> |
| 1028 |
<?php else:?> |
| 1029 |
<div class="winter_mvc-media-card" data-media-id="<?php echo esc_attr($image_id);?>"> |
| 1030 |
<img src="<?php echo esc_html($img_src); ?>" alt="<?php echo esc_attr__('thumb', 'wmvc_win');?>" style="max-width:100%;" class="thumbnail"/> |
| 1031 |
<a href="#" class="remove"></a> |
| 1032 |
</div> |
| 1033 |
<?php endif;?> |
| 1034 |
|
| 1035 |
|
| 1036 |
<?php endforeach; ?> |
| 1037 |
</div> |
| 1038 |
<br style="clear:both;" /> |
| 1039 |
|
| 1040 |
<?php //if(sw_user_in_role('administrator')): ?> |
| 1041 |
<!-- Your add & remove image links --> |
| 1042 |
<p class="hide-if-no-js"> |
| 1043 |
<a class="button button-primary upload-custom-img <?php if ( $you_have_img ) { echo ''; } ?>" |
| 1044 |
href="<?php echo esc_url($upload_link) ?>"> |
| 1045 |
<?php echo esc_html__('Add images','wmvc_win') ?> |
| 1046 |
</a> |
| 1047 |
<a class="button button-secondary delete-custom-img <?php if ( ! $you_have_img ) { echo 'hidden'; } ?>" |
| 1048 |
href="#"> |
| 1049 |
<?php echo esc_html__('Remove images','wmvc_win') ?> |
| 1050 |
</a> |
| 1051 |
</p> |
| 1052 |
<?php //endif; ?> |
| 1053 |
|
| 1054 |
<!-- A hidden input to set and post the chosen image id --> |
| 1055 |
<input class="logo_image_id" type="hidden" id="<?php echo esc_html(esc_html($field_name)); ?>" name="<?php echo esc_html($field_name); ?>" value="<?php echo esc_html($image_ids); ?>" /> |
| 1056 |
</div> |
| 1057 |
<?php |
| 1058 |
$custom_js =''; |
| 1059 |
$custom_js .=" jQuery(function($) { |
| 1060 |
if( typeof jQuery.fn.wpMediaMultiple == 'function') |
| 1061 |
$('#".esc_js($field_name)."meta-box-id.postbox-upload-multiple').wpMediaMultiple(); |
| 1062 |
/* order */ |
| 1063 |
var re_order = function(media_element){ |
| 1064 |
var list_media = ''; |
| 1065 |
media_element.find('.winter_mvc-media-card').each(function(){ |
| 1066 |
if(list_media !='') |
| 1067 |
list_media +=','; |
| 1068 |
|
| 1069 |
list_media += $(this).attr('data-media-id'); |
| 1070 |
}) |
| 1071 |
media_element.closest('.postbox-upload-multiple').find('.logo_image_id').val(list_media); |
| 1072 |
} |
| 1073 |
/* Sort table */ |
| 1074 |
$( '.winter_mvc-media' ).sortable({ |
| 1075 |
update: function(event, ui) { |
| 1076 |
re_order($(this)); |
| 1077 |
} |
| 1078 |
}); |
| 1079 |
/* remove media */ |
| 1080 |
$( '.winter_mvc-media' ).find('.winter_mvc-media-card .remove').on('click', function(e){ |
| 1081 |
e.preventDefault(); |
| 1082 |
var media = $(this).closest('.winter_mvc-media') |
| 1083 |
$(this).closest('.winter_mvc-media-card').remove(); |
| 1084 |
re_order(media) |
| 1085 |
}) |
| 1086 |
}); |
| 1087 |
"; |
| 1088 |
|
| 1089 |
echo "<script>".$custom_js."</script>"; |
| 1090 |
|
| 1091 |
?> |
| 1092 |
|
| 1093 |
<?php |
| 1094 |
} |
| 1095 |
|
| 1096 |
function wmvc_select_radio($field_name, $options = array(), $selected = NULL) |
| 1097 |
{ |
| 1098 |
$output = ''; //'<div class="radio"> <select name="'.$field_name.'" '.$extra.' >'; |
| 1099 |
|
| 1100 |
if(is_array($options) && count($options) > 0) |
| 1101 |
foreach($options as $key=>$val) |
| 1102 |
{ |
| 1103 |
$output.= '<div class="radio">'; |
| 1104 |
$output.= '<label>'; |
| 1105 |
$output.= '<input type="radio" name="'.esc_attr($field_name).'" id="optionsRadios1_format" value="'.esc_attr($key).'" '.($selected==$key?'checked':'').' />'; |
| 1106 |
$output.= esc_html($val); |
| 1107 |
$output.= '</label>'; |
| 1108 |
$output.= '</div>'; |
| 1109 |
} |
| 1110 |
|
| 1111 |
return $output; |
| 1112 |
} |
| 1113 |
|
| 1114 |
|
| 1115 |
function wmvc_form_messages() |
| 1116 |
{ |
| 1117 |
echo 'ok'; |
| 1118 |
} |
| 1119 |
|
| 1120 |
function wmvc_xss_clean($data) |
| 1121 |
{ |
| 1122 |
//if($data == '0000-00-00 00:00:00')return ''; |
| 1123 |
if(is_array($data)) |
| 1124 |
return wmvc_xss_clean_array($data); |
| 1125 |
|
| 1126 |
if(is_object($data)) |
| 1127 |
return wmvc_xss_clean_object($data); |
| 1128 |
|
| 1129 |
if($data === NULL) |
| 1130 |
return ''; |
| 1131 |
|
| 1132 |
// Fix &entity\n; |
| 1133 |
$data = str_replace(array('&','<','>'), array('&amp;','&lt;','&gt;'), $data); |
| 1134 |
$data = preg_replace('/(&#*\w+)[\x00-\x20]+;/u', '$1;', $data); |
| 1135 |
$data = preg_replace('/(&#x*[0-9A-F]+);*/iu', '$1;', $data); |
| 1136 |
$data = html_entity_decode($data, ENT_COMPAT, 'UTF-8'); |
| 1137 |
|
| 1138 |
// Remove any attribute starting with "on" or xmlns |
| 1139 |
$data = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $data); |
| 1140 |
|
| 1141 |
// Remove javascript: and vbscript: protocols |
| 1142 |
$data = preg_replace('#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([`\'"]*)[\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2nojavascript...', $data); |
| 1143 |
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iu', '$1=$2novbscript...', $data); |
| 1144 |
$data = preg_replace('#([a-z]*)[\x00-\x20]*=([\'"]*)[\x00-\x20]*-moz-binding[\x00-\x20]*:#u', '$1=$2nomozbinding...', $data); |
| 1145 |
|
| 1146 |
// Only works in IE: <span style="width: expression(alert('Ping!'));"></span> |
| 1147 |
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?expression[\x00-\x20]*\([^>]*+>#i', '$1>', $data); |
| 1148 |
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?behaviour[\x00-\x20]*\([^>]*+>#i', '$1>', $data); |
| 1149 |
$data = preg_replace('#(<[^>]+?)style[\x00-\x20]*=[\x00-\x20]*[`\'"]*.*?s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*+>#iu', '$1>', $data); |
| 1150 |
|
| 1151 |
// Remove namespaced elements (we do not need them) |
| 1152 |
$data = preg_replace('#</*\w+:\w[^>]*+>#i', '', $data); |
| 1153 |
|
| 1154 |
do |
| 1155 |
{ |
| 1156 |
// Remove really unwanted tags |
| 1157 |
$old_data = $data; |
| 1158 |
$data = preg_replace('#</*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|i(?:framXe|layer)|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|title|xml)[^>]*+>#i', '', $data); |
| 1159 |
} |
| 1160 |
while ($old_data !== $data); |
| 1161 |
|
| 1162 |
//$data = sanitize_textarea_field($data); |
| 1163 |
|
| 1164 |
// we are done... |
| 1165 |
return $data; |
| 1166 |
} |
| 1167 |
|
| 1168 |
function wmvc_xss_clean_array($array) |
| 1169 |
{ |
| 1170 |
if(!is_array($array))return array(); |
| 1171 |
|
| 1172 |
$arr_cleaned = array(); |
| 1173 |
foreach($array as $key=>$val) |
| 1174 |
{ |
| 1175 |
if($key == 'newcontent') |
| 1176 |
{ |
| 1177 |
$arr_cleaned[wmvc_xss_clean($key)] = $val; |
| 1178 |
} |
| 1179 |
else |
| 1180 |
{ |
| 1181 |
$arr_cleaned[wmvc_xss_clean($key)] = wmvc_xss_clean($val); |
| 1182 |
} |
| 1183 |
|
| 1184 |
} |
| 1185 |
|
| 1186 |
//dump($arr_cleaned); |
| 1187 |
|
| 1188 |
return $arr_cleaned; |
| 1189 |
} |
| 1190 |
|
| 1191 |
function wmvc_xss_clean_object($object) |
| 1192 |
{ |
| 1193 |
if(!is_object($object))return NULL; |
| 1194 |
|
| 1195 |
$array = get_object_vars($object); |
| 1196 |
foreach($array as $key=>$val) |
| 1197 |
{ |
| 1198 |
$object->{$key} = wmvc_xss_clean($object->{$key}); |
| 1199 |
} |
| 1200 |
|
| 1201 |
return $object; |
| 1202 |
} |
| 1203 |
|
| 1204 |
function wmvc_roles_array() { |
| 1205 |
$editable_roles = get_editable_roles(); |
| 1206 |
foreach ($editable_roles as $role => $details) { |
| 1207 |
$sub['role'] = esc_attr($role); |
| 1208 |
$sub['name'] = translate_user_role($details['name']); |
| 1209 |
$roles[] = $sub; |
| 1210 |
} |
| 1211 |
return $roles; |
| 1212 |
} |
| 1213 |
|
| 1214 |
function wmvc_seconds_to_hms($seconds, $show_days=true) { |
| 1215 |
$t = round($seconds); |
| 1216 |
$days = floor($t/86400); |
| 1217 |
$day_sec = $days*86400; |
| 1218 |
$hours = floor( ($t-$day_sec) / (60 * 60) ); |
| 1219 |
$hour_sec = $hours*3600; |
| 1220 |
$minutes = floor((($t-$day_sec)-$hour_sec)/60); |
| 1221 |
$min_sec = $minutes*60; |
| 1222 |
$sec = (($t-$day_sec)-$hour_sec)-$min_sec; |
| 1223 |
|
| 1224 |
if($show_days) |
| 1225 |
{ |
| 1226 |
return sprintf('%02d:%02d:%02d:%02d', $days, $hours, $minutes, $sec); |
| 1227 |
} |
| 1228 |
|
| 1229 |
// to show only hours, no days |
| 1230 |
$hours = floor( ($t) / (60 * 60) ); |
| 1231 |
return sprintf('%02d:%02d:%02d', $hours, $minutes, $sec); |
| 1232 |
} |
| 1233 |
|
| 1234 |
function wmvc_xml_encode($array) |
| 1235 |
{ |
| 1236 |
|
| 1237 |
if (is_null($DOMDocument)) { |
| 1238 |
$DOMDocument =new DOMDocument; |
| 1239 |
$DOMDocument->formatOutput = true; |
| 1240 |
wmvc_xml_encode($mixed, $DOMDocument, $DOMDocument); |
| 1241 |
echo $DOMDocument->saveXML(); |
| 1242 |
} |
| 1243 |
else { |
| 1244 |
// To cope with embedded objects |
| 1245 |
if (is_object($mixed)) { |
| 1246 |
$mixed = get_object_vars($mixed); |
| 1247 |
} |
| 1248 |
if (is_array($mixed)) { |
| 1249 |
foreach ($mixed as $index => $mixedElement) { |
| 1250 |
if (is_int($index)) { |
| 1251 |
if ($index === 0) { |
| 1252 |
$node = $domElement; |
| 1253 |
} |
| 1254 |
else { |
| 1255 |
$node = $DOMDocument->createElement($domElement->tagName); |
| 1256 |
$domElement->parentNode->appendChild($node); |
| 1257 |
} |
| 1258 |
} |
| 1259 |
else { |
| 1260 |
$plural = $DOMDocument->createElement($index); |
| 1261 |
$domElement->appendChild($plural); |
| 1262 |
$node = $plural; |
| 1263 |
if (!(rtrim($index, 's') === $index)) { |
| 1264 |
$singular = $DOMDocument->createElement(rtrim($index, 's')); |
| 1265 |
$plural->appendChild($singular); |
| 1266 |
$node = $singular; |
| 1267 |
} |
| 1268 |
} |
| 1269 |
|
| 1270 |
wmvc_xml_encode($mixedElement, $node, $DOMDocument); |
| 1271 |
} |
| 1272 |
} |
| 1273 |
else { |
| 1274 |
$mixed = is_bool($mixed) ? ($mixed ? 'true' : 'false') : $mixed; |
| 1275 |
$domElement->appendChild($DOMDocument->createTextNode($mixed)); |
| 1276 |
} |
| 1277 |
} |
| 1278 |
} |
| 1279 |
|
| 1280 |
function wmvc_add_wp_image($filename_source, $parent_post_id = 0) |
| 1281 |
{ |
| 1282 |
$file = $filename_source; |
| 1283 |
$filename = basename($file); |
| 1284 |
|
| 1285 |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); |
| 1286 |
if (!$upload_file['error']) { |
| 1287 |
$wp_filetype = wp_check_filetype($filename, null ); |
| 1288 |
$attachment = array( |
| 1289 |
'post_mime_type' => $wp_filetype['type'], |
| 1290 |
'post_parent' => $parent_post_id, |
| 1291 |
'post_title' => preg_replace('/\.[^.]+$/', '', $filename), |
| 1292 |
'post_content' => '', |
| 1293 |
'post_status' => 'inherit' |
| 1294 |
); |
| 1295 |
$attachment_id = wp_insert_attachment( $attachment, $upload_file['file'], $parent_post_id ); |
| 1296 |
if (!is_wp_error($attachment_id)) { |
| 1297 |
require_once(ABSPATH . "wp-admin" . '/includes/image.php'); |
| 1298 |
$attachment_data = wp_generate_attachment_metadata( $attachment_id, $upload_file['file'] ); |
| 1299 |
wp_update_attachment_metadata( $attachment_id, $attachment_data ); |
| 1300 |
|
| 1301 |
return $attachment_id; |
| 1302 |
} |
| 1303 |
} |
| 1304 |
|
| 1305 |
return NULL; |
| 1306 |
} |
| 1307 |
|
| 1308 |
function wmvc_wp_paginate($total_items, $per_page = 10, $page_var = 'paged', $texts = array()) |
| 1309 |
{ |
| 1310 |
$current_page = 1; |
| 1311 |
|
| 1312 |
if(isset($_GET[$page_var])) |
| 1313 |
$current_page = intval(wmvc_xss_clean($_GET[$page_var])); |
| 1314 |
|
| 1315 |
if(!isset($texts['previous_page']))$texts['previous_page'] = 'Previous page'; |
| 1316 |
if(!isset($texts['next_page']))$texts['next_page'] = 'Next page'; |
| 1317 |
if(!isset($texts['first_page']))$texts['first_page'] = 'First page'; |
| 1318 |
if(!isset($texts['last_page']))$texts['last_page'] = 'Last page'; |
| 1319 |
if(!isset($texts['items']))$texts['items'] = 'items'; |
| 1320 |
|
| 1321 |
if(empty($current_page))$current_page = 1; |
| 1322 |
|
| 1323 |
// get url |
| 1324 |
$url = strtok($_SERVER["REQUEST_URI"], '?'); |
| 1325 |
$qs_parameters = wmvc_xss_clean( $_GET ); |
| 1326 |
unset($qs_parameters[$page_var]); |
| 1327 |
|
| 1328 |
$qs_part = http_build_query($qs_parameters); |
| 1329 |
$url.='?'.$qs_part; |
| 1330 |
|
| 1331 |
// total pages |
| 1332 |
$total_pages = intval($total_items/$per_page+0.99); |
| 1333 |
$output = ''; |
| 1334 |
|
| 1335 |
$output.= '<div class="tablenav-pages"><span class="displaying-num">'.esc_html($total_items).' '.esc_html($texts['items']).'</span>'; |
| 1336 |
$output.= '<span class="pagination-links">'; |
| 1337 |
|
| 1338 |
if($current_page != 1) |
| 1339 |
$output.= '<a class="first-page button" href="'.esc_url($url).'"><span class="screen-reader-text">'.esc_html($texts['first_page']).'</span><span aria-hidden="true">«</span></a>'; |
| 1340 |
|
| 1341 |
if($current_page-1 > 0) |
| 1342 |
{ |
| 1343 |
$output.= '<a class="prev-page button" href="'.esc_url($url).'&'.esc_attr($page_var).'='.esc_attr(($current_page-1)).'"><span class="screen-reader-text">'.esc_html($texts['previous_page']).'</span><span aria-hidden="true">‹</span></a>'; |
| 1344 |
} |
| 1345 |
else |
| 1346 |
{ |
| 1347 |
$output.= '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span>'; |
| 1348 |
} |
| 1349 |
|
| 1350 |
$output.= '<span class="screen-reader-text">Current Page</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">'.esc_html($current_page).' of <span class="total-pages">'.esc_html(($total_pages) ? $total_pages : 1).'</span></span></span>'; |
| 1351 |
|
| 1352 |
if($current_page+1 <= $total_pages) |
| 1353 |
{ |
| 1354 |
$output.= '<a class="next-page button" href="'.esc_url($url).'&'.esc_attr($page_var).'='.esc_attr(($current_page+1)).'"><span class="screen-reader-text">'.esc_html($texts['next_page']).'</span><span aria-hidden="true">›</span></a>'; |
| 1355 |
|
| 1356 |
} |
| 1357 |
else |
| 1358 |
{ |
| 1359 |
$output.= '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span>'; |
| 1360 |
} |
| 1361 |
|
| 1362 |
if($current_page != $total_pages) |
| 1363 |
$output.= '<a class="last-page button" href="'.esc_url($url).'&'.esc_attr($page_var).'='.esc_attr($total_pages).'"><span class="screen-reader-text">'.esc_html($texts['last_page']).'</span><span aria-hidden="true">»</span></a>'; |
| 1364 |
|
| 1365 |
$output.= '</span></div>'; |
| 1366 |
|
| 1367 |
return $output; |
| 1368 |
} |
| 1369 |
|
| 1370 |
function wmvc_download_file($url, $save_file_loc, $data = array()) |
| 1371 |
{ |
| 1372 |
// Initialize the cURL session |
| 1373 |
$ch = curl_init($url); |
| 1374 |
|
| 1375 |
// Use basename() function to return |
| 1376 |
// the base name of file |
| 1377 |
$file_name = basename($url); |
| 1378 |
|
| 1379 |
if(!file_exists(dirname($save_file_loc))) |
| 1380 |
mkdir(dirname($save_file_loc)); |
| 1381 |
|
| 1382 |
// Open file |
| 1383 |
$fp = fopen($save_file_loc, 'wb'); |
| 1384 |
|
| 1385 |
// It set an option for a cURL transfer |
| 1386 |
curl_setopt($ch, CURLOPT_FILE, $fp); |
| 1387 |
curl_setopt($ch, CURLOPT_HEADER, 0); |
| 1388 |
|
| 1389 |
curl_setopt($ch, CURLOPT_POST, 1); |
| 1390 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
| 1391 |
|
| 1392 |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( |
| 1393 |
'Content-Type: multipart/form-data', |
| 1394 |
)); |
| 1395 |
|
| 1396 |
//Disable CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER by |
| 1397 |
//setting them to false. |
| 1398 |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
| 1399 |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
| 1400 |
|
| 1401 |
// Perform a cURL session |
| 1402 |
$result = curl_exec($ch); |
| 1403 |
|
| 1404 |
if(curl_errno($ch)) |
| 1405 |
{ |
| 1406 |
//exit(curl_error($ch)); |
| 1407 |
} |
| 1408 |
|
| 1409 |
// Closes a cURL session and frees all resources |
| 1410 |
curl_close($ch); |
| 1411 |
|
| 1412 |
// Close file |
| 1413 |
fclose($fp); |
| 1414 |
|
| 1415 |
return $result; |
| 1416 |
} |
| 1417 |
|
| 1418 |
function wmvc_api_call($method, $url, $data, $headers = false){ |
| 1419 |
$curl = curl_init(); |
| 1420 |
|
| 1421 |
//$data = 'email=test'; |
| 1422 |
|
| 1423 |
switch ($method){ |
| 1424 |
case "POST": |
| 1425 |
curl_setopt($curl, CURLOPT_POST, 1); |
| 1426 |
if ($data) |
| 1427 |
{ |
| 1428 |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); |
| 1429 |
|
| 1430 |
if($headers === FALSE) |
| 1431 |
$headers = array('Content-Type: multipart/form-data'); |
| 1432 |
} |
| 1433 |
|
| 1434 |
break; |
| 1435 |
case "PUT": |
| 1436 |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); |
| 1437 |
if ($data) |
| 1438 |
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); |
| 1439 |
break; |
| 1440 |
default: |
| 1441 |
if ($data) |
| 1442 |
$url = sprintf("%s?%s", $url, http_build_query($data)); |
| 1443 |
} |
| 1444 |
// OPTIONS: |
| 1445 |
curl_setopt($curl, CURLOPT_URL, $url); |
| 1446 |
if(!$headers){ |
| 1447 |
curl_setopt($curl, CURLOPT_HTTPHEADER, array( |
| 1448 |
'Content-Type: application/json', |
| 1449 |
)); |
| 1450 |
}else{ |
| 1451 |
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
| 1452 |
} |
| 1453 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
| 1454 |
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); |
| 1455 |
|
| 1456 |
//Disable CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER by |
| 1457 |
//setting them to false. |
| 1458 |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); |
| 1459 |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); |
| 1460 |
|
| 1461 |
// EXECUTE: |
| 1462 |
$result = curl_exec($curl); |
| 1463 |
if(!$result){return FALSE;} |
| 1464 |
curl_close($curl); |
| 1465 |
return $result; |
| 1466 |
} |
| 1467 |
|
| 1468 |
function wmvc_current_edit_url() |
| 1469 |
{ |
| 1470 |
$query_string_array = wmvc_xss_clean( $_GET ); |
| 1471 |
unset($query_string_array['is_updated']); |
| 1472 |
|
| 1473 |
return admin_url("admin.php?".http_build_query($query_string_array)); |
| 1474 |
} |
| 1475 |
|
| 1476 |
function wmvc_stripslashes_deep($value) |
| 1477 |
{ |
| 1478 |
$value = is_array($value) ? |
| 1479 |
array_map('stripslashes_deep', $value) : |
| 1480 |
stripslashes($value); |
| 1481 |
|
| 1482 |
return $value; |
| 1483 |
} |
| 1484 |
|
| 1485 |
function wmvc_get_date($datetime = NULL, $default='timestamp') |
| 1486 |
{ |
| 1487 |
if(is_null($datetime)) |
| 1488 |
{ |
| 1489 |
if($default == 'timestamp') |
| 1490 |
{ |
| 1491 |
$datetime = current_time('timestamp'); |
| 1492 |
} |
| 1493 |
else |
| 1494 |
{ |
| 1495 |
return $default; |
| 1496 |
} |
| 1497 |
} |
| 1498 |
else if(!is_numeric($datetime)) |
| 1499 |
{ |
| 1500 |
$datetime = strtotime($datetime); |
| 1501 |
} |
| 1502 |
|
| 1503 |
$date_format = get_option('date_format'); |
| 1504 |
$time_format = get_option('time_format'); |
| 1505 |
$date = date("{$date_format} {$time_format}", $datetime); |
| 1506 |
return $date; |
| 1507 |
} |
| 1508 |
|
| 1509 |
if ( ! function_exists('wmvc_url_suffix')) |
| 1510 |
{ |
| 1511 |
function wmvc_url_suffix($base_url, $extension_url="") |
| 1512 |
{ |
| 1513 |
if(strpos($base_url,'?') !== FALSE){ |
| 1514 |
$base_url .='&'; |
| 1515 |
} else { |
| 1516 |
$base_url .='?'; |
| 1517 |
} |
| 1518 |
return $base_url.$extension_url; |
| 1519 |
} |
| 1520 |
} |
| 1521 |
|
| 1522 |
|
| 1523 |
if ( ! function_exists('wmvc_filter_decimal')) |
| 1524 |
{ |
| 1525 |
function wmvc_filter_decimal($string = '') |
| 1526 |
{ |
| 1527 |
if(substr($string, -3, 3) == '.00') { |
| 1528 |
return substr($string, 0, -3); |
| 1529 |
} |
| 1530 |
|
| 1531 |
return $string; |
| 1532 |
} |
| 1533 |
} |
| 1534 |
|
| 1535 |
if(!function_exists('wmvc_get_option')) { |
| 1536 |
/** |
| 1537 |
* Cached and get wp options |
| 1538 |
* |
| 1539 |
* @param string option Option key |
| 1540 |
* @return string alt or title |
| 1541 |
*/ |
| 1542 |
|
| 1543 |
function wmvc_get_option($option_key = '') { |
| 1544 |
return get_option($option_key); |
| 1545 |
|
| 1546 |
if(isset($options[$option_key])) { |
| 1547 |
return $options[$option_key]; |
| 1548 |
} |
| 1549 |
|
| 1550 |
$options[$option_key] = get_option($option_key); |
| 1551 |
|
| 1552 |
return $options[$option_key]; |
| 1553 |
} |
| 1554 |
} |
| 1555 |
|
| 1556 |
if ( ! function_exists('wmvc_is_phone')) |
| 1557 |
{ |
| 1558 |
// Validation phone "-+()0123456789" |
| 1559 |
/** |
| 1560 |
* @param string $value phone in string |
| 1561 |
* @return bool |
| 1562 |
*/ |
| 1563 |
|
| 1564 |
|
| 1565 |
function wmvc_is_phone($value = '') { |
| 1566 |
if(preg_match("/^[.+]{0,1}[0-9-)(]{0,25}$/", $value)) { |
| 1567 |
return true; |
| 1568 |
} |
| 1569 |
|
| 1570 |
return false; |
| 1571 |
} |
| 1572 |
} |
| 1573 |
|
| 1574 |
|
| 1575 |
?> |