Changeset 978380
- Timestamp:
- 09/04/2014 05:24:47 AM (12 years ago)
- Location:
- ichigen-san/trunk
- Files:
-
- 3 added
- 4 deleted
- 5 edited
-
css (deleted)
-
ichigen-san.php (modified) (2 diffs)
-
images (deleted)
-
js (added)
-
js/ichigen-san.js (added)
-
languages/ichigen-san-ja.mo (modified) (previous)
-
languages/ichigen-san-ja.po (modified) (1 diff)
-
languages/ichigen-san.pot (added)
-
languages/spot-ja.mo (deleted)
-
languages/spot-ja.po (deleted)
-
readme-ja.txt (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ichigen-san/trunk/ichigen-san.php
r603714 r978380 2 2 /* 3 3 Plugin Name: Ichigen San 4 Plugin URI: http:// plugins.webnist.jp5 Description: 4 Plugin URI: http://wordpress.org/plugins/ichigen-san/ 5 Description: Because you can not be viewed unless you log When you activate this plug-in, You can start a private blog. Furthermore, you can also be used for communication between the acquaintance. 6 6 Author: Webnist 7 Version: 0.1 8 Author URI: http://webni.st 7 Version: 0.3 8 Author URI: http://profiles.wordpress.org/webnist 9 License: GPLv2 or later 10 Text Domain: ichigen-san 11 Domain Path: /languages/ 9 12 */ 10 11 if ( !defined( 'ICHIGEN_SAN_DOMAIN' ) )12 define( 'ICHIGEN_SAN_DOMAIN', 'ichigen-san' );13 13 14 14 if ( !defined( 'ICHIGEN_SAN_PLUGIN_URL' ) ) … … 18 18 define( 'ICHIGEN_SAN_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) ); 19 19 20 new Ichigen_San(); 21 22 class Ichigen_San { 23 24 private $version = '0.1'; 25 private $base_dir; 26 private $plugin_dir; 27 private $plugin_url; 28 private $menu_slug = 'ichigen-san'; 20 class IchigenSan { 29 21 30 22 public function __construct() { 31 $this->base_dir = dirname( plugin_basename( __FILE__ ) ); 32 $this->plugin_dir = WP_PLUGIN_DIR . '/' . $this->base_dir; 33 $this->plugin_url = WP_PLUGIN_URL . '/' . $this->base_dir; 34 $this->menu_slug = 'ichigen-san'; 35 36 load_plugin_textdomain( ICHIGEN_SAN_DOMAIN, false, $this->base_dir . '/languages/' ); 37 add_action( 'template_redirect', array( &$this, 'redirect_ichigen_san' ) ); 23 $data = get_file_data( 24 __FILE__, 25 array( 26 'ver' => 'Version', 27 'domain' => 'Text Domain', 28 'langs' => 'Domain Path' 29 ) 30 ); 31 32 $this->plugin_basename = dirname( plugin_basename(__FILE__) ); 33 $this->version = $data['ver']; 34 $this->domain = $data['domain']; 35 $this->langs = $data['langs']; 36 $this->enabling = get_option( 'ichigen_san_enabling', 0 ); 37 $this->basic_user = get_option( 'ichigen_san_basic_user' ); 38 $this->basic_pass = get_option( 'ichigen_san_basic_pass' ); 39 40 load_plugin_textdomain( $this->domain, false, $this->plugin_basename . $this->langs ); 41 add_action( 'template_redirect', array( &$this, 'template_redirect' ) ); 38 42 if ( is_admin() ) { 39 43 add_action( 'admin_menu', array( &$this, 'admin_menu' ) ); 40 add_action( 'admin_print_styles', array( &$this, 'admin_styles' ) );41 //add_action( 'admin_enqueue_scripts', array( &$this, 'admin_javascript' ) );42 44 add_action( 'admin_init', array( &$this, 'add_general_custom_fields' ) ); 43 45 add_filter( 'admin_init', array( &$this, 'add_custom_whitelist_options_fields' ) ); 46 add_action( 'admin_print_scripts-settings_page_' . $this->plugin_basename, array( &$this, 'admin_print_scripts' ) ); 44 47 } 45 48 } 46 49 50 public function admin_print_scripts() { 51 wp_enqueue_script( 'admin_ichigen_san', ICHIGEN_SAN_PLUGIN_URL . '/js/ichigen-san.js', array( 'jquery' ), $this->version, true ); 52 } 53 47 54 public function admin_menu() { 48 add_ menu_page( __( 'Set Ichigen San', ICHIGEN_SAN_DOMAIN ), __( 'Set Ichigen San', ICHIGEN_SAN_DOMAIN ), 'add_users', $this->menu_slug, array( &$this, 'add_admin_edit_page' ));55 add_options_page( __( 'Set Ichigen San', $this->domain ), __( 'Set Ichigen San', $this->domain ), 'add_users', $this->plugin_basename, array( &$this, 'add_admin_edit_page' ), ICHIGEN_SAN_PLUGIN_URL . '/images/icon/menu.png' ); 49 56 } 50 57 51 58 public function add_admin_edit_page() { 52 $title = __( 'Set Ichigen San', ICHIGEN_SAN_DOMAIN ); ?> 53 <div class="wrap"> 54 <?php screen_icon(); ?> 55 <h2><?php echo esc_html( $title ); ?></h2> 56 <form method="post" action="options.php"> 57 <?php settings_fields( $this->menu_slug ); ?> 58 <?php do_settings_sections( $this->menu_slug ); ?> 59 <table class="form-table"> 60 <?php do_settings_fields( $this->menu_slug, 'default' ); ?> 61 </table> 62 <?php submit_button(); ?> 63 </form> 64 </div> 65 <?php } 59 $title = __( 'Set Ichigen San', $this->domain ); 60 echo '<div class="wrap">' . "\n"; 61 screen_icon(); 62 echo '<h2>' . esc_html( $title ) . '</h2>' . "\n"; 63 echo '<form method="post" action="options.php">' . "\n"; 64 settings_fields( $this->plugin_basename ); 65 do_settings_sections( $this->plugin_basename ); 66 submit_button(); 67 echo '<h2>' . esc_html__( 'Setting initialization', $this->domain ) . '</h2>' . "\n"; 68 submit_button( __( 'Initialization', $this->domain ), 'primary', 'ichigen-san-initialization' ); 69 echo '</form>' . "\n"; 70 echo '</div>' . "\n"; 71 } 66 72 67 73 public function add_general_custom_fields() { 68 add_settings_field( 'enabling', __( 'Enabling Ichogen San', ICHIGEN_SAN_DOMAIN ), array( &$this, 'enabling_field' ), $this->menu_slug, 'default' ); 69 } 70 71 public function enabling_field( $args ) { 72 extract( $args ); 73 $value = get_option( 'ichigen_san_enabling' ); 74 ?> 75 <label><input type="checkbox" name="ichigen_san_enabling" value="1" id="ichigen_san_enabling"<?php checked( 1, $value ); ?> /><?php _e( 'Enabling', ICHIGEN_SAN_DOMAIN ); ?></label> 76 <?php 74 global $wp_version; 75 76 add_settings_section( 77 'general', 78 __( 'General', $this->domain ), 79 '', 80 $this->domain 81 ); 82 add_settings_field( 83 'enabling', 84 __( 'Enabling Ichogen San', $this->domain ), 85 array( &$this, 'select_field' ), 86 $this->plugin_basename , 87 'general', 88 array( 89 'name' => 'ichigen_san_enabling', 90 'value' => $this->enabling, 91 'option' => array( 92 __( 'Disabled', $this->domain ) => 0, 93 __( 'Login screen', $this->domain ) => 1, 94 __( 'Basic authentication', $this->domain ) => 2, 95 ), 96 ) 97 ); 98 add_settings_field( 99 'basic-user', 100 __( 'Basic User', $this->domain ), 101 array( &$this, 'text_field' ), 102 $this->plugin_basename , 103 'general', 104 array( 105 'name' => 'ichigen_san_basic_user', 106 'value' => $this->basic_user, 107 ) 108 ); 109 add_settings_field( 110 'basic-pass', 111 __( 'Basic Password', $this->domain ), 112 array( &$this, 'text_field' ), 113 $this->plugin_basename , 114 'general', 115 array( 116 'name' => 'ichigen_san_basic_pass', 117 'value' => $this->basic_pass, 118 'type' => 'password', 119 ) 120 ); 121 } 122 public function text_field( $args ) { 123 extract( $args ); 124 $desc = ! empty( $desc ) ? $desc : ''; 125 $type = empty( $type ) ? 'text' : esc_attr( $type ); 126 $value = ( 'password' == $type ) ? '' : $value; 127 $output = '<input type="' . $type . '" name="' . $name .'" id="' . $name .'" value="' . $value .'" />' . "\n"; 128 if ( $desc ) 129 $output .= '<p class="description">' . $desc . '</p>' . "\n"; 130 131 echo $output; 132 } 133 134 public function textarea_field( $args ) { 135 extract( $args ); 136 $desc = ! empty( $desc ) ? $desc : ''; 137 $output = '<textarea name="' . $name .'" rows="10" cols="50" id="' . $name .'" class="large-text code">' . $value . '</textarea>' . "\n"; 138 if ( $desc ) 139 $output .= '<p class="description">' . $desc . '</p>' . "\n"; 140 echo $output; 141 } 142 143 public function check_field( $args ) { 144 extract( $args ); 145 $desc = ! empty( $desc ) ? $desc : ''; 146 $output = '<label for="' . $name . '">' . "\n"; 147 $output = '<input name="' . $name . '" type="checkbox" id="' . $name . '" value="1"' . checked( $value, 1, false ) . '>' . "\n"; 148 if ( $desc ) 149 $output .= $desc . "\n"; 150 $output .= '</label>' . "\n"; 151 152 echo $output; 153 } 154 155 public function select_field( $args ) { 156 extract( $args ); 157 $desc = ! empty( $desc ) ? $desc : ''; 158 $output = '<select name="' . $name . '" id="' . $name . '">' . "\n"; 159 foreach ( $option as $key => $val ) { 160 $output .= '<option value="' . $val . '"' . selected( $value, $val, false ) . '>' . $key . '</option>' . "\n"; 161 } 162 $output .= '</select>' . "\n"; 163 if ( $desc ) 164 $output .= $desc . "\n"; 165 166 echo $output; 77 167 } 78 168 79 169 public function add_custom_whitelist_options_fields() { 80 register_setting( $this->menu_slug, 'ichigen_san_enabling' ); 81 } 82 83 public function admin_styles() { 84 wp_enqueue_style( 'admin_ichigen_san_style', $this->plugin_url . '/css/admin-style.css' ); 85 } 86 87 public function redirect_ichigen_san() { 88 if ( !is_user_logged_in() && get_option( 'ichigen_san_enabling' ) ) { 170 register_setting( $this->plugin_basename , 'ichigen_san_enabling', 'intval' ); 171 register_setting( $this->plugin_basename , 'ichigen_san_basic_user', 'esc_attr' ); 172 register_setting( $this->plugin_basename , 'ichigen_san_basic_pass', array( &$this, 'register_setting_basic_pass_check' ) ); 173 register_setting( $this->plugin_basename , 'ichigen-san-convert', array( &$this, 'register_setting_convert' ) ); 174 register_setting( $this->plugin_basename , 'ichigen-san-initialization', array( &$this, 'register_setting_initialization' ) ); 175 } 176 177 public function register_setting_basic_pass_check( $value ) { 178 if ( empty( $value ) && ! empty( $this->basic_pass ) ) { 179 $value = $this->basic_pass; 180 } else { 181 $value = wp_hash_password( $value ); 182 } 183 184 return $value; 185 } 186 187 public function register_setting_initialization( $value ) { 188 if ( __( 'Initialization', $this->domain ) != $value ) 189 return $value; 190 191 delete_option( 'ichigen_san_enabling' ); 192 delete_option( 'ichigen_san_basic_user' ); 193 delete_option( 'ichigen_san_basic_pass' ); 194 return $value; 195 } 196 197 public function template_redirect() { 198 if ( !is_user_logged_in() && $this->enabling == 1 ) { 89 199 auth_redirect(); 200 } elseif ( !is_user_logged_in() && $this->enabling == 2 ) { 201 nocache_headers(); 202 // Check the BASIC authentication user and password 203 $user = isset($_SERVER["PHP_AUTH_USER"]) ? $_SERVER["PHP_AUTH_USER"] : ''; 204 $pwd = isset($_SERVER["PHP_AUTH_PW"]) ? $_SERVER["PHP_AUTH_PW"] : ''; 205 if ( $this->basic_user && $this->basic_pass ) { 206 if ( $user == $this->basic_user && wp_check_password( $pwd, $this->basic_pass ) ) { 207 return; 208 } 209 } 210 // Check the user/password for WordPress 211 if ( !is_wp_error(wp_authenticate($user, $pwd)) ) { 212 return; 213 } 214 215 // BASIC authentication is required 216 header('WWW-Authenticate: Basic realm="Please Enter Your Password"'); 217 header('HTTP/1.0 401 Unauthorized'); 218 echo 'Authorization Required'; 219 die(); 220 } else { 221 return; 90 222 } 91 223 } 92 93 224 } 225 new IchigenSan(); -
ichigen-san/trunk/languages/ichigen-san-ja.po
r607358 r978380 1 # Copyright (C) 2014 Ichigen San 2 # This file is distributed under the same license as the Ichigen San package. 1 3 msgid "" 2 4 msgstr "" 3 "Project-Id-Version: Ichigen San\n" 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: 2012-09-11 19:29+0900\n" 6 "PO-Revision-Date: 2012-09-11 19:29+0900\n" 7 "Last-Translator: Webnist <webnist@webnist.org>\n" 8 "Language-Team: Webnist <webnist@webnist.org>\n" 5 "Project-Id-Version: Ichigen San 0.3\n" 6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/ichigen-san\n" 7 "POT-Creation-Date: 2014-09-04 04:23:43+00:00\n" 9 8 "MIME-Version: 1.0\n" 10 9 "Content-Type: text/plain; charset=UTF-8\n" 11 10 "Content-Transfer-Encoding: 8bit\n" 12 "X-Poedit-KeywordsList: __;_e\n" 13 "X-Poedit-Basepath: ../\n" 11 "PO-Revision-Date: 2014-09-04 13:26+0900\n" 12 "Last-Translator: Webnist <webnist@webnist.org>\n" 13 "Language-Team: LANGUAGE <LL@li.org>\n" 14 "X-Generator: Poedit 1.6.3\n" 14 15 "Plural-Forms: nplurals=1; plural=0;\n" 15 "X-Poedit-SourceCharset: UTF-8\n" 16 "X-Poedit-SearchPath-0: .\n" 16 "Language: ja\n" 17 17 18 #: ichigen-san.php: 48 ichigen-san.php:5218 #: ichigen-san.php:55 ichigen-san.php:59 19 19 msgid "Set Ichigen San" 20 20 msgstr "一見さん設定" 21 21 22 #: ichigen-san.php:68 22 #: ichigen-san.php:67 23 msgid "Setting initialization" 24 msgstr "設定の初期化" 25 26 #: ichigen-san.php:68 ichigen-san.php:188 27 msgid "Initialization" 28 msgstr "初期化" 29 30 #: ichigen-san.php:78 31 msgid "General" 32 msgstr "一般設定" 33 34 #: ichigen-san.php:84 23 35 msgid "Enabling Ichogen San" 24 msgstr "一見さん を有効化する"36 msgstr "一見さんの有効設定" 25 37 26 #: ichigen-san.php:75 27 msgid "Enabling" 28 msgstr "有効化" 38 #: ichigen-san.php:92 39 msgid "Disabled" 40 msgstr "" 41 42 #: ichigen-san.php:93 43 msgid "Login screen" 44 msgstr "" 45 46 #: ichigen-san.php:94 47 msgid "Basic authentication" 48 msgstr "" 49 50 #: ichigen-san.php:100 51 msgid "Basic User" 52 msgstr "" 53 54 #: ichigen-san.php:111 55 msgid "Basic Password" 56 msgstr "" 57 58 #. Plugin Name of the plugin/theme 59 msgid "Ichigen San" 60 msgstr "" 61 62 #. Plugin URI of the plugin/theme 63 msgid "http://wordpress.org/plugins/ichigen-san/" 64 msgstr "http://wordpress.org/plugins/ichigen-san/" 65 66 #. Description of the plugin/theme 67 msgid "" 68 "Because you can not be viewed unless you log When you activate this plug-in, " 69 "You can start a private blog. Furthermore, you can also be used for " 70 "communication between the acquaintance." 71 msgstr "" 72 "このプラグインを有効化するとログインしなければ閲覧することが出来ないため、プ" 73 "ライベートなブログを開始できます。また、知り合い同士のコミュニケーションの為" 74 "に使用することもできます。" 75 76 #. Author of the plugin/theme 77 msgid "Webnist" 78 msgstr "Webnist" 79 80 #. Author URI of the plugin/theme 81 msgid "http://profiles.wordpress.org/webnist" 82 msgstr "http://profiles.wordpress.org/webnist" -
ichigen-san/trunk/readme-ja.txt
r603714 r978380 1 === Plugin Name===1 === Ichigen San === 2 2 Contributors: Webnist, megumithemes 3 Donate link: 3 Donate link: 4 4 Tags: Private, Maintenance 5 5 Requires at least: 3.4 6 Tested up to: 3.4 7 Stable tag: 0.1 6 Tested up to: 3.9.2 7 Stable tag: 0.3 8 License: GPLv2 or later 8 9 9 プラーベート用 やメンテナンス用10 プラーベート用 10 11 11 12 == Description == … … 17 18 このプラグインを使用すれば煩わしい、BASIC認証ともさよならできます。 18 19 20 ごめんなさい、今回のバージョンで BASIC認証をサポートしました。 21 19 22 プラグインの由来について。 20 23 日本には”Ichigen-San Okotowari”という文化があります。 … … 25 28 2. プラグインメニューより有効化。 26 29 30 == Upgrade Notice == 31 BASIC認証を選択できるようになりました。 32 33 == Changelog == 34 35 = 0.3 = 36 * BASIC認証を選択できるようになりました。 37 * オプションページを、設定の中に移動 38 39 = 0.1 = 40 * 最初のバージョン -
ichigen-san/trunk/readme.txt
r603714 r978380 1 === Plugin Name===1 === Ichigen San === 2 2 Contributors: Webnist, megumithemes 3 Donate link: 3 Donate link: 4 4 Tags: Private, Maintenance 5 5 Requires at least: 3.4 6 Tested up to: 3.4 7 Stable tag: 0.1 6 Tested up to: 3.9.2 7 Stable tag: 0.3 8 License: GPLv2 or later 8 9 9 Private publishing and maintenance10 Private publishing 10 11 11 12 == Description == … … 17 18 Troublesome if you use this plugin, you can also authenticate goodbye BASIC. 18 19 20 Sorry, this version was support BASIC authentication. 21 19 22 About the origin of the plug-in. 20 23 There is a culture of "Ichigen-San Okotowari" in Japan. … … 22 25 23 26 == Installation == 24 1. Upload the entire `ichigen-san` folder to the `/wp-content/plugins/` directory. 25 2. Activate the plugin through the 'Plugins' menu in WordPress. 27 A plug-in installation screen is displayed on the WordPress admin panel. 28 It installs it in `wp-content/plugins`. 29 The plug-in is made effective. 30 Open \'Settings\' -> \'Set Ichigen San\' menu. 26 31 32 == Upgrade Notice == 33 Adding basic authentication. 34 35 == Changelog == 36 37 = 0.3 = 38 * Adding basic authentication. 39 * Go to Settings menu options page 40 41 = 0.1 = 42 * First version
Note: See TracChangeset
for help on using the changeset viewer.