Merge pull request #3 from tainacan/refactoring_php_source

fix: refactor php
This commit is contained in:
Mateus Machado Luna 2021-04-27 14:31:43 -03:00 committed by GitHub
commit 9d7d97ebfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 56 deletions

View File

@ -28,9 +28,8 @@ function tainacan_blocksy_enqueue_scripts() {
// This should only happen if we have Tainacan plugin installed // This should only happen if we have Tainacan plugin installed
if ( defined ('TAINACAN_VERSION') ) { if ( defined ('TAINACAN_VERSION') ) {
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers(); // $collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
$post_type = get_post_type(); // $post_type = get_post_type();
wp_enqueue_script( 'tainacan-blocksy-scripts', TAINACAN_BLOCKSY_PLUGIN_URL_PATH . '/js/scripts.js', array(), TAINACAN_BLOCKSY_VERSION, true ); wp_enqueue_script( 'tainacan-blocksy-scripts', TAINACAN_BLOCKSY_PLUGIN_URL_PATH . '/js/scripts.js', array(), TAINACAN_BLOCKSY_VERSION, true );
} }
} }

View File

@ -11,7 +11,6 @@ if (! function_exists('blc_call_fnc')) {
$args, $args,
[ [
'fnc' => null, 'fnc' => null,
// string | null | array // string | null | array
'default' => '' 'default' => ''
] ]

View File

@ -134,8 +134,6 @@ if ( !function_exists('blocksy_default_post_navigation') ) {
] ]
)); ));
$home_page_url = get_home_url();
$post_slug = get_post_type() === 'post' ? __( 'Post', 'blocksy' ) : get_post_type_object( get_post_type() )->labels->singular_name; $post_slug = get_post_type() === 'post' ? __( 'Post', 'blocksy' ) : get_post_type_object( get_post_type() )->labels->singular_name;
$post_slug = '<span>' . $post_slug . '</span>'; $post_slug = '<span>' . $post_slug . '</span>';
@ -188,14 +186,14 @@ if ( !function_exists('blocksy_default_post_navigation') ) {
?> ?>
<nav class="<?php echo esc_attr( $container_class ); ?>"> <nav class="<?php echo esc_attr( $container_class ); ?>">
<?php if ($next_post) { ?> <?php if ($next_post): ?>
<a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev"> <a href="<?php echo esc_url(get_permalink($next_post)); ?>" class="nav-item-prev">
<?php if ($has_thumb) { ?> <?php if ($has_thumb): ?>
<?php <?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $next_post_image_output; echo $next_post_image_output;
?> ?>
<?php } ?> <?php endif; ?>
<div class="item-content"> <div class="item-content">
<span class="item-label"> <span class="item-label">
@ -208,19 +206,19 @@ if ( !function_exists('blocksy_default_post_navigation') ) {
?> ?>
</span> </span>
<?php if ( ! empty( $next_title ) ) { ?> <?php if ( ! empty( $next_title ) ): ?>
<span class="item-title"> <span class="item-title">
<?php echo wp_kses_post($next_title); ?> <?php echo wp_kses_post($next_title); ?>
</span> </span>
<?php } ?> <?php endif; ?>
</div> </div>
</a> </a>
<?php } else { ?> <?php else: ?>
<div class="nav-item-prev"></div> <div class="nav-item-prev"></div>
<?php } ?> <?php endif; ?>
<?php if ( $previous_post ) { ?> <?php if ( $previous_post ) : ?>
<a href="<?php echo esc_url( get_permalink( $previous_post ) ); ?>" class="nav-item-next"> <a href="<?php echo esc_url( get_permalink( $previous_post ) ); ?>" class="nav-item-next">
<div class="item-content"> <div class="item-content">
<span class="item-label"> <span class="item-label">
@ -233,22 +231,20 @@ if ( !function_exists('blocksy_default_post_navigation') ) {
?> ?>
</span> </span>
<?php if ( ! empty( $previous_title ) ) { ?> <?php if ( ! empty( $previous_title ) ) : ?>
<span class="item-title"> <span class="item-title">
<?php echo wp_kses_post($previous_title); ?> <?php echo wp_kses_post($previous_title); ?>
</span> </span>
<?php } ?> <?php endif; ?>
</div> </div>
<?php if ($has_thumb) { ?> <?php if ($has_thumb) : ?>
<?php <?php echo $previous_post_image_output; ?>
echo $previous_post_image_output; <?php endif; ?>
?>
<?php } ?>
</a> </a>
<?php } else { ?> <?php else : ?>
<div class="nav-item-next"></div> <div class="nav-item-next"></div>
<?php } ?> <?php endif; ?>
</nav> </nav>
@ -296,23 +292,21 @@ if ( !function_exists('tainacan_blocksy_item_navigation') ) {
$next = $adjacent_links['next']; $next = $adjacent_links['next'];
} }
?>
<?php if ($previous !== '' || $next !== '') : ?>
<nav class="<?php echo esc_attr( $container_class ); ?>">
<?php if ( $previous !== '' ) {
echo $previous;
} else { ?>
<div class="nav-item-prev"></div>
<?php } ?>
<?php if ( $next !== '' ) { if ($previous !== '' || $next !== '') {
echo '<nav class="' . esc_attr( $container_class ) . '">';
if ( $previous !== '' ) {
echo $previous;
} else {
echo '<div class="nav-item-prev"></div>';
}
if ( $next !== '' ) {
echo $next; echo $next;
} else { ?> } else {
<div class="nav-item-next"></div> echo '<div class="nav-item-next"></div>';
<?php } ?> }
</nav> echo '</nav>';
<?php endif; ?> };
<?php
} }
} }