本文整理汇总了PHP中get_content_by_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_content_by_id函数的具体用法?PHP get_content_by_id怎么用?PHP get_content_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_content_by_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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']);
示例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>
示例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'];
?>
示例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
示例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
}
示例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>
示例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';
}
}
}
//.........这里部分代码省略.........
示例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">
示例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;
}
示例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'];
示例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';
}
示例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
}
?>
示例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;
?>
示例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'];
示例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"])) {