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; }
get_template_part('header'); ?> <div class="row"> <div class="col-lg-12"> <div class="row"> <div class="col-md-9"> <div class="main_content"> <?php if (have_content()) { foreach (query_content() as $cid) { $name = get_con_val("name=name&id={$cid}"); $link = request_uri("type=content&id={$cid}"); $description = get_con_val("name=description&id={$cid}"); $public_time = get_con_val("name=public_time&id={$cid}"); $content_thumbnail = get_con_val("name=content_thumbnail&id={$cid}"); $img = create_image("file={$content_thumbnail}&w=300&h=200"); ?> <div class="row content_item"> <div class="col-md-3"> <a href="<?php echo $link; ?> " title="<?php echo $name; ?> "> <img src="<?php echo $img; ?> "/>
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"; }
$sitemap .= '<!-- generated-on="26.09.2015 12:11" -->' . "\r\n"; $sitemap .= '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\r\n"; //loop $tableName = DB_PREFIX . "request_uri"; $hmdb->SelectRows($tableName, NULL, NULL, 'object_type', FALSE); while ($row = $hmdb->Row()) { $object_id = $row->object_id; $object_type = $row->object_type; $uri = $row->uri; $uri = urlencode($uri); switch ($object_type) { case 'content': $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'));
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; } }
<form action="?run=content_ajax.php&key=<?php echo $_GET['key']; ?> &action=edit&id=<?php echo $_GET['id']; ?> " method="post" class="ajaxForm ajaxFormcontentEdit"> <div class="row"> <div class="col-md-4"> <?php $field = $args['content_field']['primary_name_field']; $field['object_id'] = $args['object_id']; $field['object_type'] = $args['object_type']; $field['default_value'] = get_con_val(array('name' => $field['name'], 'id' => $field['object_id'])); build_input_form($field); ?> </div> <div class="col-md-4"> <ul class="taxnomy_list_ajax tree"> <?php $args['key'] = $args['taxonomy_key']; $array = array('id' => $args['object_id']); $args['default_value'] = get_con_tax($array); taxonomy_checkbox_list($args); ?> </ul> </div> <div class="col-md-4"> <div class="form-group">
get_template_part('header'); ?> <div class="row"> <div class="col-lg-12"> <div class="row"> <div class="col-md-9"> <div class="main_content"> <div class="post-content"> <h1 class="post-title"><?php echo get_con_val("name=name&id={$id}"); ?> </h1> <article> <?php echo get_con_val("name=content&id={$id}"); ?> </article> </div> </div> </div> <div class="col-md-3"> <?php get_template_part('sidebar'); ?> </div> </div> </div> </div>
/** Tạo bản xem nội dung các field của 1 content */ public function build_field_content_blockquote($args = array()) { if (isset($args['id'])) { $id = $args['id']; } else { $id = NULL; } if (isset($args['default_value'])) { $default_value = $args['default_value']; } else { $default_value = array(); } $return = array(); if (isset_content_id($id)) { $data = content_data_by_id($id); $content_key = $data['content']->key; if ($this->isset_content(array('content_key' => $content_key))) { $content = $this->hmcontent; $i = 1; foreach ($content[$content_key]['content_field'] as $field) { $return[$i]['field_name'] = $field['nice_name']; if (isset($default_value[$field['name']])) { $return[$i]['field_val'] = $default_value[$field['name']]; } else { $return[$i]['field_val'] = get_con_val(array('name' => $field['name'], 'id' => $id)); } $i++; } } } return $return; }