function dl_save_metabox_page_sidebar($post_id, $post) { global $options; if (!isset($_POST['dl_metabox_page_sidebar_nonce']) || !wp_verify_nonce($_POST['dl_metabox_page_sidebar_nonce'], basename(__FILE__))) { return $post_id; } /* Check if the current user has permission to edit the post. */ if (!current_user_can('edit_page', $post_id)) { return; } dl_save_standard('sidebar_title_above', $_POST['sidebar_title_above'], $post_id, 'page', 'text'); if ($options['advanced_page_sidebar_useeditor_textabove'] == false) { dl_save_standard('sidebar_text_above', $_POST['sidebar_text_above'], $post_id, 'page', 'textnohtml'); } else { dl_save_standard('sidebar_text_above', $_POST['sidebar_text_above'], $post_id, 'page', 'wpeditor'); } dl_save_standard('sidebar_title_below', $_POST['sidebar_title_below'], $post_id, 'page', 'text'); if ($options['advanced_page_sidebar_useeditor_textbelow'] == false) { dl_save_standard('sidebar_text_below', $_POST['sidebar_text_below'], $post_id, 'page', 'textnohtml'); } else { dl_save_standard('sidebar_text_below', $_POST['sidebar_text_below'], $post_id, 'page', 'wpeditor'); } $newval = isset($_POST['dlval_sidebar_title_linkblock1']) ? sanitize_text_field($_POST['dlval_sidebar_title_linkblock1']) : 0; dl_save_standard('dlval_sidebar_title_linkblock1', $newval, $post_id, 'page', 'text'); $newval = isset($_POST['dlval_sidebar_title_linkblock2']) ? sanitize_text_field($_POST['dlval_sidebar_title_linkblock2']) : 0; dl_save_standard('dlval_sidebar_title_linkblock1', $newval, $post_id, 'page', 'text'); global $options; for ($i = 1; $i <= $options['advanced_page_sidebar_linkblock1_number']; $i++) { $name = 'dlval_linkblock1_link' . $i; $urlname = $name . '_url'; $titlename = $name . '_title'; $oldpageid = get_post_meta($post_id, $name, true); $oldurl = get_post_meta($post_id, $urlname, true); $oldtitle = get_post_meta($post_id, $titlename, true); $c = $i - 1; $newurl = isset($_POST[$urlname]) ? esc_url($_POST[$urlname]) : 0; $newid = isset($_POST[$name]) ? sanitize_key($_POST[$name]) : 0; $newtitle = isset($_POST[$titlename]) ? sanitize_text_field($_POST[$titlename]) : 0; if (!isset($newid) || $newid <= 0) { // Versuche aus der URL die ID zu ermitteln $relativeurl = dl_make_link_relative($newurl); if ($relativeurl != $newurl) { // Ist eine interne URL, also mnuss es eine ID geben $newid = url_to_postid($newurl); } } update_post_meta($post_id, $urlname, $newurl); update_post_meta($post_id, $titlename, $newtitle); update_post_meta($post_id, $name, $newid); } }
function dl_display_search_resultitem() { global $post; global $options; $output = ''; $withthumb = $options['search_display_post_thumbnails']; $withcats = $options['search_display_post_cats']; if (isset($post) && isset($post->ID)) { $link = get_post_meta($post->ID, 'external_link', true); $external = 0; if (isset($link) && filter_var($link, FILTER_VALIDATE_URL)) { $external = 1; } else { $link = dl_make_link_relative(get_permalink($post->ID)); } $output .= '<article class="search-result">' . "\n"; $output .= "\t<h3><a "; if ($external == 1) { $output .= 'class="ext-link" '; } $output .= "href=\"" . $link . "\">" . get_the_title() . "</a></h3>\n"; $type = get_post_type(); if ($type == 'post') { $typestr = '<div class="search-meta">'; $categories = get_the_category(); $separator = ', '; $thiscatstr = ''; if ($withcats == true && $categories) { $typestr .= '<span class="post-meta-category"> '; $typestr .= __('Kategorie', 'dltextdom'); $typestr .= ': '; foreach ($categories as $category) { $thiscatstr .= '<a href="' . get_category_link($category->term_id) . '">' . $category->cat_name . '</a>' . $separator; } $typestr .= trim($thiscatstr, $separator); $typestr .= '</span> '; } $topevent_date = get_post_meta($post->ID, 'topevent_date', true); if ($topevent_date) { $typestr .= '<span class="post-meta-date"> '; $typestr .= date_i18n(get_option('date_format'), strtotime($topevent_date)); $typestr .= ' ('; $typestr .= __('Veranstaltungshinweis', 'dltextdom'); $typestr .= ')'; $typestr .= '</span>'; } else { $typestr .= '<span class="post-meta-date"> '; $typestr .= get_the_date(); $typestr .= '</span>'; } $typestr .= '</div>' . "\n"; } elseif ($type == 'event') { $typestr = '<div class="search-meta">'; $typestr .= '<span class="post-meta-event"> '; $typestr .= __('Veranstaltungshinweis', 'dltextdom'); $typestr .= '</span>'; $typestr .= '</div>' . "\n"; } else { $typestr = ''; } if (!empty($typestr)) { $output .= "\t" . $typestr . "\n"; } $output .= "\t" . '<div class="row">' . "\n"; if ($withthumb == true && has_post_thumbnail($post->ID)) { $output .= "\t\t" . '<div class="span3">' . "\n"; $output .= '<a href="' . $link . '" class="news-image'; if ($external == 1) { $output .= ' ext-link'; } $output .= '">'; $post_thumbnail_id = get_post_thumbnail_id($post->ID, 'post-thumb'); $imagehtml = ''; if ($post_thumbnail_id) { $sliderimage = wp_get_attachment_image_src($post_thumbnail_id, 'post-thumb'); $imageurl = $sliderimage[0]; } if (!isset($imageurl) || strlen(trim($imageurl)) < 4) { $imageurl = $options['default_postthumb_src']; } $output .= '<img src="' . dl_esc_url($imageurl) . '" width="' . $options['default_postthumb_width'] . '" height="' . $options['default_postthumb_height'] . '" alt="">'; $output .= '</a>'; $output .= "\t\t" . '</div>' . "\n"; $output .= "\t\t" . '<div class="span5">' . "\n"; } else { $output .= "\t\t" . '<div class="span8">' . "\n"; } $output .= "\t\t" . '<p>' . "\n"; $output .= dl_custom_excerpt($post->ID, $options['default_search_excerpt_length'], false, '', true, $options['search_display_excerpt_morestring']); if ($options['search_display_continue_arrow']) { $output .= '<a class="read-more-arrow'; if ($external == 1) { $output .= ' ext-link'; } $output .= '" href="' . $link . '">›</a>'; } $output .= "\t\t\t" . '</p>' . "\n"; $output .= "\t</div> <!-- /row -->\n"; $output .= "</article>\n"; } else { $output .= "<!-- empty result -->\n"; } return $output; }
if (isset($oldpageid) && $oldpageid > 0) { $oldtitle = get_the_title($oldpageid); $oldurl = get_permalink($oldpageid); } } } else { if (isset($oldpageid) && is_numeric($oldpageid) && $oldpageid > 0) { // Hole zur Sicherheit nochmal aktuelle URL $oldurl = get_permalink($oldpageid); } if (empty($oldtitle)) { $oldtitle = get_the_title($oldpageid); } } if (!empty($oldurl)) { $oldurl = dl_make_link_relative($oldurl); $list1 .= "\t" . '<li class="tag"><a href="' . $oldurl . '">' . $oldtitle . '</a></li>' . "\n"; } } } $output = ''; if (strlen(trim($list1)) > 0) { // Es gibt eine Liste $output .= '<aside class="widget quicklinks">' . "\n"; $output .= $titleblock1; $output .= '<ul class="tagcloud">' . "\n"; $output .= $list1; $output .= '</ul>' . "\n"; $output .= '</aside>' . "\n"; } if (function_exists('mimetypes_to_icons')) {