Plugin Directory

Changeset 2926915


Ignore:
Timestamp:
06/16/2023 06:45:43 AM (3 years ago)
Author:
advancedgridbuilder
Message:

reverting

Location:
agb-free/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • agb-free/trunk/agb-free.php

    r2926896 r2926915  
    77 *
    88 * @wordpress-plugin
    9  * Plugin Name:       Advanced Grid Builder
     9 * Plugin Name:       AGB Free
    1010 * Plugin URI:        https://www.advancedgridbuilder.com
    1111 * Description:       The ultimate grid and list generator for all Wordpress content types
    12  * Version:           4.5.0
     12 * Version:           4.1.0
    1313 * License:           GPL-2.0+
    1414 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
  • agb-free/trunk/dyg-form/includes/class-dyg-form.php

    r2926907 r2926915  
    55 */
    66
    7 require_once ABSPATH . 'wp-includes/pluggable.php';
     7require_once( ABSPATH . 'wp-includes/pluggable.php' );
    88
    99class dyg_form {
     
    2020        $this->form_name = $form_name;
    2121
    22         $this->prefill_values = ($this->form_data->settings->prefill ?? 'false') == 'true';
    23         $this->prefill_values = current_user_can('manage_options') ? $this->prefill_values : FALSE; //for safety, never load prefills for non admin
    24         if (!isset($this->form_data->settings)) {
    25             $this->form_data->settings = new stdClass();
    26         }
    27 
     22        $this->prefill_values             = ($this->form_data->settings->prefill ?? 'false' ) == 'true';
     23        $this->prefill_values             = current_user_can('manage_options') ? $this->prefill_values : FALSE; //for safety, never load prefills for non admin
     24        if (!isset($this->form_data->settings))
     25            $this->form_data->settings        = new stdClass();
    2826        $this->form_data->settings->store = $this->prefill_values ? TRUE : ($this->form_data->settings->store ?? 'true') == 'true'; //force storing the form to true if prefilling
    2927        $this->message_element            = false; //flags if the form contains the location of the message div
    3028        $this->instance                   = empty($instance) ? '' : "-$instance";
    3129        $this->form_data                  = apply_filters("dygform-filter-data-{$this->form_name}", $this->form_data);
    32         if (property_exists($this->form_data, '__queue')) {
    33             $queueContents = json_encode($this->form_data->__queue, JSON_PRETTY_PRINT);
    34             die("<p>Error: Queue still exists after processing dygform insert elements. Queue contents:</p><pre>$queueContents</pre>");
    35         }
    36         $this->form_data = apply_filters("dygform-json-load-{$this->form_name}", $this->form_data);
    37         $this->form_data = apply_filters("dygform-json-load-{$this->form_name}-$instance", $this->form_data);
    38         $this->name      = "";
    39         $this->path      = $path;
    40         $this->URI       = $URI;
     30        $this->form_data                  = apply_filters("dygform-json-load-{$this->form_name}", $this->form_data);
     31        $this->form_data                  = apply_filters("dygform-json-load-{$this->form_name}-$instance", $this->form_data);
     32        $this->name                       = "";
     33        $this->path                       = $path;
     34        $this->URI                        = $URI;
    4135
    4236        //used to create unique element ids
     
    5650        $this->process_settings();
    5751    }
     52
     53
    5854
    5955    function enqueue_scripts() {
     
    8278    }
    8379
     80
     81
    8482    function process_settings() {
    8583        $this->form_class = $this->form_data->settings->form_class ?? '';
     
    8987
    9088        //add a nonce based on the form name
    91         $this->add_hidden_input('nonce', wp_create_nonce("dyg-form-nonce-{$this->form_name}{$this->instance}"));
     89        $this->add_hidden_input('nonce', wp_create_nonce("dyg-form-nonce-$this->form_name$this->instance"));
    9290
    9391        //if help icons are in use, has a base directory been set?
     
    105103        }
    106104    }
     105
     106
    107107
    108108    //appends a hidden input field to the form so that it will be passed through to AJAX for later processing
     
    115115    }
    116116
     117
     118
    117119    // handle settings relating to form emails
    118120    function settings_email($data) {
    119121        $defaults = [
    120122            'to'   => "",
    121             "from" => '',
     123            "from" => ''
    122124        ];
    123         $data = shortcode_atts($defaults, $data);
    124     }
    125 
    126     //returns the form html back to the shortcode
     125        $data     = shortcode_atts($defaults, $data);
     126    }
     127
     128
     129
     130    //returns the form html back to the shortcode
    127131    public function shortcode() {
    128         //get the last submission form the database if requested to use as a value
     132        //get the last submission form the database if requested to use as a value 
    129133        if ($this->prefill_values AND class_exists('dyg_form_storage')) {
    130134            global $dyg_form_storage;
     
    152156        return apply_filters("dygform-filter-shortcode-{$this->form_name}$this->instance", "$stripe_key {$element['contains']}");
    153157    }
     158
     159
    154160
    155161    //recursively walks the form data elements
     
    179185            if (!empty($element['type'])) {
    180186                if (!method_exists($this, "element_{$element['type']}")) {
    181                     $x = 1; //breakpoint for debugging
     187                    $x = 1;  //breakpoint for debugging
    182188                }
    183189                $output .= call_user_func([$this, "element_{$element['type']}"], $element);
     
    191197        return $output;
    192198    }
     199
     200
    193201
    194202    //filters the name field prior to walking
     
    201209        //note the $element->type component of the name is used in ajax post processing, so don't change this without considering the consequences
    202210        if (empty($element['name'])) {
    203             $this->name = $element['name'] = "$id";
     211            $this->name      = $element['name'] = "$id";
    204212        }
    205213
    206214        return $element;
    207215    }
     216
     217
    208218
    209219    //filters the id field prior to walking
     
    214224        }
    215225        $this->id         = $id;
    216         $this->element_id = "dygform-{$this->form_name}{$this->instance}-element-$id";
     226        $this->element_id = "dygform-$this->form_name$this->instance-element-$id";
    217227        return $id;
    218228    }
     229
     230
    219231
    220232    //returns the class, data, style etc parameters for an element
     
    227239
    228240        if (isset($element['value'])) {
    229             $value = esc_html($element['value']); //encode any special charactes in VALUE so they are not interpreted as html markup
     241            $value      = esc_html($element['value']); //encode any special charactes in VALUE so they are not interpreted as html markup
    230242            $parameters .= "value='{$value}' ";
    231243        }
     
    309321    }
    310322
     323
     324
    311325    /* markup for a generic label
    312326     */
    313327
    314328    public function get_label($element) {
    315         if (empty($element['label'])) {
     329        if (empty($element['label']))
    316330            return '';
    317         }
    318331
    319332        return strtr("<label class='dygform-label dygform-label-%type%required'>%label%help</label>", [
     
    325338    }
    326339
     340
     341
    327342    /* markup for a help icon
    328343     */
    329344
    330345    public function get_help($element) {
    331         if (!array_key_exists('help', $element)) {
     346        if (!array_key_exists('help', $element))
    332347            return '';
    333         }
    334 
    335348        $slug = ($element['help'] != '' ? $element['help'] : str_replace('_', '-', $this->id));
    336349
     
    340353    }
    341354
     355
     356
    342357    /* markup for a required message
    343358     */
    344359
    345360    public function get_required($element) {
    346         if (empty($element['required-message'])) {
     361        if (empty($element['required-message']))
    347362            return '';
    348         }
    349363
    350364        return strtr("<label class='dygform-message-required'>%required</label>", [
    351             '%required' => esc_attr($element['required-message']),
    352         ]);
    353     }
     365            '%required' => esc_attr($element['required-message'])
     366        ]);
     367    }
     368
     369
    354370
    355371    /* markup for a generic container style
     
    360376    }
    361377
     378
     379
    362380    /* markup for a generic container class
    363381     */
     
    366384        return !empty($element['container-class']) ? dygpg_toolbox::sanitize_classes($element['container-class']) : "";
    367385    }
     386
     387
    368388
    369389    /* surround the supplied html in a container
     
    384404    }
    385405
     406
     407
    386408    /* markup for a button element
    387409     * 'label' is the content inside the button
     
    394416        ]);
    395417    }
     418
     419
    396420
    397421    /* markup for an input tag
     
    409433    }
    410434
     435
     436
    411437    /* markup for a select list list li element
    412438     */
     
    419445    }
    420446
     447
     448
    421449    /* markup for a jquery ui sortable/dragable set of lists
    422450     */
     
    425453
    426454        $input = strtr("<input type='hidden' %parameters>"
    427             . "<div class='dygform-select-list-wrapper'>%label%placeholder<ul class='dygform-included-list'></ul>"
    428             . "<ul class = 'dygform-source-list'>%list</ul></div>%required", [
    429                 '%required'    => $this->get_required($element),
    430                 '%label'       => $this->get_label($element),
    431                 '%placeholder' => $this->get_placeholder_label($element),
    432                 '%parameters'  => $this->get_parameters($element, "dygform-input"),
    433                 '%list'        => $this->walk_elements($element['list']),
    434             ]);
     455                . "<div class='dygform-select-list-wrapper'>%label%placeholder<ul class='dygform-included-list'></ul>"
     456                . "<ul class = 'dygform-source-list'>%list</ul></div>%required", [
     457            '%required'    => $this->get_required($element),
     458            '%label'       => $this->get_label($element),
     459            '%placeholder' => $this->get_placeholder_label($element),
     460            '%parameters'  => $this->get_parameters($element, "dygform-input"),
     461            '%list'        => $this->walk_elements($element['list']),
     462        ]);
    435463        return $this->add_container($element, $input, 'dygform-select-list');
    436464    }
    437465
     466
     467
    438468    /* markup for an textarea tag
    439469     */
    440470
    441471    public function element_textarea($element) {
    442         $placeholder_label = $textarea = strtr("%label%placeholder<textarea %parameters>%contains</textarea>%required", [
     472        $placeholder_label = $textarea          = strtr("%label%placeholder<textarea %parameters>%contains</textarea>%required", [
    443473            '%required'    => $this->get_required($element),
    444474            '%parameters'  => $this->get_parameters($element, "dygform-textarea"),
     
    451481    }
    452482
     483
     484
    453485    /* markup for a div
    454486     */
     
    461493    }
    462494
     495
     496
    463497    /* markup for a field group
    464498     * 'label' is the text label at the top of the div
     
    471505        return "<div $parameters>{$label}{$element['contains']}</div>";
    472506    }
     507
     508
    473509
    474510    /* markup for a select group of radio buttons or checkboxes
     
    484520        return "<div $parameters>{$label}{$options}{$required}</div>";
    485521    }
     522
     523
    486524
    487525    /* markup for a select/option dropdown
     
    498536    }
    499537
     538
     539
    500540    /* markup for a select option group (drop down combo)
    501541     * 'label' is the text label at the top of the div
     
    517557        $e                               = new stdClass();
    518558        $e_id                            = "{$element['id']}-input";
    519         @$e->{$e_id}                     = new stdClass();
    520         @$e->{$e_id}->type               = 'input';
    521         @$e->{$e_id}->{'element-type'}   = 'text';
     559        @$e->{$e_id}                      = new stdClass();
     560        @$e->{$e_id}->type                = 'input';
     561        @$e->{$e_id}->{'element-type'}    = 'text';
    522562        $e->{$e_id}->placeholder         = $element['placeholder'] ?? '';
    523563        $e->{$e_id}->{'data-link'}       = $element['data-link'] ?? '';
     
    530570    }
    531571
     572
     573
    532574    /* markup for a select option
    533575     */
     
    540582        return "<option $parameters>{$element['contains']}</option>";
    541583    }
     584
     585
    542586
    543587    /* markup for a form
     
    552596        $stripe_key = !empty($this->form_data->credit_card) ? dyg_get_publishable_stripe_code() : '';
    553597
    554         return "$stripe_key<form $parameters data-form-name='{$this->form_name}{$this->instance}' data-instance='$this->instance'>{$element['contains']} $message</form>";
    555     }
     598        return "$stripe_key<form $parameters data-form-name='$this->form_name$this->instance' data-instance='$this->instance'>{$element['contains']} $message</form>";
     599    }
     600
     601
    556602
    557603    /* outputs the message box
     
    563609    }
    564610
     611
     612
    565613    /* markup to support google recaptchav2.  requires the api script to be enqueued
    566614     */
     
    574622        return $output;
    575623    }
     624
     625
    576626
    577627    /* markup to support google recaptchav3.  requires the api script to be enqueued.
     
    590640    }
    591641
     642
     643
    592644    /*
    593645     * markup for select label content to add extra formatting when the label contains sub content
     
    605657        ]);
    606658    }
     659
     660
    607661
    608662    /* markup for a checkboxes.  Note, doubles up for markup of radio buttons as well
     
    629683    }
    630684
     685
     686
    631687    /* markup for a radio button
    632688     */
     
    635691        return $this->element_checkbox($element, 'radio');
    636692    }
     693
     694
    637695
    638696    /* markup for a credit card.  note that is uses the card.js library
     
    652710
    653711        $cc = strtr(""
    654             . "<div class='dygform-card-wrapper' %parameters>%label"
    655             . "<input autocomplete='cc-number' class='dygform-input dygform-cc-number dygform-no-post' placeholder='Card number' type='tel' name='number' value='%cc'>"
    656             . "<input autocomplete='cc-name'class='dygform-input dygform-cc-name' placeholder='Full name' type='text' name='name' value='%name'>"
    657             . "<input placeholder='MMYY' autocomplete='cc-exp' class='dygform-input dygform-cc-date dygform-no-post' placeholder='MM/YY' type='tel' name='expiry' value='%ex'>"
    658             . "<input autocomplete='cc-csc' class='dygform-input dygform-cc-cvc dygform-no-post' placeholder='CVC' type='number' name='cvc' value='%cvc'>"
    659             . "%required</div>"
    660             . "<div class='dygform-card-container'>"
    661             . "</div>"
    662             . "<script> new Card({form: document.querySelector('div'),container: '.dygform-card-container'});</script>",
    663             [
    664                 '%parameters' => $this->get_parameters($element, "dygform-cc"),
    665                 '%label'      => $this->get_label($element),
    666                 '%required'   => $this->get_required($element),
    667                 '%name'       => $prefills['name'],
    668                 '%cc'         => $prefills['cc'],
    669                 '%cvc'        => $prefills['cvc'],
    670                 '%ex'         => $prefills['ex'],
    671             ]
     712                . "<div class='dygform-card-wrapper' %parameters>%label"
     713                . "<input autocomplete='cc-number' class='dygform-input dygform-cc-number dygform-no-post' placeholder='Card number' type='tel' name='number' value='%cc'>"
     714                . "<input autocomplete='cc-name'class='dygform-input dygform-cc-name' placeholder='Full name' type='text' name='name' value='%name'>"
     715                . "<input placeholder='MMYY' autocomplete='cc-exp' class='dygform-input dygform-cc-date dygform-no-post' placeholder='MM/YY' type='tel' name='expiry' value='%ex'>"
     716                . "<input autocomplete='cc-csc' class='dygform-input dygform-cc-cvc dygform-no-post' placeholder='CVC' type='number' name='cvc' value='%cvc'>"
     717                . "%required</div>"
     718                . "<div class='dygform-card-container'>"
     719                . "</div>"
     720                . "<script> new Card({form: document.querySelector('div'),container: '.dygform-card-container'});</script>",
     721                [
     722                    '%parameters' => $this->get_parameters($element, "dygform-cc"),
     723                    '%label'      => $this->get_label($element),
     724                    '%required'   => $this->get_required($element),
     725                    '%name'       => $prefills['name'],
     726                    '%cc'         => $prefills['cc'],
     727                    '%cvc'        => $prefills['cvc'],
     728                    '%ex'         => $prefills['ex'],
     729                ]
    672730        );
    673731
    674732        return $this->add_container($element, $cc);
    675733    }
     734
     735
    676736
    677737    public function prefill_element($element) {
     
    702762    }
    703763
     764
     765
    704766    // attempt to prefill the element value from a linked data field by applying the dygform-data-link-xxx filter
    705767    public function get_linked_value($element) {
     
    742804    }
    743805
     806
     807
    744808    /**
    745      * returns a placeholder label element
     809     * returns a placeholder label element 
    746810     * @param type $element
    747811     */
    748812    public function get_placeholder_label($element) {
    749         if (!empty($element['label']) || empty($element['placeholder'])) {
     813        if (!empty($element['label']) || empty($element['placeholder']))
    750814            return '';
    751         }
    752815
    753816        return strtr("<div class='placeholder-label dygpg-placeholder-initial %required'>{$element['placeholder']}%help</div>", [
     
    757820    }
    758821
     822
     823
    759824}
  • agb-free/trunk/dyg-form/includes/dyg-form-functions.php

    r2926907 r2926915  
    99/**
    1010 * ads additional select options to an existing select option group
    11  *
    12  * @param array  $element - the select-option-group level element
    13  * @param array  $options  - an array of options to be included as both label and value
    14  * @param string $selected - the option to mark as selected
    15  */
    16 
    17 function dygform_add_options($element, $options, $selected) {
    18     if (!property_exists($element, 'options')) {
     11 * 
     12 * @param array $element - the select-option-group level element
     13 * @param array $options - an array of options to be included as both label and value
     14 * @param string $selected -  the option to mark as selected
     15 */
     16
     17 function dygform_add_options($element, $options, $selected) {
     18    if (!property_exists($element, 'options'))
    1919        return $element;
    20     }
    21 
     20       
    2221    $add = (array) $element->options;
    2322    foreach ($options as $option) {
    2423        $add[] = (object) [
    25             "type"      => 'option',
    26             "value"     => $option,
    27             "parameter" => $option === $selected ? 'selected' : '',
    28             "contains"  => $option,
     24                    "type"      => 'option',
     25                    "value"     => $option,
     26                    "parameter" => $option === $selected ? 'selected' : '',
     27                    "contains"  => $option
    2928        ];
    3029    }
     
    3534/**
    3635 * ads additional select options to an existing select option group
    37  *
    38  * @param type $element  - the select-option-group level element
    39  * @param type $options  - an array of options to be included as both label and value
    40  * @param type $selected - the option to mark as selected
     36 * 
     37 * @param type $element - the select-option-group level element
     38 * @param type $options - an array of options to be included as both label and value
     39 * @param type $selected -  the option to mark as selected
    4140 */
    4241function dygform_add_options_array($element, $options, $selected) {
     
    4443    foreach ($options as $option) {
    4544        $add[] = (object) [
    46             "type"      => 'option',
    47             "value"     => $option['value'],
    48             "parameter" => $option['value'] === $selected ? 'selected' : '',
    49             "contains"  => $option['contains'] ?? '',
     45                    "type"      => 'option',
     46                    "value"     => $option['value'],
     47                    "parameter" => $option['value'] === $selected ? 'selected' : '',
     48                    "contains"  => $option['contains'] ?? ''
    5049        ];
    5150    }
     
    5453}
    5554
     55
    5656/**
    5757 * ads li items for a list select group
    58  *
    59  * @param type $element  - the select-option-group level element
    60  * @param type $options  - an array of options to be included as both label and value
    61  * @param type $selected - the option to mark as selected
     58 * 
     59 * @param type $element - the select-option-group level element
     60 * @param type $options - an array of options to be included as both label and value
     61 * @param type $selected -  the option to mark as selected
    6262 */
    6363function dygform_add_list($element, $options) {
     
    6969
    7070        $add[] = (object) [
    71             "type"     => 'li',
    72             "value"    => $value,
    73             "contains" => $contains,
    74             "class"    => $class,
     71                    "type"     => 'li',
     72                    "value"    => $value,
     73                    "contains" => $contains,
     74                    "class"    => $class,
    7575        ];
    7676    }
     
    7979}
    8080
     81
     82
    8183/**
    8284 * sets the radio/checkbox option with value = $value to checked
    83  *
    84  * @param type $element - the select group element. Must be passed by reference
    85  * @param type $value   - the label value to match
     85 * 
     86 * @param type $element - the select group element.  Must be passed by reference
     87 * @param type $value - the label value to match
    8688 */
    8789function dygform_set_option(&$element, $value) {
     
    9395}
    9496
     97
     98
     99/**
     100 * walks through the data array looking for the $property element
     101 * @param type $data - the form data
     102 * @param type $property - the property element to find
     103 * @param return = false if not found, or the element by reference
     104 */
     105function dygform_find_element(&$data, $property) {
     106    $found = false;
     107    foreach ($data as $key => &$element) {
     108        if ($key === $property) {
     109            return $element;
     110        }
     111        //walk deeper into the array if there is a contains property
     112        if (is_object($element) && property_exists($element, 'contains') && is_object($element->contains)) {
     113            $found = dygform_find_element($element->contains, $property);
     114        }
     115        //walk deeper into the array if there is an options property
     116        if (is_object($element) && property_exists($element, 'options') && is_object($element->options)) {
     117            $found = dygform_find_element($element->options, $property);
     118        }
     119
     120        if ($found !== false) {
     121            break;
     122        }
     123    }
     124    return $found;
     125}
     126
     127
     128
    95129/**
    96130 * walks through the data structure and sets values from the array based on element type
    97  * @param type $data   - the form data
     131 * @param type $data - the form data
    98132 * @param type $values - an array of id => value pairs.
    99133 */
     
    127161}
    128162
     163
     164
    129165/**
    130166 * converts the form fields into a list of args based on the data-link values.
    131  * @param  array  $form
     167 * @param array $form
    132168 * @return array
    133169 */
     
    148184}
    149185
     186
     187
    150188/**
    151189 * walks through the data structure and sets values from the array based on element type
    152  * @param type $data       - the form data
     190 * @param type $data - the form data
    153191 * @param type $properties - an array of id => value pairs.
    154192 */
     
    171209}
    172210
    173 /**
    174  * walks through the data array looking for the $property element
    175  * @param type   $data     - the form data
    176  * @param type   $property - the property element to find
    177  * @param return =         false if not found, or the element by reference
    178  */
    179 function dygform_find_element(&$data, $property) {
    180     $found = false;
    181     foreach ($data as $key => &$element) {
    182         if ($key === $property) {
    183             return $element;
    184         }
    185         //walk deeper into the array if there is a contains property
    186         if (is_object($element) && property_exists($element, 'contains') && is_object($element->contains)) {
    187             $found = dygform_find_element($element->contains, $property);
    188         }
    189         //walk deeper into the array if there is an options property
    190         if (is_object($element) && property_exists($element, 'options') && is_object($element->options)) {
    191             $found = dygform_find_element($element->options, $property);
    192         }
    193 
    194         if ($found !== false) {
    195             break;
    196         }
    197     }
    198     return $found;
    199 }
    200 
    201 // ----------------------------------------------------
    202 
    203 /**
    204  * Attempts to insert a new element into a data object.
    205  * If it cannot insert, it adds the element into a queue for later processing.
    206  *
    207  *
    208  * @param  object &$data         - The data object to insert the element into.
    209  * @param  mixed  $id            - The ID of the property to insert the new element around.
    210  * @param  mixed  $new_element   - The new element to be inserted.
    211  * @param  bool   $insert_before - If true, the new element is inserted before the specified property.
    212  * @return bool   - Returns true if the new element was successfully inserted, false otherwise.
    213  */
    214 function dygform_insert_element(&$data, $id, $new_element, $insert_before = false) {
    215     $result = dygform_find_add_element($data, $id, $new_element, $insert_before);
    216 
    217     // if element was not added, add to queue
    218     if (!$result) {
    219         // check if queue exists, if not, initialize
    220         if (!property_exists($data, '__queue')) {
    221             $data->__queue = [];
    222         }
    223         // add the element, id and insert_before to queue
    224         $data->__queue[] = ['id' => $id, 'new_element' => $new_element, 'insert_before' => $insert_before];
    225     } else {
    226         dygform_process_queue($data);
    227     }
    228     return $result;
    229 }
    230 
    231 /**
    232  * Processes the queue of elements that need to be added.
    233  * It goes through each item in the queue and tries to add it.
    234  * If the item is added successfully, it is removed from the queue.
    235  * If the queue is empty after all items have been processed, it removes the __queue property.
    236  *
    237  * @param object &$data - The data object where elements are to be added.
    238  */
    239 function dygform_process_queue(&$data) {
    240     if (!property_exists($data, '__queue')) {
    241         return;
    242     }
    243 
    244     $has_inserted = false;
    245     // process each item in queue
    246     foreach ($data->__queue as $key => $item) {
    247         $item   = json_decode(json_encode($item), true);
    248         $result = dygform_find_add_element($data, $item['id'], $item['new_element'], $item['insert_before']);
    249 
    250         // if element was added, remove from queue and set flag to true
    251         if ($result) {
    252             unset($data->__queue[$key]);
    253             $has_inserted = true;
    254         }
    255     }
    256     // if queue is empty, remove the __queue property
    257     if (count($data->__queue) == 0) {
    258         unset($data->__queue);
    259     } else if ($has_inserted) {
    260         // If an item was inserted, call the function again
    261         dygform_process_queue($data);
    262     }
    263 }
    264 
    265 /**
    266  * Inserts a new element into a given data object either before or after a specific property.
    267  * It searches recursively through the data object and its properties to find the specified property (ID) to insert the new element around.
    268  * The function will first attempt to directly locate the property within the data object.
    269  * If it doesn't find it at the top level, it will then walk deeper into each property of the data object,
    270  * treating each property as a potential data object itself.
    271  *
    272  *                                If false or omitted, it is inserted after.
    273  *
    274  * @param  object $data           - The object into which the new element is to be inserted.
    275  * @param  mixed  $id             - The ID of the property to insert the new element around.
    276  * @param  array  $new_element    - The new element to be inserted.
    277  * @param  bool   $insert_before- If true, the new element is inserted before the specified property.
    278  * @return bool   - Returns true if the new element was successfully inserted, false otherwise.
    279  */
    280 
    281 function dygform_find_add_element(&$data, $id, $new_element, $insert_before = false) {
     211
     212
     213/**
     214 * walks through the data structure and inserts $element after $id
     215 * @param type $data - the form data
     216 * @param type $key - the array key to insert after
     217 */
     218function dygform_insert_element(&$data, $id, $new_element) {
    282219    $found = false;
    283220    if (property_exists($data, $id)) {
    284         $data_new = (object) dygform_array_insert((array) $data, $id, $new_element, $insert_before);
     221        $data_new = (object) dyg_array_insert_after((array) $data, $id, $new_element);
    285222        $data     = json_decode(json_encode($data_new));
    286223        return true;
    287224    }
    288225    foreach ($data as &$element) {
     226        //walk deeper into the array if there is a contains property
    289227        if (is_object($element)) {
    290             $found = dygform_find_add_element($element, $id, $new_element, $insert_before);
     228            $found = dygform_insert_element($element, $id, $new_element);
    291229        }
    292230        if ($found === true) {
     
    297235}
    298236
    299 /**
    300  * Insert a value or key/value pair before or after a specific key in an array.
    301  * If key doesn't exist, value is appended to the end of the array unless the append flag is false
    302  *
    303  * @param  array   $array        - the original array
    304  * @param  string  $key          - the key to insert around
    305  * @param  array   $new          - the array to insert
    306  * @param  boolean $insertBefore - if true, insert before the key, else insert after
    307  * @param  boolean $append       - if true and the key is not found, the new array is appended at the end
    308  * @return array
    309  */
    310 function dygform_array_insert(array $array, $key, array $new, $insertBefore = true, $append = true) {
    311     $keys  = array_keys($array);
    312     $index = array_search($key, $keys);
    313 
    314     if ($index === FALSE and !$append) {
    315         return $array;
    316     }
    317 
    318     $pos = false === $index ? count($array) : ($insertBefore ? $index : $index + 1);
    319 
    320     return array_merge(array_slice($array, 0, $pos), $new, array_slice($array, $pos));
    321 }
     237
     238
     239/**
     240 * walks through the data structure and inserts $element before $id
     241 * @param type $data - the form data
     242 * @param type $key - the array key to insert after
     243 */
     244function dygform_insert_before_element(&$data, $id, $new_element) {
     245    $found = false;
     246    if (property_exists($data, $id)) {
     247        $data_new = (object) dyg_array_insert_before((array) $data, $id, $new_element);
     248        $data     = json_decode(json_encode($data_new));
     249        return true;
     250    }
     251    foreach ($data as &$element) {
     252        //walk deeper into the array if there is a contains property
     253        if (is_object($element)) {
     254            $found = dygform_insert_before_element($element, $id, $new_element);
     255        }
     256        if ($found === true) {
     257            break;
     258        }
     259    }
     260    return $found;
     261}
     262
     263
  • agb-free/trunk/dyg-grid/addons/free/dygpg-meta.php

    r2926907 r2926915  
    22
    33/*
    4  * adds post meta field shortcodes and processing.  These fields control the formatting and
    5  * separation of the post meta fields in the grid content area
     4 * adds  post meta fields into the grid content area
    65 */
    76
    8 new DygpgMeta();
     7$dygpg_meta = new DygpgMeta();
    98
    109class DygpgMeta {
     
    1211    public function __construct() {
    1312        add_filter('dygpg-shortcode-array', [$this, 'shortcode_array']);
     13        add_filter("dygform-filter-data-dygpg-form", [$this, 'modify_data'], 5, 1);
    1414        add_filter('dygpg-modify-style-array', [$this, 'modify_style_array'], 10, 2);
    1515        add_filter('dygpg-pattern-class', [$this, 'modify_pattern_class'], 10, 3);
    1616
    17     }
    18 
    19     /**
    20      * adds an additional parameter to the shortcode array
    21      * @param  array  $shortcode - array of shortcode elements
    22      * @return string - modified shortcode array
    23      */
    24     public function shortcode_array($shortcode) {
    25         $shortcode['show_meta_icons']  = '';
    26         $shortcode['inline_separator'] = '|';
    27         $shortcode['inline_padding']   = '0em 0.2em';
    28         $shortcode['term_separator']   = ',';
    29         $shortcode['term_padding']     = '0em 0.2em';
    30         $shortcode['title-tag']        = 'h3';
    31         $shortcode['button']           = 'More';
    32         return $shortcode;
     17        $this->elements = apply_filters('dygpg-meta-elements', [
     18            'meta_wrapper' => [
     19                'type'     => 'div',
     20                'style'    => 'display:none',
     21                'contains' => [
     22                    'inline_separator' => [
     23                        'container-style' => '',
     24                        'container-class' => 'fourth-width',
     25                        'data-link'       => 'inline_separator',
     26                        'type'            => 'input',
     27                        'default'         => '|',
     28                        'placeholder'     => 'Inline Separator',
     29                        'parameter'       => 'maxlength="1"',
     30                        'options'         => [
     31                        ],
     32                    ],
     33                    'inline_padding'   => [
     34                        'container-style' => '',
     35                        'container-class' => 'fourth-width',
     36                        'data-link'       => 'inline_padding',
     37                        'type'            => 'input',
     38                        'default'         => '0em 0.2em',
     39                        'placeholder'     => 'Inline Padding',
     40                        'options'         => [
     41                        ],
     42                    ],
     43                    'term_separator'   => [
     44                        'container-style' => '',
     45                        'container-class' => 'fourth-width',
     46                        'data-link'       => 'term_separator',
     47                        'type'            => 'input',
     48                        'default'         => ',',
     49                        'placeholder'     => 'Term Separator',
     50                        'parameter'       => 'maxlength="1"',
     51                        'options'         => [
     52                        ],
     53                    ],
     54                    'term_padding'     => [
     55                        'container-style' => '',
     56                        'container-class' => 'fourth-width end',
     57                        'data-link'       => 'term_padding',
     58                        'type'            => 'input',
     59                        'default'         => '0em 0.2em',
     60                        'placeholder'     => 'Term Padding',
     61                        'options'         => [
     62                        ],
     63                    ],
     64                    'title_tag'        => [
     65                        'container-style' => '',
     66                        'container-class' => 'fourth-width',
     67                        'data-link'       => 'title-tag',
     68                        'type'            => 'dropdown_group',
     69                        'placeholder'     => 'Title tag',
     70                        'default'         => 'h3',
     71                        'options'         => [
     72                        ],
     73                    ],
     74                    'button_text'      => [
     75                        'type'            => 'input',
     76                        'element-type'    => 'text',
     77                        'placeholder'     => 'Button text',
     78                        'container-class' => 'fourth-width end',
     79                        'data-link'       => 'button',
     80                    ],
     81                ],
     82            ],
     83        ]);
    3384    }
    3485
     
    56107    }
    57108
     109    /**
     110     * adds an additional parameter to the shortcode array
     111     * @param  array  $shortcode - array of shortcode elements
     112     * @return string - modified shortcode array
     113     */
     114    public function shortcode_array($shortcode) {
     115        foreach ($this->elements['meta_wrapper']['contains'] as $element) {
     116            $shortcode[$element['data-link']] = $element['default'] ?? '';
     117        }
     118        $shortcode['show_meta_icons'] = '';
     119        return $shortcode;
     120    }
     121
     122    /**
     123     * adds additional post grid form editor elements to provide and interface for the new shortcode values
     124     * @param type $data - array of form elements
     125     */
     126    public function modify_data($data) {
     127        dygform_insert_element($data, 'pattern', $this->elements);
     128        $element = [
     129            'show_meta_icons' => [
     130                'type'            => 'checkbox',
     131                'data-link'       => 'show_meta_icons',
     132                'data-link-val'   => 'Y',
     133                'container-class' => '',
     134                'label'           => 'Show Meta Icons',
     135            ],
     136        ];
     137        dygform_insert_element($data, 'show_content', $element);
     138
     139        return $data;
     140    }
     141
    58142}
  • agb-free/trunk/dyg-grid/addons/free/dygpg_go_pro.php

    r2926907 r2926915  
    1414
    1515        //only proceed if pro addons are not present
    16         if (!is_agb_free()) {
     16        if (is_agb_pro()) {
    1717            return;
    1818        }
     
    7777        $output .= "<a target = '_blank' href='https://www.advancedgridbuilder.com/pricing'>Pricing</a>";
    7878        $output .= "<a target = '_blank'  href='https://www.advancedgridbuilder.com/#agb-demo'>Demo</a>";
     79        $output .= "<a target = '_blank'  href='https://www.advancedgridbuilder.com/#introduction-video'>Video</a>";
    7980        $output .= "</div>";
    8081        $output .= self::generate_features_table();
     
    120121        ];
    121122        $f[] = [
    122             'label' => "Equalised Cell, Content and Title Heights",
    123             'span'  => "dynamically with javascript",
    124         ];
    125         $f[] = [
    126123            'label' => "Responsive Grid Layouts",
    127124            'span'  => "customisable flex columns, horizontal fill, vertical fill, fixed width cells, responsive controls, custom gaps, custom breakpoints",
     
    133130        $f[] = [
    134131            'label' => "Responsive Featured Image Control",
    135             'span'  => "srcset configuration or specific thumbnail sizes",
     132            'span'   => "srcset configuration or specific thumbnail sizes",
    136133        ];
    137134        $f[] = [
     
    142139            'label' => "Theme Support",
    143140            'span'  => 'All themes including Divi, Elementor, Astra, Blogus, Neve, OceanWP and Wordpress native themes',
    144         ];
    145         $f[] = [
    146             'label' => "Access control",
    147             'span'  => 'Specify the minimum user role required to access grid editing features',
    148141        ];
    149142        $f[] = [
     
    153146        ];
    154147        $f[] = [
    155             'label' => "Grid Types",
    156             'free'  => 'Grids, lists',
    157             'pro'   => '+ accordions, slideshows,',
    158         ];
    159         $f[] = [
    160148            'label' => "Styling Themes",
    161             'free'  => "4 theme presets",
    162             'pro'   => "+ lots more",
     149            'free'  => '4 theme presets',
     150            'pro'   => 'lots of theme presets!!',
    163151        ];
    164152        $f[] = [
     
    179167        ];
    180168        $f[] = [
    181             'label' => "Cell Click Action Control",
     169            'label' => "Cell Click Action Control", 
    182170            'free'  => "link to post",
    183             'pro'   => "+ gallery lightbox, link buttons, custom link or disabled, Anchor/Page Scroll Links",
     171            'pro'   => "+ gallery lightbox, link buttons, custom link or disabled",
    184172        ];
    185173        $f[] = [
     
    235223            'pro'   => "click to open a lightbox gallery of post featured images",
    236224        ];
     225
     226        $f[] = [
     227            'label' => "Equalised Cell and Title Heights",
     228            'free'  => $no,
     229            'pro'   => "dynamically with javascript",
     230        ];
    237231        $f[] = [
    238232            'label' => "CSS Styling Matrix",
     
    245239            'pro'   => "Inject freeform CSS using pre-populated or custom selectors",
    246240        ];
     241 
     242 
    247243
    248244        return $f;
     
    258254     */
    259255    public function add_form_elements($data) {
    260         if (is_agb_free()) {
    261             dygform_insert_element($data, 'style-presets-wrapper', $this->elements);
    262         } else {
    263             dygform_insert_element($data, 'image_wrapper', $this->elements);
    264         }
    265 
     256        dygform_insert_element($data, 'image_wrapper', $this->elements);
    266257        if (!is_agb_pro()) {
    267258            dygform_insert_element($data, 'show_wrapper', $this->elements2);
  • agb-free/trunk/dyg-grid/addons/free/dygpg_grid_sizing.php

    r2926907 r2926915  
    22
    33/*
    4 grid sizing accordion extensions
     4  grid sizing accordion extensions
    55 */
     6
    67
    78new dygpg_grid_sizing();
     
    1314        add_filter('dygpg-shortcode-array', [$this, 'shortcode_array']);
    1415        add_filter('dygpg-modify-style-array', [$this, 'modify_style_array'], 10, 2);
    15         add_filter("dygpg-load-form", [$this, 'load_form'], 10, 2);
    16         add_filter('dygpg-class', [$this, 'filter_class'], 10, 2);
    1716    }
    1817
    19     /**
    20      * filters the dygpg-wrapper classes
    21      * adds classes to the grid wrapper to trigger row level element equalisation
    22      *
    23      * @param  string      $class - the current classes for the grid wrapper
    24      * @param  DygPostGrid $obj   - the current DygPostGrid object
    25      * @return string      - the modified classes for the grid wrapper
    26      */
    27     public function filter_class($class, $obj) {
    28         if ($obj->args['equal-grid-heights'] === 'R') {
    29             $class .= ' dygpg-wrapper-equalise-grid-rows';
    30         }
    31         if ($obj->args['grid-justification'] === 'L') {
    32             $class .= ' dygpg-justification-left';
    33         }
    34         if ($obj->args['grid-justification'] === 'R') {
    35             $class .= ' dygpg-justification-right';
    36         }
    37         return $class;
    38     }
    3918
    40     /**
    41      * modifies the form data after fully loaded
    42      * adds the options for the equal cell heights option
    43      *
    44      * @param  [array] $data
    45      * @param  [type]  $args
    46      * @return void
    47      */
    48     public function load_form($data, $args) {
    49         $styles   = [];
    50         $styles[] = [
    51             'contains' => 'Same Row',
    52             'value'    => 'R',
    53         ];
    54         $styles[] = [
    55             'contains' => 'All Cells',
    56             'value'    => 'Y',
    57         ];
    58         $styles[] = [
    59             'contains' => 'Off',
    60             'value'    => 'N',
    61         ];
    62         $e = dygform_find_element($data, 'equal_cell_heights_option');
    63         $e = dygform_add_options_array($e, $styles, $args['equal-grid-heights'] ?? 'N');
    64 
    65         $e = dygform_find_element($data, 'equal_content_heights_option');
    66         $e = dygform_add_options_array($e, $styles, $args['equal-content-heights'] ?? 'N');
    67 
    68         $e = dygform_find_element($data, 'equal_title_heights_option');
    69         $e = dygform_add_options_array($e, $styles, $args['equal-title-heights'] ?? 'N');
    70         return $data;
    71     }
    7219
    7320    /**
    7421     * filters the inline style attribute of the main cell element
    75      * @param string      $style - css style
     22     * @param string $style - css style
    7623     * @param DygPostGrid object $obj
    7724     */
    7825    public function modify_style_array($css, $obj) {
    79         if ($obj->args['use-columns'] !== 'W') {
     26        if ($obj->args['use-columns'] !== 'W')
    8027            return $css;
    81         }
    8228
    8329        $css['cell']['statements'][] = "width: " . esc_attr($obj->args['width']);
     
    8733    }
    8834
     35
     36
    8937    /**
    9038     * adds an additional parameter to the shortcode array
    91      * @param  array $shortcode - array of shortcode elements
     39     * @param array $shortcode - array of shortcode elements
    9240     * @return string - modified shortcode array
    9341     */
    9442    public function shortcode_array($shortcode) {
    9543        $shortcode['cell-margins'] = '10px';
    96         $shortcode['grid-justification'] = 'C';
    9744        return $shortcode;
    9845    }
     46
     47
    9948
    10049    public function add_form_elements($data) {
     
    180129                        ],
    181130                    ],
    182                     'grid-justification-wrapper' => [
    183                         'label'   => 'Grid justification',
    184                         'type'    => 'select_group',
    185                         'help'    => 'cell-justification',
    186                         'options' => [
    187                             'justification-left' => [
    188                                 'type'          => 'radio',
    189                                 'data-link'     => 'grid-justification',
    190                                 'data-link-val' => 'L',
    191                                 'checked'       => '',
    192                                 'label'         => 'Left',
    193                             ],
    194                             'justification-center'   => [
    195                                 'type'          => 'radio',
    196                                 'data-link'     => 'grid-justification',
    197                                 'data-link-val' => 'C',
    198                                 'checked'       => '',
    199                                 'label'         => 'Center',
    200                             ],
    201                             'justification-right'      => [
    202                                 'type'          => 'radio',
    203                                 'data-link'     => 'grid-justification',
    204                                 'data-link-val' => 'R',
    205                                 'checked'       => '',
    206                                 'label'         => 'Right',
    207                             ],
    208                         ],
    209                     ],
    210                     'equalise_heights' => [
    211                         'label'           => 'Equalise heights',
     131                    'cell_heights'        => [
     132                        'label'           => 'Cell heights',
    212133                        'type'            => 'div',
    213                         'style'           => ' ',
    214                         'help'            => 'equalise-heights',
     134                        'help'            => 'cell-heights',
    215135                        'container-style' => 'width: 100%;',
    216136                        'contains'        => [
    217                             'equal_title_heights_option'   => [
    218                                 'type'            => 'dropdown_group',
    219                                 'data-link'       => 'equal-title-heights',
     137                            'equal_cell_heights_option ' => [
     138                                'type'            => 'checkbox',
     139                                'data-link'       => 'equal-grid-heights',
     140                                'data-link-val'   => 'Y',
     141                                'container-class' => 'dygform-valign-select-input',
     142                                'checked'         => 'checked',
     143                                'label'           => 'Equalise',
     144                            ],
     145                            'cell_aspect_ratio'          => [
    220146                                'container-class' => 'third-width',
    221                                 'placeholder'     => 'Title heights',
    222                                 'options'         => [],
    223                             ],
    224                             'equal_content_heights_option' => [
    225                                 'type'            => 'dropdown_group',
    226                                 'data-link'       => 'equal-content-heights',
    227                                 'container-class' => 'third-width',
    228                                 'placeholder'     => 'Content heights',
    229                                 'options'         => [],
    230                             ],
    231                             'equal_cell_heights_option' => [
    232                                 'type'            => 'dropdown_group',
    233                                 'data-link'       => 'equal-grid-heights',
    234                                 'container-class' => 'third-width end',
    235                                 'placeholder'     => 'Cell heights',
    236                                 'options'         => [],
    237                             ],
    238                         ],
    239                     ],
    240                     'aspect_ratios'        => [
    241                         'label'           => 'Aspect ratios',
    242                         'type'            => 'div',
    243                         'help'            => 'aspect-ratios',
    244                         'container-style' => 'width: 100%;',
    245                         'contains'        => [
    246                             'iclass_aspect_ratio'     => [
    247                                 'container-class' => 'third-width',
    248                                 'container-style' => '',
    249                                 'type'            => 'select_option_group',
    250                                 'data-link'       => 'iclass-aspect-ratio',
    251                                 'placeholder'     => 'Image aspect ratio',
    252                                 'options'         => [
    253                                     0 => [
    254                                         'value'    => '1:1',
    255                                         'type'     => 'option',
    256                                         'contains' => '1:1',
    257                                     ],
    258                                     1 => [
    259                                         'value'    => '4:3',
    260                                         'type'     => 'option',
    261                                         'contains' => '4:3',
    262                                     ],
    263                                     2 => [
    264                                         'value'    => '16:9',
    265                                         'type'     => 'option',
    266                                         'contains' => '16:9',
    267                                     ],
    268                                     3 => [
    269                                         'value'    => 'match_image',
    270                                         'type'     => 'option',
    271                                         'contains' => 'match_image',
    272                                     ],
    273                                 ],
    274                             ],
    275                             'content_aspect_ratio'         => [
    276                                 'container-class' => 'third-width',
    277                                 'container-style' => '',
    278                                 'type'            => 'select_option_group',
    279                                 'data-link'       => 'content-aspect-ratio',
    280                                 'placeholder'     => 'Content aspect ratio',
    281                                 'parameter'       => 'required',
    282                                 'options'         => [
    283                                     0 => [
    284                                         'value'    => '1:1',
    285                                         'type'     => 'option',
    286                                         'contains' => '1:1',
    287                                     ],
    288                                     1 => [
    289                                         'value'    => '4:3',
    290                                         'type'     => 'option',
    291                                         'contains' => '4:3',
    292                                     ],
    293                                     2 => [
    294                                         'value'    => '16:9',
    295                                         'type'     => 'option',
    296                                         'contains' => '16:9',
    297                                     ],
    298                                     3 => [
    299                                         'value'    => 'match_image',
    300                                         'type'     => 'option',
    301                                         'contains' => 'match_image',
    302                                     ],
    303                                 ],
    304                             ],
    305                             'cell_aspect_ratio'         => [
    306                                 'container-class' => 'third-width end',
    307147                                'container-style' => '',
    308148                                'type'            => 'select_option_group',
     
    343183    }
    344184
     185
     186
    345187}
  • agb-free/trunk/dyg-grid/addons/free/dygpg_styles_css.php

    r2926907 r2926915  
    22
    33/*
    4  * adds logic and processing for css matrix panel fields
     4 * adds input fields for CSS attribute values to the CSS / Classes panel
    55 */
    66
    7  $dygpg_styles_css = new dygpg_styles_css();
     7new dygpg_styles_css();
    88
    99class dygpg_styles_css {
     
    1111    public function __construct() {
    1212        add_filter('dygpg-shortcode-array', [$this, 'shortcode_array']);
     13        add_filter("dygform-filter-data-dygpg-form", [$this, 'modify_form'], 10, 1);
    1314        add_filter('dygpg-modify-style-array', [$this, 'modify_style_array'], 10, 2);
    14 
    15         $this->defaults                              = [];
    16         $this->elements                              = ['cell', 'content', 'image', 'title'];
    17         $this->attributes                            = ['background-color', 'border-radius', 'border', 'padding', 'margin', 'text-align', 'color', 'font-size', 'line-height', 'text-transform', 'position', 'top', 'left', 'opacity', 'z-index'];
     15       
     16        $this->defaults = [];
     17        $this->elements   = ['cell', 'content', 'image', 'title' ];
     18        $this->attributes = ['background-color', 'border-radius', 'border', 'padding', 'margin','text-align',  'color', 'font-size', 'line-height', 'text-transform'];
    1819        $this->defaults['attribute_padding_content'] = '10px 0px 0px 0px';
    19 
     20       
    2021        $this->shortcodes = [];
    2122    }
    2223
     24
     25
    2326    /**
    2427     * filters the inline style attribute of the main cell element
    25      * @param string      $style - css style
     28     * @param string $style - css style
    2629     * @param DygPostGrid object $obj
    2730     */
     
    4245            $css["attribute_border-radius_cell_before"]['statements'][] = "border-radius: " . esc_attr($obj->args["attribute_border-radius_cell"]);
    4346        }
    44 
     47       
    4548        //special case to apply image centering to pattern
    4649        if (!empty($obj->args["attribute_text-align_image"])) {
     
    5356
    5457
     58
     59    /**
     60     * adds additional post grid form editor elements to provide and interface for the new shortcode values
     61     * @param type $data - array of form elements
     62     */
     63    public function modify_form($data) {
     64        $fields       = [];
     65        $column_count = count($this->elements);
     66        $columns      = $column_count;
     67
     68        //column headers
     69        foreach ($this->elements as $element) {
     70            $x                                     = ($column_count - 1) * 20;
     71            $columns--;
     72            $fields["attribute_header_{$element}"] = [
     73                "type"            => "div",
     74                "container-class" => $columns === 0 ? 'half-width end' : 'half-width',
     75                "container-style" => "text-align: center;width: calc(calc(100% - {$x}px) / $column_count);",
     76                "contains"        => $element,
     77            ];
     78        }
     79
     80        //attribute fields
     81        foreach ($this->attributes as $attribute) {
     82
     83            $columns = $column_count;
     84            foreach ($this->elements as $element) {
     85                $x                                           = ($column_count - 1) * 20;
     86                $columns--;
     87                $this->shortcodes[]                          = "attribute_{$attribute}_{$element}";
     88                $fields["attribute_{$attribute}_{$element}"] = [
     89                    "type"            => "input",
     90                    "element-type"    => "text",
     91                    "container-class" => $columns === 0 ? 'half-width end' : 'half-width',
     92                    "container-style" => "width: calc(calc(100% - {$x}px) / $column_count);",
     93                    "placeholder"     => $attribute,
     94                    "data-link"       => "attribute_{$attribute}_{$element}",
     95                ];
     96            }
     97        }
     98
     99        $set = [
     100            'css_attributes_wrapper' => [
     101                'label'           => 'CSS Attributes',
     102                'type'            => 'div',
     103                'container-class' => 'dygform-accordion',
     104                'help'            => 'panel/dynamic-sorting-filtering',
     105                'style'           => 'display:none;',
     106                'contains'        =>
     107                $fields
     108            ],
     109        ];
     110        dygform_insert_element($data, 'widget_wrapper', $set);
     111        return $data;
     112    }
     113
     114
     115
    55116    /**
    56117     * adds an additional parameter to the shortcode array
    57      * @param  array $shortcode - array of shortcode elements
     118     * @param array $shortcode - array of shortcode elements
    58119     * @return string - modified shortcode array
    59120     */
     
    67128    }
    68129
     130
     131
    69132}
  • agb-free/trunk/dyg-grid/addons/free/dygpg_styles_free.php

    r2926907 r2926915  
    2525                'container-style' => 'width: 100%;',
    2626                'contains'        => [
    27 
    28                     'style-preset-options-header' => [
    29                         'type'     => 'div',
    30                         'label'    => 'Basic styles',
    31                         'help'     => 'basic-styles',
    32                         'contains' => '',
    33                     ],
    3427                    'style-reset'                 => [
    3528                        'type'            => 'checkbox',
     
    4235                        'style'           => 'font-size: 200%;',
    4336                        'hide'            => '',
     37                    ],
     38                    'style-preset-options-header' => [
     39                        'type'     => 'div',
     40                        'label'    => 'Basic styles',
     41                        'help'     => 'basic-styles',
     42                        'contains' => '',
    4443                    ],
    4544                    'style-preset-options'        => [
     
    193192        $styles   = [];
    194193        $styles[] = [
    195             'contains' => 'Enhanced Blog Index',
     194            'contains' => 'Blog',
    196195            'value'    => 'dygpg-blog',
    197196        ];
     
    237236    public function style_selected($args, $class) {
    238237        if ($class === 'dygpg-blog') {
    239             $args['attribute_border_cell'] = '1px solid lightblue';
     238            $args['button']                    = 'More';
     239            $args['columns']                   = '3,3,2,1';
     240            $args['equal-grid-heights']        = 'Y';
     241            $args['equal-title-heights']       = is_agb_pro() ? 'Y' : '';
     242            $args['link-titles']               = 'Y';
     243            $args['pattern']                   = '%image%,%<,%title%,%category%,%excerpt%,%button%,%>';
     244            $args['attribute_border_cell']     = '1px solid lightblue';
    240245            $args['attribute_padding_content'] = '17px';
    241             $args['button'] = 'More';
    242             $args['columns'] = '3,3,2,1';
    243             $args['equal-content-heights'] = '';
    244             $args['equal-grid-heights'] = 'Y';
    245             $args['equal-title-heights'] = 'Y';
    246             $args['link-titles'] = 'Y';
    247             $args['load-more-button-label'] = '';
    248             $args['order'] = 'ASC';
    249             $args['orderby'] = 'ID';
    250             $args['pagesize'] = '3';
    251             $args['pattern'] = '%image%,%<,%date%,%author%,%category%,%title%,%excerpt%,%button%,%>';
    252             $args['pattern-direction'] = '%facebook_share%,%twitter_share%,%linkedin_share%,%date%,%author%,%category%,%download_image%';
    253             $args['preset'] = 'dygpg-blog';
    254             $args['show_meta_icons'] = 'Y';
    255             $args['tax-operator'] = 'IN';
    256             $args['transition'] = 'none';
    257             $args['use-ajax'] = '';
    258            
    259246        }
    260247        if ($class === 'dygpg-blog-fade') {
    261             $args['attribute_border_cell'] = '1px solid lightblue';
    262             $args['attribute_padding_cell'] = '20px';
    263             $args['attribute_padding_content'] = '20px';
    264             $args['columns'] = '3,3,2,1';
    265             $args['equal-content-heights'] = 'Y';
    266             $args['equal-grid-heights'] = 'R';
    267             $args['iclass-aspect-ratio'] = '';
    268             $args['pattern'] = '%<,%excerpt%,%>,%date%,%category%,%author%,%title%';
    269             $args['pattern-direction'] = '%date%,%category%,%author%';
    270             $args['preset'] = 'dygpg-blog-fade';
     248            $args['columns']                         = '3,3,2,1';
     249            $args['equal-grid-heights']              = 'Y';
     250            $args['equal-title-heights']             = '';
     251            $args['pattern']                         = '%<,%excerpt%,%>,%date%,%category%,%author%,%title%';
     252            $args['pattern-direction']               = '%date%,%category%,%author%';
     253            $args['transition']                      = 'fade';
     254            $args['attribute_border_cell']           = '1px solid lightblue';
     255            $args['attribute_padding_cell']          = '20px';
     256            $args['attribute_padding_content']       = '20px';
    271257            $args['style-center-content-horizontal'] = 'Y';
    272             $args['style-center-content-vertical'] = 'Y';
    273             $args['transition'] = 'fade';
     258            $args['style-center-content-vertical']   = 'Y';
    274259        }
    275260        if ($class === 'dygpg-list') {
  • agb-free/trunk/dyg-grid/addons/free/dygpg_transitions_free.css

    r2926907 r2926915  
    44    height:  100%;
    55    object-fit: cover;
    6     left: 0px;
    7     top: 0px;
    86}
    97.dygpg-transition-wrapper {
     
    1715/*flipy start*/
    1816
    19 .dygpg-transition-wrapper.dygpg-transition-flipy .dygpg-transition-link,
    2017.dygpg-transition-wrapper.dygpg-transition-flipy .dygpg-transition-image {
    2118    z-index: 2; /* back side, placed above front */
     
    3532}
    3633.dygpg-transition-wrapper.dygpg-transition-flipy .dygpg-content,
    37 .dygpg-transition-wrapper.dygpg-transition-flipy .dygpg-transition-link,
    3834.dygpg-transition-wrapper.dygpg-transition-flipy .dygpg-transition-image
    3935{
     
    5248}
    5349
    54 .dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-transition-link,
    5550.dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-transition-image {
    5651    z-index: 2; /* back side, placed above front */
     
    6661}
    6762.dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-content,
    68 .dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-transition-image,
    69 .dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-transition-link
     63.dygpg-transition-wrapper.dygpg-transition-flipx .dygpg-transition-image
    7064{
    7165    backface-visibility: hidden;
     
    8478}
    8579
    86 .dygpg-transition-wrapper.dygpg-transition-flip-side .dygpg-transition-link,
    8780.dygpg-transition-wrapper.dygpg-transition-flip-side .dygpg-transition-image {
    8881    z-index: 2; /* back side, placed above front */
     
    9992}
    10093.dygpg-transition-wrapper.dygpg-transition-flip-side .dygpg-content,
    101 .dygpg-transition-wrapper.dygpg-transition-flip-side .dygpg-transition-link,
    10294.dygpg-transition-wrapper.dygpg-transition-flip-side .dygpg-transition-image
    10395{
  • agb-free/trunk/dyg-grid/css/dyg-post-grid-templates.css

    r2926907 r2926915  
    55    justify-content: center;
    66    position: relative;
    7 }
    8 .dygpg-justification-left {
    9     justify-content: flex-start;
    10 }
    11 .dygpg-justification-right {
    12     justify-content: flex-end;
    137}
    148
     
    201195
    202196.dygpg-center-text .dygpg-content,
    203 .dygpg-center-text .dygpg-pattern-button,
    204197.dygpg-center-text .dygpg-text {
    205198    text-align: center;
  • agb-free/trunk/dyg-grid/css/dyg-post-grid.css

    r2926907 r2926915  
    129129    border: 1px solid darkred;
    130130    transform: scale(1);
    131     z-index: 99999;
     131    z-index: 999;
    132132}
    133133
     
    348348}
    349349
    350 .dygpg-pattern-show_woo_sold_badge {
    351     padding: 0px!important;
    352 }
    353 
    354350.dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern div {
    355351    font-weight: 400;
  • agb-free/trunk/dyg-grid/css/dygpg-form.css

    r2926907 r2926915  
    181181    padding-top: 30px;
    182182    border: 4px solid #e3ebf6;
    183     z-index: 999999;
     183    z-index: 9999;
    184184}
    185185
  • agb-free/trunk/dyg-grid/dyg-post-grid.php

    r2926907 r2926915  
    1111$dygpg_state = [];
    1212
    13 define('AGB_VERSION', '4.5.0');
     13define('AGB_VERSION', '4.1.0');
    1414
    1515include_once DYG_STYLESHEET_DIRECTORY . '/dyg-grid/includes/class-dygpg-db.php';
     
    2525    function __construct() {
    2626        //include all addons
    27         foreach (glob(DYG_STYLESHEET_DIRECTORY . "/dyg-grid/addons/free/*.php") as $filename) {
     27        foreach (glob(DYG_STYLESHEET_DIRECTORY . "/dyg-grid/addons/pro/*.php") as $filename) {
    2828            include_once $filename;
    2929        }
    30         foreach (glob(DYG_STYLESHEET_DIRECTORY . "/dyg-grid/addons/pro/*.php") as $filename) {
     30        foreach (glob(DYG_STYLESHEET_DIRECTORY . "/dyg-grid/addons/free/*.php") as $filename) {
    3131            include_once $filename;
    3232        }
     
    5252
    5353        $result = $pg->dyg_post_grid($shortcode_atts, $inner);
    54 
    5554        return $result;
    5655    }
  • agb-free/trunk/dyg-grid/forms/dygpg-form.php

    r2926907 r2926915  
    11<?php
    22
     3
    34return [
    4     'settings'        => [
    5         'form_class'       => 'dygpg-draggable',
     5    'settings' => [
     6        'form_class' => 'dygpg-draggable',
    67        'ignore_recaptcha' => 'false',
    7         'store'            => 'false',
    8         'help_base'        => 'https://www.advancedgridbuilder.com/',
    9     ],
    10     'nav'             => [
    11         'type'             => 'div',
    12         'help'             => 'navigation-icons',
     8        'store' => 'false',
     9        'help_base' => 'https://www.advancedgridbuilder.com/',
     10    ],
     11    'nav' => [
     12        'type' => 'div',
     13        'help' => 'navigation-icons',
    1314        'required-message' => '',
    14         'hidden'           => '',
    15         'element-type'     => '',
    16         'autocomplete'     => '',
    17         'name'             => '',
    18         'label'            => ' ',
    19         'placeholder'      => '',
    20         'value'            => '',
    21         'parameters'       => '',
    22         'readonly'         => '',
    23         'class'            => '',
    24         'container-class'  => 'dygpg-nav',
    25         'style'            => '',
    26         'container-style'  => '',
    27         'data-link'        => '',
    28         'data-link-val'    => '',
    29         'show'             => '',
    30         'hide'             => '',
    31         'rows'             => '',
    32         'contains'         => ""
     15        'hidden' => '',
     16        'element-type' => '',
     17        'autocomplete' => '',
     18        'name' => '',
     19        'label' => ' ',
     20        'placeholder' => '',
     21        'value' => '',
     22        'parameters' => '',
     23        'readonly' => '',
     24        'class' => '',
     25        'container-class' => 'dygpg-nav',
     26        'style' => '',
     27        'container-style' => '',
     28        'data-link' => '',
     29        'data-link-val' => '',
     30        'show' => '',
     31        'hide' => '',
     32        'rows' => '',
     33        'contains' => ""
    3334        . "<div class='dygpg-undo'><div>%undo%</div><i title='undo delete' class='fas fa-undo dygpg-undo'></i></div>"
    3435        . "<div class='dygpg-undo dygpg-redo'><div>%redo%</div><i title='undo delete' class='fas fa-redo dygpg-redo'></i></div>"
     
    3940        . "<div class='dygpg-version'>AGB " . (is_agb_theme() ? 'Theme v' : (is_agb_pro() ? 'Pro v' : 'Free v')) . AGB_VERSION . "</div>",
    4041    ],
    41     'id'              => [
    42         'type'            => 'input',
     42    'id' => [
     43        'type' => 'input',
    4344        'container-style' => '',
    44         'hidden'          => 'hidden',
    45         'name'            => 'id',
    46     ],
    47     'version'         => [
    48         'type'            => 'input',
     45        'hidden' => 'hidden',
     46        'name' => 'id',
     47    ],
     48    'version' => [
     49        'type' => 'input',
    4950        'container-style' => '',
    50         'hidden'          => 'hidden',
    51         'name'            => 'id',
    52         'data-link'       => 'version',
    53     ],
    54     'demo_id'         => [
    55         'type'            => 'input',
     51        'hidden' => 'hidden',
     52        'name' => 'id',
     53        'data-link' => 'version',
     54    ],
     55    'demo_id' => [
     56        'type' => 'input',
    5657        'container-style' => '',
    57         'hidden'          => 'hidden',
    58         'name'            => 'demo-id',
    59         'data-link'       => 'demo-id',
    60         'data-link-val'   => '',
    61     ],
    62     'undo'            => [
    63         'type'            => 'input',
     58        'hidden' => 'hidden',
     59        'name' => 'demo-id',
     60        'data-link' => 'demo-id',
     61        'data-link-val' => '',
     62    ],
     63    'undo' => [
     64        'type' => 'input',
    6465        'container-style' => '',
    65         'hidden'          => 'hidden',
    66         'name'            => 'undo',
    67         'data-link'       => 'undo',
    68         'value'           => '',
    69     ],
    70     'revised_id'      => [
    71         'type'            => 'input',
     66        'hidden' => 'hidden',
     67        'name' => 'undo',
     68        'data-link' => 'undo',
     69        'value' => '',
     70    ],
     71    'revised_id' => [
     72        'type' => 'input',
    7273        'container-style' => 'width: calc(100% - 260px);',
    73         'style'           => 'font-weight: 600;',
    74         'data-link'       => 'id',
    75         'parameter'       => 'disabled',
    76         'placeholder'     => 'Postgrid ID',
    77     ],
    78     'index'           => [
    79         'type'   => 'input',
    80         'hidden' => 'hidden',
    81         'name'   => 'id',
     74        'style' => 'font-weight: 600;',
     75        'data-link' => 'id',
     76        'parameter' => 'disabled',
     77        'placeholder' => 'Postgrid ID',
     78    ],
     79    'index' => [
     80        'type' => 'input',
     81        'hidden' => 'hidden',
     82        'name' => 'id',
    8283    ],
    8384    'content_wrapper' => [
    84         'type'            => 'div',
    85         'label'           => 'Content source',
    86         'help'            => 'panel/content-source',
     85        'type' => 'div',
     86        'label' => 'Content source',
     87        'help' => 'panel/content-source',
    8788        'container-class' => 'dygform-accordion',
    88         'contains'        => [
    89             'content_type'        => [
    90                 'label'   => 'Query source',
    91                 'type'    => 'select_group',
    92                 'help'    => 'query-source',
     89        'contains' => [
     90            'content_type' => [
     91                'label' => 'Query source',
     92                'type' => 'select_group',
    9393                'options' => [
    9494                    'type_post' => [
    95                         'type'          => 'radio',
    96                         'label'         => 'Post Type',
    97                         'data-link'     => 'content',
     95                        'type' => 'radio',
     96                        'label' => 'Post Type',
     97                        'data-link' => 'content',
     98                        'help' => 'post-type',
    9899                        'data-link-val' => 'POST',
    99                         'show'          => '.dygform-container-post_type,.dygform-container-filter_term,.dygform-container-filter_taxonomy,.dygform-container-filter_operator',
    100                     ],
    101                 ],
    102             ],
    103             'post_type'           => [
     100                        'help' => 'post-type',
     101                        'show' => '.dygform-container-post_type,.dygform-container-filter_term,.dygform-container-filter_taxonomy,.dygform-container-filter_operator',
     102                    ],
     103                ],
     104            ],
     105            'post_type' => [
    104106                'container-class' => 'dygform-hidden',
    105                 'type'            => 'dropdown_group',
    106                 'hidden'          => 'hidden',
     107                'type' => 'dropdown_group',
     108                'hidden' => 'hidden',
    107109                'container-style' => 'display:none;',
    108                 'placeholder'     => 'Post type',
    109                 'data-link'       => 'posttype',
    110                 'options'         => [
    111                 ],
    112             ],
    113             'filter_taxonomy'     => [
     110                'placeholder' => 'Post type',
     111                'data-link' => 'posttype',
     112                'options' => [
     113                ],
     114            ],
     115            'filter_taxonomy' => [
    114116                'container-class' => 'dygform-hidden third-width',
    115117                'container-style' => '',
    116                 'type'            => 'select_option_group',
    117                 'data-link'       => 'taxonomy',
    118                 'placeholder'     => 'Taxonomy filter',
    119                 'parameter'       => 'required',
    120                 'options'         => [
    121                 ],
    122             ],
    123             'filter_operator'     => [
     118                'type' => 'select_option_group',
     119                'data-link' => 'taxonomy',
     120                'placeholder' => 'Taxonomy filter',
     121                'parameter' => 'required',
     122                'options' => [
     123                ],
     124            ],
     125            'filter_operator' => [
    124126                'container-class' => 'dygform-hidden third-width',
    125127                'container-style' => '',
    126                 'type'            => 'dropdown_group',
    127                 'data-link'       => 'tax-operator',
    128                 'placeholder'     => 'Filter operator',
    129                 'options'         => [
    130                 ],
    131             ],
    132             'filter_term'         => [
    133                 'placeholder'     => 'Filter term slug',
     128                'type' => 'select_option_group',
     129                'data-link' => 'tax-operator',
     130                'placeholder' => 'Filter operator',
     131                'options' => [
     132                ],
     133            ],
     134            'filter_term' => [
     135                'placeholder' => 'Filter term slug',
    134136                'container-class' => 'dygform-hidden third-width end',
    135137                'container-style' => '',
    136                 'type'            => 'select_option_group',
    137                 'data-link'       => 'tax-terms',
    138                 'element-type'    => 'text',
    139                 'options'         => [
    140                 ],
    141             ],
    142             'term'                => [
    143                 'placeholder'     => 'Taxonomy',
     138                'type' => 'select_option_group',
     139                'data-link' => 'tax-terms',
     140                'element-type' => 'text',
     141                'options' => [
     142                ],
     143            ],
     144            'term' => [
     145                'placeholder' => 'Taxonomy',
    144146                'container-class' => 'dygform-hidden third-width',
    145147                'container-style' => '',
    146                 'type'            => 'select_option_group',
    147                 'data-link'       => 'term',
    148                 'element-type'    => 'text',
    149                 'options'         => [
     148                'type' => 'select_option_group',
     149                'data-link' => 'term',
     150                'element-type' => 'text',
     151                'options' => [
    150152                ],
    151153            ],
    152154            'attached_taxonomies' => [
    153                 'type'            => 'checkbox',
    154                 'data-link'       => 'attached-taxonomies',
    155                 'data-link-val'   => 'Y',
    156                 'value'           => '',
    157                 'checked'         => 'checked',
     155                'type' => 'checkbox',
     156                'data-link' => 'attached-taxonomies',
     157                'data-link-val' => 'Y',
     158                'value' => '',
     159                'checked' => 'checked',
    158160                'container-class' => 'dygform-hidden dygform-valign-select-input',
    159161                'container-style' => '',
    160                 'label'           => 'Only terms attached to the current post',
    161             ],
    162             'number-of-posts'     => [
    163                 'label'           => 'Number of posts',
    164                 'type'            => 'div',
    165                 'style'           => ' ',
    166                 'help'            => 'number-of-posts',
     162                'label' => 'Only terms attached to the current post',
     163            ],
     164            'number-of-posts' => [
     165                'label' => 'Number of posts',
     166                'type' => 'div',
     167                'style' => ' ',
     168                'help' => 'number-of-posts',
    167169                'container-style' => 'width: 100%;',
    168                 'contains'        => [
     170                'contains' => [
    169171                    'num_posts' => [
    170172                        'container-class' => 'third-width',
    171                         'data-link'       => 'numposts',
    172                         'type'            => 'input',
    173                         'element-type'    => 'number',
    174                         'placeholder'     => 'Max posts',
     173                        'data-link' => 'numposts',
     174                        'type' => 'input',
     175                        'element-type' => 'number',
     176                        'placeholder' => 'Max posts',
    175177                    ],
    176178                    'page-size' => [
    177                         'data-link'       => 'pagesize',
     179                        'data-link' => 'pagesize',
    178180                        'container-class' => 'third-width',
    179                         'element-type'    => 'number',
    180                         'type'            => 'input',
    181                         'placeholder'     => 'Page size',
    182                     ],
    183                 ],
    184             ],
    185             'sort_wrapper'        => [
    186                 'label'           => 'Sort order',
    187                 'type'            => 'div',
    188                 'style'           => ' ',
    189                 'help'            => 'sort-order',
     181                        'element-type' => 'number',
     182                        'type' => 'input',
     183                        'placeholder' => 'Page size',
     184                    ],
     185                ],
     186            ],
     187            'sort_wrapper' => [
     188                'label' => 'Sort order',
     189                'type' => 'div',
     190                'style' => ' ',
     191                'help' => 'sort-order',
    190192                'container-style' => 'width: 100%; ',
    191                 'contains'        => [
     193                'contains' => [
    192194                    'order_by' => [
    193195                        'container-class' => 'third-width',
    194                         'data-link'       => 'orderby',
    195                         'type'            => 'select_option_group',
    196                         'placeholder'     => 'Order by',
    197                         'options'         => [
     196                        'data-link' => 'orderby',
     197                        'type' => 'select_option_group',
     198                        'placeholder' => 'Order by',
     199                        'options' => [
    198200                        ],
    199201                    ],
    200202                    'meta_key' => [
    201                         'data-link'       => 'meta-key',
     203                        'data-link' => 'meta-key',
    202204                        'container-class' => 'third-width',
    203                         'type'            => 'input',
    204                         'placeholder'     => 'Meta key',
    205                     ],
    206                     'order'    => [
     205                        'type' => 'input',
     206                        'placeholder' => 'Meta key',
     207                    ],
     208                    'order' => [
    207209                        'container-class' => 'third-width end',
    208                         'data-link'       => 'order',
    209                         'type'            => 'dropdown_group',
    210                         'placeholder'     => 'Order',
    211                         'options'         => [
     210                        'data-link' => 'order',
     211                        'type' => 'dropdown_group',
     212                        'placeholder' => 'Order',
     213                        'options' => [
    212214                        ],
    213215                    ],
     
    216218        ],
    217219    ],
    218     'show_wrapper'    => [
    219         'label'           => 'Show elements',
    220         'type'            => 'div',
    221         'style'           => 'display:none;',
     220    'show_wrapper' => [
     221        'label' => 'Show elements',
     222        'type' => 'div',
     223        'style' => 'display:none;',
    222224        'container-class' => 'dygform-accordion',
    223         'help'            => 'panel/show-elements',
     225        'help' => 'panel/show-elements',
    224226        'container-style' => 'width: 100%;',
    225         'contains'        => [
    226             'show_elements'       => [
    227                 'label'   => 'Show Elements',
    228                 'help'    => 'show-elements',
    229                 'type'    => 'select_group',
     227        'contains' => [
     228            'show_elements' => [
     229                'label' => 'Show Elements',
     230                'help' => 'show-elements',
     231                'type' => 'select_group',
    230232                'options' => [
    231233                    'show_content' => [
    232                         'type'          => 'checkbox',
    233                         'data-link'     => 'show-content',
     234                        'type' => 'checkbox',
     235                        'data-link' => 'show-content',
    234236                        'data-link-val' => 'Y',
    235                         'checked'       => 'checked',
    236                         'show'          => '#dygform-dygpg-form-brandnew-element-equal_heights',
    237                         'label'         => 'Content wrapper',
    238                     ],
    239                 ],
    240             ],
    241             'pattern_wrapper'     => [
    242                 'type'     => 'div',
     237                        'checked' => 'checked',
     238                        'show' => '#dygform-dygpg-form-brandnew-element-equal_heights',
     239                        'label' => 'Content wrapper',
     240                    ],
     241                ],
     242            ],
     243            'pattern_wrapper' => [
     244                'type' => 'div',
    243245                'contains' => [
    244246                    'pattern-direction' => [
    245247                        'data-link' => 'pattern-direction',
    246                         'type'      => 'input',
    247                         'hidden'    => 'hidden',
    248                         'flags'     => 'complex',
    249                     ],
    250                     'pattern'           => [
     248                        'type' => 'input',
     249                        'hidden' => 'hidden',
     250                        'flags' => 'complex',
     251                    ],
     252                    'pattern' => [
    251253                        'container-style' => '',
    252254                        'container-class' => '',
    253                         'data-link'       => 'pattern',
    254                         'label'           => 'Elements Pattern',
    255                         'help'            => 'elements-pattern',
    256                         'type'            => 'select_list',
    257                         'placeholder'     => 'Elements Pattern',
    258                         'list'            => [
     255                        'data-link' => 'pattern',
     256                        'type' => 'select_list',
     257                        'placeholder' => 'Elements Pattern',
     258                        'list' => [
    259259                        ],
    260260                    ],
    261261                ],
    262262            ],
     263            'equal_title_heights' => [
     264                'label'           => 'Equalise heights',
     265                'type'            => 'div',
     266                'style'           => ' ',
     267                'help'            => 'equalise-title-heights',
     268                'container-style' => 'width: 100%;',
     269                'contains'        => [
     270                    'equal_title_heights_option'   => [
     271                        'type'            => 'checkbox',
     272                        'data-link'       => 'equal-title-heights',
     273                        'data-link-val'   => 'Y',
     274                        'container-class' => 'dygform-valign-select-input',
     275                        'checked'         => 'checked',
     276                        'label'           => 'Titles',
     277                    ],
     278                    'equal_content_heights_option' => [
     279                        'type'            => 'checkbox',
     280                        'data-link'       => 'equal-content-heights',
     281                        'data-link-val'   => 'Y',
     282                        'container-class' => 'dygform-valign-select-input',
     283                        'checked'         => 'checked',
     284                        'label'           => 'Content wrapper',
     285                    ],
     286                    'content_aspect_ratio'         => [
     287                        'container-class' => 'third-width',
     288                        'container-style' => '',
     289                        'type'            => 'select_option_group',
     290                        'data-link'       => 'content-aspect-ratio',
     291                        'placeholder'     => 'Content aspect ratio',
     292                        'parameter'       => 'required',
     293                        'options'         => [
     294                            0 => [
     295                                'value'    => '1:1',
     296                                'type'     => 'option',
     297                                'contains' => '1:1',
     298                            ],
     299                            1 => [
     300                                'value'    => '4:3',
     301                                'type'     => 'option',
     302                                'contains' => '4:3',
     303                            ],
     304                            2 => [
     305                                'value'    => '16:9',
     306                                'type'     => 'option',
     307                                'contains' => '16:9',
     308                            ],
     309                            3 => [
     310                                'value'    => 'match_image',
     311                                'type'     => 'option',
     312                                'contains' => 'match_image',
     313                            ],
     314                        ],
     315                    ],
     316                ],
     317            ],
    263318        ],
    264319    ],
    265 
    266     'submit'          => [
    267         'type'            => 'button',
     320    'image_wrapper' => [
     321        'type'            => 'div',
     322        'label'           => 'Image settings',
     323        'container-class' => 'dygform-accordion',
     324        'help'            => 'panel/image-settings',
     325        'style'           => 'display:none;',
     326        'contains'        => [
     327            'image_location'          => [
     328                'type'    => 'select_group',
     329                'label'   => 'Image location',
     330                'help'    => 'image-location',
     331                'options' => [
     332                    0 => [
     333                        'type'          => 'radio',
     334                        'label'         => 'Background',
     335                        'checked'       => '',
     336                        'value'         => '',
     337                        'contains'      => '',
     338                        'data-link'     => 'image',
     339                        'data-link-val' => 'B',
     340                        'show'          => '',
     341                        'hide'          => '.dygform-container-iclass_aspect_ratio',
     342                    ],
     343                    1 => [
     344                        'type'          => 'radio',
     345                        'label'         => 'Content',
     346                        'checked'       => '',
     347                        'value'         => '',
     348                        'contains'      => '',
     349                        'data-link'     => 'image',
     350                        'data-link-val' => 'Y',
     351                        'show'          => '.dygform-container-iclass_aspect_ratio',
     352                        'hide'          => '',
     353                    ],
     354                    2 => [
     355                        'type'          => 'radio',
     356                        'label'         => 'Hidden',
     357                        'checked'       => '',
     358                        'value'         => '',
     359                        'contains'      => '',
     360                        'data-link'     => 'image',
     361                        'data-link-val' => 'H',
     362                        'show'          => '',
     363                        'hide'          => '.dygform-container-iclass_aspect_ratio',
     364                    ],
     365                ],
     366            ],
     367            'iclass_aspect_ratio'     => [
     368                'container-class' => 'third-width',
     369                'container-style' => '',
     370                'type'            => 'select_option_group',
     371                'data-link'       => 'iclass-aspect-ratio',
     372                'placeholder'     => 'Image aspect ratio',
     373                'parameter'       => 'required',
     374                'options'         => [
     375                    0 => [
     376                        'value'    => '1:1',
     377                        'type'     => 'option',
     378                        'contains' => '1:1',
     379                    ],
     380                    1 => [
     381                        'value'    => '4:3',
     382                        'type'     => 'option',
     383                        'contains' => '4:3',
     384                    ],
     385                    2 => [
     386                        'value'    => '16:9',
     387                        'type'     => 'option',
     388                        'contains' => '16:9',
     389                    ],
     390                    3 => [
     391                        'value'    => 'match_image',
     392                        'type'     => 'option',
     393                        'contains' => 'match_image',
     394                    ],
     395                ],
     396            ],
     397            'image_thumbnail_wrapper' => [
     398                'label'           => 'Image file resolution',
     399                'type'            => 'div',
     400                'help'            => 'image-file-resolution',
     401                'container-style' => 'width: 100%;',
     402                'contains'        => [
     403                    'use_srcset'    => [
     404                        'type'            => 'radio',
     405                        'data-link'       => 'use_srcset',
     406                        'data-link-val'   => 'Y',
     407                        'checked'         => 'checked',
     408                        'container-style' => '',
     409                        'hide'            => '.dygform-container-size',
     410                        'show'            => '.dygform-container-resolutions',
     411                        'label'           => 'Use srcset',
     412                    ],
     413                    'use_thumbnail' => [
     414                        'label'           => 'Use thumbnail',
     415                        'type'            => 'radio',
     416                        'data-link'       => 'use_srcset',
     417                        'data-link-val'   => '',
     418                        'checked'         => 'checked',
     419                        'container-style' => '',
     420                        'hide'            => '.dygform-container-resolutions',
     421                        'show'            => '.dygform-container-size',
     422                    ],
     423                    'size'          => [
     424                        'container-class' => '',
     425                        'data-link'       => 'size',
     426                        'type'            => 'select_option_group',
     427                        'placeholder'     => 'Thumnbnail size',
     428                        'options'         => [],
     429                    ],
     430                    'resolutions'   => [
     431                        'container-class' => '',
     432                        'type'            => 'input',
     433                        'placeholder'     => 'Srcset requested resolutions',
     434                        'data-link'       => 'resolutions',
     435                    ],
     436                ],
     437            ],
     438        ],
     439    ],
     440    'submit' => [
     441        'type' => 'button',
    268442        'container-class' => 'dygform-hidden',
    269         'contains'        => 'Update',
    270         'style'           => 'float:left;',
    271         'class'           => 'dygform-submit-button',
    272     ],
    273     'params'          => [
    274         'type'      => 'input',
    275         'hidden'    => 'hidden',
     443        'contains' => 'Update',
     444        'style' => 'float:left;',
     445        'class' => 'dygform-submit-button',
     446    ],
     447    'params' => [
     448        'type' => 'input',
     449        'hidden' => 'hidden',
    276450        'data-link' => 'params',
    277         'name'      => 'params',
     451        'name' => 'params',
    278452    ],
    279453];
  • agb-free/trunk/dyg-grid/includes/class-dygpg-form.php

    r2926907 r2926915  
    6969        if ($element['data-link'] === 'params') {
    7070            $this->args['params']['get_the_ID'] = get_the_ID();
    71             $val                                = dyg_encryption::encode_data($this->args);
     71            $val                                = dyg_encryption::encode_data($this->args['params']);
    7272            return $val;
    7373        }
     
    154154        //prefill the post types
    155155        $x                                                  = @$data->content_wrapper->contains;
    156         $x->filter_taxonomy                                 = dygform_add_options($x->filter_taxonomy, apply_filters('dygpg_filter_options', get_taxonomies(['public' => true])), $args['taxonomy'] ?? '');
     156        $x->filter_taxonomy                                 = dygform_add_options($x->filter_taxonomy, get_taxonomies(['public' => true]), $args['taxonomy'] ?? '');
    157157        $x->term                                            = dygform_add_options($x->term, array_merge(get_taxonomies(['public' => true]), dygpg_form::magic_fields), $args['term'] ?? '');
    158158        $x->filter_term                                     = dygform_add_options($x->filter_term, dygpg_form::magic_fields, $args['tax-terms'] ?? '');
    159         $x->filter_operator                                 = dygform_add_options($x->filter_operator, ["IN", "NOT IN"], $args['tax-operator'] ?? '');
     159        $x->filter_operator                                 = dygform_add_options($x->filter_operator, ["IN", "NOT IN", "EXISTS", "NOT EXISTS"], $args['tax-operator'] ?? '');
    160160
    161161        $x           = @$data->content_wrapper->contains->sort_wrapper->contains;
     
    199199    }
    200200
    201     /**
    202      * Takes the original args and the posted args and merges them together so that any that do
    203      * not have a corresponding input field in the editor are preserved
    204      * Note the naming of the input field as params is legacy and should be changed at some point
    205      * to a more meaningful name such as original_args
    206      *
    207      * @param array $args
    208      * @return array
    209      */
    210     function decrypt_and_reconcile_args($args) {
    211         $reconciled_array = (array) dyg_encryption::decode_data($args['params']);
    212         unset($args['params']);
    213         foreach($args as $key => $value) {
    214             $reconciled_array[$key] = $value;
    215         }
    216         return $reconciled_array;
    217     }
    218201
    219202
     
    245228
    246229        //decode the query_var parameters from the hidden field so that any loop parameters are used to update the grid
    247         $args = $this->decrypt_and_reconcile_args($args);
    248         $params = $args['params'];
    249 
     230        $params = (array) dyg_encryption::decode_data($args['params']);
    250231        if (!empty($args['order'])) {
    251232            $params['orderby']  = $args['orderby'];
     
    334315        unset($args['term_args']);
    335316        unset($existing_args['params']);
    336         $args['params'] = dyg_encryption::encode_data($args);;
     317        unset($args['params']);
    337318        $existing_args['undo'] = 'Y';
    338319        $args['undo']          = ''; //the undo hidden field will trigger a redo/undo on submit, so make sure it is cleared
  • agb-free/trunk/dyg-grid/includes/class-dygpg-postgrid.php

    r2926907 r2926915  
    44
    55    protected const Filler = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTA4MCIgaGVpZ2h0PSI1NDAiIHZpZXdCb3g9IjAgMCAxMDgwIDU0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPHBhdGggZmlsbD0iI0VCRUJFQiIgZD0iTTAgMGgxMDgwdjU0MEgweiIvPgogICAgICAgIDxwYXRoIGQ9Ik00NDUuNjQ5IDU0MGgtOTguOTk1TDE0NC42NDkgMzM3Ljk5NSAwIDQ4Mi42NDR2LTk4Ljk5NWwxMTYuMzY1LTExNi4zNjVjMTUuNjItMTUuNjIgNDAuOTQ3LTE1LjYyIDU2LjU2OCAwTDQ0NS42NSA1NDB6IiBmaWxsLW9wYWNpdHk9Ii4xIiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz4KICAgICAgICA8Y2lyY2xlIGZpbGwtb3BhY2l0eT0iLjA1IiBmaWxsPSIjMDAwIiBjeD0iMzMxIiBjeT0iMTQ4IiByPSI3MCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMDgwIDM3OXYxMTMuMTM3TDcyOC4xNjIgMTQwLjMgMzI4LjQ2MiA1NDBIMjE1LjMyNEw2OTkuODc4IDU1LjQ0NmMxNS42Mi0xNS42MiA0MC45NDgtMTUuNjIgNTYuNTY4IDBMMTA4MCAzNzl6IiBmaWxsLW9wYWNpdHk9Ii4yIiBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz4KICAgIDwvZz4KPC9zdmc+Cg==";
    6     public $args           = [];
     6    public $args = [];
    77    public $query, $qtotal, $qindex, $end_index, $qterm, $qstart_index, $qalt, $qsrc, $qexcerpt, $atts, $css, $qaspect_ratio, $qtitle;
     8   
    89
    910    function __construct() {
     
    1112//        $dygpg_db->delete_all();
    1213    }
     14
     15
    1316
    1417    function handle_preset($atts) {
     
    1922    }
    2023
     24
     25
    2126    public static function retrieve_atts($id) {
    2227        global $dygpg_db;
     
    2429    }
    2530
     31
     32
    2633    public static function update_atts($id, $args) {
    2734        global $dygpg_db;
    28         return $dygpg_db->db_insert($id, $args);
    29     }
     35         return $dygpg_db->db_insert($id, $args);
     36    }
     37
     38
    3039
    3140    public static function undo_atts($id) {
     
    3443    }
    3544
     45
     46
    3647    public static function redo_atts($id) {
    3748        global $dygpg_db;
     
    3950    }
    4051
    41     // if the id attribute is supplied, shortcode atts should be retrieved via database options and editing on the frontend should be handled through dyg_form
     52
     53
     54    // if the id attribute is supplied, shortcode atts should be retrieved via database options and editing on the frontend should be handled through dyg_form
    4255    function handle_id($id) {
    4356        //if no id is set, use the post-id
     
    6073            $this->args['version'] = '0';
    6174            unset($this->args['post-id']);
    62             $this->args = self::handle_legacy_atts($this->args);
    63         }
    64     }
     75            $this->args            = self::handle_legacy_atts($this->args);
     76        }
     77    }
     78
     79
    6580
    6681    public static function unset_pattern($key, &$atts) {
    6782        $index = array_search("%$key%", $atts['pattern']);
    68         if ($index === FALSE) {
     83        if ($index === FALSE)
    6984            return;
    70         }
    7185
    7286        unset($atts['pattern'][$index]);
    7387    }
     88
     89
    7490
    7591    /**
     
    86102                $atts['pattern'] = array_filter(explode(',', $atts['pattern'] ?? ''));
    87103            }
    88             if (($atts['show-post-content'] ?? '') === 'Y') {
     104            if (($atts['show-post-content'] ?? '') === 'Y')
    89105                self::unset_pattern('content', $atts);
    90             }
    91 
    92             if (($atts['use_button'] ?? '') !== 'Y') {
     106
     107            if (($atts['use_button'] ?? '') !== 'Y')
    93108                self::unset_pattern('button', $atts);
    94             }
    95 
    96             if (($atts['title'] ?? '') !== 'Y') {
     109
     110            if (($atts['title'] ?? '') !== 'Y')
    97111                self::unset_pattern('title', $atts);
    98             }
    99 
    100             if (($atts['image'] ?? '') !== 'Y') {
     112
     113            if (($atts['image'] ?? '') !== 'Y')
    101114                self::unset_pattern('image', $atts);
    102             }
    103 
    104             if (($atts['excerpt'] ?? '') !== 'Y') {
     115
     116            if (($atts['excerpt'] ?? '') !== 'Y')
    105117                self::unset_pattern('excerpt', $atts);
    106             }
    107118
    108119            $atts['pattern']      = implode(',', $atts['pattern']);
     
    128139
    129140        if (version_compare($atts['version'] ?? '0.0.0', '1.2.3', '<')) {
    130             if (($atts['use-columns'] ?? '-') === '') {
     141            if (($atts['use-columns'] ?? '-') === '')
    131142                $atts['use-columns'] = 'W';
    132             }
    133 
    134143        }
    135144        if (version_compare($atts['version'] ?? '0.0.0', '1.3.0', '<')) {
    136             if ($atts['show_woo_price'] ?? '' === 'Y' AND array_key_exists('pattern', $atts)) {
     145            if ($atts['show_woo_price'] ?? '' === 'Y' AND array_key_exists('pattern', $atts))
    137146                $atts['pattern'] = str_replace('%title%,', "%title%,%woo_price%,", $atts['pattern']);
    138             }
    139 
    140             if (array_key_exists('pattern', $atts)) {
     147
     148            if (array_key_exists('pattern', $atts))
    141149                $atts['pattern'] = strtr($atts['pattern'], ['%meta%' => $atts['meta_pattern'] ?? '' . ","]);
    142             }
    143150
    144151            unset($atts['show_woo_price']);
     
    147154            $atts['style-fonts'] = '';
    148155        }
    149         if (version_compare($atts['version'] ?? '0.0.0', '4.4.0', '<')) {
    150             $atts['equal-content-heights'] = ($atts['equal-content-heights'] ?? '') === '' ? 'N' : $atts['equal-content-heights'];
    151             $atts['equal-title-heights']   = ($atts['equal-title-heights'] ?? '') === '' ? 'N' : $atts['equal-title-heights'];
    152             $atts['equal-grid-heights']    = ($atts['equal-grid-heights'] ?? '') === '' ? 'N' : $atts['equal-grid-heights'];
    153             $atts['image']                 = ($atts['image'] ?? '') === 'Y' ? '' : $atts['image'];
    154             unset($atts['sizes']);
    155             unset($atts['title']);
    156         }
    157156        $atts['version'] = AGB_VERSION;
    158157        return $atts;
    159158    }
    160159
     160
     161
    161162    //main post grid shortcode function
    162163
    163164    /**
    164      *
     165     *
     166     * @param array $shortcode_atts = array of attributes
     167     * @param string $content = the shortcode content.  CSS code expected
     168     * @param string $tag = the shortcode tag passed by the callback.  not used.
     169     * @param boolean $inner = a flag to request only the inner portion of the html.  Used by the form editor
    165170     * @retur shortcode markup
    166      * @param array   $shortcode_atts = array of attributes
    167      * @param string  $content        = the shortcode content. CSS code expected
    168      * @param string  $tag            = the shortcode tag passed by the callback. not used.
    169      * @param boolean $inner          = a flag to request only the inner portion of the html. Used by the form editor
    170171     */
    171172    public function dyg_post_grid($shortcode_atts = [], $inner = false) {
     
    176177        $this->doing_full_wrapper = TRUE; // this will not be set during load more.  used to check if filter widgets etc are required
    177178        //dont continue if no shortcode is provided
    178         if (empty($shortcode_atts['id'] ?? '') && empty($shortcode_atts['post-id'] ?? '')) {
     179        if (empty($shortcode_atts['id'] ?? '') && empty($shortcode_atts['post-id'] ?? ''))
    179180            return "<div>Your agb shortcode is missing 'id=put-id-here'</div>";
    180         }
    181181
    182182        $this->handle_id($shortcode_atts['id'] ?? '');
    183183
    184         if ($inner) {
     184        if ($inner)
    185185            return $this->get_inner_agb();
    186         }
    187186
    188187        return strtr("<div class='dyg-post-grid-wrapper-outer dyg-post-grid-wrapper-outer-%id'>%editor%inner</div>", [
     
    192191        ]);
    193192    }
     193
     194
    194195
    195196    /**
     
    207208    }
    208209
     210
     211
    209212    /**
    210213     * sets the array of selectors to be included in the css field and output to the agb head
     
    215218            'wrapper',
    216219            'cell',
    217             'transition-wrapper',
    218220            'content',
    219221            'image',
     
    228230        foreach ($selectors as $selector) {
    229231            $css[$selector] = [
    230                 'selector'   => ".dygpg-$selector-$id.dygpg-$selector",
     232                'selector'   => ".dygpg-$selector.dygpg-$selector-" . $id,
    231233                'statements' => [],
    232234            ];
     
    234236        return $css;
    235237    }
     238
     239
    236240
    237241    /**
     
    247251    }
    248252
     253
     254
    249255    public static function get_shortcode_defaults($id) {
    250256        return apply_filters('dygpg-shortcode-array', [
    251             'id'                    => '', //indicates this shortcode is stored in the options table as dygpg-xyz, where xyz is any identifier.  Also triggers the form based editor
    252             'version'             => AGB_VERSION, // since 1.2.1 adds a version to each set of args
     257            'id'                       => '', //indicates this shortcode is stored in the options table as dygpg-xyz, where xyz is any identifier.  Also triggers the form based editor
     258            'version'                  => AGB_VERSION, // since 1.2.1 adds a version to each set of args
    253259            'css'                      => self::get_css_template($id), // used by the form editor to populate the css field
    254             'content'             => 'POST', // see comments as part of processing further down
    255             'use-columns'          => 'Y', // should the columns field be used to set media queries, or does the cell have a width defined elsewhere
    256             'columns'  => '4,3,2,1', // how many columns in desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
    257             'column-gap'        => '10px,10px,10px,10px', // column gap for desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
    258             'breakpoints' => '1080,768,479', // breakpoints for desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
    259             'pattern'  => "%image%,%<,%title%,%>", // should the description be populated with the_content or the_excerpt;
    260             'pattern-direction' => "", // list of pattern elements that should be inline-block
    261             'preset'  => "", // currectly selected style preset class
    262             'meta_pattern' => "", // pattern for taxonomy etc meta fields
    263             'posttype' => 'post', // set to the slug name of the past type
    264             'postparent' => '', // expects a post id.  if specified, uses get_children to find images attached to the post
    265             'size' => 'medium', //which thumbnail size to select.  somewhat obsolete now that srcset is in use, but does influence the value of the original src attribute
    266             'resolutions' => '350px,350px,350px', // replaces the sizes below as this is not converted on first load into media queries
    267             'sizes-string' => '(min-width: 0px) and (max-width: 480px) %s, (min-width: 481px) and (max-width: 980px) %s, (min-width: 981px) %s', // default template for the sizes attribute
    268             'link' => 'Y', // what should the href point to
    269             'link-images' => 'Y', // should the <a> link to another page our to '#'
    270             'cell-element' => 'div', //what element tag to use for the main cell.  default to an <a> tag, but change to a <div> if the cell should not be a links
    271             'loop' => 'N', // should the <a> link to another page our to '#'
    272             'title-tag' => 'h3', // what tag to wrap around title elements
    273             'width' => '200px',
    274             'show-content'          => 'Y', //show or hide the content wrapper div.  Adds class=dygpg-no-content
    275             'filter-term'         => '', //if set, a filter widget will be added using this term to filter the grid
     260            'content'                  => 'POST', // see comments as part of processing further down
     261            'use-columns'              => 'Y', // should the columns field be used to set media queries, or does the cell have a width defined elsewhere
     262            'columns'                  => '4,3,2,1', // how many columns in desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
     263            'column-gap'               => '10px,10px,10px,10px', // column gap for desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
     264            'breakpoints'              => '1080,768,479', // breakpoints for desktop, tablet, mobile - extra can be added but columns, column-gap must have one more element than breakpoint
     265            'pattern'                  => "%image%,%<,%title%,%>", // should the description be populated with the_content or the_excerpt;         
     266            'pattern-direction'        => "", // list of pattern elements that should be inline-block     
     267            'preset'                   => "", // currectly selected style preset class 
     268            'meta_pattern'             => "", // pattern for taxonomy etc meta fields   
     269            'button'                   => 'More', //should a button linking to the post be added to %button% if not empty.  The value of this field will be used as the label
     270            'posttype'                 => 'post', // set to the slug name of the past type
     271            'postparent'               => '', // expects a post id.  if specified, uses get_children to find images attached to the post
     272            'size'                     => 'medium', //which thumbnail size to select.  somewhat obsolete now that srcset is in use, but does influence the value of the original src attribute
     273            'resolutions'              => '350px,350px,350px', // replaces the sizes below as this is not converted on first load into media queries
     274            'sizes'                    => '350px,350px,350px', // desktop, tablet, mobile.  substitutes into the sizes attribute. 
     275            'sizes-string'             => '(min-width: 0px) and (max-width: 480px) %s, (min-width: 481px) and (max-width: 980px) %s, (min-width: 981px) %s', // default template for the sizes attribute
     276            'link'                     => 'Y', // what should the href point to
     277            'link-images'              => 'Y', // should the <a> link to another page our to '#'
     278            'cell-element'             => 'div', //what element tag to use for the main cell.  default to an <a> tag, but change to a <div> if the cell should not be a links
     279            'loop'                     => 'N', // should the <a> link to another page our to '#'
     280            'title-tag'                => 'h3', // what tag to wrap around title elements
     281            'width'                    => '200px',
     282            'show-content'             => 'Y', //show or hide the content wrapper div.  Adds class=dygpg-no-content
     283            'filter-term'              => '', //if set, a filter widget will be added using this term to filter the grid
    276284            'use-dynamic-filter-links' => '', //if 'Y', the filter widget will link to category pages rather than filter the post grid dynamically
    277             'term'                => '', //if not black then the loop is based on get_terms instead of wp_query
    278             'class'                => '', //enter additional css classes separated by spaces
    279             'lightbox' => 'N', //opens the image in a divi lightbox.  Must set class='lightbox-group=xxx' and aclass="et_pb_lightbox_image"
    280             'use-button'        => '',
    281             'aclass'                => '', //enter additional css classes for the <a> object.  for example ad dyg-aspect-ratio
    282             'iclass'              => '', //enter additional css classes for the <i> object.  for example ad dyg-aspect-ratio
     285            'term'                     => '', //if not black then the loop is based on get_terms instead of wp_query
     286            'class'                    => '', //enter additional css classes separated by spaces
     287            'lightbox'                 => 'N', //opens the image in a divi lightbox.  Must set class='lightbox-group=xxx' and aclass="et_pb_lightbox_image"
     288            'use-button'               => '',
     289            'aclass'                   => '', //enter additional css classes for the <a> object.  for example ad dyg-aspect-ratio
     290            'iclass'                   => '', //enter additional css classes for the <i> object.  for example ad dyg-aspect-ratio
    283291            'iclass-aspect-ratio'      => '4-3', //used by form editor to flag that aspect ratio classes should be added to the image
    284             'aclass-aspect-ratio' => '', //used by form editor to flag that aspect ratio classes should be added to the cell
    285             'content-aspect-ratio' => '', //used by form editor to flag that aspect ratio classes should be added to the cell
    286             'show-post-content' => '', //show the_content
    287             'numposts'    => '999999', //only output first x results
    288             'pagesize' => '8', //numer of posts per page before ajax load more
    289             'use-ajax'          => '', //use ajax to load more.  if not, use a button.  NOT YET IMPLEMENTED
    290             'orderby' => '', //meta_value (string) or meta_value_num (number) for a custom field, then enter the meta-key
    291             'meta-key'     => '', //use this field value as a key if orderby has a metavalue
    292             'order'  => '',
    293             'use_srcset'            => 'Y',
    294             'projectcategory'       => '',
    295             'taxonomy'              => '', //if this arg is set the posts will be filtered by the specified taxonomy and the tax_query parameters will be used
    296             'equal-title-heights' => 'N',
    297             'equal-grid-heights'    => 'N',
    298             'equal-content-heights' => 'N',
    299             'tax-field'             => 'slug', //this tells the taxonomy search that the 'terms' argument is the 'slug' and not the name
    300             'tax-terms'           => '',
    301             'tax-operator'          => '',
    302             'category'              => '', //use the slug
    303             'shortcode'           => '', //form editor storage for the original shortcode
     292            'aclass-aspect-ratio'      => '', //used by form editor to flag that aspect ratio classes should be added to the cell
     293            'content-aspect-ratio'     => '', //used by form editor to flag that aspect ratio classes should be added to the cell
     294            'image'                    => 'Y', // 'Y' for separate <img> object.  'B' for background of the <a> object - only implemented for term so far
     295            'show-post-content'        => '', //show the_content
     296            'numposts'                 => '999999', //only output first x results
     297            'pagesize'                 => '8', //numer of posts per page before ajax load more
     298            'use-ajax'                 => '', //use ajax to load more.  if not, use a button.  NOT YET IMPLEMENTED
     299            'orderby'                  => '', //meta_value (string) or meta_value_num (number) for a custom field, then enter the meta-key
     300            'meta-key'                 => '', //use this field value as a key if orderby has a metavalue
     301            'order'                    => '',
     302            'use_srcset'               => 'Y',
     303            'projectcategory'          => '',
     304            'taxonomy'                 => '', //if this arg is set the posts will be filtered by the specified taxonomy and the tax_query parameters will be used
     305            'equal-title-heights'      => 'N',
     306            'equal-grid-heights'       => 'N',
     307            'equal-content-heights'    => 'N',
     308            'tax-field'                => 'slug', //this tells the taxonomy search that the 'terms' argument is the 'slug' and not the name
     309            'tax-terms'                => '',
     310            'post_mime_type'           => '',
     311            'post_status'              => '', //is set to inherit for media library items
     312            'tax-operator'             => '',
     313            'category'                 => '', //use the slug
     314            'shortcode'                => '', //form editor storage for the original shortcode
    304315            'start-index'              => 1,
    305             'notcat'                => '',
     316            'notcat'                   => ''
    306317        ]);
    307318    }
     319
     320
    308321
    309322    function validate_shortcode_atts($atts) {
     
    322335        $this->args['link']        = $this->args['lightbox'] === 'Y' ? 'L' : $this->args['link'] ?? '';
    323336        $this->args['use-columns'] = $this->args['columns'] === 'Y' ? '' : $this->args['use-columns'] ?? '';
    324         $this->args['class'] .= $this->args['show-content'] === 'Y' ? '' : " dygpg-no-content";
    325         $this->args['class'] .= is_agb_pro() && $this->args['link'] === 'L' ? ' dygpg-lightbox-wrapper' : " ";
    326         $this->args['content'] = $this->args['loop'] !== 'Y' ? $this->args['content'] : 'LOOP';
    327         $this->args['content'] = in_array(strtolower($this->args['content']), ['media-library', 'media_library']) ? 'MEDIA-LIBRARY' : $this->args['content'];
     337        $this->args['class']       .= $this->args['show-content'] === 'Y' ? '' : " dygpg-no-content";
     338        $this->args['class']       .= is_agb_pro() && $this->args['link'] === 'L' ? ' dygpg-lightbox-wrapper' : " ";
     339        $this->args['content']     = $this->args['loop'] !== 'Y' ? $this->args['content'] : 'LOOP';
     340        $this->args['content']     = in_array(strtolower($this->args['content']), ['media-library', 'media_library']) ? 'MEDIA-LIBRARY' : $this->args['content'];
    328341        if (!empty($this->args['category'])) {
    329342            $this->args['taxonomy']  = 'category';
     
    334347        unset($this->args['loop']);
    335348
     349        // setup wp_query for certain content types
     350        if ($this->args['content'] == "MEDIA-LIBRARY") {
     351            $this->args['posttype']    = "attachment";
     352            $this->args['post_status'] = "inherit";
     353        }
     354
    336355        //prepare the sizes attribute for use with srcset
    337356        $sizes               = explode(',', $this->args['resolutions']);
    338357        $sizes[0]            = $sizes[0] ?? '350px';
    339         $this->srcset_sizes = sprintf($this->args['sizes-string'], $sizes[2] ?? $sizes[0], $sizes[1] ?? $sizes[0], $sizes[0]);
     358        $this->args['sizes'] = sprintf($this->args['sizes-string'], $sizes[2] ?? $sizes[0], $sizes[1] ?? $sizes[0], $sizes[0]);
    340359
    341360        // determine what content type has been requested
     
    359378        }
    360379
     380
    361381        //cast strings to integers
    362382        foreach (['numposts', 'pagesize'] as $key) {
     
    367387        $params = [
    368388            'post_type'        => $this->args['posttype'],
    369             'post_status'      => ['inherit', 'publish'],
     389            'post_mime_type'   => $this->args['post_mime_type'],
     390            'post_status'      => $this->args['post_status'],
    370391            'category_name'    => $this->args['category'],
    371392            'project_category' => $this->args['projectcategory'],
    372393            'post_parent'      => $this->args['postparent'],
    373394            'orderby'          => empty($this->args['orderby']) ? 'ID' : $this->args['orderby'], //empty sort order causes issues with paging
    374             'order' => empty($this->args['order']) ? 'ASC' : $this->args['order'],
     395            'order'            => empty($this->args['order']) ? 'ASC' : $this->args['order'],
    375396            'meta_key'         => $this->args['meta-key'],
    376397            'posts_per_page'   => $this->args['pagesize'],
    377             'get_the_ID'       => isset($this->atts['params']['get_the_ID']) ? $this->atts['params']['get_the_ID'] : get_the_ID(),
     398            'get_the_ID'       => isset($this->atts['params']['get_the_ID']) ? $this->atts['params']['get_the_ID'] : get_the_ID()
    378399        ];
    379400
    380401        // should the wp_query be filtered by taxonomy?  If so add these parameters to the args
    381402        if ($this->args['taxonomy'] != "") {
    382             $params_tax = [
     403            $params_tax                          = [
    383404                'tax_query' => [
    384405                    [
     
    386407                        'field'    => $this->args['tax-field'],
    387408                        'terms'    => strpos($this->args['tax-terms'], ',') === FALSE ? $this->args['tax-terms'] : explode(',', $this->args['tax-terms']), // exclude items media items in the news-cat custom taxonomy
    388                         'operator' => $this->args['tax-operator']],
    389                 ],
     409                        'operator' => $this->args['tax-operator']]
     410                ]
    390411            ];
    391412            $params_tax['tax_query'][0]['terms'] = $this->convert_magic_field($params_tax['tax_query'][0]['terms'], $params);
     
    402423        // append the meta-key arguments if a meta-key is defined
    403424        if ($this->args['meta-key'] != '') {
    404             $term_args_append = [
     425            $term_args_append        = [
    405426                'meta_query' => [[
    406                     'key'  => $this->args['meta-key'],
    407                     'type' => 'NUMERIC',
    408                 ]],
     427                'key'  => $this->args['meta-key'],
     428                'type' => 'NUMERIC',
     429                    ]]
    409430            ];
    410431            $this->args['term_args'] = array_merge($this->args['term_args'], $term_args_append);
     
    426447            }
    427448            $params                   = $loop_params;
    428             $params['posts_per_page'] = 9999999;
     449            $params['posts_per_page'] = 9999999; 
    429450        }
    430451        $params               = apply_filters('dygpg-params', $params, $this);
     
    435456    }
    436457
     458
     459
    437460    public function convert_magic_field($field, $params) {
    438         if (is_array($field)) {
     461        if (is_array($field))
    439462            return $field;
    440         }
    441 
    442         if (strpos($field, '%post_slug%') !== false) {
     463
     464        if (strpos($field, '%post_slug%') !== false)
    443465            return str_replace("%post_slug%", get_post_field('post_name', $params['get_the_ID']), $field);
    444         }
    445 
    446         if (strpos($field, '%post_title%') !== false) {
     466
     467        if (strpos($field, '%post_title%') !== false)
    447468            return str_replace("%post_title%", get_post_field('post_name', $params['get_the_ID']), $field);
    448         }
     469
    449470
    450471        if (strpos($field, '%attached_terms%') !== false) {
    451472            $terms = get_the_terms($params['get_the_ID'], $this->args['taxonomy']);
    452             if (!is_array($terms)) {
     473            if (!is_array($terms))
    453474                return '';
    454             }
    455 
    456475            $field = [];
    457476            foreach ($terms as $term) {
     
    464483    }
    465484
     485
     486
    466487    /**
    467488     * converts the $this->css array into css statements
    468      *
     489     * 
    469490     */
    470491    function generate_inline_css() {
     
    483504    }
    484505
     506
     507
    485508    /**
    486509     * adds the predefined css as well as ::root variables ahead of the post grid to set columns widths and gap
    487      * @param  string  $index
     510     * @param string $index
    488511     * @return string
    489512     */
     
    494517
    495518        return strtr("<style>%media %css</style>",
    496             [
    497                 '%media' => dygpg_toolbox::escape_css($this->get_media_queries($index)),
    498                 '%css'   => dygpg_toolbox::escape_css($this->generate_inline_css() . $this->args['css'] ?? ''),
    499             ]
     519                [
     520                    '%media' => dygpg_toolbox::escape_css($this->get_media_queries($index)),
     521                    '%css'   => dygpg_toolbox::escape_css($this->generate_inline_css() . $this->args['css'] ?? ''),
     522                ]
    500523        );
    501524    }
     525
     526
    502527
    503528    function get_media_queries($index) {
     
    506531        $breakpoints = explode(',', $this->args['breakpoints']);
    507532
    508         if (empty($breakpoints)) {
     533        if (empty($breakpoints))
    509534            $breakpoints[] = '1080';
    510         }
    511 
    512         if (empty($gap)) {
     535
     536        if (empty($gap))
    513537            $gap[] = '0px';
    514         }
    515538
    516539        $root = '';
    517540        $len  = count($column);
    518541        for ($i = 0;
    519             $i < $len; $i++) {
     542                $i < $len; $i++) {
    520543            $gap[$i] = $gap[$i] ?? end($gap);
    521544
     
    559582            @media only screen and $min $max {
    560583                .dyg-post-grid-wrapper-$index .dygpg-cell {
    561                     width: calc(100% / {$column[$i]} - 2 * {$margin});
     584                    width: calc(calc(100% - calc(calc(calc({$column[$i]}-1)*2)*{$margin}))/{$column[$i]});
    562585                    margin: {$margin};
    563586                }
     
    576599    }
    577600
     601
     602
    578603    public static function buildArgs($array) {
    579604        if (empty($array)) {
     
    582607        $ret = '';
    583608        foreach ($array as $key => $value) {
    584             $q = strpos($value, ' ') !== false ? "'" : '';
     609            $q   = strpos($value, ' ') !== false ? "'" : '';
    585610            $ret .= " $key={$q}$value{$q}";
    586611        }
    587612        return trim($ret);
    588613    }
     614
     615
    589616
    590617    function public_edit_id() {
     
    592619
    593620        return strtr("<div class='dygpg-edit-wrapper dygpg-edit-wrapper-%id dygpg-edit-wrapper-id'>%form</div>"
    594             . "<i onclick='dygpgEditIconClick(\"%id\",this)' class='fas fa-cog dygpg-edit-icon dygpg-edit-icon-%id'></i>",
    595             [
    596                 '%form' => $form->get_form(),
    597                 '%id'   => esc_attr($this->args['id']),
    598             ]
     621                . "<i onclick='dygpgEditIconClick(\"%id\",this)' class='fas fa-cog dygpg-edit-icon dygpg-edit-icon-%id'></i>",
     622                [
     623                    '%form' => $form->get_form(),
     624                    '%id'   => esc_attr($this->args['id'])
     625                ]
    599626        );
    600627    }
     628
     629
    601630
    602631    function get_frontend_editor() {
     
    611640        $allow_editing &= !isset($_POST['is_fb_preview']);
    612641        $allow_editing &= is_user_logged_in();
    613         $allow_editing &= current_user_can(apply_filters('dygpg-editing-capability', ''));
     642        $allow_editing &= current_user_can('administrator');
    614643
    615644        return apply_filters('dygpg-allow-edit', $allow_editing, $this) === TRUE ? $this->public_edit_id() : '';
    616645
    617646    }
     647
     648
    618649
    619650    /*
     
    629660
    630661        //documents will not have a srcset
    631         if (!str_contains(get_post_mime_type($id), 'image')) {
     662        if (!str_contains(get_post_mime_type($id), 'image'))
    632663            return "";
    633         }
    634664
    635665        $this->qaspect_ratio = round($image_meta['width'] / $image_meta['height'], 2);
     
    643673        foreach ($image_meta['sizes'] as $image) {
    644674            //only add the image if it has the same aspect ratio, i.e. is not cropped
    645             if (!($image['height'] ?? 0 > 0)) {
     675            if (!($image['height'] ?? 0 > 0))
    646676                continue;
    647             }
    648 
    649677            if ($this->qaspect_ratio === round($image['width'] / $image['height'], 2)) {
    650678                $srcset .= "$image_baseurl{$image['file']} {$image['width']}w,";
     
    661689    }
    662690
     691
     692
     693// handles the loop for post attachments
     694    function grid_query_attachment() {
     695        if (!isset($this->query)) {
     696            $this->args['params']['posts_per_page'] = -1;
     697            $this->build_filter();
     698            $args                                   = [
     699                'tax_query'   => $this->args['params']['tax_query'] ?? [],
     700//                'post_mime_type' => ['application/doc','application/pdf', 'text/plain', 'image'],
     701                'post_parent' => '',
     702                'post_type'   => 'attachment',
     703                'orderby'     => $this->args['orderby'],
     704                'order'       => $this->args['order'],
     705                'meta_key'    => $this->args['meta-key'],
     706            ];
     707            $post_array                             = get_children($args);
     708//            $post_array                             = get_children($this->args['params']);
     709            $this->query                            = [];
     710            foreach ($post_array as $post) {
     711                $this->query[] = $post->ID;
     712            }
     713            $this->qtotal = count($this->query);
     714            if (isset($this->qstart_index)) {
     715                $this->qindex = $this->qstart_index - 1;
     716            } else {
     717                $this->qindex = 0;
     718            }
     719        }
     720        if ($this->qindex < ($this->qtotal)) {
     721            $this->qtitle     = get_the_title($this->query[$this->qindex]);
     722            $this->qexcerpt   = get_the_excerpt($this->query[$this->qindex]);
     723            $this->qcontent   = get_the_content(null, false, $this->query[$this->qindex]);
     724            $this->qpid       = $this->query[$this->qindex];
     725            $this->qid        = $this->query[$this->qindex];
     726            $this->qpermalink = get_the_permalink($this->query[$this->qindex]);
     727            $this->qsrc       = wp_get_attachment_image_src($this->query[$this->qindex], $this->args['size'])[0] ?? '';
     728            $this->qsrcfull   = wp_get_attachment_image_src($this->query[$this->qindex], 'full')[0] ?? '';
     729            $this->qsrcset    = $this->dyg_get_attachment_image_srcset($this->query[$this->qindex], 'full');
     730            $this->qalt       = get_post_meta($this->query[$this->qindex], '_wp_attachment_image_alt', true);
     731            $this->qsizes     = $this->args['sizes'];  //this needs more work.  The WP function that returns the srcset sizes is not adequate
     732            $this->qindex++;
     733            return true;
     734        } else {
     735            unset($this->query);
     736            return false;
     737        }
     738    }
     739
     740
     741
    663742// handles the loop data for a term query
    664743    function grid_query_term() {
     
    670749                $this->query = get_the_terms($this->args['params']['get_the_ID'], $this->args['term_args']['taxonomy']);
    671750
    672                 //if not then get all terms in the taxonomy
     751                //if not then get all terms in the taxonomy   
    673752            } else {
    674753                $this->query = get_terms($this->args['term_args']);
     
    685764        if ($this->qindex < ($this->qtotal)) {
    686765            $this->qterm = $this->query[$this->qindex];
    687             $this->qid   = "{$this->qterm->taxonomy}-{$this->qterm->term_id}";
    688 
    689             //plugin:Category and Taxonomy Image
     766            $this->qid   = '';
     767
     768            //plugin:Category and Taxonomy Image 
    690769            if (function_exists('get_wp_term_image')) {
    691770                $this->qsrc = get_wp_term_image($this->qterm->term_id);
     
    699778                //for acf
    700779            } else if (function_exists('get_field')) {
    701                 $this->qsrc    = get_field("taxonomy_image", "{$this->args['term_args']['taxonomy']}_{$this->qterm->term_id}"); //nb acf requires this specific sytax - refer to their docs
     780                $this->qsrc    = get_field("taxonomy_image", "{$this->args['term_args']['taxonomy']}_{$this->qterm->term_id}");  //nb acf requires this specific sytax - refer to their docs
    702781                $this->qpid    = attachment_url_to_postid($this->qsrc);
    703782                $this->qsrcset = $this->dyg_get_attachment_image_srcset($this->qpid, 'full');
     
    710789                $this->qsrcset  = $this->dyg_get_attachment_image_srcset($this->qpid, 'full');
    711790            }
    712             $this->qsizes     = $this->srcset_sizes;
     791            $this->qsizes     = $this->args['sizes'];
    713792            $this->qalt       = $this->qterm->name;
    714793            $this->qtitle     = $this->qterm->name;
     
    723802    }
    724803
    725     /**
    726      * this function used to handle media library queries using get_children, but not passes
    727      * procesing to the grid_query_post as an attachment as it had more advanced page handling
    728      *
    729      * @return void
    730      */
    731     function grid_query_attachment() {
    732         return $this->grid_query_post();
    733     }
    734 
    735     // handles the loop for posts
     804
     805
     806// handles the loop for posts
    736807    function grid_query_post() {
    737808        if (!isset($this->query)) {
     
    739810            $this->qindex                   = $this->qstart_index - 1;
    740811            $this->args['params']['offset'] = $this->qindex;
    741             $this->args['params']           = apply_filters('dygpg_query_post_params', $this->args['params'], $this);
    742812            $this->query                    = apply_filters('dygpg_grid_query_post', new WP_Query($this->args['params']), $this);
    743813            $this->qtotal                   = $this->query->found_posts;
     
    745815        if ($this->query->have_posts()) {
    746816            $this->query->the_post();
    747             $this->qid = $this->query->post->ID;
     817            $this->qid          = $this->query->post->ID;
    748818            $this->qindex++;
    749             $this->qpermalink = get_the_permalink();
    750             $this->qtitle     = get_the_title();
     819            $this->qpermalink   = get_the_permalink();
     820            $this->qtitle       = get_the_title();
    751821            //if divi is in use make sure builder shortcodes are not returend.
    752             $this->qpgexcerpt = function_exists('get_field') ? get_field('post_grid_excerpt') : '';
     822            $this->qpgexcerpt   = function_exists('get_field') ? get_field('post_grid_excerpt') : '';
    753823            // the et_builder_get_the_term_list function is not loaded when the post_grid is generated via ajax
    754             $this->qdate    = get_the_date();
    755             $this->qcontent = strpos($this->args['pattern'], '%content%') !== false ? do_shortcode(get_the_content()) : ''; //filter will render divi content
    756             $this->qexcerpt = strpos($this->args['pattern'], '%excerpt%') !== false ? apply_filters('the_excerpt', get_the_excerpt()) : '';
     824            $this->qdate        = get_the_date();
     825            $this->qcontent     = strpos($this->args['pattern'], '%content%') !== false ? do_shortcode(get_the_content()) : ''; //filter will render divi content
     826            $this->qexcerpt     = strpos($this->args['pattern'], '%excerpt%') !== false ? apply_filters('the_excerpt', get_the_excerpt()) : '';
    757827            //if qpid is zero, it's probably a media library loop so the attachment is the same as the post;
    758828            $this->qpid         = get_post_thumbnail_id() === 0 ? $this->qid : get_post_thumbnail_id();
     
    761831            $this->qsrcset      = $this->dyg_get_attachment_image_srcset($this->qpid, 'medium');
    762832            $this->qalt         = get_post_meta($this->qpid, '_wp_attachment_image_alt', true);
    763             $this->qsizes       = $this->srcset_sizes;
     833            $this->qsizes       = $this->args['sizes'];
    764834            $this->filter_class = $this->get_filter_classes();
    765835            return true;
     
    770840    }
    771841
     842
     843
    772844    function build_filter() {
    773845        unset($this->filter);
     
    784856                'post_type' => $this->args['content'] === 'LOOP' ? get_post_type() : $this->args['params']['post_type'],
    785857                'orderby'   => $this->args['orderby'],
    786                 'order'     => $this->args['order'],
     858                'order'     => $this->args['order']
    787859            ];
    788860        } else {
    789861            $query_args = $this->args['params'];
    790862        }
    791         $query_args['nopaging'] = true; //make sure all posts are returned
     863        $query_args['nopaging'] = true;  //make sure all posts are returned
    792864
    793865        $query = new WP_Query($query_args);
     
    827899    }
    828900
     901
     902
    829903    function get_filter_classes() {
    830904        if (!isset($this->filter_taxonomy)) {
     
    848922        return $filter_classes;
    849923    }
     924
     925
    850926
    851927    // determine which content loop function to call unless the current page size is reached
     
    857933        }
    858934    }
     935
     936
    859937
    860938    /**
     
    881959    }
    882960
     961
     962
    883963    /**
    884964     * returns the href to use for click navigation in the main loop
    885965     */
    886966    function get_href() {
    887         if ($this->args['link'] == 'N' || $this->args['link'] == '') {
     967        if ($this->args['link'] == 'N' || $this->args['link'] == '')
    888968            apply_filters('dygpg-href', '', $this);
    889         }
    890969
    891970        $this->href = apply_filters('dygpg-href', $this->qpermalink, $this);
     
    893972    }
    894973
     974
     975
    895976    /**
    896977     * returns the lightbox data element for for use with magnific popup
    897978     */
    898979    function get_lightbox() {
    899         if ($this->args['link'] !== 'L') {
     980        if ($this->args['link'] !== 'L')
    900981            return '';
    901         }
    902982
    903983        return strtr("data-mfp-src='%src'", [
     
    905985        ]);
    906986    }
     987
     988
    907989
    908990    /**
     
    914996        ]);
    915997        return self::get_pattern_field_wrapper_static(
    916             'excerpt',
    917             $excerpt,
    918             $this->args['pattern-direction'],
    919             ''
     998                        'excerpt',
     999                        $excerpt,
     1000                        $this->args['pattern-direction'],
     1001                        ''
    9201002        );
    9211003    }
     1004
     1005
    9221006
    9231007    /**
     
    9291013        ]);
    9301014        return self::get_pattern_field_wrapper_static(
    931             'content',
    932             $content,
    933             $this->args['pattern-direction'],
    934             ''
     1015                        'content',
     1016                        $content,
     1017                        $this->args['pattern-direction'],
     1018                        ''
    9351019        );
    9361020    }
    9371021
     1022
     1023
    9381024    /**
    9391025     * returns the titles to use in the main loop
    940      * @param  string $href - the href to include in the title for click navigation
     1026     * @param string $href - the href to include in the title for click navigation
    9411027     * @return string - title markup
    9421028     */
     
    9501036
    9511037        return self::get_pattern_field_wrapper_static(
    952             'title',
    953             apply_filters('dygpg-title', $title, $this, $href),
    954             $this->args['pattern-direction'],
    955             ''
     1038                        'title',
     1039                        apply_filters('dygpg-title', $title, $this, $href),
     1040                        $this->args['pattern-direction'],
     1041                        ''
    9561042        );
    9571043    }
    9581044
    959    
    960     /**
    961      *
     1045
     1046
     1047    /**
     1048     *
     1049     * @return string - the css styles to include in the main loop cell attribute wrapped in style=''
     1050     */
     1051    function get_style() {
     1052        $style = '';
     1053        if ($this->args['image'] === "B") {
     1054            $style .= "background-image:url(\"$this->qsrc\");";
     1055        }
     1056        return apply_filters('dygpg-filter-cell-inline-style', $style, $this);
     1057    }
     1058
     1059
     1060
     1061    /**
     1062     *
    9621063     * get the image element for use in the main loop
    9631064     * @param string $href -the href url for navigation when an image is clicked.
     
    9651066    function get_image($href) {
    9661067        $image = strtr("<img class='dygpg-image dygpg-image-{$this->args['id']} %iclass' %aspect src='%src' srcset='%srcset' sizes='%sizes' alt='%alt' title='%title'/>",
    967             [
    968                 '%href'   => esc_url($href),
    969                 '%iclass' => dygpg_toolbox::sanitize_classes($this->args['iclass']),
    970                 '%aspect' => $this->get_aspect_parameters($this->args['iclass-aspect-ratio']),
    971                 '%srcset' => $this->qsrcset ?? '',
    972                 '%sizes'  => $this->qsizes ?? '',
    973                 '%src'    => empty($this->qsrcset) ? $this->qsrc : '',
    974                 '%alt'    => esc_html($this->qalt),
    975                 '%title'  => apply_filters('dygpg-tooltip', esc_attr(apply_filters('dygpg-qtitle', $this->qtitle, $this)), $this),
    976             ]
     1068                [
     1069                    '%href'   => esc_url($href),
     1070                    '%iclass' => dygpg_toolbox::sanitize_classes($this->args['iclass']),
     1071                    '%aspect' => $this->get_aspect_parameters($this->args['iclass-aspect-ratio']),
     1072                    '%srcset' => $this->qsrcset ?? '',
     1073                    '%sizes'  => $this->qsizes ?? '',
     1074                    '%src'    => empty($this->qsrcset) ? $this->qsrc : '',
     1075                    '%alt'    => esc_html($this->qalt),
     1076                    '%title'  => apply_filters('dygpg-tooltip', esc_attr(apply_filters('dygpg-qtitle', $this->qtitle, $this)), $this),
     1077                ]
    9771078        );
    9781079
     
    9841085        }
    9851086        $image = self::get_pattern_field_wrapper_static(
    986             'image',
    987             $image,
    988             $this->args['pattern-direction'],
    989             ''
     1087                        'image',
     1088                        $image,
     1089                        $this->args['pattern-direction'],
     1090                        ''
    9901091        );
    9911092        return apply_filters('dygpg_image', $image, $this);
    9921093    }
    9931094
     1095
     1096
    9941097    /**
    9951098     * return markup for the load more button
     
    9981101    function get_button($href) {
    9991102        $html = strtr("<a class='dygpg-button dygpg-button-{$this->args['id']}' href='%href'><button>%button</button></a>",
    1000             [
    1001                 '%href'   => esc_url($href),
    1002                 '%button' => esc_html($this->args['button']),
    1003             ]
     1103                [
     1104                    '%href'   => esc_url($href),
     1105                    '%button' => esc_html($this->args['button']),
     1106                ]
    10041107        );
    10051108        return self::get_pattern_field_wrapper_static(
    1006             'button',
    1007             $html,
    1008             $this->args['pattern-direction'],
    1009             ''
     1109                        'button',
     1110                        $html,
     1111                        $this->args['pattern-direction'],
     1112                        ''
    10101113        );
    10111114    }
     1115
     1116
    10121117
    10131118    /**
     
    10171122    function get_date($href) {
    10181123        return self::get_pattern_field_wrapper_static(
    1019             'date',
    1020             get_the_date('M d, Y'),
    1021             $this->args['pattern-direction'],
    1022             "dygpg-text dygpg-text-{$this->args['id']}"
     1124                        'date',
     1125                        get_the_date('M d, Y'),
     1126                        $this->args['pattern-direction'],
     1127                        "dygpg-text dygpg-text-{$this->args['id']}"
    10231128        );
    10241129    }
     1130
     1131
    10251132
    10261133    /**
     
    10301137    function get_author($href) {
    10311138        return self::get_pattern_field_wrapper_static(
    1032             'author',
    1033             get_the_author(),
    1034             $this->args['pattern-direction'],
    1035             "dygpg-text dygpg-text-{$this->args['id']}"
     1139                        'author',
     1140                        get_the_author(),
     1141                        $this->args['pattern-direction'],
     1142                        "dygpg-text dygpg-text-{$this->args['id']}"
    10361143        );
    10371144    }
    10381145
     1146
     1147
    10391148    /**
    10401149     * adds a wrapper class with either span or div depending on the corresponding pattern direction
    1041      * @param  string $field                - pattern field without surrounding %
    1042      * @param  string $html
    1043      * @param  string $pattern_direction
    1044      * @param  string $class
     1150     * @param string $field - pattern field without surrounding %
     1151     * @param string $html
     1152     * @param string $pattern_direction
     1153     * @param string $class
    10451154     * @return string - html with new wrapper
    10461155     */
     
    10481157        $el = 'block';
    10491158
    1050         if (strpos($pattern_direction, "%$field%") !== false) {
     1159        if (strpos($pattern_direction, "%$field%") !== false)
    10511160            $el = 'inline';
    1052         }
    10531161
    10541162        return strtr("<div class='dygpg-pattern dygpg-pattern-%field%class dygpg-pattern-%el %filter_class'>%html</div>", [
    1055             '%el'           => $el,
    1056             '%field'        => $field,
    1057             '%html'         => $html,
    1058             '%filter_class' => apply_filters('dygpg-pattern-class', '', $field, $this),
    1059             '%class'        => empty($class) ? '' : " $class",
     1163            '%el'    => $el,
     1164            '%field' => $field,
     1165            '%html'  => $html,
     1166            '%filter_class'  => apply_filters('dygpg-pattern-class', '', $field, $this),
     1167            '%class' => empty($class) ? '' : " $class",
    10601168        ]);
    10611169    }
    10621170
     1171
     1172
    10631173    /**
    10641174     * handle the pattern argument so that elements can be re-ordered or extra html inserted
    1065      * @param  string $href - url for click navigation
     1175     * @param string $href - url for click navigation
    10661176     * @return string - html markup for the grids content
    10671177     */
     
    10731183            $field = trim($field, '% ,');
    10741184            switch ($field) {
    1075                 case "":
     1185                case "" :
    10761186                    break;
    1077                 case "title":
     1187                case "title" :
    10781188                    $output[] = $this->get_titles($href);
    10791189                    break;
    1080                 case "<":
     1190                case "<" :
    10811191                    $output[] = apply_filters('dygpg-content-open',
    1082                         strtr("<div %aspect class='dygpg-content dygpg-content-%id%equalise' style='%style'>", [
    1083                             '%id'       => $this->args['id'],
    1084                             '%equalise' => $this->args['equal-content-heights'] === 'Y' ? " dyg-equal-height-content-{$this->args['id']}" : '',
    1085                             '%aspect'   => $this->get_aspect_parameters($this->args['content-aspect-ratio'] ?? ''),
    1086                             '%style'   => apply_filters('dygpg-content-inline-style', '', $this),
    1087                         ]),
    1088                         $this);
     1192                            strtr("<div %aspect class='dygpg-content dygpg-content-%id%equalise'>", [
     1193                        '%id'       => $this->args['id'],
     1194                        '%equalise' => $this->args['equal-content-heights'] === 'Y' ? " dyg-equal-height-content-{$this->args['id']}" : '',
     1195                        '%aspect'   => $this->get_aspect_parameters($this->args['content-aspect-ratio'] ?? ''),
     1196                            ]),
     1197                            $this);
    10891198                    break;
    1090                 case ">":
     1199                case ">" :
    10911200                    $output[] = apply_filters('dygpg-content-close', "</div>");
    10921201                    break;
    1093                 case "button":
     1202                case "button" :
    10941203                    $output[] = $this->get_button($href);
    10951204                    break;
    1096                 case "image":
     1205                case "image" :
    10971206                    $output[] = $this->get_image($href);
    10981207                    break;
    1099                 case "excerpt":
     1208                case "excerpt" :
    11001209                    $output[] = $this->get_excerpt();
    11011210                    break;
    1102                 case "content":
     1211                case "content" :
    11031212                    $output[] = $this->get_the_content();
    11041213                    break;
    1105                 case "date":
     1214                case "date" :
    11061215                    $output[] = $this->get_date($href);
    11071216                    break;
    1108                 case "author":
     1217                case "author" :
    11091218                    $output[] = $this->get_author($href);
    11101219                    break;
    11111220                default:
    1112                     $pattern_element = apply_filters('dygpg-get-pattern-element', $field, $this);
    1113                     if (empty($pattern_element)) {
    1114                         break;
    1115                     }
    1116 
    11171221                    $output[] = self::get_pattern_field_wrapper_static(
    1118                         $field,
    1119                         $pattern_element,
    1120                         $this->args['pattern-direction'],
    1121                         'dygpg-text'
     1222                                    $field,
     1223                                    apply_filters('dygpg-get-pattern-element', $field, $this),
     1224                                    $this->args['pattern-direction'],
     1225                                    'dygpg-text'
    11221226                    );
    11231227            }
     
    11271231    }
    11281232
     1233
     1234
    11291235    /**
    11301236     * outputs a page of the grid based on post types.  NB this function is also called via ajax to load more content inside the wrapper
     
    11321238    function get_main_loop() {
    11331239
     1240
     1241
    11341242        $this->qstart_index = $this->args['start-index'];
    1135         $this->end_index    = $this->qstart_index + min($this->args['pagesize'], $this->args['numposts']) - 1;
     1243        $this->end_index    = $this->qstart_index + min($this->args ['pagesize'], $this->args['numposts']) - 1;
    11361244        $this->qindex       = 0;
    11371245        $grid_content       = '';
     
    11391247        // main content loop
    11401248        while ($this->grid_query()) {
    1141             if ($this->qtotal == 0) {
     1249            if ($this->qtotal == 0)
    11421250                continue;
    1143             }
    1144             $this->args = apply_filters('dygpg-main-loop-args', $this);
    11451251
    11461252            // add a default image if none is attached
     
    11491255            $href = $this->get_href();
    11501256
    1151             $grid_content .= strtr("<%el id='dygpg-%id-%post_id' %aspect %lightbox class = 'dygpg-cell dygpg-cell-%id %aclass %heights %filters' style = '%style' href = '%href'>%insert</%el>",
    1152                 [
    1153                     '%el'       => $this->args['cell-element'],
    1154                     '%aspect'   => $this->get_aspect_parameters($this->args['aclass-aspect-ratio']),
    1155                     '%aclass'   => dygpg_toolbox::sanitize_classes(apply_filters('dygpg-aclass', $this->args['aclass'], $this)),
    1156                     '%heights'  => $this->args['equal-grid-heights'] === "Y" ? "dyg-equal-height-{$this->args['id']}" : '',
    1157                     '%filters'  => dygpg_toolbox::sanitize_classes($this->get_filter_classes()),
    1158                     '%style'    => apply_filters('dygpg-cell-inline-style', '', $this, $this),
    1159                     '%href'     => esc_url($href),
    1160                     '%id'       => $this->args['id'],
    1161                     '%post_id'  => $this->qid,
    1162                     '%insert'   => apply_filters('dygpg-cell-content', $this->get_content($href), $this, $href),
    1163                     '%lightbox' => $this->get_lightbox(),
    1164                 ]
     1257            $grid_content .= strtr("<%el %aspect %lightbox class = 'dygpg-cell dygpg-cell-{$this->args['id']} %aclass %heights %filters' style = '%style' href = '%href'>%insert</%el>",
     1258                    [
     1259                        '%el'       => $this->args['cell-element'],
     1260                        '%aspect'   => $this->get_aspect_parameters($this->args['aclass-aspect-ratio']),
     1261                        '%aclass'   => dygpg_toolbox::sanitize_classes(apply_filters('dygpg-aclass', $this->args['aclass'], $this)),
     1262                        '%heights'  => $this->args['equal-grid-heights'] === "Y" ? "dyg-equal-height-{$this->args['id']}" : '',
     1263                        '%filters'  => dygpg_toolbox::sanitize_classes($this->get_filter_classes()),
     1264                        '%style'    => $this->get_style(),
     1265                        '%href'     => esc_url($href),
     1266                        '%insert'   => apply_filters('dygpg-cell-content', $this->get_content($href), $this, $href),
     1267                        '%lightbox' => $this->get_lightbox(),
     1268                    ]
    11651269            );
    11661270        }
     1271
    11671272
    11681273        // add a load_more button if required
     
    11731278        return $grid_content;
    11741279    }
     1280
     1281
    11751282
    11761283    /**
     
    11941301        $this->args['start-index'] += $this->args['pagesize'];
    11951302        return strtr("<div class = 'dyg-load-more-wrapper'>"
    1196             . "<button id = 'dyg-post-grid-%id' class = 'dyg-load-more %ajax' onclick = \"dygLoadMore('%id','%start','%param')\">"
    1197             . "%text</button></div>",
    1198             [
    1199                 '%ajax'  => !empty($this->args['use-ajax']) ? 'dyg-load-more-ajax' : '',
    1200                 '%start' => $this->args['start-index'],
    1201                 '%id'    => $this->args['id'],
    1202                 '%param' => dyg_encryption::encode_data($this->args['params']),
    1203                 '%text'  => esc_html(apply_filters('dygpg-load-more-button', "+", $this)),
    1204             ]
     1303                . "<button id = 'dyg-post-grid-%id' class = 'dyg-load-more %ajax' onclick = \"dygLoadMore('%id','%start','%param')\">"
     1304                . "%text</button></div>",
     1305                [
     1306                    '%ajax'  => !empty($this->args['use-ajax']) ? 'dyg-load-more-ajax' : '',
     1307                    '%start' => $this->args['start-index'],
     1308                    '%id'    => $this->args['id'],
     1309                    '%param' => dyg_encryption::encode_data($this->args['params']),
     1310                    '%text'  => esc_html(apply_filters('dygpg-load-more-button', "+", $this)),
     1311                ]
    12051312        );
    12061313    }
    12071314
     1315
     1316
    12081317}
  • agb-free/trunk/dyg-grid/js/dyg-resize.js

    r2926907 r2926915  
    11jQuery(document).ready(function () {
    2     dygpgEqualiseFunctions()
     2    aspect_ratio();
     3    equal_height();
    34});
    45
    56window.onresize = function () {
    6     dygpgEqualiseFunctions()
    7 }
    8 
    9 function dygpgEqualiseFunctions() {
    10     equalizeAllRowHeights();
     7    aspect_ratio();
    118    equal_height();
    12     aspect_ratio();
    139}
    1410//synchronises the height and width of all elements in the class
     
    8278}
    8379
    84 function equalizeRowHeights($wrapper, $class) {
    85     var $cells = $wrapper.find($class);
    86     var rowStartIndex = 0;
    87     var maxHeight = 0;
    88     var currentRowTopPosition = $cells.first().position().top;
    89 
    90     $cells.each(function (index) {
    91         var $cell = jQuery(this);
    92         $cell.css('height', '');
    93         var targetElement = $cell.hasClass('.dygpg-cell') ? $cell : $cell.closest('.dygpg-cell');
    94         var cellTopPosition = Math.round(targetElement.position().top);
    95 
    96         if (cellTopPosition === currentRowTopPosition) {
    97             maxHeight = Math.max(maxHeight, $cell.outerHeight());
    98         } else {
    99             for (var i = rowStartIndex; i < index; i++) {
    100                 jQuery($cells[i]).outerHeight(maxHeight);
    101             }
    102             rowStartIndex = index;
    103             maxHeight = $cell.outerHeight();
    104             currentRowTopPosition = cellTopPosition;
    105         }
    106 
    107         if (index === $cells.length - 1) {
    108             for (var i = rowStartIndex; i <= index; i++) {
    109                 jQuery($cells[i]).outerHeight(maxHeight);
    110             }
    111         }
    112     });
    113 }
    114 
    115 function equalizeAllRowHeights() {
    116     jQuery('.dygpg-wrapper-equalise-title-rows').each(function () {
    117         equalizeRowHeights(jQuery(this), '.dygpg-pattern-title');
    118     });
    119     jQuery('.dygpg-wrapper-equalise-content-rows').each(function () {
    120         equalizeRowHeights(jQuery(this), '.dygpg-content');
    121     });
    122     jQuery('.dygpg-wrapper-equalise-grid-rows').each(function () {
    123         equalizeRowHeights(jQuery(this), '.dygpg-cell');
    124     });
    125 }
  • agb-free/trunk/dyg-grid/js/dygpg-ajax-load-more.js

    r2926907 r2926915  
    2121            jQuery('.dyg-post-grid-wrapper-' + index).append(data);
    2222            scrollEventHandler();
    23             dygpgEqualiseFunctions();
     23            aspect_ratio();
     24            equal_height();
    2425            dygpgReapplyFilters(index);
    2526            dygformReady();
  • agb-free/trunk/dyg-grid/js/dygpg-edit-ajax.js

    r2926907 r2926915  
    44 * and open the template in the editor.
    55 */
     6
    67
    78
     
    1718            jQuery(el).val(data.fields[field].val);
    1819        } else
    19             if (data.fields[field].val && data.fields[field].type === 'checkbox') {
    20                 jQuery(el).prop('checked', true);
    21             } else
    22                 if (!data.fields[field].val && data.fields[field].type === 'checkbox') {
    23                     jQuery(el).prop('checked', false);
    24                 } else
    25                     if (data.fields[field].type === 'radio') {
    26                         var name = jQuery(el).attr('name');
    27                         jQuery(parent).find(`input[name='${name}']`).prop('checked', false);
    28                         jQuery(parent).find(`input[name='${name}'][data-link-val='${data.fields[field].val}']`).prop('checked', true);
    29                     }
     20        if (data.fields[field].val && data.fields[field].type === 'checkbox') {
     21            jQuery(el).prop('checked', true);
     22        } else
     23        if (!data.fields[field].val && data.fields[field].type === 'checkbox') {
     24            jQuery(el).prop('checked', false);
     25        } else
     26        if (data.fields[field].type === 'radio') {
     27            var name = jQuery(el).attr('name');
     28            jQuery(parent).find(`input[name='${name}']`).prop('checked', false);
     29            jQuery(parent).find(`input[name='${name}'][data-link-val='${data.fields[field].val}']`).prop('checked', true);
     30        }
    3031    }
    3132    jQuery(`.dyg-post-grid-wrapper-outer-${data.index} .dyg-post-grid-wrapper`).remove();
     
    3839        jQuery(`.dygform-dygpg-form .dygform-message`).hide();
    3940    }
    40     dygpgEqualiseFunctions()
     41    aspect_ratio();
     42    equal_height();
    4143    dygpgAdminAjaxReadyFunctions();
    4244    scrollEventHandler();
     
    6668
    6769    //clear the separator character after the last consecutive span in content elements
    68     jQuery('.dygpg-pattern-inline').each(function () {
    69         if (!jQuery(this).next().hasClass('dygpg-pattern-inline')) {
    70             jQuery(this).addClass('dygpg-pattern-last');
    71         }
    72     });
    73    
     70    jQuery('div.dygpg-pattern-block').prev('div.dygpg-pattern-inline').addClass('dygpg-pattern-last');
     71    jQuery('div.dygpg-pattern-block').prev('div.dygpg-pattern-inline').addClass('dygpg-pattern-last');
     72    jQuery('.dygpg-content > div.dygpg-pattern-inline:last-child').addClass('dygpg-pattern-last');
     73    jQuery('.dygpg-cell > div.dygpg-pattern-inline:last-child').addClass('dygpg-pattern-last');
     74
    7475    //initialise the inline/block pattern arrows based on the value of the hidden input field
    7576    jQuery('[data-link="pattern-direction"]').each(function () {
     
    110111    jQuery('.dygpg-accordion .dygpg-pattern-title').off('click').on('click', function () {
    111112        jQuery(this).parent().find('.dygpg-content').toggle('blind',
    112             function () {
    113                 dygpgEqualiseFunctions();
    114             }
     113                function () {
     114                    aspect_ratio();
     115                    equal_height();
     116                }
    115117        );
    116118    });
     
    128130    });
    129131
    130     //    mousedown(handle_mousedown);
     132//    mousedown(handle_mousedown);
    131133    jQuery(".dygpg-close-edit").off("click").on("click", function () {
    132134        jQuery(this).closest('.dygpg-edit-wrapper').toggleClass('dygpg-edit-wrapper-open');
  • agb-free/trunk/dyg-grid/js/dygpg-misc.js

    r2926907 r2926915  
    44 * and open the template in the editor.
    55 */
    6 
     6 
    77
    88function dygpgFilter(elem, dygclass, index) {
     
    1717    jQuery(elem).toggleClass('dygpg-filter-disabled');
    1818    scrollEventHandler();
    19     dygpgEqualiseFunctions()
     19    aspect_ratio();
     20    equal_height();
    2021}
    2122
    2223function dygpgReapplyFilters(id) {
    23     jQuery(`.dyg-post-grid-wrapper-${id} .dygpg-filter-a:not(.dygpg-filter-disabled):not(.dygpg-filter-links)`).each(function () {
    24         jQuery(this).trigger('click');
     24    jQuery(`.dyg-post-grid-wrapper-${id} .dygpg-filter-a:not(.dygpg-filter-disabled):not(.dygpg-filter-links)`).each(function (){
     25        jQuery(this).trigger('click'); 
    2526    });
    2627}
  • agb-free/trunk/dyg-theme/includes/dyg-toolkit.php

    r2926907 r2926915  
    22
    33function is_agb_theme() {
    4     $test =  class_exists('dyg_theme_updater') || function_exists('dyg_get_theme_colours');
    5     return $test;
     4    return class_exists('dyg_theme_updater') || function_exists('dyg_get_theme_colours');
    65}
    76
    87function is_agb_pro() {
    9     $test = class_exists('DygpgAjaxLoadMore');
    10     return $test;
     8    return class_exists('DygpgAjaxLoadMore');
    119}
    1210
     
    6462function dyg_array_insert_before(array $array, $key, array $new, $append = TRUE) {
    6563    $keys  = array_keys($array);
    66     $index = array_search($key, $keys);
     64    $index = array_search($key, $array);
    6765    if ($index === FALSE and !$append) {
    6866        return $array;
  • agb-free/trunk/readme.txt

    r2926907 r2926915  
    1 # Advanced Grid Builder (AGB)
    2 Tags: post grid, content grid, grid, grid generator, accordion, image gallery, lightbox, slideshow, blog, list generator, menu generator
     1=== AGB ===
     2Tags: post grid, content grid, grid, grid generator, image gallery, lightbox, slideshow, blog, list generator, menu generator
    33Requires at least: 3.6
    44Contributors: AGB
    55Requires PHP: 7.4
    66Tested up to: 6.2
    7 Stable tag: 4.5.0
     7Stable tag: 4.1.0
    88License: GPLv2
    9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     9License URI: http://www.gnu.org/licenses/gpl-2.0.html===
    1010
    11 Unleash the power of your content with AGB, the ultimate grid builder plugin for WordPress.
     11Generate grids, lists, galleries and more with a simple WYSIWYG front end editor
    1212
    13 ## Description
     13== Description ==
    1414
    15 ### Create Dynamic, Beautiful Content Grids, Galleries, Lists, Menus, and More
     15## Turn your posts into grids, lists, galleries and more
    1616
    17 AGB is not just another grid builder plugin. It's a powerful, user-friendly tool that transforms your WordPress content into dynamic, beautiful grids, lists, galleries, and more.
     17[Live Demo](https://advancedgridbuilder.com/)   |   [Documentation](https://advancedgridbuilder.com/documentation/) |   [Buy Pro](https://advancedgridbuilder.com/pricing/)
    1818
    19 [Live Demo](https://advancedgridbuilder.com/) | [Documentation](https://advancedgridbuilder.com/documentation/) | [Buy Pro](https://advancedgridbuilder.com/pricing/)
    2019
    21 With AGB, you can:
     20* Simple front end WYSIWYG editor
     21* Blogs, content grids, lists, menus, galleries
     22* Query builder
     23* Use theme presets, or build your own design
     24* Integrated help system
     25* Integrated support (Pro version)
     26* [Full features table](https://advancedgridbuilder.com/#features-table)
    2227
    23 - Create stunning content grids, accordions, lists, menus, galleries, and more with a simple front-end WYSIWYG editor
    24 - Use our query builder to filter and sort your content
    25 - Choose from our theme presets or build your own unique design
    26 - Get help when you need it with our integrated help system
    27 - Enjoy premium support with our Pro version
    28 - [Explore our full features table](https://advancedgridbuilder.com/#features-table)
    2928
    30 ### How to use
     29## How to use
    3130
    32 1. Edit a page or post.
    33 2. Place the shortcode `[AGB id='unique_identifier']` where you would like the grid to appear.
    34 3. Save, and then view the page on the front end.
    35 4. Edit your grid using the blue gear icon which will appear for logged in administrators.
     311) Edit a page or post.
     322) Place the shortcode `[AGB id='unique_identifier']` where you would like the grid to appear.
     333) Save, and then view the page on the front end.
     344) Edit your grid using the blue gear icon which will appear for logged in administrators.
    3635
    37 ### Learn more
    3836
    39 Discover the limitless possibilities of AGB with our extensive collection of styles, examples, and demos on [our website](https://advancedgridbuilder.com/)
     37## Learn more
    4038
    41 ## Installation
     39See loads of styles, examples, videos and demos on [our website](https://advancedgridbuilder.com/)
    4240
    43 1. Edit a page or post.
    44 2. Place the shortcode `[AGB id='unique_identifier']` where you would like the grid to appear.
    45 3. Save, and then view the page on the front end.
    46 4. A blue gear cog will appear near the grid content providing access to the grids edit menu.
     41== Installation ==
    4742
    48 ## Frequently Asked Questions
     431) Edit a page or post.
     442) Place the shortcode `[AGB id='unique_identifier']` where you would like the grid to appear.
     453) Save, and then view the page on the front end.
     464) A blue gear cog will appear near the grid content providing access to the grids edit menu.
    4947
    50 Have questions? We've got answers. Visit [our website](https://advancedgridbuilder.com/) for a comprehensive FAQ.
    5148
    52 ## Support
     49== Frequently Asked Questions ==
    5350
    54 Need help? We've got you covered.  For support with the free AGB, visit the [support pages](https://wordpress.com/plugins/agb-free) on the Wordpress repository.
    55 
    56 AGB Pro includes a convenient support request tool right inside the editor. To submit a request, simply enter a message in the provided text box and press the update button. Replies are emailed to the address used to register the plugin when purchased. If that address has changed or you can’t remember it, please submit an account support request [here](https://www.advancedgridbuilder.com/support/).
    57 
    58 ## Presets
    59 
    60 Get started quickly with our "Style Presets". These collections help you quickly achieve some of the most common configurations. The blog preset, for example, was designed specifically for your blog/news posts and includes all the usual fields you would expect to find, including hyperlinked meta fields. Check out more presets [here](https://www.advancedgridbuilder.com/presets/).
     51Get answers to all your questions on [our website](https://advancedgridbuilder.com/)
Note: See TracChangeset for help on using the changeset viewer.