first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace WPML\TM\Menu;
use SitePress;
use WPML\FP\Cast;
use WPML\FP\Fns;
use WPML\FP\Lst;
use WPML\FP\Maybe;
use WPML\FP\Obj;
use WPML\FP\Relation;
use WPML\LIB\WP\User;
use WPML\LIB\WP\Post;
use function WPML\FP\pipe;
class PostLinkUrl {
/**
* @param int $postId
*
* @return string
*/
public function viewLinkUrl( $postId ) {
return Maybe::of( $postId )
->map( Post::get() )
->reject( pipe( Obj::prop( 'post_status' ), Lst::includes( Fns::__, [
'private',
'trash',
] ) ) )
->map( 'get_permalink' )
->getOrElse( '' );
}
}