diff --git a/assets/theme-mode/demo-theme-options.php b/assets/theme-mode/demo-theme-options.php index 99c3eee2..209b6048 100755 --- a/assets/theme-mode/demo-theme-options.php +++ b/assets/theme-mode/demo-theme-options.php @@ -587,6 +587,21 @@ function custom_theme_options() { 'condition' => '', 'operator' => 'and', ), + array( + 'id' => 'demo_menu_select', + 'label' => __( 'Menu Select', 'theme-text-domain' ), + 'desc' => '

' . sprintf( __( 'This option type makes it possible for users to select a WordPress menu to use on a specific area.', 'theme-text-domain' ) ) . '

', + 'std' => '', + 'type' => 'menu-select', + 'section' => 'option_types', + 'rows' => '', + 'post_type' => '', + 'taxonomy' => '', + 'min_max_step' => '', + 'class' => '', + 'condition' => '', + 'operator' => 'and', + ), array( 'id' => 'demo_social_links', 'label' => __( 'Social Links', 'theme-text-domain' ), diff --git a/includes/ot-functions-admin.php b/includes/ot-functions-admin.php index 41d79797..f578f4c6 100755 --- a/includes/ot-functions-admin.php +++ b/includes/ot-functions-admin.php @@ -694,7 +694,7 @@ function _filter_wp_kses_post( $add = true ) { if ( ! empty( $input ) ) { $input_safe = sanitize_text_field( $input ); } - } elseif ( 'radio' === $type || 'radio-image' === $type || 'select' === $type || 'sidebar-select' === $type ) { + } elseif ( 'radio' === $type || 'radio-image' === $type || 'select' === $type || 'sidebar-select' === $type || 'menu-select' === $type ) { $input_safe = ''; if ( ! empty( $input ) ) { @@ -2302,6 +2302,7 @@ function ot_option_types_array() { 'radio-image' => esc_html__( 'Radio Image', 'option-tree' ), 'select' => esc_html__( 'Select', 'option-tree' ), 'sidebar-select' => esc_html__( 'Sidebar Select', 'option-tree' ), + 'menu-select' => esc_html__( 'Menu Select', 'option-tree' ), 'slider' => esc_html__( 'Slider', 'option-tree' ), 'social-links' => esc_html__( 'Social Links', 'option-tree' ), 'spacing' => esc_html__( 'Spacing', 'option-tree' ), @@ -5057,7 +5058,7 @@ function ot_decode( $value ) { preg_match( '/a:\d+:{.*?}/', $decoded, $array_matches, PREG_OFFSET_CAPTURE, 0 ); // Search for an object. - preg_match( '/O|C:\+?\d+:"[a-z0-9_]+":\+?\d+:/i', $decoded, $obj_matches, PREG_OFFSET_CAPTURE, 0 ); + preg_match( '/O|C:\+?\d+:"[a-z0-9_]+":\+?\d+:/', $decoded, $obj_matches, PREG_OFFSET_CAPTURE, 0 ); // Prevent object injection or non arrays. if ( $obj_matches || ! $array_matches ) { diff --git a/includes/ot-functions-option-types.php b/includes/ot-functions-option-types.php index d607ac68..edd98fb0 100755 --- a/includes/ot-functions-option-types.php +++ b/includes/ot-functions-option-types.php @@ -2155,6 +2155,67 @@ function ot_type_sidebar_select( $args = array() ) { } } +if ( ! function_exists( 'ot_type_menu_select' ) ) { + + /** + * Menu Select option type. + * + * This option type bring us to have all Wordpress navigation menus as a select box in the + * Option panel. + * + * Suppose you want to create a mega menu in multi dimensions row and column or wanting + * To create, manage and show some custom menus in the some post or pages or even creating a dynamical menu. + * This functionality help us to do all of them. + * + * See @ot_display_by_type to see the full list of available arguments. + * + * @param array $args An array of arguments. + * + * @access public + * @since 2.7.3 + */ + function ot_type_menu_select( $args = array() ) { + + // Turns arguments array into variables. + extract( $args ); // phpcs:ignore + + // Verify a description. + $has_desc = ! empty( $field_desc ) ? true : false; + + // Format setting outer wrapper. + echo '
'; + + /* description */ + echo $has_desc ? '
' . wp_kses_post( htmlspecialchars_decode( $field_desc ) ) . '
' : ''; + + // Format setting inner wrapper. + echo '
'; + + // Build menu select. + echo ''; + + echo '
'; + + echo '
'; + } +} + if ( ! function_exists( 'ot_type_slider' ) ) { /**