lace( 'var aioseo = ', '', substr( $data, 0, -1 ) ), true ); } $nonce = wp_create_nonce( "aioseo_meta_{$columnName}_{$postId}" ); $posts = ! empty( $data['posts'] ) ? $data['posts'] : []; $thePost = Models\Post::getPost( $postId ); $postType = get_post_type( $postId ); $postData = [ 'id' => $postId, 'columnName' => $columnName, 'nonce' => $nonce, 'title' => $thePost->title, 'titleParsed' => aioseo()->meta->title->getPostTitle( $postId ), 'defaultTitle' => aioseo()->meta->title->getPostTypeTitle( $postType ), 'description' => $thePost->description, 'descriptionParsed' => aioseo()->meta->description->getPostDescription( $postId ), 'defaultDescription' => aioseo()->meta->description->getPostTypeDescription( $postType ), 'value' => (int) $thePost->seo_score, 'showMedia' => false, 'isSpecialPage' => aioseo()->helpers->isSpecialPage( $postId ), 'postType' => $postType ]; foreach ( aioseo()->addons->getLoadedAddons() as $loadedAddon ) { if ( isset( $loadedAddon->admin ) && method_exists( $loadedAddon->admin, 'renderColumnData' ) ) { $postData = array_merge( $postData, $loadedAddon->admin->renderColumnData( $columnName, $postId, $postData ) ); } } $posts[] = $postData; $data['posts'] = $posts; $wp_scripts->add_data( 'aioseo/js/' . $this->scriptSlug, 'data', '' ); wp_localize_script( 'aioseo/js/' . $this->scriptSlug, 'aioseo', $data ); require AIOSEO_DIR . '/app/Common/Views/admin/posts/columns.php'; } /** * Checks whether the AIOSEO Details column should be registered. * * @since 4.0.0 * * @return bool Whether the column should be registered. */ public function shouldRegisterColumn( $screen, $postType ) { if ( 'type' === $postType ) { $postType = '_aioseo_type'; } if ( 'edit' === $screen || 'upload' === $screen ) { if ( aioseo()->options->advanced->postTypes->all && in_array( $postType, aioseo()->helpers->getPublicPostTypes( true ), true ) ) { return true; } $postTypes = aioseo()->options->advanced->postTypes->included; if ( in_array( $postType, $postTypes, true ) ) { return true; } } return false; } }