Example #1
0
function spg_clean_data()
{
    $easymedia_values = get_option('easy_media_opt');
    if (is_array($easymedia_values) && array_key_exists($name, $easymedia_values)) {
        $keepornot = $easymedia_values['easymedia_disen_databk'];
    }
    if ($keepornot != '1') {
        //$wpdb->query("DELETE FROM `wp_options` WHERE `option_name` LIKE 'emediagallery_%'");
        delete_option('easy_media_opt');
        // Remove plugin-specific custom post type entries.
        $posts = get_posts(array('numberposts' => -1, 'post_type' => 'easymediagallery', 'post_status' => 'any'));
        foreach ($posts as $post) {
            wp_delete_post($post->ID, true);
        }
        // Remove plugin-specific custom taxonomies and terms.
        $tax = 'emediagallery';
        if (is_taxonomy($tax)) {
            foreach ($tax as $taxonomy) {
                $terms = get_terms($taxonomy, array('get ' => 'all'));
                foreach ($terms as $term) {
                    wp_delete_term($term->term_id, $taxonomy);
                }
                unset($wp_taxonomies[$taxonomy]);
            }
        }
    } else {
    }
}
Example #2
0
function p2_body_class()
{
    if (is_taxonomy('mentions')) {
        return body_class('mentions');
    }
    return body_class();
}
Example #3
0
 function __construct()
 {
     global $pagenow;
     // Load plugin options
     $this->load_options();
     // Register new taxonomy so that we can store all our authors
     if (!is_taxonomy($this->coauthor_taxonomy)) {
         register_taxonomy($this->coauthor_taxonomy, 'post', array('hierarchical' => false, 'update_count_callback' => '_update_post_term_count', 'label' => false, 'query_var' => false, 'rewrite' => false, 'sort' => true));
     }
     // Modify SQL queries to include coauthors
     add_filter('posts_where', array(&$this, 'posts_where_filter'));
     add_filter('posts_join', array(&$this, 'posts_join_filter'));
     add_filter('posts_groupby', array(&$this, 'posts_groupby_filter'));
     // Hooks to add additional coauthors to author column to Edit Posts page
     if ($pagenow == 'edit.php') {
         add_filter('manage_posts_columns', array(&$this, '_filter_manage_posts_columns'));
         add_action('manage_posts_custom_column', array(&$this, '_filter_manage_posts_custom_column'));
     }
     // Action to set users when a post is saved
     //add_action('edit_post', array(&$this, 'coauthors_update_post'));
     add_action('save_post', array(&$this, 'coauthors_update_post'));
     // Action to reassign posts when a user is deleted
     add_action('delete_user', array(&$this, 'delete_user_action'));
     // Action to set up author auto-suggest
     add_action('wp_ajax_coauthors_ajax_suggest', array(&$this, 'ajax_suggest'));
     // Filter to allow coauthors to edit posts
     add_filter('user_has_cap', array(&$this, 'add_coauthor_cap'), 10, 3);
     add_filter('comment_notification_headers', array(&$this, 'notify_coauthors'), 10, 3);
     // Add the main JS script and CSS file
     if (get_bloginfo('version') >= 2.8) {
         // Using WordPress 2.8, are we?
         add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));
     } else {
         // Pfft, you're old school
         add_action('admin_print_scripts', array(&$this, 'enqueue_scripts_legacy'));
     }
     // Add necessary JS variables
     add_action('admin_print_scripts', array(&$this, 'js_vars'));
 }
Example #4
0
function spg_clean_data()
{
    if (easy_gt_option('easymedia_disen_databk') != '1') {
        delete_option('easy_media_opt');
        // Remove plugin-specific custom post type entries.
        $posts = get_posts(array('numberposts' => -1, 'post_type' => 'easymediagallery', 'post_status' => 'any'));
        foreach ($posts as $post) {
            wp_delete_post($post->ID, true);
        }
        // Remove plugin-specific custom taxonomies and terms ( not work ).
        $tax = 'emediagallery';
        if (is_taxonomy($tax)) {
            foreach ($tax as $taxonomy) {
                $terms = get_terms($taxonomy, array('get ' => 'all'));
                foreach ($terms as $term) {
                    wp_delete_term($term->term_id, $taxonomy);
                }
                unset($wp_taxonomies[$taxonomy]);
            }
        }
        delete_option('easy_media_opt');
    }
}
/**
 * Universal Feed Link Generator
 * @see     wp-includes/rewrite.php, wp-includes/taxonomy.php, wp-includes/feed.php
 * @see     wp-includes/link-template.php: get_category_feed_link
 * @uses    get_term_by, is_taxonomy, get_default_feed, get_option, add_query_arg, 
 *          get_category_permastruct, get_tag_permastruct, get_category_parents
 *          user_trailingslashit, trailingslashit
 * @param   string          custom feed name or taxonomy
 * @param   int             only needed for some feeds
 * @global  object          url rewriter
 * @return  string          full url
 */
function tFeedLink($feed = '', $id = false)
{
    $taxonomy = '';
    $term = '';
    if ($id && is_taxonomy($feed)) {
        $taxonomy = $feed;
        $term = get_term_by('id', $id, $taxonomy);
    }
    global $wp_rewrite;
    if (empty($feed)) {
        $feed = get_default_feed();
    }
    if (get_option('permalink_structure') == '') {
        # no wp-rewrite
        $link = add_query_arg(array('feed' => $feed, $taxonomy => $term), get_bloginfo('url'));
    } elseif ($feed == 'category' || $feed == 'tag') {
        if (!empty($term)) {
            $link = $taxonomy == 'category' ? $wp_rewrite->get_category_permastruct() : $wp_rewrite->get_tag_permastruct();
            $slug = $term->slug;
            if ($taxonomy == 'category') {
                if ($term->parent != 0) {
                    $slug = get_category_parents($term->parent, false, '/', true) . $slug;
                }
                $link = str_replace('%category%', $slug, $link);
            } elseif ($taxonomy == 'post_tag') {
                $link = str_replace('%tag%', $slug, $link);
            }
            $feed = user_trailingslashit('feed' . ($feed != get_default_feed() && $feed != $taxonomy ? '/' . $feed : ''), 'feed');
            $link = trailingslashit(get_bloginfo('url') . $link) . $feed;
        }
    } elseif ($feed == 'work' || $feed == 'writing') {
    } elseif ($feed == 'comments') {
    }
    $link = apply_filters('t_term__link', $link, $feed);
    return $link;
}
function query_content($args = array())
{
    global $hmcontent;
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    hook_filter('before_query_content', $args);
    hook_action('query_content');
    if (!is_array($args)) {
        parse_str($args, $args);
    }
    /** Lọc theo content_key */
    if (isset($args['content_key'])) {
        /** Nếu yêu cầu content key thì lấy các id có key như query yêu cầu */
        $content_key = $args['content_key'];
        /** Nếu content key là một mảng */
        if (is_array($content_key)) {
            $where_key = '';
            $i = 0;
            foreach ($content_key as $key) {
                if ($i == 0) {
                    $where_key .= " `key` = '" . $key . "' ";
                } else {
                    $where_key .= " OR `key` = '" . $key . "' ";
                }
                $i++;
            }
            $where_content_key = "WHERE " . $where_key;
        } else {
            $where_content_key = "WHERE `key` = '" . $content_key . "'";
        }
    } else {
        /** Không yêu cầu content key, kiểm tra xem có đang ở template taxonomy không */
        if (is_taxonomy() == TRUE) {
            $taxonomy_id = get_id();
            $content_key = taxonomy_get_content_key($taxonomy_id);
            if ($content_key != FALSE) {
                $where_content_key = "WHERE `key` = '" . $content_key . "'";
            }
        } else {
            $where_content_key = '';
        }
    }
    $hmdb->Release();
    $query_content_key = "SELECT `id` FROM `" . DB_PREFIX . "content` " . $where_content_key;
    /** Lọc theo taxonomy */
    $where_taxonomy = '';
    if (isset($args['taxonomy'])) {
        /** Nếu yêu cầu trong một taxonomy nhất định thì lấy các object_id có relationship như query yêu cầu */
        $taxonomy_id = $args['taxonomy'];
        /** Nếu taxonomy là một mảng */
        if (is_array($taxonomy_id)) {
            $implode = implode($taxonomy_id, ',');
            if ($implode != '') {
                $where_taxonomy = ' WHERE `target_id` IN (' . $implode . ') ';
            }
        } else {
            $where_taxonomy = 'WHERE `target_id` = ' . $taxonomy_id;
        }
    } else {
        /** Không yêu cầu taxonomy nhất định, kiểm tra xem có đang ở template taxonomy không */
        if (is_taxonomy() == TRUE) {
            $taxonomy_id = get_id();
            $where_taxonomy = 'WHERE `target_id` = ' . $taxonomy_id;
        }
    }
    if ($where_taxonomy != '') {
        $hmdb->Release();
        $query_in_taxonomy = "SELECT `object_id` FROM `" . DB_PREFIX . "relationship` " . $where_taxonomy . " AND `relationship` = 'contax'";
    }
    /** Lọc theo field */
    if (isset($args['field_query'])) {
        $field_query = $args['field_query'];
    } else {
        $field_query = array(array('field' => 'status', 'compare' => '=', 'value' => 'public'), array('field' => 'public_time', 'compare' => '<=', 'value' => time()));
    }
    $all_field_query = array();
    foreach ($field_query as $item) {
        /** check đủ điều kiện tạo field query */
        if (isset($item['field']) and isset($item['compare']) and isset($item['value'])) {
            $field = $item['field'];
            $compare = $item['compare'];
            $value = $item['value'];
            $numerically = FALSE;
            /** build query */
            if (is_numeric($value)) {
                $value_query = $value;
            } else {
                $value_query = "'{$value}'";
            }
            if ($compare == 'like%') {
                $all_field_query[$field] = " ( `name` = '{$field}' AND `val` LIKE '%{$value}%' )";
            } else {
                $all_field_query[$field] = " ( `name` = '{$field}' AND `val` {$compare} {$value_query} )";
            }
        }
    }
    /** nếu size của mảng chứa các kết quả của các field query >= 2 */
    $size = sizeof($all_field_query);
    $query_field = "SELECT `object_id` FROM `" . DB_PREFIX . "field` WHERE";
    if ($size > 1) {
        if (isset($args['field_query_relation'])) {
            $field_query_relation = $args['field_query_relation'];
        } else {
            $field_query_relation = 'and';
        }
        switch ($field_query_relation) {
            case 'or':
                $i = 0;
                foreach ($all_field_query as $single_field_query) {
                    if ($i == 0) {
                        $query_field .= " " . $single_field_query . " ";
                    } else {
                        $query_field .= " OR " . $single_field_query . " ";
                    }
                    $i++;
                }
                break;
            case 'and':
                $i = 0;
                foreach ($all_field_query as $single_field_query) {
                    if ($i == 0) {
                        $query_field .= " " . $single_field_query . " ";
                    } else {
                        $query_field .= " OR " . $single_field_query . " ";
                    }
                    $i++;
                }
                $query_field .= " GROUP BY  `object_id`  HAVING COUNT(*) = {$size} ";
                break;
        }
        /** 
         * Đưa ra kết quả dựa trên mối quan hệ giữa các field query ( field_query_relation )
         * ( thỏa mãn tất cả các field query hay chỉ cần đáp ứng được 1 trong những field query )
         */
    } else {
        $query_field = $query_field . array_shift(array_values($all_field_query));
    }
    /** Kiểm tra yêu cầu kết hợp kết quả từ content key, in taxonomy, field query là tất cả hay chỉ 1 */
    if (isset($args['join'])) {
        $join = $args['join'];
    } else {
        $join = 'and';
    }
    $query_join = '';
    switch ($join) {
        case 'or':
            if ($query_content_key) {
                $query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
            }
            if ($query_in_taxonomy) {
                $query_join .= " OR `object_id` IN (" . $query_in_taxonomy . ") ";
            }
            $query_join .= " OR `object_id` IN (" . $query_field . ") ";
            break;
        case 'and':
            if ($query_content_key) {
                $query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
            }
            if ($query_in_taxonomy) {
                $query_join .= " AND `object_id` IN (" . $query_in_taxonomy . ") ";
            }
            $query_join .= " AND `object_id` IN (" . $query_field . ") ";
            break;
        default:
            if ($query_content_key) {
                $query_join .= " AND `object_id` IN (" . $query_content_key . ") ";
            }
            if ($query_in_taxonomy) {
                $query_join .= " AND `object_id` IN (" . $query_in_taxonomy . ") ";
            }
            $query_join .= " AND `object_id` IN (" . $query_field . ") ";
    }
    /** Kết thúc các query lấy các content id thỏa mãn yêu cầu */
    /** Order theo 1 field  và limit */
    if (isset($args['order'])) {
        $order_by = $args['order'];
    } else {
        $order_by = 'public_time,desc,number';
    }
    if (isset($args['limit'])) {
        $limit = $args['limit'];
    } else {
        $limit = get_option(array('section' => 'system_setting', 'key' => 'post_per_page', 'default_value' => '12'));
    }
    if (isset($args['offset']) and is_numeric($args['offset'])) {
        $offset = $args['offset'];
    } else {
        $offset = 0;
    }
    if (isset($args['paged'])) {
        $paged = $args['paged'];
    } else {
        $paged = get_current_pagination();
    }
    $paged = $paged - 1;
    if ($paged < 0) {
        $paged = 0;
    }
    /** Tạo query ORDER */
    $ex = explode(',', $order_by);
    $ex = array_map("trim", $ex);
    $order_field = $ex[0];
    $order = strtoupper($ex[1]);
    if (isset($ex[2])) {
        $numerically = $ex[2];
    } else {
        $numerically = FALSE;
    }
    if ($numerically == 'number') {
        $order_query = " AND `name` = '" . $order_field . "' ORDER BY CAST(val AS unsigned) " . $order . " ";
    } else {
        $order_query = " AND `name` = '" . $order_field . "' ORDER BY `val` " . $order . " ";
    }
    /** Tạo query LIMIT */
    if (is_numeric($limit)) {
        $limit_query = " LIMIT {$limit} ";
    } else {
        $limit_query = '';
    }
    /** Tạo query OFFSET */
    if ($limit == FALSE) {
        $offset_query = '';
    } else {
        $offset_query_page = $paged * $limit;
        $offset_query_page = $offset_query_page + $offset;
        $offset_query = " OFFSET {$offset_query_page} ";
    }
    /** Tạo câu lệnh select từ chuỗi các id thỏa mãn */
    $result = array();
    $sql = "SELECT `object_id`" . " FROM `" . DB_PREFIX . "field`" . " WHERE `object_type` = 'content'" . " " . $query_join . " " . " " . $order_query . " ";
    $hmdb->Query($sql);
    $total_result = $hmdb->RowCount();
    $sql = "SELECT `object_id`" . " FROM `" . DB_PREFIX . "field`" . " WHERE `object_type` = 'content'" . " " . $query_join . " " . " " . $order_query . " " . $limit_query . " " . $offset_query . " ";
    $hmdb->Query($sql);
    $base = get_current_uri();
    if ($base == '') {
        $base = '/';
    }
    $hmcontent->set_val(array('key' => 'total_result', 'val' => $total_result));
    $hmcontent->set_val(array('key' => 'paged', 'val' => $paged + 1));
    $hmcontent->set_val(array('key' => 'perpage', 'val' => $limit));
    $hmcontent->set_val(array('key' => 'base', 'val' => $base));
    while ($row = $hmdb->Row()) {
        $result[] = $row->object_id;
    }
    return $result;
}
Example #7
0
 /**
  * Extended get_terms function support
  *  - Limit category
  *  - Limit days
  *  - Selection restrict
  *  - Min usage
  *
  * @param string|array $taxonomies
  * @param string $args
  * @return array
  */
 function getTerms($taxonomies, $args = '', $skip_cache = false)
 {
     global $wpdb;
     $single_taxonomy = false;
     if (!is_array($taxonomies)) {
         $single_taxonomy = true;
         $taxonomies = array($taxonomies);
     }
     foreach ((array) $taxonomies as $taxonomy) {
         if (!is_taxonomy($taxonomy)) {
             return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
         }
     }
     $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
     $defaults = array('cloud_selection' => 'count-desc', 'hide_empty' => true, 'exclude' => '', 'include' => '', 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'st_name_like' => '', 'pad_counts' => false, 'limit_days' => 0, 'category' => 0, 'min_usage' => 0);
     $args = wp_parse_args($args, $defaults);
     if (!$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) || '' != $args['parent']) {
         $args['child_of'] = 0;
         $args['hierarchical'] = false;
         $args['pad_counts'] = false;
     }
     if ('all' == $args['get']) {
         $args['child_of'] = 0;
         $args['hide_empty'] = 0;
         $args['hierarchical'] = false;
         $args['pad_counts'] = false;
     }
     extract($args, EXTR_SKIP);
     if ($child_of) {
         $hierarchy = _get_term_hierarchy($taxonomies[0]);
         if (!isset($hierarchy[$child_of])) {
             return array();
         }
     }
     if ($parent) {
         $hierarchy = _get_term_hierarchy($taxonomies[0]);
         if (!isset($hierarchy[$parent])) {
             return array();
         }
     }
     if ($skip_cache != true) {
         // Get cache if exist
         $key = md5(serialize($args) . serialize($taxonomies));
         if ($cache = wp_cache_get('get_terms', 'terms')) {
             if (isset($cache[$key])) {
                 return apply_filters('get_terms', $cache[$key], $taxonomies, $args);
             }
         }
     }
     // Restrict category
     $category_sql = '';
     if (!empty($category) && $category != '0') {
         $incategories = preg_split('/[\\s,]+/', $category);
         $objects_id = get_objects_in_term($incategories, 'category');
         $objects_id = array_unique($objects_id);
         // to be sure haven't duplicates
         if (empty($objects_id)) {
             // No posts for this category = no tags for this category
             return array();
         }
         foreach ((array) $objects_id as $object_id) {
             $category_sql .= "'" . $object_id . "', ";
         }
         $category_sql = substr($category_sql, 0, strlen($category_sql) - 2);
         // Remove latest ", "
         $category_sql = 'AND p.ID IN (' . $category_sql . ')';
     }
     // count-asc/count-desc/name-asc/name-desc/random
     $cloud_selection = strtolower($cloud_selection);
     switch ($cloud_selection) {
         case 'count-asc':
             $order_by = 'tt.count ASC';
             break;
         case 'random':
             $order_by = 'RAND()';
             break;
         case 'name-asc':
             $order_by = 't.name ASC';
             break;
         case 'name-desc':
             $order_by = 't.name DESC';
             break;
         default:
             // count-desc
             $order_by = 'tt.count DESC';
             break;
     }
     // Min usage
     $restict_usage = '';
     $min_usage = (int) $min_usage;
     if ($min_usage != 0) {
         $restict_usage = ' AND tt.count >= ' . $min_usage;
     }
     $where = '';
     $inclusions = '';
     if (!empty($include)) {
         $exclude = '';
         $interms = preg_split('/[\\s,]+/', $include);
         foreach ((array) $interms as $interm) {
             if (empty($inclusions)) {
                 $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
             } else {
                 $inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
             }
         }
     }
     if (!empty($inclusions)) {
         $inclusions .= ')';
     }
     $where .= $inclusions;
     $exclusions = '';
     if (!empty($exclude)) {
         $exterms = preg_split('/[\\s,]+/', $exclude);
         foreach ((array) $exterms as $exterm) {
             if (empty($exclusions)) {
                 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
             } else {
                 $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
             }
         }
     }
     if (!empty($exclusions)) {
         $exclusions .= ')';
     }
     $exclusions = apply_filters('list_terms_exclusions', $exclusions, $args);
     $where .= $exclusions;
     if (!empty($slug)) {
         $slug = sanitize_title($slug);
         $where .= " AND t.slug = '{$slug}'";
     }
     if (!empty($name__like)) {
         $where .= " AND t.name LIKE '{$name__like}%'";
     }
     if (strpos($st_name_like, ' ') != false || strpos($st_name_like, ' ') != null) {
         $tmp = '';
         $sts = explode(' ', $st_name_like);
         foreach ((array) $sts as $st) {
             if (empty($st)) {
                 continue;
             }
             $st = addslashes_gpc($st);
             $tmp .= " t.name LIKE '%{$st}%' OR ";
         }
         // Remove latest OR
         $tmp = substr($tmp, 0, strlen($tmp) - 4);
         $where .= " AND ( {$tmp} ) ";
         unset($tmp);
     } elseif (!empty($st_name_like)) {
         $where .= " AND t.name LIKE '%{$st_name_like}%'";
     }
     if ('' != $parent) {
         $parent = (int) $parent;
         $where .= " AND tt.parent = '{$parent}'";
     }
     if ($hide_empty && !$hierarchical) {
         $where .= ' AND tt.count > 0';
     }
     $number_sql = '';
     if (strpos($number, ',') != false || strpos($number, ',') != null) {
         $number_sql = $number;
     } else {
         $number = (int) $number;
         if ($number != 0) {
             $number_sql = 'LIMIT ' . $number;
         }
     }
     if ('all' == $fields) {
         $select_this = 't.*, tt.*';
     } else {
         if ('ids' == $fields) {
             $select_this = 't.term_id';
         } else {
             if ('names' == $fields) {
                 $select_this == 't.name';
             }
         }
     }
     // Limit posts date
     $limitdays_sql = '';
     $limit_days = (int) $limit_days;
     if ($limit_days != 0) {
         $limitdays_sql = 'AND p.post_date > "' . date('Y-m-d H:i:s', time() - $limit_days * 86400) . '"';
     }
     // Join posts ?
     $inner_posts = '';
     if (!empty($limitdays_sql) | !empty($category_sql)) {
         $inner_posts = "\r\n\t\t\t\tINNER JOIN {$wpdb->term_relationships} AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id\r\n\t\t\t\tINNER JOIN {$wpdb->posts} AS p ON tr.object_id = p.ID";
     }
     $query = "SELECT DISTINCT {$select_this}\r\n\t\t\tFROM {$wpdb->terms} AS t\r\n\t\t\tINNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id\r\n\t\t\t{$inner_posts}\r\n\t\t\tWHERE tt.taxonomy IN ( {$in_taxonomies} )\r\n\t\t\t{$limitdays_sql}\r\n\t\t\t{$category_sql}\r\n\t\t\t{$where}\r\n\t\t\t{$restict_usage}\r\n\t\t\tORDER BY {$order_by}\r\n\t\t\t{$number_sql}";
     if ('all' == $fields) {
         $terms = $wpdb->get_results($query);
         if ($skip_cache != true) {
             update_term_cache($terms);
         }
     } elseif ('ids' == $fields) {
         $terms = $wpdb->get_col($query);
     }
     if (empty($terms)) {
         return array();
     }
     if ($child_of || $hierarchical) {
         $children = _get_term_hierarchy($taxonomies[0]);
         if (!empty($children)) {
             $terms =& _get_term_children($child_of, $terms, $taxonomies[0]);
         }
     }
     // Update term counts to include children.
     if ($pad_counts) {
         _pad_term_counts($terms, $taxonomies[0]);
     }
     // Make sure we show empty categories that have children.
     if ($hierarchical && $hide_empty) {
         foreach ((array) $terms as $k => $term) {
             if (!$term->count) {
                 $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
                 foreach ((array) $children as $child) {
                     if ($child->count) {
                         continue 2;
                     }
                 }
                 // It really is empty
                 unset($terms[$k]);
             }
         }
     }
     reset($terms);
     if ($skip_cache != true) {
         $cache[$key] = $terms;
         wp_cache_set('get_terms', $cache, 'terms');
     }
     $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
     return $terms;
 }
Example #8
0
   <!--/#navigation--><!--menu-end-here-->
<!--------------------------
Added for New Header end
--------------------------->


<!--Added for Breadcum Start -->
<?php 
if (!is_page('home')) {
    ?>
<div class="container">
  <!--breadcrumb-start-->
  <div class="well gap30">
  <div class="row">
  <div class="<?php 
    if (is_taxonomy('product_cat')) {
        ?>
col-md-7<?php 
    } else {
        ?>
col-md-12<?php 
    }
    ?>
"> <ol class="breadcrumb">
  
  <li typeof="v:Breadcrumb"><a href="<?php 
    echo get_option('siteurl');
    ?>
" title="Go to ." property="v:title" rel="v:url">Home</a></li>
    <?php 
    if (function_exists('bcn_display')) {
<?php

/**
 * Edit Tags Administration Panel.
 *
 * @package WordPress
 * @subpackage Administration
 */
/** WordPress Administration Bootstrap */
require_once 'admin.php';
$title = __('Tags');
wp_reset_vars(array('action', 'tag', 'taxonomy'));
if (empty($taxonomy)) {
    $taxonomy = 'post_tag';
}
if (!is_taxonomy($taxonomy)) {
    wp_die(__('Invalid taxonomy'));
}
$parent_file = 'edit.php';
$submenu_file = "edit-tags.php?taxonomy={$taxonomy}";
if (isset($_GET['action']) && isset($_GET['delete_tags']) && ('delete' == $_GET['action'] || 'delete' == $_GET['action2'])) {
    $action = 'bulk-delete';
}
switch ($action) {
    case 'add-tag':
        check_admin_referer('add-tag');
        if (!current_user_can('manage_categories')) {
            wp_die(__('Cheatin&#8217; uh?'));
        }
        $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST);
        if ($ret && !is_wp_error($ret)) {
	/**
	 * Extended get_terms function support
	 * - Limit category
	 * - Limit days
	 * - Selection restrict
	 * - Min usage
	 *
	 * @param string|array $taxonomies
	 * @param string $args
	 * @return array
	 */
	function getTerms( $taxonomies, $args = '', $skip_cache = false, $internal_st = false ) {
		global $wpdb;
		$empty_array = array();

		$single_taxonomy = false;
		if ( !is_array($taxonomies) ) {
			$single_taxonomy = true;
			$taxonomies = array($taxonomies);
		}

		foreach ( $taxonomies as $taxonomy ) {
			if ( ! is_taxonomy($taxonomy) ) {
				return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
			}
		}

		$in_taxonomies = "'" . implode("', '", $taxonomies) . "'";

		$defaults = array(
			'orderby' => 'name',
			'order' => 'ASC',
			'cloud_selection' => 'count-desc',
			'hide_empty' => true,
			'exclude' => '',
			'include' => '',
			'number' => '',
			'fields' => 'all',
			'slug' => '',
			'parent' => '',
			'hierarchical' => true,
			'child_of' => 0,
			'get' => '',
			'name__like' => '',
			'st_name_like' => '',
			'pad_counts' => false,
			'offset' => '',
			'search' => '',
			'limit_days' => 0,
			'category' => 0,
			'min_usage' => 0
		);

		$args = wp_parse_args( $args, $defaults );
		if ( $internal_st != true ) { // Allow limit :)
			$args['number'] = absint( $args['number'] );
		}
		$args['offset'] = absint( $args['offset'] );
		if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) || '' != $args['parent'] ) {
			$args['child_of'] = 0;
			$args['hierarchical'] = false;
			$args['pad_counts'] = false;
		}

		if ( 'all' == $args['get'] ) {
			$args['child_of'] = 0;
			$args['hide_empty'] = 0;
			$args['hierarchical'] = false;
			$args['pad_counts'] = false;
		}
		extract($args, EXTR_SKIP);

		if ( $child_of ) {
			$hierarchy = _get_term_hierarchy($taxonomies[0]);
			if ( !isset($hierarchy[$child_of]) )
				return $empty_array;
		}

		if ( $parent ) {
			$hierarchy = _get_term_hierarchy($taxonomies[0]);
			if ( !isset($hierarchy[$parent]) )
				return $empty_array;
		}
		
		if ( $skip_cache != true ) {
			// $args can be whatever, only use the args defined in defaults to compute the key
			$filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
			$key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
			$last_changed = wp_cache_get('last_changed', 'terms');
			if ( !$last_changed ) {
			    $last_changed = time();
			    wp_cache_set('last_changed', $last_changed, 'terms');
			}
			$cache_key = "get_terms:$key:$last_changed";
			
			if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) {
			    $terms = apply_filters('get_terms', $cache, $taxonomies, $args);
			    return $terms;
			}
		}

		// Restrict category
		$category_sql = '';
		if ( !empty($category) && $category != '0' ) {
			$incategories = preg_split('/[\s,]+/', $category);

			$objects_id = get_objects_in_term( $incategories, 'category' );
			$objects_id = array_unique ($objects_id); // to be sure haven't duplicates

			if ( empty($objects_id) ) { // No posts for this category = no tags for this category
				return array();
			}

			foreach ( (array) $objects_id as $object_id ) {
				$category_sql .= "'". $object_id . "', ";
			}

			$category_sql = substr($category_sql, 0, strlen($category_sql) - 2); // Remove latest ", "
			$category_sql = 'AND p.ID IN ('.$category_sql.')';
		}

		// count-asc/count-desc/name-asc/name-desc/random
		$cloud_selection = strtolower($cloud_selection);
		switch ( $cloud_selection ) {
			case 'count-asc':
				$order_by = 'tt.count ASC';
				break;
			case 'random':
				$order_by = 'RAND()';
				break;
			case 'name-asc':
				$order_by = 't.name ASC';
				break;
			case 'name-desc':
				$order_by = 't.name DESC';
				break;
			default: // count-desc
			$order_by = 'tt.count DESC';
			break;
		}

		// Min usage
		$restict_usage = '';
		$min_usage = (int) $min_usage;
		if ( $min_usage != 0 ) {
			$restict_usage = ' AND tt.count >= '. $min_usage;
		}

		$where = '';
		$inclusions = '';
		if ( !empty($include) ) {
			$exclude = '';
			$interms = preg_split('/[\s,]+/',$include);
			foreach ( (array) $interms as $interm ) {
				if (empty($inclusions)) {
					$inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
				} else {
					$inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
				}
			}
		}

		if ( !empty($inclusions) ) {
			$inclusions .= ')';
		}
		$where .= $inclusions;

		$exclusions = '';
		if ( !empty($exclude) ) {
			$exterms = preg_split('/[\s,]+/',$exclude);
			foreach ( (array) $exterms as $exterm ) {
				if (empty($exclusions)) {
					$exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
				} else {
					$exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
				}
			}
		}

		if ( !empty($exclusions) ) {
			$exclusions .= ')';
		}
		$exclusions = apply_filters('list_terms_exclusions', $exclusions, $args );
		$where .= $exclusions;

		if ( !empty($slug) ) {
			$slug = sanitize_title($slug);
			$where .= " AND t.slug = '$slug'";
		}

		if ( !empty($name__like) ) {
			$where .= " AND t.name LIKE '{$name__like}%'";
		}

		if ( strpos($st_name_like, ' ') != false || strpos($st_name_like, ' ') != null ) {
			$tmp = '';
			$sts = explode(' ', $st_name_like);
			foreach ( (array) $sts as $st ) {
				if ( empty($st) )
				continue;

				$st = addslashes_gpc($st);
				$tmp .= " t.name LIKE '%{$st}%' OR ";
			}
			// Remove latest OR
			$tmp = substr( $tmp, 0, strlen($tmp) - 4);

			$where .= " AND ( $tmp ) ";
			unset($tmp)	;
		} elseif ( !empty($st_name_like) ) {
			$where .= " AND t.name LIKE '%{$st_name_like}%'";
		}

		if ( '' != $parent ) {
			$parent = (int) $parent;
			$where .= " AND tt.parent = '$parent'";
		}

		if ( $hide_empty && !$hierarchical ) {
			$where .= ' AND tt.count > 0';
		}

		$number_sql = '';
		if ( strpos($number, ',') != false || strpos($number, ',') != null ) {
			$number_sql = $number;
		} else {
			$number = (int) $number;
			if ( $number != 0 ) {
				$number_sql = 'LIMIT ' . $number;
			}
		}

		if ( !empty($search) ) {
			$search = like_escape($search);
			$where .= " AND (t.name LIKE '%$search%')";
		}

		$select_this = '';

		if ( 'all' == $fields ) {
			$select_this = 't.*, tt.*';
		} else if ( 'ids' == $fields ) {
 	        $select_this = 't.term_id, tt.parent, tt.count';
		} else if ( 'names' == $fields ) {
			$select_this = 't.term_id, tt.parent, tt.count, t.name';
		}

		// Limit posts date
		$limitdays_sql = '';
		$limit_days = (int) $limit_days;
		if ( $limit_days != 0 ) {
			$limitdays_sql = 'AND p.post_date_gmt > "' .date( 'Y-m-d H:i:s', time() - $limit_days * 86400 ). '"';
		}

		$query = "SELECT {$select_this}
			FROM {$wpdb->terms} AS t
			INNER JOIN {$wpdb->term_taxonomy} AS tt ON t.term_id = tt.term_id
			INNER JOIN {$wpdb->term_relationships} AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id
			INNER JOIN {$wpdb->posts} AS p ON tr.object_id = p.ID
			WHERE tt.taxonomy IN ( {$in_taxonomies} )
			AND p.post_date_gmt < '".current_time('mysql')."'
			{$limitdays_sql}
			{$category_sql}
			{$where}
			{$restict_usage}
			GROUP BY t.term_id
			ORDER BY {$order_by}
			{$number_sql}";
		
		if ( 'all' == $fields ) {
			$terms = $wpdb->get_results($query);
			if ( $skip_cache != true ) {
				update_term_cache($terms);
			}
		} else if ( ('ids' == $fields) || ('names' == $fields) ) {
			$terms = $wpdb->get_results($query);
		}

		if ( empty($terms) ) {
			$cache[ $key ] = array();
			wp_cache_set( 'get_terms', $cache, 'terms' );
			$terms = apply_filters('get_terms', array(), $taxonomies, $args);
			return $terms;
		}

		if ( $child_of ) {
		    $children = _get_term_hierarchy($taxonomies[0]);
		    if ( ! empty($children) )
		        $terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
		}

		// Update term counts to include children.
 	    if ( $pad_counts && 'all' == $fields )
	        _pad_term_counts($terms, $taxonomies[0]);

		// Make sure we show empty categories that have children.
		if ( $hierarchical && $hide_empty && is_array($terms) ) {
		    foreach ( $terms as $k => $term ) {
		        if ( ! $term->count ) {
		            $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
		            if( is_array($children) )
		                foreach ( $children as $child )
		                    if ( $child->count )
		                        continue 2;
		
		            // It really is empty
		            unset($terms[$k]);
		        }
		    }
		}
		reset ( $terms );
		
		$_terms = array();
		if ( 'ids' == $fields ) {
		    while ( $term = array_shift($terms) )
		        $_terms[] = $term->term_id;
		    $terms = $_terms;
		} elseif ( 'names' == $fields ) {
		    while ( $term = array_shift($terms) )
		        $_terms[] = $term->name;
		    $terms = $_terms;
		}
		
		if ( $skip_cache != true ) {
			wp_cache_add( $cache_key, $terms, 'terms' );
		}

		$terms = apply_filters('get_terms', $terms, $taxonomies, $args);
		return $terms;
	}
Example #11
0
function cwp_post_row($a_post, $pending_comments, $mode, $page)
{
    global $post;
    static $rowclass;
    $global_post = $post;
    $post = $a_post;
    setup_postdata($post);
    $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    $rowclass = apply_filters('cwp_post_row_class', $rowclass, $post, $page);
    global $current_user;
    $post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
    $edit_link = $page->get_edit_link($post->ID);
    $delete_link = add_query_arg('post', $post->ID, add_query_arg('action', 'delete', $page->get_page_url()));
    $trash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'trash', $page->get_page_url())), "trash-post_" . $post->ID);
    $untrash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'untrash', $page->get_page_url())), "untrash-post_" . $post->ID);
    $title = _draft_or_post_title();
    ?>
	<tr id='post-<?php 
    echo $post->ID;
    ?>
' class='<?php 
    echo trim($rowclass . ' author-' . $post_owner . ' status-' . $post->post_status);
    ?>
 iedit' valign="top">
	<?php 
    $posts_columns = get_column_headers('cwp_manage');
    $hidden = get_hidden_columns('edit');
    foreach ($posts_columns as $column_name => $column_display_name) {
        $class = "class=\"{$column_name} column-{$column_name}\"";
        $style = '';
        if (in_array($column_name, $hidden)) {
            $style = ' style="display:none;"';
        }
        $attributes = "{$class}{$style}";
        switch ($column_name) {
            case 'cb':
                ?>
		<th scope="row" class="check-column"><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    ?>
<input type="checkbox" name="post[]" value="<?php 
                    the_ID();
                    ?>
" /><?php 
                }
                ?>
</th>
		<?php 
                break;
            case 'date':
                if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) {
                    $t_time = $h_time = __('Unpublished');
                    $time_diff = 0;
                } else {
                    $t_time = get_the_time(__('Y/m/d g:i:s A'));
                    $m_time = $post->post_date;
                    $time = get_post_time('G', true, $post);
                    $time_diff = time() - $time;
                    if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                        $h_time = sprintf(__('%s ago'), human_time_diff($time));
                    } else {
                        $h_time = mysql2date(__('Y/m/d'), $m_time);
                    }
                }
                echo '<td ' . $attributes . '>';
                if ('excerpt' == $mode) {
                    echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
                } else {
                    echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
                }
                echo '<br />';
                if ('publish' == $post->post_status) {
                    _e('Published');
                } elseif ('future' == $post->post_status) {
                    if ($time_diff > 0) {
                        echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
                    } else {
                        _e('Scheduled');
                    }
                } else {
                    _e('Last Modified');
                }
                echo '</td>';
                break;
            case 'title':
                $attributes = 'class="post-title column-title"' . $style;
                ?>
		<td <?php 
                echo $attributes;
                ?>
><strong><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    ?>
<a class="row-title" href="<?php 
                    echo $edit_link;
                    ?>
" title="<?php 
                    echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title));
                    ?>
"><?php 
                    echo $title;
                    ?>
</a><?php 
                } else {
                    echo $title;
                }
                _post_states($post);
                ?>
</strong>
		<?php 
                if ('excerpt' == $mode) {
                    the_excerpt();
                }
                $actions = array();
                if (current_user_can('edit_post', $post->ID)) {
                    $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
                }
                if (current_user_can('delete_post', $post->ID)) {
                    if ('trash' == $post->post_status) {
                        $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . $untrash_link . "'>" . __('Restore') . "</a>";
                    } elseif (EMPTY_TRASH_DAYS) {
                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . $trash_link . "'>" . __('Trash') . "</a>";
                    }
                    if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url($delete_link, 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                    }
                }
                /*
                if ( current_user_can('delete_post', $post->ID) ) {
                	$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url($delete_link, 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                }
                */
                if (in_array($post->post_status, array('pending', 'draft'))) {
                    if (current_user_can('edit_post', $post->ID)) {
                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                    }
                } else {
                    $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                }
                $actions = apply_filters('post_row_actions', $actions, $post);
                $action_count = count($actions);
                $i = 0;
                echo '<div class="row-actions">';
                foreach ($actions as $action => $link) {
                    ++$i;
                    $i == $action_count ? $sep = '' : ($sep = ' | ');
                    echo "<span class='{$action}'>{$link}{$sep}</span>";
                }
                echo '</div>';
                get_inline_data($post);
                ?>
		</td>
		<?php 
                break;
            case 'categories':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                $categories = get_the_category();
                if (!empty($categories)) {
                    $out = array();
                    foreach ($categories as $c) {
                        $out[] = "<a href='edit.php?category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('Uncategorized');
                }
                ?>
</td>
		<?php 
                break;
            case 'tags':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                $tags = get_the_tags($post->ID);
                if (!empty($tags)) {
                    $out = array();
                    foreach ($tags as $c) {
                        $out[] = "<a href='edit.php?tag={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('No Tags');
                }
                ?>
</td>
		<?php 
                break;
            case 'comments':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><div class="post-com-count-wrapper">
		<?php 
                $pending_phrase = sprintf(__('%s pending'), number_format($pending_comments));
                if ($pending_comments) {
                    echo '<strong>';
                }
                comments_number("<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('%', 'comment count') . '</span></a>');
                if ($pending_comments) {
                    echo '</strong>';
                }
                ?>
		</div></td>
		<?php 
                break;
            case 'author':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><a href="edit.php?author=<?php 
                the_author_meta('ID');
                ?>
"><?php 
                the_author();
                ?>
</a></td>
		<?php 
                break;
            case 'control_view':
                ?>
		<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="view"><?php 
                _e('View');
                ?>
</a></td>
		<?php 
                break;
            case 'control_edit':
                ?>
		<td><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    echo "<a href='{$edit_link}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td>
		<?php 
                break;
            case 'control_delete':
                ?>
		<td><?php 
                if (current_user_can('delete_post', $post->ID)) {
                    echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$id}", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>";
                }
                ?>
</td>
		<?php 
                break;
            case is_taxonomy($column_name):
                ?>
			<td <?php 
                echo $attributes;
                ?>
><?php 
                $tags = wp_get_object_terms($post->ID, $column_name);
                if (!empty($tags)) {
                    $out = array();
                    foreach ($tags as $c) {
                        $out[] = "<a href=\"" . $page->get_edit_term_link($column_name, $c) . '">' . $c->name . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('No ' . $column_display_name);
                }
                ?>
</td>
			<?php 
                break;
            case function_exists($column_name):
                ?>
			
			<td>
			<?php 
                echo call_user_func_array($column_name, array($post));
                ?>
			</td>
			<?php 
                break;
            default:
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                do_action('manage_posts_custom_column', $column_name, $post->ID);
                ?>
</td>
		<?php 
                break;
        }
    }
    ?>
	</tr>
	<?php 
    $post = $global_post;
}
Example #12
0
">RSS</a>

			<?php 
} elseif (is_author()) {
    ?>
				
				<?php 
    printf(_c('Updates from %s|name', 'p2'), p2_get_archive_author());
    ?>
				<a class="rss" href="<?php 
    p2_author_feed_link();
    ?>
">RSS</a>
				
			<?php 
} elseif (is_taxonomy('mentions')) {
    ?>

				<?php 
    printf(_c('Posts Mentioning %s|name', 'p2'), p2_get_mention_name());
    ?>
				<a class="rss" href="<?php 
    p2_author_feed_link();
    ?>
">RSS</a>
		
			<?php 
} else {
    ?>
		
				<?php 
Example #13
0
 /**
  * Compatibility wrapper for WordPress taxonomy lookup.
  */
 function taxonomy_exists($taxonomy)
 {
     if (function_exists('taxonomy_exists')) {
         // 3.0 or later
         return taxonomy_exists($taxonomy);
     } else {
         return is_taxonomy($taxonomy);
     }
 }
Example #14
0
function wp_update_term($term, $taxonomy, $args = array())
{
    global $wpdb;
    if (!is_taxonomy($taxonomy)) {
        return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
    }
    $term_id = (int) $term;
    // First, get all of the original args
    $term = get_term($term_id, $taxonomy, ARRAY_A);
    // Escape data pulled from DB.
    $term = add_magic_quotes($term);
    // Merge old and new args with new args overwriting old ones.
    $args = array_merge($term, $args);
    $defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
    $args = wp_parse_args($args, $defaults);
    $args = sanitize_term($args, $taxonomy, 'db');
    extract($args, EXTR_SKIP);
    $empty_slug = false;
    if (empty($slug)) {
        $empty_slug = true;
        $slug = sanitize_title($name);
    }
    if ($alias_of) {
        $alias = $wpdb->fetch_row("SELECT term_id, term_group FROM {$wpdb->terms} WHERE slug = '{$alias_of}'");
        if ($alias->term_group) {
            // The alias we want is already in a group, so let's use that one.
            $term_group = $alias->term_group;
        } else {
            // The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
            $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM {$wpdb->terms} GROUP BY term_group") + 1;
            $wpdb->query("UPDATE {$wpdb->terms} SET term_group = {$term_group} WHERE term_id = {$alias->term_id}");
        }
    }
    // Check for duplicate slug
    $id = $wpdb->get_var("SELECT term_id FROM {$wpdb->terms} WHERE slug = '{$slug}'");
    if ($id && $id != $term_id) {
        // If an empty slug was passed, reset the slug to something unique.
        // Otherwise, bail.
        if ($empty_slug) {
            $slug = wp_unique_term_slug($slug, (object) $args);
        } else {
            return new WP_Error('duplicate_term_slug', sprintf(__('The slug "%s" is already in use by another term'), $slug));
        }
    }
    $wpdb->query("UPDATE {$wpdb->terms} SET name = '{$name}', slug = '{$slug}', term_group = '{$term_group}' WHERE term_id = '{$term_id}'");
    if (empty($slug)) {
        $slug = sanitize_title($name, $term_id);
        $wpdb->query("UPDATE {$wpdb->terms} SET slug = '{$slug}' WHERE term_id = '{$term_id}'");
    }
    $tt_id = $wpdb->get_var("SELECT tt.term_taxonomy_id FROM {$wpdb->term_taxonomy} AS tt INNER JOIN {$wpdb->terms} AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = '{$taxonomy}' AND t.term_id = {$term_id}");
    $wpdb->query("UPDATE {$wpdb->term_taxonomy} SET term_id = '{$term_id}', taxonomy = '{$taxonomy}', description = '{$description}', parent = '{$parent}' WHERE term_taxonomy_id = '{$tt_id}'");
    do_action("edit_term", $term_id, $tt_id);
    do_action("edit_{$taxonomy}", $term_id, $tt_id);
    $term_id = apply_filters('term_id_filter', $term_id, $tt_id);
    clean_term_cache($term_id, $taxonomy);
    do_action("edited_term", $term_id, $tt_id);
    do_action("edited_{$taxonomy}", $term_id, $tt_id);
    return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
}
Example #15
0
/**
 * Display or retrieve the HTML list of categories.
 *
 * The list of arguments is below:
 *     'show_option_all' (string) - Text to display for showing all categories.
 *     'orderby' (string) default is 'ID' - What column to use for ordering the
 * categories.
 *     'order' (string) default is 'ASC' - What direction to order categories.
 *     'show_last_update' (bool|int) default is 0 - See {@link
 * walk_category_dropdown_tree()}
 *     'show_count' (bool|int) default is 0 - Whether to show how many posts are
 * in the category.
 *     'hide_empty' (bool|int) default is 1 - Whether to hide categories that
 * don't have any posts attached to them.
 *     'use_desc_for_title' (bool|int) default is 1 - Whether to use the
 * description instead of the category title.
 *     'feed' - See {@link get_categories()}.
 *     'feed_type' - See {@link get_categories()}.
 *     'feed_image' - See {@link get_categories()}.
 *     'child_of' (int) default is 0 - See {@link get_categories()}.
 *     'exclude' (string) - See {@link get_categories()}.
 *     'exclude_tree' (string) - See {@link get_categories()}.
 *     'echo' (bool|int) default is 1 - Whether to display or retrieve content.
 *     'current_category' (int) - See {@link get_categories()}.
 *     'hierarchical' (bool) - See {@link get_categories()}.
 *     'title_li' (string) - See {@link get_categories()}.
 *     'depth' (int) - The max depth.
 *
 * @since 2.1.0
 *
 * @param string|array $args Optional. Override default arguments.
 * @return string HTML content only if 'echo' argument is 0.
 */
function wp_list_categories($args = '')
{
    $defaults = array('show_option_all' => '', 'show_option_none' => __('No categories'), 'orderby' => 'name', 'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0, 'hierarchical' => true, 'title_li' => __('Categories'), 'echo' => 1, 'depth' => 0, 'taxonomy' => 'category');
    $r = wp_parse_args($args, $defaults);
    if (!isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
        $r['pad_counts'] = true;
    }
    if (isset($r['show_date'])) {
        $r['include_last_update_time'] = $r['show_date'];
    }
    if (true == $r['hierarchical']) {
        $r['exclude_tree'] = $r['exclude'];
        $r['exclude'] = '';
    }
    if (!isset($r['class'])) {
        $r['class'] = 'category' == $r['taxonomy'] ? 'categories' : $r['taxonomy'];
    }
    extract($r);
    if (!is_taxonomy($taxonomy)) {
        return false;
    }
    $categories = get_categories($r);
    $output = '';
    if ($title_li && 'list' == $style) {
        $output = '<li class="' . $class . '">' . $title_li . '<ul>';
    }
    if (empty($categories)) {
        if (!empty($show_option_none)) {
            if ('list' == $style) {
                $output .= '<li>' . $show_option_none . '</li>';
            } else {
                $output .= $show_option_none;
            }
        }
    } else {
        global $wp_query;
        if (!empty($show_option_all)) {
            if ('list' == $style) {
                $output .= '<li><a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a></li>';
            } else {
                $output .= '<a href="' . get_bloginfo('url') . '">' . $show_option_all . '</a>';
            }
        }
        if (empty($r['current_category']) && (is_category() || is_tax())) {
            $r['current_category'] = $wp_query->get_queried_object_id();
        }
        if ($hierarchical) {
            $depth = $r['depth'];
        } else {
            $depth = -1;
        }
        // Flat.
        $output .= walk_category_tree($categories, $depth, $r);
    }
    if ($title_li && 'list' == $style) {
        $output .= '</ul></li>';
    }
    $output = apply_filters('wp_list_categories', $output);
    if ($echo) {
        echo $output;
    } else {
        return $output;
    }
}
Example #16
0
 function _get_current_taxonomy($instance)
 {
     if (!empty($instance['taxonomy']) && is_taxonomy($instance['taxonomy'])) {
         return $instance['taxonomy'];
     }
     return 'post_tag';
 }
			<?php 
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
    ?>
				<h1>Blog Archives</h1>
			<?php 
}
?>

		</div>
	</div>
	<div class="b2">
		<div class="cntr archive">
			<div class="content with-sidebar">

			<?php 
if (is_taxonomy('discography_categories')) {
    $args2 = array('show_option_all' => '', 'orderby' => 'name', 'order' => 'ASC', 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => 1, 'title_li' => __('Categories', 'eagle'), 'show_option_none' => __(' ', 'eagle'), 'number' => null, 'echo' => 1, 'depth' => 0, 'current_category' => 0, 'pad_counts' => 0, 'taxonomy' => 'discography_categories');
    echo wp_list_categories($args2);
    echo do_shortcode('[webbird-discography-category-listing]');
}
?>

			<?php 
if (have_posts()) {
    ?>

				<?php 
    while (have_posts()) {
        the_post();
        ?>
					<div <?php 
Example #18
0
 function _do_the_sync($data)
 {
     global $sitepress, $wpdb;
     if (isset($data['menu_translation']) && is_array($data['menu_translation'])) {
         foreach ($data['menu_translation'] as $menuinfo) {
             list($original_menu_id, $language, $menu_name) = explode('#', $menuinfo);
             $menu_name = urldecode($menu_name);
             $_POST['icl_translation_of'] = $original_menu_id;
             $_POST['icl_nav_menu_language'] = $language;
             $new_menu_id = wp_update_nav_menu_object(0, array('menu-name' => $menu_name));
             $new_menus[$original_menu_id][$language] = $new_menu_id;
         }
     }
     if (isset($data['del']) && is_array($data['del'])) {
         foreach ($data['del'] as $iteminfo) {
             list($menu_id, $item_id) = explode('#', $iteminfo);
             wp_delete_post($item_id, true);
         }
     }
     if (isset($data['add']) && is_array($data['add'])) {
         foreach ($data['add'] as $iteminfo) {
             list($menu_id, $object_id, $ob_type, $parent_id) = explode('#', $iteminfo);
             if (!is_numeric($menu_id)) {
                 $exp = explode('-', $menu_id);
                 $menu_id = $new_menus[$exp[1]][$exp[2]];
             }
             global $wp_post_types;
             if (is_taxonomy($ob_type)) {
                 $menu_obj = get_term($object_id, $ob_type);
                 $menu_item_type = 'taxonomy';
             } elseif (in_array($ob_type, array_keys($wp_post_types))) {
                 $menu_obj = get_post($object_id);
                 $menu_item_type = 'post_type';
             }
             $_ldetails = $sitepress->get_element_language_details($menu_id, 'tax_nav_menu');
             $language = $_ldetails->language_code;
             $menudata = array('menu-item-db-id' => 0, 'menu-item-object-id' => $object_id, 'menu-item-object' => $ob_type, 'menu-item-parent-id' => 0, 'menu-item-position' => 0, 'menu-item-type' => $menu_item_type, 'menu-item-title' => '', 'menu-item-url' => '', 'menu-item-description' => '', 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => '', 'menu-item-xfn' => '', 'menu-item-status' => 'publish');
             $nav_item_id = wp_update_nav_menu_item($menu_id, 0, $menudata);
             // set language explicitly since the 'wp_update_nav_menu_item' is still TBD
             $sitepress->set_element_language_details($nav_item_id, 'post_nav_menu_item', null, $language);
         }
         // check and set hierarchy
         foreach ($data['add'] as $iteminfo) {
             list($menu_id, $object_id, $ob_type, $original_item_parent) = explode('#', $iteminfo);
             if (!is_numeric($menu_id)) {
                 $exp = explode('-', $menu_id);
                 $menu_id = $new_menus[$exp[1]][$exp[2]];
             }
             global $wp_post_types;
             if (is_taxonomy($ob_type)) {
                 $menu_obj = get_term($object_id, $ob_type);
                 $menu_item_type = 'taxonomy';
             } elseif (in_array($ob_type, array_keys($wp_post_types))) {
                 $menu_obj = get_post($object_id);
                 $menu_item_type = 'post_type';
             }
             if (!$original_item_parent) {
                 //get original object
                 $original_object = icl_object_id($object_id, $ob_type, false, $sitepress->get_default_language());
                 // get item id of original object in original menu
                 $original_menu_id = icl_object_id($menu_id, 'nav_menu', false, $sitepress->get_default_language());
                 $original_item_id = $wpdb->get_var($wpdb->prepare("\r\r\n                        SELECT p.post_id FROM {$wpdb->postmeta}  p\r\r\n                            JOIN {$wpdb->term_relationships} r ON r.object_id = p.post_id\r\r\n                            JOIN {$wpdb->term_taxonomy} x ON r.term_taxonomy_id = x.term_taxonomy_id AND taxonomy = 'nav_menu'\r\r\n                            JOIN {$wpdb->terms} m ON m.term_id = x.term_id\r\r\n                        WHERE meta_key='_menu_item_object_id' AND meta_value=%d AND m.term_id=%d", $original_object, $original_menu_id));
                 $original_item_parent = get_post_meta($original_item_id, '_menu_item_menu_item_parent', true);
             }
             if ($original_item_parent) {
                 $original_item_parent_object_id = get_post_meta($original_item_parent, '_menu_item_object_id', true);
                 $parent_ob_type = $wpdb->get_var($wpdb->prepare("SELECT post_type FROM {$wpdb->posts} WHERE ID=%d", $original_item_parent_object_id));
                 $item_parent_object_id = icl_object_id($original_item_parent_object_id, $parent_ob_type, false, $language);
                 $item_parent = $wpdb->get_var($wpdb->prepare("\r\r\n                        SELECT p.post_id FROM {$wpdb->postmeta}  p\r\r\n                            JOIN {$wpdb->term_relationships} r ON r.object_id = p.post_id\r\r\n                            JOIN {$wpdb->term_taxonomy} x ON r.term_taxonomy_id = x.term_taxonomy_id AND taxonomy = 'nav_menu'\r\r\n                            JOIN {$wpdb->terms} m ON m.term_id = x.term_id\r\r\n                        WHERE meta_key='_menu_item_object_id' AND meta_value=%d AND m.term_id=%d\r\r\n                    ", $item_parent_object_id, $menu_id));
                 $item_id = $wpdb->get_var($wpdb->prepare("\r\r\n                        SELECT p.post_id FROM {$wpdb->postmeta}  p\r\r\n                            JOIN {$wpdb->term_relationships} r ON r.object_id = p.post_id\r\r\n                            JOIN {$wpdb->term_taxonomy} x ON r.term_taxonomy_id = x.term_taxonomy_id AND taxonomy = 'nav_menu'\r\r\n                            JOIN {$wpdb->terms} m ON m.term_id = x.term_id\r\r\n                        WHERE meta_key='_menu_item_object_id' AND meta_value=%d AND m.term_id=%d\r\r\n                    ", $object_id, $menu_id));
                 update_post_meta($item_id, '_menu_item_menu_item_parent', $item_parent);
             }
         }
     }
 }
Example #19
0
                                                        ?>
/css/style.css">
        <link rel="stylesheet" type="text/css" href="<?php 
                                                        echo get_template_directory_uri();
                                                        ?>
/css/responsive.css">
        </head>
        <body>
        <div style="background:url(<?php 
                                                        _e($image[0]);
                                                        ?>
) no-repeat #444" class="header-bar7 hidden-xs">
        <div class="container">
      <?php 
                                                    } else {
                                                        if (is_taxonomy('post_tag')) {
                                                            ?>
  <link href="<?php 
                                                            echo get_template_directory_uri();
                                                            ?>
/css/animate.min.css" rel="stylesheet">
<link href="<?php 
                                                            echo get_template_directory_uri();
                                                            ?>
/css/demo.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="<?php 
                                                            echo get_template_directory_uri();
                                                            ?>
/css/responsive.css">
</head>
<body>
Example #20
0
function ocp_title($title = null)
{
    if ($title == null) {
        $title = get_the_title();
        if (is_home()) {
            $blog_page = get_option('page_for_posts');
            $title = get_the_title($blog_page);
        }
        if (is_archive()) {
            $title = single_month_title('', false);
        }
        if (is_category()) {
            $title = single_cat_title('', false);
        }
        if (is_tag()) {
            $title = single_tag_title('', false);
        }
        if (is_taxonomy()) {
            $title = single_term_title('', false);
        }
    }
    echo $title;
}
    /**
     * Displays the option page
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     */
    function HtmlShowOptionsPage()
    {
        global $wp_version;
        $snl = false;
        //SNL
        $this->sg->Initate();
        $message = "";
        if (!empty($_REQUEST["sm_rebuild"])) {
            //Pressed Button: Rebuild Sitemap
            check_admin_referer('sitemap');
            //Clear any outstanding build cron jobs
            if (function_exists('wp_clear_scheduled_hook')) {
                wp_clear_scheduled_hook('sm_build_cron');
            }
            if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") {
                //Check again, just for the case that something went wrong before
                if (!current_user_can("administrator")) {
                    echo '<p>Please log in as admin</p>';
                    return;
                }
                $oldErr = error_reporting(E_ALL);
                $oldIni = ini_set("display_errors", 1);
                echo '<div class="wrap">';
                echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion() . '</h2>';
                echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>';
                echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
                echo "<h3>WordPress and PHP Information</h3>";
                echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>';
                echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->_svnVersion . ')';
                echo '<h4>Environment</h4>';
                echo "<pre>";
                $sc = $_SERVER;
                unset($sc["HTTP_COOKIE"]);
                print_r($sc);
                echo "</pre>";
                echo "<h4>WordPress Config</h4>";
                echo "<pre>";
                $opts = array();
                if (function_exists('wp_load_alloptions')) {
                    $opts = wp_load_alloptions();
                } else {
                    global $wpdb;
                    $os = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options}");
                    foreach ((array) $os as $o) {
                        $opts[$o->option_name] = $o->option_value;
                    }
                }
                $popts = array();
                foreach ($opts as $k => $v) {
                    //Try to filter out passwords etc...
                    if (preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si", $k)) {
                        continue;
                    }
                    $popts[$k] = htmlspecialchars($v);
                }
                print_r($popts);
                echo "</pre>";
                echo '<h4>Sitemap Config</h4>';
                echo "<pre>";
                print_r($this->sg->_options);
                echo "</pre>";
                echo '<h3>Errors, Warnings, Notices</h3>';
                echo '<div>';
                $status = $this->sg->BuildSitemap();
                echo '</div>';
                echo '<h3>MySQL Queries</h3>';
                if (defined('SAVEQUERIES') && SAVEQUERIES) {
                    echo '<pre>';
                    var_dump($GLOBALS['wpdb']->queries);
                    echo '</pre>';
                    $total = 0;
                    foreach ($GLOBALS['wpdb']->queries as $q) {
                        $total += $q[1];
                    }
                    echo '<h4>Total Query Time</h4>';
                    echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total, 2) . ' seconds.</pre>';
                } else {
                    echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>';
                }
                echo "<h3>Build Process Results</h3>";
                echo "<pre>";
                print_r($status);
                echo "</pre>";
                echo '<p>Done. <a href="' . wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap') . '">Rebuild</a> or <a href="' . $this->sg->GetBackLink() . '">Return</a></p>';
                echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
                echo '</div>';
                @error_reporting($oldErr);
                @ini_set("display_errors", $oldIni);
                return;
            } else {
                $this->sg->BuildSitemap();
                $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true';
                //Redirect so the sm_rebuild GET parameter no longer exists.
                @header("location: " . $redirURL);
                //If there was already any other output, the header redirect will fail
                echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
                echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
                exit;
            }
        } else {
            if (!empty($_POST['sm_update'])) {
                //Pressed Button: Update Config
                check_admin_referer('sitemap');
                if (isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) {
                    $_POST['sm_b_style_default'] = true;
                    $_POST['sm_b_style'] = '';
                }
                foreach ($this->sg->_options as $k => $v) {
                    //Check vor values and convert them into their types, based on the category they are in
                    if (!isset($_POST[$k])) {
                        $_POST[$k] = "";
                    }
                    // Empty string will get false on 2bool and 0 on 2float
                    //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider
                    if (substr($k, 0, 5) == "sm_b_") {
                        if ($k == "sm_b_filename" || $k == "sm_b_fileurl_manual" || $k == "sm_b_filename_manual" || $k == "sm_b_prio_provider" || $k == "sm_b_manual_key" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") {
                            if ($k == "sm_b_filename_manual" && strpos($_POST[$k], "\\") !== false) {
                                $_POST[$k] = stripslashes($_POST[$k]);
                            }
                            $this->sg->_options[$k] = (string) $_POST[$k];
                        } else {
                            if ($k == "sm_b_location_mode") {
                                $tmp = (string) $_POST[$k];
                                $tmp = strtolower($tmp);
                                if ($tmp == "auto" || ($tmp = "manual")) {
                                    $this->sg->_options[$k] = $tmp;
                                } else {
                                    $this->sg->_options[$k] = "auto";
                                }
                            } else {
                                if ($k == "sm_b_time" || $k == "sm_b_max_posts") {
                                    if ($_POST[$k] == '') {
                                        $_POST[$k] = -1;
                                    }
                                    $this->sg->_options[$k] = intval($_POST[$k]);
                                } else {
                                    if ($k == "sm_i_install_date") {
                                        if ($this->sg->GetOption('i_install_date') <= 0) {
                                            $this->sg->_options[$k] = time();
                                        }
                                    } else {
                                        if ($k == "sm_b_exclude") {
                                            $IDss = array();
                                            $IDs = explode(",", $_POST[$k]);
                                            for ($x = 0; $x < count($IDs); $x++) {
                                                $ID = intval(trim($IDs[$x]));
                                                if ($ID > 0) {
                                                    $IDss[] = $ID;
                                                }
                                            }
                                            $this->sg->_options[$k] = $IDss;
                                        } else {
                                            if ($k == "sm_b_exclude_cats") {
                                                $exCats = array();
                                                if (isset($_POST["post_category"])) {
                                                    foreach ((array) $_POST["post_category"] as $vv) {
                                                        if (!empty($vv) && is_numeric($vv)) {
                                                            $exCats[] = intval($vv);
                                                        }
                                                    }
                                                }
                                                $this->sg->_options[$k] = $exCats;
                                            } else {
                                                $this->sg->_options[$k] = (bool) $_POST[$k];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //Options of the category "Includes" are boolean
                    } else {
                        if (substr($k, 0, 6) == "sm_in_") {
                            if ($k == 'sm_in_tax') {
                                $enabledTaxonomies = array();
                                foreach (array_keys((array) $_POST[$k]) as $taxName) {
                                    if (empty($taxName) || !is_taxonomy($taxName)) {
                                        continue;
                                    }
                                    $enabledTaxonomies[] = $taxName;
                                }
                                $this->sg->_options[$k] = $enabledTaxonomies;
                            } else {
                                $this->sg->_options[$k] = (bool) $_POST[$k];
                            }
                            //Options of the category "Change frequencies" are string
                        } else {
                            if (substr($k, 0, 6) == "sm_cf_") {
                                $this->sg->_options[$k] = (string) $_POST[$k];
                                //Options of the category "Priorities" are float
                            } else {
                                if (substr($k, 0, 6) == "sm_pr_") {
                                    $this->sg->_options[$k] = (double) $_POST[$k];
                                }
                            }
                        }
                    }
                }
                //No Mysql unbuffered query for WP < 2.2
                if (floatval($wp_version) < 2.2) {
                    $this->sg->SetOption('b_safemode', true);
                }
                //No Wp-Cron for WP < 2.1
                if (floatval($wp_version) < 2.1) {
                    $this->sg->SetOption('b_auto_delay', false);
                }
                //Apply page changes from POST
                $this->sg->_pages = $this->sg->HtmlApplyPages();
                if ($this->sg->SaveOptions()) {
                    $message .= __('Configuration updated', 'sitemap') . "<br />";
                } else {
                    $message .= __('Error while saving options', 'sitemap') . "<br />";
                }
                if ($this->sg->SavePages()) {
                    $message .= __("Pages saved", 'sitemap') . "<br />";
                } else {
                    $message .= __('Error while saving pages', 'sitemap') . "<br />";
                }
            } else {
                if (!empty($_POST["sm_reset_config"])) {
                    //Pressed Button: Reset Config
                    check_admin_referer('sitemap');
                    $this->sg->InitOptions();
                    $this->sg->SaveOptions();
                    $message .= __('The default configuration was restored.', 'sitemap');
                }
            }
        }
        //Print out the message to the user, if any
        if ($message != "") {
            ?>
			<div class="updated"><strong><p><?php 
            echo $message;
            ?>
</p></strong></div><?php 
        }
        if (!$snl) {
            if (isset($_GET['sm_hidedonate'])) {
                $this->sg->SetOption('i_hide_donated', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_donated'])) {
                $this->sg->SetOption('i_donated', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hide_note'])) {
                $this->sg->SetOption('i_hide_note', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hidedonors'])) {
                $this->sg->SetOption('i_hide_donors', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hide_works'])) {
                $this->sg->SetOption('i_hide_works', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_donated']) || $this->sg->GetOption('i_donated') === true && $this->sg->GetOption('i_hide_donated') !== true) {
                ?>
				<div class="updated">
					<strong><p><?php 
                _e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!', 'sitemap');
                ?>
 <a href="<?php 
                echo $this->sg->GetBackLink() . "&amp;sm_hidedonate=true";
                ?>
"><small style="font-weight:normal;"><?php 
                _e('Hide this notice', 'sitemap');
                ?>
</small></a></p></strong>
				</div>
				<?php 
            } else {
                if ($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_note') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 30) {
                    ?>
				<div class="updated">
					<strong><p><?php 
                    echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-donate-note"), __('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and you are satisfied with the results, isn\'t it worth at least a few dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>', 'sitemap'));
                    ?>
 <a href="<?php 
                    echo $this->sg->GetBackLink() . "&amp;sm_donated=true";
                    ?>
" style="float:right; display:block; border:none; margin-left:10px;"><small style="font-weight:normal; "><?php 
                    _e('Sure, but I already did!', 'sitemap');
                    ?>
</small></a> <a href="<?php 
                    echo $this->sg->GetBackLink() . "&amp;sm_hide_note=true";
                    ?>
" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php 
                    _e('No thanks, please don\'t bug me anymore!', 'sitemap');
                    ?>
</small></a></p></strong>
					<div style="clear:right;"></div>
				</div>
				<?php 
                } else {
                    if ($this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_works') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 15) {
                        ?>
				<div class="updated">
					<strong><p><?php 
                        echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-works-note"), __('Thanks for using this plugin! You\'ve installed this plugin some time ago. If it works and your are satisfied, why not <a href="%s">rate it</a> and <a href="%s">recommend it</a> to others? :-)', 'sitemap'));
                        ?>
 <a href="<?php 
                        echo $this->sg->GetBackLink() . "&amp;sm_hide_works=true";
                        ?>
" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php 
                        _e('Don\'t show this anymore', 'sitemap');
                        ?>
</small></a></p></strong>
					<div style="clear:right;"></div>
				</div>
				<?php 
                    }
                }
            }
        }
        if (function_exists("wp_next_scheduled")) {
            $next = wp_next_scheduled('sm_build_cron');
            if ($next) {
                $diff = (time() - $next) * -1;
                if ($diff <= 0) {
                    $diffMsg = __('Your sitemap is being refreshed at the moment. Depending on your blog size this might take some time!<br /><small>Due to limitations of the WordPress scheduler, it might take another 60 seconds until the build process is actually started.</small>', 'sitemap');
                } else {
                    $diffMsg = str_replace("%s", $diff, __('Your sitemap will be refreshed in %s seconds. Depending on your blog size this might take some time!', 'sitemap'));
                }
                ?>
				<div class="updated">
					<strong><p><?php 
                echo $diffMsg;
                ?>
</p></strong>
					<div style="clear:right;"></div>
				</div>
				<?php 
            }
        }
        ?>
				
		<style type="text/css">
		
		li.sm_hint {
			color:green;
		}
		
		li.sm_optimize {
			color:orange;
		}
		
		li.sm_error {
			color:red;
		}
		
		input.sm_warning:hover {
			background: #ce0000;
			color: #fff;
		}
		
		a.sm_button {
			padding:4px;
			display:block;
			padding-left:25px;
			background-repeat:no-repeat;
			background-position:5px 50%;
			text-decoration:none;
			border:none;
		}
		
		a.sm_button:hover {
			border-bottom-width:1px;
		}

		a.sm_donatePayPal {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-paypal.gif);
		}
		
		a.sm_donateAmazon {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-amazon.gif);
		}
		
		a.sm_pluginHome {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-arne.gif);
		}
		
		a.sm_pluginList {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-email.gif);
		}
		
		a.sm_pluginSupport {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-wordpress.gif);
		}
		
		a.sm_pluginBugs {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-trac.gif);
		}
		
		a.sm_resGoogle {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-google.gif);
		}
		
		a.sm_resYahoo {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-yahoo.gif);
		}
		
		a.sm_resBing {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-bing.gif);
		}
		
		div.sm-update-nag p {
			margin:5px;
		}
		
		</style>
		
		<?php 
        if ($this->mode == 27) {
            ?>
			<style type="text/css">
		
				.sm-padded .inside {
					margin:12px!important;
				}
				.sm-padded .inside ul {
					margin:6px 0 12px 0;
				}
				
				.sm-padded .inside input {
					padding:1px;
					margin:0;
				}
			</style>
				
			<?php 
        } elseif (version_compare($wp_version, "2.5", ">=")) {
            ?>
				<style type="text/css">
					div#moremeta {
						float:right;
						width:200px;
						margin-left:10px;
					}
					<?php 
            if (!$snl) {
                ?>
					div#advancedstuff {
						width:770px;
					}
					<?php 
            }
            ?>
					div#poststuff {
						margin-top:10px;
					}
					fieldset.dbx-box {
						margin-bottom:5px;
					}
					
					div.sm-update-nag {
						margin-top:10px!important;
					}
				</style>
				<!--[if lt IE 7]>
					<style type="text/css">
						div#advancedstuff {
							width:735px;
						}
					</style>
				<![endif]-->
				
			<?php 
        } else {
            ?>
				<style type="text/css">
					div.updated-message {
						margin-left:0; margin-right:0;
					}
				</style>
			<?php 
        }
        ?>
		
		<div class="wrap" id="sm_div">
			<form method="post" action="<?php 
        echo $this->sg->GetBackLink();
        ?>
">
				<h2><?php 
        _e('XML Sitemap Generator for WordPress', 'sitemap');
        echo " " . $this->sg->GetVersion();
        ?>
 </h2>
				<?php 
        if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
            wp_update_plugins();
            $file = GoogleSitemapGeneratorLoader::GetBaseName();
            $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile());
            $current = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
            if (isset($current->response[$file])) {
                $r = $current->response[$file];
                ?>
<div id="update-nag" class="sm-update-nag"><?php 
                if (!current_user_can('edit_plugins') || version_compare($wp_version, "2.5", "<")) {
                    printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                } else {
                    if (empty($r->package)) {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                    } else {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin={$file}", 'upgrade-plugin_' . $file));
                    }
                }
                ?>
</div><?php 
            }
        }
        if (get_option('blog_public') != 1) {
            ?>
<div class="error"><p><?php 
            echo str_replace("%s", "options-privacy.php", __('Your blog is currently blocking search engines! Visit the <a href="%s">privacy settings</a> to change this.', 'sitemap'));
            ?>
</p></div><?php 
        }
        ?>

				<?php 
        if (version_compare($wp_version, "2.5", "<")) {
            ?>
				<script type="text/javascript" src="../wp-includes/js/dbx.js"></script>
				<script type="text/javascript">
				//<![CDATA[
				addLoadEvent( function() {
					var manager = new dbxManager('sm_sitemap_meta_33');
					
					//create new docking boxes group
					var meta = new dbxGroup(
						'grabit', 		// container ID [/-_a-zA-Z0-9/]
						'vertical', 	// orientation ['vertical'|'horizontal']
						'10', 			// drag threshold ['n' pixels]
						'no',			// restrict drag movement to container axis ['yes'|'no']
						'10', 			// animate re-ordering [frames per transition, or '0' for no effect]
						'yes', 			// include open/close toggle buttons ['yes'|'no']
						'open', 		// default state ['open'|'closed']
						<?php 
            echo "'" . js_escape(__('open'));
            ?>
', 		// word for "open", as in "open this box"
						<?php 
            echo "'" . js_escape(__('close'));
            ?>
', 		// word for "close", as in "close this box"
						<?php 
            echo "'" . js_escape(__('click-down and drag to move this box'));
            ?>
', // sentence for "move this box" by mouse
						<?php 
            echo "'" . js_escape(__('click to %toggle% this box'));
            ?>
', // pattern-match sentence for "(open|close) this box" by mouse
						<?php 
            echo "'" . js_escape(__('use the arrow keys to move this box'));
            ?>
', // sentence for "move this box" by keyboard
						<?php 
            echo "'" . js_escape(__(', or press the enter key to %toggle% it'));
            ?>
',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
						'%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
						);

					var advanced = new dbxGroup(
						'advancedstuff', 		// container ID [/-_a-zA-Z0-9/]
						'vertical', 		// orientation ['vertical'|'horizontal']
						'10', 			// drag threshold ['n' pixels]
						'yes',			// restrict drag movement to container axis ['yes'|'no']
						'10', 			// animate re-ordering [frames per transition, or '0' for no effect]
						'yes', 			// include open/close toggle buttons ['yes'|'no']
						'open', 		// default state ['open'|'closed']
						<?php 
            echo "'" . js_escape(__('open'));
            ?>
', 		// word for "open", as in "open this box"
						<?php 
            echo "'" . js_escape(__('close'));
            ?>
', 		// word for "close", as in "close this box"
						<?php 
            echo "'" . js_escape(__('click-down and drag to move this box'));
            ?>
', // sentence for "move this box" by mouse
						<?php 
            echo "'" . js_escape(__('click to %toggle% this box'));
            ?>
', // pattern-match sentence for "(open|close) this box" by mouse
						<?php 
            echo "'" . js_escape(__('use the arrow keys to move this box'));
            ?>
', // sentence for "move this box" by keyboard
						<?php 
            echo "'" . js_escape(__(', or press the enter key to %toggle% it'));
            ?>
',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard
						'%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
						);
				});
				//]]>
				</script>
				<?php 
        }
        ?>

				<?php 
        if ($this->mode == 27) {
            ?>
				
					<?php 
            if (!$snl) {
                ?>
						<div id="poststuff" class="metabox-holder has-right-sidebar">
							<div class="inner-sidebar">
								<div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
					<?php 
            } else {
                ?>
						<div id="poststuff" class="metabox-holder">
					<?php 
            }
            ?>
				<?php 
        } else {
            ?>
					<?php 
            if (!$snl) {
                ?>
						<div id="poststuff">
							<div id="moremeta">
								<div id="grabit" class="dbx-group">
					<?php 
            } else {
                ?>
						<div>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
				
					<?php 
        if (!$snl) {
            ?>
				
							<?php 
            $this->HtmlPrintBoxHeader('sm_pnres', __('About this Plugin:', 'sitemap'), true);
            ?>
								<a class="sm_button sm_pluginHome"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-home');
            ?>
"><?php 
            _e('Plugin Homepage', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginHome"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-feedback');
            ?>
"><?php 
            _e('Suggest a Feature', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginList"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-list');
            ?>
"><?php 
            _e('Notify List', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginSupport" href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-support');
            ?>
"><?php 
            _e('Support Forum', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginBugs"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-bugs');
            ?>
"><?php 
            _e('Report a Bug', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_donatePayPal"  href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-paypal');
            ?>
"><?php 
            _e('Donate with PayPal', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_donateAmazon"  href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-amazon');
            ?>
"><?php 
            _e('My Amazon Wish List', 'sitemap');
            ?>
</a>
								<?php 
            if (__('translator_name', 'sitemap') != 'translator_name') {
                ?>
<a class="sm_button sm_pluginSupport" href="<?php 
                _e('translator_url', 'sitemap');
                ?>
"><?php 
                _e('translator_name', 'sitemap');
                ?>
</a><?php 
            }
            ?>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
						
						
							<?php 
            $this->HtmlPrintBoxHeader('sm_smres', __('Sitemap Resources:', 'sitemap'), true);
            ?>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-gwt');
            ?>
"><?php 
            _e('Webmaster Tools', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-gwb');
            ?>
"><?php 
            _e('Webmaster Blog', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_resYahoo"     href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-yse');
            ?>
"><?php 
            _e('Site Explorer', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resYahoo"     href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-ywb');
            ?>
"><?php 
            _e('Search Blog', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_resBing"      href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-lwt');
            ?>
"><?php 
            _e('Webmaster Tools', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resBing"      href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-lswcb');
            ?>
"><?php 
            _e('Webmaster Center Blog', 'sitemap');
            ?>
</a>
								<br />
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-prot');
            ?>
"><?php 
            _e('Sitemaps Protocol', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-ofaq');
            ?>
"><?php 
            _e('Official Sitemaps FAQ', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginHome"   href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-afaq');
            ?>
"><?php 
            _e('My Sitemaps FAQ', 'sitemap');
            ?>
</a>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
							
							<?php 
            $this->HtmlPrintBoxHeader('dm_donations', __('Recent Donations:', 'sitemap'), true);
            ?>
								<?php 
            if ($this->sg->GetOption('i_hide_donors') !== true) {
                ?>
									<iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php 
                echo $this->sg->GetRedirectLink('sitemap-donorlist');
                ?>
">
									<?php 
                _e('List of the donors', 'sitemap');
                ?>
									</iframe><br />
									<a href="<?php 
                echo $this->sg->GetBackLink() . "&amp;sm_hidedonors=true";
                ?>
"><small><?php 
                _e('Hide this list', 'sitemap');
                ?>
</small></a><br /><br />
								<?php 
            }
            ?>
								<a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php 
            echo $this->sg->GetPluginUrl();
            ?>
img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a>
								<span><small><?php 
            _e('Thanks for your support!', 'sitemap');
            ?>
</small></span>
								<div style="clear:left; height:1px;"></div>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
							
						
						</div>
					</div>
					<?php 
        }
        ?>
					
					<?php 
        if ($this->mode == 27) {
            ?>
						<div class="has-sidebar sm-padded" >
					
							<div id="post-body-content" class="<?php 
            if (!$snl) {
                ?>
has-sidebar-content<?php 
            }
            ?>
">
						
								<div class="meta-box-sortabless">
					<?php 
        } else {
            ?>
						<div id="advancedstuff" class="dbx-group" >
					<?php 
        }
        ?>
					
					<!-- Rebuild Area -->
					<?php 
        $status =& GoogleSitemapGeneratorStatus::Load();
        $head = __('The sitemap wasn\'t generated yet.', 'sitemap');
        if ($status != null) {
            $st = $status->GetStartTime();
            $head = str_replace("%date%", date(get_option('date_format'), $st) . " " . date(get_option('time_format'), $st), __("Result of the last build process, started on %date%.", 'sitemap'));
        }
        $this->HtmlPrintBoxHeader('sm_rebuild', $head);
        ?>
						<ul>
							<?php 
        if ($status == null) {
            echo "<li>" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&noheader=true", 'sitemap'), __('The sitemap wasn\'t built yet. <a href="%s">Click here</a> to build it the first time.', 'sitemap')) . "</li>";
        } else {
            if ($status->_endTime !== 0) {
                if ($status->_usedXml) {
                    if ($status->_xmlSuccess) {
                        $ft = is_readable($status->_xmlPath) ? filemtime($status->_xmlPath) : false;
                        if ($ft !== false) {
                            echo "<li>" . str_replace("%url%", $status->_xmlUrl, str_replace("%date%", date(get_option('date_format'), $ft) . " " . date(get_option('time_format'), $ft), __("Your <a href=\"%url%\">sitemap</a> was last built on <b>%date%</b>.", 'sitemap'))) . "</li>";
                        } else {
                            echo "<li class=\"sm_error\">" . __("The last build succeeded, but the file was deleted later or can't be accessed anymore. Did you move your blog to another server or domain?", 'sitemap') . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-files'), __("There was a problem writing your sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a>", 'sitemap')) . "</li>";
                    }
                }
                if ($status->_usedZip) {
                    if ($status->_zipSuccess) {
                        $ft = is_readable($status->_zipPath) ? filemtime($status->_zipPath) : false;
                        if ($ft !== false) {
                            echo "<li>" . str_replace("%url%", $status->_zipUrl, str_replace("%date%", date(get_option('date_format'), $ft) . " " . date(get_option('time_format'), $ft), __("Your sitemap (<a href=\"%url%\">zipped</a>) was last built on <b>%date%</b>.", 'sitemap'))) . "</li>";
                        } else {
                            echo "<li class=\"sm_error\">" . __("The last zipped build succeeded, but the file was deleted later or can't be accessed anymore. Did you move your blog to another server or domain?", 'sitemap') . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-files'), __("There was a problem writing your zipped sitemap file. Make sure the file exists and is writable. <a href=\"%url%\">Learn more</a>", 'sitemap')) . "</li>";
                    }
                }
                if ($status->_usedGoogle) {
                    if ($status->_gooogleSuccess) {
                        echo "<li>" . __("Google was <b>successfully notified</b> about changes.", 'sitemap') . "</li>";
                        $gt = $status->GetGoogleTime();
                        if ($gt > 4) {
                            echo "<li class=\\sm_optimize\">" . str_replace("%time%", $gt, __("It took %time% seconds to notify Google, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=google&noheader=true", 'sitemap'), __('There was a problem while notifying Google. <a href="%s">View result</a>', 'sitemap')) . "</li>";
                    }
                }
                if ($status->_usedYahoo) {
                    if ($status->_yahooSuccess) {
                        echo "<li>" . __("YAHOO was <b>successfully notified</b> about changes.", 'sitemap') . "</li>";
                        $yt = $status->GetYahooTime();
                        if ($yt > 4) {
                            echo "<li class=\\sm_optimize\">" . str_replace("%time%", $yt, __("It took %time% seconds to notify YAHOO, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=yahoo&noheader=true", 'sitemap'), __('There was a problem while notifying YAHOO. <a href="%s">View result</a>', 'sitemap')) . "</li>";
                    }
                }
                if ($status->_usedMsn) {
                    if ($status->_msnSuccess) {
                        echo "<li>" . __("Bing was <b>successfully notified</b> about changes.", 'sitemap') . "</li>";
                        $at = $status->GetMsnTime();
                        if ($at > 4) {
                            echo "<li class=\\sm_optimize\">" . str_replace("%time%", $at, __("It took %time% seconds to notify Bing, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=msn&noheader=true", 'sitemap'), __('There was a problem while notifying Bing. <a href="%s">View result</a>', 'sitemap')) . "</li>";
                    }
                }
                if ($status->_usedAsk) {
                    if ($status->_askSuccess) {
                        echo "<li>" . __("Ask.com was <b>successfully notified</b> about changes.", 'sitemap') . "</li>";
                        $at = $status->GetAskTime();
                        if ($at > 4) {
                            echo "<li class=\\sm_optimize\">" . str_replace("%time%", $at, __("It took %time% seconds to notify Ask.com, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>";
                        }
                    } else {
                        echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=ask&noheader=true", 'sitemap'), __('There was a problem while notifying Ask.com. <a href="%s">View result</a>', 'sitemap')) . "</li>";
                    }
                }
                $et = $status->GetTime();
                $mem = $status->GetMemoryUsage();
                if ($mem > 0) {
                    echo "<li>" . str_replace(array("%time%", "%memory%"), array($et, $mem), __("The building process took about <b>%time% seconds</b> to complete and used %memory% MB of memory.", 'sitemap')) . "</li>";
                } else {
                    echo "<li>" . str_replace("%time%", $et, __("The building process took about <b>%time% seconds</b> to complete.", 'sitemap')) . "</li>";
                }
                if (!$status->_hasChanged) {
                    echo "<li>" . __("The content of your sitemap <strong>didn't change</strong> since the last time so the files were not written and no search engine was pinged.", 'sitemap') . "</li>";
                }
            } else {
                if ($this->sg->GetOption("b_auto_delay")) {
                    $st = ($status->GetStartTime() - time()) * -1;
                    //If the building process runs in background and was started within the last 45 seconds, the sitemap might not be completed yet...
                    if ($st < 45) {
                        echo '<li class="">' . __("The building process might still be active! Reload the page in a few seconds and check if something has changed.", 'sitemap') . '</li>';
                    }
                }
                echo '<li class="sm_error">' . str_replace("%url%", $this->sg->GetRedirectLink('sitemap-help-memtime'), __("The last run didn't finish! Maybe you can raise the memory or time limit for PHP scripts. <a href=\"%url%\">Learn more</a>", 'sitemap')) . '</li>';
                if ($status->_memoryUsage > 0) {
                    echo '<li class="sm_error">' . str_replace(array("%memused%", "%memlimit%"), array($status->GetMemoryUsage(), ini_get('memory_limit')), __("The last known memory usage of the script was %memused%MB, the limit of your server is %memlimit%.", 'sitemap')) . '</li>';
                }
                if ($status->_lastTime > 0) {
                    echo '<li class="sm_error">' . str_replace(array("%timeused%", "%timelimit%"), array($status->GetLastTime(), ini_get('max_execution_time')), __("The last known execution time of the script was %timeused% seconds, the limit of your server is %timelimit% seconds.", 'sitemap')) . '</li>';
                }
                if ($status->GetLastPost() > 0) {
                    echo '<li class="sm_optimize">' . str_replace("%lastpost%", $status->GetLastPost(), __("The script stopped around post number %lastpost% (+/- 100)", 'sitemap')) . '</li>';
                }
            }
            echo "<li>" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&noheader=true", 'sitemap'), __('If you changed something on your server or blog, you should <a href="%s">rebuild the sitemap</a> manually.', 'sitemap')) . "</li>";
        }
        echo "<li>" . str_replace("%d", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap'), __('If you encounter any problems with the build process you can use the <a href="%d">debug function</a> to get more information.', 'sitemap')) . "</li>";
        ?>

						</ul>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
						
					<!-- Basic Options -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_basic_options', __('Basic Options', 'sitemap'));
        ?>
					
						<b><?php 
        _e('Sitemap files:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-files');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<label for="sm_b_xml">
									<input type="checkbox" id="sm_b_xml" name="sm_b_xml" <?php 
        echo $this->sg->GetOption("b_xml") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Write a normal XML file (your filename)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_b_gzip">
									<input type="checkbox" id="sm_b_gzip" name="sm_b_gzip" <?php 
        if (function_exists("gzencode")) {
            echo $this->sg->GetOption("b_gzip") == true ? "checked=\"checked\"" : "";
        } else {
            echo "disabled=\"disabled\"";
        }
        ?>
 />
									<?php 
        _e('Write a gzipped file (your filename + .gz)', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						<b><?php 
        _e('Building mode:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-process');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<label for="sm_b_auto_enabled">
									<input type="checkbox" id="sm_b_auto_enabled" name="sm_b_auto_enabled" <?php 
        echo $this->sg->GetOption("b_auto_enabled") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Rebuild sitemap if you change the content of your blog', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_b_manual_enabled">
									<input type="hidden" name="sm_b_manual_key" value="<?php 
        echo $this->sg->GetOption("b_manual_key");
        ?>
" />
									<input type="checkbox" id="sm_b_manual_enabled" name="sm_b_manual_enabled" <?php 
        echo $this->sg->GetOption("b_manual_enabled") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Enable manual sitemap building via GET Request', 'sitemap');
        ?>
								</label>
								<a href="javascript:void(document.getElementById('sm_manual_help').style.display='');">[?]</a>
								<span id="sm_manual_help" style="display:none;"><br />
								<?php 
        echo str_replace("%1", trailingslashit(get_bloginfo('siteurl')) . "?sm_command=build&amp;sm_key=" . $this->sg->GetOption("b_manual_key"), __('This will allow you to refresh your sitemap if an external tool wrote into the WordPress database without using the WordPress API. Use the following URL to start the process: <a href="%1">%1</a> Please check the result box above to see if sitemap was successfully built.', 'sitemap'));
        ?>
								</span>
							</li>
						</ul>
						<b><?php 
        _e('Update notification:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-ping');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php 
        echo $this->sg->GetOption("b_ping") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_ping"><?php 
        _e('Notify Google about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-gwt'), __('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php 
        echo $this->sg->GetOption("b_pingmsn") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingmsn"><?php 
        _e('Notify Bing (formerly MSN Live Search) about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-lwt'), __('No registration required, but you can join the <a href="%s">Bing Webmaster Tools</a> to check crawling statistics.', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php 
        echo $this->sg->GetOption("b_pingask") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingask"><?php 
        _e('Notify Ask.com about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        _e('No registration required.', 'sitemap');
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php 
        echo $this->sg->GetOption("b_pingyahoo") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingyahoo"><?php 
        _e('Notify YAHOO about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<label for="sm_b_yahookey"><?php 
        _e('Your Application ID:', 'sitemap');
        ?>
 <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php 
        echo $this->sg->GetOption("b_yahookey");
        ?>
" /></label><br />
								<small><?php 
        echo str_replace(array("%s1", "%s2"), array($this->sg->GetRedirectLink('sitemap-ykr'), ' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'), __('Don\'t you have such a key? <a href="%s1">Request one here</a>! %s2', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<label for="sm_b_robots">
								<input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php 
        echo $this->sg->GetOption("b_robots") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<?php 
        _e("Add sitemap URL to the virtual robots.txt file.", 'sitemap');
        ?>
								</label>

								<br />
								<small><?php 
        _e('The virtual robots.txt generated by WordPress is used. A real robots.txt file must NOT exist in the blog directory!', 'sitemap');
        ?>
</small>
							</li>
						</ul>
						<b><?php 
        _e('Advanced options:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-adv');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<label for="sm_b_max_posts"><?php 
        _e('Limit the number of posts in the sitemap:', 'sitemap');
        ?>
 <input type="text" name="sm_b_max_posts" id="sm_b_max_posts" style="width:40px;" value="<?php 
        echo $this->sg->GetOption("b_max_posts") <= 0 ? "" : $this->sg->GetOption("b_max_posts");
        ?>
" /></label> (<?php 
        echo __('Newer posts will be included first', 'sitemap');
        ?>
)
							</li>
							<li>
								<label for="sm_b_memory"><?php 
        _e('Try to increase the memory limit to:', 'sitemap');
        ?>
 <input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="<?php 
        echo $this->sg->GetOption("b_memory");
        ?>
" /></label> (<?php 
        echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap'));
        ?>
)
							</li>
							<li>
								<label for="sm_b_time"><?php 
        _e('Try to increase the execution time limit to:', 'sitemap');
        ?>
 <input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="<?php 
        echo $this->sg->GetOption("b_time") === -1 ? '' : $this->sg->GetOption("b_time");
        ?>
" /></label> (<?php 
        echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap'));
        ?>
)
							</li>
							<li>
								<?php 
        $useDefStyle = $this->sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default') === true;
        ?>
								<label for="sm_b_style"><?php 
        _e('Include a XSLT stylesheet:', 'sitemap');
        ?>
 <input <?php 
        echo $useDefStyle ? 'disabled="disabled" ' : '';
        ?>
 type="text" name="sm_b_style" id="sm_b_style"  value="<?php 
        echo $this->sg->GetOption("b_style");
        ?>
" /></label>
								(<?php 
        _e('Full or relative URL to your .xsl file', 'sitemap');
        ?>
) <?php 
        if ($this->sg->GetDefaultStyle()) {
            ?>
<label for="sm_b_style_default"><input <?php 
            echo $useDefStyle ? 'checked="checked" ' : '';
            ?>
 type="checkbox" id="sm_b_style_default" name="sm_b_style_default" onclick="document.getElementById('sm_b_style').disabled = this.checked;" /> <?php 
            _e('Use default', 'sitemap');
            ?>
 <?php 
        }
        ?>
							</li>
							<li>
								<label for="sm_b_safemode">
									<?php 
        $forceSafeMode = floatval($wp_version) < 2.2;
        ?>
									<input type="checkbox" <?php 
        if ($forceSafeMode) {
            ?>
disabled="disabled"<?php 
        }
        ?>
 id="sm_b_safemode" name="sm_b_safemode" <?php 
        echo $this->sg->GetOption("b_safemode") == true || $forceSafeMode ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Enable MySQL standard mode. Use this only if you\'re getting MySQL errors. (Needs much more memory!)', 'sitemap');
        ?>
									<?php 
        if ($forceSafeMode) {
            ?>
 <br /><small><?php 
            _e("Upgrade WordPress at least to 2.2 to enable the faster MySQL access", 'sitemap');
            ?>
</small><?php 
        }
        ?>
								</label>
							</li>
							<li>
								<label for="sm_b_auto_delay">
								<?php 
        $forceDirect = floatval($wp_version) < 2.1;
        ?>
									<input type="checkbox" <?php 
        if ($forceDirect) {
            ?>
disabled="disabled"<?php 
        }
        ?>
 id="sm_b_auto_delay" name="sm_b_auto_delay" <?php 
        echo $this->sg->GetOption("b_auto_delay") == true && !$forceDirect ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Build the sitemap in a background process (You don\'t have to wait when you save a post)', 'sitemap');
        ?>
									<?php 
        if ($forceDirect) {
            ?>
 <br /><small><?php 
            _e("Upgrade WordPress at least to 2.1 to enable background building", 'sitemap');
            ?>
</small><?php 
        }
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<?php 
        $this->HtmlPrintBoxHeader('sm_pages', __('Additional pages', 'sitemap'));
        ?>
		
						<?php 
        _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com', 'sitemap');
        echo "<ul><li>";
        echo "<strong>" . __('Note', 'sitemap') . "</strong>: ";
        _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog directory or beneath, you MUST place your sitemap file in the root directory (Look at the &quot;Location of your sitemap file&quot; section on this page)!", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('URL to the page', 'sitemap') . "</strong>: ";
        _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('Priority', 'sitemap') . "</strong>: ";
        _e("Choose the priority of the page relative to the other pages. For example, your homepage might have a higher priority than your imprint.", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('Last Changed', 'sitemap') . "</strong>: ";
        _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).", 'sitemap');
        echo "</li></ul>";
        ?>
						<script type="text/javascript">
							//<![CDATA[
							<?php 
        $freqVals = "'" . implode("','", array_keys($this->sg->_freqNames)) . "'";
        $freqNames = "'" . implode("','", array_values($this->sg->_freqNames)) . "'";
        ?>

							var changeFreqVals = new Array( <?php 
        echo $freqVals;
        ?>
 );
							var changeFreqNames= new Array( <?php 
        echo $freqNames;
        ?>
 );
							
							var priorities= new Array(0 <?php 
        for ($i = 0.1; $i < 1; $i += 0.1) {
            echo "," . number_format($i, 1, ".", "");
        }
        ?>
);
							
							var pages = [ <?php 
        if (count($this->sg->_pages) > 0) {
            for ($i = 0; $i < count($this->sg->_pages); $i++) {
                $v =& $this->sg->_pages[$i];
                if ($i > 0) {
                    echo ",";
                }
                echo '{url:"' . $v->getUrl() . '", priority:' . number_format($v->getPriority(), 1, ".", "") . ', changeFreq:"' . $v->getChangeFreq() . '", lastChanged:"' . ($v != null && $v->getLastMod() > 0 ? date("Y-m-d", $v->getLastMod()) : "") . '"}';
            }
        }
        ?>
 ];
							//]]>
						</script>
						<script type="text/javascript" src="<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/sitemap.js"></script>
						<table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable">
							<tr>
								<th scope="col"><?php 
        _e('URL to the page', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Priority', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Change Frequency', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Last Changed', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('#', 'sitemap');
        ?>
</th>
							</tr>
							<?php 
        if (count($this->sg->_pages) <= 0) {
            ?>
									<tr>
										<td colspan="5" align="center"><?php 
            _e('No pages defined.', 'sitemap');
            ?>
</td>
									</tr><?php 
        }
        ?>
						</table>
						<a href="javascript:void(0);" onclick="sm_addPage();"><?php 
        _e("Add new page", 'sitemap');
        ?>
</a>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					
					<!-- AutoPrio Options -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_postprio', __('Post Priority', 'sitemap'));
        ?>
	
						<p><?php 
        _e('Please select how the priority of each post should be calculated:', 'sitemap');
        ?>
</p>
						<ul>
							<li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php 
        echo $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), "");
        ?>
 /> <label for="sm_b_prio_provider__0"><?php 
        _e('Do not use automatic priority calculation', 'sitemap');
        ?>
</label><br /><?php 
        _e('All posts will have the same priority which is defined in &quot;Priorities&quot;', 'sitemap');
        ?>
</p></li>
							<?php 
        for ($i = 0; $i < count($this->sg->_prioProviders); $i++) {
            echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_{$i}\" name=\"sm_b_prio_provider\" value=\"" . $this->sg->_prioProviders[$i] . "\" " . $this->sg->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), $this->sg->_prioProviders[$i]) . " /> <label for=\"sm_b_prio_provider_{$i}\">" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getName')) . "</label><br />" . call_user_func(array(&$this->sg->_prioProviders[$i], 'getDescription')) . "</p></li>";
        }
        ?>
						</ul>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
				
						
					<!-- Location Options -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_location', __('Location of your sitemap file', 'sitemap'));
        ?>
		
						<div>
							<b><label for="sm_location_useauto"><input type="radio" id="sm_location_useauto" name="sm_b_location_mode" value="auto" <?php 
        echo $this->sg->GetOption("b_location_mode") == "auto" ? "checked=\"checked\"" : "";
        ?>
 /> <?php 
        _e('Automatic detection', 'sitemap');
        ?>
</label></b>
							<ul>
								<li>
									<label for="sm_b_filename">
										<?php 
        _e('Filename of the sitemap file', 'sitemap');
        ?>
										<input type="text" id="sm_b_filename" name="sm_b_filename" value="<?php 
        echo $this->sg->GetOption("b_filename");
        ?>
" />
									</label><br />
									<?php 
        _e('Detected Path', 'sitemap');
        ?>
: <?php 
        echo $this->sg->getXmlPath(true);
        ?>
<br /><?php 
        _e('Detected URL', 'sitemap');
        ?>
: <a href="<?php 
        echo $this->sg->getXmlUrl(true);
        ?>
"><?php 
        echo $this->sg->getXmlUrl(true);
        ?>
</a>
								</li>
							</ul>
						</div>
						<div>
							<b><label for="sm_location_usemanual"><input type="radio" id="sm_location_usemanual" name="sm_b_location_mode" value="manual" <?php 
        echo $this->sg->GetOption("b_location_mode") == "manual" ? "checked=\"checked\"" : "";
        ?>
  /> <?php 
        _e('Custom location', 'sitemap');
        ?>
</label></b>
							<ul>
								<li>
									<label for="sm_b_filename_manual">
										<?php 
        _e('Absolute or relative path to the sitemap file, including name.', 'sitemap');
        echo "<br />";
        _e('Example', 'sitemap');
        echo ": /var/www/htdocs/wordpress/sitemap.xml";
        ?>
<br />
										<input style="width:70%" type="text" id="sm_b_filename_manual" name="sm_b_filename_manual" value="<?php 
        echo !$this->sg->GetOption("b_filename_manual") ? $this->sg->getXmlPath() : $this->sg->GetOption("b_filename_manual");
        ?>
" />
									</label>
								</li>
								<li>
									<label for="sm_b_fileurl_manual">
										<?php 
        _e('Complete URL to the sitemap file, including name.', 'sitemap');
        echo "<br />";
        _e('Example', 'sitemap');
        echo ": http://www.yourdomain.com/sitemap.xml";
        ?>
<br />
										<input style="width:70%" type="text" id="sm_b_fileurl_manual" name="sm_b_fileurl_manual" value="<?php 
        echo !$this->sg->GetOption("b_fileurl_manual") ? $this->sg->getXmlUrl() : $this->sg->GetOption("b_fileurl_manual");
        ?>
" />
									</label>
								</li>
							</ul>
						</div>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Includes -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_includes', __('Sitemap Content', 'sitemap'));
        ?>
					
						<ul>
							<li>
								<label for="sm_in_home">
									<input type="checkbox" id="sm_in_home" name="sm_in_home"  <?php 
        echo $this->sg->GetOption("in_home") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_posts">
									<input type="checkbox" id="sm_in_posts" name="sm_in_posts"  <?php 
        echo $this->sg->GetOption("in_posts") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include posts', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_posts_sub">
									<input type="checkbox" id="sm_in_posts_sub" name="sm_in_posts_sub"  <?php 
        echo $this->sg->GetOption("in_posts_sub") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include following pages of multi-page posts (Increases build time and memory usage!)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_pages">
									<input type="checkbox" id="sm_in_pages" name="sm_in_pages"  <?php 
        echo $this->sg->GetOption("in_pages") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_cats">
									<input type="checkbox" id="sm_in_cats" name="sm_in_cats"  <?php 
        echo $this->sg->GetOption("in_cats") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_arch">
									<input type="checkbox" id="sm_in_arch" name="sm_in_arch"  <?php 
        echo $this->sg->GetOption("in_arch") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include archives', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_in_tags">
									<input type="checkbox" id="sm_in_tags" name="sm_in_tags"  <?php 
            echo $this->sg->GetOption("in_tags") == true ? "checked=\"checked\"" : "";
            ?>
 />
									<?php 
            _e('Include tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
            $taxonomies = $this->sg->GetCustomTaxonomies();
            $enabledTaxonomies = $this->sg->GetOption('in_tax');
            foreach ($taxonomies as $taxName) {
                $taxonomy = get_taxonomy($taxName);
                $selected = in_array($taxonomy->name, $enabledTaxonomies);
                ?>
									<li>
										<label for="sm_in_tax[<?php 
                echo $taxonomy->name;
                ?>
]">
											<input type="checkbox" id="sm_in_tax[<?php 
                echo $taxonomy->name;
                ?>
]" name="sm_in_tax[<?php 
                echo $taxonomy->name;
                ?>
]" <?php 
                echo $selected ? "checked=\"checked\"" : "";
                ?>
 />
											<?php 
                echo str_replace('%s', $taxonomy->label, __('Include taxonomy pages for %s', 'sitemap'));
                ?>
										</label>
									<li>
									<?php 
            }
            ?>
							<?php 
        }
        ?>
							<li>
								<label for="sm_in_auth">
									<input type="checkbox" id="sm_in_auth" name="sm_in_auth"  <?php 
        echo $this->sg->GetOption("in_auth") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include author pages', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						<b><?php 
        _e('Further options', 'sitemap');
        ?>
:</b>
						<ul>
							<li>
								<label for="sm_in_lastmod">
									<input type="checkbox" id="sm_in_lastmod" name="sm_in_lastmod"  <?php 
        echo $this->sg->GetOption("in_lastmod") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include the last modification time.', 'sitemap');
        ?>
								</label><br />
								<small><?php 
        _e('This is highly recommended and helps the search engines to know when your content has changed. This option affects <i>all</i> sitemap entries.', 'sitemap');
        ?>
</small>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Excluded Items -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap'));
        ?>
					
						<b><?php 
        _e('Excluded categories', 'sitemap');
        ?>
:</b>
						<?php 
        if (version_compare($wp_version, "2.5.1", ">=")) {
            ?>
							<cite style="display:block; margin-left:40px;"><?php 
            _e("Note", "sitemap");
            ?>
: <?php 
            _e("Using this feature will increase build time and memory usage!", "sitemap");
            ?>
</cite>
							<div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
							<ul>
								<?php 
            wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false);
            ?>
							</ul>
							</div>
						<?php 
        } else {
            ?>
							<ul><li><?php 
            echo sprintf(__("This feature requires at least WordPress 2.5.1, you are using %s", "sitemap"), $wp_version);
            ?>
</li></ul>
						<?php 
        }
        ?>
						
						<b><?php 
        _e("Exclude posts", "sitemap");
        ?>
:</b>
						<div style="margin:5px 0 13px 40px;">
							<label for="sm_b_exclude"><?php 
        _e('Exclude the following posts or pages:', 'sitemap');
        ?>
 <small><?php 
        _e('List of IDs, separated by comma', 'sitemap');
        ?>
</small><br />
							<input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php 
        echo implode(",", $this->sg->GetOption("b_exclude"));
        ?>
" /></label><br />
							<cite><?php 
        _e("Note", "sitemap");
        ?>
: <?php 
        _e("Child posts won't be excluded automatically!", "sitemap");
        ?>
</cite>
						</div>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Change frequencies -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_change_frequencies', __('Change frequencies', 'sitemap'));
        ?>

						<p>
							<b><?php 
        _e('Note', 'sitemap');
        ?>
:</b>
							<?php 
        _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap');
        ?>
						</p>
						<ul>
							<li>
								<label for="sm_cf_home">
									<select id="sm_cf_home" name="sm_cf_home"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_home"));
        ?>
</select>
									<?php 
        _e('Homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_posts">
									<select id="sm_cf_posts" name="sm_cf_posts"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_posts"));
        ?>
</select>
									<?php 
        _e('Posts', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_pages">
									<select id="sm_cf_pages" name="sm_cf_pages"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_pages"));
        ?>
</select>
									<?php 
        _e('Static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_cats">
									<select id="sm_cf_cats" name="sm_cf_cats"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_cats"));
        ?>
</select>
									<?php 
        _e('Categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_arch_curr">
									<select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr"));
        ?>
</select>
									<?php 
        _e('The current archive of this month (Should be the same like your homepage)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_arch_old">
									<select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old"));
        ?>
</select>
									<?php 
        _e('Older archives (Changes only if you edit an old post)', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_cf_tags">
									<select id="sm_cf_tags" name="sm_cf_tags"><?php 
            $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_tags"));
            ?>
</select>
									<?php 
            _e('Tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
        }
        ?>
							<li>
								<label for="sm_cf_auth">
									<select id="sm_cf_auth" name="sm_cf_auth"><?php 
        $this->sg->HtmlGetFreqNames($this->sg->GetOption("cf_auth"));
        ?>
</select>
									<?php 
        _e('Author pages', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Priorities -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_priorities', __('Priorities', 'sitemap'));
        ?>
						<ul>
							<li>
								<label for="sm_pr_home">
									<select id="sm_pr_home" name="sm_pr_home"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_home"));
        ?>
</select>
									<?php 
        _e('Homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_posts">
									<select id="sm_pr_posts" name="sm_pr_posts"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts"));
        ?>
</select>
									<?php 
        _e('Posts (If auto calculation is disabled)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_posts_min">
									<select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min"));
        ?>
</select>
									<?php 
        _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_pages">
									<select id="sm_pr_pages" name="sm_pr_pages"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_pages"));
        ?>
</select>
									<?php 
        _e('Static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_cats">
									<select id="sm_pr_cats" name="sm_pr_cats"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_cats"));
        ?>
</select>
									<?php 
        _e('Categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_arch">
									<select id="sm_pr_arch" name="sm_pr_arch"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_arch"));
        ?>
</select>
									<?php 
        _e('Archives', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_pr_tags">
									<select id="sm_pr_tags" name="sm_pr_tags"><?php 
            $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_tags"));
            ?>
</select>
									<?php 
            _e('Tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
        }
        ?>
							<li>
								<label for="sm_pr_auth">
									<select id="sm_pr_auth" name="sm_pr_auth"><?php 
        $this->sg->HtmlGetPriorityValues($this->sg->GetOption("pr_auth"));
        ?>
</select>
									<?php 
        _e('Author pages', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					</div>
					<div>
						<p class="submit">
							<?php 
        wp_nonce_field('sitemap');
        ?>
							<input type="submit" name="sm_update" value="<?php 
        _e('Update options', 'sitemap');
        ?>
" />
							<input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php 
        _e('Reset options', 'sitemap');
        ?>
" />
						</p>
					</div>
				
				<?php 
        if ($this->mode == 27) {
            ?>
				</div>
				</div>
				<?php 
        }
        ?>
				</div>
				<script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script>
			</form>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="sm_donate_form">
				<?php 
        $lc = array("en" => array("cc" => "USD", "lc" => "US"), "en-GB" => array("cc" => "GBP", "lc" => "GB"), "de" => array("cc" => "EUR", "lc" => "DE"));
        $myLc = $lc["en"];
        $wpl = get_bloginfo('language');
        if (!empty($wpl)) {
            if (array_key_exists($wpl, $lc)) {
                $myLc = $lc[$wpl];
            } else {
                $wpl = substr($wpl, 0, 2);
                if (array_key_exists($wpl, $lc)) {
                    $myLc = $lc[$wpl];
                }
            }
        }
        ?>
				<input type="hidden" name="cmd" value="_xclick" />
				<input type="hidden" name="business" value="<?php 
        echo "donate" . "@" . "arnebra" . "chhold.de";
        ?>
" />
				<input type="hidden" name="item_name" value="Sitemap Generator for WordPress. Please tell me if if you don't want to be listed on the donator list." />
				<input type="hidden" name="no_shipping" value="1" />
				<input type="hidden" name="return" value="<?php 
        echo 'http://' . $_SERVER['HTTP_HOST'] . $this->sg->GetBackLink();
        ?>
&amp;sm_donated=true" />
				<input type="hidden" name="item_number" value="0001" />
				<input type="hidden" name="currency_code" value="<?php 
        echo $myLc["cc"];
        ?>
" />
				<input type="hidden" name="bn" value="PP-BuyNowBF" />
				<input type="hidden" name="lc" value="<?php 
        echo $myLc["lc"];
        ?>
" />
				<input type="hidden" name="rm" value="2" />
				<input type="hidden" name="on0" value="Your Website" />
				<input type="hidden" name="os0" value="<?php 
        echo get_bloginfo("home");
        ?>
"/>
			</form>
		</div>
		<?php 
    }
Example #22
0
    public static function prdctfltr_pf_filter_analytics($field)
    {
        if (get_option('wc_settings_prdctfltr_use_analytics', 'no') == 'no') {
            return '';
        }
        global $woocommerce;
        ?>
		<tr valign="top" class="">
			<th scope="row" class="titledesc">
				<label for="<?php 
        echo esc_attr($field['id']);
        ?>
"><?php 
        echo esc_html($field['title']);
        ?>
</label>
				<?php 
        echo '<img class="help_tip" data-tip="' . esc_attr($field['desc']) . '" src="' . $woocommerce->plugin_url() . '/assets/images/help.png" height="16" width="16" />';
        ?>
			</th>
			<td class="forminp forminp-<?php 
        echo sanitize_title($field['type']);
        ?>
">
				<div class="prdctfltr_filtering_analytics_wrapper">
			<?php 
        $stats = get_option('wc_settings_prdctfltr_filtering_analytics_stats', array());
        if (empty($stats)) {
            _e('Filtering Analytics are empty! Please enable the filtering analytics and wait for the results! Thank you!', 'prdctfltr');
        } else {
            ?>
					<div class="prdctfltr_filtering_analytics_settings">
						<a href="#" class="button-primary prdctfltr_filtering_analytics_reset"><?php 
            _e('Reset Analytics', 'prdctfltr');
            ?>
</a>
					</div>
					<?php 
            foreach ($stats as $k => $v) {
                $total_count = 0;
                ?>
						<div class="prdctfltr_filtering_analytics">
							<h3 class="prdctfltr_filtering_analytics_title">
							<?php 
                $mode = 'default';
                if (substr($k, 0, 3) == 'pa_') {
                    $label = wc_attribute_label($k);
                } else {
                    if ($k == 'product_cat') {
                        $label = __('Categories', 'prdctfltr');
                    } else {
                        if ($k == 'product_tag') {
                            $label = __('Tags', 'prdctfltr');
                        } else {
                            if ($k == 'characteristics') {
                                $label = __('Characteristics', 'prdctfltr');
                            } else {
                                if (is_taxonomy($k)) {
                                    $curr_term = get_taxonomy($k);
                                    $label = $curr_term->name;
                                }
                            }
                        }
                    }
                }
                if (!empty($v) && is_array($v)) {
                    foreach ($v as $vk => $vv) {
                        $term = get_term_by('slug', $vk, $k);
                        $term_name = ucfirst($term->name) . ' (' . $v[$vk] . ')';
                        $v[$term_name] = $v[$vk];
                        $total_count = $total_count + $v[$vk];
                        unset($v[$vk]);
                    }
                    echo __('Filter', 'prdctfltr') . ' <em>' . ucfirst($label) . '</em> - ' . __('Total hits count:') . ' ' . $total_count;
                }
                ?>
							</h3>
							<div id="prdctfltr_filtering_analytics_<?php 
                echo sanitize_title($k);
                ?>
" class="prdctfltr_filtering_analytics_chart" data-chart-title="<?php 
                echo esc_attr(__('Filtering data for taxonomy', 'prdctfltr') . ': ' . $k);
                ?>
" data-chart="<?php 
                echo esc_attr(json_encode($v));
                ?>
"></div>
						</div>
					<?php 
            }
            ?>
					<script type="text/javascript" src="https://www.google.com/jsapi"></script>
					<script type="text/javascript">
						(function($){
						"use strict";

							google.load('visualization', '1.0', {'packages':['corechart']});

							google.setOnLoadCallback(drawCharts);

							function drawCharts() {

								$('.prdctfltr_filtering_analytics_chart').each( function() {

									var el = $(this).attr('id');
									var chartData = $.parseJSON($(this).attr('data-chart'));
									var chartDataTitle = $(this).attr('data-chart-title');

									var chartArray = [];
									for (var key in chartData) {
										if (chartData.hasOwnProperty(key)) {
											chartArray.push([key, chartData[key]]);
										}
									};

									var data = new google.visualization.DataTable();
									data.addColumn('string', 'Term');
									data.addColumn('number', 'Count');
									data.addRows(chartArray);

									var options = {'title':chartDataTitle,'is3D':true,'chartArea':{'width':'100%','height':'80%'},'legend':{'position':'bottom'}};

									var chart = new google.visualization.PieChart(document.getElementById(el));
									chart.draw(data, options);

								});

							}
						})(jQuery);
					</script>
			<?php 
        }
        ?>
				</div>
			</td>
		</tr>
<?php 
    }
Example #23
0
    } else {
        ?>
		
			<?php 
        single_cat_title();
        ?>
 // <?php 
        bloginfo('name');
        ?>
			
		<?php 
    }
    ?>
		
	<?php 
} elseif (is_taxonomy('name')) {
    ?>
	
		<?php 
    single_term_title();
    ?>
 // <?php 
    bloginfo('name');
    ?>
		
	<?php 
} elseif (is_tag('name')) {
    ?>
 
	
		<?php 
     return $this->get_menu($args);
 }
 /** Hiển thị 1 menu */
 public function get_menu($args = array())
 {
     /** kiếm tra và add giá trị mặc định */
     if (isset($args['parent'])) {
         $parent = $args['parent'];
     } else {
         $parent = FALSE;
     }
     if (isset($args['wrapper'])) {
         $wrapper = $args['wrapper'];
     } else {
         $wrapper = 'ul';
     }
     if (isset($args['wrapper_class'])) {
         $wrapper_class = $args['wrapper_class'];
     } else {
         $wrapper_class = FALSE;
     }
     if (isset($args['wrapper_id'])) {
         $wrapper_id = $args['wrapper_id'];
     } else {
         $wrapper_id = FALSE;
     }
     if (isset($args['item'])) {
         $item = $args['item'];
     } else {
         $item = 'li';
     }
     if (isset($args['item_class'])) {
         $item_class = $args['item_class'];
     } else {
         $item_class = '';
     }
     if (isset($args['item_id'])) {
         $item_id = $args['item_id'];
     } else {
         $item_id = '';
     }
     if (isset($args['permalink_class'])) {
         $permalink_class = $args['permalink_class'];
     } else {
         $permalink_class = '';
     }
     if (isset($args['permalink_attr'])) {
         $permalink_attr = $args['permalink_attr'];
     } else {
         $permalink_attr = '';
     }
     if (isset($args['permalink_before'])) {
         $permalink_before = $args['permalink_before'];
     } else {
         $permalink_before = '';
     }
     if (isset($args['permalink_after'])) {
         $permalink_after = $args['permalink_after'];
     } else {
         $permalink_after = '';
     }
     if (isset($args['echo'])) {
         $echo = $args['echo'];
     } else {
         $echo = TRUE;
     }
     $name = $args['name'];
     if (is_numeric($parent)) {
         $menu_id = $parent;
     } else {
         $menu_id = get_option('section=theme_setting&key=' . $name);
     }
     $output_html = '';
     /** wrapper_class */
     if ($wrapper_class) {
         $wrapper_class = ' class="' . $wrapper_class . '"';
     }
     /** wrapper_id */
     if ($wrapper_id) {
         $wrapper_id = ' id="' . $wrapper_id . '"';
     }
     /** open wrapper */
     $output_html .= '<' . $wrapper . $wrapper_class . $wrapper_id . '>' . "\n";
     /** load menu item */
     $tableName = DB_PREFIX . "object";
     $whereArray = array('parent' => MySQL::SQLValue($menu_id), 'key' => MySQL::SQLValue('menu_item'));
     $this->SelectRows($tableName, $whereArray, NULL, 'order_number', 'ASC');
     while ($row = $this->Row()) {
         $menu_item[] = $row;
     }
     /** menu item */
     foreach ($menu_item as $this_menu_item) {
         $id = $this_menu_item->id;
         $menu_name = get_men_val(array('name' => 'menu_name', 'id' => $id));
         $menu_class = get_men_val(array('name' => 'menu_class', 'id' => $id));
         $menu_attr = get_men_val(array('name' => 'menu_attr', 'id' => $id));
         $menu_icon = get_men_val(array('name' => 'menu_icon', 'id' => $id));
         $menu_request_uri = get_men_val(array('name' => 'menu_request_uri', 'id' => $id));
         if ($menu_attr != '') {
             $menu_attr = ' ' . $menu_attr;
         }
         if ($menu_class != '') {
             $menu_class = ' ' . $menu_class;
         }
         /** item href */
         if (is_numeric($menu_request_uri)) {
             $data_uri = get_uri_data("id={$menu_request_uri}");
             $href = SITE_URL . FOLDER_PATH . $data_uri->uri;
             $object_type = $data_uri->object_type;
             $object_id = $data_uri->object_id;
             $menu_request_uri_html = ' href="' . $href . '"';
             $data_object_html = ' data-' . $object_type . '="' . $object_id . '"';
         } else {
             $menu_request_uri_html = ' href="#"';
             $data_object_html = '';
             $object_type = FALSE;
             $object_id = FALSE;
         }
         /** item_class */
         $in_page_class = '';
         if (is_taxonomy()) {
             $current_uri = get_current_uri();
             $data_current_uri = get_uri_data("uri={$current_uri}");
             $current_object_id = $data_current_uri->object_id;
             if ($object_type == 'taxonomy' and $object_id == $current_object_id) {
                 $in_page_class = ' current_page';
             }
         }
         if ($item_class) {
             $item_class_html = ' class="' . $item_class . $in_page_class . ' menu-' . $id . '"';
         } else {
             $item_class_html = ' class="menu-' . $id . $in_page_class . '"';
         }
         /** item_id */
         if ($item_id) {
             $item_id_html = ' id="' . $item_id . ' menu-' . $id . '"';
         } else {
             $item_id_html = ' id="menu-' . $id . '"';
         }
         /** open item */
         $output_html .= '<' . $item . $item_class_html . $item_id_html . $data_object_html . '>' . "\n";
         /** permalink before */
         $output_html .= $permalink_before;
         /** permalink_class */
         if ($permalink_class) {
             $permalink_class_html = ' class="' . $permalink_class . $menu_class . '"';
         } else {
             $permalink_class_html = '';
         }
         /** permalink */
         $output_html .= '<a' . $menu_request_uri_html . $menu_attr . $permalink_class_html . '>' . $menu_name . '</a>' . "\n";
         /** permalink after */
         $output_html .= $permalink_after;
         /** sub menu */
         if ($this->has_sub_menu($id)) {
             $args['parent'] = $id;
             $args['echo'] = FALSE;
             $args['wrapper_class'] = 'sub-menu';
             $args['wrapper_id'] = '';
             $output_html .= $this->get_menu($args);
         }
         /** close item */
         $output_html .= '</' . $item . '>' . "\n";
     }
     /** close wrapper */
     $output_html .= '</' . $wrapper . '>' . "\n";
     if ($echo == TRUE) {
         echo $output_html;
     } else {
         return $output_html;
Example #25
0
    /**
     * Displays the option page
     *
     * @since 3.0
     * @access public
     * @author Arne Brachhold
     */
    public function HtmlShowOptionsPage()
    {
        global $wp_version;
        //Hopefully this fixes the caching issues after upgrade. Redirect incl. the versions, but only if no POST data.
        if (count($_POST) == 0 && count($_GET) == 1 && isset($_GET["page"])) {
            $redirURL = $this->sg->GetBackLink() . '&sm_fromidx=true';
            //Redirect so the sm_rebuild GET parameter no longer exists.
            @header("location: " . $redirURL);
            //If there was already any other output, the header redirect will fail
            echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
            echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
            exit;
        }
        $snl = false;
        //SNL
        $this->sg->Initate();
        $message = "";
        $is_ms = $this->sg->IsMultiSite();
        if (!empty($_REQUEST["sm_rebuild"])) {
            //Pressed Button: Rebuild Sitemap
            check_admin_referer('sitemap');
            if (isset($_GET["sm_do_debug"]) && $_GET["sm_do_debug"] == "true") {
                //Check again, just for the case that something went wrong before
                if (!current_user_can("administrator")) {
                    echo '<p>Please log in as admin</p>';
                    return;
                }
                $oldErr = error_reporting(E_ALL);
                $oldIni = ini_set("display_errors", 1);
                echo '<div class="wrap">';
                echo '<h2>' . __('XML Sitemap Generator for WordPress', 'sitemap') . " " . $this->sg->GetVersion() . '</h2>';
                echo '<p>This is the debug mode of the XML Sitemap Generator. It will show all PHP notices and warnings as well as the internal logs, messages and configuration.</p>';
                echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
                echo "<h3>WordPress and PHP Information</h3>";
                echo '<p>WordPress ' . $GLOBALS['wp_version'] . ' with ' . ' DB ' . $GLOBALS['wp_db_version'] . ' on PHP ' . phpversion() . '</p>';
                echo '<p>Plugin version: ' . $this->sg->GetVersion() . ' (' . $this->sg->GetSvnVersion() . ')';
                echo '<h4>Environment</h4>';
                echo "<pre>";
                $sc = $_SERVER;
                unset($sc["HTTP_COOKIE"]);
                print_r($sc);
                echo "</pre>";
                echo "<h4>WordPress Config</h4>";
                echo "<pre>";
                $opts = array();
                if (function_exists('wp_load_alloptions')) {
                    $opts = wp_load_alloptions();
                } else {
                    global $wpdb;
                    $os = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options}");
                    foreach ((array) $os as $o) {
                        $opts[$o->option_name] = $o->option_value;
                    }
                }
                $popts = array();
                foreach ($opts as $k => $v) {
                    //Try to filter out passwords etc...
                    if (preg_match("/pass|login|pw|secret|user|usr|key|auth|token/si", $k)) {
                        continue;
                    }
                    $popts[$k] = htmlspecialchars($v);
                }
                print_r($popts);
                echo "</pre>";
                echo '<h4>Sitemap Config</h4>';
                echo "<pre>";
                print_r($this->sg->GetOptions());
                echo "</pre>";
                echo '<h3>Sitemap Content and Errors, Warnings, Notices</h3>';
                echo '<div>';
                $sitemaps = $this->sg->SimulateIndex();
                foreach ($sitemaps as $sitemap) {
                    echo "<h4>Sitemap: <a href=\"" . $sitemap["data"]->GetUrl() . "\">" . $sitemap["type"] . "/" . ($sitemap["params"] ? $sitemap["params"] : "(No parameters)") . "</a> by " . $sitemap["caller"]["class"] . "</h4>";
                    $res = $this->sg->SimulateSitemap($sitemap["type"], $sitemap["params"]);
                    echo "<ul style='padding-left:10px;'>";
                    foreach ($res as $s) {
                        echo "<li>" . $s["data"]->GetUrl() . "</li>";
                    }
                    echo "</ul>";
                }
                $status = GoogleSitemapGeneratorStatus::Load();
                echo '</div>';
                echo '<h3>MySQL Queries</h3>';
                if (defined('SAVEQUERIES') && SAVEQUERIES) {
                    echo '<pre>';
                    var_dump($GLOBALS['wpdb']->queries);
                    echo '</pre>';
                    $total = 0;
                    foreach ($GLOBALS['wpdb']->queries as $q) {
                        $total += $q[1];
                    }
                    echo '<h4>Total Query Time</h4>';
                    echo '<pre>' . count($GLOBALS['wpdb']->queries) . ' queries in ' . round($total, 2) . ' seconds.</pre>';
                } else {
                    echo '<p>Please edit wp-db.inc.php in wp-includes and set SAVEQUERIES to true if you want to see the queries.</p>';
                }
                echo "<h3>Build Process Results</h3>";
                echo "<pre>";
                print_r($status);
                echo "</pre>";
                echo '<p>Done. <a href="' . wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap') . '">Rebuild</a> or <a href="' . $this->sg->GetBackLink() . '">Return</a></p>';
                echo '<p style="font-weight:bold; color:red; padding:5px; border:1px red solid; text-align:center;">DO NOT POST THIS INFORMATION ON PUBLIC PAGES LIKE SUPPORT FORUMS AS IT MAY CONTAIN PASSWORDS OR SECRET SERVER INFORMATION!</p>';
                echo '</div>';
                @error_reporting($oldErr);
                @ini_set("display_errors", $oldIni);
                return;
            } else {
                $redirURL = $this->sg->GetBackLink() . '&sm_fromrb=true';
                //Redirect so the sm_rebuild GET parameter no longer exists.
                @header("location: " . $redirURL);
                //If there was already any other output, the header redirect will fail
                echo '<script type="text/javascript">location.replace("' . $redirURL . '");</script>';
                echo '<noscript><a href="' . $redirURL . '">Click here to continue</a></noscript>';
                exit;
            }
        } else {
            if (!empty($_POST['sm_update'])) {
                //Pressed Button: Update Config
                check_admin_referer('sitemap');
                if (isset($_POST['sm_b_style']) && $_POST['sm_b_style'] == $this->sg->getDefaultStyle()) {
                    $_POST['sm_b_style_default'] = true;
                    $_POST['sm_b_style'] = '';
                }
                foreach ($this->sg->GetOptions() as $k => $v) {
                    //Check vor values and convert them into their types, based on the category they are in
                    if (!isset($_POST[$k])) {
                        $_POST[$k] = "";
                    }
                    // Empty string will get false on 2bool and 0 on 2float
                    //Options of the category "Basic Settings" are boolean, except the filename and the autoprio provider
                    if (substr($k, 0, 5) == "sm_b_") {
                        if ($k == "sm_b_prio_provider" || $k == "sm_b_yahookey" || $k == "sm_b_style" || $k == "sm_b_memory") {
                            if ($k == "sm_b_filename_manual" && strpos($_POST[$k], "\\") !== false) {
                                $_POST[$k] = stripslashes($_POST[$k]);
                            }
                            $this->sg->SetOption($k, (string) $_POST[$k]);
                        } else {
                            if ($k == "sm_b_time") {
                                if ($_POST[$k] == '') {
                                    $_POST[$k] = -1;
                                }
                                $this->sg->SetOption($k, intval($_POST[$k]));
                            } else {
                                if ($k == "sm_i_install_date") {
                                    if ($this->sg->GetOption('i_install_date') <= 0) {
                                        $this->sg->SetOption($k, time());
                                    }
                                } else {
                                    if ($k == "sm_b_exclude") {
                                        $IDss = array();
                                        $IDs = explode(",", $_POST[$k]);
                                        for ($x = 0; $x < count($IDs); $x++) {
                                            $ID = intval(trim($IDs[$x]));
                                            if ($ID > 0) {
                                                $IDss[] = $ID;
                                            }
                                        }
                                        $this->sg->SetOption($k, $IDss);
                                    } else {
                                        if ($k == "sm_b_exclude_cats") {
                                            $exCats = array();
                                            if (isset($_POST["post_category"])) {
                                                foreach ((array) $_POST["post_category"] as $vv) {
                                                    if (!empty($vv) && is_numeric($vv)) {
                                                        $exCats[] = intval($vv);
                                                    }
                                                }
                                            }
                                            $this->sg->SetOption($k, $exCats);
                                        } else {
                                            $this->sg->SetOption($k, (bool) $_POST[$k]);
                                        }
                                    }
                                }
                            }
                        }
                        //Options of the category "Includes" are boolean
                    } else {
                        if (substr($k, 0, 6) == "sm_in_") {
                            if ($k == 'sm_in_tax') {
                                $enabledTaxonomies = array();
                                foreach (array_keys((array) $_POST[$k]) as $taxName) {
                                    if (empty($taxName) || !(function_exists('taxonomy_exists') ? taxonomy_exists($taxName) : is_taxonomy($taxName))) {
                                        continue;
                                    }
                                    $enabledTaxonomies[] = $taxName;
                                }
                                $this->sg->SetOption($k, $enabledTaxonomies);
                            } else {
                                if ($k == 'sm_in_customtypes') {
                                    $enabledPostTypes = array();
                                    foreach (array_keys((array) $_POST[$k]) as $postTypeName) {
                                        if (empty($postTypeName) || !post_type_exists($postTypeName)) {
                                            continue;
                                        }
                                        $enabledPostTypes[] = $postTypeName;
                                    }
                                    $this->sg->SetOption($k, $enabledPostTypes);
                                } else {
                                    $this->sg->SetOption($k, (bool) $_POST[$k]);
                                }
                            }
                            //Options of the category "Change frequencies" are string
                        } else {
                            if (substr($k, 0, 6) == "sm_cf_") {
                                $this->sg->SetOption($k, (string) $_POST[$k]);
                                //Options of the category "Priorities" are float
                            } else {
                                if (substr($k, 0, 6) == "sm_pr_") {
                                    $this->sg->SetOption($k, (double) $_POST[$k]);
                                }
                            }
                        }
                    }
                }
                //Apply page changes from POST
                $this->sg->SetPages($this->HtmlApplyPages());
                if ($this->sg->SaveOptions()) {
                    $message .= __('Configuration updated', 'sitemap') . "<br />";
                } else {
                    $message .= __('Error while saving options', 'sitemap') . "<br />";
                }
                if ($this->sg->SavePages()) {
                    $message .= __("Pages saved", 'sitemap') . "<br />";
                } else {
                    $message .= __('Error while saving pages', 'sitemap') . "<br />";
                }
            } else {
                if (!empty($_POST["sm_reset_config"])) {
                    //Pressed Button: Reset Config
                    check_admin_referer('sitemap');
                    $this->sg->InitOptions();
                    $this->sg->SaveOptions();
                    $message .= __('The default configuration was restored.', 'sitemap');
                } else {
                    if (!empty($_GET["sm_delete_old"])) {
                        //Delete old sitemap files
                        check_admin_referer('sitemap');
                        //Check again, just for the case that something went wrong before
                        if (!current_user_can("administrator")) {
                            echo '<p>Please log in as admin</p>';
                            return;
                        }
                        if (!$this->sg->DeleteOldFiles()) {
                            $message = __("The old files could NOT be deleted. Please use an FTP program and delete them by yourself.", "sitemap");
                        } else {
                            $message = __("The old files were successfully deleted.", "sitemap");
                        }
                    }
                }
            }
        }
        //Print out the message to the user, if any
        if ($message != "") {
            ?>
			<div class="updated"><strong><p><?php 
            echo $message;
            ?>
</p></strong></div><?php 
        }
        if (!$snl) {
            if (isset($_GET['sm_hidedonate'])) {
                $this->sg->SetOption('i_hide_donated', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_donated'])) {
                $this->sg->SetOption('i_donated', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hide_note'])) {
                $this->sg->SetOption('i_hide_note', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hidedonors'])) {
                $this->sg->SetOption('i_hide_donors', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_hide_works'])) {
                $this->sg->SetOption('i_hide_works', true);
                $this->sg->SaveOptions();
            }
            if (isset($_GET['sm_donated']) || $this->sg->GetOption('i_donated') === true && $this->sg->GetOption('i_hide_donated') !== true) {
                ?>
				<div class="updated">
					<strong><p><?php 
                _e('Thank you very much for your donation. You help me to continue support and development of this plugin and other free software!', 'sitemap');
                ?>
 <a href="<?php 
                echo $this->sg->GetBackLink() . "&amp;sm_hidedonate=true";
                ?>
"><small style="font-weight:normal;"><?php 
                _e('Hide this notice', 'sitemap');
                ?>
</small></a></p></strong>
				</div>
				<?php 
            } else {
                if ($this->sg->GetOption('i_donated') !== true && $this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_note') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 30) {
                    ?>
				<div class="updated">
					<strong><p><?php 
                    echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-donate-note"), __('Thanks for using this plugin! You\'ve installed this plugin over a month ago. If it works and you are satisfied with the results, isn\'t it worth at least a few dollar? <a href="%s">Donations</a> help me to continue support and development of this <i>free</i> software! <a href="%s">Sure, no problem!</a>', 'sitemap'));
                    ?>
 <a href="<?php 
                    echo $this->sg->GetBackLink() . "&amp;sm_donated=true";
                    ?>
" style="float:right; display:block; border:none; margin-left:10px;"><small style="font-weight:normal; "><?php 
                    _e('Sure, but I already did!', 'sitemap');
                    ?>
</small></a> <a href="<?php 
                    echo $this->sg->GetBackLink() . "&amp;sm_hide_note=true";
                    ?>
" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php 
                    _e('No thanks, please don\'t bug me anymore!', 'sitemap');
                    ?>
</small></a></p></strong>
					<div style="clear:right;"></div>
				</div>
				<?php 
                } else {
                    if ($this->sg->GetOption('i_install_date') > 0 && $this->sg->GetOption('i_hide_works') !== true && time() > $this->sg->GetOption('i_install_date') + 60 * 60 * 24 * 15) {
                        ?>
				<div class="updated">
					<strong><p><?php 
                        echo str_replace("%s", $this->sg->GetRedirectLink("sitemap-works-note"), __('Thanks for using this plugin! You\'ve installed this plugin some time ago. If it works and your are satisfied, why not <a href="%s">rate it</a> and <a href="%s">recommend it</a> to others? :-)', 'sitemap'));
                        ?>
 <a href="<?php 
                        echo $this->sg->GetBackLink() . "&amp;sm_hide_works=true";
                        ?>
" style="float:right; display:block; border:none;"><small style="font-weight:normal; "><?php 
                        _e('Don\'t show this anymore', 'sitemap');
                        ?>
</small></a></p></strong>
					<div style="clear:right;"></div>
				</div>
				<?php 
                    }
                }
            }
        }
        ?>
				
		<style type="text/css">
		
		li.sm_hint {
			color:green;
		}
		
		li.sm_optimize {
			color:orange;
		}
		
		li.sm_error {
			color:red;
		}
		
		input.sm_warning:hover {
			background: #ce0000;
			color: #fff;
		}
		
		a.sm_button {
			padding:4px;
			display:block;
			padding-left:25px;
			background-repeat:no-repeat;
			background-position:5px 50%;
			text-decoration:none;
			border:none;
		}
		
		a.sm_button:hover {
			border-bottom-width:1px;
		}

		a.sm_donatePayPal {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-paypal.gif);
		}
		
		a.sm_donateAmazon {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-amazon.gif);
		}
		
		a.sm_pluginHome {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-arne.gif);
		}
		
		a.sm_pluginList {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-email.gif);
		}
		
		a.sm_pluginSupport {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-wordpress.gif);
		}
		
		a.sm_pluginBugs {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-trac.gif);
		}
		
		a.sm_resGoogle {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-google.gif);
		}
		
		a.sm_resYahoo {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-yahoo.gif);
		}
		
		a.sm_resBing {
			background-image:url(<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/icon-bing.gif);
		}
		
		div.sm-update-nag p {
			margin:5px;
		}
		
		</style>
	

		<style type="text/css">
	
			.sm-padded .inside {
				margin:12px!important;
			}
			.sm-padded .inside ul {
				margin:6px 0 12px 0;
			}
			
			.sm-padded .inside input {
				padding:1px;
				margin:0;
			}
		</style>


		<div class="wrap" id="sm_div">
			<form method="post" action="<?php 
        echo $this->sg->GetBackLink();
        ?>
">
				<h2><?php 
        _e('XML Sitemap Generator for WordPress', 'sitemap');
        echo " " . $this->sg->GetVersion();
        ?>
 </h2>
				<?php 
        if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
            wp_update_plugins();
            $file = GoogleSitemapGeneratorLoader::GetBaseName();
            $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile());
            $current = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
            if (isset($current->response[$file])) {
                $r = $current->response[$file];
                ?>
<div id="update-nag" class="sm-update-nag"><?php 
                if (!current_user_can('edit_plugins')) {
                    printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                } else {
                    if (empty($r->package)) {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                    } else {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin={$file}", 'upgrade-plugin_' . $file));
                    }
                }
                ?>
</div><?php 
            }
        }
        if (get_option('blog_public') != 1) {
            ?>
<div class="error"><p><?php 
            echo str_replace("%s", "options-privacy.php", __('Your blog is currently blocking search engines! Visit the <a href="%s">privacy settings</a> to change this.', 'sitemap'));
            ?>
</p></div><?php 
        }
        ?>

					<?php 
        if (!$snl) {
            ?>
						<div id="poststuff" class="metabox-holder has-right-sidebar">
							<div class="inner-sidebar">
								<div id="side-sortables" class="meta-box-sortabless ui-sortable" style="position:relative;">
					<?php 
        } else {
            ?>
						<div id="poststuff" class="metabox-holder">
					<?php 
        }
        ?>
				
				
					<?php 
        if (!$snl) {
            ?>
				
							<?php 
            $this->HtmlPrintBoxHeader('sm_pnres', __('About this Plugin:', 'sitemap'), true);
            ?>
								<a class="sm_button sm_pluginHome"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-home');
            ?>
"><?php 
            _e('Plugin Homepage', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginHome"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-feedback');
            ?>
"><?php 
            _e('Suggest a Feature', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginList"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-list');
            ?>
"><?php 
            _e('Notify List', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginSupport" href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-support');
            ?>
"><?php 
            _e('Support Forum', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginBugs"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-bugs');
            ?>
"><?php 
            _e('Report a Bug', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_donatePayPal"  href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-paypal');
            ?>
"><?php 
            _e('Donate with PayPal', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_donateAmazon"  href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-amazon');
            ?>
"><?php 
            _e('My Amazon Wish List', 'sitemap');
            ?>
</a>
								<?php 
            if (__('translator_name', 'sitemap') != 'translator_name') {
                ?>
<a class="sm_button sm_pluginSupport" href="<?php 
                _e('translator_url', 'sitemap');
                ?>
"><?php 
                _e('translator_name', 'sitemap');
                ?>
</a><?php 
            }
            ?>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
						
						
							<?php 
            $this->HtmlPrintBoxHeader('sm_smres', __('Sitemap Resources:', 'sitemap'), true);
            ?>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-gwt');
            ?>
"><?php 
            _e('Webmaster Tools', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-gwb');
            ?>
"><?php 
            _e('Webmaster Blog', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_resYahoo"     href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-yse');
            ?>
"><?php 
            _e('Site Explorer', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resYahoo"     href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-ywb');
            ?>
"><?php 
            _e('Search Blog', 'sitemap');
            ?>
</a>
								
								<a class="sm_button sm_resBing"      href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-lwt');
            ?>
"><?php 
            _e('Webmaster Tools', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resBing"      href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-lswcb');
            ?>
"><?php 
            _e('Webmaster Center Blog', 'sitemap');
            ?>
</a>
								<br />
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-prot');
            ?>
"><?php 
            _e('Sitemaps Protocol', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_resGoogle"    href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-ofaq');
            ?>
"><?php 
            _e('Official Sitemaps FAQ', 'sitemap');
            ?>
</a>
								<a class="sm_button sm_pluginHome"   href="<?php 
            echo $this->sg->GetRedirectLink('sitemap-afaq');
            ?>
"><?php 
            _e('My Sitemaps FAQ', 'sitemap');
            ?>
</a>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
							
							<?php 
            $this->HtmlPrintBoxHeader('dm_donations', __('Recent Donations:', 'sitemap'), true);
            ?>
								<?php 
            if ($this->sg->GetOption('i_hide_donors') !== true) {
                ?>
									<iframe border="0" frameborder="0" scrolling="no" allowtransparency="yes" style="width:100%; height:80px;" src="<?php 
                echo $this->sg->GetRedirectLink('sitemap-donorlist');
                ?>
">
									<?php 
                _e('List of the donors', 'sitemap');
                ?>
									</iframe><br />
									<a href="<?php 
                echo $this->sg->GetBackLink() . "&amp;sm_hidedonors=true";
                ?>
"><small><?php 
                _e('Hide this list', 'sitemap');
                ?>
</small></a><br /><br />
								<?php 
            }
            ?>
								<a style="float:left; margin-right:5px; border:none;" href="javascript:document.getElementById('sm_donate_form').submit();"><img style="vertical-align:middle; border:none; margin-top:2px;" src="<?php 
            echo $this->sg->GetPluginUrl();
            ?>
img/icon-donate.gif" border="0" alt="PayPal" title="Help me to continue support of this plugin :)" /></a>
								<span><small><?php 
            _e('Thanks for your support!', 'sitemap');
            ?>
</small></span>
								<div style="clear:left; height:1px;"></div>
							<?php 
            $this->HtmlPrintBoxFooter(true);
            ?>
							
						
						</div>
					</div>
					<?php 
        }
        ?>
					
					<div class="has-sidebar sm-padded" >
				
						<div id="post-body-content" class="<?php 
        if (!$snl) {
            ?>
has-sidebar-content<?php 
        }
        ?>
">
					
							<div class="meta-box-sortabless">

							<!-- beta note -->
							<?php 
        $this->HtmlPrintBoxHeader('sm_rebuild', __('Beta-version', 'sitemap'));
        ?>
							<p><strong><?php 
        _e('Thanks for trying out the latest beta release of the sitemap generator plugin!', 'sitemap');
        ?>
</strong></p>
							<p><?php 
        printf(__('Please let me know if you experience any problems or if you have any suggestions by posting <a href="%s">here</a>. Your feedback is very important for me!', 'sitemap'), $this->sg->GetRedirectLink('sitemap-beta-feedback'));
        ?>
</p>
							<?php 
        $this->HtmlPrintBoxFooter();
        ?>

					
					<!-- Rebuild Area -->
					<?php 
        $status = GoogleSitemapGeneratorStatus::Load();
        $head = __('Search engines haven\'t been notified yet', 'sitemap');
        if ($status != null && $status->GetStartTime() > 0) {
            $st = $status->GetStartTime() + get_option('gmt_offset') * 3600;
            $head = str_replace("%date%", date_i18n(get_option('date_format'), $st) . " " . date_i18n(get_option('time_format'), $st), __("Result of the last ping, started on %date%.", 'sitemap'));
        }
        $this->HtmlPrintBoxHeader('sm_rebuild', $head);
        ?>
						<ul>
							<?php 
        if ($this->sg->OldFileExists()) {
            echo "<li class=\"sm_error\">" . str_replace("%s", wp_nonce_url($this->sg->GetBackLink() . "&sm_delete_old=true", 'sitemap'), __('There is still a sitemap.xml or sitemap.xml.gz file in your blog directory. Please delete them as no static files are used anymore or <a href="%s">try to delete them automatically</a>.', 'sitemap')) . "</li>";
        }
        echo "<li>" . str_replace("%s", $this->sg->getXmlUrl(), __('The URL to your sitemap index file is: <a href="%s">%s</a>.', 'sitemap')) . "</li>";
        if ($status == null) {
            echo "<li>" . __('Search engines haven\'t been notified yet. Write a post to let them know about your sitemap.', 'sitemap') . "</li>";
        } else {
            $services = $status->GetUsedPingServices();
            foreach ($services as $service) {
                $name = $status->GetServiceName($service);
                if ($status->GetPingResult($service)) {
                    echo "<li>" . sprintf(__("%s was <b>successfully notified</b> about changes.", 'sitemap'), $name) . "</li>";
                    $dur = $status->GetPingDuration($service);
                    if ($dur > 4) {
                        echo "<li class=\\sm_optimize\">" . str_replace(array("%time%", "%name%"), array($dur, $name), __("It took %time% seconds to notify %name%, maybe you want to disable this feature to reduce the building time.", 'sitemap')) . "</li>";
                    }
                } else {
                    echo "<li class=\"sm_error\">" . str_replace(array("%s", "%name%"), array(wp_nonce_url($this->sg->GetBackLink() . "&sm_ping_service=" . $service . "&noheader=true", 'sitemap'), $name), __('There was a problem while notifying %name%. <a href="%s">View result</a>', 'sitemap')) . "</li>";
                }
            }
        }
        echo "<li>" . str_replace("%d", wp_nonce_url($this->sg->GetBackLink() . "&sm_rebuild=true&sm_do_debug=true", 'sitemap'), __('If you encounter any problems with your sitemap you can use the <a href="%d">debug function</a> to get more information.', 'sitemap')) . "</li>";
        ?>

						</ul>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
						
					<!-- Basic Options -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_basic_options', __('Basic Options', 'sitemap'));
        ?>
					
						<b><?php 
        _e('Update notification:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-ping');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<input type="checkbox" id="sm_b_ping" name="sm_b_ping" <?php 
        echo $this->sg->GetOption("b_ping") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_ping"><?php 
        _e('Notify Google about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-gwt'), __('No registration required, but you can join the <a href="%s">Google Webmaster Tools</a> to check crawling statistics.', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingmsn" name="sm_b_pingmsn" <?php 
        echo $this->sg->GetOption("b_pingmsn") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingmsn"><?php 
        _e('Notify Bing (formerly MSN Live Search) about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        echo str_replace("%s", $this->sg->GetRedirectLink('sitemap-lwt'), __('No registration required, but you can join the <a href="%s">Bing Webmaster Tools</a> to check crawling statistics.', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingask" name="sm_b_pingask" <?php 
        echo $this->sg->GetOption("b_pingask") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingask"><?php 
        _e('Notify Ask.com about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<small><?php 
        _e('No registration required.', 'sitemap');
        ?>
</small>
							</li>
							<li>
								<input type="checkbox" id="sm_b_pingyahoo" name="sm_b_pingyahoo" <?php 
        echo $this->sg->GetOption("b_pingyahoo") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<label for="sm_b_pingyahoo"><?php 
        _e('Notify YAHOO about updates of your Blog', 'sitemap');
        ?>
</label><br />
								<label for="sm_b_yahookey"><?php 
        _e('Your Application ID:', 'sitemap');
        ?>
 <input type="text" name="sm_b_yahookey" id="sm_b_yahookey" value="<?php 
        echo esc_attr($this->sg->GetOption("b_yahookey"));
        ?>
" /></label><br />
								<small><?php 
        echo str_replace(array("%s1", "%s2"), array($this->sg->GetRedirectLink('sitemap-ykr'), ' (<a href="http://developer.yahoo.net/about/">Web Services by Yahoo!</a>)'), __('Don\'t you have such a key? <a href="%s1">Request one here</a>! %s2', 'sitemap'));
        ?>
</small>
							</li>
							<li>
								<label for="sm_b_robots">
								<input type="checkbox" id="sm_b_robots" name="sm_b_robots" <?php 
        echo $this->sg->GetOption("b_robots") == true ? "checked=\"checked\"" : "";
        ?>
 />
								<?php 
        _e("Add sitemap URL to the virtual robots.txt file.", 'sitemap');
        ?>
								</label>

								<br />
								<small><?php 
        _e('The virtual robots.txt generated by WordPress is used. A real robots.txt file must NOT exist in the blog directory!', 'sitemap');
        ?>
</small>
							</li>
						</ul>
						<b><?php 
        _e('Advanced options:', 'sitemap');
        ?>
</b> <a href="<?php 
        echo $this->sg->GetRedirectLink('sitemap-help-options-adv');
        ?>
"><?php 
        _e('Learn more', 'sitemap');
        ?>
</a>
						<ul>
							<li>
								<label for="sm_b_memory"><?php 
        _e('Try to increase the memory limit to:', 'sitemap');
        ?>
 <input type="text" name="sm_b_memory" id="sm_b_memory" style="width:40px;" value="<?php 
        echo esc_attr($this->sg->GetOption("b_memory"));
        ?>
" /></label> (<?php 
        echo htmlspecialchars(__('e.g. "4M", "16M"', 'sitemap'));
        ?>
)
							</li>
							<li>
								<label for="sm_b_time"><?php 
        _e('Try to increase the execution time limit to:', 'sitemap');
        ?>
 <input type="text" name="sm_b_time" id="sm_b_time" style="width:40px;" value="<?php 
        echo esc_attr($this->sg->GetOption("b_time") === -1 ? '' : $this->sg->GetOption("b_time"));
        ?>
" /></label> (<?php 
        echo htmlspecialchars(__('in seconds, e.g. "60" or "0" for unlimited', 'sitemap'));
        ?>
)
							</li>
							<li>
								<?php 
        $useDefStyle = $this->sg->GetDefaultStyle() && $this->sg->GetOption('b_style_default') === true;
        ?>
								<label for="sm_b_style"><?php 
        _e('Include a XSLT stylesheet:', 'sitemap');
        ?>
 <input <?php 
        echo $useDefStyle ? 'disabled="disabled" ' : '';
        ?>
 type="text" name="sm_b_style" id="sm_b_style"  value="<?php 
        echo esc_attr($this->sg->GetOption("b_style"));
        ?>
" /></label>
								(<?php 
        _e('Full or relative URL to your .xsl file', 'sitemap');
        ?>
) <?php 
        if ($this->sg->GetDefaultStyle()) {
            ?>
<label for="sm_b_style_default"><input <?php 
            echo $useDefStyle ? 'checked="checked" ' : '';
            ?>
 type="checkbox" id="sm_b_style_default" name="sm_b_style_default" onclick="document.getElementById('sm_b_style').disabled = this.checked;" /> <?php 
            _e('Use default', 'sitemap');
            ?>
 <?php 
        }
        ?>
							</li>
							<li>
								<label for="sm_b_html">
									<input type="checkbox" id="sm_b_html" name="sm_b_html"  <?php 
        echo $this->sg->GetOption("b_html") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include sitemap in HTML format', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<?php 
        $this->HtmlPrintBoxHeader('sm_pages', __('Additional pages', 'sitemap'));
        ?>
		
						<?php 
        _e('Here you can specify files or URLs which should be included in the sitemap, but do not belong to your Blog/WordPress.<br />For example, if your domain is www.foo.com and your blog is located on www.foo.com/blog you might want to include your homepage at www.foo.com', 'sitemap');
        echo "<ul><li>";
        echo "<strong>" . __('Note', 'sitemap') . "</strong>: ";
        _e("If your blog is in a subdirectory and you want to add pages which are NOT in the blog directory or beneath, you MUST place your sitemap file in the root directory (Look at the &quot;Location of your sitemap file&quot; section on this page)!", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('URL to the page', 'sitemap') . "</strong>: ";
        _e("Enter the URL to the page. Examples: http://www.foo.com/index.html or www.foo.com/home ", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('Priority', 'sitemap') . "</strong>: ";
        _e("Choose the priority of the page relative to the other pages. For example, your homepage might have a higher priority than your imprint.", 'sitemap');
        echo "</li><li>";
        echo "<strong>" . __('Last Changed', 'sitemap') . "</strong>: ";
        _e("Enter the date of the last change as YYYY-MM-DD (2005-12-31 for example) (optional).", 'sitemap');
        echo "</li></ul>";
        ?>
						<script type="text/javascript">
							//<![CDATA[
							<?php 
        $freqVals = "'" . implode("','", array_keys($this->sg->GetFreqNames())) . "'";
        $freqNames = "'" . implode("','", array_values($this->sg->GetFreqNames())) . "'";
        ?>

							var changeFreqVals = new Array( <?php 
        echo $freqVals;
        ?>
 );
							var changeFreqNames= new Array( <?php 
        echo $freqNames;
        ?>
 );
							
							var priorities= new Array(0 <?php 
        for ($i = 0.1; $i < 1; $i += 0.1) {
            echo "," . number_format($i, 1, ".", "");
        }
        ?>
);
							
							var pages = [ <?php 
        $pages = $this->sg->GetPages();
        if (count($pages) > 0) {
            for ($i = 0; $i < count($this->sg->GetPages()); $i++) {
                $v = $pages[$i];
                if ($i > 0) {
                    echo ",";
                }
                echo '{url:"' . esc_js($v->getUrl()) . '", priority:' . esc_js(number_format($v->getPriority(), 1, ".", "")) . ', changeFreq:"' . esc_js($v->getChangeFreq()) . '", lastChanged:"' . esc_js($v != null && $v->getLastMod() > 0 ? date("Y-m-d", $v->getLastMod()) : "") . '"}';
            }
        }
        ?>
 ];
							//]]>
						</script>
						<script type="text/javascript" src="<?php 
        echo $this->sg->GetPluginUrl();
        ?>
img/sitemap.js"></script>
						<table width="100%" cellpadding="3" cellspacing="3" id="sm_pageTable">
							<tr>
								<th scope="col"><?php 
        _e('URL to the page', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Priority', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Change Frequency', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('Last Changed', 'sitemap');
        ?>
</th>
								<th scope="col"><?php 
        _e('#', 'sitemap');
        ?>
</th>
							</tr>
							<?php 
        if (count($pages) <= 0) {
            ?>
									<tr>
										<td colspan="5" align="center"><?php 
            _e('No pages defined.', 'sitemap');
            ?>
</td>
									</tr><?php 
        }
        ?>
						</table>
						<a href="javascript:void(0);" onclick="sm_addPage();"><?php 
        _e("Add new page", 'sitemap');
        ?>
</a>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					
					<!-- AutoPrio Options -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_postprio', __('Post Priority', 'sitemap'));
        ?>
	
						<p><?php 
        _e('Please select how the priority of each post should be calculated:', 'sitemap');
        ?>
</p>
						<ul>
							<li><p><input type="radio" name="sm_b_prio_provider" id="sm_b_prio_provider__0" value="" <?php 
        echo $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), "");
        ?>
 /> <label for="sm_b_prio_provider__0"><?php 
        _e('Do not use automatic priority calculation', 'sitemap');
        ?>
</label><br /><?php 
        _e('All posts will have the same priority which is defined in &quot;Priorities&quot;', 'sitemap');
        ?>
</p></li>
							<?php 
        $provs = $this->sg->GetPrioProviders();
        for ($i = 0; $i < count($provs); $i++) {
            echo "<li><p><input type=\"radio\" id=\"sm_b_prio_provider_{$i}\" name=\"sm_b_prio_provider\" value=\"" . $provs[$i] . "\" " . $this->HtmlGetChecked($this->sg->GetOption("b_prio_provider"), $provs[$i]) . " /> <label for=\"sm_b_prio_provider_{$i}\">" . call_user_func(array($provs[$i], 'getName')) . "</label><br />" . call_user_func(array($provs[$i], 'getDescription')) . "</p></li>";
        }
        ?>
						</ul>
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Includes -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_includes', __('Sitemap Content', 'sitemap'));
        ?>
						<b><?php 
        _e('WordPress standard content', 'sitemap');
        ?>
:</b>
						<ul>
							<li>
								<label for="sm_in_home">
									<input type="checkbox" id="sm_in_home" name="sm_in_home"  <?php 
        echo $this->sg->GetOption("in_home") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_posts">
									<input type="checkbox" id="sm_in_posts" name="sm_in_posts"  <?php 
        echo $this->sg->GetOption("in_posts") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include posts', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_pages">
									<input type="checkbox" id="sm_in_pages" name="sm_in_pages"  <?php 
        echo $this->sg->GetOption("in_pages") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_cats">
									<input type="checkbox" id="sm_in_cats" name="sm_in_cats"  <?php 
        echo $this->sg->GetOption("in_cats") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_arch">
									<input type="checkbox" id="sm_in_arch" name="sm_in_arch"  <?php 
        echo $this->sg->GetOption("in_arch") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include archives', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_in_auth">
									<input type="checkbox" id="sm_in_auth" name="sm_in_auth"  <?php 
        echo $this->sg->GetOption("in_auth") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include author pages', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_in_tags">
									<input type="checkbox" id="sm_in_tags" name="sm_in_tags"  <?php 
            echo $this->sg->GetOption("in_tags") == true ? "checked=\"checked\"" : "";
            ?>
 />
									<?php 
            _e('Include tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
        }
        ?>
						</ul>
							
						<?php 
        if ($this->sg->IsTaxonomySupported()) {
            $taxonomies = $this->sg->GetCustomTaxonomies();
            $enabledTaxonomies = $this->sg->GetOption('in_tax');
            if (count($taxonomies) > 0) {
                ?>
<b><?php 
                _e('Custom taxonomies', 'sitemap');
                ?>
:</b><ul><?php 
                foreach ($taxonomies as $taxName) {
                    $taxonomy = get_taxonomy($taxName);
                    $selected = in_array($taxonomy->name, $enabledTaxonomies);
                    ?>
									<li>
										<label for="sm_in_tax[<?php 
                    echo $taxonomy->name;
                    ?>
]">
											<input type="checkbox" id="sm_in_tax[<?php 
                    echo $taxonomy->name;
                    ?>
]" name="sm_in_tax[<?php 
                    echo $taxonomy->name;
                    ?>
]" <?php 
                    echo $selected ? "checked=\"checked\"" : "";
                    ?>
 />
											<?php 
                    echo str_replace('%s', $taxonomy->label, __('Include taxonomy pages for %s', 'sitemap'));
                    ?>
										</label>
									</li>
									<?php 
                }
                ?>
</ul><?php 
            }
        }
        if ($this->sg->IsCustomPostTypesSupported()) {
            $custom_post_types = $this->sg->GetCustomPostTypes();
            $enabledPostTypes = $this->sg->GetOption('in_customtypes');
            if (count($custom_post_types) > 0) {
                ?>
<b><?php 
                _e('Custom post types', 'sitemap');
                ?>
:</b><ul><?php 
                foreach ($custom_post_types as $post_type) {
                    $post_type_object = get_post_type_object($post_type);
                    if (is_array($enabledPostTypes)) {
                        $selected = in_array($post_type_object->name, $enabledPostTypes);
                    }
                    ?>
									<li>
										<label for="sm_in_customtypes[<?php 
                    echo $post_type_object->name;
                    ?>
]">
											<input type="checkbox" id="sm_in_customtypes[<?php 
                    echo $post_type_object->name;
                    ?>
]" name="sm_in_customtypes[<?php 
                    echo $post_type_object->name;
                    ?>
]" <?php 
                    echo $selected ? "checked=\"checked\"" : "";
                    ?>
 />
											<?php 
                    echo str_replace('%s', $post_type_object->label, __('Include custom post type %s', 'sitemap'));
                    ?>
										</label>
									</li>
									<?php 
                }
                ?>
</ul><?php 
            }
        }
        ?>
						
						<b><?php 
        _e('Further options', 'sitemap');
        ?>
:</b>
						<ul>
							<li>
								<label for="sm_in_lastmod">
									<input type="checkbox" id="sm_in_lastmod" name="sm_in_lastmod"  <?php 
        echo $this->sg->GetOption("in_lastmod") == true ? "checked=\"checked\"" : "";
        ?>
 />
									<?php 
        _e('Include the last modification time.', 'sitemap');
        ?>
								</label><br />
								<small><?php 
        _e('This is highly recommended and helps the search engines to know when your content has changed. This option affects <i>all</i> sitemap entries.', 'sitemap');
        ?>
</small>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Excluded Items -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_excludes', __('Excluded items', 'sitemap'));
        ?>
					
						<b><?php 
        _e('Excluded categories', 'sitemap');
        ?>
:</b>

						<cite style="display:block; margin-left:40px;"><?php 
        _e("Note", "sitemap");
        ?>
: <?php 
        _e("Using this feature will increase build time and memory usage!", "sitemap");
        ?>
</cite>
						<div style="border-color:#CEE1EF; border-style:solid; border-width:2px; height:10em; margin:5px 0px 5px 40px; overflow:auto; padding:0.5em 0.5em;">
							<ul>
								<?php 
        wp_category_checklist(0, 0, $this->sg->GetOption("b_exclude_cats"), false);
        ?>
							</ul>
						</div>
						
						<b><?php 
        _e("Exclude posts", "sitemap");
        ?>
:</b>
						<div style="margin:5px 0 13px 40px;">
							<label for="sm_b_exclude"><?php 
        _e('Exclude the following posts or pages:', 'sitemap');
        ?>
 <small><?php 
        _e('List of IDs, separated by comma', 'sitemap');
        ?>
</small><br />
							<input name="sm_b_exclude" id="sm_b_exclude" type="text" style="width:400px;" value="<?php 
        echo esc_attr(implode(",", $this->sg->GetOption("b_exclude")));
        ?>
" /></label><br />
							<cite><?php 
        _e("Note", "sitemap");
        ?>
: <?php 
        _e("Child posts won't be excluded automatically!", "sitemap");
        ?>
</cite>
						</div>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Change frequencies -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_change_frequencies', __('Change frequencies', 'sitemap'));
        ?>

						<p>
							<b><?php 
        _e('Note', 'sitemap');
        ?>
:</b>
							<?php 
        _e('Please note that the value of this tag is considered a hint and not a command. Even though search engine crawlers consider this information when making decisions, they may crawl pages marked "hourly" less frequently than that, and they may crawl pages marked "yearly" more frequently than that. It is also likely that crawlers will periodically crawl pages marked "never" so that they can handle unexpected changes to those pages.', 'sitemap');
        ?>
						</p>
						<ul>
							<li>
								<label for="sm_cf_home">
									<select id="sm_cf_home" name="sm_cf_home"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_home"));
        ?>
</select>
									<?php 
        _e('Homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_posts">
									<select id="sm_cf_posts" name="sm_cf_posts"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_posts"));
        ?>
</select>
									<?php 
        _e('Posts', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_pages">
									<select id="sm_cf_pages" name="sm_cf_pages"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_pages"));
        ?>
</select>
									<?php 
        _e('Static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_cats">
									<select id="sm_cf_cats" name="sm_cf_cats"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_cats"));
        ?>
</select>
									<?php 
        _e('Categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_arch_curr">
									<select id="sm_cf_arch_curr" name="sm_cf_arch_curr"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_arch_curr"));
        ?>
</select>
									<?php 
        _e('The current archive of this month (Should be the same like your homepage)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_cf_arch_old">
									<select id="sm_cf_arch_old" name="sm_cf_arch_old"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_arch_old"));
        ?>
</select>
									<?php 
        _e('Older archives (Changes only if you edit an old post)', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_cf_tags">
									<select id="sm_cf_tags" name="sm_cf_tags"><?php 
            $this->HtmlGetFreqNames($this->sg->GetOption("cf_tags"));
            ?>
</select>
									<?php 
            _e('Tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
        }
        ?>
							<li>
								<label for="sm_cf_auth">
									<select id="sm_cf_auth" name="sm_cf_auth"><?php 
        $this->HtmlGetFreqNames($this->sg->GetOption("cf_auth"));
        ?>
</select>
									<?php 
        _e('Author pages', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					<!-- Priorities -->
					<?php 
        $this->HtmlPrintBoxHeader('sm_priorities', __('Priorities', 'sitemap'));
        ?>
						<ul>
							<li>
								<label for="sm_pr_home">
									<select id="sm_pr_home" name="sm_pr_home"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_home"));
        ?>
</select>
									<?php 
        _e('Homepage', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_posts">
									<select id="sm_pr_posts" name="sm_pr_posts"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_posts"));
        ?>
</select>
									<?php 
        _e('Posts (If auto calculation is disabled)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_posts_min">
									<select id="sm_pr_posts_min" name="sm_pr_posts_min"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_posts_min"));
        ?>
</select>
									<?php 
        _e('Minimum post priority (Even if auto calculation is enabled)', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_pages">
									<select id="sm_pr_pages" name="sm_pr_pages"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_pages"));
        ?>
</select>
									<?php 
        _e('Static pages', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_cats">
									<select id="sm_pr_cats" name="sm_pr_cats"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_cats"));
        ?>
</select>
									<?php 
        _e('Categories', 'sitemap');
        ?>
								</label>
							</li>
							<li>
								<label for="sm_pr_arch">
									<select id="sm_pr_arch" name="sm_pr_arch"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_arch"));
        ?>
</select>
									<?php 
        _e('Archives', 'sitemap');
        ?>
								</label>
							</li>
							<?php 
        if ($this->sg->IsTaxonomySupported()) {
            ?>
							<li>
								<label for="sm_pr_tags">
									<select id="sm_pr_tags" name="sm_pr_tags"><?php 
            $this->HtmlGetPriorityValues($this->sg->GetOption("pr_tags"));
            ?>
</select>
									<?php 
            _e('Tag pages', 'sitemap');
            ?>
								</label>
							</li>
							<?php 
        }
        ?>
							<li>
								<label for="sm_pr_auth">
									<select id="sm_pr_auth" name="sm_pr_auth"><?php 
        $this->HtmlGetPriorityValues($this->sg->GetOption("pr_auth"));
        ?>
</select>
									<?php 
        _e('Author pages', 'sitemap');
        ?>
								</label>
							</li>
						</ul>
						
					<?php 
        $this->HtmlPrintBoxFooter();
        ?>
					
					</div>
					<div>
						<p class="submit">
							<?php 
        wp_nonce_field('sitemap');
        ?>
							<input type="submit" class="button-primary" name="sm_update" value="<?php 
        _e('Update options', 'sitemap');
        ?>
" />
							<input type="submit" onclick='return confirm("Do you really want to reset your configuration?");' class="sm_warning" name="sm_reset_config" value="<?php 
        _e('Reset options', 'sitemap');
        ?>
" />
						</p>
					</div>
				
				
				</div>
				</div>
				</div>
				<script type="text/javascript">if(typeof(sm_loadPages)=='function') addLoadEvent(sm_loadPages); </script>
			</form>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="sm_donate_form">
				<?php 
        $lc = array("en" => array("cc" => "USD", "lc" => "US"), "en-GB" => array("cc" => "GBP", "lc" => "GB"), "de" => array("cc" => "EUR", "lc" => "DE"));
        $myLc = $lc["en"];
        $wpl = get_bloginfo('language');
        if (!empty($wpl)) {
            if (array_key_exists($wpl, $lc)) {
                $myLc = $lc[$wpl];
            } else {
                $wpl = substr($wpl, 0, 2);
                if (array_key_exists($wpl, $lc)) {
                    $myLc = $lc[$wpl];
                }
            }
        }
        ?>
				<input type="hidden" name="cmd" value="_xclick" />
				<input type="hidden" name="business" value="<?php 
        echo "donate" . "@" . "arnebra" . "chhold.de";
        ?>
" />
				<input type="hidden" name="item_name" value="Sitemap Generator for WordPress. Please tell me if if you don't want to be listed on the donator list." />
				<input type="hidden" name="no_shipping" value="1" />
				<input type="hidden" name="return" value="<?php 
        echo 'http://' . $_SERVER['HTTP_HOST'] . $this->sg->GetBackLink();
        ?>
&amp;sm_donated=true" />
				<input type="hidden" name="item_number" value="0001" />
				<input type="hidden" name="currency_code" value="<?php 
        echo $myLc["cc"];
        ?>
" />
				<input type="hidden" name="bn" value="PP-BuyNowBF" />
				<input type="hidden" name="lc" value="<?php 
        echo $myLc["lc"];
        ?>
" />
				<input type="hidden" name="rm" value="2" />
				<input type="hidden" name="on0" value="Your Website" />
				<input type="hidden" name="os0" value="<?php 
        echo get_bloginfo("url");
        ?>
"/>
			</form>
		</div>
		<?php 
    }
Example #26
0
	/**
	 * Extended get_terms function support
	 * - Limit category
	 * - Limit days
	 * - Selection restrict
	 * - Min usage
	 *
	 * @param string|array $taxonomies
	 * @param string $args
	 * @return array
	 */
	function getTerms( $taxonomies, $args = '', $internal_st = false ) {
		global $wpdb;
		$empty_array = array();

		$single_taxonomy = false;
		if ( !is_array($taxonomies) ) {
			$single_taxonomy = true;
			$taxonomies = array($taxonomies);
		}

		foreach ( (array) $taxonomies as $taxonomy ) {
			if ( ! is_taxonomy($taxonomy) ) {
				$error = & new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
				return $error;
			}
		}
		$in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
		
		$defaults = array('orderby' => 'name', 'order' => 'ASC',
			'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
			'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
			'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
			'pad_counts' => false, 'offset' => '', 'search' => '', 
			// Simple tags added
			'limit_days' => 0, 'category' => 0, 'min_usage' => 0, 'st_name__like' => '' );

		$args = wp_parse_args( $args, $defaults );

		// Translate selection order
		$args['orderby'] = $args['selectionby'];
		$args['order']   = $args['selection'];

		$args['number'] 	= absint( $args['number'] );
		$args['offset'] 	= absint( $args['offset'] );
		$args['limit_days'] = absint( $args['limit_days'] );
		$args['min_usage'] 	= absint( $args['min_usage'] );

		if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) ||
			'' !== $args['parent'] ) {
			$args['child_of'] 		= 0;
			$args['hierarchical'] 	= false;
			$args['pad_counts'] 	= false;
		}

		if ( 'all' == $args['get'] ) {
			$args['child_of'] 		= 0;
			$args['hide_empty'] 	= 0;
			$args['hierarchical'] 	= false;
			$args['pad_counts'] 	= false;
		}
		extract($args, EXTR_SKIP);

		if ( $child_of ) {
			$hierarchy = _get_term_hierarchy($taxonomies[0]);
			if ( !isset($hierarchy[$child_of]) )
				return $empty_array;
		}

		if ( $parent ) {
			$hierarchy = _get_term_hierarchy($taxonomies[0]);
			if ( !isset($hierarchy[$parent]) )
				return $empty_array;
		}

		$_orderby = strtolower($orderby);
		if ( 'count' == $_orderby )
			$orderby = 'tt.count';
		if ( 'random' == $_orderby )
			$orderby = 'RAND()';
		else if ( 'name' == $_orderby )
			$orderby = 't.name';
		else if ( 'slug' == $_orderby )
			$orderby = 't.slug';
		else if ( 'term_group' == $_orderby )
			$orderby = 't.term_group';
		elseif ( empty($_orderby) || 'id' == $_orderby )
			$orderby = 't.term_id';
		$orderby = apply_filters( 'get_terms_orderby', $orderby, $args );

		$where = '';
		$inclusions = '';
		if ( !empty($include) ) {
			$exclude = '';
			$exclude_tree = '';
			$interms = preg_split('/[\s,]+/',$include);
			if ( count($interms) ) {
				foreach ( (array) $interms as $interm ) {
					if (empty($inclusions))
						$inclusions  = ' AND ( t.term_id = ' . intval($interm) . ' ';
					else
						$inclusions .= ' OR t.term_id = ' . intval($interm) . ' ';
				}
			}
		}
		if ( !empty($inclusions) )
			$inclusions .= ')';
		$where .= $inclusions;

		$exclusions = '';
		if ( ! empty( $exclude_tree ) ) {
			$excluded_trunks = preg_split('/[\s,]+/',$exclude_tree);
			foreach( (array) $excluded_trunks as $extrunk ) {
				$excluded_children = (array) get_terms($taxonomies[0], array('child_of' => intval($extrunk), 'fields' => 'ids'));
				$excluded_children[] = $extrunk;
				foreach( (array) $excluded_children as $exterm ) {
					if ( empty($exclusions) )
						$exclusions  = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
					else
						$exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';

				}
			}
		}
		if ( !empty($exclude) ) {
			$exterms = preg_split('/[\s,]+/',$exclude);
			if ( count($exterms) ) {
				foreach ( (array) $exterms as $exterm ) {
					if ( empty($exclusions) )
						$exclusions  = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
					else
						$exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
				}
			}
		}

		if ( !empty($exclusions) )
			$exclusions .= ')';
		$exclusions = apply_filters('list_terms_exclusions', $exclusions, $args );
		$where .= $exclusions;

		// $args can be whatever, only use the args defined in defaults to compute the key
		$filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
		$key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
		$last_changed = wp_cache_get('last_changed', 'terms');
		if ( !$last_changed ) {
			$last_changed = time();
			wp_cache_set('last_changed', $last_changed, 'terms');
		}
		$cache_key = "st_get_terms:$key:$last_changed";
		$cache = wp_cache_get( $cache_key, 'terms' );
		if ( false !== $cache ) {
			$cache = apply_filters('get_terms', $cache, $taxonomies, $args);
			return $cache;
		}

		// ST Features : Restrict category
		if ( $category != 0 ) {
			if ( !is_array($taxonomies) ) 
				$taxonomies = array($taxonomies);

			$incategories = preg_split('/[\s,]+/', $category);
			$incategories = array_map('intval', $incategories);

			$taxonomies 	= "'" . implode("', '", $taxonomies) . "'";
			$incategories 	= "'" . implode("', '", $incategories) . "'";

			$where .= " AND tr.object_id IN ( ";
				$where .= "SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($incategories)";
			$where .= " ) ";

			unset($incategories, $category);
		}

		// ST Features : Limit posts date
		if ( $limit_days != 0 ) {
			$where .= " AND tr.object_id IN ( ";
				$where .= "SELECT ID WHERE $wpdb->posts WHERE post_date_gmt > '" .date( 'Y-m-d H:i:s', time() - $limit_days * 86400 ). "'";
			$where .= " ) ";	

			unset($limit_days);
		}

		if ( !empty($slug) ) {
			$slug = sanitize_title($slug);
			$where .= " AND t.slug = '$slug'";
		}

		if ( !empty($name__like) )
			$where .= " AND t.name LIKE '{$name__like}%'";

		if ( '' !== $parent ) {
			$parent = (int) $parent;
			$where .= " AND tt.parent = '$parent'";
		}

		// ST Features : Another way to search 
		if ( strpos($st_name__like, ' ') !== false ) {

			$st_terms_formatted = array();
			$st_terms = preg_split('/[\s,]+/', $st_name_like);
			foreach ( (array) $st_terms as $st_term ) {
				if ( empty($st_term) )
					continue;
				$st_terms_formatted[] = "t.name LIKE '%".like_escape($st_term)."%'";
			}

			$where .= " AND ( " . explode( ' OR ', $st_terms_formatted ) . " ) ";
			unset( $st_term, $st_terms_formatted, $st_terms );

		} elseif ( !empty($st_name__like) ) {

			$where .= " AND t.name LIKE '%{$st_name__like}%'";

		}

		// ST Features : Add min usage
		if ( $hide_empty && !$hierarchical ) {
			if ( $min_usage == 0 ) 
				$where .= ' AND tt.count > 0';
			else 
				$where .= $wpdb->prepare( ' AND tt.count >= %d', $min_usage );
		}

		if ( !empty($search) ) {
			$search = like_escape($search);
			$where .= " AND (t.name LIKE '%$search%')";
		}

		// don't limit the query results when we have to descend the family tree
		if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' === $parent ) {
			if( $offset )
				$limit = 'LIMIT ' . $offset . ',' . $number;
			else
				$limit = 'LIMIT ' . $number;

		} else
			$limit = '';

		$selects = array();
		if ( 'all' == $fields )
			$selects = array('t.*', 'tt.*');
		else if ( 'ids' == $fields )
			$selects = array('t.term_id', 'tt.parent', 'tt.count');
		else if ( 'names' == $fields )
			$selects = array('t.term_id', 'tt.parent', 'tt.count', 't.name');

		$select_this = implode(', ', apply_filters( 'get_terms_fields', $selects, $args ));

		$query = "SELECT $select_this 
			FROM $wpdb->terms AS t 
			INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id 
			INNER JOIN $wpdb->term_relationships AS tr ON tt.term_taxonomy_id = tr.term_taxonomy_id
			WHERE tt.taxonomy IN ($in_taxonomies) 
			$where 
			GROUP BY t.term_id
			ORDER BY $orderby $order
			$limit";

		$terms = $wpdb->get_results($query);
		if ( 'all' == $fields ) {
			update_term_cache($terms);
		}

		if ( empty($terms) ) {
			wp_cache_add( $cache_key, array(), 'terms' );
			$terms = apply_filters('get_terms', array(), $taxonomies, $args);
			return $terms;
		}

		if ( $child_of ) {
			$children = _get_term_hierarchy($taxonomies[0]);
			if ( ! empty($children) )
				$terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
		}

		// Update term counts to include children.
		if ( $pad_counts && 'all' == $fields )
			_pad_term_counts($terms, $taxonomies[0]);

		// Make sure we show empty categories that have children.
		if ( $hierarchical && $hide_empty && is_array($terms) ) {
			foreach ( $terms as $k => $term ) {
				if ( ! $term->count ) {
					$children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
					if( is_array($children) )
						foreach ( $children as $child )
							if ( $child->count )
								continue 2;

					// It really is empty
					unset($terms[$k]);
				}
			}
		}
		reset ( $terms );

		$_terms = array();
		if ( 'ids' == $fields ) {
			while ( $term = array_shift($terms) )
				$_terms[] = $term->term_id;
			$terms = $_terms;
		} elseif ( 'names' == $fields ) {
			while ( $term = array_shift($terms) )
				$_terms[] = $term->name;
			$terms = $_terms;
		}

		if ( 0 < $number && intval(@count($terms)) > $number ) {
			$terms = array_slice($terms, $offset, $number);
		}

		wp_cache_add( $cache_key, $terms, 'terms' );

		$terms = apply_filters('get_terms', $terms, $taxonomies, $args);
		return $terms;
	}
/**
 * wp_update_term() - Update term based on arguments provided
 *
 * The $args will indiscriminately override all values with the same field name. Care
 * must be taken to not override important information need to update or update will
 * fail (or perhaps create a new term, neither would be acceptable).
 *
 * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not defined
 * in $args already.
 *
 * 'alias_of' will create a term group, if it doesn't already exist, and update it for
 * the $term.
 *
 * If the 'slug' argument in $args is missing, then the 'name' in $args will be used.
 * It should also be noted that if you set 'slug' and it isn't unique then a WP_Error
 * will be passed back. If you don't pass any slug, then a unique one will be created
 * for you.
 *
 * For what can be overrode in $args, check the term scheme can contain and stay away
 * from the term keys.
 *
 * @package WordPress
 * @subpackage Taxonomy
 * @since 2.3
 *
 * @uses $wpdb
 * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
 * @uses apply_filters() Will call the 'term_id_filter' filter and pass the term id and
 *	taxonomy id.
 *
 * @param int $term The ID of the term
 * @param string $taxonomy The context in which to relate the term to the object.
 * @param array|string $args Overwrite term field values
 * @return array|WP_Error Returns Term ID and Taxonomy Term ID
 */
function wp_update_term( $term, $taxonomy, $args = array() ) {
	global $wpdb;

	if ( ! is_taxonomy($taxonomy) )
		return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));

	$term_id = (int) $term;

	// First, get all of the original args
	$term = get_term ($term_id, $taxonomy, ARRAY_A);

	// Escape data pulled from DB.
	$term = add_magic_quotes($term);

	// Merge old and new args with new args overwriting old ones.
	$args = array_merge($term, $args);

	$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
	$args = wp_parse_args($args, $defaults);
	$args = sanitize_term($args, $taxonomy, 'db');
	extract($args, EXTR_SKIP);

	// expected_slashed ($name)
	$name = stripslashes($name);
	$description = stripslashes($description);

	$empty_slug = false;
	if ( empty($slug) ) {
		$empty_slug = true;
		$slug = sanitize_title($name);
	}

	if ( $alias_of ) {
		$alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) );
		if ( $alias->term_group ) {
			// The alias we want is already in a group, so let's use that one.
			$term_group = $alias->term_group;
		} else {
			// The alias isn't in a group, so let's create a new one and firstly add the alias term to it.
			$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
			$wpdb->update( $wpdb->terms, compact('term_group'), array( 'term_id' => $alias->term_id ) );
		}
	}

	// Check for duplicate slug
	$id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE slug = %s", $slug ) );
	if ( $id && ($id != $term_id) ) {
		// If an empty slug was passed or the parent changed, reset the slug to something unique.
		// Otherwise, bail.
		if ( $empty_slug || ( $parent != $term->parent) )
			$slug = wp_unique_term_slug($slug, (object) $args);
		else
			return new WP_Error('duplicate_term_slug', sprintf(__('The slug "%s" is already in use by another term'), $slug));
	}

	$wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );

	if ( empty($slug) ) {
		$slug = sanitize_title($name, $term_id);
		$wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
	}

	$tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );

	$wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );

	do_action("edit_term", $term_id, $tt_id);
	do_action("edit_$taxonomy", $term_id, $tt_id);

	$term_id = apply_filters('term_id_filter', $term_id, $tt_id);

	clean_term_cache($term_id, $taxonomy);

	do_action("edited_term", $term_id, $tt_id);
	do_action("edited_$taxonomy", $term_id, $tt_id);

	return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
}
Example #28
0
<div id="tree-nav-container">
  <?php 
if (is_front_page()) {
    get_template_part('includes/posts-slider');
} elseif ('biodiversity' == get_post_type() || is_page('tree-of-life') || is_taxonomy('classification')) {
    ?>
              
       <div id="tree-nav">
          <?php 
    wp_nav_menu(array('theme_location' => 'tree-of-life', 'menu_class' => 'tree-menu'));
    ?>
       </div><!-- #navigation -->

  <?php 
} elseif ('biology' == get_post_type() || is_page('world-biology') || is_taxonomy('biology-class')) {
    ?>
        
        <div id="tree-nav">
           <?php 
    wp_nav_menu(array('theme_location' => 'biology', 'menu_class' => 'tree-menu'));
    ?>
         </div><!-- #navigation -->        
  			
  <?php 
}
?>
</div><!-- #tree navigation  container -->
    
</div><!-- #header -->