本文整理汇总了PHP中self::get方法的典型用法代码示例。如果您正苦于以下问题:PHP self::get方法的具体用法?PHP self::get怎么用?PHP self::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getById
/**
* Get user by id
*
* @param integer $userId User id
*
* @return User
*/
public static function getById($userId = null)
{
if ($userId) {
$user = new self();
if ($user->get()->where('id', '=', $userId)->count() > 0) {
return $user->get()->where('id', '=', $userId)->current();
}
}
return null;
}
示例2: active
static function active()
{
$Model = new self();
$Model->active = true;
$Model->related('image');
return $Model->get();
}
示例3: check
/**
* Check that the current user has the requested capability.
*
* @param array $all_capabilities The full list of capabilities granted (to add to).
* @param array $caps The capabilities being checked.
* @param array $args Values being passed in by `current_user_can()`.
*
* @return array
*/
public static function check($all_capabilities, $caps, $args)
{
// See if it's one of our capabilities being checked.
$cap_full_name = array_shift($caps);
if (stripos($cap_full_name, TABULATE_SLUG) === false) {
return $all_capabilities;
}
// Strip the leading 'tabulate_' from the capability name.
$cap = substr($cap_full_name, strlen(TABULATE_SLUG) + 1);
// Set up basic data.
$table_name = $args[2] ? $args[2] : false;
$grants = new self();
// Users with 'promote_users' capability can do everything.
if (isset($all_capabilities['promote_users'])) {
$all_capabilities[$cap_full_name] = true;
}
// Table has no grants, or doesn't have this one.
$table_grants = $grants->get($table_name);
if (!$table_grants || !isset($table_grants[$cap])) {
return $all_capabilities;
}
// Table has grants of this capability; check whether the user has one
// of the roles with this capability.
$user = wp_get_current_user();
$intersect = array_intersect($table_grants[$cap], $user->roles);
if (count($intersect) > 0) {
$all_capabilities[$cap_full_name] = true;
}
return $all_capabilities;
}
示例4: get
public function get()
{
$parsedMessage = array();
$message = $this->splitMessage($this->message);
$message["header"] = $this->parseHeader($message["header"]);
$message["contentType"] = $this->parseContentType($message["header"]["content-type"], $message["header"]["content-transfer-encoding"], $message["header"]["content-disposition"], $message["header"]["content-description"]);
$message["charset"] = $this->getCharset($message["header"]["content-type"]);
$partId = md5(uniqid("", true));
$parsedMessage[$partId] = array("parentPartId" => $this->parentPartId, "header" => $message["header"], "contentType" => $message["contentType"], "charset" => $message["charset"]);
if ($this->isCompositeMessage($message["contentType"])) {
$parsedMessage[$partId]["body"] = false;
if ($this->isMultipartMessage($message["contentType"]["type"])) {
$message["bodyParts"] = $this->splitBodyParts($message["body"], $message["contentType"]["boundary"]);
} else {
$message["bodyParts"][] = $message["body"];
}
foreach ($message["bodyParts"] as $bodyPart) {
$childParts = new self($bodyPart, $partId);
$parsedMessage = array_merge($parsedMessage, $childParts->get());
}
} else {
$parsedMessage[$partId]["body"] = $this->decodeBody($message["body"], $message["contentType"]);
}
return $parsedMessage;
}
示例5: fast
/**
* @param $key
* @param null $default
* @return mixed
* @throws \Exception
*/
public static function fast($key, $default = null)
{
$keyPath = explode('.', $key, 2);
if (count($keyPath) != 2) {
throw new \Exception('incorrect setting $key');
}
$config = new self($keyPath[0]);
return $config->get($keyPath[1], $default);
}
示例6: deleteAll
static function deleteAll($parentId)
{
$l10n = new self($parentId);
$materialPath = Registry::getInstance()->get('material_path');
foreach (array_keys($l10n->getLocales()) as $localeId) {
@unlink($materialPath . $l10n->get('fileName', $localeId));
}
parent::deleteAll($parentId);
}
示例7: allToOptionsArray
/**
* All options to array
*
* @return array
*/
public static function allToOptionsArray()
{
$object = new self();
$conditions = $object->get();
$optionsArray = array();
foreach ($conditions as $condition) {
$optionsArray[$condition->option] = $condition->value;
}
return $optionsArray;
}
示例8: getList
public static function getList()
{
$list = new self();
$list->sortBy('formName');
$formTypes = $list->get(0);
$result = [];
foreach ($formTypes as $formType) {
$result[$formType->getID()] = $formType->getFormName();
}
return $result;
}
示例9: getById
/**
* Get user by id
*
* @param integer $userId User id
*
* @return User
*/
public static function getById($userId = null)
{
if ($userId) {
$user = new self();
$criteria = $user->createCriteria('id', '=', $userId);
$result = $user->get(array($criteria));
if (!empty($result)) {
return $result[0];
}
}
return null;
}
示例10: getById
public static function getById($id)
{
$key = 'f' . $id;
if ($c = Cache::get($key)) {
return $c;
}
$ret = new self();
$ret->id = $id;
$ret->path = self::path($id);
$ret->get();
Cache::set($key, $ret);
return $ret;
}
示例11: groupBy
/**
* {@inheritDoc}
*/
public function groupBy(callable $groupKeyFunction)
{
$groupedMap = new self();
foreach ($this->keyIdentityPositionMap as $identityHash => $position) {
$keyCopy = $key = $this->keys[$position];
$valueCopy = $value =& $this->values[$position];
$groupKey = $groupKeyFunction($valueCopy, $keyCopy);
if ($groupedMap->contains($groupKey)) {
$groupMap = $groupedMap->get($groupKey);
} else {
$groupMap = new self();
$groupedMap->set($groupKey, $groupMap);
}
$groupMap->setInternal($key, $value, $identityHash, true);
}
return $groupedMap;
}
示例12: getInstanceById
public static function getInstanceById($recordId, $qualifiedModuleName)
{
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT * FROM ' . self::tableName . ' WHERE id = ?', array($recordId));
if ($db->num_rows($result)) {
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
$rowData = $db->query_result_rowdata($result, 0);
$recordModel = new self();
$recordModel->setData($rowData);
$parameters = Zend_Json::decode(decode_html($recordModel->get('parameters')));
foreach ($parameters as $fieldName => $fieldValue) {
$recordModel->set($fieldName, $fieldValue);
}
return $recordModel;
}
return false;
}
示例13: retrieve
public static function retrieve($endpoint, $params = null, $method = 'get')
{
$fs = new self();
$method = strtolower($method);
switch ($method) {
case 'get':
return $fs->get($endpoint, $params);
break;
case 'post':
return $fs->post($endpoint, $params);
break;
case 'delete':
return $fs->delete($endpoint, $params);
break;
default:
throw new ddFoursquareBadRequestException('The given method is invalid.');
}
}
示例14: get_value
private function get_value($v)
{
if ($v instanceof self) {
$v = $v->get();
} else {
if (is_bool($v)) {
$v = $v ? 'true' : 'false';
} else {
if ($v === '') {
$v = null;
} else {
if (is_array($v) || is_object($v)) {
$r = '';
foreach ($v as $k => $c) {
if (is_numeric($k) && is_object($c)) {
$e = explode('\\', get_class($c));
$k = array_pop($e);
}
if (is_numeric($k)) {
$k = 'data';
}
$x = new self($k, $c);
$x->escape($this->esc);
$r .= $x->get();
}
$v = $r;
} else {
if ($this->esc && strpos($v, '<![CDATA[') === false && preg_match("/&|<|>|\\&[^#\\da-zA-Z]/", $v)) {
$v = '<![CDATA[' . $v . ']]>';
}
}
}
}
}
return $v;
}
示例15: getInstanceById
/**
* Function to get record instance by using id and moduleName
* @param <Integer> $recordId
* @param <String> $qualifiedModuleName
* @return <Rss_Record_Model> RecordModel
*/
public static function getInstanceById($recordId, $qualifiedModuleName)
{
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT * FROM vtiger_rss WHERE rssid = ?', array($recordId));
if ($db->num_rows($result)) {
$rowData = $db->query_result_rowdata($result, 0);
$recordModel = new self();
$recordModel->setData($rowData);
$recordModel->setModule($qualifiedModuleName);
$rss = fetch_rss($recordModel->get('rssurl'));
$rss->items = $recordModel->setSenderInfo($rss->items);
$recordModel->setRssValues($rss);
$recordModel->setRssObject($rss);
return $recordModel;
}
return false;
}