本文整理汇总了PHP中object::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP object::fetch方法的具体用法?PHP object::fetch怎么用?PHP object::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_help
/**
* Adds inline help
*
* @param array $params the function params
* @param object $smarty reference to the smarty object
*
* @return string the help html to be inserted
* @access public
*/
function smarty_function_help($params, &$smarty)
{
if (!isset($params['id']) || !isset($smarty->_tpl_vars['config'])) {
return;
}
if (empty($params['file']) && isset($smarty->_tpl_vars['tplFile'])) {
$params['file'] = $smarty->_tpl_vars['tplFile'];
} elseif (empty($params['file'])) {
return NULL;
}
$params['file'] = str_replace(array('.tpl', '.hlp'), '', $params['file']);
if (empty($params['title'])) {
// Avod overwriting existing vars CRM-11900
$oldID = $smarty->get_template_vars('id');
$smarty->assign('id', $params['id'] . '-title');
$name = trim($smarty->fetch($params['file'] . '.hlp'));
$additionalTPLFile = $params['file'] . '.extra.hlp';
if ($smarty->template_exists($additionalTPLFile)) {
$name .= trim($smarty->fetch($additionalTPLFile));
}
$smarty->assign('id', $oldID);
} else {
$name = trim(strip_tags($params['title']));
}
// Escape for html
$title = htmlspecialchars(ts('%1 Help', array(1 => $name)));
// Escape for html and js
$name = htmlspecialchars(json_encode($name), ENT_QUOTES);
// Format params to survive being passed through json & the url
unset($params['text'], $params['title']);
foreach ($params as &$param) {
$param = is_bool($param) || is_numeric($param) ? (int) $param : (string) $param;
}
return '<a class="helpicon" title="' . $title . '" href="#" onclick=\'CRM.help(' . $name . ', ' . json_encode($params) . '); return false;\'> </a>';
}
示例2: fetch
/**
* Fetch and mix all the posts
* @return array The mixed and sorted posts
*/
public function fetch()
{
$this->facebook->fetch();
$this->twitter->fetch();
$this->posts->fetch();
return $this->merge()->sort()->merged;
}
示例3: fetch
/**
* Fetch the result of the executed statement
* @static
* @param string $sql A string of the sql query
* @param array $params An array of the parameter
* @param int $method Fetch Method
* @return array Returns an array of one from the database
* @since version 2.0
*/
public static function fetch($sql, $params = array(), $method = PDO::FETCH_ASSOC)
{
try {
return self::execute($sql, $params) ? self::$stmt->fetch($method) : FALSE;
} catch (PDOException $e) {
return self::pdoException($e);
}
}
示例4: fetch
public function fetch($mode = \PDO::FETCH_ASSOC, $argument = null)
{
if ($argument) {
$this->statement->setFetchMode($mode, $argument);
return $this->statement->fetch();
} else {
return $this->statement->fetch($mode);
}
}
示例5: article
/**
* renders a single article's page
* @param integer $id | the article's id
*/
public function article($id)
{
if (isset($id)) {
// fetch it
$this->article->fetch($id);
// call the view method passing in the template along with the parametres
$this->view('home/article', ['title' => $this->article->title, 'body' => $this->article->body, 'created' => $this->article->created]);
} else {
header('Location: /home/index');
}
}
示例6: __set
/**
* Setter
* @access public
* @return array Mounts
*/
public function __set($name, $value)
{
if ($name == "SmartyBody") {
if (is_array($value)) {
$this->Smarty->assign($value[1]);
$template_name = $value[0];
} else {
$template_name = $value[0];
}
$body = $this->Smarty->fetch($template_name);
preg_match_all("/\\[([A-Za-z0-9]+)([^\\]]*)\\]((.*)\\[\\/\\1\\])?/si", $body, $matches);
foreach ($matches[0] as $index => $variable) {
switch ($matches[1][$index]) {
case "subject":
$this->Subject = $matches[4][$index];
break;
case "settings":
$str = str_replace(' ', '&', trim($matches[2][$index]));
parse_str($str, $settings);
if ($settings['priority']) {
$this->Priority = $settings['priority'];
}
if ($settings['charset']) {
$this->CharSet = $settings['charset'];
}
break;
}
$body = str_replace($matches[0][$index], "", $body);
}
$this->Body = trim($body);
if ($settings['type'] == 'html') {
$this->AltBody = strip_tags(trim($body));
}
}
}
示例7: end
/**
* 缓存终止
*
* 停止缓存记录,并且保存缓存
* 如果 $options[flash] = true,则马上输出缓存
* $options[time] = 缓存时间
*
* @param array $options
* @return void
* @access public
*/
public function end($options = array())
{
if ($this->_cacheID == null) {
return false;
}
$params = array('flash' => true, 'time' => null);
foreach ($options as $key => $value) {
$params[$key] = $value;
}
$data = ob_get_contents();
ob_end_clean();
if (is_null($params['time'])) {
$this->_cache->store($this->_cacheID, $data);
} else {
$this->_cache->store($this->_cacheID, $data, array('expireTime' => $params['time']));
}
if (!is_null($this->_tableID)) {
$tableCache = $this->_cache->fetch($this->_tableID);
if (!$tableCache) {
$tableCache = array();
}
$tableCache[$this->_cacheID] = mb_strlen($data, 'UTF-8');
$this->_cache->store($this->_tableID, $tableCache);
$this->_tableID = null;
$this->_cacheID = null;
}
if ($params['flash']) {
echo $data;
}
}
示例8: getRow
/**
* 获得一条查询数据
* @param string $sql 要执行的SQL指令
* @return 一条查询数据,失败返回 FALSE。
* @access public
*/
public function getRow($sql)
{
$this->query($sql);
$result = $this->PDOStatement->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT);
$this->PDOStatement = null;
return $result;
}
示例9: count
/**
* Get Total Number Of Records in Requested Table
*
* @param string $sTable
* @return number
*/
public function count($sTable = '')
{
// if table name not pass
if (!empty($sTable)) {
// create count query
$this->sSql = "SELECT COUNT(*) AS NUMROWS FROM {$sTable};";
// pdo prepare statement
$this->_oSTH = $this->prepare($this->sSql);
try {
if ($this->_oSTH->execute()) {
// fetch array result
$this->aResults = $this->_oSTH->fetch();
// close pdo
$this->_oSTH->closeCursor();
// return number of count
return $this->aResults['NUMROWS'];
} else {
self::error($this->_oSTH->errorInfo());
}
} catch (PDOException $e) {
// get pdo error and pass on error method
self::error($e->getMessage() . ': ' . __LINE__);
}
} else {
self::error('Table name not found..');
}
}
示例10: _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];
}
}
}
示例11: getRepositoriesInfos
/**
* Retourne les informations concernant les dépôts de thèmes.
*
* @param array $aRepositories
* @return array
*/
public function getRepositoriesInfos($aRepositories = array())
{
if (!$this->cache->contains($this->cache_repo_id)) {
$this->saveRepositoriesInfosCache($aRepositories);
}
return $this->cache->fetch($this->cache_repo_id);
}
示例12: get
/**
* Gets the response from an API call
*
* @param string $endpoint API endpoint
* @param array $data Query string data
* @return object
*/
public function get($endpoint, $data = array())
{
$url = $this->buildUrl($endpoint, $data);
if ($cached = $this->cache->fetch($url)) {
return $cached;
}
$response = $this->http->get($url);
$responseCode = $response->getStatusCode();
if ($responseCode == 200) {
$body = $response->getBody();
$this->cache->store($body, $url, $this->timeToLive);
return $body;
} else {
return $this->returnError($responseCode);
}
}
示例13:
/**
* 头部
* @param array 参数
* @param object $smarty smarty实例
* @return string 返回HTML内容
*/
function function_header($params, &$smarty)
{
if ($smarty->app->app_id != 'content') {
return '';
}
$smarty->pagedata['TITLE'] =& $smarty->pagedata['title'];
$smarty->pagedata['KEYWORDS'] =& $smarty->pagedata['keywords'];
$smarty->pagedata['DESCRIPTION'] =& $smarty->pagedata['description'];
$smarty->pagedata['ec_res_url'] = $smarty->app->res_url;
$ext_filename = $smarty->_request->get_app_name() . '_' . $smarty->_request->get_ctl_name() . '_' . $smarty->_request->get_act_name() . '.html';
if (file_exists($smarty->app->app_dir . '/view/site/common/ext/' . $ext_filename)) {
$smarty->pagedata['extends_header'] = $smarty->fetch('site/common/ext/' . $ext_filename, $smarty->app->app_id);
}
//$
return $smarty->fetch('site/common/header.html', app::get('content')->app_id);
}
示例14: fetch
/**
* 调用view的fetch接口
* 将$this->vars输出到模板,并返回最后生成的字符串
*
* @stability: 4
* @param string $name
* @return string
*/
protected function fetch($templateFile = '', $content = '', $prefix = '')
{
if ($this->vars) {
$this->view->assign($this->vars);
}
return $this->view->fetch($templateFile, $content, $prefix);
}
示例15: 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;
}