403Webshell
Server IP : 172.67.158.161  /  Your IP : 18.188.202.155
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/giankuin/sieuthiweb.com.vn/wp-content/plugins/wpai-acf-add-on/src/groups/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/giankuin/sieuthiweb.com.vn/wp-content/plugins/wpai-acf-add-on/src/groups/Group.php
<?php

namespace wpai_acf_add_on\groups;

use wpai_acf_add_on\fields\Field;
use wpai_acf_add_on\fields\FieldFactory;

/**
 * Class Group
 * @package wpai_acf_add_on\groups
 */
abstract class Group implements GroupInterface {

    /**
     * @var
     */
    public $post;

    /**
     * @var
     */
    public $group;

    /**
     * @var array
     */
    public $fields = array();

    /**
     * @var array
     */
    public $fieldsData = array();

    /**
     * Group constructor.
     * @param $group
     */
    public function __construct($group, $post) {
        $this->group = $group;
        $this->post = $post;
        $this->initFields();
    }

    /**
     *  Create field instances
     */
    public function initFields(){
        foreach ($this->getFieldsData() as $fieldData){
            $field = FieldFactory::create($fieldData, $this->getPost());
            $this->fields[] = $field;
        }
    }

    /**
     * @return array
     */
    public function getFieldsData()
    {
        return $this->fieldsData;
    }

    /**
     * @return array
     */
    public function getFields() {
        return $this->fields;
    }

    /**
     * @return mixed
     */
    public function getPost() {
        return $this->post;
    }

    /**
     *  Render group
     */
    public function view() {
        $this->renderHeader();
        foreach ($this->getFields() as $field){
            $field->view();
        }
        $this->renderFooter();
    }

    /**
     *  Render group header
     */
    protected function renderHeader(){
        $filePath = __DIR__ . '/templates/header.php';
        if (is_file($filePath)) {
            extract($this->group);
            include $filePath;
        }
    }

    /**
     *  Render group footer
     */
    protected function renderFooter(){
        $filePath = __DIR__ . '/templates/footer.php';
        if (is_file($filePath)) {
            include $filePath;
        }
    }

    /**
     * @param $parsingData
     * @return array
     */
    public function parse($parsingData) {
        /** @var Field $field */
        foreach ($this->getFields() as $field){
            $xpath = empty($parsingData['import']->options['fields'][$field->getFieldKey()]) ? "" : $parsingData['import']->options['fields'][$field->getFieldKey()];
            $field->parse($xpath, $parsingData);
        }
    }

    /**
     * @param $importData
     * @param array $args
     */
    public function import($importData, $args = array()) {
        /** @var Field $field */
        foreach ($this->getFields() as $field){
            $field->import($importData, $args);
        }
    }

    /**
     * @param $importData
     */
    public function saved_post($importData){
        /** @var Field $field */
        foreach ($this->getFields() as $field){
            $field->saved_post($importData);
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit