Making WordPress.org


Ignore:
Timestamp:
11/04/2022 11:01:38 AM (4 years ago)
Author:
akirk
Message:

gp-translation-helpers: Update from Github

Changes:

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers

    • Property svn:ignore
      •  

        old new  
        1010phpunit.xml.dist
        1111tests
         12bin
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php

    r12063 r12205  
    8181                        'gp_tmpl_load_locations',
    8282                        function( $locations, $template, $args, $template_path ) {
    83                                 if ( 'translation-row-editor-meta-status' === $template || 'locale-projects' === $template ) {
     83                                if ( 'translation-row-editor-meta-status' === $template ) {
    8484                                        array_unshift( $locations, dirname( dirname( __FILE__ ) ) . '/templates/gp-templates-overrides/' );
    8585                                } else {
     
    413413                $helper_discussion    = new Helper_Translation_Discussion();
    414414                $locale_slug          = $helper_discussion->sanitize_comment_locale( sanitize_text_field( $_POST['data']['locale_slug'] ) );
     415                $translation_status   = $helper_discussion->sanitize_translation_status( sanitize_text_field( $_POST['data']['translation_status'] ) );
    415416                $translation_id_array = ! empty( $_POST['data']['translation_id'] ) ? array_map( array( $helper_discussion, 'sanitize_translation_id' ), $_POST['data']['translation_id'] ) : null;
    416417                $original_id_array    = ! empty( $_POST['data']['original_id'] ) ? array_map( array( $helper_discussion, 'sanitize_original_id' ), $_POST['data']['original_id'] ) : null;
     
    443444
    444445                // Post comment on discussion page for the first string
    445                 $first_comment_id = $this->insert_comment( $comment, $first_original_id, $comment_reason, $first_translation_id, $locale_slug, $_SERVER );
     446                $first_comment_id = $this->insert_comment( $comment, $first_original_id, $comment_reason, $first_translation_id, $locale_slug, $_SERVER, $translation_status );
    446447
    447448                if ( ! empty( $original_id_array ) && ! empty( $translation_id_array ) ) {
     
    449450                        $comment = get_comment_link( $first_comment_id );
    450451                        foreach ( $original_id_array as $index => $single_original_id ) {
    451                                 $comment_id = $this->insert_comment( $comment, $single_original_id, $comment_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER );
     452                                $comment_id = $this->insert_comment( $comment, $single_original_id, $comment_reason, $translation_id_array[ $index ], $locale_slug, $_SERVER, $translation_status );
    452453                                $comment    = get_comment( $comment_id );
    453454                                GP_Notifications::add_related_comment( $comment );
     
    507508         * @since 0.0.2
    508509         */
    509         private function insert_comment( $comment, $original_id, $reason, $translation_id, $locale_slug, $server ) {
     510        private function insert_comment( $comment, $original_id, $reason, $translation_id, $locale_slug, $server, $translation_status ) {
    510511                $post_id = Helper_Translation_Discussion::get_or_create_shadow_post_id( $original_id );
    511512                $user    = wp_get_current_user();
     
    521522                                'user_id'              => $user->ID,
    522523                                'comment_meta'         => array(
    523                                         'reject_reason'  => $reason,
    524                                         'translation_id' => $translation_id,
    525                                         'locale'         => $locale_slug,
     524                                        'reject_reason'      => $reason,
     525                                        'translation_id'     => $translation_id,
     526                                        'locale'             => $locale_slug,
     527                                        'translation_status' => $translation_status,
    526528                                ),
    527529                        )
Note: See TracChangeset for help on using the changeset viewer.