HTML / Javascript einblenden der Virtuellen Touch Tastatur von Windows [closed]

Ich habe folgendes Problem.
Ich habe einen Touch Monitor an dem keine Tastatur angeschlossen ist.
Auf dem Monitor wird eine E-Mail Registrierung per HTML Seite angezeigt.

Mein Problem, die Windows Touch Tastatur wird nur automatisch eingeblendet wenn ich auf
ein Passwort Feld (und da nur beim Border) klicke. Bei E-Mail oder normalen Text Feldern wird die Tastatur nicht eingeblendet.

Hat hier wer eine Idee wie man das mit Javacript oder sonstiges erzwingen kann?

Set Focus auf das Password Feld funktioniert leider nicht.

LG
Martin

Pivot tables with laravel

im new in laravel and php and im working on a project that has a specific requirements. I would appreciate if you would help me get into right direction. Use case is:

I need a project for my client that’s gonna track balances between
warehouses, generating documents and updating balances and transfers
between ones. Every item in warehouse should have its own LOT code (ex
2 items that received in warehouse can have different codes and i need
to update balance for that particular LOT code but still be able to
show balance sum for that item with all LOT codes). Users with right
permission should have access to only 1 warehouse (and admin should
have access for all), and be able to transfer items to another by
which LOT code would be generated. So lets give an example:

User 1 has access to warehouse Storage and Finished products; User 2
has access to warehouse Preparation;

Balance of Storage for item sugar is 1000kg with LOT code “28012022”;
User 1 receives 500kg of ex sugar with LOT code “02022022” (or
autogenerated if no input), he enters all the data about that
reception in fields. He then sends 200kg with LOT code 28012022 and
100kg with “02022022” to Preparation warehouse. User 2 confirms
transaction and Storage balance is updated with new values subtracted
with that amounts, and Preparation warehouse is updated with new item
values and new LOT code is generated (28012022/02022022)

User 2 then enters spent amounts and how much of Finished products is
made from it, his balance is updated with balance left and LOT code
(in this example 28012022/02022022). Then user 2 commits transaction
and user 1 confirms it and Finished Products balance is updated with
new generated LOT code (28012022/02022022/currentDate);

My question is, should i use pivot tables in laravel, and as im using spatie laravel permission, how should i implement that so that i can give access to some users only for certain warehouses?
Any pointers in right direction will be appreciated.
Here is git of a project:
https://github.com/cile1993/cmss

Include edit-tags.php in submenu page WordPress

I am making a plugin for WordPress (5.9).
I would like to include the page edit-tags.php to create and edit the tags which are specifics to a custom post type.
In my submenu page, I simply put that : include_once(plugin_dir_path(__DIR__)."includes/php/editTags.php");

My editTags.php :

<?php
/**
 * To include in BTH options
 * Edit Tags Administration Screen.
 *
 * @package WordPress
 * @subpackage Administration
 */

/** WordPress Administration Bootstrap */

$taxnow = "adLabels";
$taxonomy = "adLabels";
$current_screen = get_current_screen();


if ( ! $taxnow ) {
    wp_die( __( 'Invalid taxonomy.' ) );
}

$tax = get_taxonomy( $taxnow );

if ( ! $tax ) {
    wp_die( __( 'Invalid taxonomy.' ) );
}

if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ), true ) ) {
    wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) );
}

if ( ! current_user_can( $tax->cap->manage_terms ) ) {
    wp_die(
        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
        '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>',
        403
    );
}

/**
 * $post_type is set when the WP_Terms_List_Table instance is created
 *
 * @global string $post_type
 */
global $post_type;

$wp_list_table = _get_list_table( 'WP_Terms_List_Table' );
$pagenum       = $wp_list_table->get_pagenum();

$title = $tax->labels->name;

if ( 'post' !== $post_type ) {
    $parent_file  = ( 'attachment' === $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
    $submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;post_type=$post_type";
} elseif ( 'link_category' === $tax->name ) {
    $parent_file  = 'link-manager.php';
    $submenu_file = 'edit-tags.php?taxonomy=link_category';
} else {
    $parent_file  = 'edit.php';
    $submenu_file = "edit-tags.php?taxonomy=$taxonomy";
}

add_screen_option(
    'per_page',
    array(
        'default' => 20,
        'option'  => 'edit_' . $tax->name . '_per_page',
    )
);

get_current_screen()->set_screen_reader_content(
    array(
        'heading_pagination' => $tax->labels->items_list_navigation,
        'heading_list'       => $tax->labels->items_list,
    )
);

$location = false;
$referer  = wp_get_referer();
if ( ! $referer ) { // For POST requests.
    $referer = wp_unslash( $_SERVER['REQUEST_URI'] );
}
$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer );
switch ( $wp_list_table->current_action() ) {

    case 'add-tag':
        check_admin_referer( 'add-tag', '_wpnonce_add-tag' );

        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>',
                403
            );
        }

        $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST );
        if ( $ret && ! is_wp_error( $ret ) ) {
            $location = add_query_arg( 'message', 1, $referer );
        } else {
            $location = add_query_arg(
                array(
                    'error'   => true,
                    'message' => 4,
                ),
                $referer
            );
        }

        break;

    case 'delete':
        if ( ! isset( $_REQUEST['tag_ID'] ) ) {
            break;
        }

        $tag_ID = (int) $_REQUEST['tag_ID'];
        check_admin_referer( 'delete-tag_' . $tag_ID );

        if ( ! current_user_can( 'delete_term', $tag_ID ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
                403
            );
        }

        wp_delete_term( $tag_ID, $taxonomy );

        $location = add_query_arg( 'message', 2, $referer );

        // When deleting a term, prevent the action from redirecting back to a term that no longer exists.
        $location = remove_query_arg( array( 'tag_ID', 'action' ), $location );

        break;

    case 'bulk-delete':
        check_admin_referer( 'bulk-tags' );

        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
                403
            );
        }

        $tags = (array) $_REQUEST['delete_tags'];
        foreach ( $tags as $tag_ID ) {
            wp_delete_term( $tag_ID, $taxonomy );
        }

        $location = add_query_arg( 'message', 6, $referer );

        break;

    case 'edit':
        if ( ! isset( $_REQUEST['tag_ID'] ) ) {
            break;
        }

        $term_id = (int) $_REQUEST['tag_ID'];
        $term    = get_term( $term_id );

        if ( ! $term instanceof WP_Term ) {
            wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
        }

        wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) );
        exit;

    case 'editedtag':
        $tag_ID = (int) $_POST['tag_ID'];
        check_admin_referer( 'update-tag_' . $tag_ID );

        if ( ! current_user_can( 'edit_term', $tag_ID ) ) {
            wp_die(
                '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
                '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
                403
            );
        }

        $tag = get_term( $tag_ID, $taxonomy );
        if ( ! $tag ) {
            wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
        }

        $ret = wp_update_term( $tag_ID, $taxonomy, $_POST );

        if ( $ret && ! is_wp_error( $ret ) ) {
            $location = add_query_arg( 'message', 3, $referer );
        } else {
            $location = add_query_arg(
                array(
                    'error'   => true,
                    'message' => 5,
                ),
                $referer
            );
        }
        break;
    default:
        if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) {
            break;
        }
        check_admin_referer( 'bulk-tags' );

        $screen = get_current_screen()->id;
        $tags   = (array) $_REQUEST['delete_tags'];

        /** This action is documented in wp-admin/edit.php */
        $location = apply_filters( "handle_bulk_actions-{$screen}", $location, $wp_list_table->current_action(), $tags ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
        break;
}

if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
    $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) );
}

if ( $location ) {
    if ( $pagenum > 1 ) {
        $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages.
    }

    /**
     * Filters the taxonomy redirect destination URL.
     *
     * @since 4.6.0
     *
     * @param string      $location The destination URL.
     * @param WP_Taxonomy $tax      The taxonomy object.
     */
    wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
    exit;
}

$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );

if ( $pagenum > $total_pages && $total_pages > 0 ) {
    wp_redirect( add_query_arg( 'paged', $total_pages ) );
    exit;
}

wp_enqueue_script( 'admin-tags' );
if ( current_user_can( $tax->cap->edit_terms ) ) {
    wp_enqueue_script( 'inline-edit-tax' );
}

if ( 'category' === $taxonomy || 'link_category' === $taxonomy || 'post_tag' === $taxonomy ) {
    $help = '';
    if ( 'category' === $taxonomy ) {
        $help = '<p>' . sprintf(
            /* translators: %s: URL to Writing Settings screen. */
            __( 'You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.' ),
            'options-writing.php'
        ) . '</p>';
    } elseif ( 'link_category' === $taxonomy ) {
        $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>';
    } else {
        $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there&#8217;s no relationship from one tag to another.' ) . '</p>';
    }

    if ( 'link_category' === $taxonomy ) {
        $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>';
    } else {
        $help .= '<p>' . __( 'What&#8217;s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>';
    }

    get_current_screen()->add_help_tab(
        array(
            'id'      => 'overview',
            'title'   => __( 'Overview' ),
            'content' => $help,
        )
    );

    if ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) {
        if ( 'category' === $taxonomy ) {
            $help = '<p>' . __( 'When adding a new category on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
        } else {
            $help = '<p>' . __( 'When adding a new tag on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
        }

        $help .= '<ul>' .
        '<li>' . __( '<strong>Name</strong> &mdash; The name is how it appears on your site.' ) . '</li>';

        if ( ! global_terms_enabled() ) {
            $help .= '<li>' . __( '<strong>Slug</strong> &mdash; The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
        }

        if ( 'category' === $taxonomy ) {
            $help .= '<li>' . __( '<strong>Parent</strong> &mdash; Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
        }

        $help .= '<li>' . __( '<strong>Description</strong> &mdash; The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
        '</ul>' .
        '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>';

        get_current_screen()->add_help_tab(
            array(
                'id'      => 'adding-terms',
                'title'   => 'category' === $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ),
                'content' => $help,
            )
        );
    }

    $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';

    if ( 'category' === $taxonomy ) {
        $help .= '<p>' . __( '<a href="https://wordpress.org/support/article/posts-categories-screen/">Documentation on Categories</a>' ) . '</p>';
    } elseif ( 'link_category' === $taxonomy ) {
        $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>';
    } else {
        $help .= '<p>' . __( '<a href="https://wordpress.org/support/article/posts-tags-screen/">Documentation on Tags</a>' ) . '</p>';
    }

    $help .= '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>';

    get_current_screen()->set_help_sidebar( $help );

    unset( $help );
}

//require_once ABSPATH . 'wp-admin/admin-header.php';

// Also used by the Edit Tag form.
require_once ABSPATH . 'wp-admin/includes/edit-tag-messages.php';

$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated';

if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) {
    $import_link = admin_url( 'admin.php?import=wpcat2tag' );
} else {
    $import_link = admin_url( 'import.php' );
}

?>

<div class="wrap nosubsub">
<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>

<?php
if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
    echo '<span class="subtitle">';
    printf(
        /* translators: %s: Search query. */
        __( 'Search results for: %s' ),
        '<strong>' . esc_html( wp_unslash( $_REQUEST['s'] ) ) . '</strong>'
    );
    echo '</span>';
}
?>

<hr class="wp-header-end">

<?php if ( $message ) : ?>
<div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div>
    <?php
    $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
endif;
?>
<div id="ajax-response"></div>

<form class="search-form wp-clearfix" method="get">
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />

<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>

</form>

<?php
$can_edit_terms = current_user_can( $tax->cap->edit_terms );

if ( $can_edit_terms ) {
    ?>
<div id="col-container" class="wp-clearfix">

<div id="col-left">
<div class="col-wrap">

    <?php
    if ( 'category' === $taxonomy ) {
        /**
         * Fires before the Add Category form.
         *
         * @since 2.1.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'add_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    } elseif ( 'link_category' === $taxonomy ) {
        /**
         * Fires before the link category form.
         *
         * @since 2.3.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'add_link_category_form_pre', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_pre_add_form' );
    } else {
        /**
         * Fires before the Add Tag form.
         *
         * @since 2.5.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_pre_add_form'} instead.
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action_deprecated( 'add_tag_form_pre', array( $taxonomy ), '3.0.0', '{$taxonomy}_pre_add_form' );
    }

    /**
     * Fires before the Add Term form for all taxonomies.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_pre_add_form`
     *  - `post_tag_pre_add_form`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_pre_add_form", $taxonomy );
    ?>

<div class="form-wrap">
<h2><?php echo $tax->labels->add_new_item; ?></h2>
<form id="addtag" method="post" action="edit-tags.php" class="validate"
    <?php
    /**
     * Fires inside the Add Tag form tag.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_term_new_form_tag`
     *  - `post_tag_term_new_form_tag`
     *
     * @since 3.7.0
     */
    do_action( "{$taxonomy}_term_new_form_tag" );
    ?>
>
<input type="hidden" name="action" value="add-tag" />
<input type="hidden" name="screen" value="<?php echo esc_attr( $current_screen->id ); ?>" />
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
    <?php wp_nonce_field( 'add-tag', '_wpnonce_add-tag' ); ?>

<div class="form-field form-required term-name-wrap">
    <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
    <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
    <p><?php echo $tax->labels->name_field_description; ?></p>
</div>
    <?php if ( ! global_terms_enabled() ) : ?>
<div class="form-field term-slug-wrap">
    <label for="tag-slug"><?php _e( 'Slug' ); ?></label>
    <input name="slug" id="tag-slug" type="text" value="" size="40" />
    <p><?php echo $tax->labels->slug_field_description; ?></p>
</div>
<?php endif; // global_terms_enabled() ?>
    <?php if ( is_taxonomy_hierarchical( $taxonomy ) ) : ?>
<div class="form-field term-parent-wrap">
    <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label>
        <?php
        $dropdown_args = array(
            'hide_empty'       => 0,
            'hide_if_empty'    => false,
            'taxonomy'         => $taxonomy,
            'name'             => 'parent',
            'orderby'          => 'name',
            'hierarchical'     => true,
            'show_option_none' => __( 'None' ),
        );

        /**
         * Filters the taxonomy parent drop-down on the Edit Term page.
         *
         * @since 3.7.0
         * @since 4.2.0 Added `$context` parameter.
         *
         * @param array  $dropdown_args {
         *     An array of taxonomy parent drop-down arguments.
         *
         *     @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0|false.
         *     @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
         *     @type string   $taxonomy         The taxonomy slug.
         *     @type string   $name             Value of the name attribute to use for the drop-down select element.
         *                                      Default 'parent'.
         *     @type string   $orderby          The field to order by. Default 'name'.
         *     @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
         *     @type string   $show_option_none Label to display if there are no terms. Default 'None'.
         * }
         * @param string $taxonomy The taxonomy slug.
         * @param string $context  Filter context. Accepts 'new' or 'edit'.
         */
        $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' );

        wp_dropdown_categories( $dropdown_args );
        ?>
        <?php if ( 'category' === $taxonomy ) : ?>
        <p><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p>
    <?php else : ?>
        <p><?php echo $tax->labels->parent_field_description; ?></p>
    <?php endif; ?>
</div>
    <?php endif; // is_taxonomy_hierarchical() ?>
<div class="form-field term-description-wrap">
    <label for="tag-description"><?php _e( 'Description' ); ?></label>
    <textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
    <p><?php echo $tax->labels->desc_field_description; ?></p>
</div>

    <?php
    if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
        /**
         * Fires after the Add Tag form fields for non-hierarchical taxonomies.
         *
         * @since 3.0.0
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action( 'add_tag_form_fields', $taxonomy );
    }

    /**
     * Fires after the Add Term form fields.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_add_form_fields`
     *  - `post_tag_add_form_fields`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_add_form_fields", $taxonomy );
    ?>
    <p class="submit">
        <?php submit_button( $tax->labels->add_new_item, 'primary', 'submit', false ); ?>
        <span class="spinner"></span>
    </p>
    <?php
    if ( 'category' === $taxonomy ) {
        /**
         * Fires at the end of the Edit Category form.
         *
         * @since 2.1.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'edit_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    } elseif ( 'link_category' === $taxonomy ) {
        /**
         * Fires at the end of the Edit Link form.
         *
         * @since 2.3.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param object $arg Optional arguments cast to an object.
         */
        do_action_deprecated( 'edit_link_category_form', array( (object) array( 'parent' => 0 ) ), '3.0.0', '{$taxonomy}_add_form' );
    } else {
        /**
         * Fires at the end of the Add Tag form.
         *
         * @since 2.7.0
         * @deprecated 3.0.0 Use {@see '{$taxonomy}_add_form'} instead.
         *
         * @param string $taxonomy The taxonomy slug.
         */
        do_action_deprecated( 'add_tag_form', array( $taxonomy ), '3.0.0', '{$taxonomy}_add_form' );
    }

    /**
     * Fires at the end of the Add Term form for all taxonomies.
     *
     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     *
     * Possible hook names include:
     *
     *  - `category_add_form`
     *  - `post_tag_add_form`
     *
     * @since 3.0.0
     *
     * @param string $taxonomy The taxonomy slug.
     */
    do_action( "{$taxonomy}_add_form", $taxonomy );
    ?>
</form></div>
</div>
</div><!-- /col-left -->

<div id="col-right">
<div class="col-wrap">
<?php } ?>

<?php $wp_list_table->views(); ?>

<form id="posts-filter" method="post">
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />

<?php $wp_list_table->display(); ?>

</form>

<?php if ( 'category' === $taxonomy ) : ?>
<div class="form-wrap edit-term-notes">
<p>
    <?php
    printf(
        /* translators: %s: Default category. */
        __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the default category %s. The default category cannot be deleted.' ),
        /** This filter is documented in wp-includes/category-template.php */
        '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category' ) ), '', '' ) . '</strong>'
    );
    ?>
</p>
    <?php if ( current_user_can( 'import' ) ) : ?>
    <p>
        <?php
        printf(
            /* translators: %s: URL to Categories to Tags Converter tool. */
            __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ),
            esc_url( $import_link )
        );
        ?>
    </p>
    <?php endif; ?>
</div>
<?php elseif ( 'post_tag' === $taxonomy && current_user_can( 'import' ) ) : ?>
<div class="form-wrap edit-term-notes">
<p>
    <?php
    printf(
        /* translators: %s: URL to Categories to Tags Converter tool. */
        __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ),
        esc_url( $import_link )
    );
    ?>
    </p>
</div>
    <?php
endif;

/**
 * Fires after the taxonomy list table.
 *
 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 *
 * Possible hook names include:
 *
 *  - `after-category-table`
 *  - `after-post_tag-table`
 *
 * @since 3.0.0
 *
 * @param string $taxonomy The taxonomy name.
 */
do_action( "after-{$taxonomy}-table", $taxonomy );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

if ( $can_edit_terms ) {
    ?>
</div>
</div><!-- /col-right -->

</div><!-- /col-container -->
<?php } ?>

</div><!-- /wrap -->

<?php if ( ! wp_is_mobile() ) : ?>
<script type="text/javascript">
try{document.forms.addtag['tag-name'].focus();}catch(e){}
</script>
    <?php
endif;

$wp_list_table->inline_edit();

?>

Of course, I can just include the original edit-tags.php if the file doesn’t need any modification. For now, I just added $taxnox, $taxonomy and $current_screen as you can see after the comments at the beginning of the code. In the URL of the submenu page, I also added “taxonomy=adLabels“.

My problem is, the list of tags is not showing as you can see here.
I have no PHP error (I am in WP_DEBUG mode) and no error in the web console.

What am I missing ?

Thank you for your help.

“CREATE TABLE IF NOT EXISTS” does not return error if exists [closed]

This is my code:

$query = "CREATE TABLE IF NOT EXISTS `data`(`id` INT(11) AUTO_INCREMENT, `car` INT(11), PRIMARY KEY(id))";

try {
    $stm = self::$connection->query($query);
    echo 'done';
} catch (PDOException $e) {
    echo $e->getMessage();
}

This code work fine, but if table is exists, PDO not return any error for me.

I want this code:

if ($stm) {
    echo "not exists and create table";
} else {
    echo "exists!"
}

Is it safe to use MongoDB sessions with PHP-FPM (multi-threads)?

I want to use MongoDB sessions to get a causal consistency guarantee.
However I use nginx with PHP-FPM which is multi-threaded. Excluding MongoDB documentation https://docs.mongodb.com/v4.2/core/read-isolation-consistency-recency/ specifies “Applications must ensure that only one thread at a time executes these operations in a client session.”.

So I’m stuck at this level and I don’t really see how to get out of it. The only solution I see
is to make PHP-FPM single thread which I obviously do not want for the advantages it provides.

Do you have any ideas ?

Thank you,

PHP Posting variables to another page after calculation

i’m trying to post my variables “$correct” and “$incorrect” over to another page call “testresult.php”. But i can’t seem to receive the variables on the other page. Is there something wrong with my codes?

<form action="testresult.php" method="POST">
    <label for="qn1">Question 1: <?php echo $array_question[$question_num_array[0]] ?></label><br>
    <input type="text" id="question1_answer" name="question1_answer" required><br><br>
    
    <label for="qn2">Question 2: <?php echo $array_question[$question_num_array[1]] ?></label><br>
    <input type="text" id="question2_answer" name="question2_answer" required><br><br>

    <label for="qn3">Question 3: <?php echo $array_question[$question_num_array[2]] ?></label><br>
    <input type="text" id="question3_answer" name="question3_answer" required><br><br>

    <input type="hidden" name="correct" id="correct" value="<?php $correct ?>" />
    <input type="hidden" name="incorrect" id="incorrect" value="<?php $incorrect ?>" />
    
    <input type="submit" name="submitAnswers" value="Submit">
</form>

<?php
        if(isset($_POST["submitAnswers"])){
            $correct = 0;
            $incorrect = 0;
            $qn1_ans = $_POST['question1_answer'];
            $qn2_ans = $_POST['question2_answer'];
            $qn3_ans = $_POST['question3_answer'];

            if ($qn1_ans == $array_answer[$question_num_array[0]]){ $correct ++; }
            else { $incorrect ++; }

            if ($qn2_ans == $array_answer[$question_num_array[1]]){ $correct ++; }
            else { $incorrect ++; }

            if ($qn3_ans == $array_answer[$question_num_array[2]]){ $correct ++; }
            else { $incorrect ++; }

        }
    ?>

On the other page, this is my code.

<html>
    <head>
    <title>Results</title>
    </head>
    <body>
        <?php
        $correct = $_POST['correct'];
        $incorrect = $_POST['incorrect'];

        echo $correct."test ".$incorrect;
        ?>
    </body>
</html>

Problem in docker images it is not starting

I made in my project nginx, mysql, phpMyadmin, encore and php images.
Just php and encore dosent work, they are successed built, but the are with red color.

that is my docker-compose.yml:

version: '3.3'
services:
 database:
   container_name: database
   image: mysql:8.0
   restart: always
   command: --default-authentication-plugin=mysql_native_password
   environment:
     MYSQL_ROOT_PASSWORD: alsbls
     MYSQL_DATABASE: infoSystem
     MYSQL_USER: alsbls
     MYSQL_PASSWORD: alsbls
   ports:
     - '4306:3306'
   volumes:
     - ./mysql:/var/lib/mysql

 php:
   container_name: php
   restart: always
   build:
     context: ./php
   ports:
     - '9000:9000'
   volumes:
     - ./app:/var/www/infoSystem

   depends_on:
     - database

 nginx:
   container_name: nginx
   image: nginx:stable-alpine
   restart: always
   ports:
     - '8080:80'
   volumes:
     - ./app:/var/www/infoSystem
     - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
   depends_on:
     - php
     - database

 phpmyadmin:
   image: phpmyadmin/phpmyadmin:latest
   restart: always
   environment:
     PMA_HOST: database
     PMA_USER: alsbls_root
     PMA_PASSWORD: alsbls_root
   ports:
     - "8081:81"

 encore:
   container_name: encore
   restart: always
   build:
     context: ./php
   volumes:
       - ./:/var/www/html

That is my Dockerfile:

FROM php:8.0-fpm
          
RUN apt update   
            && apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip 
            && docker-php-ext-install intl opcache pdo pdo_mysql 
            && pecl install apcu 
            && docker-php-ext-enable apcu 
            && docker-php-ext-configure zip 
            && docker-php-ext-install zip
WORKDIR /var/www/infoSystem
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
RUN git config --global user.email "[email protected]" 
        && git config --global user.name  "alsbls"




FROM node:12.10.0
WORKDIR /var/www/html
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN ["chmod", "+x", "/usr/local/bin/entrypoint"]
ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER node

that is the entrypoint.sh in the same dir of Dockerfile:

#!/bin/bash
# Prevent container from shutting down
while true; do sleep 3600; done

I didn’t receive any error message on the terminal.
Maybe some one now the issues.

Best regards

Persisting user preference for duration of session to filter product variation prices (WordPress, Woocommerce)

I would like the know the ideal way of adding a selection to the main nav of my wordpress/woocommerce site that lets users specify what region they prefer to see prices for. All the products have four variations, each one for a specific region and price. Someone from asia should then be able to select “asia” in a dropdown or radio button and only see product prices for asia when skimming through categories.

This setting should not be persisted to disk or db, only to session or something that works similarly in WP.

At the moment I have a filter set up for “woocommerce_variable_price_html” that simply replaces the “From X – Y$” format for prices with a hardcoded region price. But instead it should use the user specified region and then default to americas if none.

Thank you in advance! Let me know if anything needs elaboration.

Problem with preparing array with attendance for team

I got Users, Absences and Reasons tables:

Users
id | name 

Absences
id | user_id:foreignKey | reason_id:foreignKey | deputy_id:foreignKey | start:date | end:date

Reasons
id | name

I got attendance calendar which looks like:

Day   | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
-----------------------------------------------|
User1 | o | o | V | V | S | S | o | o | o | V  |
-----------------------------------------------|
User2 | T | o | o | o | H | V | o | V | o | V  |
-----------------------------------------------|

Where “V” is Vacation, “S” sick etc. I want to print each User attendance report in that table.

@foreach ($users as $user )
   <tr>
      <td> {{ $user->name }} </td>
   @if($user->absences != null)
      @foreach($days as $day)
         @foreach ($user->absences as $absence)
           @if($day >= $absence->start->format('d') && $day <= $absence->end->format('d'))
              // there check if $user->absence->reason_id == something ...
           @else
              
           @endif
         @endforeach
       @endforeach
    @endif
  </tr>
@endforeach

Also I want to have a tooltip, where I print specific data for each day (reason name, deputy name).

I have no idea how to get the range between two dates in each absence, merge it to got f.e table of user absence days with another array with reason.:

[
  2 => ['reason_id => 1, deputy_id = 3], 
  3 => ['reason_id => 1, deputy_id = 3], 
  7 => ['reason_id => 2, deputy_id = 1]
]

Where keys [2,3,7] are the days of the absence.

Is there easier way to achieve that or should I rebuild the database structure?

Add image to PHP email template

If I add the following line into the template the checkout becomes unavailable.

"n<img src="https://example.com/images/girocode.png" alt="GiroCode" />" . 

How can I make the work in PHP?

Prepared statement always returns true, also when (previously registered) username is not found in database

next block is located in class that inherits database class,connect() is my method for connecting to a database

protected function checkUser($username){
    $searchForUser=$this->connect()->prepare('select username from users where username=?;');

    if($searchForUser->execute(array($username))){
        $searchForUser=null;
        header("location: ../login.php?error=existing_username");
        exit();
    }

    $check=false;
    if($searchForUser->rowCount()>0){
        $check=true;
    }
    return $check;
}

next block is from class that inherits a class above

private function checkForUserExistance(){
    $value = false;
    if($this->checkUser($this->username)){
        $value=true;
    }
    return $value;
}

how to solve the undefined property problem in laravel 8.7

I develop a forum module for a web site IN LARAVEL 8, I face the problem of Undefined property: AppModelsThread::$title, since 3 days I look for the solution but in vain.
Here is the code of my model

<?php
  namespace AppModels;
  use AppTraitsHasAuthor;
  use AppTraitsHasTags;
  use IlluminateDatabaseEloquentBuilder;
  use IlluminateDatabaseEloquentFactoriesHasFactory;
  use IlluminateDatabaseEloquentModel;
  use IlluminateDatabaseEloquentRelationsBelongsTo;
  use IlluminateSupportStr;
  class Thread extends Model
 {
use HasTags;
use HasAuthor;
use HasFactory;
const TABLE = 'threads';
protected $table = self::TABLE;
protected $fillable = [
    'title',
    'body',
    'slug',
    'writer_id',
    'category_id',
];
protected $with = [
    'category',
    'writer',
    'tags',];
public function category(): BelongsTo
{
    return $this->belongsTo(Category::class);
}

public function excerpt(int $limit = 250): string
{
    return Str::limit(strip_tags($this->body()), $limit);
}

public function id(): int
{
    return $this->id;
}

public function title(): string
{
    return $this->title;
}

public function body(): string
{
    return $this->body;
}

public function slug(): string
{
    return $this->slug;
}

public function delete()
{
    $this->removeTags();
    parent::delete();
}
public function scopeForTag(Builder $query, string $tag): Builder
{
    return $query->whereHas('tagsRelation', function ($query) use ($tag) {
        $query->where('tags.slug', $tag);
    });
}

code of my Controller that displays the details of the post (show)

public function show(Category $category, Thread $thread)
{
  return view('pages.threads.show', compact('thread', 'category'));
}

the different fragments of the views

  • Index

      @foreach($threads as $thread)
                         <article class="post post-medium">
                             <div class="row mb-3">
                                 <div class="col-lg-5">
                                     <div class="post-image thumb-info-wrapper border-radius-0">
                                         <a href="blog-post.html">
                                             <img src="{{asset('assets/frontend//img/blog/medium/blog-11.jpg')}}" class="img-fluid img-thumbnail img-thumbnail-no-borders rounded-0" style="width: 100px;height:100px" alt="" />
                                         </a>
                                     </div>
                                 </div>
                                 <div class="col-lg-7">
                                     <div class="post-content">
                                         <h2 class="font-weight-semibold pt-4 pt-lg-0 text-5 line-height-4 mb-2"><a href="{{ route('forums.show', [$thread->category->slug(), $thread->slug()]) }}"> {{ $thread->title() }}</a></h2>
                                         <p class="mb-0"> {{ $thread->excerpt() }}[...]</p>
                                     </div>
                                 </div>
                             </div>
                             <div class="row">
                                 <div class="col">
                                     <div class="post-meta">
                                         <span class="appear-animation"  data-appear-animation="flash" data-appear-animation-delay="0" data-appear-animation-duration="1s"><i class="far fa-calendar-alt"></i> {{ $thread->created_at->diffForHumans() }}</span>
                                         <span><i class="far fa-user"></i> By <a href="#">{{$thread->author()->name}}</a> </span>
                                         <span><i class="far fa-folder"></i> <a href="#">Lifestyle</a>, <a href="#">Design</a> </span>
                                         <span><i class="far fa-comments"></i> <a href="#">12 Comments</a></span>
                                         <a href="javascript:void(0)" class="text-muted d-inline-flex align-items-center align-middle" data-abc="true">
                                             <i class="fa fa-heart fa-spin text-danger"></i>&nbsp; <span class="align-middle">445</span> </a>
                                         <span class="text-muted d-inline-flex align-items-center align-middle ml-4">
                              <i class="fa fa-eye text-muted fsize-3"></i>&nbsp; <span class="align-middle">14532</span> </span>
                                         <span class="text-muted d-inline-flex align-items-center align-middle ml-4">
                              <i class="fa fa-comments text-muted fsize-3"></i>&nbsp; <span class="align-middle">14532</span>
                          </span>
                                         <span class="d-block d-sm-inline-block float-sm-right mt-3 mt-sm-0"><a href="{{ route('forums.show', [$thread->category->slug(), $thread->slug()]) }}" class="btn btn-xs btn-light text-1 text-uppercase">Read More</a></span>
                                     </div>
                                 </div>
                             </div>
                         </article>
                         @endforeach
    

*show

  @extends('layouts.guest')

  @section('title', 'forum')

 @push('css')

 @endpush

@section('content')
<section class="page-header page-header-modern bg-color-light-scale-1 page-header-md">
    <div class="container">
        <div class="row">
            <div class="col-md-12 align-self-center p-static order-2 text-center">
                <h1 class="text-dark font-weight-bold text-8">Medium Image Right Sidebar</h1>
                <span class="sub-title text-dark">Check out our Latest News!</span>
            </div>
            <div class="col-md-12 align-self-center order-1">
                <ul class="breadcrumb d-block text-center">
                    <li><a href="{{route('home')}}">Home</a></li>
                    <li><a href="{{route('forums.index')}}">Forum</a></li>
                    <li><a href="#">{{ $category->name() }}</a></li>
                    <li class="active">{{ $thread->title() }}</li>
                </ul>
            </div>
        </div>
    </div>
</section>
<div class="container-fluid mt-100">
    <div class="row">
        <div class="col-md-12">
            <div class="card mb-4">
                <div class="card-header">
                    <div class="media flex-wrap w-100 align-items-center"> <img src="https://i.imgur.com/iNmBizf.jpg" class="d-block ui-w-40 rounded-circle" alt="">
                        <div class="media-body ml-5"> <a href="javascript:void(0)" data-abc="true">Tom Harry</a>
                            <div class="text-muted small">13 days ago</div>
                        </div>
                        <div class="text-muted small ml-3">
                            <div>Member since <strong>01/1/2019</strong></div>
                            <div><strong>134</strong> posts</div>
                        </div>
                    </div>
                </div>
                <div class="card-body">
               <p>{!! $thread->body() !!}</p>
                </div>
                <div class="card-footer d-flex flex-wrap justify-content-between align-items-center px-0 pt-0 pb-3">
                    <div class="px-4 pt-3">
                        <a href="javascript:void(0)" class="text-muted d-inline-flex align-items-center align-middle" data-abc="true">
                            <i class="fa fa-heart fa-spin text-danger"></i>&nbsp; <span class="align-middle">445</span> </a>
                        <span class="text-muted d-inline-flex align-items-center align-middle ml-4">
                            <i class="fa fa-eye text-muted fsize-3"></i>&nbsp; <span class="align-middle">14532</span> </span>
                        <span class="text-muted d-inline-flex align-items-center align-middle ml-4">
                            <i class="fa fa-comments text-muted fsize-3"></i>&nbsp; <span class="align-middle">14532</span>
                        </span>
                    </div>
                    <div class="px-4 pt-3"> <button type="button" class="btn btn-primary"><i class="ion ion-md-create"></i>&nbsp; Reply</button> </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection


@push('js')

@endpush

thank you for your help

Is it a bad practice to send AJAX requests with always the POST HTTP method?

I was asking myself if it was a bad practice to send every ajax request I use on my Laravel 8 project with the HTTP Post method.

What I mean is that, according to Laravel 8 documentation on routing (if I understood everything well), you should use the appropriate HTTP request :

Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);

A French tutorial on the routes explains this (translated by myself) :

GET : ask for a resource that never changes,
POST : update or create a resource (often wrongly used when PUT is needed),
PUT : create or replace a resource,
PATCH : partialy update a resource,
DELETE : delete a resource.

The “problem”, if there is one, is that in my code in almost only use HTTP post requests for AJAX in my routes/web.php file, like this :

Route::post('mails/update/{id}', 'AppHttpControllersMailController@update');
Route::post('mails/sendMail/', 'AppHttpControllersMailController@sendMailTest')->name('mails.sendMailTest');
Route::post('mails/sendInstantMail/', 'AppHttpControllersMailController@sendInstantMail')->name('mails.sendInstantMail');
Route::post('mails/getRouteList/', 'AppHttpControllersMailController@getRouteList')->name('mails.getRouteList');

According to what I read, I should probably use PUT or PATCH for my update method. But with POST it works. Is it a bad practice to continue to use POST?

If I guess right, AJAX is only a way to do HTTP request, but in fact it is still the same idea behind the request, so I should change my request methods.

I am really sorry if my question is dumb, and thanks for your help!

Sources :

Laravel 8 – Route documentation about the router methods : https://laravel.com/docs/8.x/routing#available-router-methods

French tutorial on Laravel routing see “Les méthodes” chapter : https://laravel.sillo.org/cours-laravel-8-les-bases-le-routage/

English translated tutorial with Google Translate (See “The methods” chapter) : https://laravel-sillo-org.translate.goog/cours-laravel-8-les-bases-le-routage/?_x_tr_sl=fr&_x_tr_tl=en&_x_tr_hl=fr&_x_tr_pto=wapp