| @@ -136,18 +136,18 @@ | ||
| 136 | 136 | * |
| 137 | 137 | * @since 2.0.0 |
| 138 | 138 | * @access public |
| 139 | 139 | * |
| 140 | - * @param string $type Document type name. | |
| 141 | - * @param string $class_name The name of the class that registers the document type. | |
| 142 | - * Full name with the namespace. | |
| 140 | + * @param string $type Document type name. | |
| 141 | + * @param string $class The name of the class that registers the document type. | |
| 142 | + * Full name with the namespace. | |
| 143 | 143 | * |
| 144 | 144 | * @return Documents_Manager The updated document manager instance. |
| 145 | 145 | */ |
| 146 | - public function register_document_type( $type, $class_name ) { | |
| 147 | - $this->types[ $type ] = $class_name; | |
| 146 | + public function register_document_type( $type, $class ) { | |
| 147 | + $this->types[ $type ] = $class; | |
| 148 | 148 | |
| 149 | - $cpt = $class_name::get_property( 'cpt' ); | |
| 149 | + $cpt = $class::get_property( 'cpt' ); | |
| 150 | 150 | |
| 151 | 151 | if ( $cpt ) { |
| 152 | 152 | foreach ( $cpt as $post_type ) { |
| 153 | 153 | $this->cpt[ $post_type ] = $type; |
| @@ -153,9 +153,9 @@ | ||
| 153 | 153 | $this->cpt[ $post_type ] = $type; |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if ( $class_name::get_property( 'register_type' ) ) { | |
| 157 | + if ( $class::get_property( 'register_type' ) ) { | |
| 158 | 158 | Source_Local::add_template_type( $type ); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | return $this; |
| @@ -274,9 +274,9 @@ | ||
| 274 | 274 | * @return false|Document The document if it exist, False otherwise. |
| 275 | 275 | */ |
| 276 | 276 | public function get_doc_for_frontend( $post_id ) { |
| 277 | 277 | $preview_id = (int) Utils::get_super_global_value( $_GET, 'preview_id' ); |
| 278 | - $is_preview = is_preview(); | |
| 278 | + $is_preview = is_preview() && $post_id === $preview_id; | |
| 279 | 279 | $is_nonce_verify = wp_verify_nonce( Utils::get_super_global_value( $_GET, 'preview_nonce' ), 'post_preview_' . $preview_id ); |
| 280 | 280 | |
| 281 | 281 | if ( ( $is_preview && $is_nonce_verify ) || Plugin::$instance->preview->is_preview_mode() ) { |
| 282 | 282 | $document = $this->get_doc_or_auto_save( $post_id, get_current_user_id() ); |