<?php

// Exit if accessed directly.
if (!defined('ABSPATH')) exit;

class Sh_Blocks_Base
{
    public function getBlockName() {
        return $this->block_name;
    }

    public function getBlockTitle() {
        return $this->block_title;
    }

    public function isCaching() {
        return $this->is_caching;
    }

    public function isConfig() {
        return $this->is_config;
    }

    public function getConfig() {
        $config = [
            'page_title' => '',
            'menu_title' => '',
            'order' => '',
        ];

        if ($this->is_config) {
            $config['page_title'] = $this->config_page_title;
            $config['menu_title'] = $this->config_menu_title;
            $config['order'] = $this->config_menu_order;
        }

        return $config;
    }

    public function getLogDebug($params) {
        global $shr;
        $shr = (!empty($shr)) ? $shr : Sportshub_Recaps::instance();

        if (isset($params['type_game']) && $shr->helpers->shr_debug_blocks_games($params)) {
            echo '<div class="shr-blocks">';
            echo '<!-- SH Recaps/SH Recap: '.$params['type_game'].' ';
            print_r($params['data']);
            echo '-->';

            if (isset($params['invalid_fields']) && is_array($params['invalid_fields']) && count($params['invalid_fields']) > 0) {
                echo '<!-- Invalid Fields ';
                print_r($params['invalid_fields']);
                echo '-->';
            }

            echo '</div>';
        }
    }

    public function isStylesLoad() {
        if (property_exists($this, 'is_styles_load')) {
            return $this->is_styles_load;
        } else {
            return false;
        }
    }
}
