text_domain = $text_domain; /** * Update Status * * "ok" : Successful update */ $status = ""; /** DB Connect */ $db = new add_Banner_Extension_Admin_Db(); /** Set Default Parameter for Array */ $options = array( "id" => "", "image_url" => "", "image_alt" => "", "link_url" => "", "open_new_tab" => 0, "insert_element_class" => "", "insert_element_id" => "", "how_display" => "article", "filter_category" => 0, "category_id" => 0 ); /** Key Set */ if ( isset( $_GET['add_banner_extension_id'] ) && is_numeric( $_GET['add_banner_extension_id'] ) ) { $options['id'] = esc_html( $_GET['add_banner_extension_id'] ); } /** DataBase Update & Insert Mode */ if ( isset( $_POST['add_banner_extension_id'] ) && is_numeric( $_POST['add_banner_extension_id'] ) ) { $db->update_options( $_POST ); $options['id'] = $_POST['add_banner_extension_id']; $status = "ok"; } else { if ( isset( $_POST['add_banner_extension_id'] ) && $_POST['add_banner_extension_id'] === '' ) { $options['id'] = $db->insert_options( $_POST ); $status = "ok"; } } /** Mode Judgment */ if ( isset( $options['id'] ) && is_numeric( $options['id'] ) ) { $options = $db->get_options( $options['id'] ); } $this->page_render( $options, $status ); } /** * Page Render. * * @param array $options * @param string $status */ private function page_render ( $options, $status ) { $html = ''; $html .= '
' . __( 'Add Banner Extension Information Update.', $this->text_domain ) . '
'; $html .= ''; $html .= '