本文整理汇总了PHP中sizeOf函数的典型用法代码示例。如果您正苦于以下问题:PHP sizeOf函数的具体用法?PHP sizeOf怎么用?PHP sizeOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sizeOf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLabWorkloadByoID
/**
* Get work load by customer
* @param int $code analysis ID
* @return array the recordset
*/
public function getLabWorkloadByoID($y, $oTypeID, $oID, $countryID)
{
// # Response container init
$Response = new ServiceResponse();
// # Check Handle
if (!$this->linkD) {
return $Response;
}
// # Response container init
$data = array();
try {
// # Execute query
$RS = $this->linkD->Execute("\r\n\r\n SET NOCOUNT ON;\r\n\r\n DECLARE @TAB TABLE([Month] nvarchar(3), [WorkedHours] float)\r\n INSERT INTO @TAB SELECT 'Jan' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 1, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Feb' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 2, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Mar' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 3, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Apr' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 4, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'May' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 5, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Jun' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 6, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Jul' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 7, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Aug' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 8, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Sep' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 9, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Oct' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 10, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Nov' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 11, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n INSERT INTO @TAB SELECT 'Dec' AS [Month], [dbo].[GetLabWorkloadByCustomer]( {$y}, 12, '{$oTypeID}', '{$oID}', '{$countryID}') AS WorkedHours\r\n \r\n SELECT * FROM @TAB;\r\n\r\n ");
// # Check if something went wrong
if (!$RS) {
throw new \Exception("Unable to retrieve data for getLabWorkloadByCustomer!");
}
// # retrieveing data and building response
while (!$RS->EOF) {
$data[] = $RS->fields;
$RS->MoveNext();
}
// # Check if something went wrong
if (sizeOf($data) == 0) {
throw new \Exception("No data to retrieve for getLabWorkloadByCustomer!");
}
// # Return response
$Response->status = ServiceResponse::STATUS_OK;
$Response->data = $data;
} catch (\Exception $e) {
$this->logger->addError($e->getMessage());
}
return $Response;
}
示例2: check_ipn_response
public function check_ipn_response()
{
if (sizeOf($_POST) == 0) {
header("HTTP/1.1 500 EMPTY_POST ");
return false;
}
if (!isset($_POST['transaction_id']) || !isset($_POST['reference_id'])) {
header("HTTP/1.1 500 BAD_PARAMETERS");
return false;
}
$transaction_id = filter_var($_POST['transaction_id'], FILTER_SANITIZE_STRING);
$url = 'https://www.bitpagos.net/api/v1/transaction/' . $transaction_id . '/?api_key=' . $this->get_option('api_key') . '&format=json';
$cbp = curl_init($url);
curl_setopt($cbp, CURLOPT_RETURNTRANSFER, TRUE);
$response_curl = curl_exec($cbp);
curl_close($cbp);
$response = json_decode($response_curl);
$order_id = (int) $_POST['reference_id'];
if ($order_id != $response->reference_id) {
die('Wrong reference id');
}
if ($response->status == 'PA' || $response->status == 'CO') {
global $woocommerce;
$order = new WC_Order($order_id);
$order->update_status('completed');
$order->payment_complete();
file_put_contents('/tmp/ipn.log', print_r($order, TRUE));
header("HTTP/1.1 200 OK");
}
}
示例3: insertVenue
public function insertVenue($result)
{
for ($i = 0; i < sizeOf($result); $i++) {
$this->insertVenueData->bind_param("ssddsdsssss", $result[$i]['id'], $result[$i]['name'], $result[$i]['lat'], $result[$i]['lng'], $result[$i]['address'], $result[$i]['rating'], $result[$i]['zipcode'], $result[$i]['city'], $result[$i]['state'], $result[$i]['phone'], Foursquare, $result[$i]['url']);
$this->insertVenueData->execute();
}
}
示例4: ltheme_tab_shortcode
function ltheme_tab_shortcode($atts, $content = null)
{
global $ltheme_tab_array;
$ltheme_tab_array = array();
do_shortcode($content);
$num = sizeOf($ltheme_tab_array);
$tab = '<div class="ltheme-tab">';
// tab title
$tab = $tab . '<ul class="ltheme-tab-title">';
for ($i = 0; $i < $num; $i++) {
$active = $i == 0 ? 'class="active" ' : '';
$tab = $tab . '<li><a data-tab="tab-' . $i . '" ' . $active;
$tab = $tab . '>' . $ltheme_tab_array[$i]["title"] . '</a></li>';
}
$tab = $tab . '</ul>';
// tab content
$tab = $tab . '<div class="clear"></div>';
$tab = $tab . '<ul class="ltheme-tab-content">';
for ($i = 0; $i < $num; $i++) {
$active = $i == 0 ? 'class="active" ' : '';
$tab = $tab . '<li data-tab="tab-' . $i . '" ' . $active;
$tab = $tab . '>' . $ltheme_tab_array[$i]["content"] . '</li>';
}
$tab = $tab . "</ul>";
// ltheme-tab-content
$tab = $tab . "</div>";
// ltheme-tab
return $tab;
}
示例5: block_pagination
/**
* Breadcrumbs for the Perfectum Theme
*
* @version 1.0
* @since 1.0
* @author Daniel Noel-Davies
*
* @param array $block Array of block values
*
*/
function block_pagination($block)
{
// Get instances...
$objPage = coreObj::getPage();
$objTPL = coreObj::getTPL();
$breadcrumbs = $objPage->getOptions('breadcrumbs');
$length = sizeOf($breadcrumbs);
// Check we have breadcrumbs to work with
if (!empty($breadcrumbs)) {
return false;
}
// Give this block a handle
$objTPl->set_filenames(array('perfectum_breadcrumbs', Page::$THEME_ROOT . 'breadcrumbs.tpl'));
// Loop through breadcrumbs and assign the array values to each template block
foreach ($breadcrumbs as $index => $crumb) {
if ($index < $length) {
$objTPL->assign_block_vars('crumb', array('URL' => $crumb['url'], 'TITLE' => $crumb['name']));
// If this is the last crumb, make it un-clickable
} else {
$objTPL->assign_block_vars('crumb', array('TITLE' => $crumb['name']));
}
}
// Return the block's contents
return $objTPL->get_html('perfectum_breadcrumbs');
}
示例6: get_pronoun_id
function get_pronoun_id($subjP, $objP, $possDetP, $possP, $reflexP)
{
$pronoun_hash = hashPronouns($subjP, $objP, $possDetP, $possP, $reflexP);
$db = connectDB();
try {
$stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
$stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (sizeOf($rows) != 0) {
$pronounID = $rows[0]['pronoun_id'];
} else {
$stmt = $db->prepare("INSERT INTO cr_pronouns(pronoun_id, pronoun_hash, subj, obj, poss_det, poss_pro,\n reflexive) VALUES('', :pronoun_hash, :subj, :obj, :poss_det, :poss_pro,\n :reflexive);");
$stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
$stmt->bindValue(':subj', $subjP, PDO::PARAM_STR);
$stmt->bindValue(':obj', $objP, PDO::PARAM_STR);
$stmt->bindValue(':poss_det', $possDetP, PDO::PARAM_STR);
$stmt->bindValue(':poss_pro', $possP, PDO::PARAM_STR);
$stmt->bindValue(':reflexive', $reflexP, PDO::PARAM_STR);
$stmt->execute();
$stmt = $db->prepare("SELECT pronoun_id FROM cr_pronouns WHERE pronoun_hash=:pronoun_hash;");
$stmt->bindValue(':pronoun_hash', $pronoun_hash, PDO::PARAM_STR);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
$pronounID = $rows[0]['pronoun_id'];
}
} catch (PDOException $ex) {
header("Location: ./register?err=pronoun");
}
return $pronounID;
}
示例7: update
public function update($data)
{
$PerchEvents_Events = new PerchEvents_Events();
if (isset($data['eventDescRaw'])) {
$data['eventDescHTML'] = $PerchEvents_Events->text_to_html($data['eventDescRaw']);
} else {
$data['eventDescHTML'] = false;
}
if (isset($data['eventTitle'])) {
$data['eventSlug'] = PerchUtil::urlify(date('Y m d', strtotime($data['eventDateTime'])) . ' ' . $data['eventTitle']);
}
if (isset($data['cat_ids'])) {
$catIDs = $data['cat_ids'];
unset($data['cat_ids']);
} else {
$catIDs = false;
}
// Update the event itself
parent::update($data);
// Delete existing categories
$this->db->delete(PERCH_DB_PREFIX . 'events_to_categories', $this->pk, $this->id());
// Add new categories
if (is_array($catIDs)) {
for ($i = 0; $i < sizeOf($catIDs); $i++) {
$tmp = array();
$tmp['eventID'] = $this->id();
$tmp['categoryID'] = $catIDs[$i];
$this->db->insert(PERCH_DB_PREFIX . 'events_to_categories', $tmp);
}
}
return true;
}
示例8: testRetrieveAll
public function testRetrieveAll()
{
$items = $this->querizer->from('My\\Dom\\Identity')->datafields(array('name'))->conditions(array('active' => null))->sort(array('name' => 'DESC'))->group(array('name'))->results();
$this->assertEquals(2, sizeOf($items));
$this->assertEquals('Bob', $items[1]['name']);
$this->assertEquals('Jack', $items[3]['name']);
}
示例9: getMimeTypeForFile
function getMimeTypeForFile($file, $default = 'application/octet-stream')
{
$ext = "";
$arr = explode(".", $file);
$ext = $arr[sizeOf($arr) - 1];
return getMimeTypeFor($ext);
}
示例10: getArray
public function getArray($enPremie)
{
$premieArray = split('[|]', trim($enPremie));
if (sizeOf($premieArray) == 30) {
return array("doId" => $premieArray[0], "utstillingId" => $premieArray[1], "hundId" => $premieArray[2], "katalogNr" => $premieArray[3], "personIdDommer" => $premieArray[4], "klasse" => $premieArray[5], "kjonn" => $premieArray[6], "raseId" => $premieArray[7], "IM" => $premieArray[8], "KIP" => $premieArray[9], "JK" => $premieArray[10], "JKK" => $premieArray[11], "UK" => $premieArray[12], "UKK" => $premieArray[13], "BK" => $premieArray[14], "BKK" => $premieArray[15], "AK" => $premieArray[16], "AKK" => $premieArray[17], "VK" => $premieArray[18], "CHK" => $premieArray[19], "CHKK" => $premieArray[20], "VTK" => $premieArray[21], "VTKK" => $premieArray[22], "HP" => $premieArray[23], "CK" => $premieArray[24], "CC" => $premieArray[25], "CA" => $premieArray[26], "BIK" => $premieArray[27], "BIR" => $premieArray[28], "BIM" => $premieArray[29]);
}
}
示例11: getFields
/**
*
* @return array
*/
public function getFields()
{
if (sizeOf($this->fields) == 0) {
$this->loadFields();
}
return $this->fields;
}
示例12: solution
function solution($A)
{
$sizeOfString = strlen($A);
$i = 0;
$j = 0;
$B = array();
while ($i < $sizeOfString) {
if (!isset($B[$j])) {
$B[$j] = $A[$i];
$i++;
} else {
// var_dump("***");
// var_dump("$i: $A[$i] - " .complement($A[$i]));
if (complement($A[$i]) == $B[$j]) {
array_pop($B);
if ($j > 0) {
$j--;
}
} else {
array_push($B, $A[$i]);
$j++;
}
$i++;
}
}
if (sizeOf($B) > 0 || $sizeOfString == 0) {
return 0;
} else {
return 1;
}
}
示例13: login
function login()
{
$this->data['title'] = "Login";
//validate form input
$this->form_validation->set_rules('identity', 'Identity', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == true) {
// check to see if the user is logging in
// check for "remember me"
$remember = (bool) $this->input->post('remember');
if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember)) {
//if the login is successful
//redirect them back to the home page
if (sizeOf($this->session->flashdata('uploadAttempt')) > 0) {
redirect("/" . $this->session->flashdata('uploadAttempt'));
} else {
$this->session->set_flashdata('message', $this->ion_auth->messages());
redirect('/', 'refresh');
}
} else {
// if the login was un-successful
// redirect them back to the login page
$this->session->set_flashdata('message', $this->ion_auth->errors());
redirect('auth/login', 'refresh');
// use redirects instead of loading views for compatibility with MY_Controller libraries
}
} else {
// the user is not logging in so display the login page
// set the flash data error message if there is one
$this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
$this->data['identity'] = array('name' => 'identity', 'id' => 'identity', 'type' => 'text', 'value' => $this->form_validation->set_value('identity'));
$this->data['password'] = array('name' => 'password', 'id' => 'password', 'type' => 'password');
$this->_render_page('auth/login', $this->data);
}
}
示例14: convert
/**
* Converts from an array of user.branch.firstName=>abc, to standard objects
* {
* user:{
* branch:{
* firstName:abc
* }
* }
* }
*
* @param string[] $input
*
* @return \stdClass
* @throws Exception
*/
public function convert(array $input)
{
//Convert to objects
$returnVar = new \stdClass();
foreach ($input as $name => $value) {
$parts = explode($this->getDelimiter(), $name);
$currentPart = $returnVar;
$count = sizeOf($parts);
foreach ($parts as $key => $part) {
//Ignore all that have a blank part
if ($part == '') {
break;
}
if ($key + 1 == $count) {
$currentPart->{$part} = $value;
} else {
$part = ucfirst($part);
if (!isset($currentPart->{$part})) {
$item = new \stdClass();
$currentPart->{$part} = $item;
} else {
//Account for the url of ?employeeType&employeeType.name=1099 with employeeType and employeeType.name
if (!is_object($currentPart->{$part})) {
throw new Exception('You cannot pass in both ' . $part . ', and ' . implode('.', $parts), 400);
}
}
$currentPart = $currentPart->{$part};
}
}
}
return $returnVar;
}
示例15: __autoload
function __autoload($class_name)
{
$imported = false;
$namespaces = explode("_", strtolower($class_name));
if (sizeOf($namespaces) == 3) {
if ($namespaces[0] == "plugin") {
if (file_exists("system/plugins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php")) {
require_once "system/plugins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php";
$imported = true;
}
} else {
if ($namespaces[0] == "skin") {
if (file_exists("system/skins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php")) {
require_once "system/skins/" . $namespaces[1] . "/classes/" . $namespaces[2] . ".php";
$imported = true;
}
}
}
}
if (!$imported) {
if (file_exists("system/classes/" . strtolower($class_name) . ".php")) {
require_once "system/classes/" . strtolower($class_name) . ".php";
}
}
$GLOBALS['loadedClasses']++;
}