Gutenberg Blocks – ACF Blocks Suite - Version 2.6.0

Version Description

  • New: Access to the Extendify template and pattern library
Download this release

Release Info

Developer munirkamal
Plugin Icon 128x128 Gutenberg Blocks – ACF Blocks Suite
Version 2.6.0
Comparing to
See all releases

Code changes from version 2.5.1 to 2.6.0

Files changed (131) hide show
  1. acf-blocks.php +52 -4
  2. {block-templates → acfblocks-templates}/free/acfb-accordion.php +0 -2
  3. {block-templates → acfblocks-templates}/free/acfb-business-hours.php +0 -2
  4. {block-templates → acfblocks-templates}/free/acfb-clicktotweet.php +0 -2
  5. {block-templates → acfblocks-templates}/free/acfb-counternumber.php +0 -2
  6. {block-templates → acfblocks-templates}/free/acfb-divider.php +0 -2
  7. {block-templates → acfblocks-templates}/free/acfb-facebook-page.php +0 -0
  8. {block-templates → acfblocks-templates}/free/acfb-fb-like-button.php +0 -0
  9. {block-templates → acfblocks-templates}/free/acfb-image-slider.php +0 -2
  10. {block-templates → acfblocks-templates}/free/acfb-meta-display.php +0 -2
  11. {block-templates → acfblocks-templates}/free/acfb-multibuttons.php +0 -2
  12. {block-templates → acfblocks-templates}/free/acfb-photocollage.php +0 -0
  13. {block-templates → acfblocks-templates}/free/acfb-posts.php +0 -2
  14. {block-templates → acfblocks-templates}/free/acfb-pricelist.php +0 -2
  15. {block-templates → acfblocks-templates}/free/acfb-pricingbox.php +0 -2
  16. {block-templates → acfblocks-templates}/free/acfb-progressbar.php +0 -2
  17. {block-templates → acfblocks-templates}/free/acfb-random-image.php +0 -0
  18. {block-templates → acfblocks-templates}/free/acfb-scrollable-image.php +0 -0
  19. {block-templates → acfblocks-templates}/free/acfb-socialsharing.php +0 -2
  20. {block-templates → acfblocks-templates}/free/acfb-starrating.php +0 -3
  21. {block-templates → acfblocks-templates}/free/acfb-tabs.php +0 -3
  22. {block-templates → acfblocks-templates}/free/acfb-team.php +0 -2
  23. {block-templates → acfblocks-templates}/free/acfb-testimonial.php +0 -2
  24. {block-templates → acfblocks-templates}/free/acfb-toggle.php +0 -2
  25. block-templates/functions/function.php +0 -56
  26. extendify-sdk/.editorconfig +16 -0
  27. extendify-sdk/.eslintignore +3 -0
  28. extendify-sdk/.eslintrc.js +82 -0
  29. extendify-sdk/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
  30. extendify-sdk/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  31. extendify-sdk/.github/workflows/build-and-test.yml +62 -0
  32. extendify-sdk/.github/workflows/build-development-zip.yml +70 -0
  33. extendify-sdk/.github/workflows/force-production-on-main.yml +66 -0
  34. extendify-sdk/.gitignore +10 -0
  35. extendify-sdk/.phpcs.xml.dist +179 -0
  36. extendify-sdk/.svgrrc +20 -0
  37. extendify-sdk/app/Admin.php +111 -0
  38. extendify-sdk/app/ApiRouter.php +150 -0
  39. extendify-sdk/app/App.php +93 -0
  40. extendify-sdk/app/Controllers/CategoryController.php +42 -0
  41. extendify-sdk/app/Controllers/PluginController.php +61 -0
  42. extendify-sdk/app/Controllers/TemplateController.php +53 -0
  43. extendify-sdk/app/Http.php +145 -0
  44. extendify-sdk/app/Plugin.php +335 -0
  45. extendify-sdk/app/User.php +108 -0
  46. extendify-sdk/bootstrap.php +30 -0
  47. extendify-sdk/composer.json +16 -0
  48. extendify-sdk/composer.lock +2456 -0
  49. extendify-sdk/config.json +6 -0
  50. extendify-sdk/extendify-sdk.php +55 -0
  51. extendify-sdk/loader.php +61 -0
  52. extendify-sdk/package-lock.json +16573 -0
  53. extendify-sdk/package.json +57 -0
  54. extendify-sdk/public/.gitkeep +0 -0
  55. extendify-sdk/public/build/extendify-sdk.css +2 -0
  56. extendify-sdk/public/build/extendify-sdk.js +2 -0
  57. extendify-sdk/public/build/extendify-sdk.js.LICENSE.txt +5 -0
  58. extendify-sdk/readme.md +15 -0
  59. extendify-sdk/readme.txt +5 -0
  60. extendify-sdk/routes/api.php +26 -0
  61. extendify-sdk/src/gutenberg/api/Categories.js +9 -0
  62. extendify-sdk/src/gutenberg/api/Plugins.js +23 -0
  63. extendify-sdk/src/gutenberg/api/Templates.js +25 -0
  64. extendify-sdk/src/gutenberg/api/index.js +65 -0
  65. extendify-sdk/src/gutenberg/assets/icons/index.js +51 -0
  66. extendify-sdk/src/gutenberg/base/templates-library/index.js +47 -0
  67. extendify-sdk/src/gutenberg/components/library-auth/api-form.js +89 -0
  68. extendify-sdk/src/gutenberg/components/library-auth/index.js +67 -0
  69. extendify-sdk/src/gutenberg/components/library-auth/style.scss +24 -0
  70. extendify-sdk/src/gutenberg/components/library-content/index.js +83 -0
  71. extendify-sdk/src/gutenberg/components/library-content/style.scss +49 -0
  72. extendify-sdk/src/gutenberg/components/library-imports-counter/index.js +38 -0
  73. extendify-sdk/src/gutenberg/components/library-imports-counter/style.scss +0 -0
  74. extendify-sdk/src/gutenberg/components/library-load-more/index.js +113 -0
  75. extendify-sdk/src/gutenberg/components/library-load-more/style.scss +4 -0
  76. extendify-sdk/src/gutenberg/components/library-modal/index.js +163 -0
  77. extendify-sdk/src/gutenberg/components/library-modal/style.scss +66 -0
  78. extendify-sdk/src/gutenberg/components/library-not-found/index.js +37 -0
  79. extendify-sdk/src/gutenberg/components/library-not-found/style.scss +5 -0
  80. extendify-sdk/src/gutenberg/components/library-search/index.js +45 -0
  81. extendify-sdk/src/gutenberg/components/library-sidebar-section/index.js +18 -0
  82. extendify-sdk/src/gutenberg/components/library-sidebar-section/style.scss +10 -0
  83. extendify-sdk/src/gutenberg/components/library-sidebar/index.js +227 -0
  84. extendify-sdk/src/gutenberg/components/library-sidebar/style.scss +44 -0
  85. extendify-sdk/src/gutenberg/components/library-template-preview/index.js +192 -0
  86. extendify-sdk/src/gutenberg/components/library-template-preview/style.scss +71 -0
  87. extendify-sdk/src/gutenberg/components/library-template/index.js +89 -0
  88. extendify-sdk/src/gutenberg/components/library-template/style.scss +27 -0
  89. extendify-sdk/src/gutenberg/functions/index.js +112 -0
  90. extendify-sdk/src/gutenberg/global/index.js +1 -0
  91. extendify-sdk/src/gutenberg/listeners/index.js +5 -0
  92. extendify-sdk/src/gutenberg/listeners/softerror-encountered.js +28 -0
  93. extendify-sdk/src/gutenberg/listeners/template-inserted.js +9 -0
  94. extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatePluginsModal.js +64 -0
  95. extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/ActivatingModal.js +70 -0
  96. extendify-sdk/src/gutenberg/middleware/hasPluginsActivated/index.js +22 -0
  97. extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/InstallingModal.js +69 -0
  98. extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/RequiredPluginsModal.js +69 -0
  99. extendify-sdk/src/gutenberg/middleware/hasRequiredPlugins/index.js +22 -0
  100. extendify-sdk/src/gutenberg/middleware/helpers.js +63 -0
  101. extendify-sdk/src/gutenberg/middleware/index.js +49 -0
  102. extendify-sdk/src/gutenberg/middleware/needsPageReload/ReloadRequiredModal.js +46 -0
  103. extendify-sdk/src/gutenberg/middleware/needsPageReload/index.js +18 -0
  104. extendify-sdk/src/gutenberg/plugins/header-btn/index.js +65 -0
  105. extendify-sdk/src/gutenberg/plugins/header-btn/style.scss +10 -0
  106. extendify-sdk/src/gutenberg/plugins/index.js +2 -0
  107. extendify-sdk/src/gutenberg/plugins/more-menu-btn/index.js +64 -0
  108. extendify-sdk/src/gutenberg/plugins/more-menu-btn/style.scss +5 -0
  109. extendify-sdk/src/gutenberg/scss/_mixins.scss +62 -0
  110. extendify-sdk/src/gutenberg/scss/_variables.scss +0 -0
  111. extendify-sdk/src/gutenberg/store/actions/index.js +118 -0
  112. extendify-sdk/src/gutenberg/store/controls/index.js +9 -0
  113. extendify-sdk/src/gutenberg/store/index.js +42 -0
  114. extendify-sdk/src/gutenberg/store/reducer/index.js +167 -0
  115. extendify-sdk/src/gutenberg/store/resolvers/index.js +25 -0
  116. extendify-sdk/src/gutenberg/store/selectors/index.js +138 -0
  117. extendify-sdk/src/index.js +25 -0
  118. extendify-sdk/src/style.scss +47 -0
  119. extendify-sdk/vendor/autoload.php +7 -0
  120. extendify-sdk/vendor/composer/ClassLoader.php +445 -0
  121. extendify-sdk/vendor/composer/InstalledVersions.php +654 -0
  122. extendify-sdk/vendor/composer/LICENSE +21 -0
  123. extendify-sdk/vendor/composer/autoload_classmap.php +9 -0
  124. extendify-sdk/vendor/composer/autoload_namespaces.php +9 -0
  125. extendify-sdk/vendor/composer/autoload_psr4.php +10 -0
  126. extendify-sdk/vendor/composer/autoload_real.php +55 -0
  127. extendify-sdk/vendor/composer/autoload_static.php +31 -0
  128. extendify-sdk/vendor/composer/installed.json +1 -0
  129. extendify-sdk/vendor/composer/installed.php +395 -0
  130. extendify-sdk/webpack.config.js +140 -0
  131. readme.txt +25 -4
acf-blocks.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: ACF Blocks Suite
5
  * Plugin URI: https://acfblocks.com/
6
  * Description: Supercharge your Gutenberg editor with high quality beautiful WordPress blocks. Ready-to-use ACF Blocks!
7
- * Version: 2.5.1
8
  * Author: munirkamal
9
  * Author URI: https://munirkamal.wordpress.com
10
  * License: GPL2
@@ -15,6 +15,7 @@
15
  if ( !defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
 
18
 
19
  if ( function_exists( 'acfb_fs' ) ) {
20
  acfb_fs()->set_basename( false, __FILE__ );
@@ -402,12 +403,12 @@ if ( function_exists( 'acfb_fs' ) ) {
402
  $acfb_temp = str_replace( "acf/", "", $block['name'] );
403
  // Look for a file in theme
404
 
405
- if ( $theme_template = locate_template( 'block-templates/' . $acfb_temp . '.php' ) ) {
406
  require $theme_template;
407
  } else {
408
  // Nothing found, let's look in our plugin
409
- $free_template = plugin_dir_path( __FILE__ ) . 'block-templates/free/' . $acfb_temp . '.php';
410
- $pro_template = plugin_dir_path( __FILE__ ) . 'block-templates/pro/' . $acfb_temp . '.php';
411
  if ( file_exists( $free_template ) ) {
412
  require $free_template;
413
  }
@@ -712,6 +713,53 @@ if ( function_exists( 'acfb_fs' ) ) {
712
  // Adding .json extension
713
  return $acfb_mime_types;
714
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
715
 
716
  }
717
 
4
  * Plugin Name: ACF Blocks Suite
5
  * Plugin URI: https://acfblocks.com/
6
  * Description: Supercharge your Gutenberg editor with high quality beautiful WordPress blocks. Ready-to-use ACF Blocks!
7
+ * Version: 2.6.0
8
  * Author: munirkamal
9
  * Author URI: https://munirkamal.wordpress.com
10
  * License: GPL2
15
  if ( !defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
+ require_once plugin_dir_path( __FILE__ ) . 'extendify-sdk/loader.php';
19
 
20
  if ( function_exists( 'acfb_fs' ) ) {
21
  acfb_fs()->set_basename( false, __FILE__ );
403
  $acfb_temp = str_replace( "acf/", "", $block['name'] );
404
  // Look for a file in theme
405
 
406
+ if ( $theme_template = locate_template( 'acfblocks-templates/' . $acfb_temp . '.php' ) ) {
407
  require $theme_template;
408
  } else {
409
  // Nothing found, let's look in our plugin
410
+ $free_template = plugin_dir_path( __FILE__ ) . 'acfblocks-templates/free/' . $acfb_temp . '.php';
411
+ $pro_template = plugin_dir_path( __FILE__ ) . 'acfblocks-templates/pro/' . $acfb_temp . '.php';
412
  if ( file_exists( $free_template ) ) {
413
  require $free_template;
414
  }
713
  // Adding .json extension
714
  return $acfb_mime_types;
715
  }
716
+
717
+ // Functions Code
718
+ function parse_link( $fields )
719
+ {
720
+ $acfb_families = array();
721
+ foreach ( $fields as $key => $field ) {
722
+
723
+ if ( is_array( $field ) and array_key_exists( 'font_family', $field ) ) {
724
+ $acfb_font_family = $field['font_family'];
725
+ if ( $acfb_font_family !== "" and $acfb_font_family !== NULL and $acfb_font_family !== 'default' ) {
726
+ $acfb_families[] = $acfb_font_family;
727
+ }
728
+ }
729
+
730
+ }
731
+
732
+ if ( !empty($acfb_families) ) {
733
+ $family_merges = join( '&family=', $acfb_families );
734
+ return "<link href='https://fonts.googleapis.com/css2?family={$family_merges}' rel='stylesheet'>";
735
+ } else {
736
+ return "";
737
+ }
738
+
739
+ }
740
+
741
+ function get_family( $family )
742
+ {
743
+ return str_replace( '+', " ", $family );
744
+ }
745
+
746
+ function getCustomField( $field_name, $post_id )
747
+ {
748
+ $selected_field = get_field( $field_name );
749
+ $selected_field_data = json_decode( $selected_field, true );
750
+ return [
751
+ 'type' => $selected_field_data['type'],
752
+ 'value' => get_field( $selected_field_data['name'], $post_id ),
753
+ ];
754
+ }
755
+
756
+ // retrieves the attachment ID from the file URL for acf meta gallery
757
+ function acfb_meta_gallery_get_image_id( $acfb_meta_gallery_image_url )
758
+ {
759
+ global $wpdb ;
760
+ $attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s';", $acfb_meta_gallery_image_url ) );
761
+ return $attachment[0];
762
+ }
763
 
764
  }
765
 
{block-templates → acfblocks-templates}/free/acfb-accordion.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_accordion_title_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_accordion_title_typo'),
{block-templates → acfblocks-templates}/free/acfb-business-hours.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_bh_text_typo')
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_bh_text_typo')
{block-templates → acfblocks-templates}/free/acfb-clicktotweet.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_click_to_tweet_text_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_click_to_tweet_text_typo'),
{block-templates → acfblocks-templates}/free/acfb-counternumber.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_counter_number_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_counter_number_typo'),
{block-templates → acfblocks-templates}/free/acfb-divider.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  $uid = $block['id'];
5
 
6
  $className = 'acfb_divider_block';
1
  <?php
 
 
2
  $uid = $block['id'];
3
 
4
  $className = 'acfb_divider_block';
{block-templates → acfblocks-templates}/free/acfb-facebook-page.php RENAMED
File without changes
{block-templates → acfblocks-templates}/free/acfb-fb-like-button.php RENAMED
File without changes
{block-templates → acfblocks-templates}/free/acfb-image-slider.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_slider_caption_typo')
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_slider_caption_typo')
{block-templates → acfblocks-templates}/free/acfb-meta-display.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  $acfb_meta_display_post_id = (int)get_field('post_id'); # hidden field in order to obtain post id
5
  $acfb_meta_field = getCustomField('acfb_meta_select_field', $acfb_meta_display_post_id);
6
 
1
  <?php
 
 
2
  $acfb_meta_display_post_id = (int)get_field('post_id'); # hidden field in order to obtain post id
3
  $acfb_meta_field = getCustomField('acfb_meta_select_field', $acfb_meta_display_post_id);
4
 
{block-templates → acfblocks-templates}/free/acfb-multibuttons.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_multibutton_text_typo')
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_multibutton_text_typo')
{block-templates → acfblocks-templates}/free/acfb-photocollage.php RENAMED
File without changes
{block-templates → acfblocks-templates}/free/acfb-posts.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_post_title_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_post_title_typo'),
{block-templates → acfblocks-templates}/free/acfb-pricelist.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_price_list_title_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_price_list_title_typo'),
{block-templates → acfblocks-templates}/free/acfb-pricingbox.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_pricingbox_title_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_pricingbox_title_typo'),
{block-templates → acfblocks-templates}/free/acfb-progressbar.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_progressbar_text_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_progressbar_text_typo'),
{block-templates → acfblocks-templates}/free/acfb-random-image.php RENAMED
File without changes
{block-templates → acfblocks-templates}/free/acfb-scrollable-image.php RENAMED
File without changes
{block-templates → acfblocks-templates}/free/acfb-socialsharing.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_social_button_text_typo')
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_social_button_text_typo')
{block-templates → acfblocks-templates}/free/acfb-starrating.php RENAMED
@@ -1,7 +1,4 @@
1
  <?php
2
-
3
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
4
-
5
  echo parse_link(
6
  array(
7
  get_field('acfb_rating_before_text_typo')
1
  <?php
 
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_rating_before_text_typo')
{block-templates → acfblocks-templates}/free/acfb-tabs.php RENAMED
@@ -1,7 +1,4 @@
1
  <?php
2
-
3
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
4
-
5
  echo parse_link(
6
  array(
7
  get_field('acfb_tab_title_typo'),
1
  <?php
 
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_tab_title_typo'),
{block-templates → acfblocks-templates}/free/acfb-team.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_team_name_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_team_name_typo'),
{block-templates → acfblocks-templates}/free/acfb-testimonial.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_testimonial_text_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_testimonial_text_typo'),
{block-templates → acfblocks-templates}/free/acfb-toggle.php RENAMED
@@ -1,6 +1,4 @@
1
  <?php
2
- require_once plugin_dir_path( __DIR__ ) . 'functions/function.php';
3
-
4
  echo parse_link(
5
  array(
6
  get_field('acfb_toggle_title_typo'),
1
  <?php
 
 
2
  echo parse_link(
3
  array(
4
  get_field('acfb_toggle_title_typo'),
block-templates/functions/function.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
- function parse_link( $fields ) {
3
-
4
- $acfb_families = array();
5
-
6
-
7
- foreach ( $fields as $key => $field ) {
8
-
9
- if (is_array($field) and array_key_exists('font_family', $field) ) {
10
-
11
- $acfb_font_family = $field['font_family'];
12
-
13
- if ( $acfb_font_family !== "" and $acfb_font_family !== NULL and $acfb_font_family !== 'default' ) {
14
- $acfb_families[] = $acfb_font_family;
15
- }
16
-
17
- }
18
-
19
- }
20
-
21
- if (!empty($acfb_families)) {
22
- $family_merges = join('&family=', $acfb_families);
23
-
24
- return "<link href='https://fonts.googleapis.com/css2?family=$family_merges' rel='stylesheet'>";
25
-
26
- } else return "";
27
-
28
-
29
- }
30
-
31
-
32
- function get_family( $family ) {
33
- return str_replace('+', " ", $family);
34
- }
35
-
36
-
37
-
38
-
39
- function getCustomField($field_name, $post_id){
40
-
41
- $selected_field = get_field($field_name);
42
- $selected_field_data = json_decode($selected_field, true);
43
-
44
- return [
45
- 'type' => $selected_field_data['type'],
46
- 'value' => get_field($selected_field_data['name'], $post_id)
47
- ];
48
- }
49
-
50
-
51
- // retrieves the attachment ID from the file URL for acf meta gallery
52
- function acfb_meta_gallery_get_image_id($acfb_meta_gallery_image_url) {
53
- global $wpdb;
54
- $attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $acfb_meta_gallery_image_url ));
55
- return $attachment[0];
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
extendify-sdk/.editorconfig ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ indent_style = space
8
+ indent_size = 4
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.yml]
12
+ indent_style = space
13
+ indent_size = 2
14
+
15
+ [*.md]
16
+ trim_trailing_whitespace = false
extendify-sdk/.eslintignore ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ node_modules/*
2
+ vendor/*
3
+ public/build/*
extendify-sdk/.eslintrc.js ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es2021: true,
5
+ jest: true,
6
+ },
7
+ extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
8
+ parserOptions: {
9
+ ecmaFeatures: {
10
+ jsx: true,
11
+ },
12
+ sourceType: 'module',
13
+ },
14
+ plugins: ['react'],
15
+ rules: {
16
+ indent: ['error', 4, {
17
+ SwitchCase: 1,
18
+ }],
19
+ quotes: ['error', 'single'],
20
+ 'comma-dangle': ['error', 'always-multiline'],
21
+ 'multiline-ternary': ['error', 'always'],
22
+ 'array-element-newline': ['error', 'consistent'],
23
+ 'no-constant-condition': ['error', {
24
+ checkLoops: false,
25
+ }],
26
+ 'space-before-function-paren': [
27
+ 'error',
28
+ {
29
+ anonymous: 'always',
30
+ named: 'never',
31
+ asyncArrow: 'always',
32
+ },
33
+ ],
34
+ 'react/react-in-jsx-scope': 'off',
35
+ 'function-paren-newline': [
36
+ 'error',
37
+ {
38
+ minItems: 3,
39
+ },
40
+ ],
41
+ 'quote-props': ['error', 'as-needed'],
42
+ 'object-curly-spacing': ['error', 'always'],
43
+ 'no-multiple-empty-lines': [
44
+ 'error',
45
+ {
46
+ max: 1,
47
+ },
48
+ ],
49
+ 'react/prop-types': 0, // TODO: Do we want this required?
50
+ 'lines-around-comment': [
51
+ 'error',
52
+ {
53
+ beforeBlockComment: true,
54
+ allowBlockStart: true,
55
+ },
56
+ ],
57
+ 'object-curly-newline': [
58
+ 'error',
59
+ {
60
+ ObjectExpression: {
61
+ minProperties: 1,
62
+ },
63
+ ObjectPattern: {
64
+ multiline: true,
65
+ },
66
+ ImportDeclaration: {
67
+ multiline: true,
68
+ minProperties: 3,
69
+ },
70
+ ExportDeclaration: {
71
+ multiline: true,
72
+ minProperties: 3,
73
+ },
74
+ },
75
+ ],
76
+ },
77
+ settings: {
78
+ react: {
79
+ version: 'detect',
80
+ },
81
+ },
82
+ }
extendify-sdk/.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ Provide a screenshot of the browser console showing any errors, if applicable ([instructions](https://support.airtable.com/hc/en-us/articles/232313848-How-to-open-the-developer-console)).
25
+ Also include any screenshots that demonstrate the issue more clearly.
26
+
27
+ **Desktop (please complete the following information):**
28
+ - OS: [e.g. iOS]
29
+ - Browser [e.g. chrome, safari]
30
+ - Version [e.g. 22]
31
+
32
+ **Smartphone (please complete the following information):**
33
+ - Device: [e.g. iPhone6]
34
+ - OS: [e.g. iOS8.1]
35
+ - Browser [e.g. stock browser, safari]
36
+ - Version [e.g. 22]
37
+
38
+ **Additional context**
39
+ Add any other context about the problem here.
extendify-sdk/.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
extendify-sdk/.github/workflows/build-and-test.yml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and test
2
+ on: [push, pull_request]
3
+ jobs:
4
+ # TODO: create another job for integration testing that includes Cypress, booting up WPO, etc
5
+ # Reference wp-cli: https://github.com/wp-cli/wp-cli/blob/master/.github/workflows/testing.yml
6
+ unit: #-------------------------------------------
7
+ name: PHP ${{ matrix.php }}
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ php: ['7.4']
13
+ steps:
14
+ - name: Check out source code
15
+ uses: actions/checkout@v2
16
+
17
+ - name: Setup PHP
18
+ uses: shivammathur/setup-php@v2
19
+ with:
20
+ php-version: '${{ matrix.php }}'
21
+ extensions: mysql, zip
22
+ coverage: none
23
+ tools: composer:v1, wp-cli, cs2pr, phpcs
24
+
25
+ - name: Get Composer cache directory
26
+ id: composer-cache
27
+ run: |
28
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
29
+
30
+ - name: Use Composer cache
31
+ uses: actions/cache@master
32
+ with:
33
+ path: ${{ steps['composer-cache'].outputs.dir }}
34
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
35
+ restore-keys: |
36
+ ${{ runner.os }}-composer-
37
+
38
+ - name: Install dependencies
39
+ run: composer install --prefer-dist --no-progress --no-suggest
40
+
41
+ - name: Install PHPCS
42
+ run: git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git ${{ github.workspace }}/wpcs
43
+
44
+ - name: PHPCS check
45
+ run: |
46
+ phpcs --config-set installed_paths ${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP,${{ github.workspace }}/vendor/phpcompatibility/php-compatibility/PHPCompatibility,${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieSodiumCompat,${{ github.workspace }}/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat,${{ github.workspace }}/wpcs
47
+ phpcs -i
48
+ phpcs -q --report=checkstyle . | cs2pr
49
+
50
+ - name: Install NPM packages
51
+ run: npm ci
52
+ env:
53
+ CYPRESS_INSTALL_BINARY: "0"
54
+
55
+ - name: Build assets
56
+ run: npm run build
57
+
58
+ - name: Test JavaScript
59
+ run: npm run test
60
+
61
+ - name: Lint JavaScript
62
+ run: npm run lint
extendify-sdk/.github/workflows/build-development-zip.yml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build development zip file
2
+ on: push
3
+ jobs:
4
+ build:
5
+ name: Build test, and zip
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ php: [8.0]
11
+ node-version: [14.x]
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v1
15
+
16
+ - name: Setup PHP
17
+ uses: shivammathur/setup-php@v2
18
+ with:
19
+ php-version: '${{ matrix.php }}'
20
+ tools: composer:v1
21
+
22
+ - name: Get Composer cache directory
23
+ id: composer-cache
24
+ run: |
25
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
26
+ - name: Use Composer cache
27
+ uses: actions/cache@master
28
+ with:
29
+ path: ${{ steps['composer-cache'].outputs.dir }}
30
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
31
+ restore-keys: |
32
+ ${{ runner.os }}-composer-
33
+ - name: Build autoloader
34
+ run: composer install --prefer-dist --no-progress --no-suggest --no-dev
35
+
36
+ - name: Using Node version ${{ matrix.node-version }}
37
+ uses: actions/setup-node@v1
38
+ with:
39
+ node-version: ${{ matrix.node-version }}
40
+ - name: npm install, build, and test
41
+ run: |
42
+ npm ci
43
+ npm run dev
44
+ touch .devbuild
45
+ env:
46
+ CI: true
47
+ - name: Package
48
+ uses: actions/upload-artifact@v2
49
+ with:
50
+ name: extendify-sdk
51
+ retention-days: 5
52
+ path: |
53
+ ${{ github.workspace }}/
54
+ !${{ github.workspace }}/node_modules/
55
+ !${{ github.workspace }}/.github/
56
+ !${{ github.workspace }}/.git/
57
+ !${{ github.workspace }}/src/
58
+ !${{ github.workspace }}/.editorconfig
59
+ !${{ github.workspace }}/.eslintrc.js
60
+ !${{ github.workspace }}/.eslintignore
61
+ !${{ github.workspace }}/.gitignore
62
+ !${{ github.workspace }}/.svgrrc
63
+ !${{ github.workspace }}/.prettierrc.js
64
+ !${{ github.workspace }}/.phpcs.xml.dist
65
+ !${{ github.workspace }}/webpack.config.js
66
+ !${{ github.workspace }}/composer.json
67
+ !${{ github.workspace }}/composer.lock
68
+ !${{ github.workspace }}/package.json
69
+ !${{ github.workspace }}/package-lock.json
70
+ !${{ github.workspace }}/readme.md
extendify-sdk/.github/workflows/force-production-on-main.yml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build production assets
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ build:
8
+ name: Build and commit
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ php: [8.0]
14
+ node-version: [14.x]
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v1
18
+
19
+ - name: Set up git user
20
+ run: git config --global user.name extendify
21
+ - name: Set up git email
22
+ run: git config --global user.name extendify@users.noreply.github.com
23
+
24
+ - name: Setup PHP
25
+ uses: shivammathur/setup-php@v2
26
+ with:
27
+ php-version: '${{ matrix.php }}'
28
+ extensions: mysql, zip
29
+ coverage: none
30
+ tools: composer:v1, wp-cli, cs2pr, phpcs
31
+
32
+ - name: Get Composer cache directory
33
+ id: composer-cache
34
+ run: |
35
+ echo "::set-output name=dir::$(composer config cache-files-dir)"
36
+ - name: Use Composer cache
37
+ uses: actions/cache@master
38
+ with:
39
+ path: ${{ steps['composer-cache'].outputs.dir }}
40
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
41
+ restore-keys: |
42
+ ${{ runner.os }}-composer-
43
+ - name: Build autoloader
44
+ run: composer install --prefer-dist --no-progress --no-suggest --no-dev
45
+
46
+ - name: Using Node version ${{ matrix.node-version }}
47
+ uses: actions/setup-node@v1
48
+ with:
49
+ node-version: ${{ matrix.node-version }}
50
+ - name: npm install, build, and test
51
+ run: |
52
+ npm ci
53
+ npm run build
54
+ env:
55
+ CI: true
56
+ - name: Increment version number
57
+ run: |
58
+ perl -i -pe 's/(Stable tag: )([\d.]+)$/$1.($2+.1)/e' readme.txt
59
+ - name: Commit dist folder if needed #it fails if nothing has changed so we allow an error
60
+ run: git commit -am 'Build produciton assets'
61
+ continue-on-error: true
62
+ - name: Push changed files to main
63
+ uses: ad-m/github-push-action@master
64
+ with:
65
+ github_token: ${{ secrets.GITHUB_TOKEN }}
66
+ branch: main
extendify-sdk/.gitignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ node_modules
2
+
3
+ .DS_Store
4
+ .vscode
5
+
6
+ vendor/*
7
+ !vendor/composer
8
+ !vendor/autoload.php
9
+
10
+ wpcs
extendify-sdk/.phpcs.xml.dist ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="extendify-sdk" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
3
+
4
+ <description>WP Plugin checks</description>
5
+
6
+ <!-- Exclude the Composer Vendor directory. -->
7
+ <exclude-pattern>/vendor/*</exclude-pattern>
8
+
9
+ <exclude-pattern>/cypress/*</exclude-pattern>
10
+ <exclude-pattern>/.github/*</exclude-pattern>
11
+ <exclude-pattern>/tests/*</exclude-pattern>
12
+ <exclude-pattern>/public/*</exclude-pattern>
13
+ <exclude-pattern>/wpcs/*</exclude-pattern>
14
+
15
+ <!-- Exclude the Node Modules directory. -->
16
+ <exclude-pattern>/node_modules/*</exclude-pattern>
17
+
18
+ <!-- Exclude CSS and Javascript files. -->
19
+ <exclude-pattern>*.css</exclude-pattern>
20
+ <exclude-pattern>*.js</exclude-pattern>
21
+
22
+ <!-- Include the WordPress-Extra standard. -->
23
+ <rule ref="WordPress-Extra">
24
+ <!--
25
+ We may want a middle ground though. The best way to do this is add the
26
+ entire ruleset, then rule by rule, remove ones that don't suit a project.
27
+ We can do this by running `phpcs` with the '-s' flag, which allows us to
28
+ see the names of the sniffs reporting errors.
29
+ Once we know the sniff names, we can opt to exclude sniffs which don't
30
+ suit our project like so.
31
+
32
+ The below two examples just show how you can exclude rules.
33
+ They are not intended as advice about which sniffs to exclude.
34
+ -->
35
+
36
+ <!--
37
+ <exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
38
+ <exclude name="WordPress.Security.EscapeOutput"/>
39
+ -->
40
+ </rule>
41
+
42
+ <rule ref="WordPress">
43
+ <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
44
+ <exclude name="WordPress.Files.FileName.InvalidClassFileName" />
45
+ <exclude name="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedNamespaceFound" />
46
+ <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis" />
47
+ <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis" />
48
+ <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" />
49
+ <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
50
+ <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis" />
51
+ <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener" />
52
+ <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser" />
53
+ <exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
54
+ <exclude name="WordPress.NamingConventions.ValidVariableName.PropertyNotSnakeCase" />
55
+ <exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid" />
56
+ <exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
57
+ <exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" />
58
+ <exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys" />
59
+ <exclude name="WordPress.PHP.YodaConditions.NotYoda" />
60
+ <exclude name="WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid" />
61
+ <exclude name="WordPress.NamingConventions.ValidVariableName.InterpolatedVariableNotSnakeCase" />
62
+ </rule>
63
+
64
+ <rule ref="Generic">
65
+ <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
66
+ <exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
67
+ <exclude name="Generic.PHP.ClosingPHPTag.NotFound" />
68
+ <exclude name="Generic.Files.LowercasedFilename.NotFound" />
69
+ <exclude name="Generic.Formatting.SpaceAfterNot.Incorrect" />
70
+ <exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
71
+ <exclude name="Generic.Files.EndFileNoNewline.Found" />
72
+ <exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
73
+ <exclude name="Generic.Files.LineLength.TooLong" />
74
+ <exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
75
+ <exclude name="Generic.Commenting.Todo.TaskFound" />
76
+ <exclude name="Generic.Formatting.NoSpaceAfterCast.SpaceFound" />
77
+ <exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame" />
78
+ <exclude name="Generic.PHP.RequireStrictTypes.MissingDeclaration" />
79
+ <exclude name="Generic.PHP.UpperCaseConstant.Found" />
80
+ <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeOpen" />
81
+ <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose" />
82
+ <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen" />
83
+ <exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterClose" />
84
+ <exclude name="Generic.PHP.ForbiddenFunctions.Found" />
85
+ <exclude name="Generic.Files.InlineHTML.Found" />
86
+ </rule>
87
+ <rule ref="Squiz">
88
+ <exclude name="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen" />
89
+ <exclude name="Squiz.ControlStructures.ElseIfDeclaration.NotAllowed" />
90
+ <exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
91
+ <exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast" />
92
+ <exclude name="Squiz.Files.FileExtension.ClassFound" />
93
+ <exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
94
+ <exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed" />
95
+ <exclude name="Squiz.WhiteSpace.FunctionSpacing.BeforeFirst" />
96
+ <exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue" />
97
+ <exclude name="Squiz.WhiteSpace.FunctionSpacing.After" />
98
+ <exclude name="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned" />
99
+ <exclude name="Squiz.WhiteSpace.FunctionSpacing.Before" />
100
+ <exclude name="Squiz.PHP.DisallowBooleanStatement.Found" />
101
+ <exclude name="Squiz.ControlStructures.InlineIfDeclaration.NoBrackets" />
102
+ <exclude name="Squiz.PHP.DisallowInlineIf.Found" />
103
+ <exclude name="Squiz.PHP.DisallowComparisonAssignment.AssignedComparison" />
104
+ <exclude name="Squiz.PHP.DiscouragedFunctions.Discouraged" />
105
+ <exclude name="Squiz.Functions.GlobalFunction.Found" />
106
+ <exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
107
+ </rule>
108
+ <rule ref="PEAR">
109
+ <exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
110
+ <exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket" />
111
+ <exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket" />
112
+ <exclude name="PEAR.Commenting.FileComment.MissingPackageTag" />
113
+ <exclude name="PEAR.Commenting.FileComment.MissingAuthorTag" />
114
+ <exclude name="PEAR.Commenting.FileComment.MissingCategoryTag" />
115
+ <exclude name="PEAR.Commenting.FileComment.MissingLinkTag" />
116
+ <exclude name="PEAR.Commenting.FileComment.MissingLicenseTag" />
117
+ <exclude name="PEAR.Commenting.FileComment.MissingVersion" />
118
+ <exclude name="PEAR.Commenting.ClassComment.MissingPackageTag" />
119
+ <exclude name="PEAR.Commenting.ClassComment.MissingAuthorTag" />
120
+ <exclude name="PEAR.Commenting.ClassComment.MissingCategoryTag" />
121
+ <exclude name="PEAR.Commenting.ClassComment.MissingLinkTag" />
122
+ <exclude name="PEAR.Commenting.ClassComment.MissingLicenseTag" />
123
+ <exclude name="PEAR.Commenting.ClassComment.MissingVersion" />
124
+ <exclude name="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore" />
125
+ <exclude name="PEAR.Commenting.FileComment.WrongStyle" />
126
+ <exclude name="PEAR.Commenting.FileComment.Missing" />
127
+ <exclude name="PEAR.WhiteSpace.ScopeIndent.IncorrectExact" />
128
+ </rule>
129
+
130
+ <!-- Let's also check that everything is properly documented. -->
131
+ <rule ref="WordPress-Docs"/>
132
+
133
+ <!-- Add in some extra rules from other standards. -->
134
+ <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
135
+ <!-- <rule ref="Generic.Commenting.Todo"/> -->
136
+
137
+ <!-- Check for PHP cross-version compatibility. -->
138
+ <!--
139
+ To enable this, the PHPCompatibilityWP standard needs
140
+ to be installed.
141
+ See the readme for installation instructions:
142
+ https://github.com/PHPCompatibility/PHPCompatibilityWP
143
+ For more information, also see:
144
+ https://github.com/PHPCompatibility/PHPCompatibility
145
+ -->
146
+
147
+ <config name="testVersion" value="5.6-"/>
148
+ <rule ref="PHPCompatibilityWP"/>
149
+
150
+
151
+ <!--
152
+ To get the optimal benefits of using WPCS, we should add a couple of
153
+ custom properties.
154
+ Adjust the values of these properties to fit our needs.
155
+
156
+ For information on additional custom properties available, check out
157
+ the wiki:
158
+ https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
159
+ -->
160
+ <config name="minimum_supported_wp_version" value="5.4"/>
161
+
162
+ <rule ref="WordPress.WP.I18n">
163
+ <properties>
164
+ <property name="text_domain" type="array">
165
+ <element value="extendify-sdk"/>
166
+ </property>
167
+ </properties>
168
+ </rule>
169
+
170
+ <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
171
+ <properties>
172
+ <property name="prefixes" type="array">
173
+ <element value="extendifysdk"/>
174
+ </property>
175
+ </properties>
176
+ </rule>
177
+
178
+
179
+ </ruleset>
extendify-sdk/.svgrrc ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ svgo: true,
3
+ svgoConfig: {
4
+ plugins: [
5
+ {
6
+ removeAttrs: {
7
+ attrs: [
8
+ "height",
9
+ "width",
10
+ "x",
11
+ "y",
12
+ ],
13
+ },
14
+ },
15
+ ],
16
+ },
17
+ svgProps: {
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ },
20
+ }
extendify-sdk/app/Admin.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin.
4
+ */
5
+
6
+ namespace Extendify\ExtendifySdk;
7
+
8
+ use Extendify\ExtendifySdk\App;
9
+
10
+ /**
11
+ * This class handles any file loading for the admin area.
12
+ */
13
+ class Admin
14
+ {
15
+
16
+ /**
17
+ * The instance
18
+ *
19
+ * @var $instance
20
+ */
21
+ public static $instance = null;
22
+
23
+ /**
24
+ * Adds various actions to set up the page
25
+ *
26
+ * @return self|void
27
+ */
28
+ public function __construct()
29
+ {
30
+ if (self::$instance) {
31
+ return self::$instance;
32
+ }
33
+
34
+ self::$instance = $this;
35
+ $this->loadScripts();
36
+ }
37
+
38
+ /**
39
+ * Adds scripts to the admin
40
+ *
41
+ * @return void
42
+ */
43
+ public function loadScripts()
44
+ {
45
+ \add_action(
46
+ 'admin_enqueue_scripts',
47
+ function ($hook) {
48
+ if (!$this->checkItsGutenbergPost($hook)) {
49
+ return;
50
+ }
51
+
52
+ $this->addScopedScriptsAndStyles();
53
+ }
54
+ );
55
+ }
56
+
57
+ /**
58
+ * Makes sure we are on the correct page
59
+ *
60
+ * @param string $hook - An optional hook provided by WP to identify the page.
61
+ * @return boolean
62
+ */
63
+ public function checkItsGutenbergPost($hook = '')
64
+ {
65
+ // TODO: Maybe there's a better check here so we can show on other pages too.
66
+ return $hook && in_array($hook, ['post.php', 'post-new.php'], true);
67
+ }
68
+
69
+ /**
70
+ * Adds various JS scripts
71
+ *
72
+ * @return void
73
+ */
74
+ public function addScopedScriptsAndStyles()
75
+ {
76
+ $version = App::$environment === 'PRODUCTION' ? App::$version : uniqid();
77
+
78
+ \wp_register_script(
79
+ App::$slug . '-scripts',
80
+ EXTENDIFYSDK_BASE_URL . 'public/build/extendify-sdk.js',
81
+ [
82
+ 'wp-api',
83
+ 'wp-i18n',
84
+ 'wp-components',
85
+ 'wp-element',
86
+ 'wp-editor',
87
+ ],
88
+ $version,
89
+ true
90
+ );
91
+ \wp_localize_script(
92
+ App::$slug . '-scripts',
93
+ 'extendifySdkData',
94
+ [
95
+ 'root' => \esc_url_raw(rest_url(APP::$slug . '/' . APP::$apiVersion)),
96
+ 'nonce' => \wp_create_nonce('wp_rest'),
97
+ ]
98
+ );
99
+ \wp_enqueue_script(App::$slug . '-scripts');
100
+
101
+ \wp_set_script_translations(App::$slug . '-scripts', App::$textDomain);
102
+
103
+ \wp_enqueue_style(
104
+ App::$slug . '-theme',
105
+ EXTENDIFYSDK_BASE_URL . 'public/build/extendify-sdk.css',
106
+ [],
107
+ $version,
108
+ 'all'
109
+ );
110
+ }
111
+ }
extendify-sdk/app/ApiRouter.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API router
4
+ */
5
+
6
+ namespace Extendify\ExtendifySdk;
7
+
8
+ use Extendify\ExtendifySdk\App;
9
+ use Extendify\ExtendifySdk\Http;
10
+
11
+ /**
12
+ * Simple router for the REST Endpoints
13
+ */
14
+ class ApiRouter extends \WP_REST_Controller
15
+ {
16
+
17
+ /**
18
+ * The class instance.
19
+ *
20
+ * @var $instance
21
+ */
22
+ protected static $instance = null;
23
+
24
+ /**
25
+ * The capablity required for access.
26
+ *
27
+ * @var $capability
28
+ */
29
+ protected $capability;
30
+
31
+
32
+ /**
33
+ * The constructor
34
+ */
35
+ public function __construct()
36
+ {
37
+ $this->capability = 'install_plugins';
38
+ add_filter(
39
+ 'rest_request_before_callbacks',
40
+ // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
41
+ function ($response, $handler, $request) {
42
+ // Add the request to our helper class.
43
+ if ($request->get_header('x_extendify')) {
44
+ Http::init($request);
45
+ }
46
+
47
+ return $response;
48
+ },
49
+ 10,
50
+ 3
51
+ );
52
+ }
53
+
54
+ /**
55
+ * Check the capability
56
+ *
57
+ * @param string $capability - The capability.
58
+ *
59
+ * @return boolean
60
+ */
61
+ public function permission($capability)
62
+ {
63
+ $this->capability = $capability;
64
+ return $this;
65
+ }
66
+
67
+ /**
68
+ * Check the authorization of the request
69
+ *
70
+ * @return boolean
71
+ */
72
+ public function checkPermission()
73
+ {
74
+ // Check for the nonce on the server (used by WP REST).
75
+ if (isset($_SERVER['HTTP_X_WP_NONCE']) && \wp_verify_nonce(sanitize_text_field(wp_unslash($_SERVER['HTTP_X_WP_NONCE'])), 'wp_rest')) {
76
+ return \current_user_can($this->capability);
77
+ }
78
+
79
+ return false;
80
+ }
81
+
82
+ /**
83
+ * Register dynamic routes
84
+ *
85
+ * @param string $namespace - The api name space.
86
+ * @param string $endpoint - The endpoint.
87
+ * @param function $callback - The callback to run.
88
+ *
89
+ * @return void
90
+ */
91
+ public function getHandler($namespace, $endpoint, $callback)
92
+ {
93
+ \register_rest_route(
94
+ $namespace,
95
+ $endpoint,
96
+ [
97
+ 'methods' => 'GET',
98
+ 'callback' => $callback,
99
+ 'permission_callback' => [
100
+ $this,
101
+ 'checkPermission',
102
+ ],
103
+ ]
104
+ );
105
+ }
106
+
107
+ /**
108
+ * The post handler
109
+ *
110
+ * @param string $namespace - The api name space.
111
+ * @param string $endpoint - The endpoint.
112
+ * @param string $callback - The callback to run.
113
+ *
114
+ * @return void
115
+ */
116
+ public function postHandler($namespace, $endpoint, $callback)
117
+ {
118
+ \register_rest_route(
119
+ $namespace,
120
+ $endpoint,
121
+ [
122
+ 'methods' => 'POST',
123
+ 'callback' => $callback,
124
+ 'permission_callback' => [
125
+ $this,
126
+ 'checkPermission',
127
+ ],
128
+ ]
129
+ );
130
+ }
131
+
132
+ /**
133
+ * The caller
134
+ *
135
+ * @param string $name - The name of the method to call.
136
+ * @param array $arguments - The arguments to pass in.
137
+ *
138
+ * @return mixed
139
+ */
140
+ public static function __callStatic($name, array $arguments)
141
+ {
142
+ $name = "{$name}Handler";
143
+ if (is_null(self::$instance)) {
144
+ self::$instance = new static();
145
+ }
146
+
147
+ $r = self::$instance;
148
+ return $r->$name(APP::$slug . '/' . APP::$apiVersion, ...$arguments);
149
+ }
150
+ }
extendify-sdk/app/App.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The App details file
4
+ */
5
+
6
+ namespace Extendify\ExtendifySdk;
7
+
8
+ use Extendify\ExtendifySdk\Plugin;
9
+
10
+ /**
11
+ * Controller for handling various app data
12
+ */
13
+ class App
14
+ {
15
+
16
+ /**
17
+ * Plugin name
18
+ *
19
+ * @var string
20
+ */
21
+ public static $name = '';
22
+
23
+ /**
24
+ * Plugin slug
25
+ *
26
+ * @var string
27
+ */
28
+ public static $slug = '';
29
+
30
+ /**
31
+ * Plugin version
32
+ *
33
+ * @var string
34
+ */
35
+ public static $version = '';
36
+
37
+ /**
38
+ * Plugin API REST version
39
+ *
40
+ * @var string
41
+ */
42
+ public static $apiVersion = 'v1';
43
+
44
+ /**
45
+ * Plugin text domain
46
+ *
47
+ * @var string
48
+ */
49
+ public static $textDomain = '';
50
+
51
+ /**
52
+ * Plugin environment
53
+ *
54
+ * @var string
55
+ */
56
+ public static $environment = '';
57
+
58
+ /**
59
+ * Plugin config
60
+ *
61
+ * @var array
62
+ */
63
+ public static $config = [];
64
+
65
+ /**
66
+ * Process the readme file to get version and name
67
+ *
68
+ * @return void
69
+ */
70
+ public function __construct()
71
+ {
72
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
73
+ $readme = file_get_contents(dirname(__DIR__) . '/readme.txt');
74
+
75
+ preg_match('/=== (.+) ===/', $readme, $matches);
76
+ self::$name = $matches[1];
77
+ self::$slug = strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', self::$name), '-'));
78
+
79
+ preg_match('/Stable tag: ([0-9.:]+)/', $readme, $matches);
80
+ self::$version = $matches[1];
81
+
82
+ // An easy way to check if we are in dev mode is to look for a dev specific file.
83
+ $isDev = is_readable(EXTENDIFYSDK_PATH . 'node_modules') || is_readable(EXTENDIFYSDK_PATH . '.devbuild');
84
+ self::$environment = $isDev ? 'DEVELOPMENT' : 'PRODUCTION';
85
+
86
+ self::$textDomain = Plugin::getPluginInfo('TextDomain', self::$slug);
87
+
88
+ // Add the config.
89
+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
90
+ $config = file_get_contents(dirname(__DIR__) . '/config.json');
91
+ self::$config = json_decode($config, true);
92
+ }
93
+ }
extendify-sdk/app/Controllers/CategoryController.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controls Categories
4
+ */
5
+
6
+ namespace Extendify\ExtendifySdk\Controllers;
7
+
8
+ use Extendify\ExtendifySdk\Http;
9
+
10
+ if (!defined('ABSPATH')) {
11
+ die('No direct access.');
12
+ }
13
+
14
+ /**
15
+ * The controller for dealing with categories
16
+ */
17
+ class CategoryController
18
+ {
19
+
20
+ /**
21
+ * Return all categories
22
+ *
23
+ * @return WP_REST_Response|WP_Error
24
+ */
25
+ public static function index()
26
+ {
27
+ $response = Http::get('/airtable-categories', []);
28
+
29
+ if (!isset($response['records']) || empty($response['records'])) {
30
+ return new \WP_Error('nothing_found', \__('Categories not found. Please try again later', 'extendify-sdk'), ['status' => 404]);
31
+