403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.117.250.210
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 :  /proc/thread-self/root/proc/7779/cwd/plugins/give/src/MultiFormGoals/MultiFormGoal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/thread-self/root/proc/7779/cwd/plugins/give/src/MultiFormGoals/MultiFormGoal/Shortcode.php
<?php

namespace Give\MultiFormGoals\MultiFormGoal;

use Give\MultiFormGoals\MultiFormGoal\Model as MultiFormGoal;

class Shortcode
{

    /**
     * @since 2.9.6 Extracted from harded-coded value in `addShortcode()`.
     * @var string Shortcode tag to be searched in post content.
     * */
    protected $tag = 'give_multi_form_goal';

    /**
     * Registers Multi-Form Goal Shortcode
     *
     * @since 2.9.0
     **/
    public function addShortcode()
    {
        add_shortcode($this->tag, [$this, 'renderCallback']);
    }

    /**
     * Returns Shortcode markup
     *
     * @since 3.7.0 Sanitize attributes
     * @since 3.0.3 Use static function on array_map callback to pass the id as reference for _give_redirect_form_id to prevent warnings on PHP 8.0.1 or plus
     * @since 2.9.0
     **/
    public function renderCallback($attributes)
    {
        $attributes = give_clean($attributes);

        $attributes = $this->parseAttributes(
            [
                'ids' => [],
                'tags' => [],
                'categories' => [],
                'goal' => '1000',
                'enddate' => '',
                'color' => '#28c77b',
                'heading' => 'Example Heading',
                'image' => GIVE_PLUGIN_URL . 'assets/dist/images/onboarding-preview-form-image.min.jpg',
                'summary' => 'This is a summary.',

            ],
            $attributes,
            'give_multi_form_goal'
        );

        $multiFormGoal = new MultiFormGoal(
            [
                'ids' => array_map(
                    static function ($id) {
                        _give_redirect_form_id($id);

                        return $id;
                    },
                    $attributes['ids']
                ),
                'tags' => $attributes['tags'],
                'categories' => $attributes['categories'],
                'goal' => $attributes['goal'],
                'enddate' => $attributes['enddate'],
                'color' => $attributes['color'],
                'heading' => $attributes['heading'],
                'imageSrc' => $attributes['image'],
                'summary' => $attributes['summary'],
            ]
        );

        return $multiFormGoal->getOutput();
    }

    /**
     * Parse multiple attributes with defualt values and types (infered from the default values).
     * @link https://developer.wordpress.org/reference/functions/shortcode_atts/
     * @since 2.9.6
     *
     * @param array $pairs Entire list of supported attributes and their defaults.
     * @param array $attributes User defined attributes.
     *
     * @reutrn array
     */
    protected function parseAttributes($pairs, $attributes)
    {
        if ($attributes) {
            foreach ($attributes as $key => &$attribute) {
                if (isset($pairs[$key]) && is_array($pairs[$key])) {
                    $attribute = $this->parseAttributeArray($attribute);
                }
            }
        }

        return shortcode_atts($pairs, $attributes, $this->tag);
    }

    /**
     * Parses an individual attributes as an array (or from a comma-separated string).
     * @since 2.9.6
     *
     * @param string|array $value
     *
     * @return array
     */
    protected function parseAttributeArray($value)
    {
        if ( ! is_array($value) && ! empty($value)) {
            $value = explode(',', $value);
        }

        return $value;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit