wccs_options_validate_pro2

The WooCommerce Checkout Manager wccs options validate pro2 function.

Description

wccs_options_validate_pro2( $input ); 

Parameters (1)

0. $input
The input.

Usage

  1. if ( !function_exists( 'wccs_options_validate_pro2' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/main.php'; 
  3.  
  4. // The input. 
  5. $input = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wccs_options_validate_pro2($input); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/classes/main.php  
  1. function wccs_options_validate_pro( $input ) { 
  2.  
  3. $detect_error = 0; 
  4. // translate additional fields 
  5. if ( !empty($input['buttons']) ) { 
  6. foreach( $input['buttons'] as $i => $btn ) : 
  7.  
  8. if( function_exists( 'icl_register_string' ) ) { 
  9. if ( !empty($btn['label']) ) { 
  10. icl_register_string('WooCommerce Checkout Manager', ''.$btn['label'].'', ''.$btn['label'].''); 
  11. if ( !empty($btn['placeholder']) ) { 
  12. icl_register_string('WooCommerce Checkout Manager', ''.$btn['placeholder'].'', ''.$btn['placeholder'].''); 
  13.  
  14. if ( !empty($btn['option_array']) ) {  
  15. $mysecureop = explode( '||', $btn['option_array']); 
  16. foreach ( $mysecureop as $one ) { 
  17. icl_register_string('WooCommerce Checkout Manager', ''.$one.'', ''.$one.''); 
  18.  
  19. if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {  
  20. $input['buttons'][$i]['role_options2'] = ''; 
  21. add_settings_error( 
  22. 'wooccm_settings_errors',  
  23. esc_attr( 'settings_updated' ),  
  24. __( 'Sorry! Anerroroccurred. WooCheckout requires you to not have values in both role options. OK.', 'woocommerce-checkout-manager' ),  
  25. error 
  26. ); 
  27. }  
  28.  
  29. if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {  
  30. $input['buttons'][$i]['single_px'] = ''; 
  31. add_settings_error( 
  32. 'wooccm_settings_errors',  
  33. esc_attr( 'settings_updated' ),  
  34. __( 'Sorry! Anerroroccurred. WooCheckout requires you to not have values in both hidden product options. OK.', 'woocommerce-checkout-manager' ),  
  35. error 
  36. ); 
  37. }  
  38.  
  39. if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {  
  40. $input['buttons'][$i]['single_px_cat'] = ''; 
  41. add_settings_error( 
  42. 'wooccm_settings_errors',  
  43. esc_attr( 'settings_updated' ),  
  44. __( 'Sorry! Anerroroccurred. WooCheckout requires you to not have values in both hidden category options. OK.', 'woocommerce-checkout-manager' ),  
  45. error 
  46. ); 
  47. }  
  48.  
  49.  
  50. if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {  
  51. unset( $input['buttons'][$i] ); 
  52.  
  53. if ( $i != 999 ) { 
  54. $detect_error++; 
  55. $fieldnum = $i + 1; 
  56. add_settings_error( 
  57. 'wooccm_settings_errors',  
  58. esc_attr( 'settings_updated' ),  
  59. __( 'Sorry! Anerroroccurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),  
  60. error 
  61. ); 
  62. }  
  63.  
  64. if ( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) { 
  65. $newNum = $i + 1; 
  66. if( wooccm_mul_array( 'myfield'.$newNum.'' , $input['buttons'] ) ) { 
  67. $input['buttons'][$i]['cow'] = 'myfield'.$newNum.'c'; 
  68. } else { 
  69. $input['buttons'][$i]['cow'] = 'myfield'.$newNum.''; 
  70.  
  71.  
  72. if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {  
  73. unset( $input['buttons'][$i] ); 
  74.  
  75. if ( $i != 999 ) { 
  76. $detect_error++; 
  77. $fieldnum = $i + 1; 
  78. add_settings_error( 
  79. 'wooccm_settings_errors',  
  80. esc_attr( 'settings_updated' ),  
  81. __( 'Sorry! Anerroroccurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),  
  82. error 
  83. ); 
  84. }  
  85.  
  86.  
  87.  
  88. endforeach; 
  89.  
  90. if( $detect_error == 0 ) { 
  91. add_settings_error( 
  92. 'wooccm_settings_errors',  
  93. esc_attr( 'settings_updated' ),  
  94. __( 'Your settings has been saved.', 'woocommerce-checkout-manager' ),  
  95. 'updated' 
  96. ); 
  97.  
  98. return $input;