$start_length){ $prioritize_end = true; } }else{ $prioritize_end = false; } if($prioritize_end){ // reversed priority - find end needle first if it's more specific $pos_end=strpos($string, $end); $pos_start = strrpos( strstr($string, $end, true ), $start ); $occurence_search = substr($string, $pos_end, $end_length ); }else{ $pos_start=strpos($string, $start ); $pos_end=strpos($string, $end, $pos_start); $occurence_search = substr($string, $pos_start, $start_length ); } // get substring $substring_length = $pos_end - $pos_start + $end_length; $substring = substr($string, $pos_start, $substring_length ); //echo $substring; /** * count occurrence **/ $pos_end_element = $pos_end + $end_length-1; $occurences = substr_count($string, $occurence_search); $occ_arr = []; $substrings = [ 'start'=>$pos_start, 'end'=>$pos_end, 'end_off'=>$pos_end_element, 'offset'=>$pos_end_element, 'substr' => $substring, 'occurrance_search' => $occurence_search, 'occurrence_count' => $occurences, 'prioritize_end'=>json_decode($prioritize_end, true) ]; return $substrings; } } function findSubstringsAll($string, $start, $end ){ $occ_arr = []; $search = findSubstring($string, $start, $end, 0); //print_r($search); $substr_occurences = $search['occurrence_count']; $substr_first = $search['substr']; $substr_offset = $search['end_off']; $occ_arr[] = $substr_first; /** * loop through occurrences **/ $substr = ''; for($i=0; $i<$substr_occurences-1; $i++){ $search = findSubstring($string, $start, $end, $substr_offset ); //print_r($search); $substr = $search['substr']; $occ_arr[] = $search['substr']; $substr_offset += $search['end_off']; } return $occ_arr; } function embedsToShortcodes($string){ $youtubeEmbeds = findSubstringsAll($string, '

https://www.youtube.com', '

'); $youtubeEmbeds_short = findSubstringsAll($string, '

https://youtu.be', '

'); $vimeoEmbeds = findSubstringsAll($string, '

https://vimeo.com', '

'); $mp4Embeds = findSubstringsAll($string, '

http', '.mp4

'); $mp3Embeds = findSubstringsAll($string, '

http', '.mp3

'); $allEmbeds = array_merge($youtubeEmbeds, $youtubeEmbeds_short, $vimeoEmbeds, $mp4Embeds, $mp3Embeds ); //print_r($youtubeEmbeds); $find = $allEmbeds; $replace = []; foreach($allEmbeds as $index=>$substr){ $mediaType =''; $format = ''; switch ($substr){ case strpos($substr, 'youtube')!==false || strpos($substr, 'youtu.be')!==false: $mediaType ='youtube'; break; case strpos($substr, 'vimeo')!==false : $mediaType ='vimeo'; break; case strpos($substr, '.mp4')!==false : $mediaType ='mp4'; break; case strpos($substr, '.mp3')!==false : $mediaType ='mp3'; break; } if($mediaType=='youtube' || $mediaType=='vimeo'){ $format = 'format="16-9"'; } $substr_shortcoded = str_replace( [ '

', '

' ], ['

[media url="', '" '.$format.' type="'.$mediaType.'"]

' ], $substr); $replace[]= $substr_shortcoded; } $string = str_replace($find, $replace, $string); return $string; } function remove_utf8_bom($string){ $string = str_replace("\xEF\xBB\xBF",'',$str); return $string; } function inlineString($text){ $find = array( "\t", "\r", "\n", '
', ' ' ); $replace = array( "", "", "", ', ', ' ' ); $text = strip_tags(str_replace($find, $replace, $text)); return $text; } function stripWhite($text){ $find = array( "\t", "\r", "\n", ); $replace = array( "", "", "", ); $text = str_replace($find, $replace, $text); return $text; } ?> $value) { $sorter[$index] = $value[$key]; } asort($sorter); foreach ($sorter as $index => $value) { $sortedArray[$index] = $array[$index]; } if ($order == 'desc') { $sortedArray = array_reverse($sortedArray, true); } $array = $sortedArray; return $array; } function get_column_average_json($array, $excluded, $best, $selected_col = []) { $val_array = []; $total = count($array) - 1; foreach ($array as $row_index => $row) { foreach ($row as $column_index => $col) { if (!in_array($column_index, $excluded)) { if (is_numeric($col) && $col > 0 && $column_index != '__') { $val_array[$column_index][] = $col; } } } } $cat_count = count($val_array); $average_out = ''; $average_total = 0; $selected_col = isset($selected_col) ? $selected_col : (isset($_GET['col_select']) ? $_GET['col_select'] : ''); $title = $selected_col ? strtolower($array[1][$selected_col]) : ''; if (!$title) { return false; } $obj = []; $obj[$title] = [ 'total' => $total, 'average_total' => '', 'average_summary' => '' ]; foreach ($val_array as $row_index => $row) { if (!in_array($row_index, $excluded)) { $val_num = 0; $val_total = count($row); foreach ($row as $column_index => $val) { $val_num += $val; } $average_val = round(($val_num / $val_total), 1); $average_total += $average_val; $average_val_class = 'average-ok'; if ($average_val < 3) { $average_val_class = 'average_low'; } if ($average_val >= 4) { $average_val_class = 'average_high'; } /* $obj[$title][$row_index] = [ 'average' => $average_val, 'best' => $best ]; */ $obj[$title][$row_index] = $average_val; } } //print_r('$val_array'); //print_r("\n"); //print_r($val_array); //print_r($cat_count); if ($cat_count > 0) { //print_r('is zero'); //print_r($average_total); //print_r($val_array); $averrage_summary = round($average_total / $cat_count, 1); //print_r($average_total); $obj[$title]['average_total'] = $averrage_summary; $obj[$title]['average_summary'] = $average_val_class; } return $obj; } function get_column_average($array, $excluded, $best) { $average_out = ''; $val_array = []; $total = count($array) - 1; foreach ($array as $row_index => $row) { foreach ($row as $column_index => $col) { if (!in_array($column_index, $excluded)) { if (is_numeric($col) && $col > 0 && $column_index != '__') { $val_array[$column_index][] = $col; } } } } $val_average = []; $cat_count = count($val_array); //print_h($val_array); $average_out = ''; $average_total = 0; $averrage_summary = 0; foreach ($val_array as $row_index => $row) { $val_num = 0; $val_total = count($row); foreach ($row as $column_index => $val) { $val_num += $val; } $average_val = round(($val_num / $val_total), 1); $average_total += $average_val; $average_val_class = 'average-ok'; if ($average_val < 3) { $average_val_class = 'average_low'; } if ($average_val >= 4) { $average_val_class = 'average_high'; } $averrage_summary = round($average_total / $cat_count, 1); $average_out .= ' ' . $row_index . ': ' . $average_val . '/' . $best . ' '; } /* $average_out = '

'.$average_total.' '.$cat_count.'

'; $average_out .= $average_total."
"; $average_out .= ($average_total/($cat_count*5)); */ $selected_col = ''; $average_title = 'Alle'; $average_out_html = ''; if (isset($_GET['col_select']) && $_GET['col_select']) { $selected_col = $_GET['col_select']; $average_title = '' . $array[1][$selected_col] . ''; } //$average_out_html .= '

'.$average_total.' '.$cat_count.'

'; $average_out_html .= '

' . $average_title . ' :

' . $average_out . '

'; //print_r($val_array); return $average_out_html; } function get_array_columns($array) { $array_columns = []; foreach ($array as $row_index => $row) { //$array_columns[$row_index]=$row; foreach ($row as $column_name => $column) { $array_columns[$column_name] = $column_name; } } return $array_columns; } function reorder_columns($array, $array_columns) { $array_normalized = []; $array_col_array = []; /// create empty associative array keys foreach ($array_columns as $col_name) { $array_col_array[$col_name] = ''; } foreach ($array as $row_index => $row) { $array_normalized[$row_index] = $array_col_array; /// populate key values foreach ($row as $col_index => $col) { if (in_array($col_index, $array_columns)) { $array_normalized[$row_index][$col_index] = $col; } } } return $array_normalized; } function filter_array($array, $column, $value = '') { $filtered = []; foreach ($array as $row) { foreach ($row as $colname => $col) { if ($colname == $column && $col == $value) { $filtered[] = $row; } } } return $filtered; } function get_grouped_array($array, $column = '') { $grouped_array = []; if ($column) { $array_cols = []; foreach ($array as $index => $entry) { if (!in_array($entry[$column], $array_cols)) { $array_cols[$column][] = $entry[$column]; } } foreach ($array_cols as $colname => $row) { foreach ($row as $colval) { $grouped_array[$colval] = filter_array($array, $colname, $colval); } } } else { $grouped_array[] = $array; } //$grouped_array[] =$array; //return $array_cols; return $grouped_array; } function array_column_selector($array, $columns = [], $action = './', $selected_default = '', $selected_alle = '') { $selected_col = ''; $selected = ''; if (isset($_GET['col_select'])) { $selected_col = $_GET['col_select']; } $array_filter_select = '
' . '' . '
'; return $array_filter_select; } function getProtectedValue($obj, $name) { $array = (array) $obj; $prefix = chr(0) . '*' . chr(0); return $array[$prefix . $name]; } function print_r_hidden($data) { $out = ''; return $out; } /* check string by array */ function strposa($haystack, $needles = array(), $offset = 0) { $chr = array(); foreach ($needles as $needle) { $res = strpos($haystack, $needle, $offset); if ($res !== false) $chr[$needle] = $res; } if (empty($chr)) return false; return min($chr); } function findDateIndex($data, $value) { $index = array_search($value, array_column($data, 'date')); return $index; } function findColIndex($data, $column, $value) { $index = array_search($value, array_column($data, $column)); return $index; } function array_insert(&$array, $position, $insert_array) { $first_array = array_splice($array, 0, $position); $array = array_merge($first_array, $insert_array, $array); } /*** ex. array_insert ($array, 2, ['key'=>''] ); ***/ function filterArray($array, $offset_index) { $array = array_splice($array, $offset_index, count($array)); return $array; } function filterOutput($html, $del, $offset_index) { $filtered_html = explode($del, $html); $filtered_html = array_splice($filtered_html, $offset_index, count($filtered_html)); $output = ''; foreach ($filtered_html as $filtered_el) { $output .= $filtered_el; } return $output; } function reduceArray($array, $exclude = []) { $newArray = []; if (!empty($array)) { foreach ($array as $key => $value) { if (!in_array($key, $exclude)) { $newArray[$key] = $value; } } } if (count(array_filter(array_keys($newArray), 'is_string')) == 0) { $newArray = array_values($newArray); } return $newArray; } function unsetByValue($array, $value) { $key = array_search($value, $array); if (false !== $key) { unset($array[$key]); } $newArray = $array; if (is_numeric($key)) { $newArray = array_values($newArray); } return $newArray; } /* sort */ function array_sort_by_column($array, $column, $order = SORT_ASC) { $new_array = array(); $sortable_array = array(); if (count($array) > 0) { foreach ($array as $key => $value) { if (is_array($value)) { foreach ($value as $key2 => $value2) { if ($key2 == $column) { $sortable_array[$key] = $value2; } } } else { $sortable_array[$key] = $value; } } switch ($order) { case SORT_ASC: asort($sortable_array); break; case SORT_DESC: arsort($sortable_array); break; } foreach ($sortable_array as $key => $value) { $new_array[$key] = $array[$key]; } } return $new_array; } ?>Log:'; foreach ($log as $entry) { $log_out .= '

' . $entry . '

'; } return $log_out; } function csvToArray($file, $delimiter = ',') { $csvFile = remove_utf8_bom(file($file)); $keys = str_getcsv(array_shift($csvFile), $delimiter); foreach ($csvFile as $csvRecord) { // combine our $csvRecord with $keys array $csv[] = array_combine($keys, str_getcsv($csvRecord, $delimiter)); } return $csv; } function normalize_columns($array) { $array_columns = array_unique(get_array_columns($array)); $array_normalized = []; //echo '

cols

'; //print_h($array_columns); foreach ($array as $row_index => $row) { //$array_normalized[$row_index]= ''; $array_normalized[$row_index] = $array_columns; /// cols foreach ($array_columns as $col_index => $col) { if (!array_key_exists($col_index, $row)) { $array_normalized[$row_index][$col_index] = ''; } else { $array_normalized[$row_index][$col_index] = $array[$row_index][$col_index]; } } } //print_h($array_normalized); return $array_normalized; } function delete_columns($array, $column_delete_array, $delete_prfixes = []) { $cleaned_array = $array; foreach ($array as $index => $row) { $cleaned_array[$index] = $row; if (is_array($column_delete_array)) { foreach ($row as $column_index => $column) { if (!in_array($column_index, $column_delete_array)) { $cleaned_array[$index][$column_index] = $column; } else { unset($cleaned_array[$index][$column_index]); } } } } return $cleaned_array; } function fix_date_columns($array) { $cleaned_array = $array; foreach ($array as $index => $row) { $cleaned_array[$index] = $row; foreach ($row as $column_index => $column) { if ($column_index == '_date') { $date_us = $column; $date = date('Y.m.d', strtotime($date_us)); $cleaned_array[$index][$column_index] = $date; } } } return $cleaned_array; } function ps_array_flatten($array) { $array = array_values($array); $flat_array = array(); foreach ($array as $row_index => $row) { $flat_array[$row_index] = $row; foreach ($row as $column_index => $column) { if (is_array($column)) { unset($flat_array[$row_index][$column_index]); $sub_array = $column; $flat_array[$row_index] = array_merge($flat_array[$row_index], $sub_array); } else { $flat_array[$row_index][$column_index] = $column; } } } return $flat_array; } function addColumnHeader($array, $customCols = '') { /* adds column header as first roe by array keys */ $array = array_values($array); $array_header = []; if (!$customCols) { foreach ($array as $index => $row) { if ($index == 0) { foreach ($row as $col => $column) { $col_label = str_replace(['_'], [' '], $col); $array_header[0][$col] = $col_label; } } } //$array_header = array_values($array_header); } else { foreach ($array as $index => $row) { if ($index == 0) { $i = 0; foreach ($row as $col => $column) { if ($i <= (count($row))) { //$array_header[0][$customCols[$i]] = $customCols[$i]; $array_header[0][$col] = $customCols[$i]; $i++; } } } } } $array_header = array_merge($array_header, $array); return $array_header; } function editColumnsForm($array, $postType) { global $home_url; global $log; global $table_prefs_json; $currentURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $table_cols_all = get_array_columns($array); //print_r($table_cols_all); $cookie_name = 'table_prefs'; /// get prefs by cookie or post data $table_cols_post = ''; $table_pref_arr = []; $flush = false; /// reset if (isset($_POST['inp-table-columns'])) { if (!$_POST['inp-table-columns']) { $flush = true; $log[] = 'post empty: need flush?: ' . json_encode($flush); //$log[]='postData: '.print_h($_POST); } else { $log[] = 'post isset'; } } /// get cookie if (isset($_COOKIE[$cookie_name]) && !$flush) { $table_cols_cookie = $_COOKIE[$cookie_name]; $table_pref_arr = json_decode(stripslashes($table_cols_cookie), true); $log[] = 'has pref cookie: "' . $cookie_name . '"'; /// update cookie prefs with new data if (!empty($table_pref_arr)) { $table_cols = json_encode($table_pref_arr, JSON_PRETTY_PRINT); $log[] = 'cookie has pref array' . $table_cols; } else { $table_pref_arr = []; /* $table_pref_arr = json_decode(stripslashes($table_prefs_json), true); */ } } else { $log[] = 'no pref cookie: '; } /// add post type / set defaults if (!array_key_exists($postType, $table_pref_arr) || empty($table_pref_arr)) { if (isset($table_prefs_json)) { $table_pref_json_arr = json_decode(stripslashes($table_prefs_json), true); if (isset($table_pref_json_arr[$postType])) { $cols_postTypeJson = explode(', ', $table_pref_json_arr[$postType]); $table_cols_all_names = array_values($table_cols_all); $cols_postType_merged = array_unique(array_merge(['post_link'], $cols_postTypeJson, $table_cols_all_names)); $table_pref_arr[$postType] = implode(', ', $cols_postType_merged); $log[] = 'column prefs: updated by pref json'; } else { $table_pref_arr[$postType] = []; } } if (empty($table_pref_arr[$postType])) { $table_pref_arr[$postType] = implode(', ', $table_cols_all); $log[] = 'column prefs: updated by all columns'; } } /// update if (isset($_POST['inp-table-columns'])) { //echo '

has post

'; $table_cols_post = $_POST['inp-table-columns']; $table_pref_arr_post = json_decode(stripslashes($table_cols_post), true); $log[] = 'has post column data: ' . $table_cols_post; if (!empty($table_pref_arr_post)) { ///update foreach ($table_pref_arr_post as $index => $pref) { $table_pref_arr[$index] = $table_pref_arr_post[$index]; } $log[] = 'post column array updated from post data: also missing types'; } } $table_cols = json_encode($table_pref_arr, JSON_PRETTY_PRINT); $current_cols_drag = ''; $current_cols = explode(', ', $table_pref_arr[$postType]); //print_r($current_cols); if (!empty($current_cols)) { $current_cols_drag .= ''; } //ob_start(); //print_r($table_pref_arr); $colForm = '
Spalten filtern/sortieren
' . $current_cols_drag . '
Einstellungen
'; $edidColData = ['html' => $colForm, 'columns' => $table_cols]; return $edidColData; } function array2table($array, $normalize = false, $tableheader = true, $table_class = '', $maxRows = -1, $expiry=1.5) { /* numeric index */ $array = array_values($array); /* check if number of columns is equal in array */ if ($normalize == true) { $array = normalize_columns($array); } $offset = 0; $html = ''; $now = time(); foreach ($array as $rowIndex => $row) { if ($rowIndex > 0) { $date = str_replace('.', '-', $row['_date']); $timestamp = strtotime($date); //$timestamp = strtotime('now'); $date2 = date('Y.m.d', $timestamp); $age_years = ($now-$timestamp) / (3600*24*365); /* print_r($date ); print_r($timestamp); print_h($date2); print_h('$age_years:'.$age_years); print_h($age_years); */ if($age_years>$expiry){ continue; } } //reduce rows if ($maxRows > 0 && $rowIndex > $maxRows) { continue; } if ($rowIndex == 0 && $tableheader == true) { $html .= "" . "\n" . ""; foreach ($row as $columnName => $cell) { $html .= '' . "\n"; } $html .= "" . "\n" . "" . "\n"; $offset = 0; } if ($rowIndex == 0 && $tableheader == false) { $html .= "" . "\n"; $offset = 0; } if ($rowIndex > $offset) { $post_status = ''; if (array_key_exists('post_status', $row)) { $post_status = 'status-' . $row['post_status']; } if (array_key_exists('seite_ausblenden', $row)) { if ($row['seite_ausblenden'] == 1) { $post_status .= ' status-hidden'; } } if (array_key_exists('sichtbarkeit', $row)) { $post_status .= ' ' . $row['sichtbarkeit']; } $html .= '' . "\n"; foreach ($row as $columnName => $cell) { $statusClass = ''; if ($columnName == 'status' || $columnName == 'post_status') { $statusClass = 'status-' . strtolower($cell); } $html .= ''; } $html .= "" . "\n"; } } $html .= "" . "\n" . "
' . $cell . '
' . $cell . '
"; return $html; } function excludeColumns($array, $exclude_columns) { $array = array_values($array); $array_filtered = array(); foreach ($array as $index => $row) { $array_filtered[$index] = array(); foreach ($row as $col => $column) { if (!in_array($col, $exclude_columns)) { $array_filtered[$index][$col] = $column; } } } return $array_filtered; } ///// output as csv function outputCSV($filename = 'csv-data', $data, $delimiter = ',', $seperator = '"', $raw = false, $static = false, $ext = '.csv') { ob_clean(); header('Content-Encoding: UTF-8'); header('Content-type: text/csv; charset=UTF-8'); header("Content-Disposition: attachment; filename=$filename$ext"); if ($static == false) { $output = fopen("php://output", "wb"); } else { $output = fopen($filename . '_static' . $ext, "w"); } fputs($output, $bom = (chr(0xEF) . chr(0xBB) . chr(0xBF))); // excel compatability BOM fix foreach ($data as $index => $row) { if ($raw == true) { fputcsv($output, array_map('strip_tags', $row), $delimiter, $seperator); // here you can change delimiter/enclosure } else { fputcsv($output, $row, $delimiter, $seperator); // here you can change delimiter/enclosure } } fclose($output); } function saveCSV($data, $type = 'csv', $filename = 'csv-data', $raw = true, $static = false, $ext = '.csv') { //$data_filtered = strip_tags(json_encode($data, true)); //$data = json_decode($data_filtered); $ext = '_' . date('y.m.d') . $ext; $delimiter = ','; $seperator = '"'; if ($type == 'semicolon') { $delimiter = ';'; $seperator = '"'; } if ($type == 'comma') { $delimiter = ','; $seperator = '"'; } if ($type == 'tab') { $delimiter = "\t"; $seperator = '"'; } if ($type == 'tab_noquotes') { $delimiter = "\t"; $seperator = ''; } ob_clean(); header('Content-Encoding: UTF-8'); header('Content-type: text/csv; charset=UTF-8'); header("Content-Disposition: attachment; filename=$filename$ext"); if ($static == false) { $output = fopen("php://output", "wb"); } else { $output = fopen($filename . '_static' . $ext, "w"); } fputs($output, $bom = (chr(0xEF) . chr(0xBB) . chr(0xBF))); // excel compatability BOM fix foreach ($data as $index => $row) { if ($type != 'semicolon') { $row_filt = []; foreach ($row as $col) { $row_filt[] = str_replace(["\t"], '', $col); } $row = $row_filt; } if ($raw == true) { fputcsv($output, array_map('strip_tags', $row), $delimiter, $seperator); // here you can change delimiter/enclosure } else { fputcsv($output, $row, $delimiter, $seperator); // here you can change delimiter/enclosure } } fclose($output); } function renderCsvForm() { $form_html = '
'; return $form_html; } function renderCsvFormData($data_array, $standaloneUrl = '', $filename = "csv_data") { //$data_array_json = addslashes(json_encode($data_array)); //print_r($data_array); /// prevent excel number conversion array_walk_recursive( $data_array, function (&$v) { //$v = addslashes($v); $v = str_replace([" ", " ", " "], ' ', strip_tags($v)); $v = str_replace(['\"', ''], '::', $v); $v = str_replace(["\t", "\r", "\n", '"', 'quote'], '', $v); if (is_numeric($v)) { //$v = "\t".strval($v); } //$v = urlencode($v); } ); $data_array_json = urlencode(json_encode($data_array, true)); //$data_array_json = json_encode($data_array, true); $form_html = '
'; return $form_html; } ?> $val){ $offset = 0; $found = false; foreach($temp_array as $tmp_key => $tmp_val) { if(!$found and strtolower($val[$subkey]) > strtolower($tmp_val[$subkey])) { $temp_array = array_merge( (array)array_slice($temp_array,0,$offset), array($key => $val), array_slice($temp_array,$offset) ); $found = true; } $offset++; } if(!$found) $temp_array = array_merge($temp_array, array($key => $val)); } if ($sort_ascending) $array = array_reverse($temp_array); else $array = $temp_array; } ?>'.$modified.' '.$user_info->display_name.'

'; break; // end all case breaks } } function last_edited_label( $columns ) { $columns['modified'] = 'Geändert'; return $columns; } /* make sortable */ function last_modified_column_register_sortable( $columns ) { $columns["modified"] = "modified"; $columns["order"] = "desc"; return $columns; } add_filter( "manage_edit-post_sortable_columns", "last_modified_column_register_sortable" ); add_filter( "manage_edit-page_sortable_columns", "last_modified_column_register_sortable" ); add_filter( "manage_edit-film_sortable_columns", "last_modified_column_register_sortable" ); function wpse_81939_post_types_admin_order( $wp_query ) { if (is_admin()) { // Get the post type from the query if(isset($_GET['post_type'])){ $post_type = $_GET['post_type']; if ( $post_type == 'film' && !isset($_GET['orderby'])) { $wp_query->set('orderby', 'modified'); $wp_query->set('order', 'DESC'); } } } } add_filter('pre_get_posts', 'wpse_81939_post_types_admin_order'); ?> Erotische Massagen, body to body, Nuru, Lingam | Maribelle Hamburg itemId; $currentPageId = $this->currentPageId; /** * setup aria accordion state **/ $ariaBtnId = 'acc-btn-'.$page_id; $ariaControlsId = 'acc-item-'.$page_id; $state_btnState = 'acc-btn-cll'; $state_ariaExpanded = 'false'; $state_ariaCnt = 'aria-cnt-cll'; $state_ariaHidden = 'true'; $_current_page = get_post( $currentPageId ); if ( in_array( $page_id, $_current_page->ancestors ) ){ $state_btnState = ' acc-btn-exp'; $state_ariaExpanded = 'true'; $state_ariaCnt = 'aria-cnt-exp'; $state_ariaHidden = 'false'; } //$currentState = $itemCurrent; $output .= "\n$indent". ''. '