1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
if ( !class_exists('Wcap_Add_Settings' ) ) {
class Wcap_Add_Settings {
public static function wcap_initialize_plugin_options() {
add_settings_section(
'ac_general_settings_section',
__( 'Settings', 'woocommerce-ac' ),
array('Wcap_Add_Settings', 'wcap_general_options_callback' ),
'woocommerce_ac_page'
);
add_settings_field(
'ac_enable_cart_emails',
__( 'Enable abandoned cart emails', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_enable_cart_emails_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Yes, enable the abandoned cart emails.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_cart_abandoned_time',
__( 'Cart abandoned cut-off time for logged-in users', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_cart_abandoned_time_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'For logged-in users consider cart abandoned after X minutes of item being added to cart & order not placed.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_cart_abandoned_time_guest',
__( 'Cart abandoned cut-off time for guest users', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_cart_abandoned_time_guest_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'For guest users & visitors consider cart abandoned after X minutes of item being added to cart & order not placed.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_delete_abandoned_order_days',
__( 'Automatically Delete Abandoned Orders after X days', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_delete_abandoned_orders_days_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Automatically delete abandoned cart orders after X days.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_email_admin_on_recovery',
__( 'Email admin On Order Recovery', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_email_admin_on_recovery_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Sends email to Admin if an Abandoned Cart Order is recovered.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_disable_guest_cart_email',
__( 'Do not track carts of guest users', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_disable_guest_cart_email_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Abandoned carts of guest users will not be tracked.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_track_guest_cart_from_cart_page',
__( 'Start tracking from Cart Page', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_track_guest_cart_from_cart_page_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Enable tracking of abandoned products & carts even if customer does not visit the checkout page or does not enter any details on the checkout page like Name or Email. Tracking will begin as soon as a visitor adds a product to their cart and visits the cart page.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_disable_logged_in_cart_email',
__( 'Do not track carts of logged-in users', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_disable_logged_in_cart_email_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'Abandoned carts of logged-in users will not be tracked.', 'woocommerce-ac' ) )
);
add_settings_field(
'ac_capture_email_address_from_url',
__( 'Capture Email address from URL', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_capture_email_address_from_url' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( 'If your site URL contain the same key, then it will capture it as an email address of customer.', 'woocommerce-ac' ) )
);
add_settings_field(
'wcap_guest_cart_capture_msg',
__( 'Message to be displayed for Guest users when tracking their carts', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_guest_cart_capture_msg_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( '<br>In compliance with GDPR, add a message on the Checkout page and Email Address Capture pop-up to inform Guest users of how their data is being used.<br><i>For example: Your email address will help us support your shopping experience throughout the site. Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-ac' ) )
);
add_settings_field(
'wcap_logged_cart_capture_msg',
__( 'Message to be displayed for registered users when tracking their carts.', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_logged_cart_capture_msg_callback' ),
'woocommerce_ac_page',
'ac_general_settings_section',
array( __( '<br>In compliance with GDPR, add a message on the Shop & Product pages to inform Registered users of how their data is being used.<br><i>For example: Please check our Privacy Policy to see how we use your personal data.</i>', 'woocommerce-ac' ) )
);
add_settings_section(
'ac_email_settings_section',
__( 'Settings for abandoned cart recovery emails', 'woocommerce-ac' ),
array('Wcap_Add_Settings', 'wcap_email_callback' ),
'woocommerce_ac_cron_page'
);
add_settings_field(
'wcap_from_name',
__( '"From" Name', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_from_name_callback' ),
'woocommerce_ac_cron_page',
'ac_email_settings_section',
array( 'Enter the name that should appear in the email sent.', 'woocommerce-ac' )
);
add_settings_field(
'wcap_from_email',
__( '"From" Address', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_from_email_callback' ),
'woocommerce_ac_cron_page',
'ac_email_settings_section',
array( 'Email address from which the reminder emails should be sent. <strong>Note:</strong> This setting shall be applicable only when PHP mail function is used by your Hosting Provider. If SMTP mail plugins are used or if mail configuration is based on SMTP then this setting wont be applicable.', 'woocommerce-ac' )
);
add_settings_field(
'wcap_reply_email',
__( 'Send Reply Emails to', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_reply_email_callback' ),
'woocommerce_ac_cron_page',
'ac_email_settings_section',
array( 'When a contact receives your email and clicks reply, which email address should that reply be sent to?', 'woocommerce-ac' )
);
add_settings_field(
'wcap_product_image_size',
__( 'Product Image( H x W )', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_product_image_size_callback' ),
'woocommerce_ac_cron_page',
'ac_email_settings_section',
array( 'This setting affects the dimension of the product image in the abandoned cart reminder email.', 'woocommerce-ac' )
);
add_settings_section(
'ac_cron_job_settings_section',
__( 'Setting for sending emails using WP Cron', 'woocommerce-ac' ),
array('Wcap_Add_Settings', 'wcap_cron_job_callback' ),
'woocommerce_ac_cron_page'
);
add_settings_field(
'wcap_use_auto_cron',
__( 'Send Abandoned cart emails automatically using WP Cron', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_use_auto_cron_callback' ),
'woocommerce_ac_cron_page',
'ac_cron_job_settings_section',
array( 'Enabling this setting will send the abandoned cart reminder emails to the customer after the set time. If disabled, abandoned cart reminder emails will not be sent using WP Cron. You will need to set cron job manually from cPanel. If you are unsure how to set the cron job, please <a href= mailto:support@tychesoftwares.com>contact us</a> for it.', 'woocommerce-ac' )
);
add_settings_field(
'wcap_cron_time_duration',
__( 'Run Automated WP Cron after X minutes', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_cron_time_duration_callback' ),
'woocommerce_ac_cron_page',
'ac_cron_job_settings_section',
array( 'The duration in minutes after which a WP Cron job will run automatically for sending the abandoned cart reminder emails to the customers.', 'woocommerce-ac' )
);
add_settings_section(
'ac_general_license_key_section',
__( 'Plugin License Options', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_general_license_key_section_callback' ),
'woocommerce_ac_page'
);
add_settings_field(
'edd_sample_license_key_ac_woo',
__( 'License Key', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_edd_sample_license_key_ac_woo_callback' ),
'woocommerce_ac_page',
'ac_general_license_key_section',
array( __( 'Enter your license key.', 'woocommerce-ac' ) )
);
add_settings_field(
'activate_license_key_ac_woo',
__( 'Activate License', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_activate_license_key_ac_woo_callback' ),
'woocommerce_ac_page',
__( 'ac_general_license_key_section', 'woocommerce-ac' )
);
add_settings_section(
'ac_restrict_settings_section',
__( 'Rules to exclude capturing abandoned carts', 'woocommerce-ac' ),
array('Wcap_Add_Settings', 'wcap_custom_restrict_callback' ),
'woocommerce_ac_restrict_page'
);
add_settings_field(
'wcap_restrict_ip_address',
__( 'Do not capture abandoned carts for these IP addresses', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_restrict_ip_address_callback' ),
'woocommerce_ac_restrict_page',
'ac_restrict_settings_section',
array( 'The carts abandoned from these IP addresses will not be tracked by the plugin. Accepts wildcards, e.g <code>192.168.*</code> will block all IP addresses which starts from "192.168". <i>Separate IP addresses with commas.</i>', 'woocommerce-ac' )
);
add_settings_field(
'wcap_restrict_email_address',
__( 'Do not capture abandoned carts for these email addresses', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_restrict_email_address_callback' ),
'woocommerce_ac_restrict_page',
'ac_restrict_settings_section',
array( 'The carts abandoned using these email addresses will not be tracked by the plugin. <i>Separate email addresses with commas.</i>', 'woocommerce-ac' )
);
add_settings_field(
'wcap_restrict_domain_address',
__( 'Do not capture abandoned carts for email addresses from these domains', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_restrict_domain_address_callback' ),
'woocommerce_ac_restrict_page',
'ac_restrict_settings_section',
array( 'The carts abandoned from email addresses with these domains will not be tracked by the plugin. <i>Separate email address domains with commas.</i>', 'woocommerce-ac' )
);
add_settings_section(
'wcap_sms_settings_section',
__( 'Twilio', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_sms_settings_section_callback' ),
'woocommerce_ac_sms_page'
);
add_settings_field(
'wcap_enable_sms_reminders',
__( 'Enable SMS', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_enable_sms_reminders_callback' ),
'woocommerce_ac_sms_page',
'wcap_sms_settings_section',
array( '<i>Enable the ability to send reminder SMS for abandoned carts.</i>', 'woocommerce-ac' )
);
add_settings_field(
'wcap_sms_from_phone',
__( 'From', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_sms_from_phone_callback' ),
'woocommerce_ac_sms_page',
'wcap_sms_settings_section',
array( '<i>Must be a Twilio phone number (in E.164 format) or alphanumeric sender ID.</i>', 'woocommerce-ac' )
);
add_settings_field(
'wcap_sms_account_sid',
__( 'Account SID', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_sms_account_sid_callback' ),
'woocommerce_ac_sms_page',
'wcap_sms_settings_section',
array( '' )
);
add_settings_field(
'wcap_sms_auth_token',
__( 'Auth Token', 'woocommerce-ac' ),
array( 'Wcap_Add_Settings', 'wcap_sms_auth_token_callback' ),
'woocommerce_ac_sms_page',
'wcap_sms_settings_section',
array( '' )
);
register_setting(
'woocommerce_ac_settings',
'ac_enable_cart_emails'
);
register_setting(
'woocommerce_ac_settings',
'ac_cart_abandoned_time',
array ( 'Wcap_Add_Settings', 'wcap_cart_time_validation' )
);
register_setting(
'woocommerce_ac_settings',
'ac_cart_abandoned_time_guest',
array ( 'Wcap_Add_Settings', 'wcap_cart_time_guest_validation' )
);
register_setting(
'woocommerce_ac_settings',
'ac_delete_abandoned_order_days',
array ( 'Wcap_Add_Settings', 'wcap_delete_days_validation' )
);
register_setting(
'woocommerce_ac_settings',
'ac_email_admin_on_recovery'
);
register_setting(
'woocommerce_ac_settings',
'ac_email_admin_on_abandoned'
);
register_setting(
'woocommerce_ac_settings',
'ac_disable_guest_cart_email'
);
register_setting(
'woocommerce_ac_settings',
'ac_disable_logged_in_cart_email'
);
register_setting(
'woocommerce_ac_settings',
'ac_capture_email_address_from_url'
);
register_setting(
'woocommerce_ac_settings',
'wcap_guest_cart_capture_msg'
);
register_setting(
'woocommerce_ac_settings',
'wcap_logged_cart_capture_msg'
);
register_setting(
'woocommerce_ac_settings',
'ac_track_guest_cart_from_cart_page'
);
register_setting(
'woocommerce_ac_settings',
'edd_sample_license_key_ac_woo'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_cron_time_duration'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_use_auto_cron'
);
register_setting(
'woocommerce_ac_restrict_settings',
'wcap_restrict_ip_address'
);
register_setting(
'woocommerce_ac_restrict_settings',
'wcap_restrict_email_address'
);
register_setting(
'woocommerce_ac_restrict_settings',
'wcap_restrict_domain_address'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_from_name'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_from_email'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_reply_email'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_product_image_height'
);
register_setting(
'woocommerce_ac_cron_settings',
'wcap_product_image_width'
);
register_setting(
'woocommerce_sms_settings',
'wcap_enable_sms_reminders'
);
register_setting(
'woocommerce_sms_settings',
'wcap_sms_from_phone'
);
register_setting(
'woocommerce_sms_settings',
'wcap_sms_account_sid'
);
register_setting(
'woocommerce_sms_settings',
'wcap_sms_auth_token'
);
do_action( "wcap_add_new_settings" );
}
public static function wcap_cart_time_validation( $input ) {
$output = '';
if ( $input != '' && ( is_numeric( $input) && $input > 0 ) ) {
$output = stripslashes( $input) ;
} else {
add_settings_error( 'ac_cart_abandoned_time', 'error found', __( 'Abandoned cart cut off time should be numeric and has to be greater than 0.', 'woocommerce-ac' ) );
}
return $output;
}
public static function wcap_cart_time_guest_validation( $input ) {
$output = '';
if ( $input != '' && ( is_numeric( $input) && $input > 0 ) ) {
$output = stripslashes( $input) ;
} else {
add_settings_error( 'ac_cart_abandoned_time_guest', 'error found', __( 'Abandoned cart cut off time should be numeric and has to be greater than 0.', 'woocommerce-ac' ) );
}
return $output;
}
public static function wcap_delete_days_validation( $input ) {
$output = '';
if ( $input == '' || ( is_numeric( $input ) && $input > 0 ) ) {
$output = stripslashes( $input ) ;
} else {
add_settings_error( 'ac_delete_abandoned_order_days', 'error found', __( 'Automatically Delete Abandoned Orders after X days has to be greater than 0.', 'woocommerce-ac' ) );
}
return $output;
}
public static function wcap_general_options_callback() {
}
public static function wcap_enable_cart_emails_callback( $args ) {
$enable_cart_emails = get_option( 'ac_enable_cart_emails' );
if (isset( $enable_cart_emails ) && $enable_cart_emails == "" ) {
$enable_cart_emails = 'off';
}
$html = '<input type="checkbox" id="ac_enable_cart_emails" name="ac_enable_cart_emails" value="on" ' . checked( 'on', $enable_cart_emails, false ) . '/>';
$html .= '<label for="ac_enable_cart_emails"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_cart_abandoned_time_callback($args) {
$cart_abandoned_time = get_option( 'ac_cart_abandoned_time' );
printf(
'<input type="text" id="ac_cart_abandoned_time" name="ac_cart_abandoned_time" value="%s" />',
isset( $cart_abandoned_time ) ? esc_attr( $cart_abandoned_time ) : ''
);
$html = '<label for="ac_cart_abandoned_time"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_cart_abandoned_time_guest_callback($args) {
$cart_abandoned_time_guest = get_option( 'ac_cart_abandoned_time_guest' );
printf(
'<input type="text" id="ac_cart_abandoned_time_guest" name="ac_cart_abandoned_time_guest" value="%s" />',
isset( $cart_abandoned_time_guest ) ? esc_attr( $cart_abandoned_time_guest ) : ''
);
$html = '<label for="ac_cart_abandoned_time_guest"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_delete_abandoned_orders_days_callback( $args ) {
$delete_abandoned_order_days = get_option( 'ac_delete_abandoned_order_days' );
printf(
'<input type="text" id="ac_delete_abandoned_order_days" name="ac_delete_abandoned_order_days" value="%s" />',
isset( $delete_abandoned_order_days ) ? esc_attr( $delete_abandoned_order_days ) : ''
);
$html = '<label for="ac_delete_abandoned_order_days"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_email_admin_on_recovery_callback( $args ) {
$email_admin_on_recovery = get_option( 'ac_email_admin_on_recovery' );
if ( isset( $email_admin_on_recovery ) && $email_admin_on_recovery == '' ) {
$email_admin_on_recovery = 'off';
}
$html='';
printf(
'<input type="checkbox" id="ac_email_admin_on_recovery" name="ac_email_admin_on_recovery" value="on"
' . checked( 'on', $email_admin_on_recovery, false ) . ' />'
);
$html .= '<label for="ac_email_admin_on_recovery"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_disable_guest_cart_email_callback( $args ) {
$disable_guest_cart_email = get_option( 'ac_disable_guest_cart_email' );
if ( isset( $disable_guest_cart_email ) && $disable_guest_cart_email == '' ) {
$disable_guest_cart_email = 'off';
}
$html='';
printf(
'<input type="checkbox" id="ac_disable_guest_cart_email" name="ac_disable_guest_cart_email" value="on"
'.checked( 'on', $disable_guest_cart_email, false ) . ' />'
);
$html .= '<label for="ac_disable_guest_cart_email"> ' . $args[0] . '</label> <br> <div id ="wcap_atc_disable_msg" class="wcap_atc_disable_msg"></div>';
echo $html;
}
public static function wcap_disable_logged_in_cart_email_callback( $args ) {
$disable_logged_in_cart_email = get_option( 'ac_disable_logged_in_cart_email' );
if ( isset( $disable_logged_in_cart_email ) && $disable_logged_in_cart_email == '' ) {
$disable_logged_in_cart_email = 'off';
}
$html='';
printf(
'<input type="checkbox" id="ac_disable_logged_in_cart_email" name="ac_disable_logged_in_cart_email" value="on"
'.checked( 'on', $disable_logged_in_cart_email, false ) . ' />'
);
$html .= '<label for="ac_disable_logged_in_cart_email"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_capture_email_address_from_url( $args ) {
$ac_capture_email_address_from_url = get_option( 'ac_capture_email_address_from_url' );
printf(
'<input type="text" id="ac_capture_email_address_from_url" name="ac_capture_email_address_from_url" value="%s" />',
isset( $ac_capture_email_address_from_url ) ? esc_attr( $ac_capture_email_address_from_url ) : ''
);
$html = '<label for="ac_capture_email_address_from_url_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_guest_cart_capture_msg_callback( $args ) {
$guest_msg = get_option( 'wcap_guest_cart_capture_msg' );
$html = "<textarea rows='4' cols='80' id='wcap_guest_cart_capture_msg' name='wcap_guest_cart_capture_msg'>$guest_msg</textarea>";
$html .= '<label for="wcap_guest_cart_capture_msg"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_logged_cart_capture_msg_callback( $args) {
$logged_msg = get_option( 'wcap_logged_cart_capture_msg' );
$html = "<input type='text' class='regular-text' id='wcap_logged_cart_capture_msg' name='wcap_logged_cart_capture_msg' value='$logged_msg' />";
$html .= '<label for="wcap_logged_cart_capture_msg"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_track_guest_cart_from_cart_page_callback( $args ) {
$disable_guest_cart_from_cart_page = get_option( 'ac_track_guest_cart_from_cart_page' );
$disable_guest_cart_email = get_option( 'ac_disable_guest_cart_email' );
if ( isset( $disable_guest_cart_from_cart_page ) && $disable_guest_cart_from_cart_page == '' ) {
$disable_guest_cart_from_cart_page = 'off';
}
$html = '';
$disabled = '';
if ( isset( $disable_guest_cart_email ) && $disable_guest_cart_email == 'on' ) {
$disabled = 'disabled';
$disable_guest_cart_from_cart_page = 'off';
}
printf(
'<input type="checkbox" id="ac_track_guest_cart_from_cart_page" name="ac_track_guest_cart_from_cart_page" value="on"
'.checked( 'on', $disable_guest_cart_from_cart_page, false ) . '
'.$disabled.' />' );
$html .= '<label for="ac_track_guest_cart_from_cart_page"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_email_callback () {
}
public static function wcap_from_name_callback( $args ) {
$wcap_from_name = get_option( 'wcap_from_name' );
printf(
'<input type="text" id="wcap_from_name" name="wcap_from_name" value="%s" />',
isset( $wcap_from_name ) ? esc_attr( $wcap_from_name ) : ''
);
$html = '<label for="wcap_from_name_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_from_email_callback( $args ) {
$wcap_from_email = get_option( 'wcap_from_email' );
printf(
'<input type="text" id="wcap_from_email" name="wcap_from_email" value="%s" />',
isset( $wcap_from_email ) ? esc_attr( $wcap_from_email ) : ''
);
$html = '<label for="wcap_from_email_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_reply_email_callback( $args ) {
$wcap_reply_email = get_option( 'wcap_reply_email' );
printf(
'<input type="text" id="wcap_reply_email" name="wcap_reply_email" value="%s" />',
isset( $wcap_reply_email ) ? esc_attr( $wcap_reply_email ) : ''
);
$html = '<label for="wcap_reply_email_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_product_image_size_callback( $args ) {
$wcap_product_image_height = get_option( 'wcap_product_image_height' );
$wcap_product_image_width = get_option( 'wcap_product_image_width' );
?> <input type="text" id = "wcap_product_image_height" style= "width:50px" name="wcap_product_image_height" value="<?php echo $wcap_product_image_height; ?>" />
<?php echo "x"; ?>
<input type="text" id = "wcap_product_image_width" style = "width:50px" name="wcap_product_image_width" value="<?php echo $wcap_product_image_width; ?>" />
px
<?php
$html = '<label for="wcap_product_image_size"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_cron_job_callback () {
}
public static function wcap_use_auto_cron_callback( $args ) {
$enable_auto_cron = get_option( 'wcap_use_auto_cron' );
if( isset( $enable_auto_cron ) && '' == $enable_auto_cron ) {
$enable_auto_cron = 'off';
}
$html='';
printf(
'<input type="checkbox" id="wcap_use_auto_cron" name="wcap_use_auto_cron" value="on"
'.checked( 'on', $enable_auto_cron, false ) . ' />'
);
$html .= '<label for="wcap_use_auto_cron_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_cron_time_duration_callback( $args ) {
$wcap_cron_time_duration = get_option( 'wcap_cron_time_duration' );
printf(
'<input type="text" id="wcap_cron_time_duration" name="wcap_cron_time_duration" value="%s" />',
isset( $wcap_cron_time_duration ) ? esc_attr( $wcap_cron_time_duration ) : ''
);
$html = '<label for="wcap_cron_time_duration"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_general_license_key_section_callback(){
}
public static function wcap_edd_sample_license_key_ac_woo_callback( $args ){
$edd_sample_license_key_ac_woo_field = get_option( 'edd_sample_license_key_ac_woo' );
printf(
'<input type="text" id="edd_sample_license_key_ac_woo" name="edd_sample_license_key_ac_woo" class="regular-text" value="%s" />',
isset( $edd_sample_license_key_ac_woo_field ) ? esc_attr( $edd_sample_license_key_ac_woo_field ) : ''
);
$html = '<label for="edd_sample_license_key_ac_woo"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_activate_license_key_ac_woo_callback() {
$license = get_option( 'edd_sample_license_key_ac_woo' );
$status = get_option( 'edd_sample_license_status_ac_woo' );
?>
<form method="post" action="options.php">
<?php if ( false !== $license ) { ?>
<?php if( $status !== false && $status == 'valid' ) { ?>
<span style="color:green;"><?php _e( 'active' ); ?></span>
<?php wp_nonce_field( 'edd_sample_nonce' , 'edd_sample_nonce' ); ?>
<input type="submit" class="button-secondary" name="edd_ac_license_deactivate" value="<?php _e( 'Deactivate License' ); ?>"/>
<?php } else { ?>
<?php
wp_nonce_field( 'edd_sample_nonce', 'edd_sample_nonce' ); ?>
<input type="submit" class="button-secondary" name="edd_ac_license_activate" value="<?php _e( 'Activate License' ); ?>"/>
<?php } ?>
<?php } ?>
</form>
<?php
}
public static function wcap_custom_restrict_callback () {
}
public static function wcap_restrict_ip_address_callback( $args ) {
$wcap_restrict_ip_address = get_option( 'wcap_restrict_ip_address' );
$value = isset( $wcap_restrict_ip_address ) ? esc_attr( $wcap_restrict_ip_address ) : '';
printf(
'<textarea rows="4" cols="50" id="wcap_restrict_ip_address" name="wcap_restrict_ip_address" placeholder="Add an IP address" />' . $value .'</textarea>'
);
$html = '<label for="wcap_restrict_ip_address_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_restrict_email_address_callback( $args ) {
$wcap_restrict_email_address = get_option( 'wcap_restrict_email_address' );
$email_value = isset( $wcap_restrict_email_address ) ? esc_attr( $wcap_restrict_email_address ) : '';
printf(
'<textarea rows="4" cols="50" id="wcap_restrict_email_address" name="wcap_restrict_email_address" placeholder="Add an email address" />' . $email_value .'</textarea>'
);
$html = '<label for="wcap_restrict_email_address_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_restrict_domain_address_callback( $args ) {
$wcap_restrict_domain_address = get_option( 'wcap_restrict_domain_address' );
$domain_value = isset( $wcap_restrict_domain_address ) ? esc_attr( $wcap_restrict_domain_address ) : '';
printf(
'<textarea rows="4" cols="50" id="wcap_restrict_domain_address" name="wcap_restrict_domain_address" placeholder="Add an email domain name (Ex. hotmail.com)" />' . $domain_value .'</textarea>'
);
$html = '<label for="wcap_restrict_domain_address_label"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_sms_settings_section_callback() {
_e( 'Configure your Twilio account settings below. Please note that due to some restrictions from Twilio, customers <i>may sometimes</i> receive delayed messages', 'woocommerce-ac' );
}
public static function wcap_enable_sms_reminders_callback( $args ) {
$wcap_enable_sms = get_option( 'wcap_enable_sms_reminders' );
if (isset( $wcap_enable_sms ) && $wcap_enable_sms == "" ) {
$wcap_enable_sms = 'off';
}
$html = '<input type="checkbox" id="wcap_enable_sms_reminders" name="wcap_enable_sms_reminders" value="on" ' . checked( 'on', $wcap_enable_sms, false ) . '/>';
$html .= '<label for="wcap_enable_sms_reminders"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_sms_from_phone_callback( $args ) {
$wcap_from_phone = get_option( 'wcap_sms_from_phone' );
$html = "<input type='text' id='wcap_sms_from_phone' name='wcap_sms_from_phone' value='$wcap_from_phone' />";
$html .= '<label for="wcap_from_phone"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_sms_account_sid_callback( $args ) {
$wcap_sms_account_sid = get_option( 'wcap_sms_account_sid' );
$html = "<input type='text' style='width:60%;' id='wcap_sms_account_sid' name='wcap_sms_account_sid' value='$wcap_sms_account_sid' />";
$html .= '<label for="wcap_sms_account_sid"> ' . $args[0] . '</label>';
echo $html;
}
public static function wcap_sms_auth_token_callback( $args ) {
$wcap_sms_auth_token = get_option( 'wcap_sms_auth_token' );
$html = "<input type='text' style='width:60%;' id='wcap_sms_auth_token' name='wcap_sms_auth_token' value='$wcap_sms_auth_token' />";
$html .= '<label for="wcap_sms_auth_token"> ' . $args[0] . '</label>';
echo $html;
}
}
}
?>