本文整理汇总了PHP中in_array_r函数的典型用法代码示例。如果您正苦于以下问题:PHP in_array_r函数的具体用法?PHP in_array_r怎么用?PHP in_array_r使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了in_array_r函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add()
{
$this->check_authority();
if (isset($_POST['wid_id']) and isset($_POST['parent'])) {
$wid_id = $_POST['wid_id'];
$area = $_POST['parent'];
$this->load->model('mwidget');
$this->load->model('msettings');
$gen_settings = $this->msettings->get_set_gen();
$wid_areas = get_layout_wid_areas($gen_settings[0]->theme);
$area_wids = get_widgets($area);
$wid_list = $this->mwidget->get_widget_list();
if (null != $this->mwidget->get_widget_list($wid_id) and in_array_r($area, $wid_areas)) {
$wid_info = $this->mwidget->get_widget_list($wid_id);
$title = $wid_info[0]->desc;
$xtbl = $wid_info[0]->child_tbl;
$pos = count($area_wids) + 1;
$add = $this->mwidget->add_widget($wid_id, $title, $area, $pos, $xtbl);
if (true == $add) {
$data['wid_list'] = $this->mwidget->get_widget_list();
$data['wid_area_wids'] = get_widgets($area);
$this->load->view($this->wid_dir . 'widgets_list', $data);
}
}
}
}
示例2: in_array_r
function in_array_r($needle, $haystack, $strict = false)
{
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || is_array($item) && in_array_r($needle, $item, $strict)) {
return true;
}
}
return false;
}
示例3: in_array_r
function in_array_r($needle, $haystack)
{
foreach ($haystack as $item) {
if ($item === $needle || is_array($item) && in_array_r($needle, $item)) {
return true;
}
}
return false;
}
示例4: in_array_r
/**
* Recursive in_array function
*
* @param array $needle
* @param array $haystack
* @return boolean
*/
function in_array_r($needle, $haystack)
{
if (!is_array($needle)) {
return in_array_r(array($needle), $haystack);
}
foreach ($needle as $item) {
if (in_array($item, $haystack)) {
return true;
}
}
return false;
}
示例5: in_array_r
private function in_array_r($needle, $haystack)
{
$found = false;
foreach ($haystack as $item) {
if ($item === $needle) {
$found = true;
break;
} elseif (is_array($item)) {
$found = in_array_r($needle, $item);
if ($found) {
break;
}
}
}
return $found;
}
示例6: form
public function form($instance)
{
// Extracting defined values and defining default values for variables
$instance = wp_parse_args((array) $instance, array('title' => '', 'features' => array(), 'url' => ''));
// $title = esc_attr( $instance['title'] );
$url = esc_url($instance['url']);
$active_features = $instance['features'];
// Store all active features first in (array) $all_features
$all_features = $active_features;
// Append non-active features to (array) $all_features
foreach ($this->feature_list as $feature) {
if (!in_array_r($feature, $active_features)) {
$all_features[] = array('name' => $feature);
}
}
// Display the admin form
include plugin_dir_path(__FILE__) . 'inc/admin-widget.php';
}
示例7: parseNavArray
function parseNavArray($nav_array, $page_url, $level = 1)
{
$output = "";
foreach ($nav_array as $nav_title => $nav_url) {
if (is_array($nav_url)) {
$nav_class = '';
if (in_array_r($page_url, $nav_url)) {
$nav_class = ' active';
}
// end if (in_array_r($page_url, $nav_url))
if ($level == 1) {
$output .= '<li class="dropdown' . $nav_class . '">' . '<a class="dropdown-toggle" data-toggle="dropdown">' . $nav_title . ' <b class="caret"></b>' . '</a>' . '<ul class="dropdown-menu">' . parseNavArray($nav_url, $page_url, $level + 1) . '</ul>' . '</li>';
} else {
// end if ($level == 1)
$output .= '<li class="dropdown-submenu">' . '<a>' . $nav_title . '</a>' . '<ul class="dropdown-menu">' . parseNavArray($nav_url, $page_url, $level + 1) . '</ul>' . '</li>';
}
// end if ($level == 1) else
} else {
if ($nav_url == "divider") {
// end if (is_array($nav_url))
$output .= '<li class="divider"></li>';
} else {
if ($nav_url == $page_url) {
// end if ($nav_url == "divider")
if ($level == 1) {
$output .= '<li class="active"><a>' . $nav_title . '</a></li>';
} else {
// end if ($level == 1)
$output .= '<li class="disabled"><a>' . $nav_title . '</a></li>';
}
// end if ($level == 1) else
} else {
// end if ($nav_url == $page_url)
$output .= '<li><a href="' . $nav_url . '">' . $nav_title . '</a></li>';
}
}
}
// end if ($nav_url == $page_url) else
}
// end foreach ($nav_array as $nav_title => $nav_url)
return $output;
}
示例8: subcategorias
static function subcategorias($client)
{
if (self::tieneCatCustom($client)) {
$cats = self::categoriasCustom($client);
$c = array();
foreach ($cats['data'] as $cat) {
if ($cat['activo'] == 1 && !in_array_r($cat['subcategoria'], $c)) {
$c[] = array('categoria' => $cat['categoria'], 'subcategoria' => $cat['subcategoria']);
}
}
return $c;
} else {
PDOSql::$pdobj = pdoConnect();
$cats = Sql::fetch("SELECT categoria, subcategoria from cats ORDER BY id ASC");
$c = array();
foreach ($cats as $cat) {
if (!in_array_r($cat['subcategoria'], $c)) {
$c[] = array('categoria' => $cat['categoria'], 'subcategoria' => $cat['subcategoria']);
}
}
return $c;
}
}
示例9: checkDB
/**
* Datenbank pruefen
*
* *Description* Pruefe bei Systemstart ob alle notwendigen Tabellen und Spalten angelegt sind
*
* @param string
*
* @return array
*/
public function checkDB($setting = 'complete')
{
$missing = array('error' => FALSE, 'message' => NULL);
$tableCols = parent::dbStrukture('cols');
// Prüfe ob Tabellen existieren
$stmt = $this->db->query("SHOW TABLES");
$tables = $stmt->fetchAll(\PDO::FETCH_ASSOC);
if (!empty($tables)) {
foreach (parent::dbStrukture('tables') as $table) {
if (in_array_r(TBL_PRFX . $table, $tables)) {
// Prüfe ob alle Spalten existieren bei complete
if ($setting != 'short') {
$stmt = $this->db->query("SHOW COLUMNS FROM " . TBL_PRFX . $table);
$columns = $stmt->fetchAll(\PDO::FETCH_COLUMN);
if (!empty($columns)) {
foreach ($tableCols[$table] as $column) {
if (!in_array_r($column, $columns)) {
$missing['message'][] = 'missing column ' . $column . ' in table ' . $table;
}
}
} else {
$missing['message'][] = 'missing all cols in table ' . $table;
}
}
} else {
$missing['message'][] = 'missing table ' . $table;
}
}
} else {
$missing['message'][] = 'missing all tables';
}
if (!empty($missing['message'])) {
$missing['error'] = TRUE;
}
return $missing;
}
示例10: bbconnect_process_country
function bbconnect_process_country($country)
{
$bbconnect_helper_country = bbconnect_helper_country();
if (strlen($country) > 3) {
$country = in_array_r($country, $bbconnect_helper_country, true);
} else {
$country = substr($country, 0, 2);
}
return $country;
}
示例11: sc_ra_ads
function sc_ra_ads($name)
{
if (qw_hook_exist(__FUNCTION__)) {
$args = func_get_args();
array_unshift($args, $this);
return qw_event_hook(__FUNCTION__, $args, NULL);
}
$option = ra_opt('ra_qaads');
if (is_array($option)) {
if (in_array_r($name, $option)) {
foreach ($option as $opt) {
if (ra_edit_mode() && $opt['name'] == $name) {
$this->output('<div style="height:100px;background:#333;text-align:center;font-size:20px;margin-bottom:20px;">', $opt['name'], '</div>');
} elseif ($opt['name'] == $name) {
$this->output(str_replace('\\', '', base64_decode($opt['code'])));
}
}
} else {
$this->output('No ads code found with this name');
}
}
}
示例12: _build_links
//.........这里部分代码省略.........
}
$item['attributes']['target'] = $link['target'] ? 'target="' . $link['target'] . '"' : null;
$item['attributes']['class'] = $link_class ? 'class="' . $link_class . '"' : '';
// attributes of anchor wrapper
$wrapper['class'] = $link['class'] ? explode(' ', $link['class']) : array();
$wrapper['children'] = $return_arr ? array() : null;
$wrapper['separator'] = $separator;
// is single ?
if ($total === 1) {
$wrapper['class'][] = 'single';
} elseif ($i === 1) {
$wrapper['class'][] = $first_class;
} elseif ($i === $total) {
$wrapper['class'][] = $last_class;
$wrapper['separator'] = '';
}
// has children ? build children
if ($link['children']) {
++$level;
if (!$max_depth or $level < $max_depth) {
$wrapper['class'][] = $more_class;
$wrapper['children'] = $this->_build_links($link['children'], $return_arr);
}
--$level;
}
// is this the link to the page that we're on?
if (preg_match('@^' . current_url() . '/?$@', $link['url']) or $link['link_type'] == 'page' and $link['is_home'] and site_url() == current_url()) {
$current_link = $link['url'];
$wrapper['class'][] = $current_class;
}
// Is this page a parent of the current page?
// Get the URI and compare
$uri_segments = explode('/', str_replace(site_url(), '', $link['url']));
foreach ($uri_segments as $k => $seg) {
if (!$seg) {
unset($uri_segments[$k]);
}
}
$short_segments = array_slice($this->uri->segment_array(), 0, count($uri_segments));
if (!array_diff($short_segments, $uri_segments)) {
$wrapper['class'][] = $parent_class;
}
// is the link we're currently working with found inside the children html?
if (!in_array($current_class, $wrapper['class']) and isset($wrapper['children']) and $current_link and (is_array($wrapper['children']) and in_array_r($current_link, $wrapper['children']) or is_string($wrapper['children']) and strpos($wrapper['children'], $current_link))) {
// that means that this link is a parent
$wrapper['class'][] = 'has_' . $current_class;
} elseif ($link['module_name'] === $this->module and !preg_match('@^' . current_url() . '/?$@', $link['url'])) {
$wrapper['class'][] = 'has_' . $current_class;
}
++$i;
if ($return_arr) {
$item['target'] =& $item['attributes']['target'];
$item['class'] =& $item['attributes']['class'];
$item['children'] = $wrapper['children'];
if ($wrapper['class'] && $item['class']) {
$item['class'] = implode(' ', $wrapper['class']) . ' ' . substr($item['class'], 7, -1);
} elseif ($wrapper['class']) {
$item['class'] = implode(' ', $wrapper['class']);
}
if ($item['target']) {
$item['target'] = substr($item['target'], 8, -1);
}
// assign attributes to level family
$output[] = $item;
} else {
$add_first_tag = $level === 0 && !in_array($this->attribute('items_only', 'true'), array('1', 'y', 'yes', 'true'));
// render and indent or only render inline?
if ($indent) {
// remove all empty values so we don't have an empty class attribute
$classes = implode(' ', array_filter($wrapper['class']));
$output .= $add_first_tag ? "<{$list_tag}>" . PHP_EOL : '';
$output .= $ident_b . '<' . $tag . ($classes > '' ? ' class="' . $classes . '">' : '>') . PHP_EOL;
$output .= $ident_c . (($level == 0 and $top == 'text' and $wrapper['children']) ? $item['title'] : anchor($item['url'], $item['title'], trim(implode(' ', $item['attributes'])))) . PHP_EOL;
if ($wrapper['children']) {
$output .= $ident_c . "<{$list_tag}>" . PHP_EOL;
$output .= $ident_c . $indent . str_replace(PHP_EOL, PHP_EOL . $indent, trim($ident_c . $wrapper['children'])) . PHP_EOL;
$output .= $ident_c . "</{$list_tag}>" . PHP_EOL;
}
$output .= $wrapper['separator'] ? $ident_c . $wrapper['separator'] . PHP_EOL : '';
$output .= $ident_b . "</{$tag}>" . PHP_EOL;
$output .= $add_first_tag ? $ident_a . "</{$list_tag}>" . PHP_EOL : '';
} else {
// remove all empty values so we don't have an empty class attribute
$classes = implode(' ', array_filter($wrapper['class']));
$output .= $add_first_tag ? "<{$list_tag}>" : '';
$output .= '<' . $tag . ($classes > '' ? ' class="' . $classes . '">' : '>');
$output .= ($level == 0 and $top == 'text' and $wrapper['children']) ? $item['title'] : anchor($item['url'], $item['title'], trim(implode(' ', $item['attributes'])));
if ($wrapper['children']) {
$output .= '<' . $list_tag . ' class="' . $dropdown_class . '">';
$output .= $wrapper['children'];
$output .= "</{$list_tag}>";
}
$output .= $wrapper['separator'];
$output .= "</{$tag}>";
$output .= $add_first_tag ? "</{$list_tag}>" : '';
}
}
}
return $output;
}
示例13: htmlspecialchars
$package_name = htmlspecialchars($item['name']);
$package = $queries->getWhere('donation_packages', array('name', '=', $package_name));
if (!count($package)) {
// No, it doesn't exist
$package_id = $item['id'];
$package_category = $item['categoryid'];
$package_description = htmlspecialchars($item['description']);
$package_price = $item['price'];
$package_url = htmlspecialchars($item['url']);
$queries->create('donation_packages', array('name' => $package_name, 'description' => $package_description, 'cost' => $package_price, 'package_id' => $package_id, 'active' => 1, 'package_order' => 0, 'category' => $package_category, 'url' => $package_url));
}
}
// Delete any packages which don't exist on the web store anymore
$packages = $queries->getWhere('donation_packages', array('id', '<>', 0));
foreach ($packages as $package) {
if (!in_array_r($package->package_id, $mm_gui['result'])) {
// It doesn't exist anymore
$queries->delete('donation_packages', array('id', '=', $package->id));
}
}
/*
* DONORS SYNC
*/
foreach ($mm_donors['result'] as $item) {
// Does it already exist in the database?
$date = date('Y-m-d H:i:s', strtotime($item['date']));
$donor_query = $queries->getWhere('buycraft_data', array('time', '=', $date));
if (count($donor_query)) {
// Already exists, we can stop now
break;
}
示例14: in_array_r
function in_array_r($needle, $haystack, $strict = true)
{
$override = apply_filters('pre_in_array_r', false, $needle, $haystack, $strict);
if ($override !== false) {
return $override;
}
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || is_array($item) && in_array_r($needle, $item, $strict)) {
return true;
}
}
return false;
}
示例15: updatecycleV3
function updatecycleV3()
{
$db_server = mysqli_connect("localhost", "root", "root", "schedule");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit;
}
$today = date('Y-m-d');
//Here's the goal of V3 - take all inactive days. then run the usual update sequence checking only if a day is a weekend or on the inactive array
$findoffdays = "SELECT daate FROM days where active = 'n';";
$offdaysresult = mysqli_query($db_server, $findoffdays);
if ($findoffdays->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$offdays_array = mysqli_fetch_all($offdaysresult, MYSQLI_NUM);
mylog(print_r($offdays_array, true));
$x = 1;
$cyc_array = array('A', 'B', 'C', 'D', 'E', 'F');
$letter = 'A';
$cyc = 0;
while ($x <= 200) {
$startdate = "2016-01-04";
$dategivenbyadmin = strtotime($startdate);
$formatteddateforcondish = date('Y-m-d', $dategivenbyadmin);
mylog("{$dategivenbyadmin} is the DATE GIVEN BY ADMIN");
$nextday = date('Y-m-d', strtotime("+ {$x} days", "{$dategivenbyadmin}"));
mylog("{$x} days after {$dategivenbyadmin} is {$nextday}");
//$activeday = checkforinactiveday($nextday);
//if it's a weekend, skip
if (date('D', strtotime("+ {$x} days", "{$dategivenbyadmin}")) === "Sun" || date('D', strtotime("+ {$x} days", "{$dategivenbyadmin}")) === "Sat") {
mylog("{$nextday} is a weekend 395");
$x = $x + 1;
} elseif (in_array_r($nextday, $offdays_array, true)) {
mylog("{$nextday} is in the {$offdays} list");
$x = $x + 1;
} else {
$letter = $cyc_array[$cyc];
//mylog("should be starting with $letter");
$cyc = $cyc == 5 ? 0 : $cyc + 1;
mylog("the cyc value for {$nextday} should be {$cyc}");
mylog("the letter value for {$nextday} should be {$letter}");
$dayquery = "UPDATE days SET cycleday = '{$letter}', daymodified = '{$today}' WHERE daate = '{$nextday}';";
mylog("update query looks like {$dayquery}");
$dayqueryresult = mysqli_query($db_server, $dayquery);
mylog('ran the inactive day query');
if ($dayqueryresult->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$x = $x + 1;
//$cyc = $cyc + 1;
}
}
}