Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
picocodes committed Jan 23, 2025
1 parent fc73782 commit aa95de6
Show file tree
Hide file tree
Showing 18 changed files with 123 additions and 83 deletions.
2 changes: 1 addition & 1 deletion build/Automation_Rules/Automation_Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ private function prepare_settings( $options, $settings ) {
}

// If there are options, make sure the value is one of them.
if ( ! empty( $args['options'] ) ) {
if ( ! empty( $args['options'] ) && is_array( $args['options'] ) ) {
$choices = array_keys( $args['options'] );

if ( is_array( $value ) ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => 'dcd2ec0f63f32922353c');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => '13dd807554758590a340');
4 changes: 2 additions & 2 deletions build/Automation_Rules/assets/js/automation-rule-editor.js

Large diffs are not rendered by default.

37 changes: 36 additions & 1 deletion build/Emails/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public static function init() {
add_filter( 'noptin_get_last_send_date', array( __CLASS__, 'filter_last_send_date' ) );
add_action( 'wp_after_insert_post', array( __CLASS__, 'on_save_campaign' ), 100, 4 );
add_action( 'before_delete_post', array( __CLASS__, 'on_delete_campaign' ) );
add_filter( 'rest_pre_insert_noptin-campaign', array( __CLASS__, 'filter_campaign_rest_request' ), 10, 2 );

// Add shortcode to display past newsletters.
add_shortcode( 'past_noptin_newsletters', array( __CLASS__, 'past_newsletters' ) );
Expand Down Expand Up @@ -277,7 +278,7 @@ public static function register_post_types() {
'label' => __( 'Email Campaigns', 'newsletter-optin-box' ),
'description' => '',
'public' => false,
'rest_controller_class' => '\Hizzle\Noptin\Emails\REST',
'rest_controller_class' => __NAMESPACE__ . '\REST',
'map_meta_cap' => true,
'capabilities' => array(
'read' => 'edit_posts',
Expand Down Expand Up @@ -847,4 +848,38 @@ public static function past_newsletters( $atts ) {
<?php
return ob_get_clean();
}

/**
* Filters the campaign rest request.
*
* @param object $prepared_post The prepared post object.
* @param \WP_REST_Request $request The request object.
* @return object
*/
public static function filter_campaign_rest_request( $prepared_post, $request ) {
// Only filter Noptin campaign posts.
if ( 'noptin-campaign' !== $prepared_post->post_type ) {
return $prepared_post;
}

// Get the request parameters.
$params = $request->get_params();

// If meta is being updated, filter out Elementor fields
if ( isset( $params['meta'] ) && is_array( $params['meta'] ) ) {
$filtered_meta = array_filter(
$params['meta'],
function( $key ) {
// Filter out protected meta keys.
return strpos( $key, '_' ) !== 0;
},
ARRAY_FILTER_USE_KEY
);

// Update the request with filtered meta.
$request->set_param( 'meta', $filtered_meta );
}

return $prepared_post;
}
}
2 changes: 1 addition & 1 deletion build/Emails/assets/js/blocks.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '3442eed23c5104e4c4ca');
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-autop', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '25ea7ddfb1a6842de3b4');
34 changes: 17 additions & 17 deletions build/Emails/assets/js/blocks.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Emails/assets/js/email-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-editor', 'wp-element', 'wp-format-library', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '02250a4d64ab5e9128b9');
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-editor', 'wp-element', 'wp-format-library', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-rich-text', 'wp-url'), 'version' => '68235b4f6d8f759df176');
20 changes: 10 additions & 10 deletions build/Emails/assets/js/email-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Emails/assets/js/global.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-components', 'wp-compose', 'wp-date', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives'), 'version' => 'b43add55fbc9875245d5');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-date', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-url'), 'version' => '51810b4c42840402968d');
14 changes: 7 additions & 7 deletions build/Emails/assets/js/global.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Forms/assets/js/form-editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '36101020dd74448547f5');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '60b6973757a1868621c9');
16 changes: 8 additions & 8 deletions build/Forms/assets/js/form-editor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Misc/assets/js/collection.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '2cba5f7fe801052f61d7');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '922a68d424c73b60a387');
42 changes: 21 additions & 21 deletions build/Misc/assets/js/collection.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/Settings/assets/js/settings.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-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '0888bf14250ab062cdb7');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => 'c421860a31555bb227d1');
16 changes: 8 additions & 8 deletions build/Settings/assets/js/settings.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions build/Tasks/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ protected function run() {
throw new \Exception( 'Invalid task: no hook' );
}

// Ensure there are callbacks attached to the hook.
if ( ! has_action( $hook ) ) {
throw new \Exception( sprintf( 'Invalid task: no callbacks attached to hook "%s"', $hook ) );
}

$args = json_decode( $this->get_args(), true );

if ( ! is_array( $args ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/Integrations/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public static function get_integration_info( $slug ) {
}

foreach ( $all as $integration ) {
if ( $slug === $integration['slug'] ) {
if ( $slug === $integration['slug'] || str_replace( '-', '_', $slug ) === $integration['slug'] ) {
return $integration;
}
}
Expand Down

0 comments on commit aa95de6

Please sign in to comment.