wpp_save

The WooCommerce PDF & Print wpp save function.

Description

wpp_save( (constant) $print = true ); 

Parameters (1)

0. $print — Optional. (constant) => true
The print.

Usage

  1. if ( !function_exists( 'wpp_save' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-pdf-print/functions.php'; 
  3.  
  4. // The print. 
  5. $print = true; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpp_save($print); 
  9.  

Defined (1)

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

/functions.php  
  1. function wpp_save( $print = true) { 
  2.  
  3. global $post; 
  4. if( $post->post_status != 'publish' ) return false; 
  5. ################################################### 
  6. $wpp_follow = ( get_option( 'wpp_onoff_save_follow' ) ) ? '' : 'rel="nofollow"'; 
  7. $doc_string = stripslashes( get_option( 'wpp_save_doc_button_text' ) ); 
  8. $pdf_string = stripslashes( get_option( 'wpp_save_pdf_button_text' ) ); 
  9. $print_string = stripslashes( get_option( 'wpp_save_print_button_text' ) ); 
  10.  
  11. if( strpos(get_permalink(), '?') === FALSE ) { $upx = get_permalink() . '?'; } else{ $upx = get_permalink() . '&'; } 
  12.  
  13. $button['string']['doc'] = '<a href="'.$upx.'wpp_export=doc" '.$wpp_follow.'>'.$doc_string.'</a>'; 
  14. $button['string']['pdf'] = '<a href="'.$upx.'wpp_export=pdf" '.$wpp_follow.'>'.$pdf_string.'</a>'; 
  15. $button['string']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'>'.$print_string.'</a>'; 
  16. ///////////////////////////////////////////////// 
  17. $button['icon']['doc'] = '<a href="'.$upx.'wpp_export=doc" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_doc_icon_url').'" align="absmiddle" border="0" align="'.$doc_string.'" title="'.$doc_string.'" /></a>'; 
  18. $button['icon']['pdf'] = '<a href="'.$upx.'wpp_export=pdf" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_pdf_icon_url').'" align="absmiddle" border="0" align="'.$pdf_string.'" title="'.$pdf_string.'" /></a>'; 
  19. $button['icon']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_print_icon_url').'" align="absmiddle" border="0" align="'.$print_string.'" title="'.$print_string.'" /></a>'; 
  20. ////////////////////////////////////////////////// 
  21. $button['button']['doc'] = '<a href="'.$upx.'wpp_export=doc" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_doc_button_url').'" style="padding:2px" align="absmiddle" border="0" align="'.$doc_string.'" title="'.$doc_string.'" /></a>'; 
  22. $button['button']['pdf'] = '<a href="'.$upx.'wpp_export=pdf" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_pdf_button_url').'" style="padding:2px" align="absmiddle" border="0" align="'.$pdf_string.'" title="'.$pdf_string.'" /></a>'; 
  23. $button['button']['print'] = '<a href="'.$upx.'wpp_export=print" target="_blank" '.$wpp_follow.'><img src="'.WPP_PATH.'img/'.get_option( 'wpp_save_print_button_url').'" style="padding:2px" align="absmiddle" border="0" align="'.$print_string.'" title="'.$print_string.'" /></a>'; 
  24.  
  25. ################################################################# 
  26. if( get_option( 'wpp_onoff_saving_doc' ) ) { 
  27.  
  28. if( get_option( 'wpp_saving_type' ) ) { 
  29. //Button 
  30. if( get_option( 'wpp_save_doc_button_type' ) ) { 
  31. //button 
  32. $sm_doc = $button['button']['doc']; 
  33. else { 
  34. //icon 
  35. $sm_doc = $button['icon']['doc']; 
  36. else { 
  37. //String 
  38. $sm_doc = $button['string']['doc']; 
  39. ################################################################# 
  40. if( get_option( 'wpp_onoff_saving_pdf' ) ) { 
  41.  
  42. if( get_option( 'wpp_saving_type' ) ) { 
  43. //Button 
  44. if( get_option( 'wpp_save_pdf_button_type' ) ) { 
  45. //button 
  46. $sm_pdf = $button['button']['pdf']; 
  47. else { 
  48. //icon 
  49. $sm_pdf = $button['icon']['pdf']; 
  50. else { 
  51. //String 
  52. $sm_pdf = $button['string']['pdf']; 
  53. ################################################################# 
  54. if( get_option( 'wpp_onoff_print_manager' ) ) { 
  55.  
  56. if( get_option( 'wpp_print_app' ) ) { 
  57.  
  58. if( get_option( 'wpp_print_type' ) ) { 
  59. //Button 
  60. if( get_option( 'wpp_save_print_button_type' ) ) { 
  61. //button 
  62. $sm_print = $button['button']['print']; 
  63. else { 
  64. //icon 
  65. $sm_print = $button['icon']['print']; 
  66. else { 
  67. //String 
  68. $sm_print = $button['string']['print']; 
  69.  
  70.  
  71. $sm = str_replace(array('          ', '        ', '      ', '    ', ), '  ', $sm_pdf.'  '.$sm_doc.'  '.$sm_print); 
  72.  
  73. if( is_product() ) { 
  74. if( get_option( 'wpp_onoff_saving_manager' )) { 
  75. if( get_option('wpp_save_pdf_button_type') && strpos($sm, '000/') !== FALSE ) { 
  76. echo "<style> #wpp-buttons img { border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); display: inline; text-decoration: none; } #wpp-buttons a { text-decoration: none; border-bottom: none; } /* WooCommerce PDF & Print ".get_option('wpp_installed')." */</style>"; 
  77. else{ 
  78. echo "<style> #wpp-buttons img { padding-right: 5px; display: inline; } #wpp-buttons a { text-decoration: none; border-bottom: none; } /* WooCommerce PDF & Print ".get_option('wpp_installed')." */ </style>"; 
  79. if( $print && get_option( 'wpp_saving_location_custom' ) ) {  
  80. print( $sm );  
  81. else { 
  82. return $sm ; 
  83.  
  84. ##################################################################