本文整理汇总了PHP中get_content_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_content_by_id函数的具体用法?PHP get_content_by_id怎么用?PHP get_content_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_content_by_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: only_admin_access
<?php
only_admin_access();
$data = false;
if (isset($params['content-id'])) {
$data = get_content_by_id($params["content-id"]);
}
$available_content_types = false;
$available_content_subtypes = false;
/* FILLING UP EMPTY CONTENT WITH DATA */
if ($data == false or empty($data)) {
$is_new_content = true;
include '_empty_content_data.php';
} else {
$available_content_types = get_content('group_by=content_type');
$available_content_subtypes = get_content('group_by=subtype');
}
/* END OF FILLING UP EMPTY CONTENT */
$show_page_settings = false;
if (isset($params['content-type']) and $params['content-type'] == 'page') {
$show_page_settings = 1;
}
$template_config = mw()->template->get_config();
$data_fields_conf = false;
$data_fields_values = false;
if (!empty($template_config)) {
if (isset($params['content-type'])) {
if (isset($template_config['data-fields-' . $params['content-type']]) and is_array($template_config['data-fields-' . $params['content-type']])) {
$data_fields_conf = $template_config['data-fields-' . $params['content-type']];
if (isset($params['content-id'])) {
$data_fields_values = content_data($params['content-id']);
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:advanced_settings.php
示例2: get_content_by_id
<?php
/*
type: layout
name: Add to cart default
description: Add to cart default
*/
if (isset($params['content-id'])) {
$product = get_content_by_id($params["content-id"]);
$title = $product['title'];
} else {
$title = _e("Product");
}
?>
<script>mw.moduleCSS("<?php
print modules_url();
?>
shop/cart_add/templates.css")</script>
<script type="text/javascript">
LocalPrice = null;
SetLocalPrice = window.SetLocalPrice || function(input){
if(input.checked === true){
LocalPrice = input.value;
}
}
</script>
开发者ID:Staalkoper,项目名称:templates,代码行数:31,代码来源:default.php
示例3: post_id
<?php
/*
type: layout
content_type: static
name: Post
description: Post layout
*/
$id = post_id();
$content = get_content_by_id($id);
?>
<?php
include TEMPLATE_DIR . "header.php";
?>
<div class="container content edit" rel="content<?php
print PAGE_ID();
?>
" field="content<?php
print PAGE_ID();
?>
">
<div class="row blog-page">
<!-- Left Sidebar -->
<div class="col-md-9">
<!--Blog Post-->
<div class="blog margin-bottom-40">
<h2 class="headline edit" field="title" rel="content"><?php
print $content['title'];
?>
开发者ID:Staalkoper,项目名称:templates,代码行数:31,代码来源:blog_inner.php
示例4: foreach
<table width="100%" cellspacing="0" cellpadding="0" class="mw-ui-table mw-ui-table-basic">
<thead>
<tr>
<th>Image </th>
<th>Title</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php
foreach ($cart as $product) {
?>
<?php
$theproduct = get_content_by_id($product['rel_id']);
?>
<tr>
<td><img src="<?php
print get_picture($theproduct['id']);
?>
" width="70" alt="" /> </td>
<td><?php
print $theproduct['title'];
?>
</td>
<td><?php
print $product['qty'];
?>
</td>
<td><?php
开发者ID:Staalkoper,项目名称:templates,代码行数:31,代码来源:profile.php
示例5: only_admin_access
<?php
only_admin_access();
$data = array('content_id' => $params['content_id']);
$comments = get_comments($data);
$item = get_content_by_id($params['content_id']);
$content_id = $params['content_id'];
$moderation_is_required = get_option('require_moderation', 'comments') == 'y';
?>
<div class="comment-post">
<div class="comment-info-holder" content-id="<?php
print $item['id'];
?>
" onclick="mw.adminComments.toggleMaster(this, event)"> <span class="img"> <img src="<?php
print thumbnail(get_picture($content_id), 67, 67);
?>
" alt="" />
<?php
// $new = get_comments('count=1&is_moderated=n&rel=content&rel_id='.$content_id);
$new = get_comments('count=1&is_new=y&rel=content&rel_id=' . $content_id);
?>
<?php
if ($new > 0) {
?>
<span class="comments_number"><?php
print $new;
?>
</span>
<?php
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:comments_for_post.php
示例6: get_the_title
?>
" title="<?php
echo get_the_title(get_the_ID());
?>
">
<span><?php
echo get_the_title(get_the_ID());
?>
</span>
</a>
</h2>
<div class="desc std">
<p><?php
echo wp_trim_words(get_content_by_id(get_the_ID()), 50);
?>
</p>
<a href="<?php
echo get_the_permalink(get_the_ID());
?>
" title="<?php
echo get_the_title(get_the_ID());
?>
" class="link-learn">Chi tiết</a>
</div>
</div>
</div>
</div>
</li>
开发者ID:binhdarkcu,项目名称:shoping_quan,代码行数:31,代码来源:page-tin-tuc.php
示例7: batch_process
function batch_process($content_items = false)
{
$chunks_folder = $this->get_import_location() . '_process_import' . DS;
$index_file = $chunks_folder . 'index.php';
if (!is_dir($chunks_folder)) {
mkdir_recursive($chunks_folder);
}
$total = 0;
$remaining = 0;
$batch_file = false;
if (!is_array($content_items) or empty($content_items)) {
$content_items = array();
if (is_file($index_file)) {
$total = file_get_contents($index_file);
}
if ($total == 0) {
$total = 0;
$dir = $chunks_folder;
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
$total++;
}
}
}
file_put_contents($index_file, $total);
}
$i = 0;
$dir = $chunks_folder;
$rem_counter = 0;
$process_xml_files = array();
$chunk_size = $this->batch_size;
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
if (!in_array($file, array('.', '..')) && !is_dir($dir . $file) and strstr($file, 'import_chunk_')) {
//if (!is_array($content_items)) {
if ($i < $chunk_size) {
$batch_file = $chunks_folder . $file;
$batch_file_content = file_get_contents($batch_file);
if (strstr($file, 'import_chunk_xml')) {
// for ($x=0; $x<=10; $x++){
$content_from_xml = $this->parse_content_from_xml_string($batch_file_content);
if (is_array($content_from_xml)) {
foreach ($content_from_xml as $content_from_x) {
$content_items[] = $content_from_x;
}
// $rem_counter--;
}
//}
} else {
$content_items_from_file = @unserialize($batch_file_content);
if (!empty($content_items_from_file)) {
foreach ($content_items_from_file as $content_from_x) {
$content_items[] = $content_from_x;
}
}
}
if ($batch_file != false and is_file($batch_file)) {
@unlink($batch_file);
}
}
$i++;
}
}
$remaining = $i;
}
} else {
$total = count($content_items);
}
// dd($content_items);
if ($content_items != false and is_array($content_items)) {
if (!empty($content_items)) {
$parent = get_content('one=true&subtype=dynamic&is_deleted=0&is_active=1');
if ($parent == false) {
$parent = get_content('one=true&content_type=page&is_deleted=0&is_active=1');
}
if ($parent == false) {
$parent = 0;
}
$content_items = $this->map_array($content_items);
$parent_id = $parent['id'];
$restored_items = array();
foreach ($content_items as $content) {
if (isset($content['title'])) {
$is_saved = get_content('one=true&title=' . $content['title']);
if (isset($content['description']) and (!isset($content['content']) or $content['content'] == false)) {
//$content['content'] = $content['description'];
}
if (!isset($content['parent'])) {
$content['parent'] = $parent_id;
}
if (isset($content['parent'])) {
$par = get_content_by_id($content['parent']);
if ($par != false) {
if (isset($par['is_shop']) and $par['is_shop'] == 1) {
$content['content_type'] = 'product';
$content['subtype'] = 'product';
}
}
}
//.........这里部分代码省略.........
开发者ID:newaltcoin,项目名称:microweber,代码行数:101,代码来源:Import.php
示例8: intval
if (!is_admin()) {
return;
}
$cont_id = false;
if (isset($params['post_id']) and intval($params['post_id']) != 0) {
$cont_id = intval($params['post_id']);
} else {
if (isset($params['page_id']) and intval($params['page_id']) != 0) {
$cont_id = intval($params['page_id']);
}
}
$url = mw()->url_manager->string(true);
$history_files = false;
if ($cont_id != false) {
$history_files = get_content_field('limit=30&order_by=id desc&fields=id,created_at&is_draft=1&all=1&url=' . $url);
$last_saved = get_content_by_id($cont_id);
$last_saved_date = $last_saved['updated_at'];
$latest_drafs = get_content_field('limit=30&order_by=id desc&fields=id&created_at=[mt]' . $last_saved_date . '&is_draft=1&all=1&url=' . $url . '&rel_id=' . $cont_id);
$history_files_fields = get_content_field('group_by=field&order_by=id desc&fields=field,id,created_at&is_draft=1&all=1&url=' . $url);
}
if (isset($latest_drafs) and is_array($latest_drafs)) {
//
$latest_drafs_vals = array();
foreach ($latest_drafs as $value) {
$latest_drafs_vals[] = $value['id'];
}
if (!empty($latest_drafs_vals)) {
?>
<script type="text/javascript">
开发者ID:newaltcoin,项目名称:microweber,代码行数:29,代码来源:edit_block_history.php
示例9: copy
public function copy($data)
{
$new_cont_id = false;
if (defined('MW_API_CALL')) {
$to_trash = true;
$adm = $this->app->user_manager->is_admin();
if ($adm == false) {
return array('error' => 'You must be admin to copy content!');
}
}
if (isset($data['id'])) {
$this->app->event_manager->trigger('content.before.copy', $data);
$cont = get_content_by_id($data['id']);
if ($cont != false and isset($cont['id'])) {
$new_cont = $cont;
if (isset($new_cont['title'])) {
$new_cont['title'] = $new_cont['title'] . ' copy';
}
$new_cont['id'] = 0;
$content_cats = array();
$cats = content_categories($cont['id']);
if (!empty($cats)) {
foreach ($cats as $cat) {
if (isset($cat['id'])) {
$content_cats[] = $cat['id'];
}
}
}
if (!empty($content_cats)) {
$new_cont['categories'] = $content_cats;
}
$new_cont_id = $this->save($new_cont);
$cust_fields = get_custom_fields('content', $data['id'], true);
if (!empty($cust_fields)) {
foreach ($cust_fields as $cust_field) {
$new = $cust_field;
$new['id'] = 0;
$new['rel_id'] = $new_cont_id;
$new_item = save_custom_field($new);
}
}
$images = get_pictures($data['id']);
if (!empty($images)) {
foreach ($images as $image) {
$new = $image;
$new['id'] = 0;
$new['rel_id'] = $new_cont_id;
$new['rel_type'] = 'content';
$new_item = save_media($new);
}
}
}
}
return $new_cont_id;
}
开发者ID:microweber,项目名称:microweber,代码行数:55,代码来源:ContentManagerHelpers.php
示例10: get_content_by_id
}
?>
</div>
<?php
}
?>
<?php
} else {
?>
<div class="mw-no-posts-foot">
<?php
$page_is_shop = false;
if (isset($post_params["page-id"])) {
$page_is_shop_check = get_content_by_id($post_params["page-id"]);
if (isset($page_is_shop_check['is_shop']) and $page_is_shop_check['is_shop'] == 1) {
$page_is_shop = true;
}
}
if (isset($post_params['content_type']) and $post_params['content_type'] == 'product' or isset($params['content_type']) and $params['content_type'] == 'product' or $page_is_shop) {
?>
<span class="mw-no-posts-foot-label"><?php
_e("No Products Here");
?>
</span>
<?php
if (isset($post_params['category-id'])) {
$url = "#action=new:product&category_id=" . $post_params['category-id'];
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:manager.php
示例11: get_content_by_id
$parent_page_active = $data['parent'];
}
}
?>
<div class="admin-manage-content-wrap">
<div class="admin-manage-toolbar-holder">
<div class="admin-manage-toolbar">
<div class="admin-manage-toolbar-content">
<div class="mw-ui-row-nodrop">
<div class="mw-ui-col">
<?php
if (isset($data['id']) and intval($data['id']) == 0 and isset($data['parent']) and intval($data['parent']) != 0) {
$parent_data = get_content_by_id($data['parent']);
if (is_array($parent_data) and isset($parent_data['is_active']) and $parent_data['is_active'] == 0) {
$data['is_active'] = 0;
}
}
if ($edit_page_info['is_shop'] == 1) {
$type = 'shop';
} elseif ($edit_page_info['subtype'] == 'dynamic') {
$type = 'dynamicpage';
} elseif ($edit_page_info['subtype'] == 'post') {
$type = 'post';
} elseif ($edit_page_info['content_type'] == 'product') {
$type = 'product';
} else {
$type = 'page';
}
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:edit_default.php
示例12: get_content_by_id
$i++;
}
}
if (!empty($data)) {
//$more = $data;
}
if (!empty($more)) {
if ($list_preview == false) {
?>
<div class="mw-ui-field mw-tag-selector mw-custom-fields-tags" onclick="__smart_field_opener(event)">
<?php
if (isset($params['save_to_content_id']) and isset($params["rel_id"]) and intval($params["rel_id"] > 0)) {
?>
<?php
$p = get_content_by_id($params["rel_id"]);
?>
<?php
if (isset($p['title'])) {
?>
<div class="mw-custom-fields-from-page-title"> <span class="mw-custom-fields-from-page-title-text">
<?php
_e("From");
?>
<strong><?php
print $p['title'];
?>
</strong></span> </div>
<?php
}
?>
开发者ID:MenZil-Team,项目名称:microweber,代码行数:31,代码来源:list.php
示例13: intval
$selected = 0;
if (isset($params['field-name'])) {
$field_name = $params['field-name'];
}
if (isset($params['selected-id'])) {
$selected = intval($params['selected-id']);
}
$rand = uniqid();
$no_parent_title = _e("None", 1);
if (isset($params['no-parent-title'])) {
$no_parent_title = $params['no-parent-title'];
}
$top_item = false;
if (isset($params['recommended-id']) and $params['recommended-id'] != false) {
$recommended_parent = $params['recommended-id'];
$top_item = get_content_by_id(intval($recommended_parent));
}
?>
<?php
if (isset($params['change-field'])) {
?>
<script type="text/javascript">
$(document).ready(function(){
mw.$('#content_selector_<?php
print $rand;
?>
开发者ID:hyrmedia,项目名称:microweber,代码行数:31,代码来源:selector.php
示例14: get_content_by_id
?>
<div class="<?php
print $config['module_class'];
?>
menu_item_edit" id="mw_content/menu_item_save_<?php
print $rand;
?>
">
<?php
if ((!isset($data['title']) or $data['title'] == '') and isset($data["content_id"]) and intval($data["content_id"]) > 0) {
?>
<?php
$cont = get_content_by_id($data["content_id"]);
if (isset($cont['title'])) {
$data['title'] = $cont['title'];
$item_url = content_link($cont['id']);
}
?>
<?php
} else {
?>
<?php
if ((!isset($data['title']) or $data['title'] == '') and isset($data["categories_id"]) and intval($data["categories_id"]) > 0) {
?>
<?php
$cont = get_category_by_id($data["categories_id"]);
if (isset($cont['title'])) {
$data['title'] = $cont['title'];
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:edit_item.php
示例15: get_content_by_id
if (isset($params["inherit_from"]) and (trim($params["inherit_from"]) != '' or trim($params["inherit_from"]) != '0')) {
//
$inherit_from_id = get_content_by_id($params["inherit_from"]);
// $inherit_from_id = false;
if ($inherit_from_id != false and isset($inherit_from_id['active_site_template']) and trim($inherit_from_id['active_site_template']) != 'inherit') {
$data['active_site_template'] = $inherit_from_id['active_site_template'];
$data['layout_file'] = $inherit_from_id['layout_file'];
$inherit_from = $inherit_from_id;
$data['layout_file'] = 'inherit';
} else {
$inh1 = mw()->content_manager->get_inherited_parent($params["inherit_from"]);
if ($inh1 == false) {
$inh1 = intval($params["inherit_from"]);
}
if ($inh1 != false) {
$inherit_from = get_content_by_id($inh1);
if (is_array($inherit_from) and isset($inherit_from['active_site_template'])) {
$data['active_site_template'] = $inherit_from['active_site_template'];
$data['layout_file'] = 'inherit';
}
}
}
}
}
if ((!isset($data['layout_file']) or $data['layout_file'] == NULL) and isset($data['is_home']) and $data['is_home'] == 'y') {
$data['layout_file'] = 'index.php';
}
if (!isset($params["active_site_template"]) and isset($params["site-template"])) {
$params["active_site_template"] = $params["site-template"];
}
if (isset($params["active_site_template"])) {
开发者ID:Git-Host,项目名称:microweber,代码行数:31,代码来源:layout_selector.php
示例16: wp_trim_words
<span class="price" content="<?php
echo $price;
?>
"><?php
echo $price;
?>
VNĐ</span>
</span>
</div>
</div>
</div>
<div class="descofProduct">
<?php
echo wp_trim_words(get_content_by_id($newhome->ID), 50);
?>
</div>
</div>
</div>
</li>
<?php
}
?>
</ul>
<div class="paging">
<?php
echo wp_pagenavi();
?>
开发者ID:binhdarkcu,项目名称:shoping_quan,代码行数:31,代码来源:page-san-pham.php
示例17: save_content_admin
public function save_content_admin($data, $delete_the_cache = true)
{
if (is_string($data)) {
$data = parse_params($data);
}
$adm = $this->app->user_manager->is_admin();
$checks = mw_var('FORCE_SAVE_CONTENT');
$orig_data = $data;
$stop = false;
$data = $this->app->format->strip_unsafe($data);
if ($adm == false) {
$stop = true;
$author_id = user_id();
if (isset($data['created_at'])) {
unset($data['created_at']);
}
if (isset($data['updated_at'])) {
unset($data['updated_at']);
}
if (isset($data['id']) and $data['id'] != 0 and $author_id != 0) {
$page_data_to_check_author = $this->get_by_id($data['id']);
if (!isset($page_data_to_check_author['created_by']) or $page_data_to_check_author['created_by'] != $author_id) {
$stop = true;
return array('error' => "You don't have permission to edit this content");
} elseif (isset($page_data_to_check_author['created_by']) and $page_data_to_check_author['created_by'] == $author_id) {
$stop = false;
}
} elseif ($author_id == false) {
return array('error' => 'You must be logged to save content');
}
if (isset($data['id']) and $data['id'] != 0) {
if (!is_admin()) {
$check = get_content_by_id($data['id']);
if ($check['created_by'] != user_id()) {
return array('error' => 'Wrong content');
}
}
}
if (isset($data['is_home'])) {
if (!is_admin()) {
unset($data['is_home']);
}
}
if ($stop == true) {
if (defined('MW_API_FUNCTION_CALL') and MW_API_FUNCTION_CALL == __FUNCTION__) {
if (!isset($data['captcha'])) {
if (isset($data['error_msg'])) {
return array('error' => $data['error_msg']);
} else {
return array('error' => 'Please enter a captcha answer!');
}
} else {
$cap = $this->app->user_manager->session_get('captcha');
if ($cap == false) {
return array('error' => 'You must load a captcha first!');
}
if ($data['captcha'] != $cap) {
return array('error' => 'Invalid captcha answer!');
}
}
}
}
if (isset($data['categories'])) {
$data['category'] = $data['categories'];
}
//if (defined('MW_API_FUNCTION_CALL') and MW_API_FUNCTION_CALL == __FUNCTION__) {
if (isset($data['category'])) {
$cats_check = array();
if (is_array($data['category'])) {
foreach ($data['category'] as $cat) {
$cats_check[] = intval($cat);
}
} else {
$cats_check[] = intval($data['category']);
}
$check_if_user_can_publish = $this->app->category_manager->get('ids=' . implode(',', $cats_check));
if (!empty($check_if_user_can_publish)) {
$user_cats = array();
foreach ($check_if_user_can_publish as $item) {
if (isset($item['users_can_create_content']) and $item['users_can_create_content'] == 1) {
$user_cats[] = $item['id'];
$cont_cat = $this->get('limit=1&content_type=page&subtype_value=' . $item['id']);
}
}
if (!empty($user_cats)) {
$stop = false;
$data['categories'] = $user_cats;
}
}
}
}
// }
if ($stop == true) {
return array('error' => 'You don\'t have permissions to save content here!');
}
return $this->save_content($data, $delete_the_cache);
}
开发者ID:microweber,项目名称:microweber,代码行数:97,代码来源:ContentManager.php
示例18: testContentCategories
public function testContentCategories()
{
$params = array('title' => 'My categories page', 'content_type' => 'page', 'subtype' => 'dynamic', 'is_active' => 1);
//saving
$parent_page_id = save_content($params);
$parent_page_data = get_content_by_id($parent_page_id);
$params = array('title' => 'Test Category 1', 'parent_page' => $parent_page_id);
//saving
$category_id = save_category($params);
$category_data = get_category_by_id($category_id);
$category_page = get_page_for_category($category_data['id']);
$delete_category = delete_category($category_id);
$delete_page = delete_content($parent_page_id);
$deleted_page = get_content_by_id($parent_page_id);
$params = array('title' => 'Test Category with invalid position', 'position' => 'uga buga');
$category_with_invalid_pos = save_category($params);
//PHPUnit
$this->assertEquals(true, intval($parent_page_id) > 0);
$this->assertEquals(true, intval($category_id) > 0);
$this->assertEquals(true, is_array($category_data));
$this->assertEquals(true, is_array($category_page));
$this->assertEquals($category_page['title'], $parent_page_data['title']);
$this->assertEquals(true, $delete_category);
$this->assertEquals(false, $deleted_page);
$this->assertEquals(true, intval($category_with_invalid_pos) > 0);
$this->assertEquals(true, is_array($delete_page));
}
开发者ID:microweber,项目名称:microweber,代码行数:27,代码来源:ContentTest.php
示例19: _e
?>
<h4>
<?php
_e("Recent comments");
?>
</h4>
<?php
} else {
?>
<h4>
<?php
_e("Comments for");
?>
<strong>
<?php
$post = get_content_by_id($data['rel_id']);
print $post['title'];
?>
</strong></h4>
<?php
}
?>
<div class="comments" id="comments-list-<?php
print $data['id'];
?>
">
<?php
foreach ($comments as $comment) {
?>
<?php
$required_moderation = get_option('require_moderation', 'comments') == 'y';
开发者ID:Git-Host,项目名称:microweber,代码行数:31,代码来源:default.php
示例20: reset_edit
public function reset_edit($data)
{
if (defined('MW_API_CALL')) {
$to_trash = true;
$adm = $this->app->user_manager->is_admin();
if ($adm == false) {
return array('error' => 'You must be admin to reset content!');
}
}
if (isset($data['id'])) {
$cont = get_content_by_id($data['id']);
if (isset($cont['id']) and $cont['id'] != 0) {
$id = intval($cont['id']);
$cont['content'] = false;
$cont['content_body'] = false;
$save = $this->save($cont);
$table_fields = $this->app->database_manager->real_table_name($this->tables['content_fields']);
$del = "DELETE FROM {$table_fields} WHERE rel_type='content' AND rel_id='{$id}' ";
$this->app->database_manager->query($del);
$this->app->cache_manager->delete('content');
$this->app->cache_manager->delete('content_fields');
return $save;
}
}
}
开发者ID:Git-Host,项目名称:microweber,代码行数:25,代码来源:ContentManager.php
注:本文中的get_content_by_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论