本文整理汇总了PHP中is_Array函数的典型用法代码示例。如果您正苦于以下问题:PHP is_Array函数的具体用法?PHP is_Array怎么用?PHP is_Array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_Array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reverseTransform
public function reverseTransform($value)
{
if (is_Array($value)) {
return $value;
}
return array_map('trim', explode(',', $value));
}
示例2: usersLookup
/**
* Search users
*
* $options may include any of the following:
* - page: the page of results to retrieve
* - count: the number of users to retrieve per page; max is 20
* - include_entities: if set to boolean true, include embedded entities
*
* @param string $query
* @param array $options
* @throws Http\Client\Exception\ExceptionInterface if HTTP request fails or times out
* @throws Exception\DomainException if unable to decode JSON payload
* @return Response
*/
public function usersLookup($query, array $options = array())
{
$this->init();
$path = 'users/lookup';
if (is_Array($query)) {
$query = implode(',', $query);
}
$len = iconv_strlen($query, 'UTF-8');
if (0 == $len) {
throw new \ZendService\Twitter\Exception\InvalidArgumentException('Query must contain at least one character');
}
$params = array('screen_name' => $query);
foreach ($options as $key => $value) {
switch (strtolower($key)) {
case 'count':
$value = (int) $value;
if (1 > $value || 20 < $value) {
throw new Exception\InvalidArgumentException('count must be between 1 and 20');
}
$params['count'] = $value;
break;
case 'page':
$params['page'] = (int) $value;
break;
case 'include_entities':
$params['include_entities'] = (bool) $value;
break;
default:
break;
}
}
$response = $this->get($path, $params);
return new \ZendService\Twitter\Response($response);
}
示例3: pmpro_levels
function pmpro_levels($course_id = null)
{
if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) {
$levels = pmpro_getAllLevels();
// Get all the PMPro Levels
?>
<li class="course_membership"><strong><?php
_e('Set Course Memberships', 'wplms-front-end');
?>
<span>
<select id="vibe_pmpro_membership" class="chosen" multiple>
<?php
if (isset($levels) && is_array($levels)) {
foreach ($levels as $level) {
if (!is_Array($course_pricing['vibe_pmpro_membership'])) {
$course_pricing['vibe_pmpro_membership'] = array();
}
if (is_object($level)) {
echo '<option value="' . $level->id . '" ' . (in_array($level->id, $course_pricing['vibe_pmpro_membership']) ? 'selected' : '') . '>' . $level->name . '</option>';
}
}
}
?>
</select>
</span>
</strong>
</li>
<?php
}
}
示例4: testGetUserOptions
public function testGetUserOptions()
{
$project = $this->projects('project1');
$options = $project->getUserOptions();
$this->assertTrue(is_Array($options));
$this->assertTrue(count($options) > 0);
}
示例5: scriptCheckIfNull
function scriptCheckIfNull()
{
$errMsg = "";
$numargs = func_num_args();
for ($cntr = 0; $cntr < $numargs; $cntr += 2) {
//Create keys for the label-value pair. First in the pair is the label of the field,
//followed by the value that was submitted for that field.
$key1 = $cntr;
$key2 = $cntr + 1;
$label = func_get_arg($key1);
//This gets the label that was passed.
$value = func_get_arg($key2);
//This gets the value that was passed.
if (!is_Array($value)) {
if ($value == "") {
$errMsg .= "No value detected: {$label} <BR>";
}
} else {
$elements = count($value);
for ($arrCnt = 0; $arrCnt < $elements; $arrCnt++) {
if ($value[$arrCnt] == '') {
$errMsg .= "No value detected: {$label} in Line #" . ($arrCnt + 1) . ".<BR>";
}
}
}
}
return $errMsg;
}
示例6: print_ro
function print_ro($object, $alsoIgnore = array(), $tab = 0)
{
// prints an object/array, but removes the $parent, and anything inside alsoIgnore
$pad = "";
if (!in_array('parent', $alsoIgnore)) {
$alsoIgnore[] = "parent";
}
for ($c = 0; $c < $tab; $c++) {
$pad .= "\t";
}
foreach ($object as $key => $value) {
if (!is_numeric($key) && in_array($key, $alsoIgnore)) {
echo $pad . $key . " => *HIDDEN*\n";
} else {
if (is_Array($value) || is_Object($value)) {
if (is_Array($value)) {
echo "{$pad}{$key} => Array (\n";
} else {
echo "{$pad}{$key} => Object (\n";
}
print_ro($value, $alsoIgnore, $tab + 1);
echo $pad . ")\n";
} else {
echo $pad . $key . " => " . $value . "\n";
}
}
}
}
示例7: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$cid = vRequest::getvar('cid', NULL, 'array');
if (is_Array($cid)) {
$virtuemart_paymentmethod_id = $cid[0];
} else {
$virtuemart_paymentmethod_id = $cid;
}
$http = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&nt=ipn&tmpl=component&pm=' . $virtuemart_paymentmethod_id;
$https = str_replace('http://', 'https://', $http);
$class = $node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : 'class="text_area"';
if ($node->attributes('editable') == 'true') {
$size = $node->attributes('size') ? 'size="' . $node->attributes('size') . '"' : '';
return '<input type="text" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" ' . $class . ' ' . $size . ' />';
} else {
$string = "<div " . $class . ">";
$string .= '<div class="ipn-sandbox">' . $http . ' <br /></div>';
if (strcmp($https, $http) !== 0) {
$string .= '<div class="ipn-sandbox">' . vmText::_('VMPAYMENT_AMAZON_OR') . '<br /></div>';
$string .= $https;
$string .= "</div>";
}
return $string;
}
}
示例8: check_if_null_new
function check_if_null_new()
{
$this->error_message = '';
$numargs = func_num_args();
for ($cntr = 0; $cntr < $numargs; $cntr += 2) {
//Create keys for the label-value pair. First in the pair is the label of the field,
//followed by the value that was submitted for that field.
$key1 = $cntr;
$key2 = $cntr + 1;
$label = func_get_arg($key1);
//This gets the label that was passed.
$value = func_get_arg($key2);
//This gets the value that was passed.
if (!is_Array($value)) {
//if(trim($value)=="") $this->error_message .= "No value detected: $label <BR>";
if (trim($value) == "") {
$this->error_message .= "This field is required.";
}
} else {
$elements = count($value);
for ($arrCnt = 0; $arrCnt < $elements; $arrCnt++) {
if ($value[$arrCnt] == '') {
$this->error_message .= "No value detected: {$label} in Line #" . ($arrCnt + 1) . ".<BR>";
}
}
}
}
return $this->error_message;
}
示例9: create
/**
* Create code frame for compiled and cached templates
*
* @param Smarty_Internal_Template $_template
* @param string $content optional template content
* @param bool $cache flag for cache file
*
* @return string
*/
public static function create(Smarty_Internal_Template $_template, $content = '', $cache = false)
{
// build property code
$properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
$properties['version'] = Smarty::SMARTY_VERSION;
$properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
if (!empty($_template->tpl_function)) {
$properties['tpl_function'] = $_template->tpl_function;
}
if (!$cache) {
$properties['file_dependency'] = $_template->compiled->file_dependency;
$properties['includes'] = $_template->compiled->includes;
} else {
$properties['file_dependency'] = $_template->cached->file_dependency;
$properties['cache_lifetime'] = $_template->cache_lifetime;
}
$output = "<?php\n";
$output .= "/*%%SmartyHeaderCode:{$_template->compiled->nocache_hash}%%*/\n";
if ($_template->smarty->direct_access_security) {
$output .= "if(!defined('SMARTY_DIR')) exit('no direct access allowed');\n";
}
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n";
$output .= "/*/%%SmartyHeaderCode%%*/\n";
$output .= "if (\$_valid && !is_callable('{$properties['unifunc']}')) {\n";
$output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n";
// include code for plugins
if (!$cache) {
if (!empty($_template->compiled->required_plugins['compiled'])) {
foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
if (is_array($data['function'])) {
$output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
} else {
$output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
}
}
}
}
if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
$_template->compiled->has_nocache_code = true;
$output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
if (is_Array($data['function'])) {
$output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
} else {
$output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
}
}
}
$output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
}
}
$output .= "?>\n";
$output = self::appendCode($output, $content);
return self::appendCode($output, "<?php }\n}\n?>");
}
示例10: create
/**
* Create code frame for compiled and cached templates
*
* @param Smarty_Internal_Template $_template
* @param string $content optional template content
* @param bool $cache flag for cache file
*
* @return string
*/
public function create(Smarty_Internal_Template $_template, $content = '', $functions = '', $cache = false)
{
// build property code
$properties['has_nocache_code'] = $_template->compiled->has_nocache_code;
$properties['version'] = Smarty::SMARTY_VERSION;
$properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
if (!empty($_template->tpl_function)) {
$properties['tpl_function'] = $_template->tpl_function;
}
if (!$cache) {
$properties['file_dependency'] = $_template->compiled->file_dependency;
$properties['includes'] = $_template->compiled->includes;
} else {
$properties['file_dependency'] = $_template->cached->file_dependency;
$properties['cache_lifetime'] = $_template->cache_lifetime;
}
$output = "<?php\n";
$output .= "/* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n from \"" . $_template->source->filepath . "\" */\n\n";
$dec = "\$_smarty_tpl->smarty->ext->_validateCompiled->decodeProperties(\$_smarty_tpl, " . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ")";
$output .= "if ({$dec}) {\n";
$output .= "function {$properties['unifunc']} (\$_smarty_tpl) {\n";
// include code for plugins
if (!$cache) {
if (!empty($_template->compiled->required_plugins['compiled'])) {
foreach ($_template->compiled->required_plugins['compiled'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
if (is_array($data['function'])) {
$output .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n";
} else {
$output .= "if (!is_callable('{$data['function']}')) require_once '{$file}';\n";
}
}
}
}
if ($_template->caching && !empty($_template->compiled->required_plugins['nocache'])) {
$_template->compiled->has_nocache_code = true;
$output .= "echo '/*%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/<?php \$_smarty = \$_smarty_tpl->smarty; ";
foreach ($_template->compiled->required_plugins['nocache'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
if (is_Array($data['function'])) {
$output .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) require_once '{$file}';\n");
} else {
$output .= addslashes("if (!is_callable('{$data['function']}')) require_once '{$file}';\n");
}
}
}
$output .= "?>/*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%*/';\n";
}
}
$output .= "?>\n";
$output .= $content;
$output .= "<?php }\n?>";
$output .= $functions;
$output .= "<?php }\n";
// remove unneeded PHP tags
return preg_replace('/\\s*\\?>[\\n]?<\\?php\\s*/', "\n", $output);
}
示例11: get_cached
function get_cached($uri)
{
$uri = addslashes($uri);
$r = mysql_fetch_all(mysql_query("SELECT * FROM cache WHERE uri = '{$uri}'"));
if (is_Array($r)) {
return array_shift($r);
}
}
示例12: login
function login($username, $password)
{
session_regenerate_id(true);
$file = "/home/fcocco01/private/users.php";
$linesOfFile = readFileChosen($file);
//set variables
$all_correct = FALSE;
$username_correct = FALSE;
$password_correct = FALSE;
$username_login_trimmed = trim(filter_var($username, FILTER_SANITIZE_STRING));
$password_login_trimmed = trim(filter_var($password, FILTER_SANITIZE_STRING));
if (!empty($username) || !empty($password)) {
//Foreach loop to take each line of the array
foreach ($linesOfFile as $line) {
//Exclude empty lines from loop
if (!($line == "") || !is_bool($line)) {
//Parse each line into array of elements
$details = explode(',', $line);
//Stores, trims and sanitizes input from the user
//checks if the array exists and assign variables from indexed values
if (isset($details) && is_Array($details)) {
$details_username = reset($details);
$details_password = trim(end($details));
//compares values with input. If they do not match or input is empty, gives out error
if ($username_login_trimmed === $details_username && $password_login_trimmed === $details_password) {
$all_correct = TRUE;
break;
} else {
if ($username_login_trimmed === $details_username) {
$username_correct = TRUE;
}
}
}
}
}
}
//returns arrays depending which condition is satisfied
//the details are both correct
if ($all_correct) {
session_regenerate_id(true);
return array('TheUsername' => $username_login_trimmed, 'ThePassword' => $password_login_trimmed);
} else {
//one or more detail was wrong or left empty
if (!$username_correct) {
$error_messages_login['username_error'] = "username is incorrect";
}
if ($username_correct) {
$error_messages_login['password_error'] = "password is incorrect";
}
if (empty($username)) {
$error_messages_login['username_error'] = "please insert a valid username";
}
if (empty($password)) {
$error_messages_login['password_error'] = "please insert your password";
}
return $error_messages_login;
}
}
示例13: getInput
function getInput()
{
$js = '
//<![CDATA[
jQuery(document).ready(function( $ ) {
jQuery("#paybox_getpaybox_link").click( function() {
if ( $("#paybox_getpaybox_show_hide").is(":visible") ) {
$("#paybox_getpaybox_show_hide").hide("slow");
$("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT')) . '");
} else {
$("#paybox_getpaybox_show_hide").show("slow");
$("#paybox_getpaybox_link").html("' . addslashes(vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE')) . '");
}
});
});
//]]>
';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
if (!class_exists('pbxRequest')) {
require JPATH_SITE . DS . 'plugins' . DS . 'vmpayment' . DS . 'paybox' . DS . 'paybox' . DS . 'helpers' . DS . 'pbxrequest.php';
}
$cid = pbxRequest::getvar('cid', NULL, 'array');
if (is_Array($cid)) {
$virtuemart_paymentmethod_id = $cid[0];
} else {
$virtuemart_paymentmethod_id = $cid;
}
$query = "SELECT * FROM `#__virtuemart_paymentmethods` WHERE virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
$db = JFactory::getDBO();
$db->setQuery($query);
$params = $db->loadObject();
$html = '<img src="http://virtuemart.boutique-paybox.com/PayboxLogo.jpg" width="200px"/><br />';
if ($params->created_on == $params->modified_on) {
$id = "paybox_getpaybox_link";
$html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_GET_PAYBOX_HIDE') . '</a>';
$display = '';
$html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
} else {
$id = "paybox_getpaybox_link";
$html .= '<a href="#" id="' . $id . '">' . vmText::_('VMPAYMENT_PAYBOX_ALREADY_ACCOUNT') . '</a>';
$display = ' style="display: none;"';
$html .= '<div id="paybox_getpaybox_show_hide" align=""' . $display . ' >';
}
$id = "";
$lang = $this->getLang();
if ($lang == 'fr') {
$url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
} else {
$url = "http://virtuemart.boutique-paybox.com/PayboxPres.html";
}
$html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="800px"></iframe>';
$html .= "</div>";
return $html;
}
示例14: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$js = '
//<![CDATA[
jQuery(document).ready(function( $ ) {
jQuery("#heidelpay_getheidelpay_link").click( function() {
if ( $("#heidelpay_getheidelpay_show_hide").is(":visible") ) {
$("#heidelpay_getheidelpay_show_hide").hide("slow");
$("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT')) . '");
} else {
$("#heidelpay_getheidelpay_show_hide").show("slow");
$("#heidelpay_getheidelpay_link").html("' . addslashes(JText::_('VMPAYMENT_HEIDELPAY_GET_HEIDELPAY_HIDE')) . '");
}
});
});
//]]>
';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
$cid = jrequest::getvar('cid', NULL, 'array');
if (is_Array($cid)) {
$virtuemart_paymentmethod_id = $cid[0];
} else {
$virtuemart_paymentmethod_id = $cid;
}
$query = "SELECT payment_params FROM `#__virtuemart_paymentmethods` WHERE virtuemart_paymentmethod_id = '" . $virtuemart_paymentmethod_id . "'";
$db = JFactory::getDBO();
$db->setQuery($query);
$params = $db->loadResult();
$payment_params = explode("|", $params);
foreach ($payment_params as $payment_param) {
if (empty($payment_param)) {
continue;
}
$param = explode('=', $payment_param);
$payment_params[$param[0]] = substr($param[1], 1, -1);
}
$id = "";
if ($payment_params['HEIDELPAY_SECURITY_SENDER'] == '31HA07BC8124AD82A9E96D9A35FAFD2A' or $payment_params['HEIDELPAY_SECURITY_SENDER'] == '') {
$id = "heidelpay_getheidelpay_link";
$display = '';
$html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_ALREADY_ACCOUNT') . '</a>';
} else {
$id = "heidelpay_getheidelpay_link";
$display = ' style="display: none;"';
$html = '<a href="#" id="' . $id . '" class="signin-button-link">' . JText::_('VMPAYMENT_HEIDELPAY_CREATE_ACCOUNT') . '</a>';
}
$lang = $this->getLang();
$html .= '<div id="heidelpay_getheidelpay_show_hide" align=""' . $display . ' >';
$url = "http://demoshops.heidelpay.de/contactform/?campaign=vituemart&shop=vituemart&lang=" . $lang;
$html .= '<iframe src="' . $url . '" scrolling="yes" style="x-overflow: none;" frameborder="0" height="1400px" width="300px"></iframe>';
$html .= "</div>";
$html .= '<a target="_blank" href="http://docs.virtuemart.net/manual/shop-menu/payment-methods/heidelpay.html" class="signin-button-link">' . vmText::_('VMPAYMENT_AMAZON_DOCUMENTATION') . '</a></p></div>';
return $html;
}
示例15: get_order_report_data
function get_order_report_data($start_date, $end_date)
{
global $wpdb;
$order_item_meta_table = $wpdb->prefix . 'woocommerce_order_itemmeta';
$order_items_table = $wpdb->prefix . 'woocommerce_order_items';
$inst_commissions = $wpdb->get_results("SELECT order_items.order_id,order_meta.meta_key as instructor,order_meta.meta_value as commission\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key LIKE 'commission%'");
if (is_array($inst_commissions)) {
foreach ($inst_commissions as $inst_commission) {
$order_ids[] = $inst_commission->order_id;
$inst = explode('commission', $inst_commission->instructor);
if (is_numeric($inst[1])) {
$instructor_commissions[$inst[1]] += $inst_commission->commission;
}
}
if (is_array($order_ids)) {
$order_id_string = implode(',', $order_ids);
}
}
$query = "SELECT order_items.order_item_id,order_meta.meta_value as total_sales\n\t\t\tFROM {$wpdb->posts} as posts\n\t\t\tLEFT JOIN {$order_items_table} as order_items ON posts.ID = order_items.order_id\n\t\t\tLEFT JOIN {$order_item_meta_table} as order_meta ON order_items.order_item_id = order_meta.order_item_id\n\t\t\tWHERE posts.post_type='shop_order'\n\t\t\tAND posts.post_status='wc-completed'\n\t\t\tAND posts.post_date BETWEEN '{$start_date}' AND '{$end_date}'\n\t\t\tAND order_meta.meta_key = '_line_total'";
if (isset($order_id_string)) {
$query .= "AND posts.ID NOT IN ({$order_id_string})";
}
$inst_commissions = $wpdb->get_results($query);
$commissions = get_option('instructor_commissions');
foreach ($inst_commissions as $inst_commission) {
$oid = $inst_commission->order_item_id;
$pid = woocommerce_get_order_item_meta($oid, '_product_id', true);
$courses = vibe_sanitize(get_post_meta($pid, 'vibe_courses', false));
if (isset($courses) && is_array($courses) && count($courses)) {
$n = count($courses);
foreach ($courses as $course) {
$instructors = apply_filters('wplms_course_instructors', get_post_field('post_author', $course), $course);
if (is_numeric($instructors)) {
if (!isset($commission[$course][$instructors])) {
$commission[$course][$instructors] = 70;
}
echo $commission[$course][$instructors] * $inst_commission->total_sales;
$instructor_commissions[$instructors] += $commission[$course][$instructors] * $inst_commission->total_sales;
} else {
if (is_Array($instructors)) {
$k = count($instructors);
foreach ($instructors as $instructor) {
if (!isset($commission[$course][$instructor])) {
$commission[$course][$instructor] = floor(70 / $k);
}
$instructor_commissions[$instructor] += $commission[$course][$instructor] * $inst_commission->total_sales;
}
}
}
}
}
}
return $instructor_commissions;
}