| @@ -33,11 +33,8 @@ | ||
| 33 | 33 | add_filter('codoc_the_content',[$this,'the_content'],$priority); |
| 34 | 34 | |
| 35 | 35 | // 2020-07-25 excerpt対応 |
| 36 | 36 | add_filter('excerpt_allowed_blocks',[$this,'excerpt_allowed_blocks']); |
| 37 | - | |
| 38 | - // テーマが allowed_block_types_all で制限している場合に codoc ブロックを許可リストに追加 | |
| 39 | - add_filter('allowed_block_types_all', [$this,'allowed_block_types_all'], 100, 2); | |
| 40 | 37 | |
| 41 | 38 | $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME); |
| 42 | 39 | |
| 43 | 40 | if ($auth_info) { |
| @@ -45,10 +42,8 @@ | ||
| 45 | 42 | add_action( 'save_post', [$this,'save_post'], 20, 3 ); |
| 46 | 43 | add_action( 'added_post_meta', [$this,'updated_post_meta'], 10, 3 ); |
| 47 | 44 | add_action( 'updated_post_meta',[$this,'updated_post_meta'], 10, 3 ); |
| 48 | 45 | add_action( 'deleted_post_meta',[$this,'deleted_post_meta'], 10, 4 ); |
| 49 | - // 文字数バリデーションエラーの管理画面通知 | |
| 50 | - add_action( 'admin_notices', [$this,'show_validation_notices'] ); | |
| 51 | 46 | } |
| 52 | 47 | global $pagenow; |
| 53 | 48 | //管理画面でcodoc認証があり投稿画面の場合 |
| 54 | 49 | if (is_admin() and $auth_info and preg_match('/^post/',$pagenow)) { |
| @@ -53,10 +48,21 @@ | ||
| 53 | 48 | //管理画面でcodoc認証があり投稿画面の場合 |
| 54 | 49 | if (is_admin() and $auth_info and preg_match('/^post/',$pagenow)) { |
| 55 | 50 | // Gutenberg のサポートがない場合は何もしない |
| 56 | 51 | if ( function_exists( 'register_block_type' ) ) { |
| 57 | - // gutenberg - init.php handles all block registration and script enqueuing | |
| 52 | + // WPに登録ブロックとして認識させる(cgbは登録しないっぽい) | |
| 53 | + \WP_Block_Type_Registry::get_instance()->register('codoc/codoc-block'); | |
| 54 | + // gutenberg | |
| 58 | 55 | require_once 'src/init.php'; |
| 56 | + add_action('wp_loaded', function() { | |
| 57 | + wp_localize_script('codoc-block-js', 'OPTIONS', array( | |
| 58 | + 'codoc_url' => $this->get_codoc_url(), | |
| 59 | + 'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME), | |
| 60 | + 'codoc_plugin_version' => CODOC_PLUGIN_VERSION, | |
| 61 | + 'codoc_sdk_path' => CODOC_SDK_PATH, | |
| 62 | + )); | |
| 63 | + wp_set_script_translations('codoc-block-js', 'codoc',plugin_dir_path( __FILE__ ) . 'languages'); | |
| 64 | + }); | |
| 59 | 65 | } |
| 60 | 66 | // tinymce |
| 61 | 67 | $this->add_mce(); |
| 62 | 68 | } elseif(is_admin() and $auth_info and preg_match('/^edit/',$pagenow)) { |
| @@ -157,9 +163,9 @@ | ||
| 157 | 163 | public function add_settings() { |
| 158 | 164 | global $CODOC_SETTINGS; |
| 159 | 165 | add_action( 'admin_menu' ,function(){ |
| 160 | 166 | add_options_page( |
| 161 | - __('codoc Settings','codoc'), //ページタイトル | |
| 167 | + 'codoc の設定', //ページタイトル | |
| 162 | 168 | 'codoc', //設定メニューに表示されるメニュータイトル |
| 163 | 169 | 'edit_users', //権限 |
| 164 | 170 | 'codoc', //設定ページのURL。options-general.php?page=codoc |
| 165 | 171 | function() { |
| @@ -176,31 +182,8 @@ | ||
| 176 | 182 | add_action('admin_print_styles', 'codoc_admin_styles'); |
| 177 | 183 | function codoc_admin_styles($hook) { |
| 178 | 184 | wp_enqueue_style('codoc-options-style', plugins_url( 'codoc/css/codoc-options.css', __DIR__ )); |
| 179 | 185 | } |
| 180 | - | |
| 181 | - // notification を削除する Ajax 処理 | |
| 182 | - add_action('wp_ajax_dismiss_codoc_notification', function() { | |
| 183 | - delete_transient('codoc_api_notification'); | |
| 184 | - wp_die(); | |
| 185 | - }); | |
| 186 | - | |
| 187 | - // 管理画面で notification の dismiss を処理する JavaScript | |
| 188 | - add_action('admin_footer', function() { | |
| 189 | - ?> | |
| 190 | - <script type="text/javascript"> | |
| 191 | - jQuery(document).ready(function($) { | |
| 192 | - // codoc notification の×ボタンがクリックされたときの処理 | |
| 193 | - $(document).on('click', '.codoc-notification .notice-dismiss', function() { | |
| 194 | - $.post(ajaxurl, { | |
| 195 | - action: 'dismiss_codoc_notification' | |
| 196 | - }); | |
| 197 | - }); | |
| 198 | - }); | |
| 199 | - </script> | |
| 200 | - <?php | |
| 201 | - }); | |
| 202 | - | |
| 203 | 186 | add_action( "admin_init", function() { |
| 204 | 187 | global $CODOC_USERCODE; |
| 205 | 188 | global $CODOC_SETTINGS; |
| 206 | 189 | global $CODOC_TOKEN; |
| @@ -205,30 +188,18 @@ | ||
| 205 | 188 | global $CODOC_SETTINGS; |
| 206 | 189 | global $CODOC_TOKEN; |
| 207 | 190 | global $CODOC_AUTHINFO; |
| 208 | 191 | // codocからの認証データ処理 |
| 209 | - if (current_user_can('edit_posts') && !isset($_GET['confirm_token']) and isset($_GET['page']) and $_GET['page'] == 'codoc' and isset($_GET['fetch_token_key'])) { | |
| 210 | - $current_url = admin_url('options-general.php') . '?page=codoc'; | |
| 192 | + if (isset($_GET['page']) and $_GET['page'] == 'codoc' and isset($_GET['fetch_token_key'])) { | |
| 211 | 193 | $key = sanitize_text_field($_GET['fetch_token_key']); |
| 212 | 194 | $usercode = sanitize_text_field($_GET['usercode']); |
| 213 | - | |
| 214 | - // 確認画面の表示 | |
| 215 | - if ( | |
| 216 | - !isset($_GET['_wpnonce']) or | |
| 217 | - (isset($_GET['_wpnonce']) and !wp_verify_nonce($_GET['_wpnonce'],'fetch_token_nonce')) | |
| 218 | - ) { | |
| 219 | - wp_redirect($current_url . | |
| 220 | - sprintf("&confirm_token=1&fetch_token_key=%s&usercode=%s",$key,$usercode)); | |
| 221 | - exit; | |
| 222 | - } | |
| 223 | 195 | update_option(CODOC_USERCODE_OPTION_NAME,$usercode); |
| 224 | 196 | //$data = $this->callAPI('GET','/token',[ "fetch_token_key" => $key ]); |
| 225 | 197 | $data = $this->util->get_token([ "fetch_token_key" => $key ],["usercode" => $usercode, "token" => "1"]); |
| 226 | - if ($data->status and property_exists($data,'token') and $token = $data->token) { | |
| 198 | + if ($data->status and $token = $data->token) { | |
| 227 | 199 | update_option(CODOC_TOKEN_OPTION_NAME,$token); |
| 228 | 200 | //$data = $this->callAPI('GET',''); |
| 229 | 201 | $data = $this->util->get_user_info([],["usercode" => $usercode, "token" => $token]); |
| 230 | - | |
| 231 | 202 | if ($data->status and $user = $data->user) { |
| 232 | 203 | $this->update_codoc_authinfo($user); |
| 233 | 204 | } |
| 234 | 205 | #$current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
| @@ -233,10 +204,10 @@ | ||
| 233 | 204 | } |
| 234 | 205 | #$current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
| 235 | 206 | #$current_url = preg_replace('/(.*)fetch_token_key.*/','${1}&codoc_auth_finished=1',$current_url); |
| 236 | 207 | //add_settings_error( 'general', 'settings_updated', __( 'OK' ), 'success' ); |
| 208 | + $current_url = admin_url('options-general.php') . '?page=codoc&codoc_auth_finished=1'; | |
| 237 | 209 | |
| 238 | - $current_url = $current_url . '&codoc_auth_finished=1'; | |
| 239 | 210 | wp_redirect( $current_url); |
| 240 | 211 | exit; |
| 241 | 212 | } |
| 242 | 213 | } |
| @@ -327,18 +298,14 @@ | ||
| 327 | 298 | } |
| 328 | 299 | if (!isset($CODOC_SETTINGS['debug_params'])) { |
| 329 | 300 | $CODOC_SETTINGS['debug_params'] = ''; |
| 330 | 301 | } |
| 331 | - if (!isset($CODOC_SETTINGS['block_defaults'])) { | |
| 332 | - $CODOC_SETTINGS['block_defaults'] = ''; | |
| 333 | - } | |
| 334 | 302 | add_settings_section( |
| 335 | 303 | 'setting_section_id', // id |
| 336 | - __('codoc Settings','codoc'), // title | |
| 337 | - [$this,'show_tadv_notice'], | |
| 304 | + __('codoc Settings','codoc'), // title | |
| 305 | + function (){}, // callback | |
| 338 | 306 | 'codoc' // page |
| 339 | 307 | ); |
| 340 | - | |
| 341 | 308 | // 認証がある場合 |
| 342 | 309 | if ($CODOC_AUTHINFO) { |
| 343 | 310 | // クリエイター情報だけ更新 (POST時に同期をとる) |
| 344 | 311 | if (isset($_GET['page']) and $_GET['page'] == 'codoc' and isset($_GET['settings-updated'])) { |
| @@ -354,19 +321,9 @@ | ||
| 354 | 321 | } |
| 355 | 322 | |
| 356 | 323 | register_setting( |
| 357 | 324 | 'codoc_option_group', // option group |
| 358 | - CODOC_SETTINGS_OPTION_NAME, // option name(DB) | |
| 359 | - array('sanitize_callback' => function($input) { | |
| 360 | - if (isset($input['block_defaults']) && $input['block_defaults'] !== '') { | |
| 361 | - if (json_decode($input['block_defaults'], true) === null && $input['block_defaults'] !== 'null') { | |
| 362 | - $old = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 363 | - $input['block_defaults'] = isset($old['block_defaults']) ? $old['block_defaults'] : ''; | |
| 364 | - add_settings_error('block_defaults', 'invalid_json', esc_html(__('Block Default Values: Invalid JSON format. The value was not saved.','codoc')), 'error'); | |
| 365 | - } | |
| 366 | - } | |
| 367 | - return $input; | |
| 368 | - }) | |
| 325 | + CODOC_SETTINGS_OPTION_NAME // option name(DB) | |
| 369 | 326 | ); |
| 370 | 327 | add_settings_field( |
| 371 | 328 | 'css_path', // id |
| 372 | 329 | __('Theme','codoc'), // title |
| @@ -371,10 +328,10 @@ | ||
| 371 | 328 | 'css_path', // id |
| 372 | 329 | __('Theme','codoc'), // title |
| 373 | 330 | function() { |
| 374 | 331 | global $CODOC_SETTINGS; |
| 375 | - echo '<div class="excerpt">' . esc_html(__('You can change the design of the paywall by specifying a theme.<br />You can also specify CSS directly by selecting "Path Specification"','codoc')) . '</div>'; | |
| 376 | - echo sprintf('<div class="inputGroup"><input type="text" name="%s[css_path]" value="%s" id="codoc_css_path" readonly>',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['css_path'])); | |
| 332 | + echo '<div class="excerpt">' . __('You can change the design of the paywall by specifying a theme.<br />You can also specify CSS directly by selecting "Path Specification"','codoc') . '</div>'; | |
| 333 | + echo sprintf('<div class="inputGroup"><input type="text" name="%s[css_path]" value="%s" id="codoc_css_path" readonly>',CODOC_SETTINGS_OPTION_NAME,$CODOC_SETTINGS['css_path']); | |
| 377 | 334 | echo '' . |
| 378 | 335 | '<script type="text/javascript"> ' . |
| 379 | 336 | ' function gen_css_path(select) { ' . |
| 380 | 337 | ' if (select.value == "dark" || select.value == "dark-square") { ' . |
| @@ -398,48 +355,48 @@ | ||
| 398 | 355 | |
| 399 | 356 | echo sprintf('<select name="theme_name" onChange="gen_css_path(this)" id="codoc_theme_select">'); |
| 400 | 357 | foreach (["rainbow","blue","red","green","black","dark","rainbow-square","blue-square","red-square","green-square","black-square","dark-square"] as $theme) { |
| 401 | 358 | if ($theme == "rainbow") { |
| 402 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "rainbow" ? "selected" : ""),esc_attr(__('Rainbow colors','codoc'))); | |
| 359 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "rainbow" ? "selected" : ""),__('Rainbow colors','codoc')); | |
| 403 | 360 | } |
| 404 | 361 | if ($theme == "blue") { |
| 405 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "blue" ? "selected" : ""),esc_attr(__('Blue','codoc'))); | |
| 362 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "blue" ? "selected" : ""),__('Blue','codoc'),); | |
| 406 | 363 | } |
| 407 | 364 | if ($theme == "red") { |
| 408 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "red" ? "selected" : ""),esc_attr(__('Red','codoc'))); | |
| 365 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "red" ? "selected" : ""),__('Red','codoc')); | |
| 409 | 366 | } |
| 410 | 367 | if ($theme == "green") { |
| 411 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "green" ? "selected" : ""),esc_attr(__('Green','codoc'))); | |
| 368 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "green" ? "selected" : ""),__('Green','codoc')); | |
| 412 | 369 | } |
| 413 | 370 | if ($theme == "black") { |
| 414 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "black" ? "selected" : ""),esc_attr(__('Black','codoc'))); | |
| 371 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "black" ? "selected" : ""),__('Black','codoc')); | |
| 415 | 372 | } |
| 416 | 373 | if ($theme == "dark") { |
| 417 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "dark" ? "selected" : ""),esc_attr(__('Dark mode','codoc'))); | |
| 374 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "dark" ? "selected" : ""),__('Dark mode','codoc')); | |
| 418 | 375 | } |
| 419 | 376 | if ($theme == "rainbow-square") { |
| 420 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "rainbow-square" ? "selected" : ""),esc_attr(__("Rainbow Colors / Square design",'codoc'))); | |
| 377 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "rainbow-square" ? "selected" : ""),__("Rainbow Colors / Square design",'codoc')); | |
| 421 | 378 | } |
| 422 | 379 | if ($theme == "blue-square") { |
| 423 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "blue-square" ? "selected" : ""),esc_attr(__('Blue / Square design','codoc'))); | |
| 380 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "blue-square" ? "selected" : ""),__('Blue / Square design','codoc')); | |
| 424 | 381 | } |
| 425 | 382 | if ($theme == "red-square") { |
| 426 | - echo sprintf('<option value="%s" %s>%s/option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "red-square" ? "selected" : ""),esc_attr(__('Red / Square design','codoc'))); | |
| 383 | + echo sprintf('<option value="%s" %s>%s/option>', $theme, ($CODOC_SETTINGS["css_path"] == "red-square" ? "selected" : ""),__('Red / Square design','codoc')); | |
| 427 | 384 | } |
| 428 | 385 | if ($theme == "green-square") { |
| 429 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "green-square" ? "selected" : ""),esc_attr(__('Green / Square design','codoc'))); | |
| 386 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "green-square" ? "selected" : ""),__('Green / Square design','codoc')); | |
| 430 | 387 | } |
| 431 | 388 | if ($theme == "black-square") { |
| 432 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "black-square" ? "selected" : ""),esc_attr(__('Black / Square design','codoc'))); | |
| 389 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "black-square" ? "selected" : ""),__('Black / Square design','codoc')); | |
| 433 | 390 | } |
| 434 | 391 | if ($theme == "dark-square") { |
| 435 | - echo sprintf('<option value="%s" %s>%s</option>', esc_attr($theme), esc_attr($CODOC_SETTINGS["css_path"] == "dark-square" ? "selected" : ""),esc_attr(__('Dark mode / Square design','codoc'))); | |
| 392 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "dark-square" ? "selected" : ""),__('Dark mode / Square design','codoc')); | |
| 436 | 393 | } |
| 437 | 394 | } |
| 438 | - echo sprintf('<option value="path" %s>%s</option>', esc_attr(preg_match("/\//",$CODOC_SETTINGS["css_path"]) ? "selected" : ""),esc_attr(__('Path Specification','codoc'))); | |
| 395 | + echo sprintf('<option value="path" %s>%s</option>', (preg_match("/\//",$CODOC_SETTINGS["css_path"]) ? "selected" : ""),__('Path Specification','codoc')); | |
| 439 | 396 | echo '<script type="text/javascript">gen_css_path(document.getElementById(\'codoc_theme_select\'))</script>'; |
| 440 | 397 | echo sprintf('</select></div>'); |
| 441 | - echo '<p id="darkmode-caution" style="display:none">' . esc_attr(__('Please note that the theme for dark mode has white text color, and depending on the background color, the text may not be visible.','codoc')). '</p>'; | |
| 398 | + echo '<p id="darkmode-caution" style="display:none">' . __('Please note that the theme for dark mode has white text color, and depending on the background color, the text may not be visible.','codoc'). '</p>'; | |
| 442 | 399 | }, |
| 443 | 400 | 'codoc', //page |
| 444 | 401 | 'setting_section_id' //Section |
| 445 | 402 | ); |
| @@ -448,45 +405,45 @@ | ||
| 448 | 405 | __('Texts in paywall','codoc'), // title |
| 449 | 406 | function() { |
| 450 | 407 | global $CODOC_SETTINGS; |
| 451 | 408 | global $CODOC_AUTHINFO; |
| 452 | - echo '<div class="excerpt">' . esc_html(__('You can change, show and hide texts in your paywall.','codoc')) . '</div>'; | |
| 409 | + echo '<div class="excerpt">' . __('You can change, show and hide texts in your paywall.','codoc') . '</div>'; | |
| 453 | 410 | echo '<table class="innerTable"><tbody>'; |
| 454 | - echo '<tr><th>' . esc_html(__('Display of likes','codoc')) . '</th><td>'; | |
| 455 | - echo sprintf('<input type="radio" value="1" name="%s[show_like]" id="show_like_on" %s><label for="show_like_on">' . esc_html(__('Enable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_like'] == '1' ? "checked" : "")); | |
| 456 | - echo sprintf('<input type="radio" value="0" name="%s[show_like]" id="show_like_off" %s><label for="show_like_off">' . esc_html(__('Disable','codoc')) . '</label> <br / >',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_like'] == '0' ? "checked" : "")); | |
| 411 | + echo '<tr><th>' . __('Display of likes','codoc') . '</th><td>'; | |
| 412 | + echo sprintf('<input type="radio" value="1" name="%s[show_like]" id="show_like_on" %s><label for="show_like_on">' . __('Enable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_like'] == '1' ? "checked" : "")); | |
| 413 | + echo sprintf('<input type="radio" value="0" name="%s[show_like]" id="show_like_off" %s><label for="show_like_off">' . __('Disable','codoc') . '</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_like'] == '0' ? "checked" : "")); | |
| 457 | 414 | echo '</td></tr>'; |
| 458 | 415 | |
| 459 | - echo '<tr><th>' . esc_html(__('Display of PoweredBy','codoc')) . '</th><td>'; | |
| 460 | - echo sprintf('<input type="hidden" value="1" name="%s[show_about_codoc]">',esc_attr(CODOC_SETTINGS_OPTION_NAME)); | |
| 461 | - echo sprintf('<input type="hidden" value="1" name="%s[show_created_by]">',esc_attr(CODOC_SETTINGS_OPTION_NAME)); | |
| 462 | - echo sprintf('<input type="hidden" value="1" name="%s[show_powered_by]">',esc_attr(CODOC_SETTINGS_OPTION_NAME)); | |
| 416 | + echo '<tr><th>' . __('Display of PoweredBy','codoc') . '</th><td>'; | |
| 417 | + echo sprintf('<input type="hidden" value="1" name="%s[show_about_codoc]">',CODOC_SETTINGS_OPTION_NAME); | |
| 418 | + echo sprintf('<input type="hidden" value="1" name="%s[show_created_by]">',CODOC_SETTINGS_OPTION_NAME); | |
| 419 | + echo sprintf('<input type="hidden" value="1" name="%s[show_powered_by]">',CODOC_SETTINGS_OPTION_NAME); | |
| 463 | 420 | if (isset($CODOC_AUTHINFO['account_is_pro']) and $CODOC_AUTHINFO['account_is_pro']) { |
| 464 | - echo sprintf('<input type="radio" value="1" name="%s[show_copyright]" id="show_copyright_on" %s><label for="show_copyright_on">' . esc_html(__('Enable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_copyright'] == '1' ? "checked" : "")); | |
| 465 | - echo sprintf('<input type="radio" value="0" name="%s[show_copyright]" id="show_copyright_off" %s><label for="show_copyright_off">' . esc_html(__('Disable','codoc')) . '</label> <br / >',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_copyright'] == '0' ? "checked" : "")); | |
| 421 | + echo sprintf('<input type="radio" value="1" name="%s[show_copyright]" id="show_copyright_on" %s><label for="show_copyright_on">' . __('Enable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_copyright'] == '1' ? "checked" : "")); | |
| 422 | + echo sprintf('<input type="radio" value="0" name="%s[show_copyright]" id="show_copyright_off" %s><label for="show_copyright_off">' . __('Disable','codoc') . '</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_copyright'] == '0' ? "checked" : "")); | |
| 466 | 423 | } else { |
| 467 | - echo esc_html(__('Only PRO accounts can be disabled.','codoc')); | |
| 424 | + echo __('Only PRO accounts can be disabled.','codoc'); | |
| 468 | 425 | } |
| 469 | 426 | echo '</td></tr>'; |
| 470 | 427 | |
| 471 | - echo '<tr><th>' . esc_html(__('"Purchase Article" button text','codoc')) . '</th><td>'; | |
| 472 | - echo sprintf('<input type="text" name="%s[entry_button_text]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['entry_button_text'])); | |
| 428 | + echo '<tr><th>' . __('"Purchase Article" button text','codoc') . '</th><td>'; | |
| 429 | + echo sprintf('<input type="text" name="%s[entry_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['entry_button_text'])); | |
| 473 | 430 | echo '</td></tr>'; |
| 474 | 431 | |
| 475 | - echo '<tr><th>' . esc_html(__('"Purchase Subscription" button text.','codoc')) . '</th><td>'; | |
| 476 | - echo sprintf('<input type="text" name="%s[subscription_button_text]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['subscription_button_text'])); | |
| 432 | + echo '<tr><th>' . __('"Purchase Subscription" button text.','codoc') . '</th><td>'; | |
| 433 | + echo sprintf('<input type="text" name="%s[subscription_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['subscription_button_text'])); | |
| 477 | 434 | echo '</td></tr>'; |
| 478 | 435 | |
| 479 | - echo '<tr><th>' . esc_html(__('Support button text','codoc')) . '</th><td>'; | |
| 480 | - echo sprintf('<input type="text" name="%s[support_button_text]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['support_button_text'])); | |
| 436 | + echo '<tr><th>' . __('Support button text','codoc') . '</th><td>'; | |
| 437 | + echo sprintf('<input type="text" name="%s[support_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['support_button_text'])); | |
| 481 | 438 | echo '</td></tr>'; |
| 482 | 439 | |
| 483 | - echo '<tr><th>' . esc_html(__('Text for "Articles Included in Subscription".','codoc')) . '</th><td>'; | |
| 484 | - echo sprintf('<input type="text" name="%s[subscription_message]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['subscription_message'])); | |
| 440 | + echo '<tr><th>' . __('Text for "Articles Included in Subscription".','codoc') . '</th><td>'; | |
| 441 | + echo sprintf('<input type="text" name="%s[subscription_message]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['subscription_message'])); | |
| 485 | 442 | echo '</td></tr>'; |
| 486 | 443 | |
| 487 | - echo '<tr><th>' . esc_html(__('Text for support description','codoc')) . '</th><td>'; | |
| 488 | - echo sprintf('<input type="text" name="%s[support_message]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['support_message'])); | |
| 444 | + echo '<tr><th>' . __('Text for support description','codoc') . '</th><td>'; | |
| 445 | + echo sprintf('<input type="text" name="%s[support_message]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['support_message'])); | |
| 489 | 446 | echo '</td></tr>'; |
| 490 | 447 | |
| 491 | 448 | echo '</tbody></table>'; |
| 492 | 449 | }, |
| @@ -498,10 +455,10 @@ | ||
| 498 | 455 | 'codoc_tag_attributes', // id |
| 499 | 456 | __('Attributes for codoc tag','codoc'), // title |
| 500 | 457 | function() { |
| 501 | 458 | global $CODOC_SETTINGS; |
| 502 | - echo '<div class="excerpt">' . esc_html(__('You can add specific attributes to codoc tags.','codoc')) . '</div>'; | |
| 503 | - echo sprintf('<input type="text" name="%s[codoc_tag_attributes]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['codoc_tag_attributes'])); | |
| 459 | + echo '<div class="excerpt">' . __('You can add specific attributes to codoc tags.','codoc') . '</div>'; | |
| 460 | + echo sprintf('<input type="text" name="%s[codoc_tag_attributes]" value="%s">',CODOC_SETTINGS_OPTION_NAME,htmlspecialchars($CODOC_SETTINGS['codoc_tag_attributes'])); | |
| 504 | 461 | }, |
| 505 | 462 | 'codoc', //page |
| 506 | 463 | 'setting_section_id' //Section |
| 507 | 464 | ); |
| @@ -509,10 +466,10 @@ | ||
| 509 | 466 | 'codoc_script_tag_attributes', // id |
| 510 | 467 | __('Attributes for codoc script tag','codoc'), // title |
| 511 | 468 | function() { |
| 512 | 469 | global $CODOC_SETTINGS; |
| 513 | - echo '<div class="excerpt">' . esc_html(__('You can add specific attributes to codoc script tags.','codoc')) . '</div>'; | |
| 514 | - echo sprintf('<input type="text" name="%s[codoc_script_tag_attributes]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['codoc_script_tag_attributes'])); | |
| 470 | + echo '<div class="excerpt">' . __('You can add specific attributes to codoc script tags.','codoc') . '</div>'; | |
| 471 | + echo sprintf('<input type="text" name="%s[codoc_script_tag_attributes]" value="%s">',CODOC_SETTINGS_OPTION_NAME,htmlspecialchars($CODOC_SETTINGS['codoc_script_tag_attributes'])); | |
| 515 | 472 | }, |
| 516 | 473 | 'codoc', //page |
| 517 | 474 | 'setting_section_id' //Section |
| 518 | 475 | ); |
| @@ -520,12 +477,12 @@ | ||
| 520 | 477 | 'str_replace_binded_url', // id |
| 521 | 478 | __('Permalink','codoc'), // title |
| 522 | 479 | function() { |
| 523 | 480 | global $CODOC_SETTINGS; |
| 524 | - echo '<div class="excerpt">' . esc_html(__('You can replace the part of permalink registered on the codoc.','codoc')) . '</div>'; | |
| 525 | - echo sprintf('<input type="text" name="%s[str_replace_binded_url_from]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['str_replace_binded_url_from'])); | |
| 481 | + echo '<div class="excerpt">' . __('You can replace the part of permalink registered on the codoc.','codoc') . '</div>'; | |
| 482 | + echo sprintf('<input type="text" name="%s[str_replace_binded_url_from]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_replace_binded_url_from'])); | |
| 526 | 483 | echo ('<span class="suptext">→</span>'); |
| 527 | - echo sprintf('<input type="text" name="%s[str_replace_binded_url_to]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['str_replace_binded_url_to'])); | |
| 484 | + echo sprintf('<input type="text" name="%s[str_replace_binded_url_to]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_replace_binded_url_to'])); | |
| 528 | 485 | |
| 529 | 486 | }, |
| 530 | 487 | 'codoc', //page |
| 531 | 488 | 'setting_section_id' //Section |
| @@ -535,11 +492,11 @@ | ||
| 535 | 492 | 'str_around_codoc_tag', // id |
| 536 | 493 | __('HTML insertion','codoc'), // title |
| 537 | 494 | function() { |
| 538 | 495 | global $CODOC_SETTINGS; |
| 539 | - echo '<div class="excerpt">' . esc_html(__('You can insert HTML before and after the codoc tag.','codoc')) . '</div>'; | |
| 540 | - echo sprintf('<div class="inputRow"><p>%s</p><textarea name="%s[str_before_codoc_tag]" cols="40">%s</textarea></div>',esc_html(__('Before HTML','codoc')),esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['str_before_codoc_tag'])); | |
| 541 | - echo sprintf('<div class="inputRow"><p>%s</p><textarea name="%s[str_after_codoc_tag]" cols="40">%s</textarea></div>',esc_html(__('After HTML','codoc')),esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['str_after_codoc_tag'])); | |
| 496 | + echo '<div class="excerpt">' . __('You can insert HTML before and after the codoc tag.','codoc') . '</div>'; | |
| 497 | + echo sprintf('<div class="inputRow"><p>%s</p><textarea name="%s[str_before_codoc_tag]" cols="40">%s</textarea></div>',__('Before HTML','codoc'),CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_before_codoc_tag'])); | |
| 498 | + echo sprintf('<div class="inputRow"><p>%s</p><textarea name="%s[str_after_codoc_tag]" cols="40">%s</textarea></div>',__('After HTML','codoc'),CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_after_codoc_tag'])); | |
| 542 | 499 | |
| 543 | 500 | }, |
| 544 | 501 | 'codoc', //page |
| 545 | 502 | 'setting_section_id' //Section |
| @@ -549,23 +506,23 @@ | ||
| 549 | 506 | 'always_show_support_tag', // id |
| 550 | 507 | __('Automatic support insertion','codoc'), // title |
| 551 | 508 | function() { |
| 552 | 509 | global $CODOC_SETTINGS; |
| 553 | - echo '<div class="excerpt">' . esc_html(__('It adds support functions to the post without inserting a codoc block.','codoc')) . '</div>'; | |
| 510 | + echo '<div class="excerpt">' . __('It adds support functions to the post without inserting a codoc block.','codoc') . '</div>'; | |
| 554 | 511 | echo '<table class="innerTable"><tbody>'; |
| 555 | - echo '<tr><th>' . esc_html(__('Automatic insertion','codoc')) . '</th><td>'; | |
| 556 | - echo sprintf('<input type="radio" value="1" name="%s[always_show_support]" id="always_show_support_on" %s><label for="always_show_support_on">' . esc_html(__('Enable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['always_show_support'] == '1' ? "checked" : "")); | |
| 557 | - echo sprintf('<input type="radio" value="0" name="%s[always_show_support]" id="always_show_support_off" %s><label for="always_show_support_off">' . esc_html(__('Disable','codoc')) . '</label> <br / >',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['always_show_support'] == '0' ? "checked" : "")); | |
| 512 | + echo '<tr><th>' . __('Automatic insertion','codoc') . '</th><td>'; | |
| 513 | + echo sprintf('<input type="radio" value="1" name="%s[always_show_support]" id="always_show_support_on" %s><label for="always_show_support_on">' . __('Enable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['always_show_support'] == '1' ? "checked" : "")); | |
| 514 | + echo sprintf('<input type="radio" value="0" name="%s[always_show_support]" id="always_show_support_off" %s><label for="always_show_support_off">' . __('Disable','codoc') . '</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['always_show_support'] == '0' ? "checked" : "")); | |
| 558 | 515 | echo '</td></tr>'; |
| 559 | - echo '<tr><th>'. esc_html(__('Position','codoc')) . '</th><td>'; | |
| 560 | - echo sprintf('<input type="radio" value="top" name="%s[show_support_location]" id="show_support_location_top" %s><label for="show_support_location_top">' . esc_html(__('TOP','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_support_location'] == 'top' ? "checked" : "")); | |
| 561 | - echo sprintf('<input type="radio" value="bottom" name="%s[show_support_location]" id="show_support_location_bottom" %s><label for="show_support_location_bottom">' . esc_html(__('Bottom','codoc')) . '</label> <br / >',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['show_support_location'] == 'bottom' ? "checked" : "")); | |
| 516 | + echo '<tr><th>'. __('Position','codoc') . '</th><td>'; | |
| 517 | + echo sprintf('<input type="radio" value="top" name="%s[show_support_location]" id="show_support_location_top" %s><label for="show_support_location_top">' . __('TOP','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_support_location'] == 'top' ? "checked" : "")); | |
| 518 | + echo sprintf('<input type="radio" value="bottom" name="%s[show_support_location]" id="show_support_location_bottom" %s><label for="show_support_location_bottom">' . __('Bottom','codoc') . '</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_support_location'] == 'bottom' ? "checked" : "")); | |
| 562 | 519 | echo '</td></tr>'; |
| 563 | - echo '<tr><th>' . esc_html(__('Description','codoc')) . '</th><td>'; | |
| 564 | - echo sprintf('<input type="text" placeholder="' . esc_html(__('You can customize the description of the support.','codoc')) . '" size="50%%" name="%s[show_support_message]" value="%s">',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['show_support_message'])); | |
| 520 | + echo '<tr><th>' . __('Description','codoc') . '</th><td>'; | |
| 521 | + echo sprintf('<input type="text" placeholder="' . __('You can customize the description of the support.','codoc') . '" size="50%%" name="%s[show_support_message]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['show_support_message'])); | |
| 565 | 522 | echo '</td></tr>'; |
| 566 | - echo '<tr><th>' . esc_html(__('Category names','codoc')) . '</th><td>'; | |
| 567 | - echo sprintf('<input placeholder="' . esc_html(__('Inserted into articles of categories, divided by "|"','codoc')) . '" type="text" size="50%%" name="%s[show_support_categories]" value="%s"><br />',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['show_support_categories'])); | |
| 523 | + echo '<tr><th>' . __('Category names','codoc') . '</th><td>'; | |
| 524 | + echo sprintf('<input placeholder="' . __('Inserted into articles of categories, divided by "|"','codoc') . '" type="text" size="50%%" name="%s[show_support_categories]" value="%s"><br />',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['show_support_categories'])); | |
| 568 | 525 | echo '</td></tr>'; |
| 569 | 526 | echo '</tbody></table>'; |
| 570 | 527 | |
| 571 | 528 | }, |
| @@ -576,11 +533,11 @@ | ||
| 576 | 533 | 'do_not_filter_the_content', // id |
| 577 | 534 | __('Disable plugin filter','codoc'), // title |
| 578 | 535 | function() { |
| 579 | 536 | global $CODOC_SETTINGS; |
| 580 | - echo '<div class="excerpt">' . esc_html(__('You can disable filter processing that includes shortcodes from other plugins that interfere with the operation of codoc. Please use this only if codoc is not functioning properly.','codoc')) . '</div>'; | |
| 581 | - echo sprintf('<input type="radio" value="1" name="%s[do_not_filter_the_content]" id="do_not_filter_the_content_on" %s><label for="do_not_filter_the_content_on">' . esc_html(__('Enable','codoc')) .'</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['do_not_filter_the_content'] == '1' ? "checked" : "")); | |
| 582 | - echo sprintf('<input type="radio" value="0" name="%s[do_not_filter_the_content]" id="do_not_filter_the_content_off" %s><label for="do_not_filter_the_content_off">' . esc_html(__('Disable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['do_not_filter_the_content'] == '0' ? "checked" : "")); | |
| 537 | + echo '<div class="excerpt">' . __('You can disable filter processing that includes shortcodes from other plugins that interfere with the operation of codoc. Please use this only if codoc is not functioning properly.','codoc') . '</div>'; | |
| 538 | + echo sprintf('<input type="radio" value="1" name="%s[do_not_filter_the_content]" id="do_not_filter_the_content_on" %s><label for="do_not_filter_the_content_on">' . __('Enable','codoc') .'</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['do_not_filter_the_content'] == '1' ? "checked" : "")); | |
| 539 | + echo sprintf('<input type="radio" value="0" name="%s[do_not_filter_the_content]" id="do_not_filter_the_content_off" %s><label for="do_not_filter_the_content_off">' . __('Disable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['do_not_filter_the_content'] == '0' ? "checked" : "")); | |
| 583 | 540 | }, |
| 584 | 541 | 'codoc', //page |
| 585 | 542 | 'setting_section_id' //Section |
| 586 | 543 | ); |
| @@ -589,11 +546,11 @@ | ||
| 589 | 546 | 'shortcode_evacuation', // id |
| 590 | 547 | __('Shortcode evacuation','codoc'), // title |
| 591 | 548 | function() { |
| 592 | 549 | global $CODOC_SETTINGS; |
| 593 | - echo '<div class="excerpt">' . esc_html(__('The execution results of shortcodes written in the paid part are moved to the free part, and are used and displayed on the HTML during viewing of the paid part. Please use this if the shortcode does not work as expected in the paid part. Please note that the execution results of shortcodes in the paid part will be written in the source code.','codoc')). '</div>'; | |
| 594 | - echo sprintf('<input type="radio" value="1" name="%s[shortcode_evacuation]" id="shortcode_evacuation_on" %s><label for="shortcode_evacuation_on">' . esc_html(__('Enable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['shortcode_evacuation'] == '1' ? "checked" : "")); | |
| 595 | - echo sprintf('<input type="radio" value="0" name="%s[shortcode_evacuation]" id="shortcode_evacuation_off" %s><label for="shortcode_evacuation_off">' . esc_html(__('Disable','codoc')) . '</label> ',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_attr($CODOC_SETTINGS['shortcode_evacuation'] == '0' ? "checked" : "")); | |
| 550 | + echo '<div class="excerpt">' . __('The execution results of shortcodes written in the paid part are moved to the free part, and are used and displayed on the HTML during viewing of the paid part. Please use this if the shortcode does not work as expected in the paid part. Please note that the execution results of shortcodes in the paid part will be written in the source code.','codoc'). '</div>'; | |
| 551 | + echo sprintf('<input type="radio" value="1" name="%s[shortcode_evacuation]" id="shortcode_evacuation_on" %s><label for="shortcode_evacuation_on">' . __('Enable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['shortcode_evacuation'] == '1' ? "checked" : "")); | |
| 552 | + echo sprintf('<input type="radio" value="0" name="%s[shortcode_evacuation]" id="shortcode_evacuation_off" %s><label for="shortcode_evacuation_off">' . __('Disable','codoc') . '</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['shortcode_evacuation'] == '0' ? "checked" : "")); | |
| 596 | 553 | }, |
| 597 | 554 | 'codoc', //page |
| 598 | 555 | 'setting_section_id' //Section |
| 599 | 556 | ); |
| @@ -602,10 +559,10 @@ | ||
| 602 | 559 | 'debug_params', // id |
| 603 | 560 | __('Debug Parameters','codoc'), // title |
| 604 | 561 | function() { |
| 605 | 562 | global $CODOC_SETTINGS; |
| 606 | - echo '<div class="excerpt">' . esc_html(__('You can specify parameters for debugging. Please use this only upon request from codoc support.','codoc')) . '</div>'; | |
| 607 | - echo sprintf('<input placeholder="" type="text" size="50%%" name="%s[debug_params]" value="%s"><br />',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['debug_params'])); | |
| 563 | + echo '<div class="excerpt">' . __('You can specify parameters for debugging. Please use this only upon request from codoc support.','codoc') . '</div>'; | |
| 564 | + echo sprintf('<input placeholder="" type="text" size="50%%" name="%s[debug_params]" value="%s"><br />',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['debug_params'])); | |
| 608 | 565 | }, |
| 609 | 566 | 'codoc', //page |
| 610 | 567 | 'setting_section_id' //Section |
| 611 | 568 | ); |
| @@ -610,32 +567,8 @@ | ||
| 610 | 567 | 'setting_section_id' //Section |
| 611 | 568 | ); |
| 612 | 569 | |
| 613 | 570 | add_settings_field( |
| 614 | - 'block_defaults', // id | |
| 615 | - __('Block Default Values','codoc'), // title | |
| 616 | - function() { | |
| 617 | - global $CODOC_SETTINGS; | |
| 618 | - echo '<div class="excerpt">' . esc_html(__('You can specify default values for new codoc blocks in JSON format.','codoc')) . '</div>'; | |
| 619 | - echo sprintf('<textarea placeholder=\'{"showPrice":false,"price":300}\' rows="3" cols="50" name="%s[block_defaults]">%s</textarea>',esc_attr(CODOC_SETTINGS_OPTION_NAME),esc_html($CODOC_SETTINGS['block_defaults'])); | |
| 620 | - echo '<p class="description">' | |
| 621 | - . 'showPrice (bool: true), ' | |
| 622 | - . 'price (int: 500), ' | |
| 623 | - . 'limited (bool: false), ' | |
| 624 | - . 'limitedCount (int: 10), ' | |
| 625 | - . 'affiliateMode (bool: false), ' | |
| 626 | - . 'affiliateRate (string: "0.0500"), ' | |
| 627 | - . 'showSupport (bool: false), ' | |
| 628 | - . 'showPaywalledSupport (bool: false), ' | |
| 629 | - . 'statusLimited (bool: false), ' | |
| 630 | - . 'subscriptions (object: {})' | |
| 631 | - . '</p>'; | |
| 632 | - }, | |
| 633 | - 'codoc', //page | |
| 634 | - 'setting_section_id' //Section | |
| 635 | - ); | |
| 636 | - | |
| 637 | - add_settings_field( | |
| 638 | 571 | 'cretor_info', // id |
| 639 | 572 | __('Creator\'s Information','codoc'), // title |
| 640 | 573 | function() { |
| 641 | 574 | global $CODOC_SETTINGS; |
| @@ -643,19 +576,19 @@ | ||
| 643 | 576 | echo sprintf('<p><font id="codoc-update-creator-info-message"></font></p>',""); |
| 644 | 577 | // 変更を保存時に常に同期するのでこの表示は必要ないがUI上保持しておく |
| 645 | 578 | $script = "document.getElementById('codoc-update-creator-info-message').innerText='" . __("Please save changes to update the information.","codoc") . "';document.getElementById('codoc-update-creator-info-message').color='red';"; |
| 646 | 579 | if (isset($CODOC_AUTHINFO['profile_image_url'])) { |
| 647 | - echo sprintf('<img src="%s" width="40" height="40" />',esc_attr($CODOC_AUTHINFO['profile_image_url'])); | |
| 580 | + echo sprintf('<img src="%s" width="40" height="40" />',$CODOC_AUTHINFO['profile_image_url']); | |
| 648 | 581 | } |
| 649 | - echo sprintf('<p>%s %s %s</p>',esc_html($CODOC_AUTHINFO['name']),esc_html((isset($CODOC_AUTHINFO['account_is_pro']) and $CODOC_AUTHINFO['account_is_pro']) ? ' [PRO]' : ''),esc_html(isset($CODOC_AUTHINFO['country']) ? $CODOC_AUTHINFO['country'] : '' )); | |
| 582 | + echo sprintf('<p>%s%s</p>',$CODOC_AUTHINFO['name'],((isset($CODOC_AUTHINFO['account_is_pro']) and $CODOC_AUTHINFO['account_is_pro']) ? ' [PRO] ' : '')); | |
| 650 | 583 | if ($connect_code = $CODOC_SETTINGS['codoc_connect_code']) { |
| 651 | - // Translators: %s is the integration code, and %s is additional information based on the registration mode. | |
| 652 | - echo sprintf('<p>' . esc_html(__('Extensions integration completed (Extensions code: %1$s) %2$s','codoc')) . '</p>', | |
| 653 | - esc_html($connect_code), | |
| 654 | - esc_html($CODOC_SETTINGS['codoc_connect_registration_mode'] == 'dedicated' ? __('Set the audience as a private account.','codoc') : '')); | |
| 584 | + | |
| 585 | + echo sprintf('<p>' . __('External service integration completed (Integration code: %s) %s','codoc') . '</p>', | |
| 586 | + $connect_code, | |
| 587 | + ($CODOC_SETTINGS['codoc_connect_registration_mode'] == 'dedicated' ? '<br/> <strong>' . __('Set the audience as a private account.','codoc') . '</strong>' : '')); | |
| 655 | 588 | } |
| 656 | - echo sprintf('<p><a href="javascript:void(0);" onClick="' . esc_attr($script) . '">' . esc_html(__('Update creator\'s Information','codoc')) . '</a></p>'); | |
| 657 | - echo ('<p>' . esc_html(__('Please update each time if you change the logo or cover image on the codoc side.','codoc')) . '</p>'); | |
| 589 | + echo sprintf('<p><a href="javascript:void(0);" onClick="' . $script . '">' . __('Update creator\'s Information','codoc') . '</a></p>'); | |
| 590 | + echo ('<p>' . __('Please update each time if you change the logo or cover image on the codoc side.','codoc') . '</p>'); | |
| 658 | 591 | }, |
| 659 | 592 | 'codoc', //page |
| 660 | 593 | 'setting_section_id' //Section |
| 661 | 594 | ); |
| @@ -669,9 +602,9 @@ | ||
| 669 | 602 | CODOC_TOKEN_OPTION_NAME |
| 670 | 603 | ); |
| 671 | 604 | |
| 672 | 605 | if (isset($_GET['codoc_auth_finished']) and $_GET['codoc_auth_finished']) { |
| 673 | - add_settings_error( 'general', 'settings_updated', esc_html(__( 'codoc authentication has been completed.' ,'codoc'), 'success' )); | |
| 606 | + add_settings_error( 'general', 'settings_updated', __( 'codoc authentication has been completed.' ,'codoc'), 'success' ); | |
| 674 | 607 | } |
| 675 | 608 | |
| 676 | 609 | add_settings_field( |
| 677 | 610 | 'codoc_auth', |
| @@ -680,15 +613,14 @@ | ||
| 680 | 613 | global $CODOC_USERCODE; |
| 681 | 614 | global $CODOC_TOKEN; |
| 682 | 615 | global $CODOC_AUTHINFO; |
| 683 | 616 | $script = "javascript:document.getElementById('codoc-usercode').value='-';document.getElementById('codoc-token').value='-';document.getElementById('codoc-auth-message').innerText='" . __('Please save changes to complete the unbinding.','codoc') . "';document.getElementById('codoc-auth-message').color='red';"; |
| 617 | + | |
| 618 | + echo sprintf('<p><font color="green" id="codoc-auth-message">' . __('Authorized as <strong>%s</strong>','codoc') . '</font></p>',$CODOC_AUTHINFO['email']); | |
| 684 | 619 | |
| 685 | - // Translators: %s is the email address. | |
| 686 | - echo sprintf('<p><font color="green" id="codoc-auth-message">' . esc_html(__('Authorized as %s','codoc')) . '</font></p>',esc_attr($CODOC_AUTHINFO['email'])); | |
| 687 | - | |
| 688 | - echo sprintf('<input id="codoc-usercode" type="hidden" name="%s" value="%s">',esc_attr(CODOC_USERCODE_OPTION_NAME),esc_attr($CODOC_USERCODE)); | |
| 689 | - echo sprintf('<input id="codoc-token" type="hidden" name="%s" value="%s">',esc_attr(CODOC_TOKEN_OPTION_NAME),esc_attr($CODOC_TOKEN)); | |
| 690 | - echo sprintf('<p><a href="javascript:void(0);" onClick="' . esc_attr($script) . '">' . esc_html(__('Unbind authorization','codoc')) . '</p>'); | |
| 620 | + echo sprintf('<input id="codoc-usercode" type="hidden" name="%s" value="%s">',CODOC_USERCODE_OPTION_NAME,$CODOC_USERCODE); | |
| 621 | + echo sprintf('<input id="codoc-token" type="hidden" name="%s" value="%s">',CODOC_TOKEN_OPTION_NAME,$CODOC_TOKEN); | |
| 622 | + echo sprintf('<p><a href="javascript:void(0);" onClick="' . $script . '">' . __('Unbind authorization','codoc') . '</p>'); | |
| 691 | 623 | }, |
| 692 | 624 | 'codoc', |
| 693 | 625 | 'setting_section_id' |
| 694 | 626 | ); |
| @@ -698,9 +630,9 @@ | ||
| 698 | 630 | // ない場合 |
| 699 | 631 | if (!$CODOC_AUTHINFO and !isset($_GET['auth_by_myself'])) { |
| 700 | 632 | add_settings_field( |
| 701 | 633 | 'codoc_auth', |
| 702 | - __('Authentication','codoc'), | |
| 634 | + '認証', | |
| 703 | 635 | function() { |
| 704 | 636 | $theme = wp_get_theme(); |
| 705 | 637 | $from = 'wp'; |
| 706 | 638 | if ($theme->get('Name') === 'codoc') { |
| @@ -707,29 +639,17 @@ | ||
| 707 | 639 | $from = 'wp_codoc'; |
| 708 | 640 | } |
| 709 | 641 | //$current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
| 710 | 642 | $current_url = admin_url('options-general.php') . '?page=codoc'; |
| 711 | - $direct_url = sprintf("location.href='%s&auth_by_myself=1'",$current_url); | |
| 712 | 643 | $login_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/me/token?from=' . $from . '&return_url=' . urlencode($current_url)); |
| 713 | 644 | $register_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/register?from=' . $from . '&return_url=' . urlencode($current_url)); |
| 714 | 645 | // submitを消しておく |
| 715 | - echo ('<script type="text/javascript">window.onload=function(){document.getElementById(\'submit\').style.display = \'none\'}</script>'); | |
| 716 | - if (isset($_GET['confirm_token'])) { | |
| 717 | - $confirm_url = sprintf("location.href='%s&_wpnonce=%s&fetch_token_key=%s&usercode=%s'",$current_url, | |
| 718 | - wp_create_nonce('fetch_token_nonce'), | |
| 719 | - esc_attr($_GET['fetch_token_key']), | |
| 720 | - esc_attr($_GET['usercode'])); | |
| 721 | - echo (esc_html(__('The authentication information has been obtained. Please click the confirmation button to complete the setup.','codoc')) . '<br />'); | |
| 722 | - echo sprintf('<input type="button" class="button button-primary" value="%s" onClick="%s"> ',esc_html(__('Confirm authentication','codoc')),esc_attr($confirm_url)); | |
| 723 | - } else { | |
| 724 | - | |
| 725 | - echo (esc_html(__('Authentication is required to use codoc on WordPress.','codoc')) . '<br />'); | |
| 726 | - echo (esc_html(__('You can authenticate by directly entering the user code and API token, or by logging in and registering with codoc.','codoc')) . '<br /><br />'); | |
| 727 | - echo sprintf('<input type="button" class="button button-primary" value="%s" onClick="%s"> ',esc_attr(__('Authenticate by direct input','codoc')),esc_attr($direct_url)); | |
| 728 | - echo sprintf('<input type="button" class="button button-primary" value="%s" onClick="%s"> <input type="button" class="button button-primary" value="%s" onClick="%s"><br /><br />',esc_attr(__('Login and authenticate','codoc')),esc_attr($login_url),esc_attr(__('Register and authenticate','codoc')),esc_attr($register_url)); | |
| 729 | - } | |
| 646 | + echo ('<script type="text/javascript">window.onload=function(){document.getElementById(\'submit\').style.display = \'none\'}</script>'); | |
| 647 | + echo ('codocをWordPressでご利用いただくには認証が必要です。<br />'); | |
| 648 | + echo sprintf('ユーザーコードとAPIトークンを<a href="%s&auth_by_myself=1">直接入力</a>することでも認証できます。<br /><br />',$current_url); | |
| 649 | + echo sprintf('<input type="button" class="button button-primary" value="ログインして認証" onClick="%s"> <input type="button" class="button button-primary" value="登録して認証" onClick="%s"><br /><br />',$login_url,$register_url); | |
| 730 | 650 | if (!$this->util->health_check()) { |
| 731 | - echo sprintf('<p style="color: red;">Cannot communicate with the codoc server. Please allow communication to https://codoc.jp in your firewall settings on the server or WordPress side.</p>'); | |
| 651 | + echo sprintf('<p style="color: red;">codocサーバーと通信ができません。サーバーやWordPress側でのファイヤーウォール設定にて https://codoc.jp への通信を許可してください。</p>'); | |
| 732 | 652 | } |
| 733 | 653 | |
| 734 | 654 | }, |
| 735 | 655 | 'codoc', |
| @@ -754,9 +674,9 @@ | ||
| 754 | 674 | 'ユーザーコード', |
| 755 | 675 | function() { |
| 756 | 676 | global $CODOC_USERCODE; |
| 757 | 677 | echo '<input type="hidden" name="auth_by_myself" value="1">'; |
| 758 | - echo sprintf('<input type="text" name="%s" value="%s">',esc_attr(CODOC_USERCODE_OPTION_NAME),esc_attr($CODOC_USERCODE)); | |
| 678 | + echo sprintf('<input type="text" name="%s" value="%s">',CODOC_USERCODE_OPTION_NAME,$CODOC_USERCODE); | |
| 759 | 679 | }, |
| 760 | 680 | 'codoc', |
| 761 | 681 | 'setting_section_id' |
| 762 | 682 | ); |
| @@ -764,9 +684,9 @@ | ||
| 764 | 684 | 'codoc_token', |
| 765 | 685 | 'APIトークン', |
| 766 | 686 | function() { |
| 767 | 687 | global $CODOC_TOKEN; |
| 768 | - echo sprintf('<input type="text" name="%s" value="%s">',esc_attr(CODOC_TOKEN_OPTION_NAME),esc_attr($CODOC_TOKEN)); | |
| 688 | + echo sprintf('<input type="text" name="%s" value="%s">',CODOC_TOKEN_OPTION_NAME,$CODOC_TOKEN); | |
| 769 | 689 | }, |
| 770 | 690 | 'codoc', |
| 771 | 691 | 'setting_section_id' |
| 772 | 692 | ); |
| @@ -818,9 +738,9 @@ | ||
| 818 | 738 | }); |
| 819 | 739 | // プラグイン一覧に設定のリンクをいれる |
| 820 | 740 | add_filter( 'plugin_action_links_' . plugin_basename( plugin_dir_path( __FILE__ ) . 'codoc' . '.php' ), |
| 821 | 741 | function( $links ) { |
| 822 | - $setting_link = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'page', 'codoc', admin_url( 'options-general.php' ) ) ), esc_html( __('Settings') ) ); | |
| 742 | + $setting_link = sprintf( '<a href="%s">%s</a>', esc_url( add_query_arg( 'page', 'codoc', admin_url( 'options-general.php' ) ) ), esc_html( '設定' ) ); | |
| 823 | 743 | array_unshift( $links, $setting_link ); |
| 824 | 744 | |
| 825 | 745 | return $links; |
| 826 | 746 | } |
| @@ -842,13 +762,8 @@ | ||
| 842 | 762 | // プラグイン内で使うCSRF を生成 |
| 843 | 763 | $path = plugins_url( 'codoc/src_mce/codoc-editor-onload.js', __DIR__ ); |
| 844 | 764 | wp_enqueue_script( 'codoc-editor-onload', $path, array('jquery'), '', true ); |
| 845 | 765 | // I just want to insert this global variables but i don't know how i can do it.. |
| 846 | - $auth_info = get_option(CODOC_AUTHINFO_OPTION_NAME); | |
| 847 | - $codoc_settings = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 848 | - $block_defaults_raw = isset($codoc_settings['block_defaults']) ? $codoc_settings['block_defaults'] : ''; | |
| 849 | - $block_defaults_decoded = json_decode($block_defaults_raw, true); | |
| 850 | - $block_defaults = is_array($block_defaults_decoded) ? $block_defaults_decoded : new stdClass(); | |
| 851 | 766 | wp_localize_script( |
| 852 | 767 | 'codoc-editor-onload', |
| 853 | 768 | 'CODOCEDITOR', |
| 854 | 769 | array( |
| @@ -858,12 +773,8 @@ | ||
| 858 | 773 | 'codoc_url' => $this->get_codoc_url(), |
| 859 | 774 | 'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME), |
| 860 | 775 | 'codoc_plugin_version' => CODOC_PLUGIN_VERSION, |
| 861 | 776 | 'codoc_sdk_path' => CODOC_SDK_PATH, |
| 862 | - 'codoc_account_is_pro' => isset($auth_info['account_is_pro']) ? $auth_info['account_is_pro'] : 0, | |
| 863 | - 'codoc_currency_code' => isset($auth_info['currency_code']) ? $auth_info['currency_code'] : 0, | |
| 864 | - 'codoc_currency_decimal_places' => isset($auth_info['currency_decimal_places']) ? $auth_info['currency_decimal_places'] : 0, | |
| 865 | - 'codoc_block_defaults' => $block_defaults, | |
| 866 | 777 | ) |
| 867 | 778 | ); |
| 868 | 779 | |
| 869 | 780 | // ここでtinymceのプラグイン追加 |
| @@ -922,11 +833,8 @@ | ||
| 922 | 833 | 'connect_code' => property_exists($user,'connect_code') ? $user->connect_code : '', |
| 923 | 834 | 'connect_image_url' => property_exists($user,'connect_image_url') ? $user->connect_image_url : '', |
| 924 | 835 | 'account_is_pro' => property_exists($user,'account_is_pro') ? $user->account_is_pro : '', |
| 925 | 836 | 'created_at' => property_exists($user,'created_at') ? $user->created_at : 0, |
| 926 | - 'country' => property_exists($user,'country') ? $user->country : '', | |
| 927 | - 'currency_code' => property_exists($user,'currency_code') ? $user->currency_code : '', | |
| 928 | - 'currency_decimal_places' => property_exists($user,'currency_decimal_places') ? $user->currency_decimal_places : '', | |
| 929 | 837 | ]); |
| 930 | 838 | $CODOC_AUTHINFO = get_option(CODOC_AUTHINFO_OPTION_NAME); |
| 931 | 839 | return $CODOC_AUTHINFO; |
| 932 | 840 | } |
| @@ -1004,47 +912,11 @@ | ||
| 1004 | 912 | if (preg_match('/^(auto-draft|inherit)$/',$post->post_status)) { |
| 1005 | 913 | return; |
| 1006 | 914 | } |
| 1007 | 915 | $entryCode = get_post_meta($post_ID,'codoc_entry_code',true); |
| 1008 | - $postId = get_post_meta($post_ID,'codoc_saved_post_id',true); | |
| 1009 | - // 保存されているIDと違う場合は破棄(duplicate pageなどでmeta情報をコピーされた可能性がある) | |
| 1010 | - if ($postId and $postId != $post_ID) { | |
| 1011 | - $entryCode = ''; | |
| 1012 | - } | |
| 1013 | 916 | $codoc_settings = get_option(CODOC_SETTINGS_OPTION_NAME); |
| 1014 | 917 | $post_content = (isset($codoc_settings['do_not_filter_the_content']) and $codoc_settings['do_not_filter_the_content']) ? |
| 1015 | 918 | $post->post_content : $this->get_filtered_content($post); |
| 1016 | - | |
| 1017 | - // codoc タグ(span/div または Gutenberg ブロック)が含まれていれば API側と統一した文字数検証を行う | |
| 1018 | - $has_codoc_tag = preg_match('/<(?:span|div)[^>]+data-id="codoc-tag"/', $post_content) | |
| 1019 | - || preg_match('/wp:codoc\/codoc-block/', $post_content); | |
| 1020 | - if ($has_codoc_tag) { | |
| 1021 | - // codoc タグ位置で free / paywalled を分割 | |
| 1022 | - $gutenberg_split = '/(?:<(?:div|p)(?:[^>]+|)>|)<\!-- +wp:codoc\/codoc-block .*<\!-- +\/wp:codoc\/codoc-block +-->(?:<\/(?:div|p)>|)/s'; | |
| 1023 | - $tag_split = '/<(?:span|div)[^>]+data-id="codoc-tag"(?:[^>]+|)>(?:.+|)<\/(?:span|div)>/'; | |
| 1024 | - $end_tag_regex = '/<(?:div|p)>::CODOC_WP_END_PAYWALL::<\/(?:div|p)>/'; | |
| 1025 | - $for_split = preg_split($end_tag_regex, $post_content); | |
| 1026 | - $for_split = $for_split[0]; | |
| 1027 | - if (preg_match('/wp:codoc\/codoc-block/', $for_split)) { | |
| 1028 | - $splited = preg_split($gutenberg_split, $for_split); | |
| 1029 | - } else { | |
| 1030 | - $splited = preg_split($tag_split, $for_split); | |
| 1031 | - } | |
| 1032 | - $body_free = isset($splited[0]) ? $splited[0] : ''; | |
| 1033 | - $body_paywalled = isset($splited[1]) ? $splited[1] : ''; | |
| 1034 | - $errors = $this->util->validate_entry_lengths([ | |
| 1035 | - 'title' => $post->post_title, | |
| 1036 | - 'body_free' => $body_free, | |
| 1037 | - 'body_paywalled' => $body_paywalled, | |
| 1038 | - 'binded_url' => get_permalink($post_ID), | |
| 1039 | - ]); | |
| 1040 | - if ($errors) { | |
| 1041 | - set_transient('codoc_entry_validation_errors', $errors, MINUTE_IN_SECONDS * 5); | |
| 1042 | - // 同期はスキップ | |
| 1043 | - return true; | |
| 1044 | - } | |
| 1045 | - } | |
| 1046 | - | |
| 1047 | 919 | $res = $this->util->sync_entry([ |
| 1048 | 920 | "post_title" => $post->post_title, |
| 1049 | 921 | "post_content" => $post_content, |
| 1050 | 922 | // password が設定されてる場合は限定公開にする |
| @@ -1069,12 +941,10 @@ | ||
| 1069 | 941 | if (is_object($res) and $res->status and !$entryCode) { |
| 1070 | 942 | // 20230222 https://stackoverflow.com/questions/26640785/update-post-meta-not-work-only-when-save-data-not-for-update |
| 1071 | 943 | if ($prudent_update_post_meta_entry_code) { |
| 1072 | 944 | add_post_meta($post_ID,'codoc_entry_code',$res->entry->code); |
| 1073 | - add_post_meta($post_ID,'codoc_saved_post_id',$post_ID); | |
| 1074 | 945 | } else { |
| 1075 | 946 | update_post_meta($post_ID,'codoc_entry_code',$res->entry->code); |
| 1076 | - update_post_meta($post_ID,'codoc_saved_post_id',$post_ID); | |
| 1077 | 947 | } |
| 1078 | 948 | } |
| 1079 | 949 | return true; |
| 1080 | 950 | } |
| @@ -1166,76 +1036,6 @@ | ||
| 1166 | 1036 | if (is_array($allowed_blocks)) { |
| 1167 | 1037 | array_push($allowed_blocks,'codoc/codoc-block'); |
| 1168 | 1038 | } |
| 1169 | 1039 | return $allowed_blocks; |
| 1170 | - } | |
| 1171 | - | |
| 1172 | - function allowed_block_types_all ($allowed_block_types, $block_editor_context) { | |
| 1173 | - // テーマ等がブロックを制限していない場合(true = 全ブロック許可)はそのまま返す | |
| 1174 | - if ($allowed_block_types === true) { | |
| 1175 | - return $allowed_block_types; | |
| 1176 | - } | |
| 1177 | - // 配列で制限されている場合、codoc ブロックを追加 | |
| 1178 | - if (is_array($allowed_block_types) && !in_array('codoc/codoc-block', $allowed_block_types)) { | |
| 1179 | - $allowed_block_types[] = 'codoc/codoc-block'; | |
| 1180 | - } | |
| 1181 | - return $allowed_block_types; | |
| 1182 | - } | |
| 1183 | - | |
| 1184 | - function show_validation_notices() { | |
| 1185 | - $errors = get_transient('codoc_entry_validation_errors'); | |
| 1186 | - if (!$errors || !is_array($errors)) { | |
| 1187 | - return; | |
| 1188 | - } | |
| 1189 | - delete_transient('codoc_entry_validation_errors'); | |
| 1190 | - $header = __('codoc could not sync this entry due to length limits:', 'codoc'); | |
| 1191 | - echo '<div class="notice notice-error is-dismissible"><p><strong>' . esc_html($header) . '</strong></p><ul>'; | |
| 1192 | - foreach ($errors as $message) { | |
| 1193 | - echo '<li>' . esc_html($message) . '</li>'; | |
| 1194 | - } | |
| 1195 | - echo '</ul></div>'; | |
| 1196 | - } | |
| 1197 | - | |
| 1198 | - function show_tadv_notice() { | |
| 1199 | - // API からの notification を表示 | |
| 1200 | - $api_notifications = get_transient('codoc_api_notification'); | |
| 1201 | - if ($api_notifications && is_array($api_notifications)) { | |
| 1202 | - // notification 配列のキーと値を表示 | |
| 1203 | - foreach ($api_notifications as $key => $value) { | |
| 1204 | - // 値が配列やオブジェクトの場合は json_encode で文字列化 | |
| 1205 | - if (is_array($value) || is_object($value)) { | |
| 1206 | - $value = json_encode($value, JSON_UNESCAPED_UNICODE); | |
| 1207 | - } | |
| 1208 | - echo "<div class=\"notice notice-warning is-dismissible codoc-notification\"><p>" . esc_html($value) . "</p></div>"; | |
| 1209 | - } | |
| 1210 | - //delete_transient('codoc_api_notification'); | |
| 1211 | - } | |
| 1212 | - | |
| 1213 | - $name = 'Advanced Editor Tools'; | |
| 1214 | - $name_escaped = preg_replace('/ /','+',$name); | |
| 1215 | - $install_url = network_admin_url( "plugin-install.php?tab=search&s=" . $name ); | |
| 1216 | - $options_url = network_admin_url( "options-general.php?page=tinymce-advanced" ); | |
| 1217 | - | |
| 1218 | - //<a href=\"%s\">%s</a> を有効にし、設定画面にて "Keep paragraph tags in the Classic block and the Classic Editor" を有効にしてください。 | |
| 1219 | - //<a href=\"%s\">%s</a> の設定画面にて "Keep paragraph tags in the Classic block and the Classic Editor" を有効にしてください。 | |
| 1220 | - // Translators: %s is a link to the installation page with the plugin name. | |
| 1221 | - $tadv_message_for_install = sprintf(__("Please enable %s and enable "Keep paragraph tags in the Classic block and the Classic Editor" on the settings screen.","codoc"),sprintf("<a href=\"%s\">%s</a>",$install_url,$name)); | |
| 1222 | - // Translators: %s is a link to the options settings page with the plugin name. | |
| 1223 | - $tadv_message_for_options = sprintf(__("Please enable "Keep paragraph tags in the Classic block and the Classic Editor" on the %s settings screen.","codoc"),sprintf("<a href=\"%s\">%s</a>",$options_url,$name)); | |
| 1224 | - // クラシックエディタで advanced editor tools を入れてない場合は notice | |
| 1225 | - if (is_plugin_active('classic-editor/classic-editor.php') and | |
| 1226 | - !is_plugin_active('tinymce-advanced/tinymce-advanced.php')) { | |
| 1227 | - echo "<div class=\"notice notice-warning is-dismissible\"><p>" . esc_html($tadv_message_for_install) . "</p></div>"; | |
| 1228 | - } | |
| 1229 | - | |
| 1230 | - // advanced editor tools の設定を調査 | |
| 1231 | - $no_autop = false; | |
| 1232 | - $tadv_admin_settings = get_option( 'tadv_admin_settings', false ); | |
| 1233 | - if (isset($tadv_admin_settings['options']) and preg_match('/no_autop/',$tadv_admin_settings['options'])) { | |
| 1234 | - $no_autop = true; | |
| 1235 | - } | |
| 1236 | - // advanced editor tools が有効で no_autop (Keep paragraph tags in the Classic block and the Classic Editor) が無効 | |
| 1237 | - if (is_plugin_active('tinymce-advanced/tinymce-advanced.php') and !$no_autop) { | |
| 1238 | - echo "<div class=\"notice notice-warning is-dismissible\"><p>" . esc_html($tadv_message_for_options) . "</p></div>"; | |
| 1239 | - } | |
| 1240 | 1040 | } |
| 1241 | 1041 | } |