本文整理汇总了PHP中obj::get方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::get方法的具体用法?PHP obj::get怎么用?PHP obj::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obj
的用法示例。
在下文中一共展示了obj::get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mdjm_quote_post_order
/**
* Order posts.
*
* @since 1.3
* @param obj $query The WP_Query object
* @return void
*/
function mdjm_quote_post_order($query)
{
if (!is_admin() || 'mdjm-quotes' != $query->get('post_type')) {
return;
}
switch ($query->get('orderby')) {
case 'quote_view_date':
$query->set('meta_key', '_mdjm_quote_viewed_date');
$query->set('orderby', 'meta_value');
break;
case 'quote_value':
// TO DO
break;
}
}
示例2: mdjm_venue_post_order
/**
* Order posts.
*
* @since 1.3
* @param obj $query The WP_Query object
* @return void
*/
function mdjm_venue_post_order($query)
{
if (!is_admin() || 'mdjm-venue' != $query->get('post_type')) {
return;
}
switch ($query->get('orderby')) {
case 'town':
$query->set('meta_key', '_venue_town');
$query->set('orderby', 'meta_value');
break;
case 'county':
$query->set('meta_key', '_venue_county');
$query->set('orderby', 'meta_value');
break;
}
}
示例3: isValidCaptcha
/**
* Validate captcha
*
* @return bool
*/
public function isValidCaptcha()
{
if ($this->params->get('captcha_verify') && (!$this->session('saola_captcha') || $this->session('saola_captcha') !== $this->post('saola-captcha'))) {
$this->errors[] = JText::_('SAOLA_ERROR_CAPTCHA_VERIFICATION');
}
return !$this->errors;
}
示例4: getdata
/**
* Retorna todos os dados de um registro pelo id
* @param string $id id do registro
* @return array
*/
private static function getdata($id)
{
return self::$psy->get(function ($data) use($id) {
if ($data['id'] == $id) {
return $data;
}
});
}
示例5: addToQueue
private function addToQueue()
{
// CREATE TXT MAIL MIME
if ($this->messageTxt && $this->sendTxt) {
$mimeparams = array();
//$mimeparams['eol'] = "\n\n\t";
$mimeparams['head_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['text_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['html_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['head_charset'] = "UTF-8";
// "iso-8859-1";
$mimeparams['text_charset'] = "UTF-8";
// "iso-8859-1";
$mimeparams['html_charset'] = "UTF-8";
// "iso-8859-1";
$this->Mail_mime = new Mail_mime($mimeparams);
$this->Mail_mime->setTXTBody($this->messageTxt);
// PUT IN QUEUE HTML MAIL
if (!$this->debug) {
$this->newMailQueueId[] = $this->Mail_Queue->put($this->from, $this->recipient, $this->Mail_mime->headers($this->headers, true), $this->Mail_mime->get(), $this->mail_options['seconds_to_send'], $this->mail_options['delete_after_send'], $this->emailId);
if ($this->debug) {
$this->ErrorManager->addError('ID OF TXT MAIL PUT IN QUEUE', $this->newMailQueueId);
}
}
}
// CREATE HTML MAIL MIME
if ($this->messageHtml && $this->sendHtml) {
$mimeparams = array();
//$mimeparams['eol'] = "\n\n\t";
$mimeparams['head_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['text_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['html_encoding'] = "quoted-printable";
// "8bit";
$mimeparams['head_charset'] = "UTF-8";
// "iso-8859-1";
$mimeparams['text_charset'] = "UTF-8";
// "iso-8859-1";
$mimeparams['html_charset'] = "UTF-8";
// "iso-8859-1";
$this->Mail_mime = new Mail_mime($mimeparams);
$this->Mail_mime->setHTMLBody($this->messageHtml);
// PUT IN QUEUE HTML MAIL
if (!$this->debug) {
$this->newMailQueueId[] = $this->Mail_Queue->put($this->from, $this->recipient, $this->Mail_mime->headers($this->headers, true), $this->Mail_mime->getHTMLBody(), $this->mail_options['seconds_to_send'], $this->mail_options['delete_after_send'], $this->emailId);
if ($this->debug) {
$this->ErrorManager->addError('ID OF HTML MAIL PUT IN QUEUE', $this->newMailQueueId);
}
}
}
if ($this->debug) {
$this->ErrorManager->addError('MAIL MIME', $this->Mail_mime);
}
}
示例6: return_data
public function return_data()
{
global $add_res;
if (!empty($this->message)) {
$add_res = array('text' => $this->message, 'error' => !$this->success);
$cookie = obj::get('dynamic__cookie');
$cookie->inner_set('add_res.text', $this->message);
$cookie->inner_set('add_res.error', !$this->success);
}
}
示例7: mdjm_transaction_post_order
/**
* Order posts.
*
* @since 1.3
* @param obj $query The WP_Query object
* @return void
*/
function mdjm_transaction_post_order($query)
{
if (!is_admin() || 'mdjm-transaction' != $query->get('post_type')) {
return;
}
switch ($query->get('orderby')) {
case 'txn_date':
default:
$query->set('orderby', 'post_date');
break;
case 'txn_status':
$query->set('orderby', '_mdjm_txn_status');
break;
case 'event':
$query->set('orderby', 'post_parent');
break;
case 'txn_value':
$query->set('meta_key', '_mdjm_txn_total');
$query->set('orderby', 'meta_value_num');
break;
}
}
示例8: get_dirs
/**
* 获得一级子目录
* @param int $dir_id
* @return array
* @author weizhifeng
**/
protected function get_dirs($dir_id)
{
$folder = $this->kc_folder->get($dir_id);
$sub_folders = array();
if (isset($folder['sub_folder_ids']) && $folder['sub_folder_ids'] != NULL) {
$sub_folder_ids = explode(',', $folder['sub_folder_ids']);
foreach ($sub_folder_ids as $_sub_folder_id) {
$sub_folder = $this->kc_folder->get($_sub_folder_id);
$sub_folders[] = array('id' => $sub_folder['id'], 'name' => $sub_folder['name'], 'readable' => $sub_folder['readable'], 'writable' => $sub_folder['writable'], 'removable' => $sub_folder['removable'], 'has_dirs' => $sub_folder['sub_folder_ids'] != NULL ? TRUE : FALSE);
}
}
return $sub_folders;
}
示例9: searchtip
function searchtip () {
$search = obj::get('search');
$data = urldecode(query::$get['data']);
$query = $search->prepare_string($data, true);
if (empty($query)) {
return;
}
$area = $this->parse_area(query::$get['area']);
$order = implode('+', $area);
$where = 'and ('.implode('>0 or ',$area).'> 0)';
$queries = Database::get_vector('search_queries',
'id, query',
'(Left(query, ?) = ? '.$where.') order by '.$order.' desc limit 10',
array(mb_strlen($query), $query));
$return = array();
foreach ($queries as $one) {
$return[] = array('query' => $one,
'alias' => $one,
'type' => 'search');
}
if (count($area) == 1) {
$single = reset($area);
if (in_array($single, $this->_meta_tips)) {
$meta = array();
$field = $single.'_main';
$params = array(mb_strlen($query), $query,
mb_strlen($query), $query, '|'.$query);
$meta['tag'] = Database::get_vector('tag',
'`id`, `alias`, `name` as query',
'(Left(alias , ?) = ? or Left(name, ?) = ? or
locate(?, tag.variants)) and '.$field.' > 0
order by '.$field.' desc limit 2',
$params
);
$params = array(mb_strlen($query), $query,
mb_strlen($query), $query, '|'.$single.'|');
$meta['category'] = Database::get_vector('category',
'`id`, `alias`, `name` as query',
'(Left(alias , ?) = ? or Left(name, ?) = ?)
and locate(?, category.area) limit 2',
$params
);
$params = array(mb_strlen($query), $query,
mb_strlen($query), $query);
$meta['language'] = Database::get_vector('language',
'`id`, `alias`, `name` as query',
'Left(alias , ?) = ? or Left(name, ?) = ? limit 2',
$params
);
foreach ($meta as $key => $one) {
foreach ((array) $one as $variant) {
$variant['type'] = $key;
$return[] = $variant;
}
}
}
}
shuffle($return);
$return = array_slice($return,0,10);
foreach ($return as &$one) {
switch ($one['type']) {
case 'tag':
$one['query'] = "Тег: ".$one['query'];
break;
case 'category':
$one['query'] = "Категория: ".$one['query'];
break;
case 'language':
$one['query'] = "Язык: ".$one['query'];
break;
default: break;
}
if ($one['type'] != 'search') {
$one['alias'] = '/'.$single.'/'.$one['type'].'/'.$one['alias'].'/';
}
}
return $return;
}
示例10: role_may_view
/**
* Does the current role have permission to even see this region?
* @param obj $User User object
* @param obj $Settings Settings object
* @return bool View or not
*/
public function role_may_view($User, $Settings)
{
if ($this->role_may_edit($User)) {
return true;
}
if ($Settings->get('content_hideNonEditableRegions')->val()) {
return false;
}
return true;
}
示例11: syncGrades
/**
* Query to sync form scores with gradebook
*
* @param obj $course
* @param array $member_id
* @return void
*/
public function syncGrades($course, $member_id = null)
{
if (!is_null($member_id) && !empty($member_id)) {
if (!is_array($member_id)) {
$member_id = (array) $member_id;
}
} else {
// Pull all section members
$members = $course->offering()->section()->members(array('student' => 1));
$member_id = array();
// Get member id's for refresh filter
foreach ($members as $member) {
$member_id[] = $member->get('id');
}
}
if (count($member_id) == 0) {
return;
}
// Get the assets
$asset = new Asset($this->_db);
$assets = $asset->find(array('w' => array('course_id' => $course->get('id'), 'section_id' => $course->offering()->section()->get('id'), 'offering_id' => $course->offering()->get('id'), 'asset_type' => 'form')));
// Query for existing data
$query = "SELECT * FROM `#__courses_grade_book` WHERE `member_id` IN (" . implode(',', $member_id) . ") AND `scope` IN ('asset')";
$this->_db->setQuery($query);
$results = $this->_db->loadObjectList();
$existing_grades = array();
foreach ($results as $r) {
$existing_grades[$r->member_id . '.' . $r->scope_id] = array('id' => $r->id, 'score' => $r->score);
}
$inserts = array();
$updates = array();
$deletes = array();
if (count($assets) > 0) {
foreach ($assets as $asset) {
// Add null values for unpublished forms that may have already been taken
if ($asset->state != 1) {
$deletes[] = $asset->id;
continue;
}
$crumb = false;
// Check for result for given student on form
$crumb = $asset->url;
if (!$crumb || strlen($crumb) != 20 || $asset->state != 1) {
// Break foreach, this is not a valid form!
continue;
}
include_once dirname(__DIR__) . DS . 'models' . DS . 'formDeployment.php';
$dep = \Components\Courses\Models\PdfFormDeployment::fromCrumb($crumb, $course->offering()->section()->get('id'));
$results = $dep->getResults('member_id', $member_id);
switch ($dep->getState()) {
// Form isn't available yet
case 'pending':
// Null value
foreach ($member_id as $u) {
$key = $u . '.' . $asset->id;
if (!array_key_exists($key, $existing_grades)) {
$inserts[] = "('{$u}', NULL, 'asset', '{$asset->id}', NULL)";
} else {
if (!is_null($existing_grades[$key]['score'])) {
$updates[] = "UPDATE `#__courses_grade_book` SET `score` = NULL WHERE `id` = '" . $existing_grades[$key]['id'] . "'";
}
}
}
break;
// Form availability has expired - students either get a 0, or their score (no nulls)
// Form availability has expired - students either get a 0, or their score (no nulls)
case 'expired':
foreach ($member_id as $u) {
$score = isset($results[$u]['score']) ? $results[$u]['score'] : '0.00';
$finished = isset($results[$u]['finished']) ? '\'' . $results[$u]['finished'] . '\'' : 'NULL';
$key = $u . '.' . $asset->id;
if (!array_key_exists($key, $existing_grades)) {
$inserts[] = "('{$u}', '{$score}', 'asset', '{$asset->id}', {$finished})";
} else {
if ($existing_grades[$key]['score'] != $score) {
$updates[] = "UPDATE `#__courses_grade_book` SET `score` = '{$score}', `score_recorded` = {$finished} WHERE `id` = '" . $existing_grades[$key]['id'] . "'";
}
}
}
break;
// Form is still active - students either get their score, or a null
// Form is still active - students either get their score, or a null
case 'active':
foreach ($member_id as $u) {
$resp = $dep->getRespondent($u);
// Form is active and they have completed it!
if ($resp->getEndTime() && $resp->getEndTime() != '') {
$score = isset($results[$u]['score']) ? '\'' . $results[$u]['score'] . '\'' : 'NULL';
$key = $u . '.' . $asset->id;
if (!array_key_exists($key, $existing_grades)) {
$inserts[] = "('{$u}', {$score}, 'asset', '{$asset->id}', '" . $results[$u]['finished'] . "')";
} else {
if ($existing_grades[$key]['score'] != $score) {
//.........这里部分代码省略.........
示例12: mdjm_addon_post_order
/**
* Order addon posts.
*
* @since 1.4
* @param obj $query The WP_Query object
* @return void
*/
function mdjm_addon_post_order($query)
{
if (!is_admin() || 'mdjm-addon' != $query->get('post_type')) {
return;
}
$orderby = $query->get('orderby');
$order = $query->get('order');
switch ($orderby) {
case 'ID':
$query->set('orderby', 'ID');
$query->set('order', $order);
break;
case 'price':
$query->set('meta_key', '_addon_price');
$query->set('orderby', 'meta_value_num');
$query->set('order', $order);
break;
}
}
示例13: mdjm_hide_inactive_events
/**
* Hide inactive events from the 'all' events list.
*
* @since 1.0
* @param obj $query The WP_Query.
* @return void
*/
function mdjm_hide_inactive_events($query)
{
if (!is_admin() || !$query->is_main_query() || 'mdjm-event' != $query->get('post_type')) {
return;
}
$active_statuses = mdjm_active_event_statuses();
if (isset($_GET['post_status']) && in_array($_GET['post_status'], $active_statuses)) {
return;
}
if (!mdjm_get_option('show_active_only', false)) {
return;
}
$active_ids = mdjm_get_events(array('post_status' => $active_statuses, 'fields' => 'ids'));
if ($active_ids) {
$query->set('post__in', $active_ids);
}
}