Server IP : 192.158.238.246 / Your IP : 18.119.131.131 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/jenniferflocom/www/wp-content/plugins/gutenkit-blocks-addon/includes/Core/ |
Upload File : |
<?php namespace Gutenkit\Core; defined('ABSPATH') || exit; /** * Block registrar. * * Call assosiated classes of every blocks. * * @since 1.0.0 * @access public */ class BuildBlocks { /** * Collection of default blocks. * * @since 1.0.0 * @access private */ private $blocks; /** * The name of the option used to store the list of blocks in Gutenkit. * * @since 1.0.0 * @access private * @var string */ private $option_name = 'gutenkit_blocks_list'; /** * Hold the block list. * * @since 1.0.0 * @access public * @static */ public function __construct() { $this->blocks = \Gutenkit\Config\BlockList::instance()->get_list(); $saved_blocks = get_option($this->option_name); if (!$saved_blocks || empty($saved_blocks)) { add_option($this->option_name, $this->blocks); } else { $differences = wp_parse_args($this->blocks, $saved_blocks); foreach ($saved_blocks as $key => $block) { if (!isset($this->blocks[$key])) { unset($differences[$key]); } else { $differences[$key]['status'] = isset($saved_blocks[$key]['status']) ? $saved_blocks[$key]['status'] : 'inactive'; } } // check if $differences & $saved_blocks has no difference then return otherwise update option if (serialize($differences) === serialize($saved_blocks)) { return; } else { update_option($this->option_name, $differences); } } } }