Skip to content

Commit

Permalink
cache custom fields
Browse files Browse the repository at this point in the history
  • Loading branch information
picocodes committed Apr 22, 2024
1 parent 6135e60 commit d5e47e4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'c057b652847479aa5766');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'cde8f424b90c1f8038c9');
2 changes: 1 addition & 1 deletion build/Automation_Rules/assets/js/automation-rule-editor.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '8d13395561560cc88384');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '5e05b3b84a26327ed13f');
2 changes: 1 addition & 1 deletion build/Automation_Rules/assets/js/automation-rules.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Emails/assets/js/view-campaigns.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '7e85bb9ad39eba4fdd7a');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'a2be524059246c68366e');
4 changes: 2 additions & 2 deletions build/Emails/assets/js/view-campaigns.js

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions src/Integrations/Custom_Fields_Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ public function __construct() {
* @param array $custom_fields The known user custom fields.
*/
public function filter_user_fields( $custom_fields ) {
static $fields = null;

if ( is_null( $fields ) ) {
$fields = $this->get_user_fields();
}

return array_merge(
$custom_fields,
$this->get_user_fields()
$fields
);
}

Expand All @@ -58,9 +64,15 @@ protected function get_user_fields() {
* @param string $post_type The post type.
*/
public function filter_post_type_fields( $custom_fields, $post_type ) {
static $fields = array();

if ( ! isset( $fields[ $post_type ] ) ) {
$fields[ $post_type ] = $this->get_post_type_fields( $post_type );
}

return array_merge(
$custom_fields,
$this->get_post_type_fields( $post_type )
$fields[ $post_type ]
);
}

Expand Down
1 change: 0 additions & 1 deletion src/Objects/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ public function register_temporary_merge_tags() {
$recipient = \Hizzle\Noptin\Emails\Main::$current_email_recipient;

if ( isset( $recipient[ $this->type ] ) ) {

if ( ! is_array( $noptin_current_objects ) ) {
$noptin_current_objects = array();
}
Expand Down

0 comments on commit d5e47e4

Please sign in to comment.