/** * Save page. * @since 1.0.0 * * @param int $post_id Post id. */ public function save($post_id) { // Is valid save ? $nonce = Request::input('metabox_addon_nonce', '', true); if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || empty($nonce) || !wp_verify_nonce($nonce, 'metabox_addon')) { return; } $addon = Addon::find($post_id); $addon->description = Request::input('description'); $addon->composer = Request::input('composer'); $addon->bower = Request::input('bower'); $addon->url = Request::input('url'); $addon->download_url = Request::input('download_url'); $addon->version = Request::input('version'); $addon->supported_version = Request::input('supported_version'); $addon->github_username = Request::input('github_username'); $addon->github_repo = Request::input('github_repo'); $addon->save(); }
/** * Displays the addon metabox. * @since 1.0.0 * * @param object $post WP_Post. */ public function metabox_addon($post) { wp_nonce_field('metabox_addon', 'metabox_addon_nonce'); $this->view->show('admin.metaboxes.addon', ['addon' => Addon::find($post->ID)]); }