本文整理汇总了PHP中Space::rewrite方法的典型用法代码示例。如果您正苦于以下问题:PHP Space::rewrite方法的具体用法?PHP Space::rewrite怎么用?PHP Space::rewrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Space
的用法示例。
在下文中一共展示了Space::rewrite方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
uses("space", "industry", "area");
$space = new Space();
$area = new Areas();
$industry = new Industries();
$cache_options = cache_read('typeoption');
$area_s = $space->array_multi2single($area->getCacheArea());
$industry_s = $space->array_multi2single($area->getCacheArea());
$result = $this->findAll("*,name AS title,content AS digest", null, null, $this->orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['typename'] = $cache_types['productsort'][$values['sort_id']];
$result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
$result[$keys]['pubdate'] = df($values['begin_time']);
if (!empty($result[$keys]['area_id'])) {
$r1 = $area_s[$result[$keys]['area_id']];
}
if (!empty($result[$keys]['cache_companyname'])) {
$r2 = "<a href='" . $space->rewrite($result[$keys]['cache_companyname'], $result[$keys]['company_id']) . "'>" . $result[$keys]['cache_companyname'] . "</a>";
}
if (!empty($r1) || !empty($r2)) {
$result[$keys]['extra'] = implode(" - ", array($r1, $r2));
}
$result[$keys]['url'] = $this->getPermaLink($values['id']);
}
return $result;
}
示例2: array
setvar("ProductTypes", $product_types);
$group_info = array();
$group_info['year'] = $time_tmp;
if (!empty($member->info['membergroup_id']['name'])) {
$group_info['name'] = $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['name'];
} else {
$group_info['name'] = L("undefined_image", "tpl");
}
if (!empty($member->info['membergroup_id']['avatar'])) {
$group_info['image'] = $absolute_uri . "images/group/" . $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['avatar'];
} else {
$group_info['image'] = $absolute_uri . "images/group/formal.gif";
}
setvar("GROUP", $group_info);
//for old version
if (isset($member->info['membergroup_id']['name'])) {
setvar("GroupName", $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['name']);
}
if (isset($member->info['membergroup_id']['avatar'])) {
setvar("GroupImage", $absolute_uri . "images/group/" . $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['avatar']);
}
//:~
setvar("Menus", $space->getMenu());
setvar("Links", $space->getLinks());
$space_url = $space->rewrite($company->info['cache_spacename'], $company->info['id']);
setvar("space_url", $space_url);
setvar("SpaceUrl", $absolute_uri . $skin_dir);
setvar("BASEMAP", $absolute_uri . $skin_dir);
if (!empty($arrTemplate)) {
$smarty->assign($arrTemplate);
}
示例3: Space
/**
* only use data1 col for cache,data2 is disabled
* 03/05/2011
* @param int $id member id
* @update 7.7.2011
*/
function _updateMemberCaches($id)
{
global $_PB_CACHE;
$cache_time = $this->default_cachetime;
if (class_exists("Spaces")) {
$space_controller = new Space();
} else {
uses("space");
$space_controller = new Space();
}
$data = array();
if (empty($id)) {
$id = $_SESSION['MemberID'];
}
$data['member'] = $this->getInfoById($_SESSION['MemberID']);
$new_pm = $this->dbstuff->GetOne("SELECT count(id) AS amount FROM {$this->table_prefix}messages WHERE status='0' AND to_member_id=" . $id);
$data['message']['new_pm'] = $new_pm;
if ($data['member']['membertype_id']) {
$data['company'] = $this->GetRow("SELECT c.* FROM {$this->table_prefix}companies c LEFT JOIN {$this->table_prefix}companyfields cf ON c.id=cf.company_id WHERE c.member_id='" . $id . "'");
$data['company']['space_url'] = $space_controller->rewrite($data['company']['cache_spacename']);
}
if ($_PB_CACHE['office_cache'] && $_PB_CACHE['main_cache_lifetime']) {
$cache_time = $_PB_CACHE['main_cache_lifetime'];
$this->dbstuff->Execute("REPLACE INTO `{$this->table_prefix}membercaches` (member_id,data1,data2,expiration) VALUE ('" . $id . "','" . @serialize($data) . "',''," . ($this->timestamp + $cache_time) . ")");
}
return $data;
}
示例4: formatResult
function formatResult($result)
{
global $_PB_CACHE;
if (!class_exists('Space')) {
uses("space");
}
$space_controller = new Space();
if (!$result || empty($result)) {
return null;
}
if (!isset($_PB_CACHE['membergroup'])) {
require CACHE_PATH . "cache_membergroup.php";
}
if (!isset($_PB_CACHE['manage_type'])) {
require CACHE_PATH . "cache_typeoption.php";
}
$count = count($result);
for ($i = 0; $i < $count; $i++) {
$result[$i]['gradeimg'] = 'images/group/' . $_PB_CACHE['membergroup'][$result[$i]['cache_membergroupid']]['avatar'];
if (!empty($result[$i]['manage_type'])) {
$result[$i]['managetype'] = $_PB_CACHE['manage_type'][$result[$i]['manage_type']];
}
if (!empty($result[$i]['membergroup_id'])) {
$result[$i]['gradename'] = $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['name'];
}
if (isset($result[$i]['space_name'])) {
$result[$i]['url'] = $space_controller->rewrite($result[$i]['space_name'], $result[$i]['id']);
} else {
$result[$i]['url'] = "javascript:;";
}
if (isset($result[$i]['picture'])) {
$result[$i]['logo'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small');
$result[$i]['logosrc'] = '<img alt="' . $result[$i]['name'] . '" src="' . pb_get_attachmenturl($result[$i]['picture'], '', 'small') . '" />';
}
}
return $result;
}
示例5: smarty_block_company
//.........这里部分代码省略.........
}
}
if (isset($params['areaid'])) {
if (strpos($params['areaid'], ",")) {
$conditions['area'] = "c.area_id IN (" . $params['areaid'] . ")";
} else {
$area_id = intval($params['areaid']);
if ($area_id) {
$conditions['area'] = "c.area_id=" . $area_id;
}
}
}
if (!empty($_GET['industryid'])) {
$conditions['industry'] = "c.industry_id=" . intval($_GET['industryid']);
}
if (!empty($_GET['areaid'])) {
$conditions['area'] = "c.area_id=" . intval($_GET['areaid']);
}
if (isset($params['groupid'])) {
$conditions[] = "c.cache_membergroupid=" . $params['groupid'];
}
$limit = $offset = 0;
if (isset($params['row'])) {
$limit = $params['row'];
}
if (isset($params['start'])) {
$offset = $params['start'];
}
$orderby = null;
if (isset($params['orderby'])) {
if ($params['orderby'] == "rand" || $params['orderby'] == "rand()") {
$sql = "SELECT max(id) AS max_id,min(id) AS min_id FROM " . $company->table_prefix . "companies";
$result = $company->GetRow($sql);
for ($i = 0; $i <= $limit; $i++) {
$ids[] = mt_rand($result['min_id'], $result['max_id']);
}
$conditions[] = "id IN (" . implode(",", $ids) . ")";
} else {
$orderby = " ORDER BY " . trim($params['orderby']) . " ";
}
} else {
$orderby = " ORDER BY id DESC ";
}
$company->setCondition($conditions);
$company->setLimitOffset($offset, $limit);
$mysql_limit = $company->getLimitOffset();
if (isset($params['limit'])) {
$mysql_limit = " " . trim($params['limit']);
}
$sql = "SELECT c.id as companyid,c.name as companyname,c.name as title,cache_spacename as userid,c.* FROM {$company->table_prefix}companies c " . $company->getCondition() . "{$orderby}" . $mysql_limit . "";
if (empty($smarty->blockvars[$param_count])) {
$smarty->blockvars[$param_count] = $company->GetArray($sql);
if (!$smarty->blockvars[$param_count]) {
return $repeat = false;
}
}
if (!function_exists("smarty_function_the_url")) {
require "function.the_url.php";
}
if (list($key, $item) = each($smarty->blockvars[$param_count])) {
$repeat = true;
$item['rownum'] = $key;
$item['iteration'] = ++$key;
if (!empty($item['userid']) && $item['member_id'] > 0) {
$url = $space_controller->rewrite($item['userid']);
} else {
$url = smarty_function_the_url(array("id" => $item['id'], "module" => "company"));
}
$item['url'] = $url;
if (isset($params['titlelen'])) {
$item['companyname'] = mb_substr($item['name'], 0, $params['titlelen']);
}
if (!empty($item['cache_membergroupid'])) {
$item['avatar'] = $item['groupavatar'] = "images/group/" . $_PB_CACHE['membergroup'][$item['cache_membergroupid']]['avatar'];
}
if (!empty($item['picture'])) {
$item['logo'] = pb_get_attachmenturl($item['picture'], '', 'small');
}
$item['areaid'] = $item['area_id'];
$areas = $company_controller->array_multi2single($_PB_CACHE['area']);
if (!empty($areas[$item['area_id']])) {
$item['areaname'] = $areas[$item['area_id']];
}
if (!empty($_PB_CACHE['membergroup'][$item['cache_membergroupid']]['name'])) {
$item['groupname'] = $_PB_CACHE['membergroup'][$item['cache_membergroupid']]['name'];
}
$item['link'] = '<a title="' . $item['name'] . '" href="' . $url . '">' . $item['companyname'] . '</a>';
$item['thumb'] = $item['src'] = $item['logo'];
$smarty->assign($params['name'], $item);
} else {
$repeat = false;
reset($smarty->blockvars[$param_count]);
}
if (!is_null($content)) {
print $content;
}
if (!$repeat) {
$smarty->blockvars[$param_count] = array();
}
}
示例6: smarty_block_job
/**
* [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
* The contents of this file are subject to the License; you may not use this file except in compliance with the License.
*
* @version $Revision: 2075 $
*/
function smarty_block_job($params, $content, &$smarty, &$repeat)
{
$conditions = array();
$param_count = count($smarty->_tag_stack);
if (empty($params['name'])) {
$params['name'] = "job";
}
if (class_exists("Jobs")) {
$job = new Jobs();
} else {
uses("job");
$job = new Jobs();
}
if (!class_exists('Space')) {
uses("space");
}
$space_controller = new Space();
if (isset($params['companyid'])) {
$conditions[] = "company_id=" . $params['companyid'];
}
if (isset($params['status'])) {
$conditions[] = "j.status='" . $params['status'] . "'";
}
if (isset($params['memberid'])) {
$conditions[] = "member_id=" . $params['memberid'];
}
if (isset($params['id'])) {
$conditions[] = "j.id=" . $params['id'];
}
$orderby = null;
if (isset($params['orderby'])) {
$orderby = " ORDER BY " . trim($params['orderby']) . " ";
} else {
$orderby = " ORDER BY id DESC";
}
$job->setCondition($conditions);
$limit = $offset = 0;
if (isset($params['row'])) {
$limit = $params['row'];
}
if (isset($params['start'])) {
$offset = $params['start'];
}
$job->setLimitOffset($offset, $limit);
$sql = "SELECT j.id,j.content,j.name,j.name as title,c.name AS companyname,c.cache_spacename AS userid FROM {$job->table_prefix}jobs j LEFT JOIN {$job->table_prefix}companies c ON c.id=j.company_id " . $job->getCondition() . "{$orderby}" . $job->getLimitOffset();
if (empty($smarty->blockvars[$param_count])) {
$smarty->blockvars[$param_count] = $job->GetArray($sql);
if (!$smarty->blockvars[$param_count]) {
return $repeat = false;
}
}
if (list($key, $item) = each($smarty->blockvars[$param_count])) {
$repeat = true;
$space_controller->setBaseUrlByUserId($item['userid'], "job");
$url = $space_controller->rewriteDetail("job", $item['id']);
$item['url'] = $url;
$item['space_url'] = $space_controller->rewrite($item['userid'], $item['company_id']);
$item['content'] = strip_tags($item['content']);
if (isset($params['titlelen'])) {
$item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
}
$item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '">' . $item['title'] . '</a>';
if (isset($params['infolen'])) {
if (isset($item['content'])) {
$item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
}
}
$smarty->assign($params['name'], $item);
} else {
$repeat = false;
reset($smarty->blockvars[$param_count]);
}
if (!is_null($content)) {
print $content;
}
if (!$repeat) {
$smarty->blockvars[$param_count] = array();
}
}
示例7: smarty_function_the_url
/**
* [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
* The contents of this file are subject to the License; you may not use this file except in compliance with the License.
*
* @version $Revision: 2181 $
*/
function smarty_function_the_url($params)
{
$do = null;
extract($params);
global $subdomain_support, $topleveldomain_support, $rewrite_able, $rewrite_compatible;
$return = "##";
if (!empty($module)) {
switch ($module) {
case "producttype":
if ($rewrite_able) {
$return = URL . "space/" . $userid . "/product/list-" . $typeid . "-" . intval($page) . ".html";
} else {
$return = URL . "space/?userid=" . $userid . "&do=product&typeid=" . $typeid . "&page=" . $page;
}
break;
case "space":
if (!class_exists('Space')) {
uses("space");
}
$space_controller = new Space();
$return = $space_controller->rewrite($userid, $id, $do);
break;
case "offer":
if (!class_exists('Trade')) {
uses("trade");
}
$trade_controller = new Trade();
if ($rewrite_able) {
$return = "offer/" . $trade_controller->getModulenameById($typeid) . "/detail/" . $id . ".html";
} else {
$return = "offer/detail.php?id=" . $id;
}
break;
case "list":
$extra_param = array();
if (!empty($extra)) {
if (strpos($extra, "|") > 0) {
$tmp = explode("|", $extra);
foreach ($tmp as $k => $v) {
$tmp_p = explode(",", $v);
$extra_param[$tmp_p[0]] = $tmp_p[1];
}
} else {
$tmp = explode(",", $extra);
$extra_param[$tmp[0]] = $tmp[1];
}
}
$param = http_build_query($extra_param + $_GET);
$return = $GLOBALS['php_self'] . "?" . $param;
break;
case "special":
if ($rewrite_able) {
if ($type == "topic") {
//name first alias_name
$return = "topic/" . $name . "/";
} else {
$return = "topic/" . $type . "/" . $id . "/?do=" . $do;
}
} else {
if ($type == "topic") {
//name first alias_name
$return = "special/?type=" . $type . "&name=" . $name;
} else {
$return = "special/?type=" . $type . "&do=" . $do . "&id=" . $id;
}
}
break;
case "page":
if ($rewrite_able) {
$return = "page/" . urlencode($title) . "/";
} else {
$return = "page.php?title=" . urlencode($title);
}
break;
case "search":
if ($rewrite_able) {
if (!isset($pos)) {
$pos = 0;
}
if (!isset($params['pos']) && !isset($params['typeid'])) {
$return = empty($do) ? "search/" : "search/" . $do . "/";
} else {
$return = $do . "-list-" . $pos . "-" . intval($typeid) . "-" . intval($areaid) . "-" . intval($industryid) . ".html";
}
} else {
$return = "search/?do=" . $do . "&pos=" . $pos;
if (!empty($q)) {
$return .= "&q=" . $q;
}
if (!empty($typeid)) {
$return .= "&typeid=" . intval($typeid);
}
if (!empty($areaid)) {
$return .= "&areaid=" . $areaid;
//.........这里部分代码省略.........