wpp_admin_box

The WooCommerce PDF & Print wpp admin box class.

Defined (1)

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

/main.php  
  1. class wpp_admin_box { 
  2.  
  3. var $pn; 
  4. var $pagehook; 
  5. var $data_array; 
  6. var $wpp_unsp = false; 
  7. var $wpp_note; 
  8.  
  9. function wpp_admin_box ( $ex_array, $page_name ) { 
  10. $this->data_array = $ex_array ; 
  11. $this->pn = $page_name ; 
  12.  
  13. function wpp_admin() { 
  14.  
  15. add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns' ), 10, 2); 
  16. add_action('admin_menu', array(&$this, 'on_admin_menu' ));  
  17.  
  18. function on_admin_menu() { 
  19. add_menu_page($this->data_array['parent_page_title'], $this->data_array['parent_menu_title'] , $this->data_array['parent_level'], $this->data_array['parent_file'] , array(&$this, 'on_show_page'), $this->data_array['parent_menu_icon']); 
  20. foreach($this->data_array['page'] as $name) { 
  21. if($name['page_file'] == $this->pn) { 
  22. $this->pagehook = add_submenu_page( $this->data_array['parent_file'] , $name['page_title'], $name['page_menu_title'], $name['page_level'], $name['page_file'], array(&$this, 'on_show_page' )); 
  23. else{ 
  24. add_submenu_page( $this->data_array['parent_file'] , $name['page_title'], $name['page_menu_title'], $name['page_level'], $name['page_file'], array(&$this, 'on_show_page' )); 
  25. if( !empty($this->data_array['page'][$this->pn]) && $this->data_array['page'][$this->pn]['page_type'] == 'admin_box' ) { 
  26. add_action('load-'.$this->pagehook, array(&$this, 'on_load_page')); 
  27. function on_screen_layout_columns($columns, $screen) { 
  28. if ( $screen == $this->pagehook ) {  
  29. $columns[ $this->pagehook ] = $this->data_array['page'][$this->pn]['page_column_number'];  
  30. return $columns; 
  31.  
  32. function on_load_page() { 
  33. wp_enqueue_script('common'); 
  34. wp_enqueue_script('wp-lists'); 
  35. wp_enqueue_script('postbox'); 
  36. if( isset($this->data_array['content'][$this->pn]['sidebox']) && count($this->data_array['content'][$this->pn]['sidebox']) > 10) {  
  37. wp_die( __(' Number of sideboxes more then 10 !')); 
  38. $fn = 0; 
  39. if( !empty($this->data_array['content'][$this->pn]['sidebox']) ) { 
  40. foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sid ) { 
  41. add_meta_box( $sid['sidebox_id'], $sid['sidebox_title'], array(&$this, 'sb_'.$fn), $this->pagehook, 'side', 'core');  
  42. $fn=$fn+1;  
  43.  
  44. function on_show_page() { 
  45. global $screen_layout_columns; 
  46. if( $this->data_array['page'][$this->pn]['page_type'] == 'admin_box' ) {  
  47. if( isset($this->data_array['content'][$this->pn]['contentbox']) && count($this->data_array['content'][$this->pn]['contentbox']) > 10 ) {  
  48. wp_die( __(' Number of contentbox more then 10 !')); 
  49. $fn = 0; 
  50. if(!empty($this->data_array['content'][$this->pn]['contentbox'])) { 
  51. foreach( $this->data_array['content'][$this->pn]['contentbox'] as $sid ) { 
  52. add_meta_box( $sid['contentbox_id'], $sid['contentbox_title'], array(&$this, 'cb_'.$fn), $this->pagehook, 'normal', 'core'); 
  53. $fn=$fn+1;  
  54.  
  55. ?> 
  56.  
  57. <div id="wpp_wrap" class="wrap"> 
  58. <?php  
  59. if( !$this->data_array['page'][$this->pn]['page_screen_custom_icon'] ) { 
  60. screen_icon($this->data_array['page'][$this->pn]['page_screen_icon']); 
  61. ?> 
  62. <h2> 
  63. <?php  
  64. if( !empty($this->data_array['page'][$this->pn]['page_screen_custom_icon']) || $this->data_array['page'][$this->pn]['page_screen_custom_icon'] ) {  
  65. echo '<img src = "'.$this->data_array['page'][$this->pn]['page_screen_custom_icon'].'" align="absmiddle" style="background:#FFFFFF; border:#CCCCCC 1px solid; padding:1px;">  '; }  
  66. _e( $this->data_array['page'][$this->pn]['page_header']) ?> 
  67. </h2> 
  68. <?php  
  69. if(!empty($this->data_array['page'][$this->pn]) && $this->data_array['page'][$this->pn]['page_include_file_top'] ) {  
  70. include( WPP_FOLDER . $this->data_array['page'][$this->pn]['page_include_file_top'] );  
  71. ?> 
  72. <div id="poststuff" class="metabox-holder<?php echo $this->data_array['page'][$this->pn]['page_column_number'] == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>"> 
  73. <?php  
  74. if( !empty($this->data_array['page'][$this->pn]) && $this->data_array['page'][$this->pn]['page_type'] == 'admin_box' )  
  75.  
  76. if($this->data_array['page'][$this->pn]['page_column_number'] == 2)  
  77. ?> 
  78. <div id="side-info-column" class="inner-sidebar"> 
  79. <?php do_meta_boxes($this->pagehook , 'side', $data); ?> 
  80. </div> 
  81.  
  82. <div id="post-body" class="has-sidebar"> 
  83. <div id="post-body-content" class="has-sidebar-content"> 
  84. <?php do_meta_boxes($this->pagehook , 'normal', $data); ?> 
  85. </div> 
  86. </div> 
  87. <?php 
  88. else 
  89. @do_meta_boxes($this->pagehook , 'normal', $data); 
  90. @do_meta_boxes($this->pagehook , 'side', $data); 
  91. ?> 
  92. <br class="clear"/>  
  93. </div>  
  94. </div> 
  95. <script type="text/javascript"> 
  96. //<![CDATA[ 
  97. jQuery(document).ready( function($) { 
  98. // close postboxes that should be closed 
  99. $('.if-js-closed').removeClass('if-js-closed').addClass('closed'); 
  100. // postboxes setup 
  101. postboxes.add_postbox_toggles('<?php echo $this->pagehook ; ?>'); 
  102. }); 
  103. //]]> 
  104. </script> 
  105. <?php 
  106. if($this->data_array['page'][$this->pn]['page_include_file_bottom'] ) include( WPP_FOLDER . $this->data_array['page'][$this->pn]['page_include_file_bottom'] ); 
  107. else { 
  108. if($this->data_array['page'][$this->pn]['page_include_file_bottom']) include( WPP_FOLDER . $this->data_array['page'][$this->pn]['page_include_file_bottom'] ); 
  109.  
  110. function sb_0($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 0) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  111. function sb_1($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 1) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  112. function sb_2($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 2) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  113. function sb_3($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 3) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  114. function sb_4($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 4) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  115. function sb_5($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 5) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  116. function sb_6($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 6) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  117. function sb_7($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 7) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  118. function sb_8($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 8) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  119. function sb_9($data) {$i = 0;foreach( $this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 9) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  120. function sb_10($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['sidebox'] as $sb => $sid ) {if($i == 10) {if($sid['sidebox_data']) {echo $sid['sidebox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  121.  
  122. function cb_0($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 0) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  123. function cb_1($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 1) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  124. function cb_2($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 2) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  125. function cb_3($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 3) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  126. function cb_4($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 4) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  127. function cb_5($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 5) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  128. function cb_6($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 6) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  129. function cb_7($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 7) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  130. function cb_8($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 8) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  131. function cb_9($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 9) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  132. function cb_10($data) {$i = 0;foreach($this->data_array['content'][$this->pn]['contentbox'] as $cb => $sid ) {if($i == 10) { if($sid['contentbox_data']) {echo $sid['contentbox_data'];}else{include ( WPP_FOLDER . 'page_contents.php' );}}$i=$i+1;}} 
  133.