Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder
File: functions.php
'description' => sprintf(
[10500] Fix | Delete
// translators: %1$s: "Rows" - label.
[10501] Fix | Delete
__( 'Every section contains one or more %1$s of columns. You can choose between various column layouts for each row you add to your page. Click the highlighted three-column layout to add a new row to your section.', 'et_builder' ),
[10502] Fix | Delete
sprintf( '<span class="et_fb_tour_text_green">%1$s</span>', esc_html__( 'Rows' ) )
[10503] Fix | Delete
),
[10504] Fix | Delete
),
[10505] Fix | Delete
'selectModule' => array(
[10506] Fix | Delete
'title' => esc_html__( 'Add A Module To The Column', 'et_builder' ),
[10507] Fix | Delete
'description' => esc_html__( 'Within each column you can add one or more Modules. A module is basic content element. The Divi Builder comes with over 40 different content elements to choose from, such as Images, Videos, Text, and Buttons. Click the highlighted Blurb button to add a new Blurb module to the first column in your row.', 'et_builder' ),
[10508] Fix | Delete
),
[10509] Fix | Delete
'configureModule' => array(
[10510] Fix | Delete
'title' => esc_html__( 'Adjust Your Module Settings', 'et_builder' ),
[10511] Fix | Delete
'description' => esc_html__( 'Each Module comes with various settings. These settings are separated into three tabs: Content, Design and Advanced. Inside the content tab you can modify the module content elements, such as text and images. If you need more control over the appearance of your module, head over to the Design tab. For more advanced modifications, such as custom CSS and HTML attributes, explore the Advanced tab. Try adjusting the Title of your blurb by clicking into the highlighted field.', 'et_builder' ),
[10512] Fix | Delete
),
[10513] Fix | Delete
'saveModule' => array(
[10514] Fix | Delete
'title' => esc_html__( 'Accept Or Discard Your Changes', 'et_builder' ),
[10515] Fix | Delete
'description' => esc_html__( 'Whenever you make changes in the Divi Builder, these changes can be Undone, Redone, Discarded or Accepted. Now that you have adjusted your module’s title, you can click the red discard button to cancel these changes, or your can click the green button to accept them.', 'et_builder' ),
[10516] Fix | Delete
),
[10517] Fix | Delete
'duplicateModule' => array(
[10518] Fix | Delete
'title' => esc_html__( 'Hover To Access Action Buttons', 'et_builder' ),
[10519] Fix | Delete
'description' => esc_html__( 'Whenever you hover over a Section, Row or Module in the Divi Builder, action buttons will appear. These buttons can be used to move, modify, duplicate or delete your content. Click the highlighted “duplicate” icon to duplicate the blurb module that you just added to the page.', 'et_builder' ),
[10520] Fix | Delete
),
[10521] Fix | Delete
'moveModule' => array(
[10522] Fix | Delete
'title' => __( 'Drag & Drop Content', 'et_builder' ),
[10523] Fix | Delete
'description' => esc_html__( 'Every item on the page can be dragged and dropped to new locations. Using your mouse, click the highlighted move icon and hold down the mouse button. While holding down the mouse button, move your cursor over to the empty column and then release your mouse button to drop the module into the new column.', 'et_builder' ),
[10524] Fix | Delete
),
[10525] Fix | Delete
'rightClickCopy' => array(
[10526] Fix | Delete
'title' => esc_html__( 'Access Right Click Options', 'et_builder' ),
[10527] Fix | Delete
'description' => esc_html__( 'In addition to hover actions, additional options can be accessed by Right Clicking or Cmd + Clicking on any module, row or section. Using the right click menu shown, click the highlighted “Copy Module” button to copy the blurb module that you just moved.', 'et_builder' ),
[10528] Fix | Delete
),
[10529] Fix | Delete
'rightClickPaste' => array(
[10530] Fix | Delete
'title' => esc_html__( 'Paste Your Copied Module', 'et_builder' ),
[10531] Fix | Delete
'description' => esc_html__( 'Now that you have copied a module using the Right Click menu, you can Right Click in a new location to paste that module. Using the right click options shown, click the “Paste Module” button to paste the module you just copied into the empty column.', 'et_builder' ),
[10532] Fix | Delete
),
[10533] Fix | Delete
'rowOptions' => array(
[10534] Fix | Delete
'title' => esc_html__( 'Access Your Row Options', 'et_builder' ),
[10535] Fix | Delete
'description' => esc_html__( 'Every Row and Section has its own set of options that can be used to adjust the item’s appearance. You can adjust its width, padding, background and more. To access a row’s settings, hover over the row and click the highlighted options button.', 'et_builder' ),
[10536] Fix | Delete
),
[10537] Fix | Delete
'editRow' => array(
[10538] Fix | Delete
'title' => esc_html__( 'Adjust Your Row Setting', 'et_builder' ),
[10539] Fix | Delete
'description' => esc_html__( 'Just like Modules, Rows come with a lot of settings that are separated into the Content, Design and Advanced tabs. Click the highlighted button to add a new background color to your row.', 'et_builder' ),
[10540] Fix | Delete
),
[10541] Fix | Delete
'saveRow' => array(
[10542] Fix | Delete
'title' => esc_html__( 'Accept Your Changes', 'et_builder' ),
[10543] Fix | Delete
'description' => esc_html__( 'Click the highlighted green check mark button to accept your changes. ', 'et_builder' ),
[10544] Fix | Delete
),
[10545] Fix | Delete
'pageSettings' => array(
[10546] Fix | Delete
'title' => esc_html__( 'Open Your Page Settings', 'et_builder' ),
[10547] Fix | Delete
'description' => esc_html__( 'While using the Divi Builder, you can access your page settings by toggling the page settings bar at the bottom of your screen. Click the highlighted button to reveal your page settings.', 'et_builder' ),
[10548] Fix | Delete
),
[10549] Fix | Delete
'tabletPreview' => array(
[10550] Fix | Delete
'title' => esc_html__( 'Preview Your Page On Mobile', 'et_builder' ),
[10551] Fix | Delete
'description' => esc_html__( 'While editing your page, it’s easy to see what your design will look like on mobile devices. You can also make adjustments to your module, row and section settings for each mobile breakpoint. Click the highlighted “Tablet” icon to enter Tablet preview mode. ', 'et_builder' ),
[10552] Fix | Delete
),
[10553] Fix | Delete
'desktopPreview' => array(
[10554] Fix | Delete
'title' => esc_html__( 'Switch Back To Desktop Mode', 'et_builder' ),
[10555] Fix | Delete
'description' => esc_html__( 'You can switch back and forth between each preview mode freely while editing your page. Now that we have previewed our page on Tablet, let’s switch back to Desktop preview mode by clicking the highlighted button.', 'et_builder' ),
[10556] Fix | Delete
),
[10557] Fix | Delete
'openHistory' => array(
[10558] Fix | Delete
'title' => esc_html__( 'Access Your Editing History', 'et_builder' ),
[10559] Fix | Delete
'description' => esc_html__( 'Every change you make while editing your page is saved in your editing history. You can navigate backwards and forwards through time to any point during your current editing session, as well as undo and redo recent changes. Click the highlighted History button to access your editing history. ', 'et_builder' ),
[10560] Fix | Delete
),
[10561] Fix | Delete
'editHistory' => array(
[10562] Fix | Delete
'title' => esc_html__( 'Undo, Redo And Restore', 'et_builder' ),
[10563] Fix | Delete
'description' => esc_html__( 'Here you can undo, redo or restore a saved history state. If you change your mind about recent changes, simply click back in time and start building again. You can also undo and redo recent changes. Click the undo and redo buttons and then accept your changes by clicking the green check mark.', 'et_builder' ),
[10564] Fix | Delete
),
[10565] Fix | Delete
'savePage' => array(
[10566] Fix | Delete
'title' => esc_html__( 'Save Your Page', 'et_builder' ),
[10567] Fix | Delete
'description' => sprintf(
[10568] Fix | Delete
// translators: %1$s: "Save" or "Publish" - label.
[10569] Fix | Delete
esc_html__( 'When you are all done, you can save your changes by clicking the %1$s button inside of your page settings bar. You can also press Ctrl + S at any time to save your changes. Click the highlighted Save button to save your changes. Don’t worry, the page you were working on before starting this tour will not be lost!', 'et_builder' ),
[10570] Fix | Delete
in_array( $post_status, array( 'private', 'publish' ), true ) ? esc_html__( 'Save', 'et_builder' ) : esc_html__( 'Publish', 'et_builder' )
[10571] Fix | Delete
),
[10572] Fix | Delete
),
[10573] Fix | Delete
'finish' => array(
[10574] Fix | Delete
'title' => esc_html__( 'You’re Ready To Go!', 'et_builder' ),
[10575] Fix | Delete
'description' => sprintf(
[10576] Fix | Delete
// translators: %10$s: Tour video overlay, %1$s: "Section" - label, %2$s: Add icon markup, %3$s: "Row" - label, %4$s: Add icon markup, %5$s: "Modules" - label, %6$s: Add icon markup, %7$s: Settings gear icon markup, %9$s: Documentation link markup.
[10577] Fix | Delete
__( '%10$sBuilding beautiful pages is a breeze using the Visual Builder. To get started, add a new %1$s to your page by pressing the %2$s button. Next, add a %3$s of columns inside your section by pressing the %4$s button. Finally, start adding some content %5$s inside your columns by pressing the %6$s button. You can customize the design and content of any element on the page by pressing the %7$s button. If you ever need help, visit our %9$s page for a full list of tutorials.', 'et_builder' ),
[10578] Fix | Delete
sprintf( '<span class="et_fb_tour_text et_fb_tour_text_blue">%1$s</span>', esc_html__( 'Section' ) ),
[10579] Fix | Delete
'<span class="et_fb_tour_icon et_fb_tour_icon_blue"><svg viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" shapeRendering="geometricPrecision"><g><path d="M18 13h-3v-3a1 1 0 0 0-2 0v3h-3a1 1 0 0 0 0 2h3v3a1 1 0 0 0 2 0v-3h3a1 1 0 0 0 0-2z" fillRule="evenodd" /></g></svg></span>',
[10580] Fix | Delete
sprintf( '<span class="et_fb_tour_text et_fb_tour_text_green">%1$s</span>', esc_html__( 'Row' ) ),
[10581] Fix | Delete
'<span class="et_fb_tour_icon et_fb_tour_icon_green"><svg viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" shapeRendering="geometricPrecision"><g><path d="M18 13h-3v-3a1 1 0 0 0-2 0v3h-3a1 1 0 0 0 0 2h3v3a1 1 0 0 0 2 0v-3h3a1 1 0 0 0 0-2z" fillRule="evenodd" /></g></svg></span>',
[10582] Fix | Delete
sprintf( '<span class="et_fb_tour_text et_fb_tour_text_black">%1$s</span>', esc_html__( 'Modules' ) ),
[10583] Fix | Delete
'<span class="et_fb_tour_icon"><svg viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" shapeRendering="geometricPrecision"><g><path d="M18 13h-3v-3a1 1 0 0 0-2 0v3h-3a1 1 0 0 0 0 2h3v3a1 1 0 0 0 2 0v-3h3a1 1 0 0 0 0-2z" fillRule="evenodd" /></g></svg></span>',
[10584] Fix | Delete
'<span class="et_fb_tour_icon"><svg viewBox="0 0 28 28" preserveAspectRatio="xMidYMid meet" shapeRendering="geometricPrecision"><g><path d="M20.426 13.088l-1.383-.362a.874.874 0 0 1-.589-.514l-.043-.107a.871.871 0 0 1 .053-.779l.721-1.234a.766.766 0 0 0-.116-.917 6.682 6.682 0 0 0-.252-.253.768.768 0 0 0-.917-.116l-1.234.722a.877.877 0 0 1-.779.053l-.107-.044a.87.87 0 0 1-.513-.587l-.362-1.383a.767.767 0 0 0-.73-.567h-.358a.768.768 0 0 0-.73.567l-.362 1.383a.878.878 0 0 1-.513.589l-.107.044a.875.875 0 0 1-.778-.054l-1.234-.722a.769.769 0 0 0-.918.117c-.086.082-.17.166-.253.253a.766.766 0 0 0-.115.916l.721 1.234a.87.87 0 0 1 .053.779l-.043.106a.874.874 0 0 1-.589.514l-1.382.362a.766.766 0 0 0-.567.731v.357a.766.766 0 0 0 .567.731l1.383.362c.266.07.483.26.588.513l.043.107a.87.87 0 0 1-.053.779l-.721 1.233a.767.767 0 0 0 .115.917c.083.087.167.171.253.253a.77.77 0 0 0 .918.116l1.234-.721a.87.87 0 0 1 .779-.054l.107.044a.878.878 0 0 1 .513.589l.362 1.383a.77.77 0 0 0 .731.567h.356a.766.766 0 0 0 .73-.567l.362-1.383a.878.878 0 0 1 .515-.589l.107-.044a.875.875 0 0 1 .778.054l1.234.721c.297.17.672.123.917-.117.087-.082.171-.166.253-.253a.766.766 0 0 0 .116-.917l-.721-1.234a.874.874 0 0 1-.054-.779l.044-.107a.88.88 0 0 1 .589-.513l1.383-.362a.77.77 0 0 0 .567-.731v-.357a.772.772 0 0 0-.569-.724v-.005zm-6.43 3.9a2.986 2.986 0 1 1 2.985-2.986 3 3 0 0 1-2.985 2.987v-.001z" fillRule="evenodd" /></g></svg></span>',
[10585] Fix | Delete
'<span class="et_fb_tour_text et_fb_tour_text_black">?</span>',
[10586] Fix | Delete
sprintf( '<a target="_blank" href="https://www.elegantthemes.com/documentation/divi/" class="et_fb_tour_text et_fb_tour_text_black">%1$s</a>', esc_html__( 'Documentation' ) ),
[10587] Fix | Delete
sprintf(
[10588] Fix | Delete
'<div class="et-fb-tour-video-overlay" data-video="https://www.youtube.com/embed/JXZIGZqr9OE?rel=0&autoplay=1">
[10589] Fix | Delete
<img src="%1$s"/>
[10590] Fix | Delete
<div class="et-fb-play-overlay"></div>
[10591] Fix | Delete
</div>',
[10592] Fix | Delete
esc_url( ET_BUILDER_URI . '/frontend-builder/assets/img/product-tour-intro.jpg' )
[10593] Fix | Delete
)
[10594] Fix | Delete
),
[10595] Fix | Delete
'endButtonText' => esc_html__( 'Start Building', 'et_builder' ),
[10596] Fix | Delete
),
[10597] Fix | Delete
'endButtonTextDefault' => esc_html__( 'End the Tour', 'et_builder' ),
[10598] Fix | Delete
'skipButtonTextDefault' => esc_html__( 'Skip This Step', 'et_builder' ),
[10599] Fix | Delete
);
[10600] Fix | Delete
[10601] Fix | Delete
return $product_tour_text;
[10602] Fix | Delete
}
[10603] Fix | Delete
[10604] Fix | Delete
/**
[10605] Fix | Delete
* Process builder shortcode into object.
[10606] Fix | Delete
*
[10607] Fix | Delete
* The standard do_shortcode filter should be removed, and
[10608] Fix | Delete
* this function hooked instead.
[10609] Fix | Delete
*
[10610] Fix | Delete
* This function is very similar to `do_shortcode`,
[10611] Fix | Delete
* with the main differences being:
[10612] Fix | Delete
* - Its main design is to allow recursive array to be built out of wp shortcode
[10613] Fix | Delete
* - Allows shortcode callback to return an array rather than a string
[10614] Fix | Delete
* - It tracks the inner `index` / `_i` of each child shortcode to the passed content, which is used in the address creation as well
[10615] Fix | Delete
* - It uses and passes `$address` & `$parent_address`, which are used by FB app.
[10616] Fix | Delete
*
[10617] Fix | Delete
* @param string $content post content.
[10618] Fix | Delete
* @param string $parent_address parent shortcode address.
[10619] Fix | Delete
* @param string $global_parent ?? @todo Add param doc.
[10620] Fix | Delete
* @param string $global_parent_type ?? @todo Add param doc.
[10621] Fix | Delete
* @param string $parent_type ?? @todo Add param doc.
[10622] Fix | Delete
*
[10623] Fix | Delete
* @return mixed
[10624] Fix | Delete
*/
[10625] Fix | Delete
function et_fb_process_shortcode( $content, $parent_address = '', $global_parent = '', $global_parent_type = '', $parent_type = '' ) {
[10626] Fix | Delete
global $shortcode_tags, $fb_processing_counter;
[10627] Fix | Delete
[10628] Fix | Delete
if ( false === strpos( $content, '[' ) ) {
[10629] Fix | Delete
return $content;
[10630] Fix | Delete
}
[10631] Fix | Delete
[10632] Fix | Delete
// Count started processes.
[10633] Fix | Delete
$fb_processing_counter = isset( $fb_processing_counter ) ? $fb_processing_counter + 1 : 1;
[10634] Fix | Delete
[10635] Fix | Delete
// Find all registered tag names in $content.
[10636] Fix | Delete
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
[10637] Fix | Delete
// Only need unique tag names.
[10638] Fix | Delete
$unique_matches = array_unique( $matches[1] );
[10639] Fix | Delete
[10640] Fix | Delete
$tagnames = array_intersect( array_keys( $shortcode_tags ), $unique_matches );
[10641] Fix | Delete
$pattern = get_shortcode_regex( $unique_matches );
[10642] Fix | Delete
$content = preg_match_all( "/$pattern/", $content, $matches, PREG_SET_ORDER );
[10643] Fix | Delete
[10644] Fix | Delete
$_matches = array();
[10645] Fix | Delete
$_index = 0;
[10646] Fix | Delete
foreach ( $matches as $match ) {
[10647] Fix | Delete
$tag = $match[2];
[10648] Fix | Delete
[10649] Fix | Delete
// reset global parent data to calculate it correctly for next modules.
[10650] Fix | Delete
if ( $global_parent_type === $tag && '' !== $global_parent ) {
[10651] Fix | Delete
$global_parent = '';
[10652] Fix | Delete
$global_parent_type = '';
[10653] Fix | Delete
}
[10654] Fix | Delete
[10655] Fix | Delete
$attr = shortcode_parse_atts( $match[3] );
[10656] Fix | Delete
[10657] Fix | Delete
if ( ! is_array( $attr ) ) {
[10658] Fix | Delete
$attr = array();
[10659] Fix | Delete
}
[10660] Fix | Delete
[10661] Fix | Delete
$index = $_index++;
[10662] Fix | Delete
$address = isset( $parent_address ) && '' !== $parent_address ? (string) $parent_address . '.' . (string) $index : (string) $index;
[10663] Fix | Delete
[10664] Fix | Delete
// set global parent and global parent tag if current module is global and can be a parent.
[10665] Fix | Delete
$possible_global_parents = array( 'et_pb_section', 'et_pb_row', 'et_pb_row_inner' );
[10666] Fix | Delete
if ( '' === $global_parent && in_array( $tag, $possible_global_parents, true ) ) {
[10667] Fix | Delete
$global_parent = isset( $attr['global_module'] ) ? $attr['global_module'] : '';
[10668] Fix | Delete
$global_parent_type = $tag;
[10669] Fix | Delete
}
[10670] Fix | Delete
[10671] Fix | Delete
// As responsive content attributes value might be has been encoded before saving to database,
[10672] Fix | Delete
// so we need to decode it before passing back to builder.
[10673] Fix | Delete
if ( $attr ) {
[10674] Fix | Delete
$decoded_content_fields = array(
[10675] Fix | Delete
'content__hover',
[10676] Fix | Delete
'content_tablet',
[10677] Fix | Delete
'content_phone',
[10678] Fix | Delete
'raw_content__hover',
[10679] Fix | Delete
'raw_content_tablet',
[10680] Fix | Delete
'raw_content_phone',
[10681] Fix | Delete
);
[10682] Fix | Delete
[10683] Fix | Delete
foreach ( $decoded_content_fields as $decoded_content_field ) {
[10684] Fix | Delete
if ( array_key_exists( $decoded_content_field, $attr ) ) {
[10685] Fix | Delete
$attr[ $decoded_content_field ] = str_replace( array( '%22', '%92', '%91', '%93' ), array( '"', '\\', '&#91;', '&#93;' ), $attr[ $decoded_content_field ] );
[10686] Fix | Delete
}
[10687] Fix | Delete
}
[10688] Fix | Delete
}
[10689] Fix | Delete
[10690] Fix | Delete
$attr['_i'] = $index;
[10691] Fix | Delete
$attr['_address'] = $address;
[10692] Fix | Delete
[10693] Fix | Delete
// Builder shortcode which exist on page but not registered in WP i.e. 3rd party shortcode when 3rd party module disabled
[10694] Fix | Delete
// Add dummy object to render it in Divi Builder.
[10695] Fix | Delete
if ( ! in_array( $tag, $tagnames, true ) ) {
[10696] Fix | Delete
$_matches[] = array(
[10697] Fix | Delete
'_i' => $index,
[10698] Fix | Delete
'_order' => $index,
[10699] Fix | Delete
'address' => $address,
[10700] Fix | Delete
'vb_support' => 'off',
[10701] Fix | Delete
'component_path' => 'et-fb-removed-component',
[10702] Fix | Delete
'type' => $tag,
[10703] Fix | Delete
'attrs' => $attr,
[10704] Fix | Delete
);
[10705] Fix | Delete
[10706] Fix | Delete
continue;
[10707] Fix | Delete
}
[10708] Fix | Delete
[10709] Fix | Delete
// Flag that the shortcode object is being built.
[10710] Fix | Delete
$GLOBALS['et_fb_processing_shortcode_object'] = true;
[10711] Fix | Delete
[10712] Fix | Delete
if ( isset( $match[5] ) ) {
[10713] Fix | Delete
// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found -- `call_user_func` calls the registered shortcode callback.
[10714] Fix | Delete
$output = call_user_func( $shortcode_tags[ $tag ], $attr, $match[5], $tag, $parent_address, $global_parent, $global_parent_type, $parent_type );
[10715] Fix | Delete
} else {
[10716] Fix | Delete
// self-closing tag.
[10717] Fix | Delete
// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found -- `call_user_func` calls the registered shortcode callback.
[10718] Fix | Delete
$output = call_user_func( $shortcode_tags[ $tag ], $attr, null, $tag );
[10719] Fix | Delete
}
[10720] Fix | Delete
[10721] Fix | Delete
$_matches[] = et_fb_add_additional_attrs( $attr, $output );
[10722] Fix | Delete
}
[10723] Fix | Delete
[10724] Fix | Delete
// Count finished processes.
[10725] Fix | Delete
$fb_processing_counter = $fb_processing_counter - 1; // phpcs:ignore Squiz.Operators.IncrementDecrementUsage -- This is more readable.
[10726] Fix | Delete
[10727] Fix | Delete
// Make sure ALL the processes finished to avoid wrong disabling of `et_fb_processing_shortcode_object` when several concurrent instances of `et_fb_process_shortcode` running.
[10728] Fix | Delete
if ( 0 === $fb_processing_counter ) {
[10729] Fix | Delete
// Turn off the flag since the shortcode object is done being built.
[10730] Fix | Delete
et_fb_reset_shortcode_object_processing();
[10731] Fix | Delete
}
[10732] Fix | Delete
[10733] Fix | Delete
return $_matches;
[10734] Fix | Delete
}
[10735] Fix | Delete
[10736] Fix | Delete
/**
[10737] Fix | Delete
* Allowlist any additional attributes.
[10738] Fix | Delete
*
[10739] Fix | Delete
* @param array $processed_attrs Shortcode's processed attributes.
[10740] Fix | Delete
* @param array $output Shortcode output.
[10741] Fix | Delete
*
[10742] Fix | Delete
* @return mixed
[10743] Fix | Delete
*/
[10744] Fix | Delete
function et_fb_add_additional_attrs( $processed_attrs, $output ) {
[10745] Fix | Delete
if ( empty( $output['attrs'] ) ) {
[10746] Fix | Delete
return $output;
[10747] Fix | Delete
}
[10748] Fix | Delete
[10749] Fix | Delete
// A list of all the attributes that are already returned after the shortcode is processed.
[10750] Fix | Delete
$safe_attrs = array_keys( $output['attrs'] );
[10751] Fix | Delete
$allowlisted_attrs = array();
[10752] Fix | Delete
[10753] Fix | Delete
foreach ( $processed_attrs as $attr => $value ) {
[10754] Fix | Delete
if ( ! preg_match( '~_hover(_enabled)?$~', $attr ) ) {
[10755] Fix | Delete
continue;
[10756] Fix | Delete
}
[10757] Fix | Delete
[10758] Fix | Delete
$allowlisted_attrs[ $attr ] = $value;
[10759] Fix | Delete
}
[10760] Fix | Delete
[10761] Fix | Delete
if ( $allowlisted_attrs ) {
[10762] Fix | Delete
$output['attrs'] = array_merge( $output['attrs'], $allowlisted_attrs );
[10763] Fix | Delete
}
[10764] Fix | Delete
[10765] Fix | Delete
return $output;
[10766] Fix | Delete
}
[10767] Fix | Delete
[10768] Fix | Delete
/**
[10769] Fix | Delete
* Parse builder shortcode into an array.
[10770] Fix | Delete
*
[10771] Fix | Delete
* @param string $content Builder built post content.
[10772] Fix | Delete
*
[10773] Fix | Delete
* @return array Array representation of the builder shortcode.
[10774] Fix | Delete
*/
[10775] Fix | Delete
function et_pb_parse_shortcode_to_array( $content ) {
[10776] Fix | Delete
global $shortcode_tags;
[10777] Fix | Delete
[10778] Fix | Delete
if ( false === strpos( $content, '[' ) ) {
[10779] Fix | Delete
return $content;
[10780] Fix | Delete
}
[10781] Fix | Delete
[10782] Fix | Delete
// Find all registered tag names in $content.
[10783] Fix | Delete
preg_match_all( '@\[([^<>&/\[\]\x00-\x20=]++)@', $content, $matches );
[10784] Fix | Delete
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
[10785] Fix | Delete
[10786] Fix | Delete
$pattern = get_shortcode_regex( $matches[1] );
[10787] Fix | Delete
[10788] Fix | Delete
$content = preg_match_all( "/$pattern/", $content, $matches, PREG_SET_ORDER );
[10789] Fix | Delete
[10790] Fix | Delete
$shortcode_data = array();
[10791] Fix | Delete
foreach ( $matches as $match ) {
[10792] Fix | Delete
$tag = $match[2];
[10793] Fix | Delete
$attr = shortcode_parse_atts( $match[3] );
[10794] Fix | Delete
[10795] Fix | Delete
if ( ! is_array( $attr ) ) {
[10796] Fix | Delete
$attr = array();
[10797] Fix | Delete
}
[10798] Fix | Delete
[10799] Fix | Delete
$_shortcode_data = array(
[10800] Fix | Delete
'type' => $tag,
[10801] Fix | Delete
'attrs' => $attr,
[10802] Fix | Delete
);
[10803] Fix | Delete
[10804] Fix | Delete
if ( ! empty( $match[5] ) ) {
[10805] Fix | Delete
$_shortcode_data['content'] = et_pb_parse_shortcode_to_array( $match[5] );
[10806] Fix | Delete
}
[10807] Fix | Delete
[10808] Fix | Delete
$shortcode_data[] = $_shortcode_data;
[10809] Fix | Delete
}
[10810] Fix | Delete
[10811] Fix | Delete
return $shortcode_data;
[10812] Fix | Delete
}
[10813] Fix | Delete
[10814] Fix | Delete
/**
[10815] Fix | Delete
* Parse post content that includes builder shortcode to an array,
[10816] Fix | Delete
* then run it back through "some sanity check" and "some sanitization"
[10817] Fix | Delete
* and then form into a shortcode again.
[10818] Fix | Delete
*
[10819] Fix | Delete
* @see et_fb_process_to_shortcode() for exact sanitizations performed.
[10820] Fix | Delete
*
[10821] Fix | Delete
* @param string $content Builder built post content.
[10822] Fix | Delete
* @param bool $force_valid_builder_slugs Whether to force the shortcode to allow valid builder shortcode slugs only.
[10823] Fix | Delete
*
[10824] Fix | Delete
* @return string Sanitized builder built post content.
[10825] Fix | Delete
*/
[10826] Fix | Delete
function et_pb_sanitize_shortcode( $content, $force_valid_builder_slugs = false ) {
[10827] Fix | Delete
global $shortcode_tags;
[10828] Fix | Delete
[10829] Fix | Delete
if ( false === strpos( $content, '[' ) ) {
[10830] Fix | Delete
return $content;
[10831] Fix | Delete
}
[10832] Fix | Delete
[10833] Fix | Delete
$content_array = et_pb_parse_shortcode_to_array( $content );
[10834] Fix | Delete
[10835] Fix | Delete
$options = array(
[10836] Fix | Delete
'force_valid_slugs' => $force_valid_builder_slugs,
[10837] Fix | Delete
);
[10838] Fix | Delete
$new_content = et_fb_process_to_shortcode( $content_array, $options );
[10839] Fix | Delete
[10840] Fix | Delete
return $new_content;
[10841] Fix | Delete
}
[10842] Fix | Delete
[10843] Fix | Delete
/**
[10844] Fix | Delete
* Use shortcode tag which renders the content to correctly display its properties.
[10845] Fix | Delete
*
[10846] Fix | Delete
* @param string $tag shortcode tag.
[10847] Fix | Delete
*
[10848] Fix | Delete
* @return string
[10849] Fix | Delete
*/
[10850] Fix | Delete
function et_fb_prepare_tag( $tag ) {
[10851] Fix | Delete
// List of aliases.
[10852] Fix | Delete
$aliases = apply_filters(
[10853] Fix | Delete
'et_fb_prepare_tag_aliases',
[10854] Fix | Delete
array(
[10855] Fix | Delete
'et_pb_accordion_item' => 'et_pb_toggle',
[10856] Fix | Delete
)
[10857] Fix | Delete
);
[10858] Fix | Delete
[10859] Fix | Delete
return isset( $aliases[ $tag ] ) ? $aliases[ $tag ] : $tag;
[10860] Fix | Delete
}
[10861] Fix | Delete
[10862] Fix | Delete
if ( ! function_exists( 'et_strip_shortcodes' ) ) :
[10863] Fix | Delete
/**
[10864] Fix | Delete
* Strip builder shortcodes only, leaving default WordPress shortcodes intact.
[10865] Fix | Delete
*
[10866] Fix | Delete
* @param string $content the content.
[10867] Fix | Delete
* @param string $truncate_post_based_shortcodes_only Optional. Whether trunct only post based shortcodes.
[10868] Fix | Delete
*/
[10869] Fix | Delete
function et_strip_shortcodes( $content, $truncate_post_based_shortcodes_only = false ) {
[10870] Fix | Delete
global $shortcode_tags;
[10871] Fix | Delete
[10872] Fix | Delete
$content = trim( $content );
[10873] Fix | Delete
[10874] Fix | Delete
$strip_content_shortcodes = array(
[10875] Fix | Delete
'et_pb_code',
[10876] Fix | Delete
'et_pb_fullwidth_code',
[10877] Fix | Delete
);
[10878] Fix | Delete
[10879] Fix | Delete
// list of post-based shortcodes.
[10880] Fix | Delete
if ( $truncate_post_based_shortcodes_only ) {
[10881] Fix | Delete
$strip_content_shortcodes = array(
[10882] Fix | Delete
'et_pb_post_slider',
[10883] Fix | Delete
'et_pb_fullwidth_post_slider',
[10884] Fix | Delete
'et_pb_blog',
[10885] Fix | Delete
'et_pb_comments',
[10886] Fix | Delete
);
[10887] Fix | Delete
}
[10888] Fix | Delete
[10889] Fix | Delete
foreach ( $strip_content_shortcodes as $shortcode_name ) {
[10890] Fix | Delete
$regex = sprintf(
[10891] Fix | Delete
'(\[%1$s[^\]]*\][^\[]*\[\/%1$s\]|\[%1$s[^\]]*\])',
[10892] Fix | Delete
esc_html( $shortcode_name )
[10893] Fix | Delete
);
[10894] Fix | Delete
[10895] Fix | Delete
$content = preg_replace( $regex, '', $content );
[10896] Fix | Delete
}
[10897] Fix | Delete
[10898] Fix | Delete
// do not proceed if we need to truncate post-based shortcodes only.
[10899] Fix | Delete
if ( $truncate_post_based_shortcodes_only ) {
[10900] Fix | Delete
return $content;
[10901] Fix | Delete
}
[10902] Fix | Delete
[10903] Fix | Delete
$shortcode_tag_names = array();
[10904] Fix | Delete
foreach ( $shortcode_tags as $shortcode_tag_name => $shortcode_tag_cb ) {
[10905] Fix | Delete
if ( 0 !== strpos( $shortcode_tag_name, 'et_pb_' ) ) {
[10906] Fix | Delete
continue;
[10907] Fix | Delete
}
[10908] Fix | Delete
[10909] Fix | Delete
$shortcode_tag_names[] = $shortcode_tag_name;
[10910] Fix | Delete
}
[10911] Fix | Delete
[10912] Fix | Delete
$et_shortcodes = implode( '|', $shortcode_tag_names );
[10913] Fix | Delete
[10914] Fix | Delete
$regex_opening_shortcodes = sprintf( '(\[(%1$s)[^\]]+\])', esc_html( $et_shortcodes ) );
[10915] Fix | Delete
$regex_closing_shortcodes = sprintf( '(\[\/(%1$s)\])', esc_html( $et_shortcodes ) );
[10916] Fix | Delete
[10917] Fix | Delete
$content = preg_replace( $regex_opening_shortcodes, '', $content );
[10918] Fix | Delete
$content = preg_replace( $regex_closing_shortcodes, '', $content );
[10919] Fix | Delete
[10920] Fix | Delete
return $content;
[10921] Fix | Delete
}
[10922] Fix | Delete
endif;
[10923] Fix | Delete
[10924] Fix | Delete
/**
[10925] Fix | Delete
* Reset shortcode object processing.
[10926] Fix | Delete
*/
[10927] Fix | Delete
function et_fb_reset_shortcode_object_processing() {
[10928] Fix | Delete
$GLOBALS['et_fb_processing_shortcode_object'] = false;
[10929] Fix | Delete
}
[10930] Fix | Delete
[10931] Fix | Delete
add_action( 'et_fb_enqueue_assets', 'et_fb_backend_helpers' );
[10932] Fix | Delete
[10933] Fix | Delete
if ( ! function_exists( 'et_builder_maybe_flush_rewrite_rules' ) ) :
[10934] Fix | Delete
/**
[10935] Fix | Delete
* Flush rewrite rules if theme option saved value and passed $value are not same.
[10936] Fix | Delete
*
[10937] Fix | Delete
* @param string $setting_name The theme option.
[10938] Fix | Delete
* @param string $value The value to be compared.
[10939] Fix | Delete
*/
[10940] Fix | Delete
function et_builder_maybe_flush_rewrite_rules( $setting_name, $value = 'done' ) {
[10941] Fix | Delete
$string_value = (string) $value;
[10942] Fix | Delete
$saved_value = et_get_option( $setting_name );
[10943] Fix | Delete
[10944] Fix | Delete
if ( $saved_value && $saved_value === $string_value ) {
[10945] Fix | Delete
return;
[10946] Fix | Delete
}
[10947] Fix | Delete
[10948] Fix | Delete
flush_rewrite_rules();
[10949] Fix | Delete
[10950] Fix | Delete
et_update_option( $setting_name, $string_value );
[10951] Fix | Delete
}
[10952] Fix | Delete
endif;
[10953] Fix | Delete
[10954] Fix | Delete
/**
[10955] Fix | Delete
* Flush rewrite rules to fix the issue Layouts, not being visible on front-end and visual builder,
[10956] Fix | Delete
* if pretty permalinks were enabled
[10957] Fix | Delete
*
[10958] Fix | Delete
* @return void
[10959] Fix | Delete
*/
[10960] Fix | Delete
function et_pb_maybe_flush_rewrite_rules_library() {
[10961] Fix | Delete
// Run flush rewrite only when et_pb_layout post type registered.
[10962] Fix | Delete
if ( post_type_exists( 'et_pb_layout' ) ) {
[10963] Fix | Delete
et_builder_maybe_flush_rewrite_rules( 'et_flush_rewrite_rules_library', ET_BUILDER_PRODUCT_VERSION );
[10964] Fix | Delete
}
[10965] Fix | Delete
}
[10966] Fix | Delete
add_action( 'init', 'et_pb_maybe_flush_rewrite_rules_library', 9 );
[10967] Fix | Delete
[10968] Fix | Delete
/**
[10969] Fix | Delete
* Remove et_builder_maybe_flush_rewrite_rules flag if flush_rewrite_rules() is called while
[10970] Fix | Delete
* `et_pb_layout` post type hasn't been registered
[10971] Fix | Delete
*
[10972] Fix | Delete
* @since 3.19.18
[10973] Fix | Delete
*
[10974] Fix | Delete
* @param string|array $old_value old option value.
[10975] Fix | Delete
* @param string|array $value new option value.
[10976] Fix | Delete
* @param string $option option name.
[10977] Fix | Delete
*/
[10978] Fix | Delete
function et_pb_maybe_remove_flush_rewrite_rules_library_flag( $old_value, $value, $option ) {
[10979] Fix | Delete
// rewrite rules for CPT that are rebuilt by flush_rewrite_rules() are based on
[10980] Fix | Delete
// get_post_types( array( '_builtin' => false ) ) value; Hence if flush_rewrite_rules() is
[10981] Fix | Delete
// executed while `et_pb_layout` CPT hasn't been registered (usually by third party plugin)
[10982] Fix | Delete
// et_pb_maybe_flush_rewrite_rules_library() flag has to be removed to trigger flush_rewrite_rules()
[10983] Fix | Delete
// via et_pb_maybe_flush_rewrite_rules_library() which contains `et_pb_layout` rewrite rules
[10984] Fix | Delete
// because et_pb_maybe_flush_rewrite_rules_library() checks for `et_pb_layout` first.
[10985] Fix | Delete
if ( '' === $value && ! post_type_exists( 'et_pb_layout' ) ) {
[10986] Fix | Delete
et_update_option( 'et_flush_rewrite_rules_library', '' );
[10987] Fix | Delete
}
[10988] Fix | Delete
}
[10989] Fix | Delete
add_action( 'update_option_rewrite_rules', 'et_pb_maybe_remove_flush_rewrite_rules_library_flag', 10, 3 );
[10990] Fix | Delete
[10991] Fix | Delete
if ( ! function_exists( 'et_builder_get_shortcuts' ) ) :
[10992] Fix | Delete
/**
[10993] Fix | Delete
* Get list of shortcut available on BB and FB
[10994] Fix | Delete
*
[10995] Fix | Delete
* @param string $on (fb|bb) shortcut mode.
[10996] Fix | Delete
* @return array shortcut list
[10997] Fix | Delete
*/
[10998] Fix | Delete
function et_builder_get_shortcuts( $on = 'fb' ) {
[10999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function