← All changes
|
app/modules/import-export-customization/utils.php
+3
-38
4.1.0-dev2
→
3.31.2
View file →
| @@ -57,33 +57,19 @@ | ||
| 57 | 57 | |
| 58 | 58 | return $result; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public static function get_elementor_post_types( $exclude = [] ) { | |
| 61 | + public static function get_elementor_post_types() { | |
| 62 | 62 | $elementor_post_types = get_post_types_by_support( 'elementor' ); |
| 63 | 63 | |
| 64 | 64 | return array_filter( $elementor_post_types, function ( $value ) { |
| 65 | 65 | // Templates are handled in a separate process. |
| 66 | - if ( 'elementor_library' === $value ) { | |
| 67 | - return false; | |
| 68 | - } | |
| 69 | - | |
| 70 | - if ( ! empty( $exclude ) && in_array( $value, $exclude, true ) ) { | |
| 71 | - return false; | |
| 72 | - } | |
| 73 | - | |
| 74 | 66 | return 'elementor_library' !== $value; |
| 75 | 67 | } ); |
| 76 | 68 | } |
| 77 | 69 | |
| 78 | - public static function get_builtin_wp_post_types( $exclude = [] ) { | |
| 79 | - $builtin_wp_post_types = [ 'post', 'page', 'nav_menu_item' ]; | |
| 80 | - | |
| 81 | - if ( ! empty( $exclude ) ) { | |
| 82 | - return array_diff( $builtin_wp_post_types, $exclude ); | |
| 83 | - } | |
| 84 | - | |
| 85 | - return $builtin_wp_post_types; | |
| 70 | + public static function get_builtin_wp_post_types() { | |
| 71 | + return [ 'post', 'page', 'nav_menu_item' ]; | |
| 86 | 72 | } |
| 87 | 73 | |
| 88 | 74 | public static function get_registered_cpt_names() { |
| 89 | 75 | $post_types = get_post_types( [ |
| @@ -149,27 +135,6 @@ | ||
| 149 | 135 | $space_between_widgets['row'] = $size; |
| 150 | 136 | $space_between_widgets['isLinked'] = true; |
| 151 | 137 | |
| 152 | 138 | return $space_between_widgets; |
| 153 | - } | |
| 154 | - | |
| 155 | - public static function resolve_label_conflict( string $label, array $existing_labels, int $max_length = 50 ): string { | |
| 156 | - $lower_label = strtolower( $label ); | |
| 157 | - | |
| 158 | - if ( ! in_array( $lower_label, $existing_labels, true ) ) { | |
| 159 | - return $label; | |
| 160 | - } | |
| 161 | - | |
| 162 | - $suffix = 1; | |
| 163 | - $max_suffix_attempts = 1000; | |
| 164 | - | |
| 165 | - do { | |
| 166 | - $suffix_str = '_' . $suffix; | |
| 167 | - $max_base_length = $max_length - strlen( $suffix_str ); | |
| 168 | - $base_label = mb_substr( $label, 0, $max_base_length ); | |
| 169 | - $new_label = $base_label . $suffix_str; | |
| 170 | - ++$suffix; | |
| 171 | - } while ( in_array( strtolower( $new_label ), $existing_labels, true ) && $suffix < $max_suffix_attempts ); | |
| 172 | - | |
| 173 | - return $new_label; | |
| 174 | 139 | } |
| 175 | 140 | } |