Plugin Directory

Changeset 3806754


Ignore:
Timestamp:
11/17/2026 07:55:37 AM (less than one hour ago)
Author:
gurmehub
Message:

Release version: 17-11-26 updates

Location:
kargo-entegrator
Files:
57 added
12 edited
12 copied

Legend:

Unmodified
Added
Removed
  • kargo-entegrator/tags/1.1.55/hooks/class-gcargo-ajax.php

    r3787702 r3806754  
    9595         */
    9696        public function middleware() {
    97                 // Ajax nonce kontrolü yap.
    98                 if ( check_ajax_referer( GCARGO_AJAX_ACTION ) && isset( $_REQUEST['action'] ) ) {
    99                         $request     = gcargo_clean( $_REQUEST );
    100                         $next_action = str_replace( "{$this->prefix}_", '', $request['action'] );
    101                         if ( ! current_user_can( gcargo_capability() ) ) {
    102                                 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'kargo-entegrator' ) );
     97                // Ajax nonce kontrolü yap; hata da ön yüzün okuyabileceği JSON olarak dönsün.
     98                if ( ! check_ajax_referer( GCARGO_AJAX_ACTION, false, false ) ) {
     99                        wp_send_json( array( 'error_message' => __( 'Oturum süresi doldu, lütfen sayfayı yenileyin.', 'kargo-entegrator' ) ), 403 );
     100                }
     101
     102                $request     = gcargo_clean( $_REQUEST );
     103                $next_action = str_replace( "{$this->prefix}_", '', $request['action'] );
     104
     105                $forbidden_message = __( 'You do not have sufficient permissions to access this page.', 'kargo-entegrator' );
     106
     107                if ( ! current_user_can( gcargo_capability( $next_action ) ) ) {
     108                        wp_send_json( array( 'error_message' => $forbidden_message ), 403 );
     109                }
     110
     111                try {
     112                        /**
     113                         * Uç noktaya istinaden çalıştırılacak fonksiyonu tanımlar,
     114                         * filter aracılığı ile farklı sınıfların farklı fonksiyonları ile de aksiyon alınabilir.
     115                         *
     116                         * @param string|array $callback Çalıştırılacak fonksiyon.
     117                         * @param mixed $next_action Uç nokta.
     118                         */
     119                        $action = apply_filters( "{$this->prefix}_ajax_action", $this->endpoints[ $next_action ], $next_action );
     120                        $body   = gcargo_clean( json_decode( file_get_contents( 'php://input' ) ) );
     121
     122                        /**
     123                         * İstek gövdesi çözümlendikten sonra, aksiyon çalıştırılmadan önce
     124                         * ek yetkilendirme (örn. pazaryeri satıcısının sipariş sahipliği) yapmak için kullanılır.
     125                         *
     126                         * @param true|false|WP_Error $allowed     İzin; true dışındaki her değer isteği reddeder.
     127                         * @param string              $next_action Uç nokta.
     128                         * @param mixed               $body        Çözümlenmiş istek gövdesi.
     129                         * @param int                 $user_id     İsteği yapan kullanıcı.
     130                         */
     131                        $allowed = apply_filters( "{$this->prefix}_ajax_authorize", true, $next_action, $body, get_current_user_id() );
     132
     133                        if ( true !== $allowed ) {
     134                                wp_send_json( array( 'error_message' => is_wp_error( $allowed ) ? $allowed->get_error_message() : $forbidden_message ), 403 );
    103135                        }
    104136
    105                         try {
    106                                 /**
    107                                  * Uç noktaya istinaden çalıştırılacak fonksiyonu tanımlar,
    108                                  * filter aracılığı ile farklı sınıfların farklı fonksiyonları ile de aksiyon alınabilir.
    109                                  *
    110                                  * @param string|array $callback Çalıştırılacak fonksiyon.
    111                                  * @param mixed $next_action Uç nokta.
    112                                  */
    113                                 $action = apply_filters( "{$this->prefix}_ajax_action", $this->endpoints[ $next_action ], $next_action );
    114                                 // $action tanımlanan fonksiyonu çağır.
    115                                 $response = call_user_func( $action, gcargo_clean( json_decode( file_get_contents( 'php://input' ) ) ) );
    116 
    117                                 // WP_Error kontrolü yapar.
    118                                 if ( is_wp_error( $response ) ) {
    119                                         wp_send_json( array( 'error_message' => $response->get_error_message() ), 500 );
    120                                 }
    121 
    122                                 wp_send_json( $response );
    123                         } catch ( Exception $e ) {
    124 
    125                                 if ( $e instanceof GCARGO_Ajax_Validation_Exception ) {
    126                                         wp_send_json( $e->get_validation_errors(), 422 );
    127                                 }
    128                                 wp_send_json( array( 'error_message' => $e->getMessage() ), 500 );
     137                        // $action tanımlanan fonksiyonu çağır.
     138                        $response = call_user_func( $action, $body );
     139
     140                        // WP_Error kontrolü yapar.
     141                        if ( is_wp_error( $response ) ) {
     142                                wp_send_json( array( 'error_message' => $response->get_error_message() ), 500 );
    129143                        }
     144
     145                        wp_send_json( $response );
     146                } catch ( Exception $e ) {
     147
     148                        if ( $e instanceof GCARGO_Ajax_Validation_Exception ) {
     149                                wp_send_json( $e->get_validation_errors(), 422 );
     150                        }
     151                        wp_send_json( array( 'error_message' => $e->getMessage() ), 500 );
    130152                }
    131153        }
  • kargo-entegrator/tags/1.1.55/includes/gcargo-functions.php

    r3679172 r3806754  
    4242 * Kullanıcıya göre yetki tanımı.
    4343 *
     44 * Uç nokta adı filtreye iletilir; böylece pazaryeri eklentileri yalnızca
     45 * belirli AJAX uç noktaları için farklı bir yetki tanımlayabilir.
     46 *
     47 * @param string $endpoint AJAX uç noktası (ön eksiz, örn: print_barcode). AJAX dışı kontrollerde boştur.
     48 *
    4449 * @return string $role;
    4550 */
    46 function gcargo_capability() {
    47         return apply_filters( 'gcargo_capability', 'manage_woocommerce' );
     51function gcargo_capability( $endpoint = '' ) {
     52        return apply_filters( 'gcargo_capability', 'manage_woocommerce', $endpoint );
    4853}
    4954
  • kargo-entegrator/tags/1.1.55/kargo-entegrator.php

    r3806753 r3806754  
    44 * Plugin URI: https://kargoentegrator.com
    55 * Description: Kolay, hızlı, entegre edilebilir Woo kargo eklentisi 10’dan fazla firma ile entegre olun.
    6  * Version: 1.1.54
     6 * Version: 1.1.55
    77 * Author: GurmeHub
    88 * Author URI: https://gurmehub.com
    … …  
    4141         * @var string
    4242         */
    43         public $version = '1.1.54';
     43        public $version = '1.1.55';
    4444
    4545        /**
  • kargo-entegrator/tags/1.1.55/readme.txt

    r3806753 r3806754  
    88Requires at least: 6.4
    99Tested up to: 7.0.3
    10 Stable tag: 1.1.54
     10Stable tag: 1.1.55
    1111Requires PHP: 7.4
    1212License: GPLv2 or later
  • kargo-entegrator/tags/1.1.55/src/components/ShipmentListItem.vue

    r3787702 r3806754  
    3434
    3535const printPdf = async (id) => {
    36   const url = await getPdf({ data: { shipments: [id] } });
    37   emit("update:pdfUrl", url);
    38   emit("update:pdfUrlModal", true);
     36  try {
     37    const url = await getPdf({ data: { shipments: [id] } });
     38    emit("update:pdfUrl", url);
     39    emit("update:pdfUrlModal", true);
     40  } catch (e) {
     41    // AJAX hatalarının mesajı ajax eklentisi tarafından zaten gösteriliyor; diğerleri konsolda kalsın.
     42    console.error(e);
     43  }
    3944};
    4045
  • kargo-entegrator/tags/1.1.55/src/plugins/ajax.js

    r3640474 r3806754  
    3232          loading.value = false;
    3333        },
    34     error: (e) => {
     34    error: (e, textStatus) => {
    3535      loading.value = false;
    3636      if (e.status === 422 && onValidationError) {
    … …  
    3939      }
    4040      if (e.statusText !== "abort") {
     41        // Sunucu JSON dışında bir yanıt döndüyse (ör. PHP uyarısı, düz metin hata) anlamlı bir mesaj göster.
     42        const parseErrorMessage =
     43          textStatus === "parsererror"
     44            ? "Sunucudan beklenmeyen bir yanıt alındı. Lütfen sayfayı yenileyip tekrar deneyin."
     45            : "";
    4146        errorAlert({
    4247          message:
    4348            e.responseJSON?.error_message ||
     49            parseErrorMessage ||
    4450            e.statusText ||
    4551            "An error occurred",
  • kargo-entegrator/tags/1.1.55/vendor/composer/installed.php

    r3787702 r3806754  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'eae318a2727e2ce3d47ea6f2eca26224c0e15f1e',
     6        'reference' => '7834eb9f749dfe31deaacce1022d2b59f061ff41',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'eae318a2727e2ce3d47ea6f2eca26224c0e15f1e',
     16            'reference' => '7834eb9f749dfe31deaacce1022d2b59f061ff41',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • kargo-entegrator/trunk/hooks/class-gcargo-ajax.php

    r3787702 r3806754  
    9595         */
    9696        public function middleware() {
    97                 // Ajax nonce kontrolü yap.
    98                 if ( check_ajax_referer( GCARGO_AJAX_ACTION ) && isset( $_REQUEST['action'] ) ) {
    99                         $request     = gcargo_clean( $_REQUEST );
    100                         $next_action = str_replace( "{$this->prefix}_", '', $request['action'] );
    101                         if ( ! current_user_can( gcargo_capability() ) ) {
    102                                 wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'kargo-entegrator' ) );
     97                // Ajax nonce kontrolü yap; hata da ön yüzün okuyabileceği JSON olarak dönsün.
     98                if ( ! check_ajax_referer( GCARGO_AJAX_ACTION, false, false ) ) {
     99                        wp_send_json( array( 'error_message' => __( 'Oturum süresi doldu, lütfen sayfayı yenileyin.', 'kargo-entegrator' ) ), 403 );
     100                }
     101
     102                $request     = gcargo_clean( $_REQUEST );
     103                $next_action = str_replace( "{$this->prefix}_", '', $request['action'] );
     104
     105                $forbidden_message = __( 'You do not have sufficient permissions to access this page.', 'kargo-entegrator' );
     106
     107                if ( ! current_user_can( gcargo_capability( $next_action ) ) ) {
     108                        wp_send_json( array( 'error_message' => $forbidden_message ), 403 );
     109                }
     110
     111                try {
     112                        /**
     113                         * Uç noktaya istinaden çalıştırılacak fonksiyonu tanımlar,
     114                         * filter aracılığı ile farklı sınıfların farklı fonksiyonları ile de aksiyon alınabilir.
     115                         *
     116                         * @param string|array $callback Çalıştırılacak fonksiyon.
     117                         * @param mixed $next_action Uç nokta.
     118                         */
     119                        $action = apply_filters( "{$this->prefix}_ajax_action", $this->endpoints[ $next_action ], $next_action );
     120                        $body   = gcargo_clean( json_decode( file_get_contents( 'php://input' ) ) );
     121
     122                        /**
     123                         * İstek gövdesi çözümlendikten sonra, aksiyon çalıştırılmadan önce
     124                         * ek yetkilendirme (örn. pazaryeri satıcısının sipariş sahipliği) yapmak için kullanılır.
     125                         *
     126                         * @param true|false|WP_Error $allowed     İzin; true dışındaki her değer isteği reddeder.
     127                         * @param string              $next_action Uç nokta.
     128                         * @param mixed               $body        Çözümlenmiş istek gövdesi.
     129                         * @param int                 $user_id     İsteği yapan kullanıcı.
     130                         */
     131                        $allowed = apply_filters( "{$this->prefix}_ajax_authorize", true, $next_action, $body, get_current_user_id() );
     132
     133                        if ( true !== $allowed ) {
     134                                wp_send_json( array( 'error_message' => is_wp_error( $allowed ) ? $allowed->get_error_message() : $forbidden_message ), 403 );
    103135                        }
    104136
    105                         try {
    106                                 /**
    107                                  * Uç noktaya istinaden çalıştırılacak fonksiyonu tanımlar,
    108                                  * filter aracılığı ile farklı sınıfların farklı fonksiyonları ile de aksiyon alınabilir.
    109                                  *
    110                                  * @param string|array $callback Çalıştırılacak fonksiyon.
    111                                  * @param mixed $next_action Uç nokta.
    112                                  */
    113                                 $action = apply_filters( "{$this->prefix}_ajax_action", $this->endpoints[ $next_action ], $next_action );
    114                                 // $action tanımlanan fonksiyonu çağır.
    115                                 $response = call_user_func( $action, gcargo_clean( json_decode( file_get_contents( 'php://input' ) ) ) );
    116 
    117                                 // WP_Error kontrolü yapar.
    118                                 if ( is_wp_error( $response ) ) {
    119                                         wp_send_json( array( 'error_message' => $response->get_error_message() ), 500 );
    120                                 }
    121 
    122                                 wp_send_json( $response );
    123                         } catch ( Exception $e ) {
    124 
    125                                 if ( $e instanceof GCARGO_Ajax_Validation_Exception ) {
    126                                         wp_send_json( $e->get_validation_errors(), 422 );
    127                                 }
    128                                 wp_send_json( array( 'error_message' => $e->getMessage() ), 500 );
     137                        // $action tanımlanan fonksiyonu çağır.
     138                        $response = call_user_func( $action, $body );
     139
     140                        // WP_Error kontrolü yapar.
     141                        if ( is_wp_error( $response ) ) {
     142                                wp_send_json( array( 'error_message' => $response->get_error_message() ), 500 );
    129143                        }
     144
     145                        wp_send_json( $response );
     146                } catch ( Exception $e ) {
     147
     148                        if ( $e instanceof GCARGO_Ajax_Validation_Exception ) {
     149                                wp_send_json( $e->get_validation_errors(), 422 );
     150                        }
     151                        wp_send_json( array( 'error_message' => $e->getMessage() ), 500 );
    130152                }
    131153        }
  • kargo-entegrator/trunk/includes/gcargo-functions.php

    r3679172 r3806754  
    4242 * Kullanıcıya göre yetki tanımı.
    4343 *
     44 * Uç nokta adı filtreye iletilir; böylece pazaryeri eklentileri yalnızca
     45 * belirli AJAX uç noktaları için farklı bir yetki tanımlayabilir.
     46 *
     47 * @param string $endpoint AJAX uç noktası (ön eksiz, örn: print_barcode). AJAX dışı kontrollerde boştur.
     48 *
    4449 * @return string $role;
    4550 */
    46 function gcargo_capability() {
    47         return apply_filters( 'gcargo_capability', 'manage_woocommerce' );
     51function gcargo_capability( $endpoint = '' ) {
     52        return apply_filters( 'gcargo_capability', 'manage_woocommerce', $endpoint );
    4853}
    4954
  • kargo-entegrator/trunk/kargo-entegrator.php

    r3787702 r3806754  
    44 * Plugin URI: https://kargoentegrator.com
    55 * Description: Kolay, hızlı, entegre edilebilir Woo kargo eklentisi 10’dan fazla firma ile entegre olun.
    6  * Version: 1.1.54
     6 * Version: 1.1.55
    77 * Author: GurmeHub
    88 * Author URI: https://gurmehub.com
    … …  
    4141         * @var string
    4242         */
    43         public $version = '1.1.54';
     43        public $version = '1.1.55';
    4444
    4545        /**
  • kargo-entegrator/trunk/readme.txt

    r3787702 r3806754  
    88Requires at least: 6.4
    99Tested up to: 7.0.3
    10 Stable tag: 1.1.54
     10Stable tag: 1.1.55
    1111Requires PHP: 7.4
    1212License: GPLv2 or later
  • kargo-entegrator/trunk/src/components/ShipmentListItem.vue

    r3787702 r3806754  
    3434
    3535const printPdf = async (id) => {
    36   const url = await getPdf({ data: { shipments: [id] } });
    37   emit("update:pdfUrl", url);
    38   emit("update:pdfUrlModal", true);
     36  try {
     37    const url = await getPdf({ data: { shipments: [id] } });
     38    emit("update:pdfUrl", url);
     39    emit("update:pdfUrlModal", true);
     40  } catch (e) {
     41    // AJAX hatalarının mesajı ajax eklentisi tarafından zaten gösteriliyor; diğerleri konsolda kalsın.
     42    console.error(e);
     43  }
    3944};
    4045
  • kargo-entegrator/trunk/src/plugins/ajax.js

    r3640474 r3806754  
    3232          loading.value = false;
    3333        },
    34     error: (e) => {
     34    error: (e, textStatus) => {
    3535      loading.value = false;
    3636      if (e.status === 422 && onValidationError) {
    … …  
    3939      }
    4040      if (e.statusText !== "abort") {
     41        // Sunucu JSON dışında bir yanıt döndüyse (ör. PHP uyarısı, düz metin hata) anlamlı bir mesaj göster.
     42        const parseErrorMessage =
     43          textStatus === "parsererror"
     44            ? "Sunucudan beklenmeyen bir yanıt alındı. Lütfen sayfayı yenileyip tekrar deneyin."
     45            : "";
    4146        errorAlert({
    4247          message:
    4348            e.responseJSON?.error_message ||
     49            parseErrorMessage ||
    4450            e.statusText ||
    4551            "An error occurred",
  • kargo-entegrator/trunk/vendor/composer/installed.php

    r3787702 r3806754  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => 'eae318a2727e2ce3d47ea6f2eca26224c0e15f1e',
     6        'reference' => '7834eb9f749dfe31deaacce1022d2b59f061ff41',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    1414            'pretty_version' => 'dev-main',
    1515            'version' => 'dev-main',
    16             'reference' => 'eae318a2727e2ce3d47ea6f2eca26224c0e15f1e',
     16            'reference' => '7834eb9f749dfe31deaacce1022d2b59f061ff41',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.