Advertisement
Guest User

Untitled

a guest
Nov 14th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.87 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.6.0
  8. * @ Author : DeZender
  9. * @ Release on : 02.06.2013
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. function wpmlm_query_vars_product_list($vars) {
  15. if (( 'wpmlm-product' != $vars['post_type'] || in_array( $vars['orderby'], array( 'meta_value_num', 'meta_value' ) ) )) {
  16. return $vars;
  17. }
  18.  
  19. $vars['posts_per_archive_page'] = 0;
  20.  
  21. if (( is_admin( ) && isset( $vars['orderby'] ) )) {
  22. $vars['orderby'] = 'date';
  23. $vars['order'] = 'desc';
  24. $vars['nopaging'] = false;
  25. $posts_per_page = (int)get_user_option( 'edit_wpmlm_product_per_page' );
  26. $vars['posts_per_page'] = ($posts_per_page ? $posts_per_page : 20);
  27. }
  28.  
  29.  
  30. if ('dragndrop' == get_option( 'wpmlm_sort_by' )) {
  31. $vars['orderby'] = 'menu_order title';
  32. $vars['order'] = 'desc';
  33. $vars['nopaging'] = true;
  34. }
  35.  
  36. return $vars;
  37. }
  38.  
  39. /**
  40. * setting the screen option to between 1 and 999
  41. * @access public
  42. *
  43. * @since 3.8
  44. * @param $status
  45. * @param $option (string) name of option being saved
  46. * @param $value (string) value of option being saved
  47. * @return $value after changes...
  48. */
  49. function wpmlm_set_screen_option($status, $option, $value) {
  50. if (in_array( $option, array( 'edit_wpmlm_variation_per_page', 'edit_wpmlm_product_per_page' ) )) {
  51. if ('edit_wpmlm_variation_per_page' == $option) {
  52. global $user_ID;
  53.  
  54. update_user_option( $user_ID, 'edit_wpmlm-variation_per_page', $value );
  55. }
  56.  
  57. return $value;
  58. }
  59.  
  60. }
  61.  
  62. /**
  63. * When rearranging the products for drag and drop it is easiest to arrange them when they are all on the same page...
  64. * @access public (wp-admin)
  65. *
  66. * @since 3.8
  67. * @param $per_page (int) number of products per page
  68. * @param $post_type (string) name of current post type
  69. * @return $per_page after changes...
  70. */
  71. function wpmlm_drag_and_drop_ordering($per_page, $post_type) {
  72. global $wpdb;
  73.  
  74. if (( ( 'wpmlm-product' == $post_type && 'dragndrop' == get_option( 'wpmlm_sort_by' ) ) && $count = $wpdb->get_var( '' . 'SELECT COUNT(*) FROM ' . $wpdb->posts . ' WHERE `post_type`=\'wpmlm-product\' AND `post_parent`=0' ) )) {
  75. $per_page = $count;
  76. }
  77.  
  78. return $per_page;
  79. }
  80.  
  81. /**
  82. * Checks whether to display or hide the update wp-e-commerce link
  83. *
  84. * @access public
  85. *
  86. * @since 3.8
  87. * @return boolean true - show link, false- hide link
  88. */
  89. function wpmlm_show_update_link() {
  90. global $wpdb;
  91.  
  92. $sql = 'SHOW TABLES LIKE "' . $wpdb->prefix . 'wpmlm_product_list"';
  93. $var = $wpdb->get_var( $sql );
  94.  
  95. if (( !empty( $var ) && false == get_option( 'wpmlm_hide_update' ) )) {
  96. return true;
  97. }
  98.  
  99. return false;
  100. }
  101.  
  102. /**
  103. * wpmlm_admin_pages function, all the definitons of admin pages are stores here.
  104. * No parameters, returns nothing
  105. *
  106. * Fairly standard wordpress plugin API stuff for adding the admin pages, rearrange the order to rearrange the pages
  107. * The bits to display the options page first on first use may be buggy, but tend not to stick around long enough to be identified and fixed
  108. * if you find bugs, feel free to fix them.
  109. *
  110. * If the permissions are changed here, they will likewise need to be changed for the other sections of the admin that either use ajax
  111. * or bypass the normal download system.
  112. */
  113. function wpmlm_admin_pages() {
  114. if (isset( $_GET['wpmlm_activate_debug_page'] )) {
  115. if ('true' == $_GET['wpmlm_activate_debug_page']) {
  116. $_SESSION['wpmlm_activate_debug_page'] = true;
  117. } else {
  118. if ('false' == $_GET['wpmlm_activate_debug_page']) {
  119. $_SESSION['wpmlm_activate_debug_page'] = false;
  120. }
  121. }
  122. }
  123.  
  124.  
  125. if (wpmlm_show_update_link( )) {
  126. $page_hooks[] = add_submenu_page( 'index.php', __( 'Update Store', 'wpmlm' ), __( 'Store Update', 'wpmlm' ), 'administrator', 'wpmlm-update', 'wpmlm_display_update_page' );
  127. }
  128.  
  129. $iconURL = WPMLM_CORE_IMAGES_URL . '/binary-tree-icon.png';
  130. $page_hooks[] = add_menu_page( 'eCommerce MLM', 'eCommerce MLM', 'administrator', 'wpmlm-ecommerce', 'wpmlm_display_purchase_logs_page', $iconURL );
  131. $page_hooks[] = $purchase_logs_page = add_submenu_page( 'wpmlm-ecommerce', __( 'Sales', 'wpmlm' ), __( 'Sales', 'wpmlm' ), 'administrator', 'wpmlm-ecommerce', 'wpmlm_display_purchase_logs_page' );
  132. $page_hooks[] = $wpmlm_report_page = add_submenu_page( 'wpmlm-ecommerce', __( 'MLM Reports', 'wpmlm' ), __( 'MLM Reports', 'wpmlm' ), 'administrator', 'wpmlm-admin-tasks', 'display_wpmlm_page' );
  133. $page_hooks[] = $wpmlm_member_profile_page = add_submenu_page( 'wpmlm-ecommerce', __( 'Members Info', 'wpmlm' ), __( 'Members Info', 'wpmlm' ), 'administrator', 'wpmlm-member-profile', 'display_wpmlm_member_profile_page' );
  134. $products_page = 'edit.php?post_type=wpmlm-product';
  135. $page_hooks[] = $edit_coupons_page = add_submenu_page( $products_page, __( 'Coupons', 'wpmlm' ), __( 'Coupons', 'wpmlm' ), 'administrator', 'wpmlm-edit-coupons', 'wpmlm_display_coupons_page' );
  136. $page_hooks[] = $edit_options_page = add_submenu_page( 'wpmlm-ecommerce', __( 'Shopping Cart Setting', 'wpmlm' ), __( 'Shopping Cart Setting', 'wpmlm' ), 'administrator', 'wpmlm-settings', 'wpmlm_display_settings_page' );
  137. add_action( 'admin_print_scripts-' . $edit_options_page, 'wpmlm_print_admin_scripts' );
  138. $page_hooks[] = $wpmlm_mlmsetting_page = add_submenu_page( 'wpmlm-ecommerce', __( 'MLM Settings', 'wpmlm' ), __( 'MLM Settings', 'wpmlm' ), 'administrator', 'wpmlm-mlmsettings', 'wpmlm_display_mlm_settings_page' );
  139.  
  140. if (( ( defined( 'WPMLM_ADD_DEBUG_PAGE' ) && WPMLM_ADD_DEBUG_PAGE == true ) || ( isset( $_SESSION['wpmlm_activate_debug_page'] ) && true == $_SESSION['wpmlm_activate_debug_page'] ) )) {
  141. $page_hooks[] = add_options_page( __( 'Store Debug', 'wpmlm' ), __( 'Store Debug', 'wpmlm' ), 'administrator', 'wpmlm-debug', 'wpmlm_debug_page' );
  142. }
  143.  
  144. $page_hooks = apply_filters( 'wpmlm_additional_pages', $page_hooks, $products_page );
  145. do_action( 'wpmlm_add_submenu' );
  146. foreach ($page_hooks as $page_hook) {
  147. add_action( 'load-' . $page_hook, 'wpmlm_admin_include_css_and_js_refac' );
  148. switch ($page_hook) {
  149. case $edit_options_page: {
  150. add_action( 'load-' . $page_hook, 'wpmlm_admin_include_optionspage_css_and_js' );
  151. break;
  152. }
  153.  
  154. case $wpmlm_report_page: {
  155. add_action( 'load-' . $page_hook, 'wpmlm_admin_include_report_page_css_and_js' );
  156. add_action( 'load-' . $page_hook . '2', 'cmi_add_option' );
  157. break;
  158. }
  159.  
  160. case $wpmlm_member_profile_page: {
  161. add_action( 'load-' . $page_hook, 'wpmlm_admin_include_member_profile_page_css_and_js' );
  162. break;
  163. }
  164.  
  165. case $wpmlm_mlmsetting_page: {
  166. add_action( 'load-' . $page_hook, 'wpmlm_admin_include_wpmlm_setting_page_css_and_js' );
  167. break;
  168. }
  169. ......................................................................................................
  170. .......................................................
  171. ..........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement