本文整理汇总了PHP中path::loadElementPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP path::loadElementPaths方法的具体用法?PHP path::loadElementPaths怎么用?PHP path::loadElementPaths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::loadElementPaths方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_from_resultset
public function load_from_resultset($rs)
{
$main = $rs[0];
$this->id = $main->id;
$this->website = $main->website;
$this->parent = $main->parent;
$this->position = $main->position;
$this->template = $main->template;
$this->access = $main->access;
$this->permission = $main->permission;
$this->icon = $main->icon;
$this->metatags = $main->metatags;
$this->date_published = empty($main->date_published) ? '' : $main->date_published;
$this->date_unpublish = empty($main->date_unpublish) ? '' : $main->date_unpublish;
$this->votes = $main->votes;
$this->score = $main->score;
$this->views = $main->views;
$this->dictionary = webdictionary::load_element_strings('structure', $this->id);
$this->paths = path::loadElementPaths('structure', $this->id, $this->website);
$this->visible = $main->visible;
// to get the array of groups first we remove the "g" character
$groups = str_replace('g', '', $main->groups);
$this->groups = explode(',', $groups);
if (!is_array($this->groups)) {
$this->groups = array($groups);
}
}
示例2: homepage_from_structure
public function homepage_from_structure($all_languages = false)
{
$homepage_relative_url = $this->homepage;
if (is_numeric($homepage_relative_url)) {
$homepage_relative_url = path::loadElementPaths('structure', $homepage_relative_url);
if (!$all_languages) {
$homepage_relative_url = array_shift($homepage_relative_url);
}
}
return $homepage_relative_url;
}
示例3: load_from_resultset
public function load_from_resultset($rs)
{
$main = $rs[0];
$this->id = $main->id;
$this->website = $main->website;
$this->association = $main->association;
$this->category = $main->category;
$this->embedding = $main->embedding;
$this->template = $main->template;
$this->date_to_display = empty($main->date_to_display) ? '' : $main->date_to_display;
$this->date_published = empty($main->date_published) ? '' : $main->date_published;
$this->date_unpublish = empty($main->date_unpublish) ? '' : $main->date_unpublish;
$this->date_created = $main->date_created;
$this->date_modified = $main->date_modified;
$this->galleries = mb_unserialize($main->galleries);
$this->comments_enabled_to = $main->comments_enabled_to;
$this->comments_moderator = $main->comments_moderator;
$this->access = $main->access;
$this->permission = $main->permission;
$this->author = $main->author;
$this->views = $main->views;
$this->votes = $main->votes;
$this->score = $main->score;
$this->position = $main->position;
$this->dictionary = webdictionary::load_element_strings('item', $this->id);
$this->paths = path::loadElementPaths('item', $this->id);
// to get the array of groups first we remove the "g" character
$groups = str_replace('g', '', $main->groups);
$this->groups = explode(',', $groups);
if (!is_array($this->groups)) {
$this->groups = array($groups);
}
if ($this->association == 'free') {
$this->category = '';
}
}
示例4: run
//.........这里部分代码省略.........
}
for ($ps = 0; $ps < count($template->properties); $ps++) {
// ignore structure properties
if (isset($template->properties[$ps]->element) && $template->properties[$ps]->element != 'item') {
continue;
}
// ignore non-textual properties
if (!in_array($template->properties[$ps]->type, array("text", "textarea", "rich_textarea"))) {
continue;
}
$title = $template->properties[$ps]->name;
if (!empty($theme)) {
$title = $theme->t($title);
}
$zones[] = array('type' => 'property', 'id' => $template->properties[$ps]->id, 'title' => $title);
}
echo json_encode($zones);
core_terminate();
break;
case 95:
// free path checking
$path = $_REQUEST['path'];
$id = $_REQUEST['id'];
$DB->query('SELECT type, object_id, lang
FROM nv_paths
WHERE path = ' . protect($path) . '
AND website = ' . $website->id);
$rs = $DB->result();
echo json_encode($rs);
core_terminate();
break;
case 96:
// return category paths
echo json_encode(path::loadElementPaths('structure', intval($_REQUEST['id'])));
core_terminate();
break;
case 'json_find_user':
// json find user by name request (for "moderator" autocomplete)
$DB->query('
SELECT id, username as text
FROM nv_users
WHERE username LIKE ' . protect('%' . $_REQUEST['username'] . '%') . '
ORDER BY username ASC
LIMIT 30', 'array
');
$rows = $DB->result();
$total = $DB->foundRows();
echo json_encode(array('items' => $rows, 'total_count' => $total));
core_terminate();
break;
case 'json_find_item':
// find items by its title
// any language
$template_filter = '';
if (!empty($_REQUEST['template'])) {
$template_filter = ' AND nvi.template = ' . protect($_REQUEST['template']) . ' ';
}
if (!empty($_REQUEST['association'])) {
$template_filter = ' AND nvi.association = ' . protect($_REQUEST['association']) . ' ';
}
if (isset($_REQUEST['embedding'])) {
$template_filter = ' AND nvi.embedding = ' . protect($_REQUEST['embedding']) . ' ';
}
$text = $_REQUEST['title'];
if (!empty($_REQUEST['term'])) {
// tagit request
示例5: generate_feed
public static function generate_feed($id = NULL)
{
global $current;
global $website;
global $DB;
if (empty($id)) {
$id = $current['id'];
}
$item = new feed();
$item->load($id);
$permission = nvweb_object_enabled($item);
if (!$permission) {
return;
}
$feed = new UniversalFeedCreator();
$feed->encoding = 'UTF-8';
$feed->title = $item->dictionary[$current['lang']]['title'];
$feed->description = $item->dictionary[$current['lang']]['description'];
$feed->link = $website->absolute_path();
$feed->syndicationURL = $website->absolute_path() . $item->paths[$current['lang']];
if (!empty($item->image)) {
$image = new FeedImage();
$image->url = $website->absolute_path() . '/object?type=image&id=' . $item->image;
$image->link = $website->absolute_path();
//$image->description = $vars['dictionary_description'];
$feed->image = $image;
}
if (!empty($item->categories[0])) {
$limit = intval($item->entries);
if ($limit <= 0) {
$limit = 10;
}
$DB->query(' SELECT SQL_CALC_FOUND_ROWS i.id, i.permission, i.date_published, i.date_unpublish,
i.date_to_display, COALESCE(NULLIF(i.date_to_display, 0), i.date_created) as pdate, d.text as title, i.position as position,
i.galleries as galleries, i.template as template
FROM nv_items i, nv_structure s, nv_webdictionary d
WHERE i.category IN(' . implode(",", $item->categories) . ')
AND i.website = ' . $website->id . '
AND i.permission = 0
AND (i.date_published = 0 OR i.date_published < ' . core_time() . ')
AND (i.date_unpublish = 0 OR i.date_unpublish > ' . core_time() . ')
AND s.id = i.category
AND (s.date_published = 0 OR s.date_published < ' . core_time() . ')
AND (s.date_unpublish = 0 OR s.date_unpublish > ' . core_time() . ')
AND s.permission = 0
AND (s.access = 0)
AND (i.access = 0)
AND d.website = i.website
AND d.node_type = "item"
AND d.subtype = "title"
AND d.node_id = i.id
AND d.lang = ' . protect($current['lang']) . '
ORDER BY pdate DESC
LIMIT ' . $limit . '
OFFSET 0');
$rs = $DB->result();
for ($x = 0; $x < count($rs); $x++) {
if (nvweb_object_enabled($rs[$x])) {
$texts = webdictionary::load_element_strings('item', $rs[$x]->id);
$paths = path::loadElementPaths('item', $rs[$x]->id);
$fitem = new FeedItem();
$fitem->title = $texts[$current['lang']]['title'];
$fitem->link = $website->absolute_path() . $paths[$current['lang']];
switch ($item->content) {
case 'title':
// no description
break;
case 'content':
$fitem->description = $texts[$current['lang']]['section-main'];
break;
case 'summary':
default:
$fitem->description = $texts[$current['lang']]['section-main'];
$fitem->description = str_replace(array('</p>', '<br />', '<br/>', '<br>'), array('</p>' . "\n", '<br />' . "\n", '<br/>' . "\n", '<br>' . "\n"), $fitem->description);
$fitem->description = core_string_cut($fitem->description, 500, '…');
break;
}
$fitem->date = $rs[$x]->date_to_display;
// find an image to attach to the item
// A) first enabled image in item gallery
// B) first image on properties
$image = '';
if (!empty($rs[$x]->galleries)) {
$galleries = mb_unserialize($rs[$x]->galleries);
$photo = @array_shift(array_keys($galleries[0]));
if (!empty($photo)) {
$image = $website->absolute_path(false) . '/object?type=image&id=' . $photo;
}
}
if (empty($image)) {
// no image found on galleries, look for image properties
$properties = property::load_properties("item", $rs[$x]->template, "item", $rs[$x]->id);
for ($p = 0; $p < count($properties); $p++) {
if ($properties[$p]->type == 'image') {
if (!empty($properties[$p]->value)) {
$image = $properties[$p]->value;
} else {
if (!empty($properties[$p]->dvalue)) {
$image = $properties[$p]->dvalue;
}
//.........这里部分代码省略.........
示例6: run
function run()
{
global $user;
global $layout;
global $DB;
global $website;
$out = '';
$item = new website();
switch ($_REQUEST['act']) {
case 'json':
case 1:
// json data retrieval & operations
switch ($_REQUEST['oper']) {
case 'search_links':
// active website only!
$text = $_REQUEST['text'];
$lang = $_REQUEST['lang'];
if (empty($lang)) {
$lang = array_keys($website->languages)[0];
}
$DB->query('
SELECT p.path, d.text
FROM nv_paths p, nv_webdictionary d
WHERE p.website = ' . protect($website->id) . ' AND
p.lang = ' . protect($lang) . ' AND
d.website = p.website AND
d.node_type = p.type AND
d.node_id = p.object_id AND
d.lang = p.lang AND
d.subtype = "title" AND
(
p.path LIKE ' . protect('%' . $text . '%') . ' OR
d.text LIKE ' . protect('%' . $text . '%') . '
)
ORDER BY d.id DESC
LIMIT 10
');
$result = $DB->result();
echo json_encode($result);
core_terminate();
break;
case 'del':
// remove rows
if ($user->permission('websites.delete') == 'true') {
$ids = $_REQUEST['ids'];
foreach ($ids as $id) {
$item->load($id);
$item->delete();
}
echo json_encode(true);
}
core_terminate();
break;
default:
// list or search
$page = intval($_REQUEST['page']);
$max = intval($_REQUEST['rows']);
$offset = ($page - 1) * $max;
$orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
$where = " 1=1 ";
if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
if (isset($_REQUEST['quicksearch'])) {
$where .= $item->quicksearch($_REQUEST['quicksearch']);
} else {
if (isset($_REQUEST['filters'])) {
$where .= navitable::jqgridsearch($_REQUEST['filters']);
} else {
// single search
$where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
}
}
}
$DB->queryLimit('id,name,subdomain,domain,folder,homepage,permission,favicon', 'nv_websites', $where, $orderby, $offset, $max);
$dataset = $DB->result();
$total = $DB->foundRows();
//echo $DB->get_last_error();
$out = array();
$permissions = array(0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(69, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(70, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(81, 'Hidden'));
for ($i = 0; $i < count($dataset); $i++) {
$homepage = 'http://';
$homepage_relative_url = $dataset[$i]['homepage'];
if (is_numeric($homepage_relative_url)) {
$homepage_relative_url = path::loadElementPaths('structure', $homepage_relative_url);
$homepage_relative_url = array_shift($homepage_relative_url);
}
if (!empty($dataset[$i]['subdomain'])) {
$homepage .= $dataset[$i]['subdomain'] . '.';
}
$homepage .= $dataset[$i]['domain'] . $dataset[$i]['folder'] . $homepage_relative_url;
$favicon = '';
if (!empty($dataset[$i]['favicon'])) {
$favicon = '<img src="' . NVWEB_OBJECT . '?type=img&id=' . $dataset[$i]['favicon'] . '&width=16&height=16" align="absmiddle" height="16" />';
}
$out[$i] = array(0 => $dataset[$i]['id'], 1 => $favicon, 2 => $dataset[$i]['name'], 3 => '<a href="' . $homepage . '" target="_blank"><img align="absmiddle" src="' . NAVIGATE_URL . '/img/icons/silk/house_link.png"></a> ' . $homepage, 4 => $permissions[$dataset[$i]['permission']]);
}
navitable::jqgridJson($out, $page, $offset, $max, $total);
break;
}
session_write_close();
exit;
//.........这里部分代码省略.........
示例7: run
function run()
{
global $user;
global $layout;
global $DB;
global $website;
global $theme;
$out = '';
$item = new structure();
switch ($_REQUEST['act']) {
case 'load':
case 'edit':
case 2:
// edit/new form
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
}
if (isset($_REQUEST['form-sent'])) {
$item->load_from_post();
try {
$item->save();
property::save_properties_from_post('structure', $item->id);
$item = $item->reload();
// reorder associated category elements
if (!empty($_POST['elements-order'])) {
$response = item::reorder($_POST['elements-order']);
if ($response !== true) {
throw new Exception($response);
}
}
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
if (!empty($item->id)) {
users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
}
} else {
if (!empty($item->id)) {
users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
}
}
$out = structure_form($item);
break;
case 3:
case "reorder":
$ok = structure::reorder($_REQUEST['parent'], $_REQUEST['children_order']);
echo json_encode($ok);
core_terminate();
break;
case "homepager":
$node = $_REQUEST['node'];
$website->homepage = $node;
$ok = $website->save();
echo json_encode($ok);
core_terminate();
break;
case 4:
case "remove":
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
if ($item->delete() > 0) {
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$structure = structure::hierarchy(-1);
// root level (0) including Web node (-1)
$out = structure_tree($structure);
users_log::action($_REQUEST['fid'], $item->id, 'remove');
} else {
$layout->navigate_notification(t(56, 'Unexpected error.'), false);
$out = structure_form($item);
}
}
break;
case 95:
// free path checking
$path = $_REQUEST['path'];
$id = $_REQUEST['id'];
$DB->query('SELECT type, object_id, lang
FROM nv_paths
WHERE path = ' . protect($path) . '
AND website = ' . $website->id);
$rs = $DB->result();
echo json_encode($rs);
core_terminate();
break;
case "category_path":
// return category paths
echo json_encode(path::loadElementPaths('structure', intval($_REQUEST['id'])));
core_terminate();
break;
case 'json_find_item':
// find items by its title
// the items must have its own path (free OR not embedded to a category)
$DB->query('
SELECT SQL_CALC_FOUND_ROWS nvw.node_id as id, nvw.text as text
FROM nv_webdictionary nvw, nv_items nvi
WHERE nvw.node_type = "item"
AND nvw.node_id = nvi.id
AND nvw.subtype = "title"
AND ( nvi.association = "free" OR
//.........这里部分代码省略.........