]+>)([^<]+)(<\/' . $el . ')'; if ( is_string( $parent_el ) && '' !== $parent_el ) $pattern = '(<' . $parent_el . '\s[~>]+>' . $pattern; $pattern = '/' . $pattern . '/msi'; return preg_replace( '/(<' . $parent_el . '\s[~>]+>[^<]+<' . $el . '\s[^>]+>)([^<]+)(<\/' . $el . ')/msi', '{$1}' . $before . '{$2}' . $after . '{$3}', $html ); } } if( ! function_exists( 'ace_print_edit_shortcut_for_theme_customizer' ) ) { /** * Edit Shortcut for Theme Customizer * * @param string $setting_id * @param string $label * * @return string **/ function ace_print_edit_shortcut_for_theme_customizer( $setting_id, $label = '' ) { if( is_customize_preview() ) { AceRenderingMethods::editorShortcutForThemeCustomizer( $setting_id, $label ); } } } /** * Return EOF String **/ if ( ! function_exists( 'ace_get_string_eof' ) ) { function ace_get_string_eof( $string ) { $return = <<< EOF {$string} EOF; return $return; } } # # String # if ( ! function_exists( 'ace_is_json_string' ) ) { /** * Check if $var is json * * @parma string $var * * @return bool **/ function ace_is_json_string( $var ) { json_decode( $var ); return ace_boolval( json_last_error() == JSON_ERROR_NONE ); } } /** * Array */ if ( ! function_exists( 'ace_array_insert' ) ) { /** * Insert an array into another array before/after a certain key * * @param array $array The initial array * @param array $pairs The array to insert * @param string $key The certain key * @param string $position Wether to insert the array before or after the key * @return array */ function ace_array_insert( $array, $pairs, $key, $position = 'after' ) { $key_pos = array_search( $key, array_keys( $array ) ); if ( 'after' == $position ) $key_pos++; if ( false !== $key_pos ) { $result = array_slice( $array, 0, $key_pos ); $result = array_merge( $result, $pairs ); $result = array_merge( $result, array_slice( $array, $key_pos ) ); } else { $result = array_merge( $array, $pairs ); } return $result; } } // Comments if ( ! function_exists( 'ace_comments_tempalte' ) ) { /** * Print Comment List **/ function ace_comments_tempalte() { if ( is_singular() || is_page() ) { if ( comments_open( $post ) || get_comments_number() ) { comments_template(); } } } } if ( ! function_exists( 'ace_comments_list' ) ) { /** * Print Comment List * * @param object $comment * @param array $args * @param int $depth **/ function ace_comments_list( $comment, $args, $depth ) { echo '
'; esc_html_e( '* Waiting for being approved *', Ace::TEXTDOMAIN ); echo '
'; } echo '