SEO用のキーワード変更WordpressPluginを作っています。
以下のエラーメッセージが発生しました。
どうすればいいですか
###発生している問題・エラーメッセージ
Parse error: syntax error, unexpected ';', expecting ')' in xxx/wp-content/plugins/KeywordsChenge/Plugin.php on line 50
###該当のソースコード
PHP
1<?php 2/* 3Plugin Name: KeywordsChenge 4Plugin URI: 5Description: Change the search keyword in the web page. 6Version: 1.0 7Author: mk 8Author URI: 9License: GPL2 10*/ 11/* Copyright 2016 mk (email : yamk4054@gmail.com) 12 13 This program is free software; you can redistribute it and/or modify 14 it under the terms of the GNU General Public License, version 2, as 15 published by the Free Software Foundation. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25*/ 26//lang 27 $mk_kc_lang_title = "キーワード管理"; 28 $mk_kc_lang_screen_title = "キーワード管理画面"; 29 $mk_kc_lang_keyword = "キーワード"; 30 $mk_kc_lang_save_messege = "変更を保存しました"; 31 $mk_kc_lang_save_button = "変更を保存"; 32//settings 33 $mk_kc_settings_maxkyes = 5; //Google of the recommended number of keywords,5 keywords. 34 35add_action( 'admin_menu', 'mk_kc_add_plugin_admin_menu' ); 36function mk_kc_add_plugin_admin_menu() {add_options_page($mk_kc_lang_title,$mk_kc_lang_screen_title,'administrator', 'keywords','mk_kc_display_plugin_admin_page');} 37function mk_kc_display_plugin_admin_page() { 38 if ( isset($_POST['mk_kc_options'])) {check_admin_referer('kcoptions');$opt = $_POST['mk_kc_options'];update_option('mk_kc_options', $opt); 39 ?> 40 <div class="updated fade"><p><strong><?php _e($mk_kc_lang_save_messege); ?></strong></p></div> 41 <?php 42 } 43 ?> 44 <div class="wrap"> 45 <div id="icon-options-general" class="icon32"><br /></div><h2><?php echo $mk_kc_lang_screen_title ?></h2> 46 <form action="" method="post"> 47 <?php 48 wp_nonce_field('kcoptions'); 49 $opt = get_option('mk_kc_options'); 50 for ($mk_kc_system_i = 1;$mk_kc_system_i < $mk_kc_settings_maxkyes;$mk_kc_system_i += 1;){ 51 $show_text[$mk_kc_system_i] = isset($opt['key'[$mk_kc_system_i]]) ? $opt['key'[$mk_kc_system_i]]: null; 52 } 53 ?> 54 <table class="form-table"> 55 <?php for ($mk_kc_system_i = 1,$mk_kc_system_i < $mk_kc_settings_maxkyes,$mk_kc_system_i += 1;){echo "\t<tr valign=\"top\"><th scope=\"row\"><label for=\"inputtext\">" & $mk_kc_lang_keyword & "</label></th><td><input name=\"mk_kc_options[key["$mk_kc_system_i"]]\" type=\"key\" id=\"inputtext\" value=" & $show_text[$mk_kc_system_i] & " class=\"regular-text\" /></td></tr>\n\t\t\t"} ?> 56 </table> 57 <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php echo $mk_kc_lang_save_button ?>" /></p> 58 </form> 59 <!-- /.wrap --></div> 60 <?php} 61//main 62function mk_kc_get_key($num) { 63 $opt = get_option('mk_kc_options'); 64 $array = $opt['text']; 65 $array[0] = ""; 66 if ($num == "List"){ 67 return implode(",",$array); 68 }elseif (is_int($num)){ 69 if{ 70 $array[$num] 71 }else{ 72 return ""; 73 } 74 }else{return "";} 75 76} 77?>
###補足情報(言語/FW/ツール等のバージョンなど)
PHP 7 wordpress最新
###追記
上のは解決したのですが今度は
コード
php
1<?php 2/* 3Plugin Name: KeywordsChenge 4Plugin URI: 5Description: Change the search keyword in the web page. 6Version: 1.0 7Author: mk 8Author URI: 9License: GPL2 10*/ 11/* Copyright 2016 mk (email : yamk4054@gmail.com) 12 13 This program is free software; you can redistribute it and/or modify 14 it under the terms of the GNU General Public License, version 2, as 15 published by the Free Software Foundation. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 25*/ 26//lang 27 $mk_kc_lang_title = "キーワード管理"; 28 $mk_kc_lang_screen_title = "キーワード管理画面"; 29 $mk_kc_lang_keyword = "キーワード"; 30 $mk_kc_lang_save_messege = "変更を保存しました"; 31 $mk_kc_lang_save_button = "変更を保存"; 32//settings 33 $mk_kc_settings_maxkyes = 5; //Google of the recommended number of keywords,5 keywords. 34 35add_action( 'admin_menu', 'mk_kc_add_plugin_admin_menu' ); 36function mk_kc_add_plugin_admin_menu() {add_options_page($mk_kc_lang_title,$mk_kc_lang_screen_title,'administrator', 'keywords','mk_kc_display_plugin_admin_page');} 37function mk_kc_display_plugin_admin_page() { 38 if ( isset($_POST['mk_kc_options'])) {check_admin_referer('kcoptions');$opt = $_POST['mk_kc_options'];update_option('mk_kc_options', $opt); 39 ?> 40 <div class="updated fade"><p><strong><?php _e($mk_kc_lang_save_messege); ?></strong></p></div> 41 <?php 42 } 43 ?> 44 <div class="wrap"> 45 <div id="icon-options-general" class="icon32"><br /></div><h2><?php echo $mk_kc_lang_screen_title ?></h2> 46 <form action="" method="post"> 47 <?php 48 wp_nonce_field('kcoptions'); 49 $opt = get_option('mk_kc_options'); 50 for ($mk_kc_system_i = 1;$mk_kc_system_i < $mk_kc_settings_maxkyes;$mk_kc_system_i += 1){ 51 $show_text[$mk_kc_system_i] = isset($opt['key'[$mk_kc_system_i]]) ? $opt['key'[$mk_kc_system_i]]: null; 52 } 53 ?> 54 <table class="form-table"> 55 <?php 56 for ($mk_kc_system_i = 1;$mk_kc_system_i < $mk_kc_settings_maxkyes;$mk_kc_system_i += 1){ 57 echo "\t<tr valign=\"top\"><th scope=\"row\"><label for=\"inputtext\">" & $mk_kc_lang_keyword & "</label></th><td><input name=\"mk_kc_options[key["$mk_kc_system_i"]]\" type=\"key\" id=\"inputtext\" value=" & $show_text[$mk_kc_system_i] & " class=\"regular-text\" /></td></tr>\n\t\t\t"; 58 } 59 ?> 60 </table> 61 <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php echo $mk_kc_lang_save_button ?>" /></p> 62 </form> 63 <!-- /.wrap --></div> 64 <?php} 65//main 66function mk_kc_get_key($num) { 67 $opt = get_option('mk_kc_options'); 68 $array = $opt['text']; 69 $array[0] = ""; 70 if ($num == "List"){ 71 return implode(",",$array); 72 }elseif (is_int($num)){ 73 if{ 74 $array[$num] 75 }else{ 76 return ""; 77 } 78 }else{return "";} 79 80} 81?>
Parse error: syntax error, unexpected ';', expecting ')' in xxx/wp-content/plugins/KeywordsChenge/Plugin.php on line 56
上のエラーが出てしまいました
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/05/04 03:49
退会済みユーザー
2016/05/04 03:56