init_hooks(); } private function init_hooks() { if( wpforo_setting( 'posting', 'is_preview_on' ) || wpforo_setting( 'posting', 'is_draft_on' ) ) { add_action( 'wpforo_editor_topic_submit_after', [ $this, 'show_html_into_form' ] ); add_action( 'wpforo_editor_post_submit_after', [ $this, 'show_html_into_form' ] ); add_action( 'wpforo_portable_editor_post_submit_after', [ $this, 'show_html_into_form' ] ); } } private function build_wrap_inner_html( $revisions_count = null ) { $buttons = ''; if( wpforo_setting( 'posting', 'is_preview_on' ) ) { $buttons .= sprintf( '', wpforo_phrase( 'Preview', false ) ); } if( wpforo_setting( 'posting', 'is_draft_on' ) ) { $revisions_count = intval( $revisions_count ); $buttons .= sprintf( '', sprintf( wpforo_phrase( '%1$s Revisions', false ), '' . $revisions_count . '' ) ) . sprintf( '', wpforo_phrase( 'Save Draft', false ) ) . sprintf( '', wpforo_phrase( 'Saved', false ) ); } return sprintf( '
', $buttons ); } private function show_wrap_inner_html( $revisions_count = null ) { echo $this->build_wrap_inner_html( $revisions_count ); } public function show_html_into_form() { if( wpforo_setting( 'posting', 'is_draft_on' ) ) { $args = [ // 'textareaids_include' => (string) wpfval( $_POST, 'textareaid' ), 'postids_include' => wpforo_bigintval( wpfval( $_POST, 'postid' ) ), 'userids_include' => WPF()->current_userid, 'emails_include' => WPF()->current_user_email, 'urls_include' => WPF()->revision->get_current_url_query_vars_str(), ]; $revisions_count = wpforo_ram_get( [ WPF()->revision, 'get_count' ], $args ); } else { $revisions_count = null; } ?>