getPostId() ); if ( ! defined( 'ET_BUILDER_PRODUCT_VERSION' ) || ! version_compare( '4.9.2', ET_BUILDER_PRODUCT_VERSION, '<=' ) || ! ( function_exists( 'et_core_is_fb_enabled' ) && et_core_is_fb_enabled() ) || ! aioseo()->postSettings->canAddPostSettingsMetabox( $postType ) ) { return; } add_action( 'wp_footer', [ $this, 'addContainers' ] ); add_action( 'wp_footer', [ $this, 'addIframeWatcher' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] ); add_filter( 'script_loader_tag', [ $this, 'addEtTag' ], 10, 2 ); } /** * Enqueue the required scripts for the admin screen. * * @since 4.1.7 * * @return void */ public function enqueueAdmin() { if ( ! aioseo()->helpers->isScreenBase( 'toplevel_page_et_divi_options' ) ) { return; } aioseo()->core->assets->load( 'src/vue/standalone/page-builders/divi-admin/main.js', [], aioseo()->helpers->getVueData() ); aioseo()->main->enqueueTranslations(); } /** * Add et attributes to script tags. * * @since 4.1.7 * * @param string $tag The
'; echo ''; echo ''; echo ''; } /** * Returns whether or not the given Post ID was built with Divi. * * @since 4.1.7 * * @param int $postId The Post ID. * @return boolean Whether or not the Post was built with Divi. */ public function isBuiltWith( $postId ) { if ( ! function_exists( 'et_pb_is_pagebuilder_used' ) ) { return false; } return et_pb_is_pagebuilder_used( $postId ); } /** * Returns the Divi edit url for the given Post ID. * * @since 4.3.1 * * @param int $postId The Post ID. * @return string The Edit URL. */ public function getEditUrl( $postId ) { if ( ! function_exists( 'et_fb_get_vb_url' ) ) { return ''; } $isDiviLibrary = 'et_pb_layout' === get_post_type( $postId ); $editUrl = $isDiviLibrary ? get_edit_post_link( $postId, 'raw' ) : get_permalink( $postId ); if ( et_pb_is_pagebuilder_used( $postId ) ) { $editUrl = et_fb_get_vb_url( $editUrl ); } else { if ( ! et_pb_is_allowed( 'divi_builder_control' ) ) { // Prevent link when user lacks `Toggle Divi Builder` capability. return ''; } $editUrl = add_query_arg( [ 'et_fb_activation_nonce' => wp_create_nonce( 'et_fb_activation_nonce_' . $postId ) ], $editUrl ); } return $editUrl; } /** * Checks whether or not we should prevent the date from being modified. * * @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_et_fb_ajax_save` action. if ( empty( $_REQUEST['et_fb_save_nonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['et_fb_save_nonce'] ), 'et_fb_save_nonce' ) ) { return false; } $editorPostId = ! empty( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; if ( $editorPostId !== $postId ) { return false; } return ! empty( $_REQUEST['options']['conditional_tags']['aioseo_limit_modified_date'] ); } }