| 1 |
<?php |
| 2 |
/** |
| 3 |
* Pagination class for Smart Post Show Blocks. |
| 4 |
* |
| 5 |
* @package Smart_Post_Show |
| 6 |
* @subpackage Smart_Post_Show/blocks/includes |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SmartPostShow\Blocks; |
| 10 |
|
| 11 |
use SmartPostShow\Blocks\Helper; |
| 12 |
|
| 13 |
use SmartPostShow\Blocks\Block_Base; |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
/** |
| 20 |
* Pagination block for Smart Post Show. |
| 21 |
* |
| 22 |
* Handles the pagination logic for Smart Post Show blocks. |
| 23 |
*/ |
| 24 |
class Pagination extends Block_Base { |
| 25 |
/** |
| 26 |
* Set_block_properties |
| 27 |
* |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
protected function set_block_properties() { |
| 31 |
$this->block_name = 'pagination'; |
| 32 |
$this->styles = array( 'sp_smart_post_blocks_google_fonts' ); |
| 33 |
} |
| 34 |
/** |
| 35 |
* Block render function. |
| 36 |
* |
| 37 |
* @param array $attributes attributes. |
| 38 |
* @param string $content Content to be rendered. |
| 39 |
* @param string $blocks Nested blocks. |
| 40 |
* @return string Rendered HTML content. |
| 41 |
*/ |
| 42 |
public function render_block( $attributes, $content = '', $blocks = array() ) { |
| 43 |
if ( Helper::is_editor_page() ) { |
| 44 |
return $content; |
| 45 |
} |
| 46 |
|
| 47 |
ob_start(); |
| 48 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- The HTML output is already properly escaped at the time of generation, so additional escaping is not required here. |
| 49 |
echo Template_Part::pagination_block_html( $attributes ); |
| 50 |
return ob_get_clean(); |
| 51 |
} |
| 52 |
} |
| 53 |
|