createCheckoutForm(); $this->createPages(); } /** * Create the main checkout form. * * @return void */ public function createCheckoutForm() { $forms = apply_filters( 'surecart/create_forms', array( 'checkout' => array( 'name' => _x( 'checkout', 'Form slug', 'surecart' ), 'title' => _x( 'Checkout', 'Form title', 'surecart' ), 'content' => ' Contact Information Credit Card Totals Subtotal TotalTotal Due Today Purchase  ', 'post_type' => 'sc_form', ), ) ); $this->createPosts( $forms ); } /** * Create pages that the plugin relies on, storing page IDs in variables. * * @return void */ public function createPages() { $form = \SureCart::forms()->getDefault(); $pages = apply_filters( 'surecart/create_pages', array( 'checkout' => array( 'name' => _x( 'checkout', 'Page slug', 'surecart' ), 'title' => _x( 'Checkout', 'Page title', 'surecart' ), 'content' => ' ', ), 'order-confirmation' => array( 'name' => _x( 'order-confirmation', 'Page slug', 'surecart' ), 'title' => _x( 'Thank you!', 'Page title', 'surecart' ), 'content' => ' ', ), 'dashboard' => array( 'name' => _x( 'customer-dashboard', 'Page slug', 'surecart' ), 'title' => _x( 'Dashboard', 'Page title', 'surecart' ), 'content' => ' ', ), ) ); $this->createPosts( $pages ); } /** * Create posts from an array of post data. * * @param array $posts Array of post data. * @return void */ public function createPosts( $posts ) { foreach ( $posts as $key => $post ) { \SureCart::pages()->findOrCreate( esc_sql( $post['name'] ), $key, $post['title'], $post['content'], ! empty( $post['parent'] ) ? \SureCart::pages()->findOrCreate( $post['parent'] ) : '', ! empty( $post['post_status'] ) ? $post['post_status'] : 'publish', ! empty( $post['post_type'] ) ? $post['post_type'] : 'page' ); } } }