instance for the given Post ID. * * @since 4.3.5 * * @param int $postId The Post ID. * @return object The Elementor Document instance. */ private function getElementorDocument( $postId ) { if ( ! class_exists( '\Elementor\Plugin' ) || ! is_object( \Elementor\Plugin::instance()->documents ) || ! method_exists( \Elementor\Plugin::instance()->documents, 'get' ) ) { return false; } $elementorDocument = \Elementor\Plugin::instance()->documents->get( $postId ); if ( empty( $elementorDocument ) ) { return false; } return $elementorDocument; } /** * Checks whether or not we should prevent the date from being modified. * This method is supposed to be used in the `wp_ajax_seedprod_pro_save_lpage` action. * * @since 4.5.2 * * @param int $postId The Post ID. * @return bool Whether or not we should prevent the date from being modified. */ public function limitModifiedDate( $postId ) { // This method is supposed to be used in the `wp_ajax_elementor_ajax` action. if ( empty( $_REQUEST['_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_nonce'] ) ), 'elementor_ajax' ) ) { return false; } $editorPostId = ! empty( $_REQUEST['editor_post_id'] ) ? (int) $_REQUEST['editor_post_id'] : false; if ( $editorPostId !== $postId ) { return false; } return ! empty( $_REQUEST['aioseo_limit_modified_date'] ); } /** * Get the post ID. * * @since 4.6.9 * * @return int|null The post ID or null. */ public function getPostId() { // phpcs:disable HM.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Recommended if ( aioseo()->helpers->isAjaxCronRestRequest() ) { foreach ( [ 'editor_post_id', 'initial_document_id' ] as $key ) { if ( ! empty( $_REQUEST[ $key ] ) ) { return intval( wp_unslash( $_REQUEST[ $key ] ) ); } } } // phpcs:enable return parent::getPostId(); } }