<?php

namespace Fab\Feature;

! defined( 'WPINC ' ) or die;

/**
 * Initiate plugins
 *
 * @package    Fab
 * @subpackage Fab\Includes
 */

class Hooks extends Feature {

    /**
     * Feature construect
     *
     * @return void
     * @var    object   $plugin     Feature configuration
     * @pattern prototype
     */
    public function __construct() {
        parent::__construct();
        $this->key         = 'core_hooks';
        $this->name        = 'Hooks';
        $this->description = 'Handles plugin hooks management';
    }

    /**
     * Sanitize input
     */
    public function sanitize() {
        /** Grab Data */
        $this->params = $_POST;
        $this->params = $this->params['fab_hooks'];

        /** Sanitize Text Field */
        $this->params = (object) \FAB()->Helper->sanitizeTextField( $this->params );
    }

    /**
     * Transform data before save
     */
    public function transform() {
        /** Validate active/inactive asset */
        $this->params = (object) \FAB()->Helper->transformBooleanValue( (array) $this->params );

        return $this->params;
    }
}
