本文整理汇总了PHP中object::build方法的典型用法代码示例。如果您正苦于以下问题:PHP object::build方法的具体用法?PHP object::build怎么用?PHP object::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchTopicParticipants
/**
* Fetch the topic participants
*
* @access public
* @param int Topic ID
* @param boolean Load and parse member data (TRUE for yes, FALSE for no)
* @return array Array of member data indexed by member ID
*/
public function fetchTopicParticipants($topicID, $parseThem = FALSE)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$memberData = array();
$remapData = array();
//-----------------------------------------
// Grab 'em
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => 'map_topic_id=' . intval($topicID)));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$remapData[$row['map_user_id']] = $row;
}
if (!count($remapData)) {
return array();
}
/* Parse 'em? */
if ($parseThem === TRUE) {
/* Grab member data */
$memberData = IPSMember::load(array_keys($remapData), 'all');
foreach ($memberData as $id => $data) {
$data['_canBeBlocked'] = IPSMember::isIgnorable($data['member_group_id'], $data['mgroup_others']);
$memberData[$id] = IPSMember::buildDisplayData($data, array('__all__' => 1));
$memberData[$id] = array_merge($memberData[$id], $remapData[$id]);
}
$remapData = $memberData;
}
return $remapData;
}
示例2: _buildTiers
/**
* Build the in-memory information tiers
*
* @access protected
* @return @e void
*/
protected function _buildTiers()
{
if (!count($this->_itemCache)) {
//-----------------------------------------
// See if there is a specialized function
// for this first
//-----------------------------------------
if (method_exists($this, $this->_customBuildMethod)) {
$method = $this->_customBuildMethod;
$this->{$method}();
return;
}
//-----------------------------------------
// Get pages from db
//-----------------------------------------
$this->_sqlOrder = $this->_sqlOrder ? $this->_sqlOrder : $this->_sqlTitle;
$this->DB->build(array('select' => $this->_sqlSelect, 'where' => $this->_sqlWhere, 'from' => $this->_sqlTable, 'order' => $this->_sqlOrder));
$this->DB->execute();
while ($item = $this->DB->fetch()) {
if ($item[$this->_sqlParentID] < 1) {
$item[$this->_sqlParentID] = 'root';
}
$this->_itemCache[$item[$this->_sqlParentID]][$item[$this->_sqlPrimaryID]] = $item;
$this->_itemByID[$item[$this->_sqlPrimaryID]] = $item[$this->_sqlParentID];
}
}
}
示例3: getResultsForSphinx
/**
* This function grabs the actual results for display
*
* @param array $ids
* @return query result
**/
public function getResultsForSphinx($ids)
{
if (ipsRegistry::$request['content_title_only'] == 1) {
$this->DB->build(array('select' => "t.*", 'from' => array('topics' => 't'), 'where' => 't.tid IN( ' . implode(',', $ids) . ')', 'order' => 't.last_post DESC', 'add_join' => array(array('select' => 'p.*', 'from' => array('posts' => 'p'), 'where' => 'p.pid=t.topic_firstpost', 'type' => 'left'), array('from' => array('forums' => 'f'), 'where' => 'f.id=t.forum_id', 'type' => 'left'), array('select' => 'm.member_id, m.members_display_name, m.members_seo_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'))));
} else {
$this->DB->build(array('select' => "p.*", 'from' => array('posts' => 'p'), 'where' => 'p.pid IN( ' . implode(',', $ids) . ')', 'order' => 'p.post_date DESC', 'add_join' => array(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => 't.tid=p.topic_id', 'type' => 'left'), array('from' => array('forums' => 'f'), 'where' => 'f.id=t.forum_id', 'type' => 'left'), array('select' => 'm.member_id, m.members_display_name, m.members_seo_name', 'from' => array('members' => 'm'), 'where' => 'm.member_id=p.author_id', 'type' => 'left'))));
}
return $this->DB->execute();
}
示例4: buildQuery
/**
* Builds query based on the current query elements established
*
* @param string $type The type of query to build
* @return string
* @since 2.0.0
**/
private function buildQuery($type = 'select')
{
$pieces = array();
// Loop through query elements
foreach ($this->{$type} as $piece) {
// If we have one of these elements, get its string value
if ($element = $this->syntax->build($piece)) {
$pieces[] = $element;
}
}
return implode("\n", $pieces);
}
示例5: getSearchCount
/**
* Returns the total number of results the search will return
*
* @access public
* @param string $search_term Search term
* @param string $group_by Column to group by
* @param bool $content_title_only Only search title records
* @return integer
*/
public function getSearchCount($search_term, $group_by = '', $content_title_only = false)
{
/* Query the count */
$this->DB->build($this->_buildSearchQueryArray($search_term, array(), '', $group_by, true, $content_title_only));
$this->DB->execute();
/* Return the count */
if ($group_by) {
return $this->DB->getTotalRows();
} else {
$r = $this->DB->fetch();
return $r['total_results'];
}
}
示例6: processData
/**
* Process links data
*
* Array will be $key => array( log_data_app =>, log_data_type =>, log_data_primary_id =>, )
*
* MUST be returned:
* $key => array( 'title' => 'My Great Topic',
* 'url' => URL, SEO where appropriate,
* 'published' => unix time stamp,
* 'icon' => icon relative to /style_images/master (16x16 icon)
*
* @param array
* @return array
*/
public function processData($array)
{
$topics = array();
$final = array();
$return = array();
/* Ensure forums class is loaded */
if (!$this->registry->isClassLoaded('class_forums')) {
try {
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
$this->registry->setClass('class_forums', new $classToLoad($this->registry));
$this->registry->getClass('class_forums')->strip_invisible = 1;
$this->registry->getClass('class_forums')->forumsInit();
} catch (Exception $error) {
IPS_exception_error($error);
}
}
/* Here we go again */
if (is_array($array) and count($array)) {
foreach ($array as $key => $data) {
if ($data['log_data_type'] == 'topic') {
$topics[] = intval($data['log_data_primary_id']);
}
}
if (count($topics)) {
$this->DB->build(array('select' => 'tid, title, title_seo, start_date, forum_id', 'from' => 'topics', 'where' => 'tid IN (' . implode(',', $topics) . ')'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
/* Quick permission check */
if (!$this->registry->getClass('class_forums')->forumsCheckAccess($row['forum_id'], 0, 'forum', $row, true)) {
$url = $this->registry->output->buildUrl('showtopic=' . $row['tid'], 'publicNoSession');
$title = 'Protected Topic';
} else {
$url = $this->registry->output->buildSEOUrl('showtopic=' . $row['tid'], 'publicNoSession', $row['title_seo'], 'showtopic');
$title = $row['title'];
}
$final[$row['tid']] = array('title' => $title, 'url' => $url, 'published' => $row['start_date'], 'icon' => 'page_topic.png');
}
}
/* Sigh */
if (is_array($final)) {
foreach ($array as $key => $data) {
$return[$key] = isset($final[$data['log_data_primary_id']]) ? $final[$data['log_data_primary_id']] : array();
}
return $return;
}
return array();
}
return array();
}
示例7: recacheFriends
/**
* Recaches member's friends
*
* @access public
* @param array $member Member array to recache
* @return boolean
*/
public function recacheFriends($member)
{
/* INIT */
$friends = array();
/* Check the member id */
if (!$member['member_id']) {
return FALSE;
}
/* Get our friends */
$this->DB->build(array('select' => '*', 'from' => 'profile_friends', 'where' => 'friends_member_id=' . $member['member_id']));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$friends[$row['friends_friend_id']] = $row['friends_approved'];
}
/* Update the cache */
IPSMember::packMemberCache($member['member_id'], array('friends' => $friends));
return TRUE;
}
示例8: _buildTiers
/**
* Build the in-memory information tiers
*
* @access private
* @return void
*/
private function _buildTiers()
{
if (!count($this->_itemCache)) {
//-----------------------------------------
// Get pages from db
//-----------------------------------------
$this->_sqlOrder = $this->_sqlOrder ? $this->_sqlOrder : $this->_sqlTitle;
$this->DB->build(array('select' => '*', 'where' => $this->_sqlWhere, 'from' => $this->_sqlTable, 'order' => $this->_sqlOrder));
$this->DB->execute();
while ($item = $this->DB->fetch()) {
if ($item[$this->_sqlParentID] < 1) {
$item[$this->_sqlParentID] = 'root';
}
$this->_itemCache[$item[$this->_sqlParentID]][$item[$this->_sqlPrimaryID]] = $item;
$this->_itemByID[$item[$this->_sqlPrimaryID]] = $item[$this->_sqlParentID];
}
}
}
示例9: addWidget
/**
* Add a widget to the dashboard.
*
* If a widget with the same $widgetIdent already exists, it will be overridden.
*
* @param string $widgetIdent The widget identifier.
* @param UiItemInterface|array $widget The widget object or structure.
* @throws InvalidArgumentException If the widget is invalid.
* @return DashboardInterface Chainable
*/
public function addWidget($widgetIdent, $widget)
{
if (!is_string($widgetIdent)) {
throw new InvalidArgumentException('Widget identifier needs to be a string');
}
if ($widget instanceof UiItemInterface) {
$this->widgets[$widgetIdent] = $widget;
} elseif (is_array($widget)) {
if (!isset($widget['ident'])) {
$widget['ident'] = $widgetIdent;
}
$w = $this->widgetBuilder->build($widget);
$this->widgets[$widgetIdent] = $w;
} else {
throw new InvalidArgumentException('Can not add widget: Invalid Widget.');
}
return $this;
}
示例10: buildComments
/**
* Builds comments
*
* @access public
* @param array Member information
* @param boolean Use a new id
* @param string Message to display
* @return string Comment HTML
* @since IPB 2.2.0.2006-08-02
*/
public function buildComments($member, $new_id = 0, $return_msg = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$comments = array();
$member_id = intval($member['member_id']);
$comment_perpage = 15;
//intval( $member['pp_setting_count_comments'] );
$comment_html = 0;
$comment_start = intval($this->request['st']);
$comment_approved = ($this->memberData['member_id'] == $member['member_id'] or $this->memberData['g_is_supmod']) ? '' : ' AND ( pc.comment_approved=1 OR ( pc.comment_approved=0 AND pc.comment_by_member_id=' . $member_id . ') )';
//-----------------------------------------
// Not showing comments?
//-----------------------------------------
if ($comment_perpage < 1) {
return '';
}
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->DB->build(array('select' => 'pc.*', 'from' => array('profile_comments' => 'pc'), 'where' => 'pc.comment_for_member_id=' . $member_id . $comment_approved, 'order' => 'pc.comment_date DESC', 'limit' => array($comment_start, $comment_perpage), 'calcRows' => TRUE, 'add_join' => array(array('select' => 'm.members_display_name, m.members_seo_name, m.posts, m.last_activity, m.member_group_id, m.member_id, m.last_visit, m.warn_level', 'from' => array('members' => 'm'), 'where' => 'm.member_id=pc.comment_by_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left'))));
$o = $this->DB->execute();
$max = $this->DB->fetchCalculatedRows();
while ($row = $this->DB->fetch($o)) {
$row['_comment_date'] = ipsRegistry::getClass('class_localization')->getDate($row['comment_date'], 'TINY');
$row = IPSMember::buildDisplayData($row);
if (!$row['members_display_name_short']) {
$row = array_merge($row, IPSMember::setUpGuest());
}
$comments[] = $row;
}
//-----------------------------------------
// Pagination
//-----------------------------------------
$links = $this->registry->output->generatePagination(array('totalItems' => $max, 'itemsPerPage' => $comment_perpage, 'currentStartValue' => $comment_start, 'baseUrl' => "showuser={$member_id}", 'seoTitle' => $member['members_seo_name']));
$comment_html = $this->registry->getClass('output')->getTemplate('profile')->showComments($member, $comments, $new_id, $return_msg, $links);
//-----------------------------------------
// Return it...
//-----------------------------------------
return $comment_html;
}
示例11: initData
/**
* Initializes cache, loads kernel class, and formats data for kernel class
*
* @param string $type Set to view for displaying the field normally or edit for displaying in a form
* @param bool $mlist Whether this is the memberlist or not
* @return @e void
*/
public function initData($type = 'view', $mlist = 0, $attributes = array())
{
/* Store Type */
$this->type = $type;
/* Get Member */
if (!count($this->member_data) and $this->mem_data_id && !$mlist) {
$this->member_data = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'pfields_content', 'where' => 'member_id=' . intval($this->mem_data_id)));
}
if (count($this->member_data)) {
$this->mem_data_id = isset($this->member_data['member_id']) ? $this->member_data['member_id'] : 0;
}
if (!$this->init) {
/* Cache data... */
if (!is_array($this->cache_data)) {
$this->DB->build(array('select' => '*', 'from' => 'pfields_data', 'order' => 'pf_group_id,pf_position'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$this->cache_data[$r['pf_id']] = $r;
}
}
}
/* Get names... */
if (is_array($this->cache_data) and count($this->cache_data)) {
foreach ($this->cache_data as $id => $data) {
/* Field names and descriptions */
$this->field_names[$id] = $data['pf_title'];
$this->field_desc[$id] = $data['pf_desc'];
/* In Fields */
foreach ($this->cache_data as $id => $data) {
$data['pf_key'] = !empty($data['pf_key']) ? $data['pf_key'] : '_key_' . $data['pf_id'];
$data['pf_group_key'] = $data['pf_group_key'] ? $data['pf_group_key'] : '_other';
if ($mlist) {
$this->in_fields[$id] = '';
if (!empty(ipsRegistry::$request['field_' . $id])) {
if (is_string(ipsRegistry::$request['field_' . $id])) {
$this->in_fields[$id] = urldecode(ipsRegistry::$request['field_' . $id]);
} else {
if (is_array(ipsRegistry::$request['field_' . $id])) {
foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
$this->in_fields[$id][$k] = urldecode($v);
}
}
}
}
} else {
$_val = '';
if (is_string(ipsRegistry::$request['field_' . $id])) {
$_val = urldecode(ipsRegistry::$request['field_' . $id]);
} else {
if (is_array(ipsRegistry::$request['field_' . $id])) {
foreach (ipsRegistry::$request['field_' . $id] as $k => $v) {
$_val[$k] = urldecode($v);
}
}
}
$this->in_fields[$id] = isset($this->member_data['field_' . $id]) ? $this->member_data['field_' . $id] : $_val;
}
}
}
}
/* Clean up on aisle #4 */
$this->out_fields = array();
$this->out_chosen = array();
/* Format data for kernel class */
foreach ($this->cache_data as $k => $v) {
/* Add any option to dropdown */
if ($v['pf_type'] == 'drop' && $mlist) {
$v['pf_content'] = '0=|' . $v['pf_content'];
}
/* Field Info */
$this->cache_data[$k]['id'] = $v['pf_id'];
$this->cache_data[$k]['type'] = $v['pf_type'];
$this->cache_data[$k]['data'] = $v['pf_content'];
$this->cache_data[$k]['value'] = $this->in_fields[$k];
/* Field Restrictions */
$this->cache_data[$k]['restrictions'] = array('max_size' => isset($v['pf_max_input']) ? $v['pf_max_input'] : '', 'min_size' => isset($v['pf_min_input']) ? $v['pf_min_input'] : '', 'not_null' => isset($v['pf_not_null']) ? $v['pf_not_null'] : '', 'format' => isset($v['pf_input_format']) ? $v['pf_input_format'] : '', 'urlfilter' => isset($v['pf_filtering']) ? $v['pf_filtering'] : '');
if (!empty($attributes)) {
if (!isset($this->cache_data[$k]['attributes'])) {
$this->cache_data[$k]['attributes'] = $attributes;
} else {
$this->cache_data[$k]['attributes'] = array_merge($this->cache_data[$k]['attributes'], $attributes);
}
}
}
/* Kernel profile field class */
$_NOW = IPSDebug::getMemoryDebugFlag();
$classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classCustomFields.php', 'classCustomFields');
IPSDebug::setMemoryDebugFlag("Get CustomFields Kernel Class", $_NOW);
$this->cfields_obj = new $classToLoad($this->cache_data, $type, $attributes);
$this->cfields = $this->cfields_obj->cfields;
$this->init = 1;
}
示例12: build
/**
* Build the children
*
* @param array $sDates array containing Calendar objects to select (optional)
*
* @return boolean
* @access public
* @abstract
*/
function build($sDates = array())
{
$this->calendar->build($sDates);
}
示例13: process
/**
* Processes the source code tokens
*
* Gets all the source code tokens. Determines the source code EOL.
* Determines the file PHP version. Initializes the Page-level tags.
* Parses the file tokens and creates their DocBlocks.
* Re-assembles all the tokens with their DocBlocks.
*
* @param string $data the source code
* @param array $param the tags/parameters values
* @return boolean true on success, false on failure
* @access public
*/
public function process($data, $param)
{
// get all the tokens
if ($result = $this->getAll($data)) {
// determines the source code EOL
$this->getEOL($data);
// extracts all the tokens
$allTokens = $this->slice();
// initializes the Page-level tags
$this->block->init($param);
$this->hasBlock = 0;
$this->id = array();
$this->inClass = null;
$inFunct = null;
$openTagID = null;
$isPageBlock = false;
foreach ($this->tokens as $id => $token) {
$value = $token['value'];
switch ($type = $token['type']) {
case '{':
// class or function opening curly brace
// note: none matching open and close curly braces will cause issues
// class or function opening curly brace
// note: none matching open and close curly braces will cause issues
case T_CURLY_OPEN:
case T_DOLLAR_OPEN_CURLY_BRACES:
// ${
// counting braces within the function, and the class
is_null($inFunct) or $inFunct++;
is_null($this->inClass) or $this->inClass++;
break;
case '}':
// class or function closing curly brace
// reached end of the function or class
is_null($inFunct) or --$inFunct or $inFunct = null;
is_null($this->inClass) or --$this->inClass or $this->inClass = null;
break;
case T_CLASS:
// class classes and objects
$this->inClass = 0;
$this->block->setClass($id);
break;
case T_CONST:
// const
// sets the const DocBlock
is_null($this->inClass) or $this->block->setConst($id);
break;
case T_CONSTANT_ENCAPSED_STRING:
// "foo" or 'bar' string syntax
// sets the include DocBlock
isset($this->id[T_INCLUDE]) and $this->block->build($this->id[T_INCLUDE]);
break;
case T_DOC_COMMENT:
// /** */ PHPDoc style comments (PHP 5 only)
// spots the page block, realigns the DocBlock tags
$this->hasBlock = true;
$isPageBlock or $isPageBlock = strpos($value, '@package') !== false;
$this->block->realign($id, $value);
break;
case T_FUNCTION:
// function or cfunction functions
$inFunct = 0;
$this->block->setFunction($id);
// sets function DocBlock
break;
case T_INCLUDE:
// include() include()
// include() include()
case T_INCLUDE_ONCE:
// include_once() include_once()
// include_once() include_once()
case T_REQUIRE:
// require() require()
// require() require()
case T_REQUIRE_ONCE:
// require_once() require_once()
$type = T_INCLUDE;
case T_GLOBAL:
// global variable scope
// only capturing includes and globals outside of classes and functions
is_null($this->inClass) and is_null($inFunct) and $this->id[$type] = $id;
break;
case T_OPEN_TAG:
// <?php, <? or <%
$openTagID = $id;
break;
case T_PRIVATE:
//.........这里部分代码省略.........
示例14: _destroySessions
/**
* Kill sessions
*
* @access protected
* @param string Any extra WHERE stuff
* @return void
*/
protected function _destroySessions($where = '')
{
$where .= $where ? ' OR ' : '';
$where .= 'running_time < ' . (IPS_UNIX_TIME_NOW - $this->settings['session_expiration']);
//-----------------------------------------
// Grab session data to delete on destruct
//-----------------------------------------
if ($this->_deleteNow) {
$this->DB->delete('sessions', $where);
} else {
$this->DB->build(array('select' => '*', 'from' => 'sessions', 'where' => $where));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$this->_sessionsToKill[$row['id']] = $row;
}
IPSDebug::addLogMessage("_destroySessions: {$where}", 'sessions-' . $this->_memberData['member_id']);
}
}
示例15: getResultsForSphinx
/**
* This function grabs the actual results for display
*
* @param array $ids
* @return query result
**/
public function getResultsForSphinx($ids)
{
$this->DB->build(array('select' => "*", 'from' => 'ccs_pages', 'where' => 'page_id IN(' . implode(',', $ids) . ')', 'order' => "page_last_edited DESC"));
return $this->DB->execute();
}