Changeset 2832606
- Timestamp:
- 12/12/2022 11:41:51 PM (3 years ago)
- Location:
- dyggrid/trunk
- Files:
-
- 13 edited
-
dyg-form/css/dygform-public.css (modified) (2 diffs)
-
dyg-form/includes/dyg-form-functions.php (modified) (1 diff)
-
dyg-post-grid/addons/free/dygpg_go_pro.css (modified) (1 diff)
-
dyg-post-grid/addons/free/dygpg_styles_free.php (modified) (11 diffs)
-
dyg-post-grid/addons/free/dygpg_transitions_free.php (modified) (5 diffs)
-
dyg-post-grid/css/dyg-post-grid-templates.css (modified) (4 diffs)
-
dyg-post-grid/css/dyg-post-grid.css (modified) (6 diffs)
-
dyg-post-grid/dyg-post-grid.php (modified) (1 diff)
-
dyg-post-grid/includes/class-dygpg-form.php (modified) (4 diffs)
-
dyg-post-grid/includes/class-dygpg-postgrid.php (modified) (15 diffs)
-
dyg-post-grid/js/dygpg-edit-ajax.js (modified) (3 diffs)
-
dyggrid.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dyggrid/trunk/dyg-form/css/dygform-public.css
r2823384 r2832606 430 430 margin-top: 20px; 431 431 } 432 .full-width { 433 width: 100%; 434 } 435 .half-width { 436 display:inline-block; 437 width: calc(calc(100% - 20px) / 2); 438 margin-right: 20px; 439 } 440 .third-width { 441 display:inline-block; 442 width: calc(calc(100% - 40px) / 3); 443 margin-right: 20px; 444 } 445 .end { 446 margin-right: 0px !important; 447 } 448 form.dygform .end { 449 margin-right: 0px !important; 450 } 432 451 433 452 434 .dygform-container-radio, … … 568 550 /* top: -5px; */ 569 551 } 552 .dygform .full-width { 553 width: 100%; 554 } 555 .dygform .half-width { 556 display:inline-block; 557 width: calc(calc(100% - 20px) / 2); 558 margin-right: 20px; 559 } 560 .dygform .third-width { 561 display:inline-block; 562 width: calc(calc(100% - 40px) / 3); 563 margin-right: 20px; 564 } 565 .dygform .end { 566 margin-right: 0px !important; 567 } 568 form.dygform .end { 569 margin-right: 0px !important; 570 } -
dyggrid/trunk/dyg-form/includes/dyg-form-functions.php
r2823384 r2832606 28 28 } 29 29 30 /** 31 * ads additional select options to an existing select option group 32 * 33 * @param type $element - the select-option-group level element 34 * @param type $options - an array of options to be included as both label and value 35 * @param type $selected - the option to mark as selected 36 */ 37 function dygform_add_options_array($element, $options, $selected) { 38 $add = (array) $element->options; 39 foreach ($options as $option) { 40 $add[] = (object) [ 41 "type" => 'option', 42 "value" => $option['value'], 43 "parameter" => $option['value'] === $selected ? 'selected' : '', 44 "contains" => $option['contains'] ?? '' 45 ]; 46 } 47 $element->options = (object) $add; 48 return $element; 49 } 30 50 31 51 -
dyggrid/trunk/dyg-post-grid/addons/free/dygpg_go_pro.css
r2818006 r2832606 80 80 margin:3px; 81 81 } 82 .dyg-post-grid-wrapper.dygpg-gallery .dyg-post-grid-cell .dygpg-pattern, 83 .dyg-post-grid-wrapper.dygpg-gallery .dyg-post-grid-cell .dygpg-pattern > *, 84 .dyg-post-grid-wrapper.dygpg-gallery-tiled .dyg-post-grid-cell .dygpg-pattern, 85 .dyg-post-grid-wrapper.dygpg-gallery-tiled .dyg-post-grid-cell .dygpg-pattern > *, 86 .dyg-post-grid-wrapper.dygpg-gallery-columns .dyg-post-grid-cell .dygpg-pattern, 87 .dyg-post-grid-wrapper.dygpg-gallery-columns .dyg-post-grid-cell .dygpg-pattern > * 88 { 89 line-height: 0; 90 padding: 0px; 91 } -
dyggrid/trunk/dyg-post-grid/addons/free/dygpg_styles_free.php
r2823384 r2832606 11 11 12 12 public function __construct() { 13 add_filter('dygpg-after-process-atts', [$this, 'store_args'], 10, 2); 13 14 add_filter('dygpg-style-selected', [$this, 'style_selected'], 1, 2); 14 15 add_filter("dygform-filter-data-dygpg-form", [$this, 'add_form_elements'], 5, 1); 16 add_filter('dygpg-shortcode-array', [$this, 'shortcode_array']); 17 add_filter('dygpg-class', [$this, 'filter_class'], 10, 2); 15 18 16 19 $this->elements = [ … … 23 26 'container-style' => 'width: 100%;', 24 27 'contains' => [ 28 'style-reset' => [ 29 'type' => 'checkbox', 30 'label' => 'Reset', 31 'checked' => '', 32 'value' => '', 33 'container-class' => 'dygpg-play-button', 34 'data-link' => 'style-reset', 35 'data-link-val' => 'Y', 36 'style' => 'font-size: 200%;', 37 'hide' => '', 38 ], 25 39 'style-preset-options-header' => [ 26 40 'type' => 'div', … … 40 54 'parameters' => '', 41 55 'readonly' => '', 42 'class' => 'dygpg-play- button',56 'class' => 'dygpg-play-', 43 57 'container-class' => '', 44 58 'container-style' => '', … … 46 60 'contains' => '', 47 61 'options' => [ 48 'style-reset' => [ 49 'type' => 'checkbox', 50 'label' => 'Reset', 51 'checked' => '', 52 'value' => '', 53 'contains' => '', 54 'data-link' => 'style-reset', 55 'data-link-val' => 'Y', 56 'show' => '', 57 'hide' => '', 58 ], 59 'fonts' => [ 60 'type' => 'checkbox', 61 'label' => 'Font Styles', 62 'checked' => '', 63 'value' => '', 64 'contains' => '', 65 'data-link' => 'class-fonts', 66 'data-link-val' => 'Y', 67 'show' => '', 68 'hide' => '', 69 ], 70 0 => [ 71 'type' => 'checkbox', 72 'label' => 'Shadow', 73 'checked' => '', 74 'value' => '', 75 'contains' => '', 76 'data-link' => 'class-shadow', 77 'data-link-val' => 'Y', 78 'show' => '', 79 'hide' => '', 80 ], 81 1 => [ 82 'type' => 'checkbox', 83 'label' => 'Image shadow', 84 'checked' => '', 85 'value' => '', 86 'contains' => '', 87 'data-link' => 'class-image-shadow', 88 'data-link-val' => 'Y', 89 'show' => '', 90 'hide' => '', 91 ], 92 2 => [ 93 'type' => 'checkbox', 94 'label' => 'Hover enlarge', 95 'checked' => '', 96 'value' => '', 97 'contains' => '', 98 'data-link' => 'class-hover-enlarge', 99 'data-link-val' => 'Y', 100 'show' => '', 101 'hide' => '', 62 'fonts' => [ 63 'type' => 'checkbox', 64 'label' => 'Override theme fonts', 65 'data-link' => 'style-fonts', 66 'data-link-val' => 'Y', 67 'default' => 'Y', 68 ], 69 0 => [ 70 'type' => 'checkbox', 71 'label' => 'Cell Shadow', 72 'data-link' => 'style-shadow', 73 'data-link-val' => 'Y', 74 'default' => '', 75 ], 76 1 => [ 77 'type' => 'checkbox', 78 'label' => 'Image Shadow', 79 'data-link' => 'style-image-shadow', 80 'data-link-val' => 'Y', 81 'default' => '', 82 ], 83 2 => [ 84 'type' => 'checkbox', 85 'label' => 'Hover Enlarge', 86 'data-link' => 'style-hover-enlarge', 87 'data-link-val' => 'Y', 88 'default' => '', 89 ], 90 3 => [ 91 'type' => 'checkbox', 92 'label' => 'Center All Text', 93 'data-link' => 'style-center-text', 94 'data-link-val' => 'Y', 95 'default' => '', 96 ], 97 4 => [ 98 'type' => 'checkbox', 99 'label' => 'Center Content (Vertical)', 100 'data-link' => 'style-center-content-vertical', 101 'data-link-val' => 'Y', 102 'default' => '', 103 ], 104 5 => [ 105 'type' => 'checkbox', 106 'label' => 'Center Content (Horizontal)', 107 'data-link' => 'style-center-content-horizontal', 108 'data-link-val' => 'Y', 109 'default' => '', 102 110 ], 103 111 ], … … 105 113 'theme-preset-options-header' => [ 106 114 'type' => 'div', 107 'label' => 'Theme presets', 115 'label' => 'Theme preset', 116 'container-class' => 'half-width', 108 117 'help' => 'theme-presets', 109 'contains' => '', 110 ], 111 'theme-preset-options' => [ 112 'type' => 'select_group', 113 'class' => 'dygpg-play-button', 114 'style' => 'column-count: 4;', 115 'options' => [ 118 'contains' => [ 119 'theme-preset-options' => [ 120 'container-style' => '', 121 'data-link' => 'preset', 122 'type' => 'dropdown_group', 123 'default' => '', 124 'placeholder' => 'Preset', 125 'options' => [ 126 ], 127 ], 116 128 ], 117 129 ], … … 152 164 153 165 166 public function store_args($args, $atts) { 167 $this->args = $args; 168 return $args; 169 } 170 171 172 173 public function filter_class($class, $obj) { 174 if ($obj->args['style-center-text'] === 'Y') { 175 $class .= ' dygpg-center-text'; 176 } 177 if ($obj->args['style-center-content-horizontal'] === 'Y') { 178 $class .= ' dygpg-center-content-horizontal'; 179 } 180 if ($obj->args['style-center-content-vertical'] === 'Y') { 181 $class .= ' dygpg-center-content-vertical'; 182 } 183 if ($obj->args['style-shadow'] === 'Y') { 184 $class .= ' dygpg-shadow'; 185 } 186 if ($obj->args['style-image-shadow'] === 'Y') { 187 $class .= ' dygpg-image-shadow'; 188 } 189 if ($obj->args['style-hover-enlarge'] === 'Y') { 190 $class .= ' dygpg-hover-enlarge'; 191 } 192 if ($obj->args['style-fonts'] === 'Y') { 193 $class .= ' dygpg-fonts'; 194 } 195 return $class; 196 } 197 198 199 200 /** 201 * adds an additional parameter to the shortcode array 202 * @param array $shortcode - array of shortcode elements 203 * @return string - modified shortcode array 204 */ 205 public function shortcode_array($shortcode) { 206 foreach ($this->elements['style-presets-wrapper']['contains']['style-preset-options']['options'] as $element) { 207 $shortcode[$element['data-link']] = $element['default'] ?? ''; 208 } 209 210 return $shortcode; 211 } 212 213 214 154 215 /** 155 216 * adds additional post grid form editor elements to provide and interface for the new shortcode values … … 159 220 $styles = []; 160 221 $styles[] = [ 161 'type' => 'checkbox', 162 'label' => 'Blog', 163 'container-style' => 'display:block;', 164 'data-link' => 'class-blog', 165 'data-link-val' => 'Y', 222 'contains' => 'Blog', 223 'value' => 'dygpg-blog', 166 224 ]; 167 225 $styles[] = [ 168 'type' => 'checkbox', 169 'label' => 'List (bullets)', 170 'data-link' => 'class-list', 171 'data-link-val' => 'Y', 172 'container-style' => 'display:block;', 226 'contains' => 'Blog (Fade)', 227 'value' => 'dygpg-blog-fade', 173 228 ]; 174 229 $styles[] = [ 175 'type' => 'checkbox', 176 'label' => 'Gallery', 177 'data-link' => 'class-gallery', 178 'data-link-val' => 'Y', 179 'container-style' => 'display:block;', 230 'contains' => 'List (bullets)', 231 'value' => 'dygpg-list', 232 ]; 233 $styles[] = [ 234 'contains' => 'Gallery', 235 'value' => 'dygpg-gallery', 236 ]; 237 $none = []; 238 $none [] = [ 239 'contains' => 'None', 240 'value' => 'none', 180 241 ]; 181 242 … … 183 244 $styles = apply_filters('dygpg-get-more-styles', $styles); 184 245 usort($styles, function ($item1, $item2) { 185 return $item1[' label'] <=> $item2['label'];246 return $item1['contains'] <=> $item2['contains']; 186 247 }); 187 $this->elements['style-presets-wrapper']['contains']['theme-preset-options']['options'] = $styles; 188 248 $styles = array_merge($none, $styles); 189 249 dygform_insert_element($data, 'show_wrapper', $this->elements); 250 $e = dygform_find_element($data, 'theme-preset-options'); 251 $e = dygform_add_options_array($e, $styles, $this->args['preset'] ?? 'none'); 252 190 253 if (is_dyggrid_free()) { 191 254 dygform_insert_element($data, 'pattern_wrapper', $this->elements2); … … 207 270 208 271 public function style_selected($args, $class) { 209 if ($class === ' class-blog') {272 if ($class === 'dygpg-blog') { 210 273 $args['button'] = 'More'; 211 274 $args['columns'] = '3,3,2,1'; 212 $args['equal-grid-heights'] = is_dyggrid_pro() ? 'Y': '';213 $args['equal-title-heights'] = is_dyggrid_pro() ? 'Y' : '';275 $args['equal-grid-heights'] = 'Y'; 276 $args['equal-title-heights'] = is_dyggrid_pro() ? 'Y' : ''; 214 277 $args['link-titles'] = 'Y'; 215 278 $args['meta_tag'] = 'h6'; 216 279 $args['pattern'] = '%image%,%<,%title%,%category%,%excerpt%,%button%,%>'; 217 280 } 218 if ($class === 'class-list') { 281 if ($class === 'dygpg-blog-fade') { 282 $args['columns'] = '3,3,2,1'; 283 $args['content-aspect-ratio'] = '4:3'; 284 $args['equal-grid-heights'] = 'Y'; 285 $args['equal-title-heights'] = ''; 286 $args['pattern'] = '%<,%excerpt%,%>,%date%,%category%,%author%,%title%'; 287 $args['pattern-direction'] = '%date%,%category%,%author%'; 288 $args['transition'] = 'fade'; 289 } 290 if ($class === 'dygpg-list') { 219 291 $args['column-gap'] = '0px,0px,0px,0px'; 220 292 $args['columns'] = '1,1,1,1'; … … 225 297 $args['title-tag'] = 'li'; 226 298 } 227 if ($class === ' class-gallery') {299 if ($class === 'dygpg-gallery') { 228 300 $args['equal-grid-heights'] = ''; 229 301 $args['equal-title-heights'] = ''; 230 302 $args['iclass-aspect-ratio'] = '1-1'; 231 303 $args['link'] = 'L'; 304 $args['columns'] = '6,4,3,1'; 232 305 $args['resolutions'] = '100px, 100px, 100px, 100px'; 233 306 $args['show-content'] = ''; … … 237 310 $args['width'] = '100px'; 238 311 } 239 if ($class === ' class-fonts') {312 if ($class === 'dygpg-fonts') { 240 313 $pattern = [ 241 314 'title' => 18, -
dyggrid/trunk/dyg-post-grid/addons/free/dygpg_transitions_free.php
r2827455 r2832606 12 12 public function __construct() { 13 13 $this->obj = NULL; 14 add_filter('dygpg-after-process-atts', [$this, 'store_args'], 10, 2); 14 15 add_action('wp_enqueue_scripts', [$this, 'enqueue_scripts']); 15 16 add_filter('dygpg-content-open', [$this, 'open_wrapper'], 10, 2); //filter the cell content open tag … … 18 19 add_filter('dygpg-shortcode-array', [$this, 'shortcode_array']); //adds additional shortcode arguements 19 20 add_filter('dygpg-aclass', [$this, 'aclass'], 10, 2); //filters the aclass arguement at output; 21 } 22 23 24 25 public function store_args($args, $atts) { 26 $this->args = $args; 27 return $args; 20 28 } 21 29 … … 34 42 */ 35 43 public function aclass($class, $obj) { 36 if (empty($obj->args['transition']) ) {44 if (empty($obj->args['transition']) OR $obj->args['transition'] === 'none') { 37 45 $this->obj = NULL; 38 46 return $class; … … 105 113 $none = []; 106 114 $none[] = [ 107 'type' => 'radio', 108 'label' => 'None', 109 'container-style' => 'display:block;', 110 'data-link' => 'transition', 111 'data-link-val' => '', 115 'contains' => 'None', 116 'value' => 'none', 112 117 ]; 113 118 114 119 $styles = []; 115 120 $styles[] = [ 116 'type' => 'radio', 117 'label' => 'Fade', 118 'container-style' => 'display:block;', 119 'data-link' => 'transition', 120 'data-link-val' => 'fade', 121 'contains' => 'Fade', 122 'value' => 'fade', 121 123 ]; 122 124 … … 124 126 $styles = apply_filters('dygpg-get-more-transitions', $styles); 125 127 usort($styles, function ($item1, $item2) { 126 return $item1[' label'] <=> $item2['label'];128 return $item1['contains'] <=> $item2['contains']; 127 129 }); 128 130 129 $styles = $elements = [ 130 'transition-animations-label' => [ 131 'type' => 'div', 132 'label' => 'Transition animations', 131 $elements = [ 132 'transition-animations-label' => [ 133 'type' => 'div', 134 'container-class' => 'half-width end', 135 'label' => 'Transition animation', 133 136 // 'help' => 'transition-animations', 134 'contains' => '', 135 ], 136 'transition-animations-wrapper' => [ 137 'type' => 'select_group', 138 'style' => 'column-count:4', 139 'options' => array_merge($none, $styles), 137 'contains' => [ 138 'transition-animations-wrapper' => [ 139 'data-link' => 'transition', 140 'type' => 'dropdown_group', 141 'default' => '', 142 'placeholder' => 'Animation', 143 'options' => [ 144 ], 145 ], 146 ], 140 147 ], 141 148 ]; 142 dygform_insert_element($data, 'theme-preset-options', $elements); 149 dygform_insert_element($data, 'theme-preset-options-header', $elements); 150 $e = dygform_find_element($data, 'transition-animations-wrapper'); 151 dygform_add_options_array($e, array_merge($none, $styles), $this->args['transition'] ?? 'none'); 143 152 return $data; 144 153 } -
dyggrid/trunk/dyg-post-grid/css/dyg-post-grid-templates.css
r2827455 r2832606 15 15 } 16 16 17 .dyg-post-grid-wrapper img {max-width: 100%;height: auto;} 18 .dyg-post-grid-wrapper h3 { 19 } 20 21 .dyg-post-grid-wrapper p { 22 } 23 .dyg-post-grid-wrapper li, 24 .dyg-post-grid-wrapper p, 25 .dyg-post-grid-wrapper p:not(.has-background):last-of-type, 26 .dyg-post-grid-wrapper h1, 27 .dyg-post-grid-wrapper h2, 28 .dyg-post-grid-wrapper h3, 29 .dyg-post-grid-wrapper h4, 30 .dyg-post-grid-wrapper h5, 31 .dyg-post-grid-wrapper h6 32 { 33 /* padding: 0px 0px 5px 0px; */ 34 /* margin:0px; */ 35 /* line-height: 1.3em; */ 17 .dyg-post-grid-wrapper img {/* max-width: 100%; */ 18 height: auto; 36 19 } 37 20 … … 170 153 cursor:pointer; 171 154 } 172 /*end dygpg-button*/ 173 155 /*blog-hover*/ 156 .dygpg-blog-fade .dyg-post-grid-cell { 157 padding: 20px; 158 } 159 .dygpg-blog-fade .dygpg-transition-wrapper { 160 margin: -20px -20px 20px -20px; 161 } 162 .dygpg-blog-fade .dyg-post-grid-cell { 163 border: 1px solid var(--dygiphy-theme-color-extra-light); 164 } 165 .dygpg-blog-fade .dygpg-content { 166 padding: 20px; 167 display: flex; 168 align-items: center; 169 justify-items: center; 170 } 171 172 /*end dygpg-blog-fade*/ 174 173 .dygpg-blog .dygpg-content { 175 174 padding: 17px; … … 188 187 .dygpg-overlay .dygpg-content { 189 188 background-color: #ffffffa0; 190 display: flex;191 189 width: 100%; 192 190 height: 100%; 193 justify-content: center;194 align-items: center;195 191 text-align: center; 196 192 padding: 20px; 197 flex-direction: column;198 193 margin: 0px; 199 194 } 200 195 201 .dygpg-content {box-sizing: border-box;} 196 .dygpg-content { 197 box-sizing: border-box; 198 } 202 199 203 200 .dygpg-meta li:not(:last-child):after { 204 content:" , "; 201 content:","; 202 padding: 0px 0.2em 0px 0.2em; 205 203 } 206 204 ul.dygpg-meta { … … 248 246 } 249 247 /*end dygpg-list*/ 248 249 .dygpg-center-text .dygpg-content, 250 .dygpg-center-text .dygpg-text { 251 text-align: center; 252 align-items: center; 253 } 254 255 .dygpg-center-content-horizontal .dygpg-content { 256 text-align: center; 257 justify-content: center; 258 } 259 .dygpg-center-content-vertical .dygpg-content { 260 display:flex; 261 flex-flow: row wrap; 262 align-content: center; 263 align-items: center; 264 } 265 .dygpg-center-content-vertical .dygpg-content * { 266 flex-basis: 100%; 267 } 268 .dygpg-center-content-vertical .dygpg-content span { 269 flex: 0 1 auto; 270 } -
dyggrid/trunk/dyg-post-grid/css/dyg-post-grid.css
r2823384 r2832606 1 @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=Rokkitt:wght@700&display=swap'); 2 1 3 .dygpg-filter-hide { 2 4 display:none !important; … … 12 14 } 13 15 .dyg-post-grid-wrapper div.dygpg-filter { 14 text-align: left;16 text-align: center; 15 17 margin-bottom: 30px; 16 18 width: 100%; … … 26 28 } 27 29 28 .dygpg-content > span:not(.dygpg-pattern-last):after { 29 content: ' | '; 30 span.dygpg-pattern:not(.dygpg-pattern-last):after { 31 content: '|'; 32 padding: 0px 0.2em 0px 0.2em; 30 33 } 31 34 .dyg-post-grid-wrapper .dygpg-filter table, … … 96 99 .dyg-post-grid-wrapper-outer { 97 100 position: relative; 101 z-index: 0; 98 102 } 99 103 div.dygpg-edit-wrapper .dygpg-keep-together textarea:not(:last-child) { … … 148 152 background-size: cover; 149 153 background-position: 50% 50%; 150 } 151 152 154 line-height: 0; 155 } 153 156 154 157 … … 264 267 position: relative; 265 268 } 269 .dyg-post-grid-cell > .dygpg-pattern:not(.dygpg-pattern-image) { 270 padding-top: 10px; 271 } 272 .dyg-post-grid-wrapper .dygpg-meta, 273 .dyg-post-grid-wrapper .dygpg-text { 274 line-height: 1.3; 275 } 276 .dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern, 277 .dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern-title a > * , 278 .dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern > *:not(a) { 279 font-family: 'Open Sans', sans-serif; 280 font-weight: 700; 281 font-size: 15px; 282 margin: 0px; 283 padding: 0px 0px 5px 0px; 284 } 285 .dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern div { 286 font-weight: 400; 287 } 288 div.dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern-title a > * , 289 div.dyg-post-grid-wrapper.dygpg-fonts .dygpg-pattern-title * { 290 font-weight: 700; 291 font-size: 20px; 292 padding: 0px; 293 font-family: 'Rokkitt', serif; 294 text-decoration: none; 295 text-transform: uppercase; 296 } -
dyggrid/trunk/dyg-post-grid/dyg-post-grid.php
r2827455 r2832606 11 11 $dygpg_state = 0; 12 12 13 define('DYGGRID_VERSION', '2. 0.1');13 define('DYGGRID_VERSION', '2.3.0'); 14 14 15 15 include_once DYG_STYLESHEET_DIRECTORY . '/dyg-post-grid/includes/class-dygpg-db.php'; -
dyggrid/trunk/dyg-post-grid/includes/class-dygpg-form.php
r2827455 r2832606 184 184 * @return type 185 185 */ 186 function handle_reset($args , $existing_args) {186 function handle_reset($args) { 187 187 if (apply_filters('dygpg-reset-arg-test', $args['style-reset'], $args) !== 'Y') 188 return [$args, $existing_args]; 189 190 $id = $args['id']; 191 $args = apply_filters('dygpg-reset-get-defaults', DygPostGrid::get_shortcode_defaults($id), $args); 188 return $args; 189 190 $existing_args = $args; 191 192 $args = apply_filters('dygpg-reset-get-defaults', DygPostGrid::get_shortcode_defaults($args['id']), $args['id']); 192 193 $args['style-reset'] = ''; 193 194 194 195 //don't reset the query source 195 196 $keeps = ['id', 'demo-id', 'content', 'posttype', 'taxonomy', 'tax-operator', 'tax-terms', 'numposts', 'pagesize', 'orderby', 'order', 'meta-key', 'term', 196 'attached-taxonomies', 'use-ajax', 'load-more-button-label' ];197 'attached-taxonomies', 'use-ajax', 'load-more-button-label', 'preset']; 197 198 $keeps = apply_filters('dygpg-reset-keeps', $keeps, $args); 198 199 … … 200 201 $args[$key] = $existing_args[$key] ?? ''; 201 202 } 202 $existing_args['style-reset'] = 'Y'; 203 204 return [$args, $existing_args]; 203 204 return $args; 205 205 } 206 206 … … 262 262 //if this is a demo grid and we are at position 1, return the current state of the parent grid 263 263 if ($undo_count == 1 AND $undo_field === 'undo' AND $args['id'] !== $parent_id) { 264 $args = $postgrid::retrieve_atts($parent_id);264 $args = $postgrid::retrieve_atts($parent_id); 265 265 $response['message'] = "$undo_field successful"; 266 266 } 267 267 268 268 //if this is an undo with an undo count of 1, perform a reset as no record is saved at 0 269 269 else if ($undo_count == 1 AND $undo_field === 'undo') { … … 286 286 287 287 //handle reset 288 list($args, $existing_args) = $this->handle_reset($args, $existing_args); 289 290 //convert the class preset checkboxes into classes 291 $args['class'] = $args['class'] ?? ''; 292 foreach ($args_copy as $key => $value) { //use the args copy in case the style checkboxes were reset above 293 preg_match_all('/^class-(.*)/m', $key, $matches, PREG_SET_ORDER, 0); 294 if (count($matches) === 0) { // we are looking for args with a key that starts with 'class-' 295 continue; 296 } 297 $class = "dygpg-{$matches[0][1]}"; 298 if (!empty($args_copy[$key]) && !str_contains($args['class'], $class)) { 299 $args['class'] .= " $class"; 300 } 301 302 //for each checked style, call the filter so that other args can be modified by addons etc 303 if ($args_copy[$key] === 'Y') { 304 $args = apply_filters("dygpg-style-selected", $args, $key); 305 } 306 307 //clear the play checkbox on the edit form 308 $existing_args[$key] = 'Y'; 309 $args[$key] = ''; 310 } 288 $args = $this->handle_reset($args); 289 $existing_args['style-reset'] = 'Y'; 290 $args['style-reset'] = ''; 291 292 //handle presets 293 if ($args['preset'] !== $existing_args['preset']) 294 $args = apply_filters("dygpg-style-selected", $args, $args['preset']); 311 295 312 296 //perform a final filter of the args prior to saving -
dyggrid/trunk/dyg-post-grid/includes/class-dygpg-postgrid.php
r2827455 r2832606 1 <?php1 <?php 2 2 3 3 class DygPostGrid { … … 135 135 unset($atts['show_woo_price']); 136 136 } 137 if (version_compare($atts['version'] ?? '0.0.0', '2.0.1', '<')) { 138 139 } 140 if (version_compare($atts['version'] ?? '0.0.0', '2.0.1', '<')) { 141 $atts['style-fonts'] = ''; 142 } 137 143 $atts['version'] = DYGGRID_VERSION; 138 144 return $atts; … … 185 191 '%grid' => $this->get_main_loop(), 186 192 '%widgets' => apply_filters('dygpg-top-widgets', '', $this), 187 '%class' => dygpg_toolbox::sanitize_classes( $this->args['class'])193 '%class' => dygpg_toolbox::sanitize_classes(apply_filters('dygpg-class', $this->args['class'], $this)) . " {$this->args['preset']}", 188 194 ]); 189 195 } … … 264 270 'pattern' => "%image%,%<,%title%,%>", // should the description be populated with the_content or the_excerpt; 265 271 'pattern-direction' => "", // list of pattern elements that should be inline-block 272 'preset' => "", // currectly selected style preset class 266 273 'meta_pattern' => "", // pattern for taxonomy etc meta fields 267 274 'meta_tag' => "h5", // element for meta wrapper … … 290 297 'iclass-aspect-ratio' => '4-3', //used by form editor to flag that aspect ratio classes should be added to the image 291 298 'aclass-aspect-ratio' => '', //used by form editor to flag that aspect ratio classes should be added to the cell 299 'content-aspect-ratio' => '', //used by form editor to flag that aspect ratio classes should be added to the cell 292 300 'image' => 'Y', // 'Y' for separate <img> object. 'B' for background of the <a> object - only implemented for term so far 293 301 'show-post-content' => '', //show the_content … … 642 650 return ''; 643 651 } 644 $ aspect_ratio = round($image_meta['width'] / $image_meta['height'], 2);645 $dirname = _wp_get_attachment_relative_path($image_meta['file']);652 $this->qaspect_ratio = round($image_meta['width'] / $image_meta['height'], 2); 653 $dirname = _wp_get_attachment_relative_path($image_meta['file']); 646 654 if ($dirname) { 647 655 $dirname = trailingslashit($dirname); … … 654 662 if (!($image['height'] ?? 0 > 0)) 655 663 continue; 656 if ($ aspect_ratio === round($image['width'] / $image['height'], 2)) {664 if ($this->qaspect_ratio === round($image['width'] / $image['height'], 2)) { 657 665 $srcset .= "$image_baseurl{$image['file']} {$image['width']}w,"; 658 666 } … … 921 929 return ''; 922 930 } 923 $aspect_ratio = str_replace(':', '-', $aspect_ratio); 924 $aspect_ratio = explode('-', $aspect_ratio); 931 if ($aspect_ratio === 'match_image') { 932 $aspect_ratio = []; 933 $aspect_ratio[0] = $this->qaspect_ratio ?? ''; 934 $aspect_ratio[1] = 1; 935 } else { 936 $aspect_ratio = str_replace(':', '-', $aspect_ratio); 937 $aspect_ratio = explode('-', $aspect_ratio); 938 } 925 939 926 940 if (!is_numeric($aspect_ratio[0] ?? '') || !is_numeric($aspect_ratio[1] ?? '')) { … … 962 976 */ 963 977 function get_excerpt() { 964 $excerpt = strtr("<div class='dygpg- excerpt'>%data%</div>", [978 $excerpt = strtr("<div class='dygpg-text dygpg-excerpt'>%data%</div>", [ 965 979 '%data%' => $this->qexcerpt ?? '', 966 980 ]); … … 979 993 */ 980 994 function get_rich_excerpt() { 981 $excerpt = strtr("<div class='dygpg- rich-excerpt'>%data%</div>", [995 $excerpt = strtr("<div class='dygpg-text dygpg-rich-excerpt'>%data%</div>", [ 982 996 '%data%' => $this->qpgexcerpt ?? '', 983 997 ]); … … 996 1010 */ 997 1011 function get_the_content() { 998 $content = strtr("<div class='dygpg-t he-content'>%data%</div>", [1012 $content = strtr("<div class='dygpg-text dygpg-the-content'>%data%</div>", [ 999 1013 '%data%' => $this->qcontent ?? '', 1000 1014 ]); … … 1015 1029 */ 1016 1030 public function get_titles($href) { 1017 $title = strtr("<%tag href='%href' class='dygpg-t itle %equal'>%qtitle</%tag>", [1031 $title = strtr("<%tag href='%href' class='dygpg-text dygpg-title %equal'>%qtitle</%tag>", [ 1018 1032 '%tag' => esc_attr($this->args['title-tag']), 1019 1033 '%href' => esc_url($href), … … 1115 1129 get_the_date('M d, Y'), 1116 1130 $this->args['pattern-direction'], 1117 ' '1131 'dygpg-text' 1118 1132 ); 1119 1133 } … … 1130 1144 get_the_author(), 1131 1145 $this->args['pattern-direction'], 1132 ' '1146 'dygpg-text' 1133 1147 ); 1134 1148 } … … 1180 1194 $output[] = apply_filters('dygpg-content-open', 1181 1195 strtr("<div %aspect class='dygpg-content%equalise'>", [ 1182 '%equalise' => $this->args['equal-content-heights'] === 'Y' ? " dyg-equal-height-content-{$this->args['id']}" : '',1183 '%aspect'=> $this->get_aspect_parameters($this->args['content-aspect-ratio'] ?? ''),1196 '%equalise' => $this->args['equal-content-heights'] === 'Y' ? " dyg-equal-height-content-{$this->args['id']}" : '', 1197 '%aspect' => $this->get_aspect_parameters($this->args['content-aspect-ratio'] ?? ''), 1184 1198 ]), 1185 1199 $this); -
dyggrid/trunk/dyg-post-grid/js/dygpg-edit-ajax.js
r2827455 r2832606 15 15 var el = '#' + data.fields[field].id; 16 16 var parent = jQuery(el).closest('form'); 17 if (data.fields[field].type === 'input' || data.fields[field].type === 'textarea' || data.fields[field].type === 'select_list' ) {17 if (data.fields[field].type === 'input' || data.fields[field].type === 'textarea' || data.fields[field].type === 'select_list' || data.fields[field].type === 'dropdown_group') { 18 18 jQuery(el).val(data.fields[field].val); 19 19 } else … … 62 62 function dygpgAdminAjaxReadyFunctions() { 63 63 //auto select reset when a preset button is clicked 64 jQuery('input[name="theme-preset-options"]').each(function () { 65 jQuery(this).off('click').on('click', function () { 66 var resetButton = jQuery(this).closest('form').find('[data-link="style-reset"]'); 67 jQuery(resetButton).prop("checked", false); 68 jQuery(this).closest('form').find('input[name="theme-preset-options"]').each(function () { 69 if (jQuery(this).prop('checked') === true) { 70 jQuery(resetButton).prop("checked", true); 71 } 72 }); 73 }); 64 jQuery('select[name="theme-preset-options"]').off('change').on('change', function () { 65 var resetButton = jQuery(this).closest('form').find('[data-link="style-reset"]'); 66 jQuery(resetButton).prop("checked", true); 74 67 }); 75 68 76 69 //clear the separator character after the last consecutive span in content elements 77 jQuery(' .dygpg-content > div').prev('span').addClass('dygpg-pattern-last');70 jQuery('div.dygpg-pattern').prev('span').addClass('dygpg-pattern-last'); 78 71 jQuery('.dygpg-content > span:last-child').addClass('dygpg-pattern-last'); 72 jQuery('.dyg-post-grid-cell > span:last-child').addClass('dygpg-pattern-last'); 79 73 80 74 //initialise the inline/block pattern arrows based on the value of the hidden input field … … 116 110 }); 117 111 jQuery('i.dygpg-redo').off('click').on('click', function () { 118 if (jQuery(this).prev().text() == 0) 112 if (jQuery(this).prev().text() == 0) 119 113 return; 120 114 jQuery(this).closest('form').find("[name='undo']").val('redo'); -
dyggrid/trunk/dyggrid.php
r2827455 r2832606 12 12 * Plugin URI: https://www.dyggrid.com 13 13 * Description: The ultimate grid and list generator for all Wordpress content types 14 * Version: 2.0. 114 * Version: 2.0.3 15 15 * License: GPL-2.0+ 16 16 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt -
dyggrid/trunk/readme.txt
r2827455 r2832606 5 5 Requires PHP: 7.4 6 6 Tested up to: 6.1.1 7 Stable tag: 2. 0.17 Stable tag: 2.3.0 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html===
Note: See TracChangeset
for help on using the changeset viewer.