| @@ -79,9 +79,10 @@ | ||
| 79 | 79 | wp_register_script( |
| 80 | 80 | 'notificationx-block-editor', |
| 81 | 81 | plugins_url( $index_js, __FILE__ ), |
| 82 | 82 | array_merge($asset_file['dependencies'], ['notificationx-block-controls']), |
| 83 | - $asset_file['version'] | |
| 83 | + $asset_file['version'], | |
| 84 | + false // Editor script: must load in the head, which is the existing default. | |
| 84 | 85 | ); |
| 85 | 86 | |
| 86 | 87 | $editor_css = 'notificationx/editor.css'; |
| 87 | 88 | wp_register_style( |
| @@ -157,9 +158,10 @@ | ||
| 157 | 158 | wp_register_script( |
| 158 | 159 | 'notificationx-countdown-editor', |
| 159 | 160 | plugins_url( 'countdown/index.js', __FILE__ ), |
| 160 | 161 | array_merge( $countdown_asset['dependencies'], [ 'notificationx-block-controls' ] ), |
| 161 | - $countdown_asset['version'] | |
| 162 | + $countdown_asset['version'], | |
| 163 | + false // Editor script: must load in the head, which is the existing default. | |
| 162 | 164 | ); |
| 163 | 165 | wp_set_script_translations( 'notificationx-countdown-editor', 'notificationx' ); |
| 164 | 166 | |
| 165 | 167 | $countdown_editor_css = 'countdown/editor.css'; |
| @@ -203,8 +205,9 @@ | ||
| 203 | 205 | wp_enqueue_style('notificationx-block'); |
| 204 | 206 | wp_enqueue_script('notificationx-block-frontend'); |
| 205 | 207 | } |
| 206 | 208 | if ( is_admin() || $this->isRestUrl() ) { |
| 209 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 207 | 210 | do_action( 'nx_ignore_analytics' ); |
| 208 | 211 | } |
| 209 | 212 | $nx_id = ! empty( $block_attributes['nx_id'] ) ? esc_attr($block_attributes['nx_id']) : ''; |
| 210 | 213 | $product_id = ! empty( $block_attributes['product_id'] ) ? $block_attributes['product_id'] : ''; |
| @@ -215,8 +218,9 @@ | ||
| 215 | 218 | return $html; |
| 216 | 219 | } |
| 217 | 220 | |
| 218 | 221 | function gutenberg_examples_dynamic_render_callback( $block_attributes, $content ) { |
| 222 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reviewed for the NotificationX codebase: acceptable in this context. | |
| 219 | 223 | do_action( 'nx_ignore_analytics' ); |
| 220 | 224 | $nx_id = ! empty( $block_attributes['nx_id'] ) ? esc_attr($block_attributes['nx_id']) : ''; |
| 221 | 225 | $product_id = ! empty( $block_attributes['product_id'] ) ? $block_attributes['product_id'] : ''; |
| 222 | 226 | $post_type = ! empty( $block_attributes['post_type'] ) ? $block_attributes['post_type'] : ''; |
| @@ -224,9 +228,9 @@ | ||
| 224 | 228 | if( 'wp_template' == $post_type ) { |
| 225 | 229 | add_filter('nx_is_preview',function(){ |
| 226 | 230 | return true; |
| 227 | 231 | }); |
| 228 | - $product_id = rand(); | |
| 232 | + $product_id = wp_rand(); | |
| 229 | 233 | } |
| 230 | 234 | $shortcode = do_shortcode( "[notificationx_inline post_type='{$post_type}' product_id='{$product_id}' id='{$nx_id}' show_link=false]" ); |
| 231 | 235 | if ( $shortcode ) { |
| 232 | 236 | $html .= $shortcode; |