| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | require_once(plugin_dir_path( __FILE__ ) .'class-codoc-util.php'); |
| 3 | 3 | final class Codoc { |
| 4 | - | |
| 5 | 4 | public function __construct() { |
| 5 | + add_action('plugins_loaded', [$this,'codoc_load_textdomain']); | |
| 6 | 6 | if (is_admin()) { |
| 7 | 7 | // setting |
| 8 | 8 | $this->add_settings(); |
| 9 | 9 | } |
| @@ -14,9 +14,10 @@ | ||
| 14 | 14 | # the_content フィルタを実行しない状態 |
| 15 | 15 | $this->do_not_filter_the_content = false; |
| 16 | 16 | |
| 17 | 17 | // paywall用の本文非表示化とcodocタグへの属性追加 |
| 18 | - $priority = 10; | |
| 18 | + #$priority = 999999999; | |
| 19 | + $priority = 100000; # フィルターは最後に実施する default 10 | |
| 19 | 20 | $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); |
| 20 | 21 | if (isset($CODOC_SETTINGS["debug_params"])) { |
| 21 | 22 | $params_decoded = json_decode($CODOC_SETTINGS["debug_params"],true); |
| 22 | 23 | if (isset($params_decoded["the_content_filter_priority"])) { |
| @@ -22,9 +23,15 @@ | ||
| 22 | 23 | if (isset($params_decoded["the_content_filter_priority"])) { |
| 23 | 24 | $priority = $params_decoded["the_content_filter_priority"]; |
| 24 | 25 | } |
| 25 | 26 | } |
| 27 | + // ショーココードの退避 | |
| 28 | + if (isset($CODOC_SETTINGS['shortcode_evacuation']) and $CODOC_SETTINGS['shortcode_evacuation']) { | |
| 29 | + add_filter('the_content',[$this,'the_content_shortcode_evacuations'],0); | |
| 30 | + } | |
| 26 | 31 | add_filter('the_content',[$this,'the_content'],$priority); |
| 32 | + // 2021-09-24 the_content を利用しない場合は個別に呼び出ししてもらう | |
| 33 | + add_filter('codoc_the_content',[$this,'the_content'],$priority); | |
| 27 | 34 | |
| 28 | 35 | // 2020-07-25 excerpt対応 |
| 29 | 36 | add_filter('excerpt_allowed_blocks',[$this,'excerpt_allowed_blocks']); |
| 30 | 37 | |
| @@ -36,36 +43,73 @@ | ||
| 36 | 43 | add_action( 'added_post_meta', [$this,'updated_post_meta'], 10, 3 ); |
| 37 | 44 | add_action( 'updated_post_meta',[$this,'updated_post_meta'], 10, 3 ); |
| 38 | 45 | add_action( 'deleted_post_meta',[$this,'deleted_post_meta'], 10, 4 ); |
| 39 | 46 | } |
| 40 | - if (is_admin() and $auth_info) { //管理画面 | |
| 47 | + global $pagenow; | |
| 48 | + //管理画面でcodoc認証があり投稿画面の場合 | |
| 49 | + if (is_admin() and $auth_info and preg_match('/^post/',$pagenow)) { | |
| 41 | 50 | // Gutenberg のサポートがない場合は何もしない |
| 42 | 51 | if ( function_exists( 'register_block_type' ) ) { |
| 52 | + // WPに登録ブロックとして認識させる(cgbは登録しないっぽい) | |
| 53 | + \WP_Block_Type_Registry::get_instance()->register('codoc/codoc-block'); | |
| 43 | 54 | // gutenberg |
| 44 | 55 | require_once 'src/init.php'; |
| 45 | 56 | add_action('wp_loaded', function() { |
| 46 | - wp_localize_script('wordpress-cgb-block-js', 'OPTIONS', array( | |
| 57 | + wp_localize_script('codoc-block-js', 'OPTIONS', array( | |
| 47 | 58 | 'codoc_url' => $this->get_codoc_url(), |
| 48 | 59 | 'codoc_usercode' => get_option(CODOC_USERCODE_OPTION_NAME), |
| 49 | 60 | 'codoc_plugin_version' => CODOC_PLUGIN_VERSION, |
| 50 | 61 | 'codoc_sdk_path' => CODOC_SDK_PATH, |
| 51 | 62 | )); |
| 63 | + wp_set_script_translations('codoc-block-js', 'codoc',plugin_dir_path( __FILE__ ) . 'languages'); | |
| 52 | 64 | }); |
| 53 | 65 | } |
| 54 | 66 | // tinymce |
| 55 | 67 | $this->add_mce(); |
| 56 | - } else { // ブログ画面 | |
| 68 | + } elseif(is_admin() and $auth_info and preg_match('/^edit/',$pagenow)) { | |
| 69 | + // 記事編集ページ | |
| 70 | + } elseif(!is_admin()) { // ブログ画面 | |
| 57 | 71 | // codocのJS登録 |
| 58 | 72 | add_action( 'wp_enqueue_scripts', function() { |
| 59 | - wp_enqueue_script( 'codoc-injector-js', $this->get_codoc_url() . '/js/cms.js' ); | |
| 73 | + $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 74 | + $load_script_condition = ''; | |
| 75 | + if (isset($CODOC_SETTINGS["debug_params"]) and | |
| 76 | + $params_decoded = json_decode($CODOC_SETTINGS["debug_params"],true) and | |
| 77 | + isset($params_decoded["load_script_condition"]) | |
| 78 | + ) { | |
| 79 | + $load_script_condition = $params_decoded["load_script_condition"]; | |
| 80 | + } | |
| 81 | + if ($load_script_condition == 'not_list_page') { | |
| 82 | + // not_list_pageの場合はトップページ等でスクリプトをロードしない | |
| 83 | + if (!(is_archive() or is_category() or is_home() or is_front_page())) { | |
| 84 | + wp_enqueue_script( 'codoc-injector-js', $this->get_codoc_url() . '/js/cms.js' ); | |
| 85 | + } | |
| 86 | + } else { | |
| 87 | + wp_enqueue_script( 'codoc-injector-js', $this->get_codoc_url() . '/js/cms.js' ); | |
| 88 | + } | |
| 60 | 89 | }); |
| 61 | - // 登録したscriptタグに属性をつける | |
| 90 | + //登録したscriptタグに属性をつける | |
| 62 | 91 | add_filter('script_loader_tag', [$this,'modifier_script_tag'],10,2); |
| 63 | 92 | // tinymce用のショートコード |
| 64 | 93 | add_shortcode('codoc', [$this, 'injector_shortcode']); |
| 94 | + // テーマをbodyにも反映 | |
| 95 | + add_filter('body_class', function($classes) { | |
| 96 | + $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 97 | + // デフォルトを変更 | |
| 98 | + $css_path = 'rainbow-square'; | |
| 99 | + if (isset($CODOC_SETTINGS["css_path"]) and $CODOC_SETTINGS["css_path"]) { | |
| 100 | + $css_path = $CODOC_SETTINGS["css_path"]; | |
| 101 | + } | |
| 102 | + array_push($classes,sprintf( "codoc-theme-%s",$css_path)); | |
| 103 | + return $classes; | |
| 104 | + }); | |
| 105 | + | |
| 65 | 106 | } |
| 66 | 107 | return $this; |
| 67 | 108 | } |
| 109 | + function codoc_load_textdomain() { | |
| 110 | + load_plugin_textdomain('codoc', false, dirname(plugin_basename( __FILE__ )) . '/languages/'); | |
| 111 | + } | |
| 68 | 112 | public function get_codoc_url() { |
| 69 | 113 | $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); |
| 70 | 114 | if (isset($CODOC_SETTINGS["debug_params"])) { |
| 71 | 115 | $params_decoded = json_decode($CODOC_SETTINGS["debug_params"],true); |
| @@ -83,10 +127,32 @@ | ||
| 83 | 127 | $data_css = ''; |
| 84 | 128 | if ($css_path = $CODOC_SETTINGS['css_path']) { |
| 85 | 129 | $data_css = sprintf(' data-css="%s" ',$css_path); |
| 86 | 130 | } |
| 131 | + // connect用パラメータ | |
| 132 | + $connect_attributes = ''; | |
| 133 | + if (isset($CODOC_SETTINGS["codoc_connect_code"])) { | |
| 134 | + $connect_code = $CODOC_SETTINGS["codoc_connect_code"]; | |
| 135 | + $connect_attributes = sprintf(' data-connect-code="%s"',$connect_code); | |
| 136 | + $tag = preg_replace('/cms\.js/','cms-connect.js',$tag); | |
| 137 | + } | |
| 138 | + if (isset($CODOC_SETTINGS["codoc_connect_registration_mode"]) and $CODOC_SETTINGS["codoc_connect_registration_mode"]) { | |
| 139 | + $connect_attributes = $connect_attributes . | |
| 140 | + sprintf(' data-connect-registration-mode="%s"',$CODOC_SETTINGS["codoc_connect_registration_mode"]); | |
| 141 | + } | |
| 142 | + | |
| 143 | + $usercode_attributes = ''; | |
| 144 | + $user_code = get_option(CODOC_USERCODE_OPTION_NAME); | |
| 145 | + if ($user_code) { | |
| 146 | + $usercode_attributes = sprintf(' data-usercode="%s"',$user_code); | |
| 147 | + } | |
| 148 | + | |
| 149 | + $setting_attributes = ''; | |
| 150 | + if (isset($CODOC_SETTINGS['codoc_script_tag_attributes']) and $CODOC_SETTINGS['codoc_script_tag_attributes']) { | |
| 151 | + $setting_attributes = $CODOC_SETTINGS['codoc_script_tag_attributes']; | |
| 152 | + } | |
| 87 | 153 | //return str_replace(' src=', $data_css . ' defer src=', $tag); |
| 88 | - return preg_replace('/(src=[^>]+)/',' ${1} ' . $data_css . ' defer',$tag); | |
| 154 | + return preg_replace('/(src=[^>]+)/',' ${1} ' . $data_css . $connect_attributes . $usercode_attributes . $setting_attributes . ' defer',$tag); | |
| 89 | 155 | } |
| 90 | 156 | public function injector_shortcode($atts) { |
| 91 | 157 | global $post; |
| 92 | 158 | ob_start(); |
| @@ -116,10 +182,13 @@ | ||
| 116 | 182 | add_action('admin_print_styles', 'codoc_admin_styles'); |
| 117 | 183 | function codoc_admin_styles($hook) { |
| 118 | 184 | wp_enqueue_style('codoc-options-style', plugins_url( 'codoc/css/codoc-options.css', __DIR__ )); |
| 119 | 185 | } |
| 120 | - | |
| 121 | 186 | add_action( "admin_init", function() { |
| 187 | + global $CODOC_USERCODE; | |
| 188 | + global $CODOC_SETTINGS; | |
| 189 | + global $CODOC_TOKEN; | |
| 190 | + global $CODOC_AUTHINFO; | |
| 122 | 191 | // codocからの認証データ処理 |
| 123 | 192 | if (isset($_GET['page']) and $_GET['page'] == 'codoc' and isset($_GET['fetch_token_key'])) { |
| 124 | 193 | $key = sanitize_text_field($_GET['fetch_token_key']); |
| 125 | 194 | $usercode = sanitize_text_field($_GET['usercode']); |
| @@ -130,12 +199,9 @@ | ||
| 130 | 199 | update_option(CODOC_TOKEN_OPTION_NAME,$token); |
| 131 | 200 | //$data = $this->callAPI('GET',''); |
| 132 | 201 | $data = $this->util->get_user_info([],["usercode" => $usercode, "token" => $token]); |
| 133 | 202 | if ($data->status and $user = $data->user) { |
| 134 | - update_option(CODOC_AUTHINFO_OPTION_NAME,[ | |
| 135 | - 'email' => $user->email, | |
| 136 | - 'name' => $user->name, | |
| 137 | - ]); | |
| 203 | + $this->update_codoc_authinfo($user); | |
| 138 | 204 | } |
| 139 | 205 | #$current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
| 140 | 206 | #$current_url = preg_replace('/(.*)fetch_token_key.*/','${1}&codoc_auth_finished=1',$current_url); |
| 141 | 207 | //add_settings_error( 'general', 'settings_updated', __( 'OK' ), 'success' ); |
| @@ -144,12 +210,8 @@ | ||
| 144 | 210 | wp_redirect( $current_url); |
| 145 | 211 | exit; |
| 146 | 212 | } |
| 147 | 213 | } |
| 148 | - global $CODOC_USERCODE; | |
| 149 | - global $CODOC_SETTINGS; | |
| 150 | - global $CODOC_TOKEN; | |
| 151 | - global $CODOC_AUTHINFO; | |
| 152 | 214 | $CODOC_USERCODE = get_option(CODOC_USERCODE_OPTION_NAME); |
| 153 | 215 | $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); |
| 154 | 216 | $CODOC_TOKEN = get_option(CODOC_TOKEN_OPTION_NAME); |
| 155 | 217 | $CODOC_AUTHINFO = get_option(CODOC_AUTHINFO_OPTION_NAME); |
| @@ -187,8 +249,11 @@ | ||
| 187 | 249 | } |
| 188 | 250 | if (!isset($CODOC_SETTINGS['do_not_filter_the_content'])) { |
| 189 | 251 | $CODOC_SETTINGS['do_not_filter_the_content'] = '0'; |
| 190 | 252 | } |
| 253 | + if (!isset($CODOC_SETTINGS['shortcode_evacuation'])) { | |
| 254 | + $CODOC_SETTINGS['shortcode_evacuation'] = '0'; | |
| 255 | + } | |
| 191 | 256 | |
| 192 | 257 | if (!isset($CODOC_SETTINGS['entry_button_text'])) { |
| 193 | 258 | $CODOC_SETTINGS['entry_button_text'] = ''; |
| 194 | 259 | } |
| @@ -212,24 +277,50 @@ | ||
| 212 | 277 | } |
| 213 | 278 | if (!isset($CODOC_SETTINGS['show_powered_by'])) { |
| 214 | 279 | $CODOC_SETTINGS['show_powered_by'] = '1'; |
| 215 | 280 | } |
| 216 | - | |
| 281 | + if (!isset($CODOC_SETTINGS['show_created_by'])) { | |
| 282 | + $CODOC_SETTINGS['show_created_by'] = '1'; | |
| 283 | + } | |
| 284 | + if (!isset($CODOC_SETTINGS['show_copyright'])) { | |
| 285 | + $CODOC_SETTINGS['show_copyright'] = '1'; | |
| 286 | + } | |
| 217 | 287 | if (!isset($CODOC_SETTINGS['codoc_tag_attributes'])) { |
| 218 | 288 | $CODOC_SETTINGS['codoc_tag_attributes'] = ''; |
| 219 | 289 | } |
| 290 | + if (!isset($CODOC_SETTINGS['codoc_script_tag_attributes'])) { | |
| 291 | + $CODOC_SETTINGS['codoc_script_tag_attributes'] = ''; | |
| 292 | + } | |
| 293 | + if (!isset($CODOC_SETTINGS['codoc_connect_code'])) { | |
| 294 | + $CODOC_SETTINGS['codoc_connect_code'] = ''; | |
| 295 | + } | |
| 296 | + if (!isset($CODOC_SETTINGS['codoc_connect_registration_mode'])) { | |
| 297 | + $CODOC_SETTINGS['codoc_connect_registration_mode'] = ''; | |
| 298 | + } | |
| 220 | 299 | if (!isset($CODOC_SETTINGS['debug_params'])) { |
| 221 | 300 | $CODOC_SETTINGS['debug_params'] = ''; |
| 222 | 301 | } |
| 223 | - | |
| 224 | 302 | add_settings_section( |
| 225 | 303 | 'setting_section_id', // id |
| 226 | - 'codoc 設定ページ', // title | |
| 304 | + __('codoc Settings','codoc'), // title | |
| 227 | 305 | function (){}, // callback |
| 228 | 306 | 'codoc' // page |
| 229 | 307 | ); |
| 230 | 308 | // 認証がある場合 |
| 231 | 309 | if ($CODOC_AUTHINFO) { |
| 310 | + // クリエイター情報だけ更新 (POST時に同期をとる) | |
| 311 | + if (isset($_GET['page']) and $_GET['page'] == 'codoc' and isset($_GET['settings-updated'])) { | |
| 312 | + $data = $this->util->get_user_info([],[ | |
| 313 | + "usercode" => get_option(CODOC_USERCODE_OPTION_NAME), | |
| 314 | + "token" => get_option(CODOC_TOKEN_OPTION_NAME), | |
| 315 | + ]); | |
| 316 | + if ($data->status and $user = $data->user) { | |
| 317 | + $this->update_codoc_authinfo($user); | |
| 318 | + // 一度get_optionしてるのでリロードする | |
| 319 | + $CODOC_AUTHINFO = get_option(CODOC_AUTHINFO_OPTION_NAME); | |
| 320 | + } | |
| 321 | + } | |
| 322 | + | |
| 232 | 323 | register_setting( |
| 233 | 324 | 'codoc_option_group', // option group |
| 234 | 325 | CODOC_SETTINGS_OPTION_NAME // option name(DB) |
| 235 | 326 | ); |
| @@ -234,20 +325,22 @@ | ||
| 234 | 325 | CODOC_SETTINGS_OPTION_NAME // option name(DB) |
| 235 | 326 | ); |
| 236 | 327 | add_settings_field( |
| 237 | 328 | 'css_path', // id |
| 238 | - 'テーマ', // title | |
| 329 | + __('Theme','codoc'), // title | |
| 239 | 330 | function() { |
| 240 | 331 | global $CODOC_SETTINGS; |
| 241 | - echo '<div class="excerpt">テーマを指定してペイウォールのデザインを変えることができます。<br>パスを指定を選択することでCSSを直接指定するこもと可能です。</div>'; | |
| 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>'; | |
| 242 | 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']); |
| 243 | 334 | echo '' . |
| 244 | 335 | '<script type="text/javascript"> ' . |
| 245 | 336 | ' function gen_css_path(select) { ' . |
| 246 | - ' if (select.value == "dark") { ' . | |
| 337 | + ' if (select.value == "dark" || select.value == "dark-square") { ' . | |
| 247 | 338 | ' document.getElementById("darkmode-caution").style.display="block";' . |
| 248 | 339 | ' } else { ' . |
| 249 | - ' document.getElementById("darkmode-caution").style.display="none";' . | |
| 340 | + ' if (document.getElementById("darkmode-caution")) { ' . | |
| 341 | + ' document.getElementById("darkmode-caution").style.display="none";' . | |
| 342 | + ' } ' . | |
| 250 | 343 | ' } ' . |
| 251 | 344 | ' if (select.value == "path") { ' . |
| 252 | 345 | ' document.getElementById("codoc_css_path").readOnly=false; ' . |
| 253 | 346 | ' if (!document.getElementById("codoc_css_path").value.match(/\//g)) {' . |
| @@ -260,29 +353,50 @@ | ||
| 260 | 353 | ' } ' . |
| 261 | 354 | '</script> ' ; |
| 262 | 355 | |
| 263 | 356 | echo sprintf('<select name="theme_name" onChange="gen_css_path(this)" id="codoc_theme_select">'); |
| 264 | - foreach (["blue","red","green","black","dark"] as $theme) { | |
| 357 | + foreach (["rainbow","blue","red","green","black","dark","rainbow-square","blue-square","red-square","green-square","black-square","dark-square"] as $theme) { | |
| 358 | + if ($theme == "rainbow") { | |
| 359 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "rainbow" ? "selected" : ""),__('Rainbow colors','codoc')); | |
| 360 | + } | |
| 265 | 361 | if ($theme == "blue") { |
| 266 | - echo sprintf('<option value="%s" %s>青</option>', $theme, ($CODOC_SETTINGS["css_path"] == "blue" ? "selected" : "")); | |
| 362 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "blue" ? "selected" : ""),__('Blue','codoc'),); | |
| 267 | 363 | } |
| 268 | 364 | if ($theme == "red") { |
| 269 | - echo sprintf('<option value="%s" %s>赤</option>', $theme, ($CODOC_SETTINGS["css_path"] == "red" ? "selected" : "")); | |
| 365 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "red" ? "selected" : ""),__('Red','codoc')); | |
| 270 | 366 | } |
| 271 | 367 | if ($theme == "green") { |
| 272 | - echo sprintf('<option value="%s" %s>緑</option>', $theme, ($CODOC_SETTINGS["css_path"] == "green" ? "selected" : "")); | |
| 368 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "green" ? "selected" : ""),__('Green','codoc')); | |
| 273 | 369 | } |
| 274 | 370 | if ($theme == "black") { |
| 275 | - echo sprintf('<option value="%s" %s>黒</option>', $theme, ($CODOC_SETTINGS["css_path"] == "black" ? "selected" : "")); | |
| 371 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "black" ? "selected" : ""),__('Black','codoc')); | |
| 276 | 372 | } |
| 277 | 373 | if ($theme == "dark") { |
| 278 | - echo sprintf('<option value="%s" %s>ダークモード</option>', $theme, ($CODOC_SETTINGS["css_path"] == "dark" ? "selected" : "")); | |
| 374 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "dark" ? "selected" : ""),__('Dark mode','codoc')); | |
| 279 | 375 | } |
| 376 | + if ($theme == "rainbow-square") { | |
| 377 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "rainbow-square" ? "selected" : ""),__("Rainbow Colors / Square design",'codoc')); | |
| 378 | + } | |
| 379 | + if ($theme == "blue-square") { | |
| 380 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "blue-square" ? "selected" : ""),__('Blue / Square design','codoc')); | |
| 381 | + } | |
| 382 | + if ($theme == "red-square") { | |
| 383 | + echo sprintf('<option value="%s" %s>%s/option>', $theme, ($CODOC_SETTINGS["css_path"] == "red-square" ? "selected" : ""),__('Red / Square design','codoc')); | |
| 384 | + } | |
| 385 | + if ($theme == "green-square") { | |
| 386 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "green-square" ? "selected" : ""),__('Green / Square design','codoc')); | |
| 387 | + } | |
| 388 | + if ($theme == "black-square") { | |
| 389 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "black-square" ? "selected" : ""),__('Black / Square design','codoc')); | |
| 390 | + } | |
| 391 | + if ($theme == "dark-square") { | |
| 392 | + echo sprintf('<option value="%s" %s>%s</option>', $theme, ($CODOC_SETTINGS["css_path"] == "dark-square" ? "selected" : ""),__('Dark mode / Square design','codoc')); | |
| 393 | + } | |
| 280 | 394 | } |
| 281 | - echo sprintf('<option value="path" %s>パス指定</option>', (preg_match("/\//",$CODOC_SETTINGS["css_path"]) ? "selected" : "")); | |
| 395 | + echo sprintf('<option value="path" %s>%s</option>', (preg_match("/\//",$CODOC_SETTINGS["css_path"]) ? "selected" : ""),__('Path Specification','codoc')); | |
| 282 | 396 | echo '<script type="text/javascript">gen_css_path(document.getElementById(\'codoc_theme_select\'))</script>'; |
| 283 | 397 | echo sprintf('</select></div>'); |
| 284 | - echo '<p id="darkmode-caution" style="display:none">ダークモード向けテーマは文字色が白となり、背景色によっては文字が見えない状態となるためご注意ください。</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>'; | |
| 285 | 399 | }, |
| 286 | 400 | 'codoc', //page |
| 287 | 401 | 'setting_section_id' //Section |
| 288 | 402 | ); |
| @@ -287,45 +401,48 @@ | ||
| 287 | 401 | 'setting_section_id' //Section |
| 288 | 402 | ); |
| 289 | 403 | add_settings_field( |
| 290 | 404 | 'paywall_text', // id |
| 291 | - '各種文言', // title | |
| 405 | + __('Texts in paywall','codoc'), // title | |
| 292 | 406 | function() { |
| 293 | 407 | global $CODOC_SETTINGS; |
| 294 | - echo '<div class="excerpt">ペイウォール内の一部文言を変更できます。</div>'; | |
| 408 | + global $CODOC_AUTHINFO; | |
| 409 | + echo '<div class="excerpt">' . __('You can change, show and hide texts in your paywall.','codoc') . '</div>'; | |
| 295 | 410 | echo '<table class="innerTable"><tbody>'; |
| 296 | - echo '<tr><th>いいねの表示</th><td>'; | |
| 297 | - echo sprintf('<input type="radio" value="1" name="%s[show_like]" id="show_like_on" %s><label for="show_like_on">する</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_like'] == '1' ? "checked" : "")); | |
| 298 | - echo sprintf('<input type="radio" value="0" name="%s[show_like]" id="show_like_off" %s><label for="show_like_off">しない</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($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" : "")); | |
| 299 | 414 | echo '</td></tr>'; |
| 300 | 415 | |
| 301 | - echo '<tr><th>codocについての表示</th><td>'; | |
| 302 | - echo sprintf('<input type="radio" value="1" name="%s[show_about_codoc]" id="show_about_codoc_on" %s><label for="show_about_codoc_on">する</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_about_codoc'] == '1' ? "checked" : "")); | |
| 303 | - echo sprintf('<input type="radio" value="0" name="%s[show_about_codoc]" id="show_about_codoc_off" %s><label for="show_about_codoc_off">しない</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_about_codoc'] == '0' ? "checked" : "")); | |
| 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); | |
| 420 | + if (isset($CODOC_AUTHINFO['account_is_pro']) and $CODOC_AUTHINFO['account_is_pro']) { | |
| 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" : "")); | |
| 423 | + } else { | |
| 424 | + echo __('Only PRO accounts can be disabled.','codoc'); | |
| 425 | + } | |
| 304 | 426 | echo '</td></tr>'; |
| 305 | 427 | |
| 306 | - echo '<tr><th>PoweredByの表示</th><td>'; | |
| 307 | - echo sprintf('<input type="radio" value="1" name="%s[show_powered_by]" id="show_powered_by_on" %s><label for="show_powered_by_on">する</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_powered_by'] == '1' ? "checked" : "")); | |
| 308 | - echo sprintf('<input type="radio" value="0" name="%s[show_powered_by]" id="show_powered_by_off" %s><label for="show_powered_by_off">しない</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_powered_by'] == '0' ? "checked" : "")); | |
| 309 | - echo '</td></tr>'; | |
| 310 | - | |
| 311 | - echo '<tr><th>記事購入ボタンのテキスト</th><td>'; | |
| 428 | + echo '<tr><th>' . __('"Purchase Article" button text','codoc') . '</th><td>'; | |
| 312 | 429 | echo sprintf('<input type="text" name="%s[entry_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['entry_button_text'])); |
| 313 | 430 | echo '</td></tr>'; |
| 314 | 431 | |
| 315 | - echo '<tr><th>サブスクリプション購入ボタンのテキスト</th><td>'; | |
| 432 | + echo '<tr><th>' . __('"Purchase Subscription" button text.','codoc') . '</th><td>'; | |
| 316 | 433 | echo sprintf('<input type="text" name="%s[subscription_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['subscription_button_text'])); |
| 317 | 434 | echo '</td></tr>'; |
| 318 | 435 | |
| 319 | - echo '<tr><th>サポートボタンのテキスト</th><td>'; | |
| 436 | + echo '<tr><th>' . __('Support button text','codoc') . '</th><td>'; | |
| 320 | 437 | echo sprintf('<input type="text" name="%s[support_button_text]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['support_button_text'])); |
| 321 | 438 | echo '</td></tr>'; |
| 322 | 439 | |
| 323 | - echo '<tr><th>「サブスクリプションに含まれる記事」のテキスト</th><td>'; | |
| 440 | + echo '<tr><th>' . __('Text for "Articles Included in Subscription".','codoc') . '</th><td>'; | |
| 324 | 441 | echo sprintf('<input type="text" name="%s[subscription_message]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['subscription_message'])); |
| 325 | 442 | echo '</td></tr>'; |
| 326 | 443 | |
| 327 | - echo '<tr><th>サポート説明のテキスト</th><td>'; | |
| 444 | + echo '<tr><th>' . __('Text for support description','codoc') . '</th><td>'; | |
| 328 | 445 | echo sprintf('<input type="text" name="%s[support_message]" value="%s">',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['support_message'])); |
| 329 | 446 | echo '</td></tr>'; |
| 330 | 447 | |
| 331 | 448 | echo '</tbody></table>'; |
| @@ -335,28 +452,38 @@ | ||
| 335 | 452 | ); |
| 336 | 453 | |
| 337 | 454 | add_settings_field( |
| 338 | 455 | 'codoc_tag_attributes', // id |
| 339 | - 'codocタグの属性', // title | |
| 456 | + __('Attributes for codoc tag','codoc'), // title | |
| 340 | 457 | function() { |
| 341 | 458 | global $CODOC_SETTINGS; |
| 342 | - echo '<div class="excerpt">codocタグに特定の属性を追加することができます。</div>'; | |
| 459 | + echo '<div class="excerpt">' . __('You can add specific attributes to codoc tags.','codoc') . '</div>'; | |
| 343 | 460 | echo sprintf('<input type="text" name="%s[codoc_tag_attributes]" value="%s">',CODOC_SETTINGS_OPTION_NAME,htmlspecialchars($CODOC_SETTINGS['codoc_tag_attributes'])); |
| 344 | 461 | }, |
| 345 | 462 | 'codoc', //page |
| 346 | 463 | 'setting_section_id' //Section |
| 347 | 464 | ); |
| 348 | - | |
| 349 | 465 | add_settings_field( |
| 466 | + 'codoc_script_tag_attributes', // id | |
| 467 | + __('Attributes for codoc script tag','codoc'), // title | |
| 468 | + function() { | |
| 469 | + global $CODOC_SETTINGS; | |
| 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'])); | |
| 472 | + }, | |
| 473 | + 'codoc', //page | |
| 474 | + 'setting_section_id' //Section | |
| 475 | + ); | |
| 476 | + add_settings_field( | |
| 350 | 477 | 'str_replace_binded_url', // id |
| 351 | - 'パーマリンク', // title | |
| 478 | + __('Permalink','codoc'), // title | |
| 352 | 479 | function() { |
| 353 | 480 | global $CODOC_SETTINGS; |
| 354 | - echo '<div class="excerpt">codoc側に登録するパーマリンクを置換することができます。</div>'; | |
| 481 | + echo '<div class="excerpt">' . __('You can replace the part of permalink registered on the codoc.','codoc') . '</div>'; | |
| 355 | 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'])); |
| 356 | - echo ('<span class="suptext">を</span>'); | |
| 483 | + echo ('<span class="suptext">→</span>'); | |
| 357 | 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'])); |
| 358 | - echo ('に変換'); | |
| 485 | + | |
| 359 | 486 | }, |
| 360 | 487 | 'codoc', //page |
| 361 | 488 | 'setting_section_id' //Section |
| 362 | 489 | ); |
| @@ -362,16 +489,14 @@ | ||
| 362 | 489 | ); |
| 363 | 490 | |
| 364 | 491 | add_settings_field( |
| 365 | 492 | 'str_around_codoc_tag', // id |
| 366 | - 'HTMLの挿入', // title | |
| 493 | + __('HTML insertion','codoc'), // title | |
| 367 | 494 | function() { |
| 368 | 495 | global $CODOC_SETTINGS; |
| 369 | - echo '<div class="excerpt">codocタグの前後にHTMLを挿入することができます。</div>'; | |
| 370 | - echo sprintf('<div class="inputRow"><textarea name="%s[str_before_codoc_tag]" cols="40">%s</textarea>',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_before_codoc_tag'])); | |
| 371 | - echo ('を前に挿入</div>'); | |
| 372 | - echo sprintf('<div class="inputRow"><textarea name="%s[str_after_codoc_tag]" cols="40">%s</textarea>',CODOC_SETTINGS_OPTION_NAME,esc_html($CODOC_SETTINGS['str_after_codoc_tag'])); | |
| 373 | - echo ('を後に挿入</div>'); | |
| 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'])); | |
| 374 | 499 | |
| 375 | 500 | }, |
| 376 | 501 | 'codoc', //page |
| 377 | 502 | 'setting_section_id' //Section |
| @@ -378,26 +503,26 @@ | ||
| 378 | 503 | ); |
| 379 | 504 | |
| 380 | 505 | add_settings_field( |
| 381 | 506 | 'always_show_support_tag', // id |
| 382 | - 'サポートの自動挿入', // title | |
| 507 | + __('Automatic support insertion','codoc'), // title | |
| 383 | 508 | function() { |
| 384 | 509 | global $CODOC_SETTINGS; |
| 385 | - echo '<div class="excerpt">codocブロックを挿入することなく投稿にサポート機能を追加します</div>'; | |
| 510 | + echo '<div class="excerpt">' . __('It adds support functions to the post without inserting a codoc block.','codoc') . '</div>'; | |
| 386 | 511 | echo '<table class="innerTable"><tbody>'; |
| 387 | - echo '<tr><th>自動挿入</th><td>'; | |
| 388 | - echo sprintf('<input type="radio" value="1" name="%s[always_show_support]" id="always_show_support_on" %s><label for="always_show_support_on">する</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['always_show_support'] == '1' ? "checked" : "")); | |
| 389 | - echo sprintf('<input type="radio" value="0" name="%s[always_show_support]" id="always_show_support_off" %s><label for="always_show_support_off">しない</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($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" : "")); | |
| 390 | 515 | echo '</td></tr>'; |
| 391 | - echo '<tr><th>表示位置</th><td>'; | |
| 392 | - echo sprintf('<input type="radio" value="top" name="%s[show_support_location]" id="show_support_location_top" %s><label for="show_support_location_top">冒頭</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['show_support_location'] == 'top' ? "checked" : "")); | |
| 393 | - echo sprintf('<input type="radio" value="bottom" name="%s[show_support_location]" id="show_support_location_bottom" %s><label for="show_support_location_bottom">末尾</label> <br / >',CODOC_SETTINGS_OPTION_NAME,($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" : "")); | |
| 394 | 519 | echo '</td></tr>'; |
| 395 | - echo '<tr><th>説明文</th><td>'; | |
| 396 | - echo sprintf('<input type="text" placeholder="サポートの説明文をカスタマイズできます" size="50%%" name="%s[show_support_message]" value="%s">',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'])); | |
| 397 | 522 | echo '</td></tr>'; |
| 398 | - echo '<tr><th>対象カテゴリ名</th><td>'; | |
| 399 | - echo sprintf('<input placeholder=""|"区切りで複数指定できます" type="text" size="50%%" name="%s[show_support_categories]" value="%s"><br />',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'])); | |
| 400 | 525 | echo '</td></tr>'; |
| 401 | 526 | echo '</tbody></table>'; |
| 402 | 527 | |
| 403 | 528 | }, |
| @@ -405,24 +530,38 @@ | ||
| 405 | 530 | 'setting_section_id' //Section |
| 406 | 531 | ); |
| 407 | 532 | add_settings_field( |
| 408 | 533 | 'do_not_filter_the_content', // id |
| 409 | - '支障が出る処理を無効化', // title | |
| 534 | + __('Disable plugin filter','codoc'), // title | |
| 410 | 535 | function() { |
| 411 | 536 | global $CODOC_SETTINGS; |
| 412 | - echo '<div class="excerpt">codocの動作に支障が出る他のプラグインによる<strong>フィルター処理</strong>を無効化できます。codocが上手く動かない場合のみ利用してください。</div>'; | |
| 413 | - 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">する</label> ',CODOC_SETTINGS_OPTION_NAME,($CODOC_SETTINGS['do_not_filter_the_content'] == '1' ? "checked" : "")); | |
| 414 | - 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">しない</label> ',CODOC_SETTINGS_OPTION_NAME,($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" : "")); | |
| 415 | 540 | }, |
| 416 | 541 | 'codoc', //page |
| 417 | 542 | 'setting_section_id' //Section |
| 418 | 543 | ); |
| 544 | + | |
| 419 | 545 | add_settings_field( |
| 546 | + 'shortcode_evacuation', // id | |
| 547 | + __('Shortcode evacuation','codoc'), // title | |
| 548 | + function() { | |
| 549 | + global $CODOC_SETTINGS; | |
| 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" : "")); | |
| 553 | + }, | |
| 554 | + 'codoc', //page | |
| 555 | + 'setting_section_id' //Section | |
| 556 | + ); | |
| 557 | + | |
| 558 | + add_settings_field( | |
| 420 | 559 | 'debug_params', // id |
| 421 | - 'デバック用', // title | |
| 560 | + __('Debug Parameters','codoc'), // title | |
| 422 | 561 | function() { |
| 423 | 562 | global $CODOC_SETTINGS; |
| 424 | - echo '<div class="excerpt">デバック用のパラメーターを指定できます。codocサポートから依頼がある場合のみ利用してください。</div>'; | |
| 563 | + echo '<div class="excerpt">' . __('You can specify parameters for debugging. Please use this only upon request from codoc support.','codoc') . '</div>'; | |
| 425 | 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'])); |
| 426 | 565 | }, |
| 427 | 566 | 'codoc', //page |
| 428 | 567 | 'setting_section_id' //Section |
| @@ -427,9 +566,34 @@ | ||
| 427 | 566 | 'codoc', //page |
| 428 | 567 | 'setting_section_id' //Section |
| 429 | 568 | ); |
| 430 | 569 | |
| 570 | + add_settings_field( | |
| 571 | + 'cretor_info', // id | |
| 572 | + __('Creator\'s Information','codoc'), // title | |
| 573 | + function() { | |
| 574 | + global $CODOC_SETTINGS; | |
| 575 | + global $CODOC_AUTHINFO; | |
| 576 | + echo sprintf('<p><font id="codoc-update-creator-info-message"></font></p>',""); | |
| 577 | + // 変更を保存時に常に同期するのでこの表示は必要ないがUI上保持しておく | |
| 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';"; | |
| 579 | + if (isset($CODOC_AUTHINFO['profile_image_url'])) { | |
| 580 | + echo sprintf('<img src="%s" width="40" height="40" />',$CODOC_AUTHINFO['profile_image_url']); | |
| 581 | + } | |
| 582 | + echo sprintf('<p>%s%s</p>',$CODOC_AUTHINFO['name'],((isset($CODOC_AUTHINFO['account_is_pro']) and $CODOC_AUTHINFO['account_is_pro']) ? ' [PRO] ' : '')); | |
| 583 | + if ($connect_code = $CODOC_SETTINGS['codoc_connect_code']) { | |
| 431 | 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>' : '')); | |
| 588 | + } | |
| 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>'); | |
| 591 | + }, | |
| 592 | + 'codoc', //page | |
| 593 | + 'setting_section_id' //Section | |
| 594 | + ); | |
| 595 | + | |
| 432 | 596 | register_setting( |
| 433 | 597 | 'codoc_option_group', // option group |
| 434 | 598 | CODOC_USERCODE_OPTION_NAME |
| 435 | 599 | ); |
| @@ -438,25 +602,25 @@ | ||
| 438 | 602 | CODOC_TOKEN_OPTION_NAME |
| 439 | 603 | ); |
| 440 | 604 | |
| 441 | 605 | if (isset($_GET['codoc_auth_finished']) and $_GET['codoc_auth_finished']) { |
| 442 | - add_settings_error( 'general', 'settings_updated', __( 'codocの認証が完了しました' ), 'success' ); | |
| 606 | + add_settings_error( 'general', 'settings_updated', __( 'codoc authentication has been completed.' ,'codoc'), 'success' ); | |
| 443 | 607 | } |
| 444 | 608 | |
| 445 | 609 | add_settings_field( |
| 446 | 610 | 'codoc_auth', |
| 447 | - '認証', | |
| 611 | + __('Authentication','codoc'), | |
| 448 | 612 | function() { |
| 449 | 613 | global $CODOC_USERCODE; |
| 450 | 614 | global $CODOC_TOKEN; |
| 451 | 615 | global $CODOC_AUTHINFO; |
| 452 | - $script = "javascript:document.getElementById('codoc-usercode').value='-';document.getElementById('codoc-token').value='-';document.getElementById('codoc-auth-message').innerText='解除を完了するには変更を保存してください';document.getElementById('codoc-auth-message').color='red';"; | |
| 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']); | |
| 453 | 619 | |
| 454 | - echo sprintf('<p><font color="green" id="codoc-auth-message"><strong>%s</strong> で認証済</font></p>',$CODOC_AUTHINFO['email']); | |
| 455 | - | |
| 456 | 620 | echo sprintf('<input id="codoc-usercode" type="hidden" name="%s" value="%s">',CODOC_USERCODE_OPTION_NAME,$CODOC_USERCODE); |
| 457 | 621 | echo sprintf('<input id="codoc-token" type="hidden" name="%s" value="%s">',CODOC_TOKEN_OPTION_NAME,$CODOC_TOKEN); |
| 458 | - echo sprintf('<p>認証を<a href="javascript:void(0);" onClick="' . $script . '">解除する</p>'); | |
| 622 | + echo sprintf('<p><a href="javascript:void(0);" onClick="' . $script . '">' . __('Unbind authorization','codoc') . '</p>'); | |
| 459 | 623 | }, |
| 460 | 624 | 'codoc', |
| 461 | 625 | 'setting_section_id' |
| 462 | 626 | ); |
| @@ -468,20 +632,26 @@ | ||
| 468 | 632 | add_settings_field( |
| 469 | 633 | 'codoc_auth', |
| 470 | 634 | '認証', |
| 471 | 635 | function() { |
| 472 | - | |
| 636 | + $theme = wp_get_theme(); | |
| 637 | + $from = 'wp'; | |
| 638 | + if ($theme->get('Name') === 'codoc') { | |
| 639 | + $from = 'wp_codoc'; | |
| 640 | + } | |
| 473 | 641 | //$current_url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
| 474 | 642 | $current_url = admin_url('options-general.php') . '?page=codoc'; |
| 475 | - $login_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/me/token?from=wp&return_url=' . urlencode($current_url)); | |
| 476 | - $register_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/register?from=wp&return_url=' . urlencode($current_url)); | |
| 643 | + $login_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/me/token?from=' . $from . '&return_url=' . urlencode($current_url)); | |
| 644 | + $register_url = sprintf("location.href='%s'",$this->get_codoc_url() . '/register?from=' . $from . '&return_url=' . urlencode($current_url)); | |
| 477 | 645 | // submitを消しておく |
| 478 | 646 | echo ('<script type="text/javascript">window.onload=function(){document.getElementById(\'submit\').style.display = \'none\'}</script>'); |
| 479 | 647 | echo ('codocをWordPressでご利用いただくには認証が必要です。<br />'); |
| 480 | 648 | echo sprintf('ユーザーコードとAPIトークンを<a href="%s&auth_by_myself=1">直接入力</a>することでも認証できます。<br /><br />',$current_url); |
| 481 | 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); |
| 650 | + if (!$this->util->health_check()) { | |
| 651 | + echo sprintf('<p style="color: red;">codocサーバーと通信ができません。サーバーやWordPress側でのファイヤーウォール設定にて https://codoc.jp への通信を許可してください。</p>'); | |
| 652 | + } | |
| 482 | 653 | |
| 483 | - | |
| 484 | 654 | }, |
| 485 | 655 | 'codoc', |
| 486 | 656 | 'setting_section_id' |
| 487 | 657 | ); |
| @@ -538,9 +708,9 @@ | ||
| 538 | 708 | $data = $this->util->get_support_entry([],[ |
| 539 | 709 | "usercode" => get_option(CODOC_USERCODE_OPTION_NAME), |
| 540 | 710 | "token" => get_option(CODOC_TOKEN_OPTION_NAME), |
| 541 | 711 | ]); |
| 542 | - if ($data->status and $entry = $data->entry) { | |
| 712 | + if ($data and $data->status and $entry = $data->entry) { | |
| 543 | 713 | update_option(CODOC_SUPPORT_ENTRYCODE_OPTION_NAME,$entry->code); |
| 544 | 714 | } else { |
| 545 | 715 | update_option(CODOC_SUPPORT_ENTRYCODE_OPTION_NAME,''); |
| 546 | 716 | } |
| @@ -547,9 +717,9 @@ | ||
| 547 | 717 | } elseif(isset($CODOC_SETTINGS['always_show_support']) and !$CODOC_SETTINGS['always_show_support']) { |
| 548 | 718 | update_option(CODOC_SUPPORT_ENTRYCODE_OPTION_NAME,''); |
| 549 | 719 | } |
| 550 | 720 | }); |
| 551 | - | |
| 721 | + | |
| 552 | 722 | add_action('updated_option',function(){ |
| 553 | 723 | global $CODOC_RE_AUTHORIZE; |
| 554 | 724 | if ($CODOC_RE_AUTHORIZE) { |
| 555 | 725 | //$data = $this->callAPI('GET',''); |
| @@ -557,12 +727,9 @@ | ||
| 557 | 727 | "usercode" => get_option(CODOC_USERCODE_OPTION_NAME), |
| 558 | 728 | "token" => get_option(CODOC_TOKEN_OPTION_NAME), |
| 559 | 729 | ]); |
| 560 | 730 | if ($data->status and $user = $data->user) { |
| 561 | - update_option(CODOC_AUTHINFO_OPTION_NAME,[ | |
| 562 | - 'email' => $user->email, | |
| 563 | - 'name' => $user->name, | |
| 564 | - ]); | |
| 731 | + $this->update_codoc_authinfo($user); | |
| 565 | 732 | } else { |
| 566 | 733 | update_option(CODOC_AUTHINFO_OPTION_NAME,''); |
| 567 | 734 | } |
| 568 | 735 | } |
| @@ -624,13 +791,55 @@ | ||
| 624 | 791 | add_filter( 'mce_buttons', function( $buttons ) { |
| 625 | 792 | array_push( $buttons, "|", "codoc" ); |
| 626 | 793 | return $buttons; |
| 627 | 794 | } ); |
| 795 | + // 非SSL環境の場合、なぜかhttps -> httpsになってしまうので対策 | |
| 796 | + // コメントタグが除去されることがあるらしいのでvalid_elementsに必要なタグを追加 (EXPERIMENTAL) | |
| 797 | + add_filter( 'tiny_mce_before_init', function($settings) { | |
| 798 | + $settings['external_plugins'] = preg_replace('/"codoc":"http:/','"codoc":"https:',$settings['external_plugins']); | |
| 799 | + foreach (['valid_elements','extended_valid_elements'] as $valid_elements) { | |
| 800 | + if (isset($settings[$valid_elements])) { | |
| 801 | + $settings[$valid_elements] = $settings[$valid_elements] . ',div[*],p[*],img[*],--[*]'; | |
| 802 | + } | |
| 803 | + } | |
| 804 | + $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 805 | + if (isset($CODOC_SETTINGS["debug_params"])) { | |
| 806 | + $params_decoded = json_decode($CODOC_SETTINGS["debug_params"],true); | |
| 807 | + if (isset($params_decoded["mce_valid_elements"])) { | |
| 808 | + $settings['valid_elements'] = $params_decoded["mce_valid_elements"]; | |
| 809 | + $settings['extended_valid_elements'] = $params_decoded["mce_valid_elements"]; | |
| 810 | + } | |
| 811 | + } | |
| 628 | 812 | |
| 813 | + return $settings; | |
| 814 | + },1000000); | |
| 629 | 815 | } |
| 630 | 816 | } |
| 631 | 817 | } ); |
| 632 | 818 | } |
| 819 | + function update_codoc_authinfo($user) { | |
| 820 | + global $CODOC_SETTINGS; | |
| 821 | + global $CODOC_AUTHINFO; | |
| 822 | + if (property_exists($user,'connect_code') and $user->connect_code) { | |
| 823 | + $CODOC_SETTINGS = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 824 | + $CODOC_SETTINGS['codoc_connect_code'] = $user->connect_code; | |
| 825 | + $CODOC_SETTINGS['codoc_connect_registration_mode'] = $user->connect_has_permission_dedicated_account ? 'dedicated' : ''; | |
| 826 | + update_option(CODOC_SETTINGS_OPTION_NAME,$CODOC_SETTINGS); | |
| 827 | + } | |
| 828 | + return update_option(CODOC_AUTHINFO_OPTION_NAME,[ | |
| 829 | + 'email' => $user->email, | |
| 830 | + 'name' => $user->name, | |
| 831 | + 'profile_image_url' => $user->profile_image_url, | |
| 832 | + 'cover_image_url' => $user->cover_image_url, | |
| 833 | + 'connect_code' => property_exists($user,'connect_code') ? $user->connect_code : '', | |
| 834 | + 'connect_image_url' => property_exists($user,'connect_image_url') ? $user->connect_image_url : '', | |
| 835 | + 'account_is_pro' => property_exists($user,'account_is_pro') ? $user->account_is_pro : '', | |
| 836 | + 'created_at' => property_exists($user,'created_at') ? $user->created_at : 0, | |
| 837 | + ]); | |
| 838 | + $CODOC_AUTHINFO = get_option(CODOC_AUTHINFO_OPTION_NAME); | |
| 839 | + return $CODOC_AUTHINFO; | |
| 840 | + } | |
| 841 | + // 保存用コンテンツにフィルターを実施する | |
| 633 | 842 | public function get_filtered_content($post_emulated) { |
| 634 | 843 | // 記事ページであることをエミュレートしてフィルター実行 |
| 635 | 844 | $post_backuped = null; |
| 636 | 845 | if (isset($GLOBALS['post'])) { |
| @@ -641,13 +850,18 @@ | ||
| 641 | 850 | $wp_query_backuped = null; |
| 642 | 851 | if (isset($GLOBALS['wp_query'])) { |
| 643 | 852 | $wp_query_backuped = $GLOBALS['wp_query']; |
| 644 | 853 | $wp_query = $GLOBALS['wp_query']; |
| 645 | - $is_single_backuped = $wp_query->is_single; | |
| 646 | 854 | $wp_query->is_single = true; |
| 855 | + $wp_query->is_singular = true; | |
| 856 | + # in_the_loop は記事ページでは通常有効っぽいので true指定 ex: wp_ulike | |
| 857 | + $wp_query->in_the_loop = true; | |
| 858 | + # これも追加しておく | |
| 859 | + $wp_query->is_main_query = true; | |
| 860 | + | |
| 647 | 861 | $wp_query->post = $post_emulated; |
| 648 | 862 | $wp_query->queried_object = $post_emulated; |
| 649 | - $wp_query->queried_object_id = $post_emulated->id; | |
| 863 | + $wp_query->queried_object_id = $post_emulated->ID; | |
| 650 | 864 | |
| 651 | 865 | $GLOBALS['wp_query'] = $wp_query; |
| 652 | 866 | } |
| 653 | 867 | // $this->the_content でオリジナルを返してもらうため |
| @@ -655,8 +869,29 @@ | ||
| 655 | 869 | $content = preg_replace( |
| 656 | 870 | '/ (\/)?wp:codoc\/codoc-block /',' \\1wptmp:codoc/codoc-block ', |
| 657 | 871 | $post_emulated->post_content |
| 658 | 872 | ); |
| 873 | + // post_metaに内容を保存し、無料パートにショートコードの退避をおこなう | |
| 874 | + $codoc_settings = get_option(CODOC_SETTINGS_OPTION_NAME); | |
| 875 | + if (isset($codoc_settings['shortcode_evacuation']) and $codoc_settings['shortcode_evacuation']) { | |
| 876 | + $splited = preg_split('/\/wptmp:codoc\/codoc-block/s',$content); | |
| 877 | + if (isset($splited[0]) and isset($splited[1])) { | |
| 878 | + // すべてのショートコードを $match_all にいれる | |
| 879 | + preg_match_all('/\[[^\[\]]+?\](.+\[\/[^\[\]]+?\])?/',$splited[1],$match_all); | |
| 880 | + // ショートコードをURLエンコードしてdivタグの中にいれておく(後でmetaの中のショートコードと付け合せ) | |
| 881 | + $replaced = preg_replace_callback('/\[[^\[\]]+?\](.+\[\/[^\[\]]+?\])?/',function($matches) { | |
| 882 | + return sprintf ('<div class="codoc-evacuation-dests" data-shortcode="%s"></div>', urlencode($matches[0])); | |
| 883 | + },$splited[1]); | |
| 884 | + // 0番目に配列で入っているのでそこを退避対象の配列とする | |
| 885 | + $evacuations = $match_all[0]; | |
| 886 | + // ショートコードの中身をタグに退避 | |
| 887 | + $content = $splited[0] . '/wptmp:codoc/codoc-block' . $replaced; | |
| 888 | + // 無料パートでショートコードを実行できるようにする | |
| 889 | + update_post_meta($post_emulated->ID,'codoc_shortcode_evacuations',join('**codoc**',$evacuations)); | |
| 890 | + } else { | |
| 891 | + update_post_meta($post_emulated->id,'codoc_shortcode_evacuations',""); | |
| 892 | + } | |
| 893 | + } | |
| 659 | 894 | #$content = do_shortcode( $content ); |
| 660 | 895 | $content_filtered = apply_filters( 'the_content', $content); |
| 661 | 896 | $this->do_not_filter_the_content = false; |
| 662 | 897 | |
| @@ -669,9 +904,8 @@ | ||
| 669 | 904 | $content_filtered = preg_replace( |
| 670 | 905 | '/ (\/)?wptmp:codoc\/codoc-block /',' \\1wp:codoc/codoc-block ', |
| 671 | 906 | $content_filtered |
| 672 | 907 | ); |
| 673 | - | |
| 674 | 908 | return $content_filtered; |
| 675 | 909 | } |
| 676 | 910 | |
| 677 | 911 | public function save_post($post_ID,$post,$update) { |
| @@ -684,9 +918,10 @@ | ||
| 684 | 918 | $post->post_content : $this->get_filtered_content($post); |
| 685 | 919 | $res = $this->util->sync_entry([ |
| 686 | 920 | "post_title" => $post->post_title, |
| 687 | 921 | "post_content" => $post_content, |
| 688 | - "post_status" => ($post->post_status == 'publish' ? 1 : 0), | |
| 922 | + // password が設定されてる場合は限定公開にする | |
| 923 | + "post_status" => $post->post_status == 'publish' ? ($post->post_password ? 2 : 1) : 0, | |
| 689 | 924 | "post_permalink" => get_permalink($post_ID), |
| 690 | 925 | "codoc_entry_code" => $entryCode, |
| 691 | 926 | "codoc_settings" => $codoc_settings, |
| 692 | 927 | ],[ |
| @@ -692,20 +927,42 @@ | ||
| 692 | 927 | ],[ |
| 693 | 928 | "usercode" => get_option(CODOC_USERCODE_OPTION_NAME), |
| 694 | 929 | "token" => get_option(CODOC_TOKEN_OPTION_NAME), |
| 695 | 930 | ]); |
| 696 | - | |
| 931 | + $prudent_update_post_meta_entry_code = null; | |
| 932 | + if (isset($codoc_settings["debug_params"])) { | |
| 933 | + $params_decoded = json_decode($codoc_settings["debug_params"],true); | |
| 934 | + if (isset($params_decoded["prudent_update_post_meta_entry_code"])) { | |
| 935 | + $prudent_update_post_meta_entry_code = $params_decoded["prudent_update_post_meta_entry_code"]; | |
| 936 | + } | |
| 937 | + } | |
| 938 | + if ($prudent_update_post_meta_entry_code == 2) { | |
| 939 | + error_log('CODOC:: ' . sprintf ("%s : %s : %s : %s", $post_ID, (is_object($res) ? "1" : 0),$res->status,$entryCode)); | |
| 940 | + } | |
| 697 | 941 | if (is_object($res) and $res->status and !$entryCode) { |
| 698 | - update_post_meta($post_ID,'codoc_entry_code',$res->entry->code); | |
| 942 | + // 20230222 https://stackoverflow.com/questions/26640785/update-post-meta-not-work-only-when-save-data-not-for-update | |
| 943 | + if ($prudent_update_post_meta_entry_code) { | |
| 944 | + add_post_meta($post_ID,'codoc_entry_code',$res->entry->code); | |
| 945 | + } else { | |
| 946 | + update_post_meta($post_ID,'codoc_entry_code',$res->entry->code); | |
| 947 | + } | |
| 699 | 948 | } |
| 700 | - | |
| 701 | 949 | return true; |
| 702 | 950 | } |
| 703 | 951 | function updated_post_meta( $meta_ID, $post_ID, $meta_key ) { |
| 704 | - if ($meta_key != '_thumbnail_id') { | |
| 952 | + // スルーされてる場合は他のメタ情報更新のタイミングにサムネイルをアップロード | |
| 953 | + $has_to_resend = get_post_meta($post_ID,'codoc_post_thumbnail_invoking_entry_code',true); | |
| 954 | + if ($has_to_resend != 1 and $meta_key != '_thumbnail_id') { | |
| 705 | 955 | return; |
| 706 | 956 | } |
| 707 | 957 | if ( has_post_thumbnail($post_ID) ) { |
| 958 | + // 新規投稿の場合、タイミングによってはcodocEntryCodeが取得できないので一旦スルーする | |
| 959 | + if (!get_post_meta($post_ID,'codoc_entry_code',true)) { | |
| 960 | + update_post_meta($post_ID,'codoc_post_thumbnail_invoking_entry_code',1); | |
| 961 | + return; | |
| 962 | + } else { | |
| 963 | + update_post_meta($post_ID,'codoc_post_thumbnail_invoking_entry_code',0); | |
| 964 | + } | |
| 708 | 965 | $attachment = wp_get_attachment_metadata( get_post_thumbnail_id($post_ID)); |
| 709 | 966 | $upload_dir = wp_upload_dir(); |
| 710 | 967 | $file_path = sprintf ('%s/%s',$upload_dir['basedir'],$attachment['file']); |
| 711 | 968 | |
| @@ -730,9 +987,25 @@ | ||
| 730 | 987 | "token" => get_option(CODOC_TOKEN_OPTION_NAME), |
| 731 | 988 | ] |
| 732 | 989 | ); |
| 733 | 990 | } |
| 734 | - | |
| 991 | + // 退避されてるかどうかをmetaを使って確認し、無料エリアの一番最後にショートコードを追加 | |
| 992 | + function the_content_shortcode_evacuations( $post_content ) { | |
| 993 | + if ($this->do_not_filter_the_content) { | |
| 994 | + return $post_content; | |
| 995 | + } | |
| 996 | + $post = get_post(); | |
| 997 | + if (!$post) { | |
| 998 | + return $post_content; | |
| 999 | + } | |
| 1000 | + $evacuations_meta = get_post_meta($post->ID,'codoc_shortcode_evacuations',true); | |
| 1001 | + $evacuations = preg_split('/\*\*codoc\*\*/',$evacuations_meta); | |
| 1002 | + foreach ($evacuations as $evacuation) { | |
| 1003 | + $post_content = sprintf('<div class="codoc-evacuations" style="display:none;" data-shortcode="%s">%s</div>', | |
| 1004 | + urlencode($evacuation),$evacuation) . $post_content; | |
| 1005 | + } | |
| 1006 | + return $post_content; | |
| 1007 | + } | |
| 735 | 1008 | function the_content( $post_content ) { |
| 736 | 1009 | if ( is_single() && in_the_loop() && is_main_query() ) { |
| 737 | 1010 | } |
| 738 | 1011 | // get_filtered_content から do_not_filter_the_contentを有効にされるパターン |
| @@ -740,8 +1013,12 @@ | ||
| 740 | 1013 | if ($this->do_not_filter_the_content) { |
| 741 | 1014 | return $post_content; |
| 742 | 1015 | } |
| 743 | 1016 | $post = get_post(); |
| 1017 | + // 20211215 null になる場合がある | |
| 1018 | + if (!$post) { | |
| 1019 | + return $post_content; | |
| 1020 | + } | |
| 744 | 1021 | # is_amp で実装しているテンプレート用 |
| 745 | 1022 | $is_amp_endpoint = (function_exists('is_amp_endpoint') && is_amp_endpoint()) ? true : |
| 746 | 1023 | ((function_exists('is_amp') && is_amp()) ? true : false); |
| 747 | 1024 | return $this->util->filter_content([ |