print(f"full_path: {full_path}")
return full_path
group_path = getGroupPathById(file_path, group_id)
new_tab = newTab(new_group_name)
group_path.append(new_tab)
new_group = newGroup(new_group_name)
group_path.append(new_group)
function eventsApiPosts()
{
register_rest_route('events/v1', 'posts', [
'methods' => WP_REST_SERVER::READABLE,
'callback' => 'eventsApiPostsFunc',
]);
}
add_action('rest_api_init', 'eventsApiPosts');
function eventsApiPostsFunc($data)
{
$term_slug = $data['term_slug'] ?? null;
$date = $data['date'];
$now = date('Y-m-d');
$current_page = $data['current_page'];
$lang = $data['lang'];
if ($date) {
if ($date === 'coming-soon') {
$meta_query = array(
array(
'key' => 'loop_event_date',
'value' => $now,
'compare' => '>',
'type' => 'DATE'
)
);
} else if ($date === 'past-events') {
$meta_query = array(
array(
'key' => 'loop_event_date',
'value' => $now,
'compare' => '<',
'type' => 'DATE'
)
);
} else {
$meta_query = array(
array(
'key' => 'loop_event_date',
'value' => $date,
'compare' => 'LIKE'
)
);
}
}
$tax_query = [];
if ($term_slug) {
$tax_query = array(
array(
'taxonomy' => 'events_category',
'field' => 'slug',
'terms' => [$term_slug],
)
);
}
$post_type = 'events';
$posts_per_page = 3;
$offset = ($current_page * $posts_per_page) - $posts_per_page;
$post_events = new WP_Query(array(
'post_type' => $post_type,
'posts_per_page' => $posts_per_page,
'offset' => $offset,
'tax_query' => $tax_query,
'meta_query' => $meta_query,
// 'orderby' => 'meta_value', // Order by meta value as numeric
// 'meta_key' => 'featured', // Meta key for sorting
// 'meta_type' => 'DATE', // Meta type
// 'order' => 'DESC',
));
$total_posts = $post_events->found_posts;
$pages = ceil($total_posts / $posts_per_page);
$events_array = $post_events->get_posts();
$events_array = array_map(function ($event) use ($lang) {
$id = $event->ID;
$title = get_the_title($id);
$term = get_the_terms($id, 'events_category')[0];
if ($lang === 'ro') {
$location = get_field('title_ro', $term);
} else {
$location = $term->name;
}
$loop = get_field('loop', $id);
$event_date = $loop['event_date'];
$short_description = $loop['short_description'];
$image = get_the_post_thumbnail_url($id);
return [
'id' => $id,
'title' => $title,
'location' => $location,
'event_date' => $event_date,
'featured' => get_field('featured', $id),
'short_description' => $short_description,
'image' => $image,
'lang' => $lang,
'term_name' => $term->name,
'permalink' => get_the_permalink($id),
];
}, $events_array);
$count = count($events_array);
return [
'lang' => $lang,
'total' => $total_posts,
'count' => $count,
'pages' => $pages,
'current_page' => $current_page,
'events' => $events_array,
'offset' => $offset,
'current_page' => $current_page,
'posts_per_page' => $posts_per_page,
];
}
mysql:
container_name: mysql_laravel9
image: mysql:8
restart: always
environment:
# - "MYSQL_ROOT_PASSWORD=root;"
MYSQL_ROOT_USER: root
MYSQL_ROOT_PASSWORD: secret
MYSQL_PASSWORD: secret
volumes:
- "./docker/mysql:/var/lib/mysql"
ports:
- "33062:3306"
❯ mysql -h 127.0.0.1 -P 33062 -u root -p
Enter password:
ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.
❯ locale -a | grep ru
ru_RU
ru_RU.cp1251
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian
ru_UA.utf8
❯ export LC_ALL=ru_RU.koi8r
❯ echo "какой-то текст" | iconv -f utf-8 -t ascii//TRANSLIT
?????-?? ?????
❯ export LC_ALL=ru_RU.iso88595
❯ locale
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE="ru_RU.iso88595"
LC_NUMERIC="ru_RU.iso88595"
LC_TIME="ru_RU.iso88595"
LC_COLLATE="ru_RU.iso88595"
LC_MONETARY="ru_RU.iso88595"
LC_MESSAGES="ru_RU.iso88595"
LC_PAPER="ru_RU.iso88595"
LC_NAME="ru_RU.iso88595"
LC_ADDRESS="ru_RU.iso88595"
LC_TELEPHONE="ru_RU.iso88595"
LC_MEASUREMENT="ru_RU.iso88595"
LC_IDENTIFICATION="ru_RU.iso88595"
LC_ALL=ru_RU.iso88595
❯ echo "какой-то текст" | iconv -f utf-8 -t ascii//TRANSLIT
?????-?? ?????
❯ export LC_ALL=ru_RU
❯ locale
LANG=en_US.UTF-8
LANGUAGE=en
LC_CTYPE="ru_RU"
LC_NUMERIC="ru_RU"
LC_TIME="ru_RU"
LC_COLLATE="ru_RU"
LC_MONETARY="ru_RU"
LC_MESSAGES="ru_RU"
LC_PAPER="ru_RU"
LC_NAME="ru_RU"
LC_ADDRESS="ru_RU"
LC_TELEPHONE="ru_RU"
LC_MEASUREMENT="ru_RU"
LC_IDENTIFICATION="ru_RU"
LC_ALL=ru_RU
❯ echo "какой-то текст" | iconv -f utf-8 -t ascii//TRANSLIT
?????-?? ?????
❯ locale
LANG=ru_RU.UTF-8
LANGUAGE=ru
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=
❯ export LC_ALL=ru_RU.UTF-8
❯ locale
LANG=ru_RU.UTF-8
LANGUAGE=ru
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=ru_RU.UTF-8
"action": {
"default_popup": "index.html",
"default_icon": "icons/icon-32.png"
},
"commands": {
"_execute_action": {
"suggested_key": {
"default": "Ctrl+Comma",
"mac": "Command+Comma"
}
}
}
Можно docker использовать