本文整理汇总了PHP中get_value函数的典型用法代码示例。如果您正苦于以下问题:PHP get_value函数的具体用法?PHP get_value怎么用?PHP get_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_value函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_newsletter_form
public function get_newsletter_form()
{
/* BENCHMARK */
$this->benchmark->mark('func_get_newsletter_form_start');
$this->load->helper('data');
$newsletter_html = '';
// only make a newsletter form if users who are not site admins are signed in
/*if ('super_admin'==$this->user['user_type'] or
'admin_user'==$this->user['user_type'] or
'supplier_user'==$this->user['user_type'])
{
$newsletter_html.='';
}
else
{*/
$attr = array('name' => 'newsletter_form', 'id' => 'newsletter_form', 'class' => 'form');
$hidden = array('url' => uri_string());
// reload url
$newsletter_html .= form_open('newsletter/signup', $attr, $hidden);
// email field
$attr = array('name' => 'newsletter_email', 'id' => 'newsletter_email', 'class' => 'form_field', 'placeholder' => 'enter your email ...', 'value' => get_value(null, 'newsletter_email'));
$newsletter_html .= form_input($attr, '');
$newsletter_html .= form_input(array('name' => 'phone_number', 'class' => 'phone_number', 'style' => 'position:absolute;top:-10000px;'));
// submit button
$attr = array('name' => 'submit', 'id' => 'newsletter_submit', 'class' => 'checkout submit');
$newsletter_html .= form_submit($attr, 'sign up');
$newsletter_html .= form_close();
/*}*/
/* BENCHMARK */
$this->benchmark->mark('func_get_newsletter_form_end');
return $newsletter_html;
}
示例2: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('chat');
require_css('side_blocks');
$room_id = array_key_exists('param', $map) ? intval($map['param']) : NULL;
$num_messages = array_key_exists('max', $map) ? intval($map['max']) : 5;
if (is_null($room_id)) {
$room_id = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'MIN(id)', array('is_im' => 0));
if (is_null($room_id)) {
return new ocp_tempcode();
}
}
$room_check = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $room_id), '', 1);
if (!array_key_exists(0, $room_check)) {
return new ocp_tempcode();
}
require_code('chat');
if (!check_chatroom_access($room_check[0], true)) {
global $DO_NOT_CACHE_THIS;
// We don't cache against access, so we have a problem and can't cache
$DO_NOT_CACHE_THIS = true;
return new ocp_tempcode();
}
$content = NULL;
if (get_value('no_frames') === '1') {
$content = shoutbox_script(true, $room_id, $num_messages);
}
return do_template('BLOCK_SIDE_SHOUTBOX_IFRAME', array('CONTENT' => $content, 'ROOM_ID' => strval($room_id), 'NUM_MESSAGES' => strval($num_messages)));
}
示例3: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('backup')) {
return array();
}
if (get_option('backup_time', true) == '') {
return array();
}
$limit_hours = intval(get_option('backup_time', true));
require_lang('backups');
$date = intval(get_value('last_backup'));
$seconds_ago = mixed();
if ($date != 0) {
$seconds_ago = time() - $date;
$status = intval($seconds_ago) > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'backup_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'admin_backup', 'type' => 'misc'), 'adminzone');
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '432685ec6c9f7548ce8b488b6ce00030', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('BACKUP'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'backup_time'));
}
示例4: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
// The counter we're using
$name = array_key_exists('param', $map) ? $map['param'] : '';
if ($name == '-') {
$name = get_page_name() . ':' . get_param('type', 'misc') . ':' . get_param('id', '');
}
if ($name == '') {
$name = 'hits';
}
$start = array_key_exists('start', $map) ? intval($map['start']) : 0;
// Set it if it's not already
$_current_value = get_value($name);
if (is_null($_current_value)) {
set_value($name, strval($start));
$current_value = $start;
} else {
$current_value = intval($_current_value);
if ($start > $current_value) {
$current_value = $start;
set_value($name, strval($current_value));
}
}
// Hit counter?
$hit_count = array_key_exists('hit_count', $map) ? intval($map['hit_count']) : 1;
if ($hit_count == 1) {
update_stat($name, 1);
}
return do_template('MAIN_COUNT', array('NAME' => $name, 'VALUE' => strval($current_value)));
}
示例5: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (get_value('implicit_usergroup_sync') === '1') {
$last = get_value('last_implicit_sync');
if (is_null($last) || intval($last) < time() - 60 * 60) {
$hooks = find_all_hooks('systems', 'ocf_implicit_usergroups');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/ocf_implicit_usergroups/' . $hook);
$ob = object_factory('Hook_implicit_usergroups_' . $hook);
$group_id = $ob->get_bound_group_id();
$GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_group_id' => $group_id));
$list = $ob->get_member_list();
if (!is_null($list)) {
foreach ($list as $member_row) {
$GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_row['id'], 'gm_validated' => 1));
}
} else {
$start = 0;
do {
$members = collapse_1d_complexity('id', $GLOBALS['FORUM_DB']->query_select('f_members', array('id'), NULL, '', 400, $start));
foreach ($members as $member_id) {
if ($ob->is_member_within($member_id)) {
$GLOBALS['FORUM_DB']->query_insert('f_group_members', array('gm_group_id' => $group_id, 'gm_member_id' => $member_id, 'gm_validated' => 1));
}
}
$start += 400;
} while (count($members) == 400);
}
}
set_value('last_implicit_sync', strval(time()));
}
}
}
示例6: get_value
function get_value($indexes, $arrayToAccess)
{
if (count($indexes) > 1) {
return get_value(array_slice($indexes, 1), $arrayToAccess[$indexes[0]]);
}
return $arrayToAccess[$indexes[0]];
}
示例7: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (get_forum_type() != 'ocf') {
return;
}
$time = time();
$last_time = intval(get_value('last_confirm_reminder_time'));
if ($last_time > time() - 24 * 60 * 60 * 2) {
return;
}
set_value('last_confirm_reminder_time', strval($time));
require_code('mail');
require_lang('ocf');
$GLOBALS['NO_DB_SCOPE_CHECK'] = true;
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members WHERE ' . db_string_not_equal_to('m_validated_email_confirm_code', '') . ' AND m_join_time>' . strval($last_time));
$GLOBALS['NO_DB_SCOPE_CHECK'] = false;
foreach ($rows as $row) {
$coppa = get_option('is_on_coppa') == '1' && utctime_to_usertime(time() - mktime(0, 0, 0, $row['m_dob_month'], $row['m_dob_day'], $row['m_dob_year'])) / 31536000.0 < 13.0;
if (!$coppa) {
$zone = get_module_zone('join');
if ($zone != '') {
$zone .= '/';
}
$url = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4&email=' . rawurlencode($row['m_email_address']) . '&code=' . $row['m_validated_email_confirm_code'];
$url_simple = get_base_url() . '/' . $zone . 'index.php?page=join&type=step4';
$message = do_lang('OCF_SIGNUP_TEXT', comcode_escape(get_site_name()), comcode_escape($url), array($url_simple, $row['m_email_address'], strval($row['m_validated_email_confirm_code'])), $row['m_language']);
mail_wrap(do_lang('CONFIRM_EMAIL_SUBJECT', get_site_name(), NULL, NULL, $row['m_language']), $message, array($row['m_email_address']), $row['m_username']);
}
}
}
示例8: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('newsletter')) {
return array();
}
if (get_option('news_update_time', true) == '') {
return array();
}
$limit_hours = intval(get_option('news_update_time', true));
$limit_hours = intval($limit_hours / 3);
// 3 news pieces (+ other stuff) per newsletter seems reasonable
require_lang('newsletter');
$date = get_value('newsletter_send_time');
$seconds_ago = mixed();
if (!is_null($date)) {
$seconds_ago = time() - intval($date);
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'news_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'admin_newsletter', 'type' => 'whatsnew'), 'adminzone');
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => 'fb9483bb05ad90b9f2b7eba0c53996f4', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('NEWSLETTER_SEND'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'news_update_time'));
}
示例9: header_social_links
function header_social_links()
{
$social_links = tijara_option('social_links');
if (!is_array($social_links)) {
return;
}
/**
* Social sites to font icon reference
*
* Example:
* $social_domains['google'] = ''
*
* Note:
* If no corresponding value is found for a social site,
* the domain without extention will be used (e.g.: twitter, facebook...)
*/
$social_domains = array('google' => array('google-plus', 'Google+'), 'facebook' => array('facebook', 'Facebook'), 'flickr' => array('flickr', 'Flickr'), 'instagram' => array('instagram', 'Instagram'), 'linkedin' => array('linkedin', 'LinkedIn'), 'pinterest' => array('pinterest', 'Pinterest'), 'skype' => array('skype', 'Skype'), 'twitter' => array('twitter', 'Twitter'), 'vimeo' => array('vimeo', 'Vimeo'), 'vk' => array('vk', 'VKontakte'), 'youtube' => array('youtube', 'YouTube'));
foreach ($social_links as $social_link) {
// Get link domain
$social_domain = str_replace('www.', '', get_value(parse_url($social_link), 'host'));
// Automatic slug
$social_domain_no_ext = array_shift(preg_split('/(?=\\.[^.]+$)/', $social_domain));
// Slug from referece
if (isset($social_domains[$social_domain_no_ext])) {
$social_slug = $social_domains[$social_domain_no_ext][0];
$social_service = $social_domains[$social_domain_no_ext][1];
} else {
$social_slug = 'question-circle';
}
echo "<a title = \"" . sprintf(__('Follow on %s', 'tijara'), $social_service) . "\" href=\"{$social_link}\" ><i class=\"{$social_slug} fa fa-{$social_slug}\"></i></a> ";
}
}
示例10: display_messages
public function display_messages()
{
if (empty($this->messages)) {
return;
}
$last_message_level = null;
foreach ($this->messages as $message) {
$css_class = get_value($message->level, $this->message_css_classes, '');
if ($message->level != $last_message_level) {
if (!empty($last_message_level)) {
echo '</div>';
}
echo '<div class="' . $css_class . '">';
$message_header = $this->get_message_header($message->level);
if (!empty($message_header)) {
echo '<h4 class="wc_aelia message_header">';
echo $message_header;
echo '</h4>';
}
}
$output_msg = empty($message->code) ? '' : $message->code . ' ';
$output_msg .= $message->message;
echo '<p class="wc_aelia message">';
echo $output_msg;
echo '</p>';
$last_message_level = $message->level;
}
echo '</div>';
}
示例11: run
/**
* Standard modular run function for OcCLE notification hooks.
*
* @param ?integer The "current" time on which to base queries (NULL: now)
* @return ~array Array of section, type and message responses (false: nothing)
*/
function run($timestamp = NULL)
{
if (!addon_installed('chat')) {
return false;
}
if (!is_null(get_value('occle_watched_chatroom'))) {
require_lang('chat');
if (is_null($timestamp)) {
$timestamp = time();
}
$room = intval(get_value('occle_watched_chatroom'));
$room_messages = $GLOBALS['SITE_DB']->query('SELECT COUNT(*) AS cnt FROM ' . get_table_prefix() . 'chat_messages WHERE room_id=' . strval($room) . ' AND date_and_time>=' . strval((int) $timestamp));
if (!array_key_exists(0, $room_messages)) {
return false;
}
if ($room_messages[0]['cnt'] > 0) {
$rooms = array();
$messages = $room_messages[0]['cnt'];
$room_data = $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'room_name', array('id' => $room));
if (is_null($room_data)) {
return false;
}
// Selected room deleted
$rooms[$room_data] = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $room), get_module_zone('chat'));
return array(do_lang('SECTION_CHAT'), do_lang('NEW_MESSAGES'), do_template('OCCLE_CHAT_NOTIFICATION', array('MESSAGE_COUNT' => integer_format($messages), 'ROOMS' => $rooms)));
} else {
return false;
}
} else {
return false;
}
}
示例12: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('watch_chatroom', array('h', 'u'), array(true)), '', '');
} else {
require_code('chat');
if (array_key_exists('u', $options) || array_key_exists('unwatch', $options)) {
delete_value('occle_watched_chatroom');
$_chatroom = do_lang('SUCCESS');
} elseif (array_key_exists(0, $parameters)) {
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
set_value('occle_watched_chatroom', $chatroom);
$_chatroom = get_chatroom_name($chatroom);
} else {
$_chatroom = get_chatroom_name(intval(get_value('occle_watched_chatroom')), true);
if (is_null($_chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
}
return array('', '', $_chatroom, '');
}
}
示例13: custom_menu_tree
function custom_menu_tree($menus = array())
{
$html = '';
// Build all application menus in a tree format
foreach ($menus as $menu) {
// Check if this menu has children
$count_menu_children = count(get_value($menu, 'children'));
// Build a single line menu
$html .= '<li id="menu-item-' . get_value($menu, 'id_menu') . '" class="dd-item dd3-item" data-id="' . get_value($menu, 'id_menu') . '" order="' . get_value($menu, 'order_') . '">';
$html .= '<div class="dd-handle dd3-handle"></div>';
$html .= '<div class="dd3-content">';
$class = get_value($menu, 'dtt_inative') != '' ? 'text-error' : '';
$img = image(get_value($menu, 'url_img'));
$label = get_value($menu, 'url_img') == '' && get_value($menu, 'label') == '' ? '[NO NAME]' : lang(get_value($menu, 'label'));
$html .= '<a href="javascript:void(0)" class="menu-label ' . $class . '" data-toggle="modal" data-target="#modal-menu-' . get_value($menu, 'id_menu') . '">' . $img . ' ' . $label . '</a>';
$html .= '<i class="text-success fa fa-fw fa-check-circle" style="display: none; margin-left: 5px"></i>';
$html .= '<a href="javascript:void(0)" class="menu-delete pull-right hidden"><i class="fa fa-trash fa-fw"></i></a>';
$html .= '</div>';
// If current menu has children items, then build all again
if ($count_menu_children > 0) {
$html .= '<ol class="dd-list">' . custom_menu_tree(get_value($menu, 'children')) . '</ol>';
}
$html .= '</li>';
}
return $html;
}
示例14: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('send_chatmessage', array('h'), array(true, true)), '', '');
} else {
if (!array_key_exists(0, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '1', 'send_chatmessage'));
}
if (!array_key_exists(1, $parameters)) {
return array('', '', '', do_lang('MISSING_PARAM', '2', 'send_chatmessage'));
}
require_code('chat');
if (is_numeric($parameters[0])) {
$chatroom = $parameters[0];
} elseif ($parameters[0] == 'first-watched') {
$_chatroom = get_value('occle_watched_chatroom');
$chatroom = is_null($_chatroom) ? $GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'id', NULL, 'ORDER BY id') : intval($_chatroom);
} else {
$chatroom = get_chatroom_id($parameters[0]);
}
if (is_null($chatroom)) {
return array('', '', '', do_lang('MISSING_RESOURCE'));
}
chat_post_message($chatroom, $parameters[1], get_option('chat_default_post_font'), get_option('chat_default_post_colour'));
return array('', '', do_lang('SUCCESS'), '');
}
}
示例15: build_menu
function build_menu($menus = array())
{
// Check if current level is parent
$current_line = isset($menus[0]) ? $menus[0] : array();
$root_level = get_value($current_line, 'id_menu_parent') <= 0 ? true : false;
if (count($menus) > 0) {
foreach ($menus as $menu) {
// DEBUG:
// print_r($menu);
// Counting children menu
$count_menu_children = count(get_value($menu, 'children'));
// Build a link
$link = tag_replace(get_value($menu, 'link'));
$target = get_value($menu, 'target') != '' ? ' target="' . tag_replace(get_value($menu, 'target')) . '" ' : '';
$label = lang(get_value($menu, 'label'));
$img = image(get_value($menu, 'url_img'));
// Build a single line menu
if ($count_menu_children > 0) {
$class = $root_level ? 'dropdown' : 'dropdown dropdown-submenu';
$caret = $root_level ? '<span class="caret"></span>' : '';
?>
<li class="<?php
echo $class;
?>
">
<a href="<?php
echo $link;
?>
" <?php
echo $target;
?>
class="dropdown-toggle" data-toggle="dropdown">
<?php
echo $img . ' ' . $label . $caret;
?>
</a>
<ul class="dropdown-menu"><?php
build_menu(get_value($menu, 'children'));
?>
</ul>
</li>
<?php
} else {
?>
<li><a href="<?php
echo $link;
?>
" <?php
echo $target;
?>
><?php
echo $img . ' ' . $label;
?>
</a></li>
<?php
}
}
}
}