Plugin Directory

Changeset 3404641


Ignore:
Timestamp:
11/28/2025 05:51:48 AM (3 months ago)
Author:
codoc
Message:

0.9.56.2

Location:
codoc
Files:
4 edited
30 copied

Legend:

Unmodified
Added
Removed
  • codoc/tags/0.9.56.2/class-codoc-util.php

    r3258348 r3404641  
    5252                ]
    5353            );
     54            // notification を処理
     55            $body = json_decode($response['body'],true);
     56            if (isset($body['notification']) && !empty($body['notification'])) {
     57                // notification をトランジェントに保存(24時間保持)
     58                set_transient('codoc_api_notification', $body['notification'], DAY_IN_SECONDS);
     59            }
    5460            if ( is_wp_error($response) || $response['response']['code'] != 200 ) {
    5561                //何もしない
  • codoc/tags/0.9.56.2/class-codoc.php

    r3341929 r3404641  
    188188          wp_enqueue_style('codoc-options-style', plugins_url( 'codoc/css/codoc-options.css', __DIR__ ));
    189189        }
     190
     191        // notification を削除する Ajax 処理
     192        add_action('wp_ajax_dismiss_codoc_notification', function() {
     193            delete_transient('codoc_api_notification');
     194            wp_die();
     195        });
     196
     197        // 管理画面で notification の dismiss を処理する JavaScript
     198        add_action('admin_footer', function() {
     199            ?>
     200            <script type="text/javascript">
     201            jQuery(document).ready(function($) {
     202                // codoc notification の×ボタンがクリックされたときの処理
     203                $(document).on('click', '.codoc-notification .notice-dismiss', function() {
     204                    $.post(ajaxurl, {
     205                        action: 'dismiss_codoc_notification'
     206                    });
     207                });
     208            });
     209            </script>
     210            <?php
     211        });
     212
    190213        add_action( "admin_init", function() {
    191214            global $CODOC_USERCODE;
     
    10851108
    10861109    function show_tadv_notice() {
     1110        // API からの notification を表示
     1111        $api_notifications = get_transient('codoc_api_notification');
     1112        if ($api_notifications && is_array($api_notifications)) {
     1113            // notification 配列のキーと値を表示
     1114            foreach ($api_notifications as $key => $value) {
     1115                // 値が配列やオブジェクトの場合は json_encode で文字列化
     1116                if (is_array($value) || is_object($value)) {
     1117                    $value = json_encode($value, JSON_UNESCAPED_UNICODE);
     1118                }
     1119                echo "<div class=\"notice notice-warning is-dismissible codoc-notification\"><p>" . esc_html($value) . "</p></div>";
     1120            }
     1121            //delete_transient('codoc_api_notification');
     1122        }
     1123
    10871124        $name = 'Advanced Editor Tools';
    10881125        $name_escaped = preg_replace('/ /','+',$name);
  • codoc/tags/0.9.56.2/codoc.php

    r3378697 r3404641  
    66Author:      codoc.jp
    77Author URI:  https://codoc.jp
    8 Version:     0.9.56.1
     8Version:     0.9.56.2
    99License:     GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 const CODOC_PLUGIN_VERSION        = '0.9.56.1';
     16const CODOC_PLUGIN_VERSION        = '0.9.56.2';
    1717const CODOC_URL                   = 'https://codoc.jp';
    1818const CODOC_USERCODE_OPTION_NAME  = 'codoc_usercode';
  • codoc/tags/0.9.56.2/readme.txt

    r3378697 r3404641  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 0.9.56.1
     7Stable tag: 0.9.56.2
    88Requires PHP: 5.4
    99License: GPLv2 or later
  • codoc/trunk/class-codoc-util.php

    r3258348 r3404641  
    5252                ]
    5353            );
     54            // notification を処理
     55            $body = json_decode($response['body'],true);
     56            if (isset($body['notification']) && !empty($body['notification'])) {
     57                // notification をトランジェントに保存(24時間保持)
     58                set_transient('codoc_api_notification', $body['notification'], DAY_IN_SECONDS);
     59            }
    5460            if ( is_wp_error($response) || $response['response']['code'] != 200 ) {
    5561                //何もしない
  • codoc/trunk/class-codoc.php

    r3341929 r3404641  
    188188          wp_enqueue_style('codoc-options-style', plugins_url( 'codoc/css/codoc-options.css', __DIR__ ));
    189189        }
     190
     191        // notification を削除する Ajax 処理
     192        add_action('wp_ajax_dismiss_codoc_notification', function() {
     193            delete_transient('codoc_api_notification');
     194            wp_die();
     195        });
     196
     197        // 管理画面で notification の dismiss を処理する JavaScript
     198        add_action('admin_footer', function() {
     199            ?>
     200            <script type="text/javascript">
     201            jQuery(document).ready(function($) {
     202                // codoc notification の×ボタンがクリックされたときの処理
     203                $(document).on('click', '.codoc-notification .notice-dismiss', function() {
     204                    $.post(ajaxurl, {
     205                        action: 'dismiss_codoc_notification'
     206                    });
     207                });
     208            });
     209            </script>
     210            <?php
     211        });
     212
    190213        add_action( "admin_init", function() {
    191214            global $CODOC_USERCODE;
     
    10851108
    10861109    function show_tadv_notice() {
     1110        // API からの notification を表示
     1111        $api_notifications = get_transient('codoc_api_notification');
     1112        if ($api_notifications && is_array($api_notifications)) {
     1113            // notification 配列のキーと値を表示
     1114            foreach ($api_notifications as $key => $value) {
     1115                // 値が配列やオブジェクトの場合は json_encode で文字列化
     1116                if (is_array($value) || is_object($value)) {
     1117                    $value = json_encode($value, JSON_UNESCAPED_UNICODE);
     1118                }
     1119                echo "<div class=\"notice notice-warning is-dismissible codoc-notification\"><p>" . esc_html($value) . "</p></div>";
     1120            }
     1121            //delete_transient('codoc_api_notification');
     1122        }
     1123
    10871124        $name = 'Advanced Editor Tools';
    10881125        $name_escaped = preg_replace('/ /','+',$name);
  • codoc/trunk/codoc.php

    r3378697 r3404641  
    66Author:      codoc.jp
    77Author URI:  https://codoc.jp
    8 Version:     0.9.56.1
     8Version:     0.9.56.2
    99License:     GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 const CODOC_PLUGIN_VERSION        = '0.9.56.1';
     16const CODOC_PLUGIN_VERSION        = '0.9.56.2';
    1717const CODOC_URL                   = 'https://codoc.jp';
    1818const CODOC_USERCODE_OPTION_NAME  = 'codoc_usercode';
  • codoc/trunk/readme.txt

    r3378697 r3404641  
    55Requires at least: 4.6
    66Tested up to: 6.8.2
    7 Stable tag: 0.9.56.1
     7Stable tag: 0.9.56.2
    88Requires PHP: 5.4
    99License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.