Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kurudrive committed Jun 4, 2024
1 parent 2cab025 commit 13d8a71
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions inc/post-type-manager/package/class.post-type-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ public static function add_meta_box_action() {
echo '<input class="form-control" type="text" id="veu_menu_position" name="veu_menu_position" value="' . esc_attr( $post->veu_menu_position ) . '" size="30">';

echo '<hr>';

/*******************************************
* Menu Icon
*/
echo '<h4>' . esc_html__( 'Menu Icon(Optional)', 'vk-all-in-one-expansion-unit' ) . '</h4>';
echo '<p>' . esc_html__( 'Select an icon from the images below, or enter a custom Dashicon class.', 'vk-all-in-one-expansion-unit' ) . '</p>';

echo '<div style="margin-bottom: 1rem;">';
$icons = [
$icons = array(
'dashicons-admin-post',
'dashicons-admin-site',
'dashicons-admin-users',
Expand All @@ -151,19 +151,19 @@ public static function add_meta_box_action() {
'dashicons-admin-home',
'dashicons-admin-generic',
'dashicons-admin-collapse',
];
foreach ($icons as $icon) {
echo '<button type="button" class="button" style="margin-right: 10px; margin-bottom: 10px; width: 40px; height: 40px; padding: 5px;" onclick="updateIconSelection(\'' . esc_attr($icon) . '\');">';
echo '<span class="dashicons ' . esc_attr($icon) . '" style="font-size: 20px; vertical-align: sub;"></span>';
);

foreach ( $icons as $icon ) {
echo '<button type="button" class="button" style="margin-right: 10px; margin-bottom: 10px; width: 40px; height: 40px; padding: 5px;" onclick="updateIconSelection(\'' . esc_attr( $icon ) . '\');">';
echo '<span class="dashicons ' . esc_attr( $icon ) . '" style="font-size: 20px; vertical-align: sub;"></span>';
echo '</button>';
}

echo '<div>';
echo '<input type="text" id="veu_menu_icon" name="veu_menu_icon" value="' . esc_attr($post->veu_menu_icon) . '" style="margin-right: 10px;" size="30">';
echo '<a href="https://developer.wordpress.org/resource/dashicons/" class="button" target="_blank">' . esc_html__('Dashicons Library', 'vk-all-in-one-expansion-unit') . '</a>';
echo '<input type="text" id="veu_menu_icon" name="veu_menu_icon" value="' . esc_attr( $post->veu_menu_icon ) . '" style="margin-right: 10px;" size="30">';
echo '<a href="https://developer.wordpress.org/resource/dashicons/" class="button" target="_blank">' . esc_html__( 'Dashicons Library', 'vk-all-in-one-expansion-unit' ) . '</a>';
echo '</div>';

echo '</div>';

echo '<hr>';
Expand All @@ -188,7 +188,6 @@ function updateIconSelection(icon) {
});
</script>';


/*******************************************
* Export to Rest api
*/
Expand Down Expand Up @@ -378,12 +377,12 @@ public static function add_post_type() {
/*******************************************
* メニューアイコンを設定するためのコード
*/
$menu_icon = get_post_meta($post->ID, 'veu_menu_icon', true);
if (empty($menu_icon)) {
$menu_icon = get_post_meta( $post->ID, 'veu_menu_icon', true );
if ( empty( $menu_icon ) ) {
$menu_icon = 'dashicons-admin-post';
} elseif ($menu_icon === 'none') {
} elseif ( $menu_icon === 'none' ) {
$menu_icon = ''; // CSSでスタイリング可能に
} elseif (!strpos($menu_icon, 'dashicons-') === 0 && !strpos($menu_icon, 'data:image/svg+xml;base64,') === 0) {
} elseif ( ! strpos( $menu_icon, 'dashicons-' ) === 0 && ! strpos( $menu_icon, 'data:image/svg+xml;base64,' ) === 0 ) {
$menu_icon = 'dashicons-admin-post';
}

Expand All @@ -403,10 +402,10 @@ public static function add_post_type() {
foreach ( $post_type_items as $key => $value ) {
$supports[] = $key;
}

// 投稿タイプのアイコンを取得
$menu_icon = get_post_meta($post->ID, 'veu_menu_icon', true);
$menu_icon = !empty($menu_icon) ? $menu_icon : 'dashicons-admin-post';
$menu_icon = get_post_meta( $post->ID, 'veu_menu_icon', true );
$menu_icon = ! empty( $menu_icon ) ? $menu_icon : 'dashicons-admin-post';

// カスタム投稿タイプのスラッグ.
$post_type_id = mb_strimwidth( mb_convert_kana( mb_strtolower( esc_html( get_post_meta( $post->ID, 'veu_post_type_id', true ) ) ), 'a' ), 0, 20, '', 'UTF-8' );
Expand Down Expand Up @@ -440,7 +439,7 @@ public static function add_post_type() {
'public' => true,
'has_archive' => true,
'menu_position' => $menu_position,
'menu_icon' => $menu_icon,
'menu_icon' => $menu_icon,
'supports' => $supports,
'rewrite' => $rewrite,
);
Expand Down

0 comments on commit 13d8a71

Please sign in to comment.