本文整理汇总了PHP中get_item函数的典型用法代码示例。如果您正苦于以下问题:PHP get_item函数的具体用法?PHP get_item怎么用?PHP get_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($seek_search_params, $search_position)
{
$this->search_position = $search_position;
if (is_string($seek_search_params)) {
parse_str($seek_search_params, $query_params);
} else {
$query_params = $seek_search_params;
}
$search = Search::from_params($query_params);
$search->maxrecs = 3;
$prev_item_num = $this->search_position > 1 ? $this->search_position - 1 : null;
$current_result_index = $this->search_position - 1;
$search->start = array(0, max(1, $current_result_index));
$results = $search->results();
if ($this->search_position > 1) {
$this->previous_item = get_item($results[0]['collection'], $results[0]['pointer']);
$this->previous_item['query_string'] .= "&search_position=" . ($this->search_position - 1);
}
if ($this->search_position < $search->total) {
$next_result_index = $this->search_position > 1 ? 2 : 1;
$this->next_item = get_item($results[$next_result_index]['collection'], $results[$next_result_index]['pointer']);
$this->next_item['query_string'] .= "&search_position=" . ($this->search_position + 1);
}
$this->total_items = $search->total;
}
示例2: indexAction
function indexAction()
{
global $site;
$request = $site->mvc->getRequest();
$login = get_item($_SESSION, 'login');
switch ($request->type) {
case 'get':
$site->enqueueStyle('console');
$site->enqueueScript('console');
if ($this->checkLogin($login)) {
$this->view->render('/index-page');
} else {
$this->view->render('/login-page');
}
break;
case 'post':
if ($this->checkLogin($login)) {
$code = $request->post('code');
$code = preg_replace('/^\\s*\\<\\?php/', '', $code);
$code = preg_replace('/\\?\\>\\s*$/', '', $code);
eval($code);
} else {
$password = md5($request->post('password'));
if ($this->checkLogin($password)) {
$_SESSION['login'] = $password;
$site->redirectTo($site->urlTo('/console'));
} else {
$site->redirectTo($site->urlTo('/console?msg=400'));
}
}
break;
}
}
示例3: insert_user
function insert_user($added_name, $password, $gradyear, $email, $type, $status = '')
{
if (!$password) {
srand(time());
$password = rand(0, 999999);
}
if (!$email) {
$email = $added_name . "@grinnell.edu";
}
$crpassword = User::hashPassword($password);
$dbh = db_connect();
$myrow = array("", $added_name, "", $crpassword, $email, "", "", "", "", "", "", $gradyear, "70", "14", "", "", $type, "", "", 0);
add_row($dbh, "accounts", $myrow);
mysql_query("UPDATE accounts SET created = NOW() WHERE\n\t\t\tusername = '{$added_name}'");
$added_id = get_item($dbh, "userid", "accounts", "username", $added_name);
mysql_query("INSERT INTO plans (user_id) VALUES ({$added_id})");
add_row($dbh, "display", array($added_id, "6", "7"));
foreach (array(2, 4, 6, 8, 14, 15, 16) as $opt_link) {
$myrow = array($added_id, $opt_link);
add_row($dbh, "opt_links", $myrow);
}
$myrow = array($added_id, $status);
add_row($dbh, "perms", $myrow);
return array($password, $email);
}
示例4: cleanText
function cleanText($plan, &$planlove = array())
{
$plan = htmlspecialchars($plan);
//take out html
//fix the dollar sign error- by josh
//$plan = preg_replace("(\|(\w\s)*)\$
$plan = preg_replace("/((\\[\\w*\\],?){8})(?=[^ ,])/s", "\$1 ", $plan);
$plan = preg_replace("/\n/s", "<br>", $plan);
$plan = preg_replace("/\\<\\;hr\\>\\;/si", "</p><hr><p class=\"sub\">", $plan);
// replace the first </p> that we just inserted erroneously
//$plan = preg_replace("</p>", "", $plan, 1);
$plan = '<p class="sub">' . $plan . '</p>';
$plan = preg_replace("/\\<\\;b\\>\\;(.*?)\\<\\;\\/b\\>\\;/si", "<b>\\1</b>", $plan);
//allow stuff in the bold tag back in
$plan = preg_replace("/\\<\\;tt\\>\\;(.*?)\\<\\;\\/tt\\>\\;/si", "<tt>\\1</tt>", $plan);
$plan = preg_replace("/\\<\\;pre\\>\\;(.*?)\\<\\;\\/pre\\>\\;/si", "</p><pre class=\"sub\">\\1</pre><p class=\"sub\">", $plan);
$plan = preg_replace("/\\<\\;strike\\>\\;(.*?)\\<\\;\\/strike\\>\\;/si", "<span class=\"strike\">\\1</span><!--strike-->", $plan);
$plan = preg_replace("/\\<\\;s\\>\\;(.*?)\\<\\;\\/s\\>\\;/si", "<s>\\1</s>", $plan);
$plan = preg_replace("/\\<\\;i\\>\\;(.*?)\\<\\;\\/i\\>\\;/si", "<i>\\1</i>", $plan);
//allow stuff in the italics tag back in
$plan = preg_replace("/\\<\\;u\\>\\;(.*?)\\<\\;\\/u\\>\\;/si", "<span class=\"underline\">\\1</span><!--u-->", $plan);
//allow stuff in the underline tag back in
$plan = preg_replace("/\\<\\;a.+?href=."\\;(.+?)."\\;>\\;(.+?)<\\;\\/a>\\;/si", "<a href=\"\\1\" class=\"onplan\">\\2</a>", $plan);
//$plan = preg_replace("/\<\;a.href=."\;(.+)."\;/si", "EEE",$plan);
preg_match_all("/\\[([^\\[\\]]*?)\\]/s", $plan, $mymatches);
//get an array of everything in brackets
foreach ($mymatches[1] as $mycheck) {
//echo '<!-- ' ."/\[$mycheck\]/s" . ' -->' . "\n";
if (!isset($checked[$mycheck])) {
//check for plan with username
$dbh = db_connect();
if ($item = get_item($dbh, "username", "accounts", "username", $mycheck)) {
$planlove[] = $mycheck;
$plan = preg_replace("/\\[" . preg_quote($mycheck, '/') . "\\]/s", "[<a href=\"read.php?searchname={$item}\" class=\"planlove\">{$mycheck}</a>]", $plan);
//change all occurences of person on plan
} else {
if (preg_match('/^\\d+$/', $mycheck) && ($item = get_item($dbh, "messageid", "subboard", "messageid", $mycheck))) {
$plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "[<a href=\"board_messages.php?messagenum={$item}#{$item}\" class=\"boardlink\">{$mycheck}</a>]", $plan);
}
if (preg_match("/^(http|https|mailto):/", $mycheck)) {
if (strrpos($mycheck, "|")) {
preg_match("/(.+?)\\|(.+)/si", $mycheck, $love_replace);
// Here, we need to escape $'s so they don't get treated as back-references
$love_replace[2] = addcslashes($love_replace[2], "\$");
$plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "<a href=\"{$love_replace['1']}\" class=\"onplan\">{$love_replace['2']}</a>", $plan);
} else {
$plan = preg_replace("/\\[" . preg_quote($mycheck, "/") . "\\]/s", "<a href=\"{$mycheck}\" class=\"onplan\">{$mycheck}</a>", $plan);
}
}
}
$checked[$mycheck] = 1;
//mark checked values as checked, so don't have to check again
}
//if (!$checked[$mycheck])
}
//foreach ($mymatches[1] as $mycheck)
$plan = trim($plan);
return $plan;
}
示例5: update_item
function update_item($item_id)
{
set_lock_state(True, $item_id);
$item = get_item($item_id);
$item['fields']['description'] .= test_results();
put_item($item_id, $item);
set_lock_state(False, $item_id);
}
示例6: use_item
/**
* Use the object in the provided position, subtracting the
* @param int $pos Explicit position of the object in the array.
* @param int $amount Amount you want to use.
* @return int Amount actually used.
*/
public function use_item($pos, $amount)
{
if (get_item($pos) !== null) {
return $this->inventory[$pos]->UseItem($amount);
} else {
return -1;
}
}
示例7: checkitem
private function checkitem($userdata, $param, $key)
{
if (get_item($userdata, $param) && !isempty($userdata[$param])) {
return 0;
}
$this->set_message(sprintf(lang('account.param.empty'), $param) . '<br />');
return 1;
}
示例8: print_work_order_listing
function print_work_order_listing()
{
global $path_to_root, $wo_types_array;
$item = $_POST['PARAM_0'];
$location = $_POST['PARAM_1'];
$open_only = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
$orientation = $_POST['PARAM_4'];
$destination = $_POST['PARAM_5'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$orientation = $orientation ? 'L' : 'P';
if ($item == '') {
$items = _('All');
} else {
$row = get_item($item);
$items = $row['description'];
}
if ($location == '') {
$loc = _('All');
} else {
$loc = get_location_name($location);
}
$open = $open_only == 1 ? _('Yes') : _('No');
$cols = array(0, 100, 120, 165, 210, 275, 315, 375, 385, 440, 495, 555);
$headers = array(_('Type'), '#', 'Reference', _('Location'), _('Item'), _('Required'), _('Manufactured'), ' ', _('Date'), _('Required By'), _('Closed'));
$aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'left', 'left');
$params = array(0 => $comments, 1 => array('text' => _('Items'), 'from' => $items, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Open Only'), 'from' => $open, 'to' => ''));
$rep = new FrontReport(_('Work Order Listing'), "WorkOrderListing", user_pagesize(), 9, $orientation);
if ($orientation == 'L') {
recalculate_cols($cols);
}
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewPage();
$res = getTransactions($item, $open_only, $location);
while ($trans = db_fetch($res)) {
$rep->TextCol(0, 1, $wo_types_array[$trans['type']]);
$rep->TextCol(1, 2, $trans['id'], -1);
$rep->TextCol(2, 3, $trans['wo_ref'], -1);
$rep->TextCol(3, 4, $trans['location_name'], -1);
$rep->TextCol(4, 5, $trans['description'], -1);
$dec = get_qty_dec($trans['stock_id']);
$rep->AmountCol(5, 6, $trans['units_reqd'], $dec);
$rep->AmountCol(6, 7, $trans['units_issued'], $dec);
$rep->TextCol(7, 8, '', -1);
$rep->TextCol(8, 9, sql2date($trans['date_']), -1);
$rep->TextCol(9, 10, sql2date($trans['required_by']), -1);
$rep->TextCol(10, 11, $trans['closed'] ? ' ' : _('No'), -1);
$rep->NewLine();
}
$rep->Line($rep->row);
$rep->End();
}
示例9: getData
static function getData($token, $divider = '.')
{
global $site;
$ret = false;
$key = $site->getGlobal('token_salt');
$parts = explode($divider, $token);
$ret = get_item($parts, 0);
return $ret;
}
示例10: index
public function index()
{
$data['email'] = get_item($_POST, 'email');
$data['password'] = get_item($_POST, 'password');
view::load_view('default/standard/header');
view::load_view('default/standard/menu');
view::load_view('default/login/form', $data);
view::load_view('default/standard/footer');
}
示例11: password
public function password()
{
$encrypt = new encryption();
$data['email'] = get_item($_POST, 'email');
$data['title'] = lang('title.password');
view::load_view('default/standard/header', $data);
view::load_view('default/standard/menu');
view::load_view('default/login/password', $data);
view::load_view('default/standard/footer');
}
示例12: print_bill_of_material
function print_bill_of_material()
{
global $path_to_root;
$frompart = $_POST['PARAM_0'];
$topart = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
$orientation = $_POST['PARAM_3'];
$destination = $_POST['PARAM_4'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$orientation = $orientation ? 'L' : 'P';
$cols = array(0, 50, 305, 375, 445, 515);
$headers = array(_('Component'), _('Description'), _('Loc'), _('Wrk Ctr'), _('Quantity'));
$aligns = array('left', 'left', 'left', 'left', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
$rep = new FrontReport(_('Bill of Material Listing'), "BillOfMaterial", user_pagesize(), 9, $orientation);
if ($orientation == 'L') {
recalculate_cols($cols);
}
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewPage();
$res = getTransactions($frompart, $topart);
$parent = '';
while ($trans = db_fetch($res)) {
if ($parent != $trans['parent']) {
if ($parent != '') {
$rep->Line($rep->row - 2);
$rep->NewLine(2, 3);
}
$rep->TextCol(0, 1, $trans['parent']);
$desc = get_item($trans['parent']);
$rep->TextCol(1, 2, $desc['description']);
$parent = $trans['parent'];
$rep->NewLine();
}
$rep->NewLine();
$dec = get_qty_dec($trans['component']);
$rep->TextCol(0, 1, $trans['component']);
$rep->TextCol(1, 2, $trans['CompDescription']);
//$rep->TextCol(2, 3, $trans['loc_code']);
//$rep->TextCol(3, 4, $trans['workcentre_added']);
$wc = get_work_centre($trans['workcentre_added']);
$rep->TextCol(2, 3, get_location_name($trans['loc_code']));
$rep->TextCol(3, 4, $wc['name']);
$rep->AmountCol(4, 5, $trans['quantity'], $dec);
}
$rep->Line($rep->row - 4);
$rep->NewLine();
$rep->End();
}
示例13: process_purchase
function process_purchase($id)
{
$user_id = wp_get_current_user()->ID;
$currency = get_currency_available();
$item = get_item($id);
$price = $item->price;
if (intval($price) > intval($currency)) {
return false;
} else {
$purchase_id = create_purchase($user_id);
create_line_item($purchase_id, $id, $price);
$cost = floatval($price) * -1;
bonus_points_to_wallet($user_id, $cost);
return true;
}
}
示例14: print_assets_list
function print_assets_list()
{
global $path_to_root;
$frompart = $_POST['PARAM_0'];
$topart = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
$destination = $_POST['PARAM_3'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$cols = array(0, 50, 305, 375, 445, 515);
$headers = array(_('Asset Type'), _('Asset name'), _('Serial Number'), _('Purchase Date'), _('Purchase Value'));
$aligns = array('left', 'left', 'left', 'left', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Component'), 'from' => $frompart, 'to' => $topart));
$rep = new FrontReport(_('Assets Listing'), "AssetList", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->NewPage();
$res = getTransactions($frompart, $topart);
$parent = '';
while ($trans = db_fetch($res)) {
if ($parent != $trans['asset_type_name']) {
if ($parent != '') {
$rep->Line($rep->row - 2);
$rep->NewLine(2, 3);
}
$rep->TextCol(0, 2, $trans['asset_type_name']);
$desc = get_item($trans['asset_type_name']);
$parent = $trans['asset_type_name'];
$rep->NewLine();
}
$rep->NewLine();
$dec = get_qty_dec($trans['asset_id']);
$rep->TextCol(0, 1, $trans['asset_type_name']);
$rep->TextCol(1, 2, $trans['asset_name']);
$rep->TextCol(2, 3, $trans['asset_serial']);
$rep->TextCol(3, 4, $trans['purchase_date']);
$rep->AmountCol(4, 5, $trans['purchase_value'], $dec);
}
$rep->Line($rep->row - 4);
$rep->NewLine();
$rep->End();
}
示例15: print_bill_of_material
function print_bill_of_material()
{
global $path_to_root;
include_once $path_to_root . "reporting/includes/pdf_report.inc";
$frompart = $_REQUEST['PARAM_0'];
$topart = $_REQUEST['PARAM_1'];
$comments = $_REQUEST['PARAM_2'];
$dec = user_qty_dec();
$cols = array(0, 50, 305, 375, 445, 515);
$headers = array(tr('Component'), tr('Description'), tr('Loc'), tr('Wrk Ctr'), tr('Quantity'));
$aligns = array('left', 'left', 'left', 'left', 'right');
$params = array(0 => $comments, 1 => array('text' => tr('Component'), 'from' => $frompart, 'to' => $topart));
$rep = new FrontReport(tr('Bill of Material Listing'), "BillOfMaterial.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns);
$rep->Header();
$res = getTransactions($frompart, $topart);
$parent = '';
while ($trans = db_fetch($res)) {
if ($parent != $trans['parent']) {
if ($parent != '') {
$rep->Line($rep->row - 2);
$rep->NewLine(2, 3);
}
$rep->TextCol(0, 1, $trans['parent']);
$desc = get_item($trans['parent']);
$rep->TextCol(1, 2, $desc['description']);
$parent = $trans['parent'];
$rep->NewLine();
}
$rep->NewLine();
$rep->TextCol(0, 1, $trans['component']);
$rep->TextCol(1, 2, $trans['CompDescription']);
$rep->TextCol(2, 3, $trans['loc_code']);
$rep->TextCol(3, 4, $trans['workcentre_added']);
$rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
}
$rep->Line($rep->row - 4);
$rep->End();
}