Plugin Directory

Changeset 3351090


Ignore:
Timestamp:
08/27/2025 10:31:29 AM (4 months ago)
Author:
naibabiji
Message:

update 1.0.7

Location:
naibabiji-b2b-product-showcase/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • naibabiji-b2b-product-showcase/trunk/includes/class-admin-settings.php

    r3350010 r3351090  
    159159                <h3><?php echo esc_html__('Usage Instructions', 'naibabiji-b2b-product-showcase'); ?></h3>
    160160                <ul>
    161                     <li><strong><?php echo esc_html__('Product Archive Page', 'naibabiji-b2b-product-showcase'); ?>:</strong> <?php echo esc_html__('Visit', 'naibabiji-b2b-product-showcase'); ?> <code><?php echo esc_url(home_url('/naibb2pr-products/')); ?></code> <?php echo esc_html__('to view all products', 'naibabiji-b2b-product-showcase'); ?></li>
     161                    <li><strong><?php echo esc_html__('Product Archive Page', 'naibabiji-b2b-product-showcase'); ?>:</strong> <?php echo esc_html__('Visit', 'naibabiji-b2b-product-showcase'); ?> <code><?php echo esc_url(home_url('/products/')); ?></code> <?php echo esc_html__('to view all products', 'naibabiji-b2b-product-showcase'); ?></li>
    162162                    <li><strong><?php echo esc_html__('Shortcode', 'naibabiji-b2b-product-showcase'); ?>:</strong> <?php echo esc_html__('Use', 'naibabiji-b2b-product-showcase'); ?> <code>[naibabiji_b2b_products]</code> <?php echo esc_html__('to display product grid on any page', 'naibabiji-b2b-product-showcase'); ?></li>
    163163                    <li><strong><?php echo esc_html__('Shortcode Parameters', 'naibabiji-b2b-product-showcase'); ?>:</strong>
     
    172172            </div>
    173173        </div>
    174        
     174        <?php
    175175        // 添加内联样式
    176176        wp_add_inline_style(
     
    192192            }'
    193193        );
    194         <?php
    195194    }
    196195   
  • naibabiji-b2b-product-showcase/trunk/includes/class-meta-fields.php

    r3350010 r3351090  
    350350   
    351351    /**
    352      * 添加产品编辑页面的自定义样式和设置模态框
     352     * 添加产品编辑页面的自定义样式
    353353     *
    354354     * @since 1.0.0
     
    357357        global $post_type, $pagenow;
    358358        if ( 'naibb2pr_products' === $post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
    359             $default_inquiry_url = get_option( 'naibabiji_b2b_product_default_inquiry_url', '' );
    360             $default_inquiry_text = get_option( 'naibabiji_b2b_product_inquiry_button_text', esc_html__( 'Get Quote', 'naibabiji-b2b-product-showcase' ) );
    361            
    362359            // 添加内联样式
    363360            wp_add_inline_style(
     
    369366                    width: 100%;
    370367                    min-height: 80px;
    371                 }
    372                
    373                 /* 设置模态框样式 */
    374                 .naibabiji-b2b-settings-modal {
    375                     display: none;
    376                     position: fixed;
    377                     z-index: 100000;
    378                     left: 0;
    379                     top: 0;
    380                     width: 100%;
    381                     height: 100%;
    382                     background-color: rgba(0,0,0,0.5);
    383                 }
    384                 .naibabiji-b2b-settings-modal-content {
    385                     background-color: #fefefe;
    386                     margin: 5% auto;
    387                     padding: 20px;
    388                     border: 1px solid #888;
    389                     width: 80%;
    390                     max-width: 600px;
    391                     border-radius: 5px;
    392                 }
    393                 .naibabiji-b2b-settings-close {
    394                     color: #aaa;
    395                     float: right;
    396                     font-size: 28px;
    397                     font-weight: bold;
    398                     cursor: pointer;
    399                 }
    400                 .naibabiji-b2b-settings-close:hover {
    401                     color: black;
    402368                }'
    403369            );
    404            
    405             $save_success_msg = esc_js( __( 'Settings saved successfully! The page will refresh to show new settings.', 'naibabiji-b2b-product-showcase' ) );
    406             $save_failed_msg = esc_js( __( 'Save failed:', 'naibabiji-b2b-product-showcase' ) );
    407             $unknown_error_msg = esc_js( __( 'Unknown error', 'naibabiji-b2b-product-showcase' ) );
    408            
    409             // 添加内联脚本
    410             wp_add_inline_script(
    411                 'naibabiji-b2b-product-showcase-admin-script',
    412                 'function openSettingsModal() {
    413                     document.getElementById("naibabijiB2bSettingsModal").style.display = "block";
    414                 }
    415                
    416                 function closeSettingsModal() {
    417                     document.getElementById("naibabijiB2bSettingsModal").style.display = "none";
    418                 }
    419                
    420                 function saveSettings() {
    421                     var form = document.getElementById("naibabijiB2bSettingsForm");
    422                     var formData = new FormData(form);
    423                     formData.append("action", "naibabiji_b2b_save_settings");
    424                    
    425                     fetch(ajaxurl, {
    426                         method: "POST",
    427                         body: formData
    428                     })
    429                     .then(function(response) {
    430                         return response.json();
    431                     })
    432                     .then(function(data) {
    433                         if (data.success) {
    434                             alert("' . $save_success_msg . '");
    435                             location.reload();
    436                         } else {
    437                             alert("' . $save_failed_msg . ' " + (data.data || "' . $unknown_error_msg . '"));
    438                         }
    439                     })
    440                     .catch(function(error) {
    441                         alert("' . $save_failed_msg . ' " + error.message);
    442                     });
    443                 }
    444                
    445                 // 点击模态框外部关闭
    446                 window.onclick = function(event) {
    447                     var modal = document.getElementById("naibabijiB2bSettingsModal");
    448                     if (event.target == modal) {
    449                         closeSettingsModal();
    450                     }
    451                 }'
    452             );
    453             ?>
    454             <!-- 设置模态框 -->
    455             <div id="naibabijiB2bSettingsModal" class="naibabiji-b2b-settings-modal">
    456                 <div class="naibabiji-b2b-settings-modal-content">
    457                     <span class="naibabiji-b2b-settings-close" onclick="closeSettingsModal()">&times;</span>
    458                     <h2><?php esc_html_e( 'B2B Product Showcase - Global Settings', 'naibabiji-b2b-product-showcase' ); ?></h2>
    459                     <form id="naibabijiB2bSettingsForm">
    460                         <table class="form-table">
    461                             <tr>
    462                                 <th scope="row">
    463                                     <label for="naibabiji_b2b_product_default_inquiry_url"><?php esc_html_e( 'Default Inquiry Page URL:', 'naibabiji-b2b-product-showcase' ); ?></label>
    464                                 </th>
    465                                 <td>
    466                                     <input type="url" id="naibabiji_b2b_product_default_inquiry_url" name="naibabiji_b2b_product_default_inquiry_url"
    467                                            value="<?php echo esc_attr( $default_inquiry_url ); ?>" class="regular-text">
    468                                 </td>
    469                             </tr>
    470                             <tr>
    471                                 <th scope="row">
    472                                     <label for="naibabiji_b2b_product_inquiry_button_text"><?php esc_html_e( 'Default Inquiry Button Text:', 'naibabiji-b2b-product-showcase' ); ?></label>
    473                                 </th>
    474                                 <td>
    475                                     <input type="text" id="naibabiji_b2b_product_inquiry_button_text" name="naibabiji_b2b_product_inquiry_button_text"
    476                                            value="<?php echo esc_attr( $default_inquiry_text ); ?>" class="regular-text">
    477                                 </td>
    478                             </tr>
    479                         </table>
    480                         <p class="submit">
    481                             <button type="button" class="button button-primary" onclick="saveSettings()"><?php esc_html_e( 'Save Settings', 'naibabiji-b2b-product-showcase' ); ?></button>
    482                         </p>
    483                     </form>
    484                 </div>
    485             </div>
    486             <?php
    487370        }
    488371    }
  • naibabiji-b2b-product-showcase/trunk/includes/post-types.php

    r3350010 r3351090  
    5151        'show_in_nav_menus'     => true,
    5252        'can_export'            => true,
    53         'has_archive'           => 'naibb2pr_products',
     53        'has_archive'           => 'products',
    5454        'exclude_from_search'   => false,
    5555        'publicly_queryable'    => true,
     
    5757        'show_in_rest'          => true,
    5858        'rewrite'               => array(
    59             'slug'       => 'naibb2pr_products',
     59            'slug'       => 'products',
    6060            'with_front' => false,
    6161        ),
  • naibabiji-b2b-product-showcase/trunk/naibabiji-b2b-product-showcase.php

    r3350010 r3351090  
    44 * Plugin URI: https://blog.naibabiji.com
    55 * Description: Lightweight B2B product showcase plugin designed for corporate websites, without shopping cart functionality, focusing on product display and inquiry.
    6  * Version: 1.0.6
     6 * Version: 1.0.7
    77 * Author: Naibabiji
    88 * Text Domain: naibabiji-b2b-product-showcase
     
    2525 * 定义插件常量
    2626 */
    27 define( 'NAIBABIJI_B2B_PRODUCT_SHOWCASE_VERSION', '1.0.6' );
     27define( 'NAIBABIJI_B2B_PRODUCT_SHOWCASE_VERSION', '1.0.7' );
    2828define( 'NAIBABIJI_B2B_PRODUCT_SHOWCASE_AUTHOR', 'Naibabiji' );
    2929define( 'NAIBABIJI_B2B_PRODUCT_SHOWCASE_URI', 'https://blog.naibabiji.com' );
  • naibabiji-b2b-product-showcase/trunk/readme.txt

    r3350010 r3351090  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.6
     7Stable tag: 1.0.7
    88License: GPL v2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    8282== Changelog ==
    8383
     84= 1.0.7 =
     85* Changed product archive page URL from 'naibb2pr-products' to 'products'
     86* Fixed PHP syntax error in admin settings page
     87
    8488= 1.0.6 =
    8589* Fixed an issue with WordPress official review feedback
Note: See TracChangeset for help on using the changeset viewer.