options = get_option('appmaker_wc_settings'); if (empty( $this->options['project_id']) && !(isset($_POST['appmaker_wc_settings']) && !empty($_POST['appmaker_wc_settings']['project_id']))) { add_action( 'admin_notices', array( $this, 'show_settings_admin_message' ) ); } } function show_settings_admin_message() { ?>

Configure app to continue

Take me there !
'; $output .= "\njQuery(function() {"; $output .= " jQuery('#wrapper').html(jQuery('#main').html())\n"; $output .= " jQuery('body').css('margin-left','20px')\n"; $output .= " jQuery('body').css('margin-bottom','300px')\n"; $output .= "});\n"; $output .= "\n"; echo $output; } /** * Order change callback function * * @param int $order_id order id. */ public function appmaker_wc_order_status_changed( $order_id ) { $fcm_key = APPMAKER_WC::$api->get_settings( 'fcm_server_key' ); $order = new WC_Order( $order_id ); if ( ! empty( $fcm_key ) && APPMAKER_WC::$api->get_settings( 'enable_order_push', true ) ) { $fcm = new Appmaker_WC_FCM_Helper( $fcm_key ); $user_id = self::get_property($order,'user_id'); if ( class_exists( 'WC_Seq_Order_Number' ) ) { $display_order_id = self::get_property($order,'order_number'); } else { $display_order_id = self::get_id($order); } if ( ! empty( $user_id ) && get_user_meta( $user_id, 'appmaker_wc_user_login_from_app' ) ) { sprintf( __( 'Order updated #%s', 'appmaker-woocommerce-mobile-app-manager' ), $display_order_id ); $fcm->setTopic( "user-$user_id" ) ->setMessage( sprintf( __( 'Order updated #%s', 'appmaker-woocommerce-mobile-app-manager' ), $display_order_id ), sprintf( __( 'Order status changed to %s', 'appmaker-woocommerce-mobile-app-manager' ), $order->get_status() )) ->setAction( array( 'type' => 'OPEN_ORDER', 'params' => array( 'orderId' => $order_id, ), ) ) ->send(); } } } public function hook_stripe_enable_headers() { $output = ' '; echo $output; } public function hook_payment_footer() { $gateway = isset( $_GET['payment_gateway'] ) ? $_GET['payment_gateway'] : ''; $output = ' '; echo $output; } /** * Load the persistent cart make cart sync with app * * @return void|bool */ public function load_persistent_cart() { global $current_user; if ( ! $current_user ) { return false; } $saved_cart = get_user_meta( $current_user->ID, '_woocommerce_persistent_cart', true ); if ( $saved_cart && is_array( $saved_cart ) && isset( $saved_cart['cart'] ) ) { WC()->session->set( 'cart', $saved_cart['cart'] ); } return true; } public static function get_id( $object ) { if ( method_exists( $object, 'get_id' ) ) { return $object->get_id(); } else { return $object->id; } } static function get_property( $object, $property ) { if ( method_exists( $object, 'get_'.$property ) ) { return call_user_func(array($object, 'get_'.$property)); } else { return $object->{$property}; } } } new APPMAKER_WC_General_hooks();