Beispiel #1
0
function hello_louie_get_lyric()
{
    /** These are the lyrics to Frank Sinatra's version of "Hello Dolly" from the album "It Might as Well Be Swing" */
    $lyrics = "Hello Dolly\r\nWell hello Dolly\r\nIt's so nice to have you back where you belong\r\nYou're lookin' swell, Dolly\r\nWe can tell, Dolly\r\nYou're still glowin', you're still crowin'\r\nYou're still goin' strong\r\nWe feel the room swayin'\r\n'Cause the band's playin'\r\nOne of your old favorite songs from way back when\r\nTake her wrap, fellas\r\nFind her an empty lap, fellas\r\nDolly'll never go away\r\nDolly'll never go away\r\nHello Satch\r\nThis is Francis, Louie\r\nIt's so nice to see you back where you belong\r\nYou're back on top, Louie\r\nNever stop, Louie\r\nYou're still singin', you're still swingin'\r\nYou're still goin' strong\r\nYou get the room swayin'\r\nWhen you start in playin'\r\nOne of your great songs, or songs from way back when\r\nBlow your horn, Louie\r\nSing up a great big song, Louie\r\nPromise you won't go away\r\nPromise you won't go away\r\nPromise you won't go away again, ooh yeah";
    // Here we split it into lines
    $lyrics = explode("\n", $lyrics);
    // And then randomly choose a line
    return nxttexturize($lyrics[mt_rand(0, count($lyrics) - 1)]);
}
function huddle_shortcode_formatter($content)
{
    $new_content = '';
    $pattern_full = '{(\\[raw\\].*?\\[/raw\\])}is';
    $pattern_contents = '{\\[raw\\](.*?)\\[/raw\\]}is';
    $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
    foreach ($pieces as $piece) {
        if (preg_match($pattern_contents, $piece, $matches)) {
            $new_content .= $matches[1];
        } else {
            $new_content .= nxttexturize(nxtautop($piece));
        }
    }
    return $new_content;
}
Beispiel #3
0
/**
 * Display menu.
 *
 * @access private
 * @since 2.7.0
 *
 * @param array $menu
 * @param array $submenu
 * @param bool $submenu_as_parent
 */
function _nxt_menu_output($menu, $submenu, $submenu_as_parent = true)
{
    global $self, $parent_file, $submenu_file, $plugin_page, $pagenow, $typenow;
    $first = true;
    // 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
    foreach ($menu as $key => $item) {
        $admin_is_parent = false;
        $class = array();
        $aria_attributes = 'tabindex="1"';
        if ($first) {
            $class[] = 'nxt-first-item';
            $first = false;
        }
        $submenu_items = false;
        if (!empty($submenu[$item[2]])) {
            $class[] = 'nxt-has-submenu';
            $submenu_items = $submenu[$item[2]];
        }
        if ($parent_file && $item[2] == $parent_file || empty($typenow) && $self == $item[2]) {
            $class[] = !empty($submenu_items) ? 'nxt-has-current-submenu nxt-menu-open' : 'current';
        } else {
            $class[] = 'nxt-not-current-submenu';
            if (!empty($submenu_items)) {
                $aria_attributes .= ' aria-haspopup="true"';
            }
        }
        if (!empty($item[4])) {
            $class[] = $item[4];
        }
        $class = $class ? ' class="' . join(' ', $class) . '"' : '';
        $id = !empty($item[5]) ? ' id="' . preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]) . '"' : '';
        $img = '';
        if (!empty($item[6])) {
            $img = 'div' === $item[6] ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
        }
        $arrow = '<div class="nxt-menu-arrow"><div></div></div>';
        $title = nxttexturize($item[0]);
        echo "\n\t<li{$class}{$id}>";
        if (false !== strpos($class, 'nxt-menu-separator')) {
            echo '<div class="separator"></div>';
        } elseif ($submenu_as_parent && !empty($submenu_items)) {
            $submenu_items = array_values($submenu_items);
            // Re-index.
            $menu_hook = get_plugin_page_hook($submenu_items[0][2], $item[2]);
            $menu_file = $submenu_items[0][2];
            if (false !== ($pos = strpos($menu_file, '?'))) {
                $menu_file = substr($menu_file, 0, $pos);
            }
            if (!empty($menu_hook) || 'index.php' != $submenu_items[0][2] && file_exists(nxt_PLUGIN_DIR . "/{$menu_file}")) {
                $admin_is_parent = true;
                echo "<div class='nxt-menu-image'><a href='admin.php?page={$submenu_items[0][2]}'>{$img}</a></div>{$arrow}<a href='admin.php?page={$submenu_items[0][2]}'{$class} {$aria_attributes}>{$title}</a>";
            } else {
                echo "\n\t<div class='nxt-menu-image'><a href='{$submenu_items[0][2]}'>{$img}</a></div>{$arrow}<a href='{$submenu_items[0][2]}'{$class} {$aria_attributes}>{$title}</a>";
            }
        } elseif (!empty($item[2]) && current_user_can($item[1])) {
            $menu_hook = get_plugin_page_hook($item[2], 'admin.php');
            $menu_file = $item[2];
            if (false !== ($pos = strpos($menu_file, '?'))) {
                $menu_file = substr($menu_file, 0, $pos);
            }
            if (!empty($menu_hook) || 'index.php' != $item[2] && file_exists(nxt_PLUGIN_DIR . "/{$menu_file}")) {
                $admin_is_parent = true;
                echo "\n\t<div class='nxt-menu-image'><a href='admin.php?page={$item[2]}'>{$img}</a></div>{$arrow}<a href='admin.php?page={$item[2]}'{$class} {$aria_attributes}>{$item[0]}</a>";
            } else {
                echo "\n\t<div class='nxt-menu-image'><a href='{$item[2]}'>{$img}</a></div>{$arrow}<a href='{$item[2]}'{$class} {$aria_attributes}>{$item[0]}</a>";
            }
        }
        if (!empty($submenu_items)) {
            echo "\n\t<div class='nxt-submenu'><div class='nxt-submenu-wrap'>";
            echo "<div class='nxt-submenu-head'>{$item[0]}</div><ul>";
            $first = true;
            foreach ($submenu_items as $sub_key => $sub_item) {
                if (!current_user_can($sub_item[1])) {
                    continue;
                }
                $aria_attributes = 'tabindex="1"';
                $class = array();
                if ($first) {
                    $class[] = 'nxt-first-item';
                    $first = false;
                }
                $menu_file = $item[2];
                if (false !== ($pos = strpos($menu_file, '?'))) {
                    $menu_file = substr($menu_file, 0, $pos);
                }
                // Handle current for post_type=post|page|foo pages, which won't match $self.
                $self_type = !empty($typenow) ? $self . '?post_type=' . $typenow : 'nothing';
                if (isset($submenu_file)) {
                    if ($submenu_file == $sub_item[2]) {
                        $class[] = 'current';
                    }
                    // If plugin_page is set the parent must either match the current page or not physically exist.
                    // This allows plugin pages with the same hook to exist under different parents.
                } else {
                    if (!isset($plugin_page) && $self == $sub_item[2] || isset($plugin_page) && $plugin_page == $sub_item[2] && ($item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false)) {
                        $class[] = 'current';
                    }
                }
                $class = $class ? ' class="' . join(' ', $class) . '"' : '';
                $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
                $sub_file = $sub_item[2];
                if (false !== ($pos = strpos($sub_file, '?'))) {
                    $sub_file = substr($sub_file, 0, $pos);
                }
                $title = nxttexturize($sub_item[0]);
                if (!empty($menu_hook) || 'index.php' != $sub_item[2] && file_exists(nxt_PLUGIN_DIR . "/{$sub_file}")) {
                    // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
                    if (!$admin_is_parent && file_exists(nxt_PLUGIN_DIR . "/{$menu_file}") && !is_dir(nxt_PLUGIN_DIR . "/{$item[2]}") || file_exists($menu_file)) {
                        $sub_item_url = add_query_arg(array('page' => $sub_item[2]), $item[2]);
                    } else {
                        $sub_item_url = add_query_arg(array('page' => $sub_item[2]), 'admin.php');
                    }
                    $sub_item_url = esc_url($sub_item_url);
                    echo "<li{$class}><a href='{$sub_item_url}'{$class} {$aria_attributes}>{$title}</a></li>";
                } else {
                    echo "<li{$class}><a href='{$sub_item[2]}'{$class} {$aria_attributes}>{$title}</a></li>";
                }
            }
            echo "</ul></div></div>";
        }
        echo "</li>";
    }
    echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>';
    echo '<span>' . esc_html__('Collapse menu') . '</span>';
    echo '</li>';
}
 function get_content($content, $class = null)
 {
     global $post;
     return '<div id="nxtw_read_div" ' . $class . '>' . $this->table_of_contents(nxttexturize($this->wiki_parser($content))) . '</div>';
 }
Beispiel #5
0
/**
 * The Gallery shortcode.
 *
 * This implements the functionality of the Gallery Shortcode for displaying
 * NXTClass images on a post.
 *
 * @since 2.5.0
 *
 * @param array $attr Attributes of the shortcode.
 * @return string HTML content to display gallery.
 */
function gallery_shortcode($attr)
{
    global $post;
    static $instance = 0;
    $instance++;
    // Allow plugins/themes to override the default gallery template.
    $output = apply_filters('post_gallery', '', $attr);
    if ($output != '') {
        return $output;
    }
    // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
    if (isset($attr['orderby'])) {
        $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
        if (!$attr['orderby']) {
            unset($attr['orderby']);
        }
    }
    extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr));
    $id = intval($id);
    if ('RAND' == $order) {
        $orderby = 'none';
    }
    if (!empty($include)) {
        $include = preg_replace('/[^0-9,]+/', '', $include);
        $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
        $attachments = array();
        foreach ($_attachments as $key => $val) {
            $attachments[$val->ID] = $_attachments[$key];
        }
    } elseif (!empty($exclude)) {
        $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
        $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    } else {
        $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
    }
    if (empty($attachments)) {
        return '';
    }
    if (is_feed()) {
        $output = "\n";
        foreach ($attachments as $att_id => $attachment) {
            $output .= nxt_get_attachment_link($att_id, $size, true) . "\n";
        }
        return $output;
    }
    $itemtag = tag_escape($itemtag);
    $captiontag = tag_escape($captiontag);
    $columns = intval($columns);
    $itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
    $float = is_rtl() ? 'right' : 'left';
    $selector = "gallery-{$instance}";
    $gallery_style = $gallery_div = '';
    if (apply_filters('use_default_gallery_style', true)) {
        $gallery_style = "\n\t\t<style type='text/css'>\n\t\t\t#{$selector} {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#{$selector} .gallery-item {\n\t\t\t\tfloat: {$float};\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: {$itemwidth}%;\n\t\t\t}\n\t\t\t#{$selector} img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#{$selector} .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t</style>\n\t\t<!-- see gallery_shortcode() in nxt-includes/media.php -->";
    }
    $size_class = sanitize_html_class($size);
    $gallery_div = "<div id='{$selector}' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
    $output = apply_filters('gallery_style', $gallery_style . "\n\t\t" . $gallery_div);
    $i = 0;
    foreach ($attachments as $id => $attachment) {
        $link = isset($attr['link']) && 'file' == $attr['link'] ? nxt_get_attachment_link($id, $size, false, false) : nxt_get_attachment_link($id, $size, true, false);
        $output .= "<{$itemtag} class='gallery-item'>";
        $output .= "\n\t\t\t<{$icontag} class='gallery-icon'>\n\t\t\t\t{$link}\n\t\t\t</{$icontag}>";
        if ($captiontag && trim($attachment->post_excerpt)) {
            $output .= "\n\t\t\t\t<{$captiontag} class='nxt-caption-text gallery-caption'>\n\t\t\t\t" . nxttexturize($attachment->post_excerpt) . "\n\t\t\t\t</{$captiontag}>";
        }
        $output .= "</{$itemtag}>";
        if ($columns > 0 && ++$i % $columns == 0) {
            $output .= '<br style="clear: both" />';
        }
    }
    $output .= "\n\t\t\t<br style='clear: both;' />\n\t\t</div>\n";
    return $output;
}
Beispiel #6
0
                if (!empty($plugins)) {
                    $keys = array_keys($plugins);
                    $plugin_file = $plugin_slug . '/' . $keys[0];
                    $action = '<a href="' . esc_url(nxt_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
                }
            }
            if (empty($action)) {
                if (is_main_site()) {
                    $action = '<a href="' . esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&from=import&TB_iframe=true&width=600&height=550')) . '" class="thickbox" title="' . esc_attr__('Install importer') . '">' . $data[0] . '</a>';
                } else {
                    $action = $data[0];
                    $data[1] = sprintf(__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'), get_admin_url($current_site->blog_id, 'import.php'));
                }
            }
        } else {
            $action = "<a href='" . esc_url("admin.php?import={$id}") . "' title='" . esc_attr(nxttexturize(strip_tags($data[1]))) . "'>{$data[0]}</a>";
        }
        if ($style != '') {
            $style = 'class="' . $style . '"';
        }
        echo "\n\t\t\t<tr {$style}>\n\t\t\t\t<td class='import-system row-title'>{$action}</td>\n\t\t\t\t<td class='desc'>{$data[1]}</td>\n\t\t\t</tr>";
    }
    ?>

</table>
<?php 
}
if (current_user_can('install_plugins')) {
    echo '<p>' . sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))) . '</p>';
}
?>
Beispiel #7
0
/**
 * Retrieve list of themes with theme data in theme directory.
 *
 * The theme is broken, if it doesn't have a parent theme and is missing either
 * style.css and, or index.php. If the theme has a parent theme then it is
 * broken, if it is missing style.css; index.php is optional. The broken theme
 * list is saved in the {@link $nxt_broken_themes} global, which is displayed on
 * the theme list in the administration panels.
 *
 * @since 1.5.0
 * @global array $nxt_broken_themes Stores the broken themes.
 * @global array $nxt_themes Stores the working themes.
 *
 * @return array Theme list with theme data.
 */
function get_themes()
{
    global $nxt_themes, $nxt_broken_themes;
    if (isset($nxt_themes)) {
        return $nxt_themes;
    }
    if (!($theme_files = search_theme_directories())) {
        return false;
    }
    asort($theme_files);
    $nxt_themes = array();
    foreach ((array) $theme_files as $theme_file) {
        $theme_root = $theme_file['theme_root'];
        $theme_file = $theme_file['theme_file'];
        if (!is_readable("{$theme_root}/{$theme_file}")) {
            $nxt_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.'));
            continue;
        }
        $theme_data = get_theme_data("{$theme_root}/{$theme_file}");
        $name = $theme_data['Name'];
        $title = $theme_data['Title'];
        $description = nxttexturize($theme_data['Description']);
        $version = $theme_data['Version'];
        $author = $theme_data['Author'];
        $template = $theme_data['Template'];
        $stylesheet = dirname($theme_file);
        $screenshot = false;
        foreach (array('png', 'gif', 'jpg', 'jpeg') as $ext) {
            if (file_exists("{$theme_root}/{$stylesheet}/screenshot.{$ext}")) {
                $screenshot = "screenshot.{$ext}";
                break;
            }
        }
        if (empty($name)) {
            $name = dirname($theme_file);
            $title = $name;
        }
        $parent_template = $template;
        if (empty($template)) {
            if (file_exists("{$theme_root}/{$stylesheet}/index.php")) {
                $template = $stylesheet;
            } else {
                continue;
            }
        }
        $template = trim($template);
        if (!file_exists("{$theme_root}/{$template}/index.php")) {
            $parent_dir = dirname(dirname($theme_file));
            if (file_exists("{$theme_root}/{$parent_dir}/{$template}/index.php")) {
                $template = "{$parent_dir}/{$template}";
                $template_directory = "{$theme_root}/{$template}";
            } else {
                /**
                 * The parent theme doesn't exist in the current theme's folder or sub folder
                 * so lets use the theme root for the parent template.
                 */
                if (isset($theme_files[$template]) && file_exists($theme_files[$template]['theme_root'] . "/{$template}/index.php")) {
                    $template_directory = $theme_files[$template]['theme_root'] . "/{$template}";
                } else {
                    if (empty($parent_template)) {
                        $nxt_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template');
                    } else {
                        $nxt_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf(__('The parent theme is missing. Please install the "%s" parent theme.'), $parent_template), 'error' => 'no_parent', 'parent' => $parent_template);
                    }
                    continue;
                }
            }
        } else {
            $template_directory = trim($theme_root . '/' . $template);
        }
        $stylesheet_files = array();
        $template_files = array();
        $stylesheet_dir = @dir("{$theme_root}/{$stylesheet}");
        if ($stylesheet_dir) {
            while (($file = $stylesheet_dir->read()) !== false) {
                if (!preg_match('|^\\.+$|', $file)) {
                    if (preg_match('|\\.css$|', $file)) {
                        $stylesheet_files[] = "{$theme_root}/{$stylesheet}/{$file}";
                    } elseif (preg_match('|\\.php$|', $file)) {
                        $template_files[] = "{$theme_root}/{$stylesheet}/{$file}";
                    }
                }
            }
            @$stylesheet_dir->close();
        }
        $template_dir = @dir("{$template_directory}");
        if ($template_dir) {
            while (($file = $template_dir->read()) !== false) {
                if (preg_match('|^\\.+$|', $file)) {
                    continue;
                }
                if (preg_match('|\\.php$|', $file)) {
                    $template_files[] = "{$template_directory}/{$file}";
                } elseif (is_dir("{$template_directory}/{$file}")) {
                    $template_subdir = @dir("{$template_directory}/{$file}");
                    if (!$template_subdir) {
                        continue;
                    }
                    while (($subfile = $template_subdir->read()) !== false) {
                        if (preg_match('|^\\.+$|', $subfile)) {
                            continue;
                        }
                        if (preg_match('|\\.php$|', $subfile)) {
                            $template_files[] = "{$template_directory}/{$file}/{$subfile}";
                        }
                    }
                    @$template_subdir->close();
                }
            }
            @$template_dir->close();
        }
        //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes
        $template_files = array_unique($template_files);
        $stylesheet_files = array_unique($stylesheet_files);
        $template_dir = $template_directory;
        $stylesheet_dir = $theme_root . '/' . $stylesheet;
        if (empty($template_dir)) {
            $template_dir = '/';
        }
        if (empty($stylesheet_dir)) {
            $stylesheet_dir = '/';
        }
        // Check for theme name collision.  This occurs if a theme is copied to
        // a new theme directory and the theme header is not updated.  Whichever
        // theme is first keeps the name.  Subsequent themes get a suffix applied.
        // The Twenty Eleven, Twenty Ten, Default and Classic themes always trump
        // their pretenders.
        if (isset($nxt_themes[$name])) {
            $trump_cards = array('classic' => 'NXTClass Classic', 'default' => 'NXTClass Default', 'twentyten' => 'Twenty Ten', 'twentyeleven' => 'Twenty Eleven');
            if (isset($trump_cards[$stylesheet]) && $name == $trump_cards[$stylesheet]) {
                // If another theme has claimed to be one of our default themes, move
                // them aside.
                $suffix = $nxt_themes[$name]['Stylesheet'];
                $new_name = "{$name}/{$suffix}";
                $nxt_themes[$new_name] = $nxt_themes[$name];
                $nxt_themes[$new_name]['Name'] = $new_name;
            } else {
                $name = "{$name}/{$stylesheet}";
            }
        }
        $theme_roots[$stylesheet] = str_replace(nxt_CONTENT_DIR, '', $theme_root);
        $nxt_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Author Name' => $theme_data['AuthorName'], 'Author URI' => $theme_data['AuthorURI'], 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace(nxt_CONTENT_DIR, content_url(), $theme_root));
    }
    unset($theme_files);
    /* Store theme roots in the DB */
    if (get_site_transient('theme_roots') != $theme_roots) {
        set_site_transient('theme_roots', $theme_roots, 7200);
    }
    // cache for two hours
    unset($theme_roots);
    /* Resolve theme dependencies. */
    $theme_names = array_keys($nxt_themes);
    foreach ((array) $theme_names as $theme_name) {
        $nxt_themes[$theme_name]['Parent Theme'] = '';
        if ($nxt_themes[$theme_name]['Stylesheet'] != $nxt_themes[$theme_name]['Template']) {
            foreach ((array) $theme_names as $parent_theme_name) {
                if ($nxt_themes[$parent_theme_name]['Stylesheet'] == $nxt_themes[$parent_theme_name]['Template'] && $nxt_themes[$parent_theme_name]['Template'] == $nxt_themes[$theme_name]['Template']) {
                    $nxt_themes[$theme_name]['Parent Theme'] = $nxt_themes[$parent_theme_name]['Name'];
                    break;
                }
            }
        }
    }
    return $nxt_themes;
}
 $output = '';
 $post_type = get_post_type($post->ID);
 $post_type_obj = get_post_type_object($post_type);
 $taxonomies_string = 'post_tag, category';
 $taxonomies = array('post_tag', 'category');
 if (isset($post_type_obj->taxonomies) && count($post_type_obj->taxonomies) > 0) {
     $taxonomies_string = join(', ', $post_type_obj->taxonomies);
     $taxonomies = $post_type_obj->taxonomies;
 }
 // Clean up our taxonomies for use in the query.
 if (count($taxonomies)) {
     foreach ($taxonomies as $k => $v) {
         $taxonomies[$k] = trim($v);
     }
 }
 // Determine which terms we're going to relate to this entry.
 $related_terms = array();
 foreach ($taxonomies as $t) {
     $terms = get_the_terms($post->ID, $t);
     if (!empty($terms)) {
         foreach ($terms as $k => $v) {
             $related_terms[$t][$v->term_id] = $v->slug;
         }
     }
 }
 $specific_terms = array();
 foreach ($related_terms as $k => $v) {
     foreach ($v as $i => $j) {
         $specific_terms[] = $j;
     }
 }
 $query_args = array('limit' => $atts['limit'], 'post_type' => $post_type, 'taxonomies' => $taxonomies_string, 'specific_terms' => $specific_terms, 'order' => 'DESC', 'orderby' => 'date', 'exclude' => array($post->ID));
 $posts = woo_get_posts_by_taxonomy($query_args);
 if (count((array) $posts)) {
     $output .= '<div class="' . $css_class . '">' . "\n";
     $output .= '<ul>' . "\n";
     foreach ($posts as $post) {
         setup_postdata($post);
Beispiel #9
0
/**
 * Retrieve archive link content based on predefined or custom code.
 *
 * The format can be one of four styles. The 'link' for head element, 'option'
 * for use in the select element, 'html' for use in list (either ol or ul HTML
 * elements). Custom content is also supported using the before and after
 * parameters.
 *
 * The 'link' format uses the link HTML element with the <em>archives</em>
 * relationship. The before and after parameters are not used. The text
 * parameter is used to describe the link.
 *
 * The 'option' format uses the option HTML element for use in select element.
 * The value is the url parameter and the before and after parameters are used
 * between the text description.
 *
 * The 'html' format, which is the default, uses the li HTML element for use in
 * the list HTML elements. The before parameter is before the link and the after
 * parameter is after the closing link.
 *
 * The custom format uses the before parameter before the link ('a' HTML
 * element) and the after parameter after the closing link tag. If the above
 * three values for the format are not used, then custom format is assumed.
 *
 * @since 1.0.0
 *
 * @param string $url URL to archive.
 * @param string $text Archive text description.
 * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
 * @param string $before Optional.
 * @param string $after Optional.
 * @return string HTML link content for archive.
 */
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '')
{
    $text = nxttexturize($text);
    $title_text = esc_attr($text);
    $url = esc_url($url);
    if ('link' == $format) {
        $link_html = "\t<link rel='archives' title='{$title_text}' href='{$url}' />\n";
    } elseif ('option' == $format) {
        $link_html = "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        $link_html = "\t<li>{$before}<a href='{$url}' title='{$title_text}'>{$text}</a>{$after}</li>\n";
    } else {
        // custom
        $link_html = "\t{$before}<a href='{$url}' title='{$title_text}'>{$text}</a>{$after}\n";
    }
    $link_html = apply_filters('get_archives_link', $link_html);
    return $link_html;
}
Beispiel #10
0
/**
 * Generates and displays the RDF for the trackback information of current post.
 *
 * Deprecated in 3.0.0, and restored in 3.0.1.
 *
 * @since 0.71
 *
 * @param int $deprecated Not used (Was $timezone = 0)
 */
function trackback_rdf($deprecated = '')
{
    if (!empty($deprecated)) {
        _deprecated_argument(__FUNCTION__, '2.5');
    }
    if (false !== stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
        return;
    }
    echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
			xmlns:dc="http://purl.org/dc/elements/1.1/"
			xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
		<rdf:Description rdf:about="';
    the_permalink();
    echo '"' . "\n";
    echo '    dc:identifier="';
    the_permalink();
    echo '"' . "\n";
    echo '    dc:title="' . str_replace('--', '&#x2d;&#x2d;', nxttexturize(strip_tags(get_the_title()))) . '"' . "\n";
    echo '    trackback:ping="' . get_trackback_url() . '"' . " />\n";
    echo '</rdf:RDF>';
}
Beispiel #11
0
function _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup = true, $translate = true)
{
    //Translate fields
    if ($translate && !empty($plugin_data['TextDomain'])) {
        if (!empty($plugin_data['DomainPath'])) {
            load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file) . $plugin_data['DomainPath']);
        } else {
            load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file));
        }
        foreach (array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field) {
            $plugin_data[$field] = translate($plugin_data[$field], $plugin_data['TextDomain']);
        }
    }
    $plugins_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
    $plugin_data['AuthorName'] = $plugin_data['Author'] = nxt_kses($plugin_data['Author'], $plugins_allowedtags);
    //Apply Markup
    if ($markup) {
        if (!empty($plugin_data['PluginURI']) && !empty($plugin_data['Name'])) {
            $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . esc_attr__('Visit plugin homepage') . '">' . $plugin_data['Name'] . '</a>';
        } else {
            $plugin_data['Title'] = $plugin_data['Name'];
        }
        if (!empty($plugin_data['AuthorURI']) && !empty($plugin_data['Author'])) {
            $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . esc_attr__('Visit author homepage') . '">' . $plugin_data['Author'] . '</a>';
        }
        $plugin_data['Description'] = nxttexturize($plugin_data['Description']);
        if (!empty($plugin_data['Author'])) {
            $plugin_data['Description'] .= ' <cite>' . sprintf(__('By %s'), $plugin_data['Author']) . '.</cite>';
        }
    }
    // Sanitize all displayed data. Author and AuthorName sanitized above.
    $plugin_data['Title'] = nxt_kses($plugin_data['Title'], $plugins_allowedtags);
    $plugin_data['Version'] = nxt_kses($plugin_data['Version'], $plugins_allowedtags);
    $plugin_data['Description'] = nxt_kses($plugin_data['Description'], $plugins_allowedtags);
    $plugin_data['Name'] = nxt_kses($plugin_data['Name'], $plugins_allowedtags);
    return $plugin_data;
}