本文整理汇总了PHP中stdClass::get方法的典型用法代码示例。如果您正苦于以下问题:PHP stdClass::get方法的具体用法?PHP stdClass::get怎么用?PHP stdClass::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stdClass
的用法示例。
在下文中一共展示了stdClass::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
if ($this->data === null) {
$userId = $this->state->get('user.id');
// Initialise the table with JUser.
$this->data = new JUser($userId);
// Set the base user data.
$this->data->email1 = $this->data->get('email');
$this->data->email2 = $this->data->get('email');
// Override the base user data with any data in the session.
$temp = (array) JFactory::getApplication()->getUserState('com_users.registration.data', array());
foreach ($temp as $k => $v) {
$this->data->{$k} = $v;
}
// Unset the passwords.
unset($this->data->password1);
unset($this->data->password2);
$registry = new JRegistry($this->data->params);
$this->data->params = $registry->toArray();
// Get the dispatcher and load the users plugins.
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = JFactory::getApplication()->triggerEvent('onContentPrepareData', array('com_userxtd.profile', $this->data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true)) {
//$this->setError($dispatcher->getError());
$this->data = false;
}
}
return $this->data;
}
示例2: retrieve
/**
* Retrieve a value from the request (GET/POST/REQUEST)
*
* @param string $name name of the variable to be retrieved
* @param string $type type of the variable (see CRM_Utils_Type for details)
* @param stdClass $store session scope where variable is stored
* @param bool $abort is this variable required
* @param mixed $default default value of the variable if not present
* @param string $method where should we look for the variable
*
* @return mixed the value of the variable
* @access public
* @static
*/
static function retrieve($name, $type, &$store = NULL, $abort = FALSE, $default = NULL, $method = 'REQUEST')
{
// hack to detect stuff not yet converted to new style
if (!is_string($type)) {
CRM_Core_Error::backtrace();
CRM_Core_Error::fatal(ts("Please convert retrieve call to use new function signature"));
}
$value = NULL;
switch ($method) {
case 'GET':
$value = CRM_Utils_Array::value($name, $_GET);
break;
case 'POST':
$value = CRM_Utils_Array::value($name, $_POST);
break;
default:
$value = CRM_Utils_Array::value($name, $_REQUEST);
break;
}
if (isset($value) && CRM_Utils_Type::validate($value, $type, $abort, $name) === NULL) {
$value = NULL;
}
if (!isset($value) && $store) {
$value = $store->get($name);
}
if (!isset($value) && $abort) {
CRM_Core_Error::fatal(ts("Could not find valid value for %1", array(1 => $name)));
}
if (!isset($value) && $default) {
$value = $default;
}
// minor hack for action
if ($name == 'action' && is_string($value)) {
$value = CRM_Core_Action::resolve($value);
}
if (isset($value) && $store) {
$store->set($name, $value);
}
return $value;
}
示例3: exist
/**
* Check if there is a valid cache entry for the key required
* @param string $key the key of the data that you want to be checked
* @return bool true if the key exists, false otherwise
*/
public function exist($key)
{
return $this->_cache->get($this->combineKey($key)) !== false;
}
示例4: fieldForeign
/**
* @param string $attrName
* @param Entity $entity
* @param string $defaultValue
* @return ElementAbstract
* */
public function fieldForeign($attrName, Entity $entity, $defaultValue = NULL)
{
$info = $this->_FKConfig->get($attrName);
return new Select($attrName, $this->_executor->execute(QueryAbstract::factory($this->_executor->getConfig()->get('driver'), $entity)), $info->value, $info->label, $defaultValue);
}
示例5: generate
/**
* Generate a language file.
*
* @param FileInfo $checker FileInfo object.
* @param \stdClass $options Options.
*
* @return string
*/
public function generate(FileInfo $checker, $options)
{
$dateTimeZone = new \DateTimeZone(date_default_timezone_get());
$dateTime = new \DateTime('now', $dateTimeZone);
$timeOffset = $dateTimeZone->getOffset($dateTime) / 3600;
$contents = array();
$strings = $checker->strings;
$stringsPlural = $checker->stringsPlural;
$contents[] = '' . "\n# SOME DESCRIPTIVE TITLE.\n# Copyright (C) YEAR Free Software Foundation, Inc.\n# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n#\n#, fuzzy\nmsgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: PACKAGE VERSION\\n\"\n\"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\\n\"\n\"POT-Creation-Date: " . date('Y-m-d H:i ') . $timeOffset . "00\\n\"\n\"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\\n\"\n\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n\"Content-Type: text/plain; charset=CHARSET\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"X-Generator: G11n\\n\"\n\"MIME-Version: 1.0\\n\"\n\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n";
foreach ($strings as $key => $string) {
if ($string->info) {
$contents[] = trim($string->info);
}
if ($options->get('includeLineNumbers')) {
foreach ($string->files as $f => $locs) {
foreach ($locs as $loc) {
$contents[] = "#: {$f}:{$loc}";
}
}
}
$key = html_entity_decode($key);
$key = addcslashes($key, '"');
while (strpos($key, "\\\\") != false) {
$key = str_replace('\\\\', '\\', $key);
}
while (strpos($key, "\\'") != false) {
$key = str_replace("\\'", "'", $key);
}
$contents[] = 'msgid "' . htmlentities($key) . '"';
$contents[] = 'msgstr ""';
$contents[] = '';
}
foreach ($stringsPlural as $key => $string) {
if ($options->get('includeLineNumbers')) {
foreach ($string->files as $f => $locs) {
foreach ($locs as $loc) {
$contents[] = "#: {$f}:{$loc}";
}
}
}
$key = html_entity_decode($key);
$value = html_entity_decode($string->pluralForms[1]);
$contents[] = 'msgid "' . htmlspecialchars($key) . '"';
$contents[] = 'msgid_plural "' . htmlspecialchars($value) . '"';
$contents[] = 'msgstr[0] ""';
$contents[] = 'msgstr[1] ""';
$contents[] = '';
}
return implode("\n", $contents);
}
示例6: showCategory
/**
* @param int The category id
* @param int The group id of the user
* @param int The access level of the user
* @param int The section id
* @param int The number of items to dislpay
* @param int The offset for pagination
*/
function showCategory($id, $gid, &$access, $sectionid, $limit, $limitstart, $now)
{
global $database, $mainframe, $Itemid, $mosConfig_offset, $mosConfig_list_limit;
$noauth = !$mainframe->getCfg('shownoauth');
$selected = mosGetParam($_POST, 'order', '');
// Paramters
$params = new stdClass();
if ($Itemid) {
$menu = new mosMenu($database);
$menu->load($Itemid);
$params =& new mosParameters($menu->params);
} else {
$menu = "";
$params =& new mosParameters('');
}
if ($selected) {
$orderby = $selected;
} else {
$orderby = $params->get('orderby', 'rdate');
$selected = $orderby;
}
$params->def('page_title', 1);
$params->def('title', 1);
$params->def('hits', $mainframe->getCfg('hits'));
$params->def('author', !$mainframe->getCfg('hideAuthor'));
$params->def('date', !$mainframe->getCfg('hideCreateDate'));
$params->def('date_format', _DATE_FORMAT_LC);
$params->def('navigation', 2);
$params->def('display', 1);
$params->def('display_num', $mosConfig_list_limit);
$params->def('other_cat', 1);
$params->def('empty_cat', 0);
$params->def('cat_items', 1);
$params->def('cat_description', 1);
$params->def('back_button', $mainframe->getCfg('back_button'));
$params->def('pageclass_sfx', '');
$params->def('headings', 1);
$params->def('order_select', 1);
$params->def('filter', 1);
$params->def('filter_type', 'title');
// Ordering control
$orderby = _orderby_sec($orderby);
$category = new mosCategory($database);
$category->load($id);
if ($sectionid == 0) {
$sectionid = $category->section;
}
if ($access->canEdit) {
$xwhere = '';
$xwhere2 = "AND b.state >= '0'";
} else {
$xwhere = "\n AND c.published='1'";
$xwhere2 = "\n AND b.state='1'" . "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '" . $now . "' )" . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '" . $now . "' )";
}
// check if this is a category menu item
if ($Itemid) {
$menu = new mosMenu($database);
$menu->load($Itemid);
if ($menu->type == 'content_category') {
$xwhere = "\n\tAND a.id = '" . $id . "'";
}
} else {
$menu = "";
}
// show/hide empty categories
if ($params->get('empty_cat')) {
$empty = '';
} else {
$empty = "\n HAVING COUNT( b.id ) > 0";
}
// get the list of other categories
$query = "SELECT c.*, COUNT( b.id ) AS numitems" . "\n FROM #__categories AS c" . "\n LEFT JOIN #__content AS b ON b.catid = c.id " . $xwhere2 . "\n WHERE c.section = '" . $category->section . "'" . ($noauth ? "\n AND c.access <= '" . $gid . "'" : '') . "\n GROUP BY c.id" . $empty . "\n ORDER BY c.ordering";
$database->setQuery($query);
$other_categories = $database->loadObjectList();
// get the total number of published items in the category
if ($access->canEdit) {
$xwhere = "AND a.state >= '0'";
} else {
$xwhere = "\n AND a.state='1'" . "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '{$now}' )" . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '{$now}' )";
}
$query = "SELECT a.id" . "\n FROM #__content AS a" . "\n WHERE a.sectionid = '" . $category->section . "'" . "\n AND a.catid = '" . $category->id . "'" . $xwhere;
$database->setQuery($query);
$counter = $database->loadObjectList();
$total = count($counter);
$limit = $limit ? $limit : $params->get('display_num');
if ($total <= $limit) {
$limitstart = 0;
}
require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php';
$pageNav = new mosPageNav($total, $limitstart, $limit);
// filter functionality
$filter = trim(mosGetParam($_POST, 'filter', ''));
//.........这里部分代码省略.........
示例7: die
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once "priceguard.html.php";
require_once "tools.php";
require_once "Services/AmazonECS4.php";
//$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
//$catid = intval( mosGetParam( $_REQUEST, 'catid', 0 ) );
// get parameters
$params = new stdClass();
if ($Itemid) {
$menu = new mosMenu($database);
$menu->load($Itemid);
$params =& new mosParameters($menu->params);
} else {
die('Something is wrong here...');
}
$task = $params->get('task');
switch ($task) {
case 'add_product':
addProduct();
break;
case 'show_products':
showProducts();
break;
case 'show_products_delete':
showProductsDelete();
break;
case 'create_category':
createCategory();
break;
default:
showProducts();
示例8: testClassMethodMemberPrimaryPrefixIsStaticReturnsTrue
function testClassMethodMemberPrimaryPrefixIsStaticReturnsTrue()
{
return stdClass::get();
}