get_snippet_id( $attr, WINP_SNIPPET_TYPE_JS ); if ( ! $id && ( current_user_can( 'manage_options' ) || ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) ) { /* translators: %s: Shortcode tag name */ echo '' . sprintf( esc_html__( '[%s]: PHP snippets error (not passed the snippet ID)', 'insert-php' ), esc_html( $tag ) ) . ''; return; } $snippet = get_post( $id ); $snippet_meta = get_post_meta( $id, '' ); if ( ! $snippet || empty( $snippet_meta ) ) { return; } $attrs = $this->filter_attributes( $attr, $id ); // Let users pass arbitrary variables, through shortcode attributes. // @since 2.4.0 $vars = ''; foreach ( $attrs as $var => $value ) { $vars .= PHP_EOL . "var {$var} = \"{$value}\";"; } $is_activate = $this->get_snippet_activate( $snippet_meta ); $snippet_content = $this->get_snippet_content( $snippet, $snippet_meta, $id ); $snippet_scope = $this->get_snippet_scope( $snippet_meta ); $is_condition = WINP_Plugin::app()->get_execute_object()->checkCondition( $id ); if ( ! $is_activate || empty( $snippet_content ) || $snippet_scope != 'shortcode' || ! $is_condition ) { return; } // Track shortcode execution. WINP_Plugin::app()->get_execute_object()->track_shortcode_snippet( $id ); echo ""; // print attributes echo WINP_Execute_Snippet::getJsCssSnippetData( $id ); } }