From 6f238650d16067f4e545300cdc4f19227b75b157 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Sun, 10 Mar 2013 14:33:27 +0000 Subject: [PATCH] Fix the page slurp --- admin/woocommerce-admin-hooks.php | 8 +- .../mijireh/assets/images/mijireh-logo.png | Bin 0 -> 5793 bytes .../gateways/mijireh/assets/js/page_slurp.js | 10 +- .../mijireh/class-wc-gateway-mijireh.php | 89 +++++++++--------- readme.txt | 1 + 5 files changed, 60 insertions(+), 48 deletions(-) create mode 100644 classes/gateways/mijireh/assets/images/mijireh-logo.png diff --git a/admin/woocommerce-admin-hooks.php b/admin/woocommerce-admin-hooks.php index 8b7e7f532ae..275e96fc5e5 100644 --- a/admin/woocommerce-admin-hooks.php +++ b/admin/woocommerce-admin-hooks.php @@ -67,4 +67,10 @@ add_action( "delete_term", 'woocommerce_delete_term', 5 ); */ add_action( 'admin_footer', 'woocommerce_bulk_admin_footer', 10 ); add_action( 'load-edit.php', 'woocommerce_order_bulk_action' ); -add_action( 'admin_notices', 'woocommerce_order_bulk_admin_notices' ); \ No newline at end of file +add_action( 'admin_notices', 'woocommerce_order_bulk_admin_notices' ); + +/** + * Mijireh Gateway + */ +add_action( 'add_meta_boxes', array( 'WC_Gateway_Mijireh', 'add_page_slurp_meta' ) ); +add_action( 'wp_ajax_page_slurp', array( 'WC_Gateway_Mijireh', 'page_slurp' ) ); \ No newline at end of file diff --git a/classes/gateways/mijireh/assets/images/mijireh-logo.png b/classes/gateways/mijireh/assets/images/mijireh-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..5a2cb8f06f74b8b1c4f5e7afc4c0d3d72a763856 GIT binary patch literal 5793 zcmV;S7GCLzP)yhPlp)ywLzt zdal*w7ffIPN@_HPoU_>HMwhf^q`jZY*_6Z95@Li4Sb804iGr@X5n_d=&*7ZN+7Uum z4n0u~MPDd&kP=E{bgRBfq`)C;h5$rl9btKB!PfvuX=uOIqR!k5NM#vTY$JA%8alO-Ju*zn) z&;S4c4nbrEXp=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&&SW5GiTAFrAwDi zgJugnij*Wmvu9&{>C#1u7R{MUSbfHV3#x)uz*?y|Yb|;Wv7zbu)4~26Y`}>Q_LBr8 z3D7xn=YDQrFuf&Rku3i;?+IX;HKo1IY#p&Be5HxWs_E0e`U-3bXS~#GZY2^>rhfj_ z^y#ZiRvND%?7DR#S>iqs473Vt91Un_z5-vfX64FNs|e0?#`6iJn8!pg0VV3Hl`Ge* zS@7-JwFo4z>s8PG57$65Tf*0_UHk2~%vRt`2OmX9@)!xILS6GMurgcXBHd?#84Upq zwidod3ul3$6%!drP=%_^mZ8rDLn=#VLlVwx31__2bUZA9WT=*^q}%rY*9R{fXcP%& zHp3-eoenabled && is_admin() ) { $this->install_slurp_page(); - - // Hooks - add_action( 'add_meta_boxes', array( $this, 'add_page_slurp_meta' ) ); - add_action( 'wp_ajax_page_slurp', array( $this, 'page_slurp' ) ); } // Save options @@ -56,19 +52,6 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { add_action( 'woocommerce_api_wc_gateway_mijireh', array( $this, 'mijireh_notification' ) ); } - /** - * init_mijireh function. - * - * @access public - */ - public function init_mijireh() { - if ( ! class_exists( 'Mijireh' ) ) { - require_once 'includes/Mijireh.php'; - - Mijireh::$access_key = $this->access_key; - } - } - /** * install_slurp_page function. * @@ -94,25 +77,6 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { } } - /** - * page_slurp function. - * - * @access public - * @return void - */ - public function page_slurp() { - - $this->init_mijireh(); - - $page = get_page( absint( $_POST['page_id'] ) ); - $url = get_permalink( $page->ID ); - wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'publish' ) ); - $job_id = Mijireh::slurp( $url ); - wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'private' ) ); - echo $job_id; - die; - } - /** * mijireh_notification function. * @@ -323,16 +287,57 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { } + /** + * init_mijireh function. + * + * @access public + */ + public function init_mijireh() { + if ( ! class_exists( 'Mijireh' ) ) { + require_once 'includes/Mijireh.php'; + + if ( ! isset( $this ) ) { + $settings = get_option( 'woocommerce_' . 'mijireh_checkout' . '_settings', null ); + $key = ! empty( $settings['access_key'] ) ? $settings['access_key'] : ''; + } else { + $key = $this->access_key; + } + + Mijireh::$access_key = $key; + } + } + + + /** + * page_slurp function. + * + * @access public + * @return void + */ + public static function page_slurp() { + + self::init_mijireh(); + + $page = get_page( absint( $_POST['page_id'] ) ); + $url = get_permalink( $page->ID ); + wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'publish' ) ); + $job_id = Mijireh::slurp( $url ); + wp_update_post( array( 'ID' => $page->ID, 'post_status' => 'private' ) ); + echo $job_id; + die; + } + + /** * add_page_slurp_meta function. * * @access public * @return void */ - public function add_page_slurp_meta() { + public static function add_page_slurp_meta() { global $woocommerce; - if ( $this->is_slurp_page() ) { + if ( self::is_slurp_page() ) { wp_enqueue_style( 'mijireh_css', $woocommerce->plugin_url() . '/classes/gateways/mijireh/assets/css/mijireh.css' ); wp_enqueue_script( 'pusher', 'https://d3dy5gmtp8yhk7.cloudfront.net/1.11/pusher.min.js', null, false, true ); wp_enqueue_script( 'page_slurp', $woocommerce->plugin_url() . '/classes/gateways/mijireh/assets/js/page_slurp.js', array('jquery'), false, true ); @@ -340,7 +345,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { add_meta_box( 'slurp_meta_box', // $id 'Mijireh Page Slurp', // $title - array( $this, 'draw_page_slurp_meta_box' ), // $callback + array( 'WC_Gateway_Mijireh', 'draw_page_slurp_meta_box' ), // $callback 'page', // $page 'normal', // $context 'high' // $priority @@ -355,7 +360,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { * @access public * @return void */ - public function is_slurp_page() { + public static function is_slurp_page() { global $post; $is_slurp = false; if ( isset( $post ) && is_object( $post ) ) { @@ -375,10 +380,10 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway { * @param mixed $post * @return void */ - public function draw_page_slurp_meta_box( $post ) { + public static function draw_page_slurp_meta_box( $post ) { global $woocommerce; - $this->init_mijireh(); + self::init_mijireh(); echo "
"; echo "

Slurp your custom checkout page!

"; diff --git a/readme.txt b/readme.txt index fa184455a25..e3fb24e97cc 100644 --- a/readme.txt +++ b/readme.txt @@ -180,6 +180,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc * Fix - Moved init checkout to a later hook to prevent canonical template redirects kicking in. * Fix - Made custom attributes more robust by using sanitized values for variations. * Fix - woocommerce_cancel_unpaid_orders respects the manage stock setting. +* Fix - Mijireh Page Slurp = 2.0.2 - 06/03/2013 = * Fix - Frontpage shop when 'orderby' is set.