controller = $controller; } function print_add_new() { if ( !empty($_POST) && (isset($_POST['flipbook-upload']) || isset($_POST['flipbook-upload-url']) || isset($_POST['flipbook-upload-folder'])) && wp_verify_nonce($_POST['flipbook-nonce'],'flipbook-add-new-add-new') ) { if ( isset($_POST['flipbook-upload']) ) { if ( !isset($_FILES['flipbook-zip']) || ($_FILES["flipbook-zip"]["error"] > 0) ) { if ($_FILES["flipbook-zip"]["error"] == 1) echo '

' . __('The uploaded file exceeds the upload_max_filesize directive in php.ini', 'flipbook') . '

'; else echo '

' . __('Please select a ZIP file created with Flip Book', 'flipbook') . '

'; } else { $uploadfile = wp_handle_upload($_FILES['flipbook-zip'], array( 'test_form' => false, 'mimes' => array('zip' => 'application/zip') )); if ( isset($uploadfile['error']) ) { echo '

' . esc_attr($uploadfile['error']) . '

'; } else { $id = ( isset($_POST['flipbook-replace']) && ($_POST['flipbook-replace'] == 'yes') && isset($_POST['flipbook-replace-id']) ) ? ($_POST['flipbook-replace-id']) : -1; $ret = $this->controller->install_book($uploadfile['file'], $id); if ( is_wp_error($ret) ) { echo '

' . $ret->get_error_message() . '

'; } else { if ( $ret["new"] ) echo '

This is a new version Flip Book WordPress Plugin. In addition to adding the Book here, you also need to update the Plugin itself. Fore more inforamtion, visit How to update Flip Book WordPress Plugin.

'; echo '

The book is successfully installed.   View The Book

'; echo '

To embed the book into your page, use shortcode [flipbook id="' . $ret["id"] . '"]

'; echo '

To embed the book into your template, use php code ' . esc_attr('') . '

'; } } } } else if ( isset($_POST['flipbook-upload-url']) ) { if ( !isset($_POST['flipbook-zip-url']) || strlen($_POST['flipbook-zip-url']) == 0) { echo '

' . __('Please specify a URL of ZIP file created with Flip Book', 'flipbook') . '

'; } else { $accepted_status_codes = array( 200, 301, 302 ); $response = wp_remote_head( $_POST['flipbook-zip-url'] ); if ( is_wp_error( $response ) || !in_array( wp_remote_retrieve_response_code( $response ), $accepted_status_codes ) ) { echo '

' . __('The specified URL does not exist', 'flipbook') . '

'; } else { $uploadfile = fopen($_POST['flipbook-zip-url'], "r"); if ( !$uploadfile ) { echo '

' . __('The specified URL does not exist', 'flipbook') . '

'; } else { $uploads = wp_upload_dir(); $zipfile = $uploads['basedir'] . '/flipbook/flipbook-url-upload.zip'; while ( !feof($uploadfile) ) { file_put_contents($zipfile, fread($uploadfile, 4096), FILE_APPEND); } fclose($uploadfile); $id = ( isset($_POST['flipbook-replace']) && ($_POST['flipbook-replace'] == 'yes') && isset($_POST['flipbook-replace-id']) ) ? ($_POST['flipbook-replace-id']) : -1; $ret = $this->controller->install_book($zipfile, $id); if ( is_wp_error($ret) ) { echo '

' . $ret->get_error_message() . '

'; } else { if ( $ret["new"] ) echo '

This is a new version Flip Book WordPress Plugin. In addition to adding the book here, you also need to update the Plugin itself. Fore more inforamtion, visit How to update Flip Book WordPress Plugin.

'; echo '

The book is successfully installed.   View The Book

'; echo '

To embed the book into your page, use shortcode [flipbook id="' . $ret["id"] . '"]

'; echo '

To embed the book into your template, use php code ' . esc_attr('') . '

'; } } } } } else if ( isset($_POST['flipbook-upload-folder']) ) { if ( !isset($_POST['flipbook-zip-folder']) || strlen(trim($_POST['flipbook-zip-folder'])) == 0) { echo '

' . __('Please specify a folder for the unzipped plugin files', 'flipbook') . '

'; } else { $install_folder = trim($_POST['flipbook-zip-folder']); $id = ( isset($_POST['flipbook-replace']) && ($_POST['flipbook-replace'] == 'yes') && isset($_POST['flipbook-replace-id']) ) ? ($_POST['flipbook-replace-id']) : -1; $ret = $this->controller->install_book_from_folder($install_folder, $id); if ( is_wp_error($ret) ) { echo '

' . $ret->get_error_message() . '

'; } else { if ( $ret["new"] ) echo '

This is a new version Flip Book WordPress Plugin. In addition to adding the book here, you also need to update the Plugin itself. Fore more inforamtion, visit How to update Flip Book WordPress Plugin.

'; echo '

The book is successfully installed.   View The Book

'; echo '

To embed the book into your page, use shortcode [flipbook id="' . $ret["id"] . '"]

'; echo '

To embed the book into your template, use php code ' . esc_attr('') . '

'; } } } } ?>

Show All Books


Add New

process_delete_action(); ?>
list_table) ) $this->list_table = new FlipBook_List_Table($this); $this->list_table->list_data = $this->controller->get_list_data(); $this->list_table->prepare_items(); $this->list_table->display(); ?>
controller->delete_book($id); if ($ret > 0) $deleted += $ret; } } else { $deleted = $this->controller->delete_book( $_REQUEST['bookid'] ); } } if ($deleted > 0) { echo '

'; printf( _n('%d book deleted.', '%d books deleted.', $deleted), $deleted ); echo '

'; } } function view_book() { if ( !isset( $_REQUEST['bookid'] ) ) return; ?>

Show All Books Add New

To embed the book into your page, use shortcode

To embed the book into your template, use php code '); ?>

controller->generate_body_code_Preview( $_REQUEST['bookid'] ); ?>