本文整理汇总了PHP中recursive_array_search函数的典型用法代码示例。如果您正苦于以下问题:PHP recursive_array_search函数的具体用法?PHP recursive_array_search怎么用?PHP recursive_array_search使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了recursive_array_search函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recursive_array_search
function recursive_array_search($needle, $haystack)
{
foreach ($haystack as $key => $value) {
$current_key = $key;
if ($needle === $value or is_array($value) && recursive_array_search($needle, $value) !== false) {
return $current_key;
}
}
return false;
}
示例2: rename_woocoomerce
function rename_woocoomerce()
{
global $menu;
// Pinpoint menu item
$woo = recursive_array_search( 'WooCommerce', $menu );
// Validate
if( !$woo )
return;
$menu[$woo][0] = __('Orders', 'woocommerce');
}
示例3: recursive_array_search
function recursive_array_search($needle, $haystack)
{
foreach ($haystack as $key => $value) {
$current_key = $key;
if (is_array($value)) {
$val = recursive_array_search($needle, $value);
}
if ($needle === $value or $val != false and $val != NULL) {
if ($val == NULL) {
return array($current_key);
}
return array_merge(array($current_key), $val);
}
}
return false;
}
示例4: social_warfare_buttons
//.........这里部分代码省略.........
$floatOption = 'float_ignore';
} elseif ($spec_float_where == 'off' && $options['buttonFloat'] != 'float_ignore') {
$floatOption = 'floatNone';
} elseif ($options['float'] && is_singular() && $options['float_location_' . $postType] == 'on') {
$floatOption = 'float' . ucfirst($options['floatOption']);
} else {
$floatOption = 'floatNone';
}
// Disable the plugin on feeds, search results, and non-published content
if (!is_feed() && !is_search() && get_post_status($postID) == 'publish') {
// Acquire the social stats from the networks
if (isset($array['url'])) {
$buttonsArray['url'] = $array['url'];
} else {
$buttonsArray['url'] = get_permalink($postID);
}
// Fetch the share counts
$buttonsArray['shares'] = get_social_warfare_shares($postID);
// Pass the swp_options into the array so we can pass it into the filter
$buttonsArray['options'] = $options;
// Customize which buttosn we're going to display
if (isset($array['buttons'])) {
// Fetch the global names and keys
$swp_options = array();
$swp_available_options = apply_filters('swp_options', $swp_options);
$available_buttons = $swp_available_options['options']['swp_display']['buttons']['content'];
// Split the comma separated list into an array
$button_set_array = explode(',', $array['buttons']);
// Match the names in the list to their appropriate system-wide keys
foreach ($button_set_array as $button) {
// Trim the network name in case of white space
$button = trim($button);
// Convert the names to their systme-wide keys
if (recursive_array_search($button, $available_buttons)) {
$key = recursive_array_search($button, $available_buttons);
// Store the result in the array that gets passed to the HTML generator
$buttonsArray['buttons'][$key] = $button;
// Declare a default share count of zero. This will be overriden later
if (!isset($buttonsArray['shares'][$key])) {
$buttonsArray['shares'][$key] = 0;
}
}
}
// Manually turn the total shares on or off
if (array_search('Total', $button_set_array)) {
$buttonsArray['buttons']['totes'] = 'Total';
}
}
// Setup the buttons array to pass into the 'swp_network_buttons' hook
$buttonsArray['count'] = 0;
$buttonsArray['totes'] = 0;
if ($buttonsArray['options']['totes'] && $buttonsArray['shares']['totes'] >= $buttonsArray['options']['minTotes'] && !isset($array['buttons']) || isset($buttonsArray['buttons']) && isset($buttonsArray['buttons']['totes']) && $buttonsArray['totes'] >= $options['minTotes']) {
++$buttonsArray['count'];
}
$buttonsArray['resource'] = array();
$buttonsArray['postID'] = $postID;
// Disable the subtitles plugin to avoid letting them inject their subtitle into our share titles
if (is_plugin_active('subtitles/subtitles.php') && class_exists('Subtitles')) {
remove_filter('the_title', array(Subtitles::getinstance(), 'the_subtitle'), 10, 2);
}
// This array will contain the HTML for all of the individual buttons
$buttonsArray = apply_filters('swp_network_buttons', $buttonsArray);
// Create the social panel
$assets = '<div class="nc_socialPanel swp_' . $options['visualTheme'] . ' swp_d_' . $options['dColorSet'] . ' swp_i_' . $options['iColorSet'] . ' swp_o_' . $options['oColorSet'] . '" data-position="' . $options['location_post'] . '" data-float="' . $floatOption . '" data-count="' . $buttonsArray['count'] . '" data-floatColor="' . $options['floatBgColor'] . '" data-scale="' . $options['buttonSize'] . '" data-align="' . $options['buttonFloat'] . '">';
// Setup the total shares count if it's on the left
if ($options['totes'] && $options['swTotesFormat'] == 'totesAltLeft' && $buttonsArray['totes'] >= $options['minTotes'] && !isset($array['buttons']) || $options['swTotesFormat'] == 'totesAltLeft' && isset($array['buttons']) && isset($array['buttons']['totes']) && $buttonsArray['totes'] >= $options['minTotes']) {
示例5: theSearchResultsShouldIncludeTheHellenicPoliceDataset
/**
* @Given /^the search results should include the hellenic-police dataset$/
*/
public function theSearchResultsShouldIncludeTheHellenicPoliceDataset()
{
$result = $this->result->toArray();
PHPUnit_Framework_Assert::assertTrue(recursive_array_search('hellenic-police', $result['result']));
}
示例6: foreach
// subscore 3 - common directors subscore
if (strcmp($selected_radio, "common_director_slider") == 0) {
foreach ($commonDirectors as $movie1 => $value) {
// $value is an array of movie2 => list_of_genres
$movie1_index = recursive_array_search($movie1, $movies);
foreach ($value as $movie2 => $directors) {
// compute score for the <movie1, movie2> pair
//$sub_score = count($genres) * $common_genre_slider_value;
//$sub_score = count($genres) / $max_number_common_genres;
// UPDATE: this logic has moved to UI logic - we now send every link
//$sub_score = (count($directors) >= $common_director_slider_value) ? count($directors) : 0;
$sub_score = count($directors);
if ($sub_score == 0) {
continue;
}
$movie2_index = recursive_array_search($movie2, $movies);
if (!isset($scores[$movie1_index][$movie2_index])) {
$scores[$movie1_index][$movie2_index] = 0;
}
$scores[$movie1_index][$movie2_index] += $sub_score;
}
}
}
$threshold_score = $max_score * $score_filter_slider_value / 100;
//var_dump($max_score);
//var_dump($threshold_score);
$links = array();
foreach ($scores as $movie1_index => $value) {
foreach ($value as $movie2_index => $score) {
// if ($score < $threshold_score) continue;
$links[] = array('source' => $movie1_index, 'target' => $movie2_index, 'common_elements' => $score);
示例7: delete_customer
/**
* Delete from the customer database object
*
* @access public
* @param int $user_id
* @param array $customer_data
* @return mixed
*/
public static function delete_customer($user_id, $customer_data)
{
global $s4wc;
// Sample structure of $customer_data
// $customer_data = array(
// 'card' => 'card_104FP72XTgyB3Fd3Pw9jM2Xh'
// );
if (!isset($customer_data)) {
return false;
}
// Grab the current object out of the database and return a useable array
$currentObject = maybe_unserialize(get_user_meta($user_id, $s4wc->settings['stripe_db_location'], true));
// If the object exists already, do work
if ($currentObject) {
$newObject = $currentObject;
// If a card id is passed, delete the card from the database object
if (isset($customer_data['card'])) {
unset($newObject['cards'][recursive_array_search($customer_data['card'], $newObject['cards'])]);
}
// Add to the database
return update_user_meta($user_id, $s4wc->settings['stripe_db_location'], $newObject);
} else {
return false;
}
}
示例8: errMod
# | Email developer@artlantis.net |
# | Web http://www.artlantis.net |
# +------------------------------------------------------------------------+
$pgnt = true;
if ($page_main == 'organizations') {
if (!permCheck($p)) {
echo errMod(letheglobal_you_are_not_authorized_to_view_this_page, 'danger');
} else {
/* Requests */
if (!isset($_GET['ID']) || !is_numeric($_GET['ID'])) {
$ID = 0;
} else {
$ID = intval($_GET['ID']);
}
/* Mod Settings */
$mod_confs = $lethe_modules[recursive_array_search('lethe.organizations', $lethe_modules)];
$pg_title = $mod_confs['title'];
$pg_nav_buts = '';
$errText = '';
/* Demo Check */
if (!isDemo('addUser,editUser')) {
$errText = errMod(letheglobal_demo_mode_active, 'danger');
}
?>
<?php
if ($page_sub == 'organization') {
include_once 'pg.organization.php';
} else {
if ($page_sub == 'users') {
include_once 'pg.users.php';
示例9: get_question_label
private function get_question_label($cms_question)
{
$this->load->helper('array');
$this->config->load('form_validation');
$cms_rules = $this->config->item('cms_rules');
$key = recursive_array_search($cms_question, $cms_rules);
if ($key === FALSE) {
// Try a second time, looking for an array
$key = recursive_array_search("{$cms_question}[]", $cms_rules);
if ($key === FALSE) {
return 'Undefined';
}
}
return $cms_rules[$key]['label'];
}
示例10: errMod
/* | Lethe Newsletter & Mailing System | */
/* | Copyright (c) Artlantis Design Studio 2014. All rights reserved. | */
/* | Version 2.0 | */
/* | Last modified 20.01.2015 | */
/* | Email developer@artlantis.net | */
/* | Web http://www.artlantis.net | */
/* +------------------------------------------------------------------------+ */
$pgnt = true;
if ($page_main == 'autoresponder') {
if (!permCheck($p)) {
echo errMod(letheglobal_you_are_not_authorized_to_view_this_page, 'danger');
} else {
$ID = !isset($_GET['ID']) || !is_numeric($_GET['ID']) ? 0 : intval($_GET['ID']);
/* Mod Settings */
include_once 'mod.common.php';
$mod_confs = $lethe_modules[recursive_array_search('lethe.autoresponder', $lethe_modules)];
$pg_title = $mod_confs['title'];
$pg_nav_buts = '';
$errText = '';
/* Demo Check */
if (!isDemo('addAutoresponder,editAutoresponder')) {
$errText = errMod(letheglobal_demo_mode_active, 'danger');
}
/* Source Limit */
$sourceLimit = calcSource(set_org_id, 'autoresponder');
/* Default Values */
$ar_action = !isset($_POST['ar_action']) || !is_numeric($_POST['ar_action']) || $_POST['ar_action'] == 999 ? 999 : intval($_POST['ar_action']);
$ar_time = 1;
$ar_time_type = 'MINUTE';
$ar_start_date = date('Y-m-d H:i:s');
$ar_end_date = strtotime(date('Y-m-d H:i:s'));
示例11: decodeState
function decodeState($dpt, $data)
{
$state = dptSelectDecode($dpt, $data);
$t = All_DPT();
$type = recursive_array_search($dpt, $t);
switch ($type) {
case "Boolean":
return $t[$type][$dpt]["Valeurs"][$state];
break;
case "8BitEncAbsValue":
return $t[$type][$dpt]["Valeurs"][$state];
break;
default:
return $state . " " . $t[$type][$dpt]["Unite"];
break;
}
}
示例12: get_data
// //$rows[] = $r;
//
// $common_cast[ $r['movie1_title'] ][ $r['movie2_title'] ] [] = $r['actor_name'];
//
//}
//
//echo json_encode($common_cast);
//mysql_close($con);
$movieTitle = $_GET['movieTitle'];
require "include/php/helper_functions.php";
$movieData = get_data();
$movies = $movieData['movies'];
$commonCast = $movieData['commonCast'];
$commonGenres = $movieData['commonGenres'];
$commonDirectors = $movieData['commonDirectors'];
$movie_index = recursive_array_search($movieTitle, $movies);
unset($movieData['movies']);
// don't send information about all the movies
$movieData['movie_data'] = $movies[$movie_index];
// send common cast to this movie
$movieData['commonCast'] = $commonCast[$movieTitle];
// send common directors to this movie
$movieData['commonDirectors'] = $commonDirectors[$movieTitle];
//var_dump($movieData['commonDirectors']);
// but the genres are filtered because they are too many => not useful information anymore
// we will the genres of the movies found in (commonCast or commonDirectors)
$commonGenres = $commonGenres[$movieTitle];
$finalCommonGenres = array();
if (is_array($movieData['commonCast'])) {
foreach ($movieData['commonCast'] as $movie => $actors) {
if ($commonGenres[$movie]) {