本文整理汇总了PHP中getelementindexinarray函数的典型用法代码示例。如果您正苦于以下问题:PHP getelementindexinarray函数的具体用法?PHP getelementindexinarray怎么用?PHP getelementindexinarray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getelementindexinarray函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: big_calendar_list_widget
function big_calendar_list_widget()
{
require_once "frontend_functions.php";
global $wpdb;
$widget = isset($_GET['widget']) && (int) $_GET['widget'] ? (int) $_GET['widget'] : 0;
$many_sp_calendar = isset($_GET['many_sp_calendar']) && is_numeric(esc_html($_GET['many_sp_calendar'])) ? esc_html($_GET['many_sp_calendar']) : 1;
$calendar_id = isset($_GET['calendar']) ? (int) $_GET['calendar'] : '';
$theme_id = isset($_GET['theme_id']) ? (int) $_GET['theme_id'] : 1;
$date = isset($_GET['date']) && IsDate_inputed(esc_html($_GET['date'])) ? esc_html($_GET['date']) : '';
$view_select = isset($_GET['select']) ? esc_html($_GET['select']) : 'month,';
$path_sp_cal = isset($_GET['cur_page_url']) ? esc_html($_GET['cur_page_url']) : '';
$site_url = get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php';
///////////////////////////////////////////////////////////////////////////////////
if (isset($_GET['cat_id'])) {
$cat_id = $_GET['cat_id'];
} else {
$cat_id = "";
}
if (isset($_GET['cat_ids'])) {
$cat_ids = $_GET['cat_ids'];
} else {
$cat_ids = "";
}
if ($cat_ids == '') {
$cat_ids .= $cat_id . ',';
} else {
$cat_ids .= ',' . $cat_id . ',';
}
$cat_ids = substr($cat_ids, 0, -1);
function getelementcountinarray($array, $element)
{
$t = 0;
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t++;
}
}
return $t;
}
function getelementindexinarray($array, $element)
{
$t = '';
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t .= $i . ',';
}
}
return $t;
}
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
$theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_widget_theme WHERE id=%d', $theme_id));
$weekstart = $theme->week_start_day;
$bg = '#' . str_replace('#', '', $theme->header_bgcolor);
$bg_color_selected = '#' . str_replace('#', '', $theme->bg_color_selected);
$color_arrow = '#' . str_replace('#', '', $theme->arrow_color);
$evented_color = '#' . str_replace('#', '', $theme->text_color_this_month_evented);
$evented_color_bg = '#' . str_replace('#', '', $theme->bg_color_this_month_evented);
$sun_days = '#' . str_replace('#', '', $theme->text_color_sun_days);
$text_color_other_months = '#' . str_replace('#', '', $theme->text_color_other_months);
$text_color_this_month_unevented = '#' . str_replace('#', '', $theme->text_color_this_month_unevented);
$text_color_month = '#' . str_replace('#', '', $theme->text_color_month);
$color_week_days = '#' . str_replace('#', '', $theme->text_color_week_days);
$text_color_selected = '#' . str_replace('#', '', $theme->text_color_selected);
$border_day = '#' . str_replace('#', '', $theme->border_day);
$calendar_width = $theme->width;
$calendar_bg = '#' . str_replace('#', '', $theme->footer_bgcolor);
$weekdays_bg_color = '#' . str_replace('#', '', $theme->weekdays_bg_color);
$weekday_su_bg_color = '#' . str_replace('#', '', $theme->su_bg_color);
$cell_border_color = '#' . str_replace('#', '', $theme->cell_border_color);
$year_font_size = $theme->year_font_size;
$year_font_color = '#' . str_replace('#', '', $theme->year_font_color);
$year_tabs_bg_color = '#' . str_replace('#', '', $theme->year_tabs_bg_color);
$font_year = $theme->font_year;
$font_month = $theme->font_month;
$font_day = $theme->font_day;
$font_weekday = $theme->font_weekday;
$show_cat = 1;
$ev_title_color = '#' . str_replace('#', '', $theme->ev_title_color);
$popup_width = $theme->popup_width;
$popup_height = $theme->popup_height;
$show_event_bgcolor = '#' . str_replace('#', '', $theme->show_event_bgcolor);
__('January', 'sp_calendar');
__('February', 'sp_calendar');
__('March', 'sp_calendar');
__('April', 'sp_calendar');
__('May', 'sp_calendar');
//.........这里部分代码省略.........
示例2: getcategorycolor
function getcategorycolor($ev_day, $ev_month, $ev_year, $i, $eventIDs)
{
$db = JFactory::getDBO();
$calendar_id = JRequest::getVar('calendar');
$cat_id = JRequest::getVar('cat_id');
$cat_ids = JRequest::getVar('cat_ids');
if (isset($eventIDs[$i])) {
$ev_ids = explode('<br>', $eventIDs[$i]);
array_pop($ev_ids);
$ev_ids_inline = implode(',', $ev_ids);
if ($cat_ids == '') {
$cat_ids .= $cat_id . ',';
} else {
$cat_ids .= ',' . $cat_id . ',';
}
$cat_ids = substr($cat_ids, 0, -1);
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
if ($cat_ids != '') {
$query = "SELECT DISTINCT sec.color FROM #__spidercalendar_event AS se JOIN \n\t\t#__spidercalendar_event_category AS sec ON se.category=sec.id WHERE se.published='1' AND sec.published='1' AND se.calendar=" . $calendar_id . " AND se.id IN (" . $ev_ids_inline . ") ";
} else {
$query = "SELECT DISTINCT sec.color FROM #__spidercalendar_event AS se JOIN \n\t\t#__spidercalendar_event_category AS sec ON se.category=sec.id WHERE se.published='1' AND sec.published='1' AND se.calendar=" . $calendar_id . " AND se.id IN (" . $ev_ids_inline . ") ";
}
$db->setQuery($query);
$rows = $db->loadObjectList();
return $rows;
}
}
示例3: big_calendar_day
function big_calendar_day()
{
require_once "frontend_functions.php";
global $wpdb;
$widget = isset($_GET['widget']) && (int) $_GET['widget'] ? (int) $_GET['widget'] : 0;
$many_sp_calendar = isset($_GET['many_sp_calendar']) && is_numeric(esc_html($_GET['many_sp_calendar'])) ? esc_html($_GET['many_sp_calendar']) : 1;
$calendar_id = isset($_GET['calendar']) ? (int) $_GET['calendar'] : '';
$theme_id = isset($_GET['theme_id']) ? (int) $_GET['theme_id'] : 1;
$date = isset($_GET['date']) && IsDate_inputed(esc_html($_GET['date'])) ? esc_html($_GET['date']) : '';
$view_select = isset($_GET['select']) ? esc_html($_GET['select']) : 'month,';
$path_sp_cal = isset($_GET['cur_page_url']) ? esc_html($_GET['cur_page_url']) : '';
$site_url = get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php';
///////////////////////////////////////////////////////////////////////////////////
if (isset($_GET['cat_id'])) {
$cat_id = $_GET['cat_id'];
} else {
$cat_id = "";
}
if (isset($_GET['cat_ids'])) {
$cat_ids = $_GET['cat_ids'];
} else {
$cat_ids = "";
}
if ($cat_ids == '') {
$cat_ids .= $cat_id . ',';
} else {
$cat_ids .= ',' . $cat_id . ',';
}
$cat_ids = substr($cat_ids, 0, -1);
function getelementcountinarray($array, $element)
{
$t = 0;
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t++;
}
}
return $t;
}
function getelementindexinarray($array, $element)
{
$t = '';
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t .= $i . ',';
}
}
return $t;
}
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
$theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_theme WHERE id=%d', $theme_id));
$cal_width = $theme->width;
$bg_top = '#' . str_replace('#', '', $theme->bg_top);
$bg_bottom = '#' . str_replace('#', '', $theme->bg_bottom);
$border_color = '#' . str_replace('#', '', $theme->border_color);
$text_color_year = '#' . str_replace('#', '', $theme->text_color_year);
$text_color_month = '#' . str_replace('#', '', $theme->text_color_month);
$color_week_days = '#' . str_replace('#', '', $theme->text_color_week_days);
$text_color_other_months = '#' . str_replace('#', '', $theme->text_color_other_months);
$text_color_this_month_unevented = '#' . str_replace('#', '', $theme->text_color_this_month_unevented);
$evented_color = '#' . str_replace('#', '', $theme->text_color_this_month_evented);
$evented_color_bg = '#' . str_replace('#', '', $theme->bg_color_this_month_evented);
$color_arrow_year = '#' . str_replace('#', '', $theme->arrow_color_year);
$color_arrow_month = '#' . str_replace('#', '', $theme->arrow_color_month);
$sun_days = '#' . str_replace('#', '', $theme->text_color_sun_days);
$event_title_color = '#' . str_replace('#', '', $theme->event_title_color);
$current_day_border_color = '#' . str_replace('#', '', $theme->current_day_border_color);
$cell_border_color = '#' . str_replace('#', '', $theme->cell_border_color);
$cell_height = $theme->cell_height;
$popup_width = $theme->popup_width;
$popup_height = $theme->popup_height;
$number_of_shown_evetns = $theme->number_of_shown_evetns;
$sundays_font_size = $theme->sundays_font_size;
$other_days_font_size = $theme->other_days_font_size;
$weekdays_font_size = $theme->weekdays_font_size;
$border_width = $theme->border_width;
$top_height = $theme->top_height;
$bg_color_other_months = '#' . str_replace('#', '', $theme->bg_color_other_months);
$sundays_bg_color = '#' . str_replace('#', '', $theme->sundays_bg_color);
$weekdays_bg_color = '#' . str_replace('#', '', $theme->weekdays_bg_color);
$weekstart = $theme->week_start_day;
$weekday_sunday_bg_color = '#' . str_replace('#', '', $theme->weekday_sunday_bg_color);
$border_radius = $theme->border_radius;
$border_radius2 = $border_radius - $border_width;
$week_days_cell_height = $theme->week_days_cell_height;
$year_font_size = $theme->year_font_size;
//.........这里部分代码省略.........
示例4: getelementindexinarray
return $t;
}
function getelementindexinarray($array, $element)
{
$t = '';
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t .= $i . ',';
}
}
return $t;
}
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
/*$module = &JModuleHelper::getModule('spidercalendar');
$moduleParams = new JParameter($module->params);
print_r($module);*/
示例5: php_getdays_for_three_months
function php_getdays_for_three_months($calendar, $date, $months, $theme_id, $widget)
{
global $wpdb;
$year = substr($date, 0, 4);
$month = substr($date, 5, 2);
$months_array = explode(',', $months);
if ($widget) {
$show_time = 0;
} else {
$theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_theme WHERE id=%d', $theme_id));
$show_time = $theme->show_time;
}
if (isset($_GET['cat_id'])) {
$cat_id = $_GET['cat_id'];
} else {
$cat_id = "";
}
if (isset($_GET['cat_ids'])) {
$cat_ids = $_GET['cat_ids'];
} else {
$cat_ids = "";
}
if ($cat_ids == '') {
$cat_ids .= $cat_id . ',';
} else {
$cat_ids .= ',' . $cat_id . ',';
}
$cat_ids = substr($cat_ids, 0, -1);
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
$row = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "spidercalendar_calendar where published=1 and id=%d", $calendar));
if ($row->time_format == 0) {
$order_by = "ORDER BY " . $wpdb->prefix . "spidercalendar_event.time ASC";
} else {
$order_by = " ORDER BY STR_TO_DATE( SUBSTRING( time, 1, 7 ) , '%h:%i%p' )";
}
if ($cat_ids != '' and preg_match("/^[0-9\\,]+\$/", $cat_ids)) {
$query = $wpdb->prepare("SELECT " . $wpdb->prefix . "spidercalendar_event.*,\t" . $wpdb->prefix . "spidercalendar_event_category.color from " . $wpdb->prefix . "spidercalendar_event JOIN " . $wpdb->prefix . "spidercalendar_event_category ON " . $wpdb->prefix . "spidercalendar_event.category = " . $wpdb->prefix . "spidercalendar_event_category.id \twhere " . $wpdb->prefix . "spidercalendar_event_category.published=1 and " . $wpdb->prefix . "spidercalendar_event.category IN (" . $cat_ids . ") and " . $wpdb->prefix . "spidercalendar_event.published=1 and ( ( (date<=%s\tor date like %s) and (date_end>=%s ) or date_end='0000-00-00' ) or ( date_end is Null and date like %s ) ) and calendar=%d ", substr($date, 0, 7) . '-01', substr($date, 0, 7) . "%", substr($date, 0, 7) . '-01', substr($date, 0, 7) . "%", $calendar);
} else {
$query = $wpdb->prepare("SELECT * from " . $wpdb->prefix . "spidercalendar_event where published=1 and ((date_end>=%s) or (date_end=%s)) and calendar=%d", "" . substr($date, 0, 7) . "-01", "0000-00-00", $calendar);
}
$rows = $wpdb->get_results($query . " " . $order_by);
$all_id_array = array();
$all_array_days = array();
$all_array_days1 = array();
$all_title = array();
$all_ev_ids = array();
$s = count($rows);
foreach ($months_array as $month) {
$id_array = array();
$array_days = array();
$array_days1 = array();
$title = array();
$ev_ids = array();
for ($i = 1; $i <= $s; $i++) {
if ($rows[$i - 1]->repeat_method != 'no_repeat' and $rows[$i - 1]->date_end == '0000-00-00') {
$d_end = (int) substr($rows[$i - 1]->date, 0, 4) + 40 . substr($rows[$i - 1]->date, 4, 6);
} else {
$d_end = $rows[$i - 1]->date_end;
}
$date_month = (int) substr($rows[$i - 1]->date, 5, 2);
$date_end_month = (int) substr($d_end, 5, 2);
$date_day = (int) substr($rows[$i - 1]->date, 8, 2);
$date_end_day = (int) substr($d_end, 8, 2);
$date_year_month = (int) (substr($rows[$i - 1]->date, 0, 4) . substr($rows[$i - 1]->date, 5, 2));
$date_end_year_month = (int) (substr($d_end, 0, 4) . substr($d_end, 5, 2));
$year_month = (int) ($year . $month);
$repeat = $rows[$i - 1]->repeat;
if ($repeat == "") {
$repeat = 1;
}
$start_date = $rows[$i - 1]->date;
$weekly = $rows[$i - 1]->week;
$weekly_array = explode(',', $weekly);
$date_days = array();
$weekdays_start = array();
$weekdays = array();
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// NO Repeat /////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($rows[$i - 1]->repeat_method == 'no_repeat') {
$date_days[] = $date_day;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////// Repeat Daily /////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($rows[$i - 1]->repeat_method == 'daily') {
$t = php_daysDifference($rows[$i - 1]->date, $d_end);
//.........这里部分代码省略.........
示例6: big_calendar_month
function big_calendar_month()
{
require_once "frontend_functions.php";
global $wpdb;
$widget = isset($_GET['widget']) && (int) $_GET['widget'] ? (int) $_GET['widget'] : 0;
$many_sp_calendar = isset($_GET['many_sp_calendar']) && is_numeric(esc_html($_GET['many_sp_calendar'])) ? esc_html($_GET['many_sp_calendar']) : 1;
$calendar_id = isset($_GET['calendar']) ? (int) $_GET['calendar'] : '';
$theme_id = isset($_GET['theme_id']) ? (int) $_GET['theme_id'] : 13;
$date = isset($_GET['date']) && IsDate_inputed(esc_html($_GET['date'])) ? esc_html($_GET['date']) : '';
$view_select = isset($_GET['select']) ? esc_html($_GET['select']) : 'month,';
$path_sp_cal = isset($_GET['cur_page_url']) ? esc_html($_GET['cur_page_url']) : '';
$query = "SELECT * FROM " . $wpdb->prefix . "spidercalendar_calendar where id=" . $calendar_id . "";
$calendar = $wpdb->query($query);
$site_url = get_option("home", get_site_url()) . '/wp-admin/admin-ajax.php';
///////////////////////////////////////////////////////////////////////////////////
if (isset($_GET['cat_id'])) {
$cat_id = $_GET['cat_id'];
} else {
$cat_id = "";
}
if (isset($_GET['cat_ids'])) {
$cat_ids = $_GET['cat_ids'];
} else {
$cat_ids = "";
}
if ($cat_ids == '') {
$cat_ids .= $cat_id . ',';
} else {
$cat_ids .= ',' . $cat_id . ',';
}
$cat_ids = substr($cat_ids, 0, -1);
function getelementcountinarray($array, $element)
{
$t = 0;
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t++;
}
}
return $t;
}
function getelementindexinarray($array, $element)
{
$t = '';
for ($i = 0; $i < count($array); $i++) {
if ($element == $array[$i]) {
$t .= $i . ',';
}
}
return $t;
}
$cat_ids_array = explode(',', $cat_ids);
if ($cat_id != '') {
if (getelementcountinarray($cat_ids_array, $cat_id) % 2 == 0) {
$index_in_line = getelementindexinarray($cat_ids_array, $cat_id);
$index_array = explode(',', $index_in_line);
array_pop($index_array);
for ($j = 0; $j < count($index_array); $j++) {
unset($cat_ids_array[$index_array[$j]]);
}
$cat_ids = implode(',', $cat_ids_array);
}
} else {
$cat_ids = substr($cat_ids, 0, -1);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
$theme = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'spidercalendar_theme WHERE id=%d', $theme_id));
$cal_width = $theme->width;
$bg_top = '#' . str_replace('#', '', $theme->bg_top);
$bg_bottom = '#' . str_replace('#', '', $theme->bg_bottom);
$border_color = '#' . str_replace('#', '', $theme->border_color);
$text_color_year = '#' . str_replace('#', '', $theme->text_color_year);
$text_color_month = '#' . str_replace('#', '', $theme->text_color_month);
$color_week_days = '#' . str_replace('#', '', $theme->text_color_week_days);
$text_color_other_months = '#' . str_replace('#', '', $theme->text_color_other_months);
$text_color_this_month_unevented = '#' . str_replace('#', '', $theme->text_color_this_month_unevented);
$evented_color = '#' . str_replace('#', '', $theme->text_color_this_month_evented);
$evented_color_bg = '#' . str_replace('#', '', $theme->bg_color_this_month_evented);
$color_arrow_year = '#' . str_replace('#', '', $theme->arrow_color_year);
$color_arrow_month = '#' . str_replace('#', '', $theme->arrow_color_month);
$sun_days = '#' . str_replace('#', '', $theme->text_color_sun_days);
$event_title_color = '#' . str_replace('#', '', $theme->event_title_color);
$current_day_border_color = '#' . str_replace('#', '', $theme->current_day_border_color);
$cell_border_color = '#' . str_replace('#', '', $theme->cell_border_color);
$cell_height = $theme->cell_height;
$popup_width = $theme->popup_width;
$popup_height = $theme->popup_height;
$number_of_shown_evetns = $theme->number_of_shown_evetns;
$sundays_font_size = $theme->sundays_font_size;
$other_days_font_size = $theme->other_days_font_size;
$weekdays_font_size = $theme->weekdays_font_size;
$border_width = $theme->border_width;
$top_height = $theme->top_height;
$bg_color_other_months = '#' . str_replace('#', '', $theme->bg_color_other_months);
$sundays_bg_color = '#' . str_replace('#', '', $theme->sundays_bg_color);
$weekdays_bg_color = '#' . str_replace('#', '', $theme->weekdays_bg_color);
$weekstart = $theme->week_start_day;
$weekday_sunday_bg_color = '#' . str_replace('#', '', $theme->weekday_sunday_bg_color);
$border_radius = $theme->border_radius;
$border_radius2 = $border_radius - $border_width;
//.........这里部分代码省略.........