function request_suggest($key)
{
    $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET);
    global $hmtaxonomy;
    global $hmcontent;
    $return = '';
    $input_name = hm_post('input', '');
    $key = trim($key);
    $key = str_replace(' ', '-', $key);
    if ($key != '') {
        $tableName = DB_PREFIX . 'request_uri';
        $hmdb->Query("SELECT * FROM `" . $tableName . "` WHERE `uri` LIKE '%" . $key . "%' LIMIT 10");
        while ($row = $hmdb->Row()) {
            $id = $row->id;
            $object_id = $row->object_id;
            $object_type = $row->object_type;
            $uri = $row->uri;
            $suggest_label = '';
            $object_name = '';
            switch ($object_type) {
                case 'taxonomy':
                    $tax_data = taxonomy_data_by_id($object_id);
                    $tax_key = $tax_data['taxonomy']->key;
                    $taxonomy = $hmtaxonomy->hmtaxonomy;
                    $suggest_label = $taxonomy[$tax_key]['taxonomy_name'];
                    $object_name = get_tax_val('name=name&id=' . $object_id);
                    break;
                case 'content':
                    $con_data = content_data_by_id($object_id);
                    $con_key = $con_data['content']->key;
                    $content = $hmcontent->hmcontent;
                    $suggest_label = $content[$con_key]['content_name'];
                    $object_name = get_con_val('name=name&id=' . $object_id);
                    break;
            }
            $return .= '<li>';
            $return .= '<p data-id="' . $id . '" data-input="' . $input_name . '" data-name="' . $object_name . '" object_id="' . $object_id . '" object_type="' . $object_type . '">';
            $return .= '<span class="suggest_label">' . $suggest_label . ': </span><b>' . $object_name . '</b>';
            $return .= '</p>';
            $return .= '</li>';
        }
    }
    return $return;
}
    $latest = array('id' => $insert_id, 'name' => $menu_name, 'key' => 'menu', 'parent' => '0');
    return json_encode(array('latest' => $latest));
}
/** Sửa menu */
function edit_menu($id)
{
    hook_action('edit_menu');
    global $hmdb;
    $menu_id = hm_get('id');
    $taxonomy = hm_post('taxonomy');
    if (is_array($taxonomy)) {
        $tableName = DB_PREFIX . 'object';
        foreach ($taxonomy as $tax_id) {
            /** insert menu item */
            $args = array('name' => 'name', 'id' => $tax_id);
            $tax_name = get_tax_val($args);
            $data_array = array('name' => MySQL::SQLValue($tax_name), 'key' => MySQL::SQLValue('menu_item'), 'parent' => MySQL::SQLValue($menu_id), 'order_number' => MySQL::SQLValue(0, MySQL::SQLVALUE_NUMBER));
            $insert_id_array[$tax_id] = $hmdb->InsertRow($tableName, $data_array);
        }
        /** tạo field cho các menu item vừa insert */
        foreach ($insert_id_array as $tax_id => $insert_id) {
            if (is_numeric($insert_id)) {
                $tableName = DB_PREFIX . 'field';
                $args = array('name' => 'name', 'id' => $tax_id);
                $tax_name = get_tax_val($args);
                $data_array = array('name' => MySQL::SQLValue('menu_name'), 'val' => MySQL::SQLValue($tax_name), 'object_id' => MySQL::SQLValue($insert_id), 'object_type' => MySQL::SQLValue('menu_item'));
                $hmdb->InsertRow($tableName, $data_array);
                $tableRequestName = DB_PREFIX . 'request_uri';
                $whereArray = array('object_id' => MySQL::SQLValue($tax_id), 'object_type' => MySQL::SQLValue('taxonomy'));
                $hmdb->SelectRows($tableRequestName, $whereArray);
                if ($hmdb->HasRecords()) {
                    $row = $hmdb->Row();
                    $request_id = $row->id;
                    $data_array = array('name' => MySQL::SQLValue('menu_request_uri'), 'val' => MySQL::SQLValue($request_id), 'object_id' => MySQL::SQLValue($insert_id), 'object_type' => MySQL::SQLValue('menu_item'));
                    $hmdb->InsertRow($tableName, $data_array);
                }
            }
 * File template form edit nhanh 1 taxonomy
 */
?>
<form action="?run=taxonomy_ajax.php&key=<?php 
echo hm_get('key');
?>
&action=edit&id=<?php 
echo hm_get('id');
?>
" method="post" class="ajaxForm ajaxFormTaxonomyEdit">
	<?php 
taxonomy_select_parent($args['taxonomy_key'], $args['object_id']);
foreach ($args['taxonomy_field'] as $field) {
    $field['object_id'] = $args['object_id'];
    $field['object_type'] = $args['object_type'];
    $field['default_value'] = get_tax_val(array('name' => $field['name'], 'id' => $field['object_id']));
    build_input_form($field);
}
?>
	<button name="submit" type="submit" class="btn btn-default"><?php 
echo $args['edit_item'];
?>
</button>
</form>
<script type="text/javascript">
	$('.ajaxFormTaxonomyEdit').ajaxForm(function(data) {
		$('.quick_edit_tr').remove();
		$('.custom_paged').click();
		$.notify('Đã lưu lại chỉnh sửa', { globalPosition: 'top right',className: 'success' } );
	});
</script>
function build_input_slug($val_name, $val_nicename, $object_id, $object_type)
{
    hook_action('build_input_slug');
    $checked_true = NULL;
    $checked_false = NULL;
    $slug = NULL;
    if (is_numeric($object_id) and $object_id != 0) {
        if ($object_type == 'taxonomy') {
            $slug = get_tax_val(array('name' => 'slug_of_' . $val_name, 'id' => $object_id));
            $checked = get_tax_val(array('name' => 'accented_of_' . $val_name, 'id' => $object_id));
        }
        if ($object_type == 'content') {
            $slug = get_con_val(array('name' => 'slug_of_' . $val_name, 'id' => $object_id));
            $checked = get_con_val(array('name' => 'accented_of_' . $val_name, 'id' => $object_id));
        }
        if ($checked == 'true') {
            $checked_true = 'checked="checked"';
        }
        if ($checked == 'false') {
            $checked_false = 'checked="checked"';
        }
        if ($checked == 'html') {
            $checked_html = 'checked="checked"';
        }
    }
    echo '<div class="form-group-sub">' . "\n";
    echo '	<label for="slug_of_' . $val_name . '">' . _('Slug') . ' (' . _('tự động tạo từ') . ' ' . $val_nicename . ')</label>' . "\n";
    echo '	<p class="input_description">' . _('Slug là đường dẫn thân thiện với các bộ máy tìm kiếm, nó sẽ tự động tạo nếu bạn bỏ trống') . '</p>' . "\n";
    echo '	<input autocomplete="off" required value="' . $slug . '" name="slug_of_' . $val_name . '" type="text" class="form-control ajax_slug slug_of_' . $val_name . ' slug_of_' . $val_name . '_' . $object_id . '" id="slug_of_' . $val_name . '" >' . "\n";
    echo '</div>' . "\n";
    echo '<div class="form-group-sub">' . "\n";
    echo '	<label class="radio-inline">' . "\n";
    echo '		<input ' . $checked_true . ' type="radio" slug-input="slug_of_' . $val_name . '" data-field-name="' . $val_name . '" data-field-object="' . $object_id . '" class="accented accented_of_' . $val_name . '" name="accented_of_' . $val_name . '" value="true" >Giữ lại dấu</input>' . "\n";
    echo '	</label>' . "\n";
    echo '	<label class="radio-inline">' . "\n";
    echo '		<input ' . $checked_false . ' type="radio" slug-input="slug_of_' . $val_name . '" data-field-name="' . $val_name . '" data-field-object="' . $object_id . '" class="accented accented_of_' . $val_name . '" name="accented_of_' . $val_name . '" value="false" >Xóa dấu</input>' . "\n";
    echo '	</label>' . "\n";
    echo '</div>' . "\n";
}
         $include_to_sitemap = get_con_val("name=include_to_sitemap&id={$object_id}");
         $sitemap_change_frequency = get_con_val("name=sitemap_change_frequency&id={$object_id}");
         $sitemap_priority = get_con_val("name=sitemap_priority&id={$object_id}");
         $time = get_con_val("name=public_time&id={$object_id}");
         $lastmod = '<lastmod>' . date('Y-m-d H:i:s', $time) . '</lastmod>';
         if ($sitemap_change_frequency == 'auto') {
             $sitemap_change_frequency = get_option(array('section' => 'hm_seo', 'key' => 'content_sitemap_change_frequency', 'default_value' => 'daily'));
         }
         if ($sitemap_priority == 'auto') {
             $sitemap_priority = get_option(array('section' => 'hm_seo', 'key' => 'content_sitemap_priority', 'default_value' => '0.6'));
         }
         break;
     case 'taxonomy':
         $include_to_sitemap = get_tax_val("name=include_to_sitemap&id={$object_id}");
         $sitemap_change_frequency = get_tax_val("name=sitemap_change_frequency&id={$object_id}");
         $sitemap_priority = get_tax_val("name=sitemap_priority&id={$object_id}");
         $lastmod = NULL;
         if ($sitemap_change_frequency == 'auto') {
             $sitemap_change_frequency = get_option(array('section' => 'hm_seo', 'key' => 'taxonomy_sitemap_change_frequency', 'default_value' => 'daily'));
         }
         if ($sitemap_priority == 'auto') {
             $sitemap_priority = get_option(array('section' => 'hm_seo', 'key' => 'taxonomy_sitemap_priority', 'default_value' => '0.8'));
         }
         break;
 }
 if ($include_to_sitemap == 'yes') {
     $sitemap .= '<url>' . "\r\n";
     $sitemap .= '	<loc>' . SITE_URL . '/' . $uri . '</loc>' . "\r\n";
     if ($lastmod != '') {
         $sitemap .= '	' . $lastmod . "\r\n";
     }
function hm_seo_display_meta_keywords()
{
    global $hmcontent;
    global $hmtaxonomy;
    $request = get_current_uri();
    $request_data = get_uri_data(array('uri' => $request));
    if ($request_data != FALSE) {
        $object_type = $request_data->object_type;
        $object_id = $request_data->object_id;
        switch ($object_type) {
            case 'content':
                $keywords = get_con_val("name=meta_keywords&id=" . $object_id);
                echo '<meta name="keywords" content="' . $keywords . '" />' . "\n\r";
                break;
            case 'taxonomy':
                $keywords = get_tax_val("name=meta_keywords&id=" . $object_id);
                echo '<meta name="keywords" content="' . $keywords . '" />' . "\n\r";
                break;
        }
    } else {
        return FALSE;
    }
}