$90 GRAYBYTE WORDPRESS FILE MANAGER $91

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/MultiFormGoals/MultiFormGoal/

HOME
Current File : /home/bravetechrwanda/itiministry.org/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 . 'build/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;
    }
}

Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 12.00 AM
root / root
0
Block.php
0.736 KB
24 Nov 2021 4.55 AM
bravetechrwanda / bravetechrwanda
0644
Model.php
3.415 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644
Shortcode.php
3.374 KB
31 Mar 2025 11.17 PM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF