Changeset 2416114
- Timestamp:
- 11/10/2020 07:33:45 PM (5 years ago)
- Location:
- acf-engine
- Files:
-
- 6 added
- 1 deleted
- 12 edited
-
assets/screenshot-3.png (added)
-
assets/screenshot-4.png (added)
-
assets/screenshot-5.png (added)
-
trunk/acfengine.php (modified) (5 diffs)
-
trunk/fields/group_5fa836c4c9a7d.json (modified) (3 diffs)
-
trunk/fields/group_5fa8f10925b52.json (modified) (6 diffs)
-
trunk/fields/group_5faac2a257682.json (added)
-
trunk/fields/group_5faadd5d5f90c.json (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/BlockType/BlockQuote/BlockQuote.php (modified) (1 diff)
-
trunk/src/BlockType/CountDown/CountDown.php (modified) (3 diffs)
-
trunk/src/BlockType/Form/Form.php (modified) (1 diff)
-
trunk/src/BlockType/PostQueryReport/PostQueryReport.php (modified) (1 diff)
-
trunk/src/BlockType/Testimonial/Testimonial.php (modified) (1 diff)
-
trunk/src/Form.php (modified) (4 diffs)
-
trunk/src/FormManager.php (modified) (2 diffs)
-
trunk/src/Import.php (modified) (1 diff)
-
trunk/src/Query.php (added)
-
trunk/vendor/freemius/assets/img/acfengine.png (deleted)
Legend:
- Unmodified
- Added
- Removed
-
acf-engine/trunk/acfengine.php
r2415365 r2416114 6 6 * Plugin URI: https://acfengine.com/ 7 7 * Description: Provides data-driven solutions powered by ACF including custom post types, custom taxonomies, options pages and rendering templates. 8 * Version: 1.0. 38 * Version: 1.0.4 9 9 * Author: Eat/Build/Play 10 10 * Author URI: https://eatbuildplay.com … … 29 29 define( 'ACF_ENGINE_PATH', plugin_dir_path( __FILE__ ) ); 30 30 define( 'ACF_ENGINE_URL', plugin_dir_url( __FILE__ ) ); 31 define( 'ACF_ENGINE_VERSION', '1.0. 3' );31 define( 'ACF_ENGINE_VERSION', '1.0.4' ); 32 32 define( 'ACF_ENGINE_TEXT_DOMAIN', 'acf-engine' ); 33 33 class Plugin … … 69 69 add_action( 70 70 'before_delete_post', 71 [ $this, ' acfg_before_delete_post' ],71 [ $this, 'beforeDeletePost' ], 72 72 10, 73 73 1 … … 84 84 } 85 85 86 public function acfg_before_delete_post( $id_acfg )86 public function beforeDeletePost( $id_acfg ) 87 87 { 88 88 $acfg_post = get_post( $id_acfg ); … … 178 178 true 179 179 ); 180 // enable scripts for front-end acf forms 181 acf_form_head(); 180 182 } 181 183 -
acf-engine/trunk/fields/group_5fa836c4c9a7d.json
r2415365 r2416114 21 21 }, 22 22 { 23 "key": "field_5fa836d130557",24 "label": "Reps",25 "name": "reps",26 "type": "number",27 "instructions": "",28 "required": 0,29 "conditional_logic": 0,30 "wrapper": {31 "width": "",32 "class": "",33 "id": ""34 },35 "default_value": 5,36 "placeholder": 5,37 "prepend": "",38 "append": "reps",39 "min": 1,40 "max": 100,41 "step": ""42 },43 {44 23 "key": "field_5fa836f992efc", 45 24 "label": "Exercise", … … 62 41 "return_format": "object", 63 42 "ui": 1 43 }, 44 { 45 "key": "field_5fa9ce32d6aa8", 46 "label": "Value", 47 "name": "value", 48 "type": "number", 49 "instructions": "", 50 "required": 0, 51 "conditional_logic": 0, 52 "wrapper": { 53 "width": "", 54 "class": "", 55 "id": "" 56 }, 57 "default_value": "", 58 "placeholder": "", 59 "prepend": "", 60 "append": "", 61 "min": 1, 62 "max": 121, 63 "step": "" 64 }, 65 { 66 "key": "field_5fa9ce44d6aa9", 67 "label": "Unit", 68 "name": "unit", 69 "type": "button_group", 70 "instructions": "", 71 "required": 0, 72 "conditional_logic": 0, 73 "wrapper": { 74 "width": "", 75 "class": "", 76 "id": "" 77 }, 78 "choices": { 79 "reps": "Reps", 80 "minutes": "Minutes" 81 }, 82 "allow_null": 0, 83 "default_value": "", 84 "layout": "horizontal", 85 "return_format": "value" 64 86 } 65 87 ], … … 81 103 "active": true, 82 104 "description": "", 83 "modified": 160 4860604105 "modified": 1605033500 84 106 } -
acf-engine/trunk/fields/group_5fa8f10925b52.json
r2415365 r2416114 77 77 }, 78 78 { 79 "key": "field_5fa8f63fc1643", 80 "label": "Field Groups", 81 "name": "form_field_groups", 82 "type": "textarea", 83 "instructions": "", 84 "required": 0, 85 "conditional_logic": 0, 86 "wrapper": { 87 "width": "", 88 "class": "", 89 "id": "" 90 }, 91 "default_value": "", 92 "placeholder": "", 93 "maxlength": "", 94 "rows": "", 95 "new_lines": "" 96 }, 97 { 98 "key": "field_5fa8f665c1644", 99 "label": "Fields", 100 "name": "form_fields", 101 "type": "textarea", 102 "instructions": "", 103 "required": 0, 104 "conditional_logic": 0, 105 "wrapper": { 106 "width": "", 107 "class": "", 108 "id": "" 109 }, 110 "default_value": "", 111 "placeholder": "", 112 "maxlength": "", 113 "rows": "", 114 "new_lines": "" 115 }, 116 { 117 "key": "field_5faad42a164cd", 118 "label": "Create Posts", 119 "name": "", 120 "type": "tab", 121 "instructions": "", 122 "required": 0, 123 "conditional_logic": 0, 124 "wrapper": { 125 "width": "", 126 "class": "", 127 "id": "" 128 }, 129 "placement": "left", 130 "endpoint": 0 131 }, 132 { 79 133 "key": "field_5fa8f533f21ae", 80 "label": " New Post",134 "label": "Create New Post", 81 135 "name": "new_post", 82 136 "type": "true_false", … … 96 150 }, 97 151 { 98 "key": "field_5fa8f63fc1643", 99 "label": "Field Groups", 100 "name": "form_field_groups", 101 "type": "textarea", 102 "instructions": "", 103 "required": 0, 104 "conditional_logic": 0, 105 "wrapper": { 106 "width": "", 107 "class": "", 108 "id": "" 109 }, 110 "default_value": "", 111 "placeholder": "", 112 "maxlength": "", 113 "rows": "", 114 "new_lines": "" 115 }, 116 { 117 "key": "field_5fa8f665c1644", 118 "label": "Fields", 119 "name": "form_fields", 120 "type": "textarea", 121 "instructions": "", 122 "required": 0, 123 "conditional_logic": 0, 124 "wrapper": { 125 "width": "", 126 "class": "", 127 "id": "" 128 }, 129 "default_value": "", 130 "placeholder": "", 131 "maxlength": "", 132 "rows": "", 133 "new_lines": "" 152 "key": "field_5faad4843a8b9", 153 "label": "Post Type", 154 "name": "create_post_type", 155 "type": "text", 156 "instructions": "Set to the post type you want to have created. Use the post type key such as \"vehicle\" or \"vehicle_type\".", 157 "required": 0, 158 "conditional_logic": [ 159 [ 160 { 161 "field": "field_5fa8f533f21ae", 162 "operator": "==", 163 "value": "1" 164 } 165 ] 166 ], 167 "wrapper": { 168 "width": "", 169 "class": "", 170 "id": "" 171 }, 172 "default_value": "", 173 "placeholder": "", 174 "prepend": "", 175 "append": "", 176 "maxlength": "" 177 }, 178 { 179 "key": "field_5faad5334fd29", 180 "label": "Post Title", 181 "name": "create_post_title", 182 "type": "text", 183 "instructions": "Title of the newly created post.", 184 "required": 0, 185 "conditional_logic": [ 186 [ 187 { 188 "field": "field_5fa8f533f21ae", 189 "operator": "==", 190 "value": "1" 191 } 192 ] 193 ], 194 "wrapper": { 195 "width": "", 196 "class": "", 197 "id": "" 198 }, 199 "default_value": "", 200 "placeholder": "", 201 "prepend": "", 202 "append": "", 203 "maxlength": "" 204 }, 205 { 206 "key": "field_5faad5464fd2a", 207 "label": "Post Content", 208 "name": "create_post_content", 209 "type": "textarea", 210 "instructions": "Content for the newly created post.", 211 "required": 0, 212 "conditional_logic": [ 213 [ 214 { 215 "field": "field_5fa8f533f21ae", 216 "operator": "==", 217 "value": "1" 218 } 219 ] 220 ], 221 "wrapper": { 222 "width": "", 223 "class": "", 224 "id": "" 225 }, 226 "default_value": "", 227 "placeholder": "", 228 "maxlength": "", 229 "rows": "", 230 "new_lines": "" 231 }, 232 { 233 "key": "field_5faad55f4fd2b", 234 "label": "Post Status", 235 "name": "create_post_status", 236 "type": "radio", 237 "instructions": "Content for the newly created post.", 238 "required": 0, 239 "conditional_logic": [ 240 [ 241 { 242 "field": "field_5fa8f533f21ae", 243 "operator": "==", 244 "value": "1" 245 } 246 ] 247 ], 248 "wrapper": { 249 "width": "", 250 "class": "", 251 "id": "" 252 }, 253 "choices": { 254 "draft": "Draft", 255 "publish": "Published" 256 }, 257 "allow_null": 0, 258 "other_choice": 0, 259 "default_value": "", 260 "layout": "vertical", 261 "return_format": "value", 262 "save_other_choice": 0 263 }, 264 { 265 "key": "field_5fa8fdc41ba80", 266 "label": "Advanced", 267 "name": "", 268 "type": "tab", 269 "instructions": "", 270 "required": 0, 271 "conditional_logic": 0, 272 "wrapper": { 273 "width": "", 274 "class": "", 275 "id": "" 276 }, 277 "placement": "left", 278 "endpoint": 0 134 279 }, 135 280 { … … 185 330 }, 186 331 "message": "", 187 "default_value": 0,332 "default_value": 1, 188 333 "ui": 1, 189 334 "ui_on_text": "", … … 210 355 }, 211 356 { 212 "key": "field_5fa8fdc41ba80", 213 "label": "Advanced", 214 "name": "", 215 "type": "tab", 216 "instructions": "", 217 "required": 0, 218 "conditional_logic": 0, 219 "wrapper": { 220 "width": "", 221 "class": "", 222 "id": "" 223 }, 224 "placement": "left", 225 "endpoint": 0 357 "key": "field_5fa98fbd7603c", 358 "label": "Return", 359 "name": "return", 360 "type": "text", 361 "instructions": "The URL to be redirected to after the form is submitted. Defaults to the current URL with a GET parameter ‘?updated=true’. \r\n\r\nA special placeholder ‘%post_url%’ will be converted to post’s permalink.\r\n\r\nA special placeholder ‘%post_id%’ will be converted to post’s ID.", 362 "required": 0, 363 "conditional_logic": 0, 364 "wrapper": { 365 "width": "", 366 "class": "", 367 "id": "" 368 }, 369 "default_value": "", 370 "placeholder": "", 371 "prepend": "", 372 "append": "", 373 "maxlength": "" 374 }, 375 { 376 "key": "field_5fa98ffd4fa41", 377 "label": "HTML Before Fields", 378 "name": "html_before_fields", 379 "type": "textarea", 380 "instructions": "Extra HTML to add before the fields.", 381 "required": 0, 382 "conditional_logic": 0, 383 "wrapper": { 384 "width": "", 385 "class": "", 386 "id": "" 387 }, 388 "default_value": "", 389 "placeholder": "", 390 "maxlength": "", 391 "rows": "", 392 "new_lines": "" 393 }, 394 { 395 "key": "field_5fa990164fa42", 396 "label": "HTML After Fields", 397 "name": "html_after_fields", 398 "type": "textarea", 399 "instructions": "Extra HTML to add after the fields.", 400 "required": 0, 401 "conditional_logic": 0, 402 "wrapper": { 403 "width": "", 404 "class": "", 405 "id": "" 406 }, 407 "default_value": "", 408 "placeholder": "", 409 "maxlength": "", 410 "rows": "", 411 "new_lines": "" 412 }, 413 { 414 "key": "field_5fa99057c89e5", 415 "label": "Submit Value", 416 "name": "submit_value", 417 "type": "text", 418 "instructions": "The text displayed on the submit button.", 419 "required": 0, 420 "conditional_logic": 0, 421 "wrapper": { 422 "width": "", 423 "class": "", 424 "id": "" 425 }, 426 "default_value": "", 427 "placeholder": "", 428 "prepend": "", 429 "append": "", 430 "maxlength": "" 431 }, 432 { 433 "key": "field_5fa99087825c7", 434 "label": "Updated Message", 435 "name": "updated_message", 436 "type": "textarea", 437 "instructions": "The message displayed above the form after being redirected. Can also be set to false for no message.", 438 "required": 0, 439 "conditional_logic": 0, 440 "wrapper": { 441 "width": "", 442 "class": "", 443 "id": "" 444 }, 445 "default_value": "", 446 "placeholder": "", 447 "maxlength": "", 448 "rows": "", 449 "new_lines": "" 450 }, 451 { 452 "key": "field_5fa990d857e79", 453 "label": "Label Placement", 454 "name": "label_placement", 455 "type": "button_group", 456 "instructions": "Determines where field labels are places in relation to fields. Defaults to ‘top’. Choices of ‘top’ (above fields) or ‘left’ (beside fields).", 457 "required": 0, 458 "conditional_logic": 0, 459 "wrapper": { 460 "width": "", 461 "class": "", 462 "id": "" 463 }, 464 "choices": { 465 "top": "Top", 466 "left": "Left" 467 }, 468 "allow_null": 0, 469 "default_value": "top", 470 "layout": "horizontal", 471 "return_format": "value" 472 }, 473 { 474 "key": "field_5fa9911c7d101", 475 "label": "Instruction Placement", 476 "name": "instruction_placement", 477 "type": "button_group", 478 "instructions": "Determines where field instructions are placed in relation to fields. Defaults to ‘label’. Choice of ‘label’ (below labels) or ‘field’ (below fields).", 479 "required": 0, 480 "conditional_logic": 0, 481 "wrapper": { 482 "width": "", 483 "class": "", 484 "id": "" 485 }, 486 "choices": { 487 "label": "Label", 488 "field": "Field" 489 }, 490 "allow_null": 0, 491 "default_value": "label", 492 "layout": "horizontal", 493 "return_format": "value" 494 }, 495 { 496 "key": "field_5fa9914d558d8", 497 "label": "Field Element", 498 "name": "form_field_el", 499 "type": "button_group", 500 "instructions": "Determines element used to wrap a field. Defaults to ‘div’. Choices of ‘div’, ‘tr’, ‘td’, ‘ul’, ‘ol’, ‘dl’.", 501 "required": 0, 502 "conditional_logic": 0, 503 "wrapper": { 504 "width": "", 505 "class": "", 506 "id": "" 507 }, 508 "choices": { 509 "div": "div", 510 "tr": "tr", 511 "td": "td", 512 "ul": "ul", 513 "ol": "ol", 514 "dl": "dl" 515 }, 516 "allow_null": 0, 517 "default_value": "", 518 "layout": "horizontal", 519 "return_format": "value" 226 520 }, 227 521 { … … 337 631 }, 338 632 "message": "", 339 "default_value": 0,633 "default_value": 1, 340 634 "ui": 1, 341 635 "ui_on_text": "", … … 360 654 "active": true, 361 655 "description": "", 362 "modified": 160 4912167656 "modified": 1605031608 363 657 } -
acf-engine/trunk/readme.txt
r2415365 r2416114 2 2 Contributors: eatbuildplay, freemius 3 3 Donate link: https://eatbuildplay.com/donate/ 4 Tags: acf, post types,taxonomies, blocks, builder4 Tags: acf, custom post types, custom taxonomies, blocks, builder 5 5 Requires at least: 5.0 6 6 Tested up to: 5.5 … … 18 18 All assets that you register with ACF Engine are stored as JSON files and can be easily migrated to any other website powered by ACF Engine. 19 19 20 The free version of ACF Engine provides the following Object Types. 21 22 * Custom Post Types. Register custom post types using the Post Type Editor. All options supported including the new "template" and "template_lock" arguments used to setup Gutenberg. Support for turning on/off Gutenberg editor, setup of WP archive page, REST settings and more. 23 * Custom Taxonomies. Supports all available WordPress taxonomy options including setup of either tags or categories (hierarchal taxonomies). Custom taxonomies can be associated with one or more post types, including both existing or newly registered ACF Engine Post Types. 24 * Options Pages. These are WP Admin pages created using ACF's page registration feature. These pages are then available as ACF field locations allowing you to build a sophisticated settings page for your site, plugin or theme. 25 * Block Types. Register ACF block types and associate field groups to create powerful dynamic custom blocks. 26 * Templates. ACF Engine has a template registry system similar to that found in Elementor and other page builders where you can add a template and assign it to work with given post types. This feature is in early stages of progression, but already supports "Single Post Templates" and "Archive Templates". These templates use dynamic Gutenberg blocks to load content, such as our ACF Field block. 27 28 # Core Block Types 29 30 ACF Engine provides core block types (in addition to providing a UX for registering custom blocks). The library of block types drafted is currently 55, however only a small number are considered "fully functional". These are being built at a rate of approximately 3-4 per week and will be uploaded to WP in the form of weekly block releases. 31 32 Notable core block types for rendering ACF fields include: 33 34 * ACF Field block. This will render any ACF field including repeater fields, it uses a "default render template" for each of the approx. 28 ACF field types. 35 * ACF Image block. This block is more specifically for image rendering of an image field and contains some image specific settings. 36 * ACF Template. This block renders a registered ACF Engine template. This enables nesting of templates inside of other templates. 37 38 # Development Roadmap 39 40 We are currently working primarily on ACF Engine Pro features such as front-end ACF forms and post queries. The forms will likely remain a pro-only feature, but there will be some trickle-down of the query features used to support post filtering and to power some of the more advanced block types. The main work specifically for the open source free version hosted at WordPress.org will be block type rendering. We're also working on documentation at https://acfengine.com and setting up demo sites to help users learn the common functionality and workflow of using ACF Engine to build data-driven sites. 41 20 42 == Frequently Asked Questions == 21 43 … … 30 52 == Screenshots == 31 53 32 1. Main Menu 33 2. ACF Engine Dashboard, provides an overview of all the objects you've created with ACF Engine and links to manage your objects. 54 1. Main Menu - ACF Engine free version has 5 primary object types that are fully supported including Post Types, Taxonomies, Options Pages, Block Types and Templates. 55 2. ACF Engine Dashboard - the simple ACF Engine dashboard currently provides only an overview of all the objects you've created with ACF Engine and links to manage your objects. 56 3. Post Type Editor - ACF Engine provides a beautiful user-friendly ACF tabbed interface. All options for registering custom post types are provided. With minimal settings a post type can be created in under 15-seconds. 57 4. Taxonomy Editor - ACF Engine provides an ACF tabbed UX for registering custom taxonomies. All options for taxonomy registration are provided. With minimal settings a taxonomy can be setup and associated with your custom post types in under 10-seconds. 58 5. Options Page Editor - ACF Engine provides an ACF tabbed UX for registering options pages. These are ACF pages that will appear in the WP admin, ACF field groups can then be associated with them. Previously this feature was only available for developers using code to register their options pages. 34 59 35 60 == Changelog == 36 61 37 62 = 1.0.3 = 38 * Fixed incorrect PHP version requirement listing 63 * Fixed incorrect PHP version requirement listing 39 64 * Added new screenshots for the directory listing 40 65 * Optimized loading of core block types -
acf-engine/trunk/src/BlockType/BlockQuote/BlockQuote.php
r2415365 r2416114 26 26 27 27 public function callback( $block, $content, $isPreview, $postId ) { 28 29 30 $this->render( $block, $content, $postId ); 31 28 $this->render( $block, $content, $postId ); 32 29 } 33 30 34 protected function render( $block, $content, $postId ) { 35 ob_start(); ?> 36 <div class="acfg-blockquote-container"> 37 <blockquote class="acfg-blockquote"><?= get_field('text') ?></blockquote> 38 <cite class="acfg-author">- <?= get_field('author') ?></cite> 39 </div> 40 <style> 41 .acfg-blockquote-container{ 42 max-width: 600px !important; 43 margin: auto; 44 } 45 .acfg-blockquote{ 46 font-weight: 100; 47 font-style: italic; 48 line-height: 1.4; 49 position: relative; 50 border: none; 51 52 <?php if( $fontSize = get_field('font_size') ) { ?> 53 font-size: <?= $fontSize ?>px; 54 <?php }else{ ?> 55 font-size: 16px; 56 <?php } ?> 57 58 <?php if( $padding = get_field('padding') ) { ?> 59 padding: <?= $padding ?>px; 60 <?php }else{ ?> 61 padding: 8px; 62 <?php } ?> 63 64 <?php if( $margin = get_field('margin') ) { ?> 65 margin: <?= $margin ?>px !important; 66 <?php }else{ ?> 67 margin: 0 !important; 68 <?php } ?> 69 70 <?php if( $color = get_field('color') ) { ?> 71 color: <?= $color ?>; 72 <?php }else{ ?> 73 color: #000; 74 <?php } ?> 75 } 76 .acfg-blockquote:before, 77 .acfg-blockquote:after { 78 position: absolute; 79 color: #777777; 80 font-size: 8rem; 81 width: 4rem; 82 height: 4rem; 83 } 84 85 .acfg-blockquote:before { 86 content: '“'; 87 left: -5rem; 88 top: -2rem; 89 } 90 91 .acfg-blockquote:after { 92 content: '”'; 93 right: -4rem; 94 bottom: 1rem; 95 } 96 .acfg-author { 97 text-transform: capitalize; 98 line-height: 3; 99 text-align: left; 100 max-width: 600px; 101 width: 100%; 102 color: #777777; 103 font-weight: 700; 104 <?php if( $padding = get_field('padding') ) { ?> 105 padding-left: <?= $padding ?>px; 106 <?php }else{ ?> 107 padding-left: 0; 108 <?php } ?> 109 } 110 </style> 111 112 <?php 113 print ob_get_clean(); 114 115 } 31 protected function render( $block, $content, $postId ) { 32 33 ob_start(); ?> 34 <div class="acfg-blockquote-container"> 35 <blockquote class="acfg-blockquote"><?= get_field('text') ?></blockquote> 36 <cite class="acfg-author">- <?= get_field('author') ?></cite> 37 </div> 38 <style> 39 .acfg-blockquote-container{ 40 max-width: 600px !important; 41 margin: auto; 42 } 43 .acfg-blockquote{ 44 font-weight: 100; 45 font-style: italic; 46 line-height: 1.4; 47 position: relative; 48 border: none; 49 <?php if( $fontSize = get_field('font_size') ) { ?> 50 font-size: <?= $fontSize ?>px; 51 <?php }else{ ?> 52 font-size: 16px; 53 <?php } ?> 54 <?php if( $padding = get_field('padding') ) { ?> 55 padding: <?= $padding ?>px; 56 <?php }else{ ?> 57 padding: 8px; 58 <?php } ?> 59 <?php if( $margin = get_field('margin') ) { ?> 60 margin: <?= $margin ?>px !important; 61 <?php }else{ ?> 62 margin: 0 !important; 63 <?php } ?> 64 <?php if( $color = get_field('color') ) { ?> 65 color: <?= $color ?>; 66 <?php }else{ ?> 67 color: #000; 68 <?php } ?> 69 } 70 .acfg-blockquote:before, 71 .acfg-blockquote:after { 72 position: absolute; 73 color: #777777; 74 font-size: 8rem; 75 width: 4rem; 76 height: 4rem; 77 } 78 .acfg-blockquote:before { 79 content: '“'; 80 left: -5rem; 81 top: -2rem; 82 } 83 .acfg-blockquote:after { 84 content: '”'; 85 right: -4rem; 86 bottom: 1rem; 87 } 88 .acfg-author { 89 text-transform: capitalize; 90 line-height: 3; 91 text-align: left; 92 max-width: 600px; 93 width: 100%; 94 color: #777777; 95 font-weight: 700; 96 <?php if( $padding = get_field('padding') ) { ?> 97 padding-left: <?= $padding ?>px; 98 <?php }else{ ?> 99 padding-left: 0; 100 <?php } ?> 101 } 102 </style> 103 <?php 104 print ob_get_clean(); 105 } 116 106 117 107 } -
acf-engine/trunk/src/BlockType/CountDown/CountDown.php
r2415553 r2416114 4 4 5 5 if (!defined('ABSPATH')) { 6 exit; 6 exit; 7 7 } 8 8 … … 10 10 11 11 public function key() { 12 return 'count_down';13 }12 return 'count_down'; 13 } 14 14 15 15 public function title() { … … 27 27 public function callback( $block, $content, $isPreview, $postId ) { 28 28 29 if( $isPreview ) {30 $previewPost = $this->getPreviewPost( $postId );31 $postId = $previewPost->ID;29 if( $isPreview ) { 30 $previewPost = $this->getPreviewPost( $postId ); 31 $postId = $previewPost->ID; 32 32 } 33 33 34 $this->render( $block, $content, $postId );34 $this->render( $block, $content, $postId ); 35 35 36 36 } 37 37 38 protected function render( $block, $content, $postId ) {39 print 'COUNTDOWN';40 }38 protected function render( $block, $content, $postId ) { 39 print 'COUNTDOWN'; 40 } 41 41 42 42 } -
acf-engine/trunk/src/BlockType/Form/Form.php
r2415365 r2416114 37 37 38 38 protected function render( $block, $content, $postId ) { 39 print 'FORM'; 39 $formKey = get_field( 'form_key' ); 40 if( !$formKey ) { 41 print "Set form key to see form."; 42 return; 43 } 44 acf_form( $formKey ); 40 45 } 41 46 -
acf-engine/trunk/src/BlockType/PostQueryReport/PostQueryReport.php
r2415365 r2416114 40 40 ]); 41 41 42 $total = 0; 42 $totalReps = 0; 43 $totalMinutes = 0; 43 44 foreach( $posts as $post ) { 44 $total += (int) get_field('reps', $post->ID); 45 46 if( get_field('unit', $post->ID) == 'reps' ) { 47 $totalReps += (int) get_field('value', $post->ID); 48 } 49 50 if( get_field('unit', $post->ID) == 'minutes' ) { 51 $totalMinutes += (int) get_field('value', $post->ID); 52 } 53 45 54 } 46 55 47 56 print '<div class="acfg-post-query-report">'; 48 57 print '<h4>Reps Total</h4>'; 49 print '<h2>' . $total . '</h2>'; 58 print '<h2>' . $totalReps . '</h2>'; 59 print '<h4>Minutes Total</h4>'; 60 print '<h2>' . $totalMinutes . '</h2>'; 50 61 print '</div>'; 51 62 -
acf-engine/trunk/src/BlockType/Testimonial/Testimonial.php
r2415365 r2416114 37 37 38 38 protected function render( $block, $content, $postId ) { 39 ob_start();40 $image = get_field('image');41 $size = 'full';42 $boxedWidth = get_field( 'boxed_width' );43 ?>44 <div class="acfg-testimonials" >45 <div class="acfg-testimonial">46 <?= wp_get_attachment_image( $image, $size ) ?>47 <h2 class="acfg-tertimonial-name"><?= get_field( 'name' ) ?></h2>48 <h3 class="acfg-tertimonial-company"><?= get_field( 'company' ) ?></h3>49 <p class="acfg-tertimonial-content"><?= get_field( 'body' ) ?></p>50 <div class="acfg-tertimonial-stars" style="--rating: <?= get_field( 'rating' ) ?>;" aria-label="Rating of this product is 2.3 out of 5.">51 </div>52 </div>53 <style>54 :root {55 --star-size: <?= get_field('stars_testimonial')['font_size'] ?>px;56 --star-color: <?= get_field('stars_testimonial')['color'] ?>;57 --star-background: <?= get_field('stars_testimonial')['backgound_color'] ?>;58 }59 .acfg-tertimonial-stars {60 --percent: calc(var(--rating) / 5 * 100%);39 ob_start(); 40 $image = get_field('image'); 41 $size = 'full'; 42 $boxedWidth = get_field( 'boxed_width' ); 43 ?> 44 <div class="acfg-testimonials" > 45 <div class="acfg-testimonial"> 46 <?= wp_get_attachment_image( $image, $size ) ?> 47 <h2 class="acfg-tertimonial-name"><?= get_field( 'name' ) ?></h2> 48 <h3 class="acfg-tertimonial-company"><?= get_field( 'company' ) ?></h3> 49 <p class="acfg-tertimonial-content"><?= get_field( 'body' ) ?></p> 50 <div class="acfg-tertimonial-stars" style="--rating: <?= get_field( 'rating' ) ?>;" aria-label="Rating of this product is 2.3 out of 5."> 51 </div> 52 </div> 53 <style> 54 :root { 55 --star-size: <?= get_field('stars_testimonial')['font_size'] ?>px; 56 --star-color: <?= get_field('stars_testimonial')['color'] ?>; 57 --star-background: <?= get_field('stars_testimonial')['backgound_color'] ?>; 58 } 59 .acfg-tertimonial-stars { 60 --percent: calc(var(--rating) / 5 * 100%); 61 61 62 display: inline-block;63 font-size: var(--star-size);64 font-family: Times; /* make sure ★ appears correctly */65 line-height: 1;66 height: ;67 }68 .acfg-tertimonial-stars::before {69 content: "★★★★★";70 letter-spacing: 3px;71 background: linear-gradient(72 90deg,73 var(--star-background) var(--percent),74 var(--star-color) var(--percent)75 );76 -webkit-background-clip: text;77 -webkit-text-fill-color: transparent;78 }79 /* outer wrap div around list */62 display: inline-block; 63 font-size: var(--star-size); 64 font-family: Times; /* make sure ★ appears correctly */ 65 line-height: 1; 66 height: ; 67 } 68 .acfg-tertimonial-stars::before { 69 content: "★★★★★"; 70 letter-spacing: 3px; 71 background: linear-gradient( 72 90deg, 73 var(--star-background) var(--percent), 74 var(--star-color) var(--percent) 75 ); 76 -webkit-background-clip: text; 77 -webkit-text-fill-color: transparent; 78 } 79 /* outer wrap div around list */ 80 80 81 <?php if ($boxedWidth) { ?>82 .acfg-testimonials {83 max-width: <?= get_field( 'max_width' ) ?>px !important;84 margin: 30px auto;85 }86 <?php } ?>81 <?php if ($boxedWidth) { ?> 82 .acfg-testimonials { 83 max-width: <?= get_field( 'max_width' ) ?>px !important; 84 margin: 30px auto; 85 } 86 <?php } ?> 87 87 88 /* singular testimonial */ 89 .acfg-testimonial { 90 background-color: #FFF; 91 border: solid 1px #D6D6D6; 92 text-align: center; 93 font-family: verdana, sans-serif; 94 margin: 15px auto; 95 padding: 25px; 96 width: 600px; 97 } 88 /* singular testimonial */ 89 .acfg-testimonial { 90 background-color: #FFF; 91 border: solid 1px #D6D6D6; 92 text-align: center; 93 font-family: verdana, sans-serif; 94 margin: 15px auto; 95 padding: 25px; 96 width: 600px; 97 } 98 .acfg-testimonial img { 99 height: <?= get_field('image_testimonial')['height'] ?>px !important; 100 width: <?= get_field('image_testimonial')['height'] ?>px !important; 101 margin: auto; 102 border-radius: 50%; 103 } 98 104 99 .acfg-testimonial img { 100 height: <?= get_field('image_testimonial')['height'] ?>px !important; 101 width: <?= get_field('image_testimonial')['height'] ?>px !important; 102 margin: auto; 103 border-radius: 50%; 104 } 105 /* name */ 106 .acfg-testimonial h2 { 107 color: <?= get_field('name_testimonial')['color'] ?>; 108 font-size: <?= get_field('name_testimonial')['font_size'] ?>px; 109 margin: <?= get_field('name_testimonial')['margin'] ?>px; 110 padding: <?= get_field('name_testimonial')['padding'] ?>px; 111 } 105 112 106 /* name*/107 .acfg-testimonial h2{108 color: <?= get_field('name_testimonial')['color'] ?>;109 font-size: <?= get_field('name_testimonial')['font_size'] ?>px;110 margin: <?= get_field('name_testimonial')['margin'] ?>px;111 padding: <?= get_field('name_testimonial')['padding'] ?>px;112 }113 /* company */ 114 .acfg-testimonial h3 { 115 color: <?= get_field('company_testimonial')['color'] ?>; 116 font-size: <?= get_field('company_testimonial')['font_size'] ?>px; 117 margin: <?= get_field('company_testimonial')['margin'] ?>px; 118 padding: <?= get_field('company_testimonial')['padding'] ?>px; 119 } 113 120 114 /* company */ 115 .acfg-testimonial h3 { 116 color: <?= get_field('company_testimonial')['color'] ?>; 117 font-size: <?= get_field('company_testimonial')['font_size'] ?>px; 118 margin: <?= get_field('company_testimonial')['margin'] ?>px; 119 padding: <?= get_field('company_testimonial')['padding'] ?>px; 120 } 121 /* body */ 122 .acfg-testimonial p { 123 color: <?= get_field('body_testimonial')['color'] ?>; 124 font-size: <?= get_field('body_testimonial')['font_size'] ?>px; 125 font-style: italic; 126 margin: <?= get_field('body_testimonial')['margin'] ?>px; 127 padding: <?= get_field('body_testimonial')['padding'] ?>px; 128 text-align: <?= get_field( 'alignment' ) ?>; 129 } 130 </style> 121 131 122 /* body */ 123 .acfg-testimonial p { 124 color: <?= get_field('body_testimonial')['color'] ?>; 125 font-size: <?= get_field('body_testimonial')['font_size'] ?>px; 126 font-style: italic; 127 margin: <?= get_field('body_testimonial')['margin'] ?>px; 128 padding: <?= get_field('body_testimonial')['padding'] ?>px; 129 text-align: <?= get_field( 'alignment' ) ?>; 130 } 131 132 </style> 133 134 <?php 132 <?php 135 133 print ob_get_clean(); 136 134 } -
acf-engine/trunk/src/Form.php
r2415365 r2416114 10 10 11 11 protected $prefix = 'acfg_'; 12 protected $postType = 'acfg_form';12 protected $postType = 'acfg_form'; 13 13 protected $key; 14 protected $postId; 15 protected $title; 16 protected $newPost; 17 protected $fieldGroups; 18 protected $fields; 19 protected $postTitle; 20 protected $postContent; 21 protected $formAttributes; 22 protected $return; 23 protected $htmlBeforeFields; 24 protected $htmlAfterFields; 25 protected $submitValue; 26 protected $updatedMessage; 27 protected $labelPlacement; 28 protected $instructionPlacement; 29 protected $formFieldEl; 30 protected $uploader; 31 protected $honeypot; 32 protected $htmlUpdatedMessage; 33 protected $htmlSubmitButton; 34 protected $htmlSubmitSpinner; 35 protected $kses; 14 36 15 37 public function init() { … … 26 48 27 49 $args = $this->args(); 50 51 //var_dump( $args ); 52 28 53 acf_register_form( $args ); 29 54 … … 42 67 public function defaultArgs() { 43 68 69 $args = [ 70 'id' => $this->key(), 71 'post_id' => $this->postId(), 72 'new_post' => $this->newPost(), 73 'field_groups' => [$this->fieldGroups()], // temporary fix, value must be array 74 'fields' => $this->fields(), 75 'post_title' => $this->postTitle(), 76 'post_content' => $this->postContent(), 77 'form' => $this->form(), 78 'form_attributes' => $this->formAttributes(), 79 'updated_message' => __($this->updatedMessage(), 'acf'), 80 'label_placement' => $this->labelPlacement(), 81 'instruction_placement' => $this->instructionPlacement(), 82 'field_el' => $this->formFieldEl(), 83 'uploader' => $this->uploader(), 84 'honeypot' => $this->honeypot(), 85 'html_updated_message' => $this->htmlUpdatedMessage(), 86 'html_submit_spinner' => $this->htmlSubmitSpinner(), 87 'kses' => $this->kses() 88 ]; 89 90 if( $this->submitValue() && $this->submitValue() != '' ) { 91 $args['submit_value'] = __($this->submitValue(), 'acf'); 92 } 93 94 if( $this->htmlSubmitButton() && $this->htmlSubmitButton() != '' ) { 95 $args['html_submit_button'] = $this->htmlSubmitButton(); 96 } 97 98 if( !empty($this->return()) ) { 99 $args['return'] = $this->return(); 100 } 101 102 if( !empty($this->htmlBeforeFields()) ) { 103 $args['html_before_fields'] = $this->htmlBeforeFields(); 104 } 105 106 if( !empty($this->htmlAfterFields()) ) { 107 $args['html_after_fields'] = $this->htmlAfterFields(); 108 } 109 110 return $args; 111 44 112 } 45 113 … … 56 124 } 57 125 126 public function setPostId( $v ) { 127 $this->postId = $v; 128 } 129 130 public function postId() { 131 return $this->postId; 132 } 133 58 134 public function postType() { 59 135 return $this->postType; 136 } 137 138 public function setTitle( $v ) { 139 $this->title = $v; 140 } 141 142 public function title() { 143 return $this->title; 144 } 145 146 public function setNewPost( $v ) { 147 $this->newPost = $v; 148 } 149 150 public function newPost() { 151 return $this->newPost; 152 } 153 154 public function setFieldGroups( $v ) { 155 $this->fieldGroups = $v; 156 } 157 158 public function fieldGroups() { 159 return $this->fieldGroups; 160 } 161 162 public function setFields( $v ) { 163 $this->fields = $v; 164 } 165 166 public function fields() { 167 return $this->fields; 168 } 169 170 public function setPostTitle( $v ) { 171 $this->postTitle = $v; 172 } 173 174 public function postTitle() { 175 return $this->postTitle; 176 } 177 178 public function setPostContent( $v ) { 179 $this->postContent = $v; 180 } 181 182 public function postContent() { 183 return $this->postContent; 184 } 185 186 public function setForm( $v ) { 187 $this->form = $v; 188 } 189 190 public function form() { 191 return $this->form; 192 } 193 194 public function setFormAttributes( $v ) { 195 $this->formAttributes = $v; 196 } 197 198 public function formAttributes() { 199 return $this->formAttributes; 200 } 201 202 public function setReturn( $v ) { 203 $this->return = $v; 204 } 205 206 public function return() { 207 return $this->return; 208 } 209 210 public function setHtmlBeforeFields( $v ) { 211 $this->htmlBeforeFields = $v; 212 } 213 214 public function htmlBeforeFields() { 215 return $this->htmlBeforeFields; 216 } 217 218 public function setHtmlAfterFields( $v ) { 219 $this->htmlAfterFields = $v; 220 } 221 222 public function htmlAfterFields() { 223 return $this->htmlAfterFields; 224 } 225 226 public function setSubmitValue( $v ) { 227 $this->submitValue = $v; 228 } 229 230 public function submitValue() { 231 return $this->submitValue; 232 } 233 234 public function setUpdatedMessage( $v ) { 235 $this->updatedMessage = $v; 236 } 237 238 public function updatedMessage() { 239 return $this->updatedMessage; 240 } 241 242 public function setLabelPlacement( $v ) { 243 $this->labelPlacement = $v; 244 } 245 246 public function labelPlacement() { 247 return $this->labelPlacement; 248 } 249 250 public function setInstructionPlacement( $v ) { 251 $this->instructionPlacement = $v; 252 } 253 254 public function instructionPlacement() { 255 return $this->instructionPlacement; 256 } 257 258 public function setFormFieldEl( $v ) { 259 $this->formFieldEl = $v; 260 } 261 262 public function formFieldEl() { 263 return $this->formFieldEl; 264 } 265 266 public function setUploader( $v ) { 267 $this->uploader = $v; 268 } 269 270 public function uploader() { 271 return $this->uploader; 272 } 273 274 public function setHoneypot( $v ) { 275 $this->honeypot = $v; 276 } 277 278 public function honeypot() { 279 return $this->honeypot; 280 } 281 282 public function setHtmlUpdatedMessage( $v ) { 283 $this->htmlUpdatedMessage = $v; 284 } 285 286 public function htmlUpdatedMessage() { 287 return $this->htmlUpdatedMessage; 288 } 289 290 public function setHtmlSubmitButton( $v ) { 291 $this->htmlSubmitButton = $v; 292 } 293 294 public function htmlSubmitButton() { 295 return $this->htmlSubmitButton; 296 } 297 298 public function setHtmlSubmitSpinner( $v ) { 299 $this->htmlSubmitSpinner = $v; 300 } 301 302 public function htmlSubmitSpinner() { 303 return $this->htmlSubmitSpinner; 304 } 305 306 public function setKses( $v ) { 307 $this->kses = $v; 308 } 309 310 public function kses() { 311 return $this->kses; 60 312 } 61 313 -
acf-engine/trunk/src/FormManager.php
r2415365 r2416114 25 25 26 26 $data = new \stdClass(); 27 $data->key = get_field('key', $postId);27 $data->key = get_field('key', $postId); 28 28 29 29 if( !$data->key ) { 30 30 return; 31 31 } 32 33 $data->title = get_field('title', $postId); 34 $data->postId = get_field('post_id', $postId); 35 $data->newPost = get_field('new_post', $postId); 36 $data->fieldGroups = get_field('form_field_groups', $postId); 37 $data->fields = get_field('form_fields', $postId); 38 $data->postTitle = get_field('post_title', $postId); 39 $data->postContent = get_field('post_content', $postId); 40 $data->form = get_field('form', $postId); 41 $data->formAttributes = get_field('form_attributes', $postId); 42 $data->return = get_field('return', $postId); 43 $data->htmlBeforeFields = get_field('html_before_fields', $postId); 44 $data->htmlAfterFields = get_field('html_after_fields', $postId); 45 $data->submitValue = get_field('submit_value', $postId); 46 $data->updatedMessage = get_field('updated_message', $postId); 47 $data->labelPlacement = get_field('label_placement', $postId); 48 $data->instructionPlacement = get_field('instruction_placement', $postId); 49 $data->formFieldEl = get_field('form_field_el', $postId); 50 $data->uploader = get_field('uploader', $postId); 51 $data->honeypot = get_field('honeypot', $postId); 52 $data->htmlUpdatedMessage = get_field('html_updated_message', $postId); 53 $data->htmlSubmitButton = get_field('html_submit_button', $postId); 54 $data->htmlSubmitSpinner = get_field('html_submit_spinner', $postId); 55 $data->kses = get_field('kses', $postId); 56 57 /* 58 * Post create field handling 59 */ 60 if( $data->newPost == true ) { 61 $data->newPost = [ 62 'post_type' => get_field('create_post_type', $postId), 63 'post_title' => get_field('create_post_title', $postId), 64 'post_content' => get_field('create_post_content', $postId), 65 'post_status' => get_field('create_post_status', $postId), 66 ]; 67 } 68 69 /* update post title */ 70 remove_action( 'save_post', [$this, 'savePost'] ); 71 wp_update_post( 72 [ 73 'ID' => $postId, 74 'post_title' => $data->title 75 ] 76 ); 32 77 33 78 $json = json_encode( $data ); … … 48 93 $data = json_decode( $json ); 49 94 50 $c = new FormCustom(); 51 $c->setKey( $data->key ); 52 $c->register(); 95 $f = new FormCustom(); 96 $f->setKey( $data->key ); 97 $f->setTitle( $data->title ); 98 $f->setPostId( $data->postId ); 99 $f->setNewPost( $data->newPost ); 100 $f->setFieldGroups( $data->fieldGroups ); 101 $f->setFields( $data->fields ); 102 $f->setPostTitle( $data->postTitle ); 103 $f->setPostContent( $data->postContent ); 104 $f->setForm( $data->form ); 105 $f->setFormAttributes( $data->formAttributes ); 106 $f->setReturn( $data->return ); 107 $f->setHtmlBeforeFields( $data->htmlBeforeFields ); 108 $f->setHtmlAfterFields( $data->htmlAfterFields ); 109 $f->setSubmitValue( $data->submitValue ); 110 $f->setUpdatedMessage( $data->updatedMessage ); 111 $f->setLabelPlacement( $data->labelPlacement ); 112 $f->setInstructionPlacement( $data->instructionPlacement ); 113 $f->setFormFieldEl( $data->formFieldEl ); 114 $f->setUploader( $data->uploader ); 115 $f->setHoneypot( $data->honeypot ); 116 $f->setHtmlUpdatedMessage( $data->htmlUpdatedMessage ); 117 $f->setHtmlSubmitButton( $data->htmlSubmitButton ); 118 $f->setHtmlSubmitSpinner( $data->htmlSubmitSpinner ); 119 $f->setKses( $data->kses ); 120 $f->register(); 53 121 54 122 } -
acf-engine/trunk/src/Import.php
r2415365 r2416114 17 17 18 18 public function saveCallback( $id ) { 19 20 if( !is_admin() ) { 21 return; 22 } 19 23 20 24 $screen = get_current_screen();
Note: See TracChangeset
for help on using the changeset viewer.