HEX
Server: Apache/2.4.65 (Debian)
System: Linux web6 5.10.0-36-amd64 #1 SMP Debian 5.10.244-1 (2025-09-29) x86_64
User: innocamp (1028)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/csm/public_html/wp-content/plugins/wordpress-popup/inc/class-hustle-meta.php
<?php
/**
 * File for Hustle_Meta class.
 *
 * @package Hustle
 * @since unkown
 */

/**
 * Abstract Hustle_Meta class.
 * Extended by each handler of the modules' metas.
 *
 * When creating a new meta property:
 * -Booleans properties must be '0' and '1', as strings. Make sure they're also stored in this way when saving.
 */
abstract class Hustle_Meta {

	/**
	 * The meta's saved value.
	 *
	 * @since unknown
	 *
	 * @var array
	 */
	protected $data;

	/**
	 * Current module.
	 *
	 * @since unknown
	 * @var Hustle_Model
	 */
	protected $module;

	/**
	 * Hustle_Meta constructos.
	 *
	 * @param array        $data The saved meta's value.
	 * @param Hustle_Model $model Instance of the module this meta belongs to.
	 */
	public function __construct( array $data, Hustle_Model $model ) {
		$this->data   = $data;
		$this->module = $model;
	}

	/**
	 * Return an array with the default values.
	 * Must be overridden to return an array of default values
	 * without restricting them to static values.
	 *
	 * @since 4.0.0
	 *
	 * @return array
	 */
	abstract public function get_defaults();

	/**
	 * Returns the defaults for merging purposes.
	 * Allows handling unwanted overrides of the saved data.
	 *
	 * @since 4.4.1
	 *
	 * @return array
	 */
	protected function get_defaults_for_merge() {
		return $this->get_defaults();
	}

	/**
	 * Returns the meta value with the defaults as fallback.
	 * Useful for introducing new values without things exploding.
	 *
	 * @since unknown
	 *
	 * @todo Rename this method. It's inaccurate.
	 *
	 * @return array
	 */
	public function to_array() {
		$defaults = $this->get_defaults_for_merge();
		if ( $defaults ) {
			$data = array_replace_recursive( $defaults, $this->data );
		} else {
			$data = $this->data;
		}

		if ( ! empty( $data['schedule'] ) ) {
			array_walk_recursive(
				$data['schedule'],
				function ( &$val ) {
					$val = esc_attr( $val );
				}
			);
		}

		return $data;
	}
}