Changeset 1217917
- Timestamp:
- 08/11/2015 06:49:40 AM (11 years ago)
- Location:
- min-calendar/trunk/admin
- Files:
-
- 5 edited
-
class-admin-controller.php (modified) (9 diffs)
-
class-appearance.php (modified) (1 diff)
-
class-manage-form-action.php (modified) (5 diffs)
-
class-post-form.php (modified) (1 diff)
-
class-validation.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
min-calendar/trunk/admin/class-admin-controller.php
r1217818 r1217917 7 7 * @property MC_Post_Form $post_form 8 8 * @property MC_Appearance $appearance 9 * @property MC_ Admin_Action $action9 * @property MC_Manage_Form_Action $action 10 10 */ 11 11 class MC_Admin_Controller 12 12 { 13 13 14 /** @var MC_ Admin_Action */14 /** @var MC_Manage_Form_Action */ 15 15 public $action; 16 16 /** @var MC_Post_Form */ … … 25 25 { 26 26 $this->porst_form = new MC_Post_Form(); 27 $this->action = new MC_ Admin_Action();27 $this->action = new MC_Manage_Form_Action(); 28 28 $this->appearance = new MC_Appearance(); 29 29 } 30 30 31 31 /** 32 * 管理画面 処理32 * 管理画面作成 33 33 */ 34 34 public function setup() { … … 38 38 39 39 /** 40 * 管理画面へMin Calendarページ追加40 * Min Calendar関連ページ作成 41 41 */ 42 42 public function admin_menu() 43 43 { 44 44 if ( current_user_can( 'edit' ) ) { 45 // メニュー追加 45 46 add_object_page( 46 47 'Min Calendar', … … 50 51 array( $this, 'admin_management_page' ) 51 52 ); 52 53 // カスタム投稿タイプmincalendarの一覧 54 $post_list = add_submenu_page( 53 // 一覧ページ追加 54 $list_page = add_submenu_page( 55 55 'mincalendar', 56 56 __( 'Edit Calendar', 'mincalendar' ), … … 60 60 array( $this, 'admin_management_page' ) 61 61 ); 62 63 // MC_Admin_Action->manage_postをコールバックに設定 64 add_action( 'load-' . $post_list, array( $this->action, 'manage_post' ) ); 65 66 // カレンダーオプション設定画面 62 // MC_Manage_Form_Action->manage_postをコールバックに設定 63 add_action( 'load-' . $list_page, array( $this->action, 'manage_post' ) ); 64 // 外観ページ(カレンダーオプション) 67 65 add_submenu_page( 68 66 'mincalendar', … … 73 71 array( $this->appearance, 'admin_appearance_page' ) 74 72 ); 75 76 } 77 } 78 79 80 /** 81 * Min Calendarページ呼び出し 73 } 74 } 75 76 /** 77 * Min Calendarページ管理 82 78 * 83 * 投稿の編集は編集画面表示しそれ他は投稿リストを表示する。79 * 既存の投稿は編集画面表示しその他はリストを表示します。 84 80 */ 85 81 public function admin_management_page() 86 82 { 87 83 $post_wrapper = $this->action->get_post_wrapper(); 88 89 // 編集処理90 84 if ( $post_wrapper ) { 91 $post_form = new MC_Post_Form(); 92 $html = $post_form->get_form( $post_wrapper ); 93 MC_Custom_Field::set_field( $post_wrapper, $html ); 94 // $this->add_meta_boxes(); 95 // do_meta_boxes( 'mincalendar', 'normal', array( $post_wrapper, $html ) ); 96 // get_htmlはエスケープ済みマークアップを返す 97 echo $post_wrapper->get_html(); 98 return; 99 } 100 101 // リスト表示 85 // 編集画面 86 echo $this->get_edit_page($post_wrapper); 87 } else { 88 // 一覧画面 89 echo $this->get_list_page(); 90 } 91 } 92 93 /** 94 * 編集画面マークアップ取得 95 * 96 * @return string マークアップ 97 */ 98 public function get_edit_page($post_wrapper) { 99 $post_form = new MC_Post_Form(); 100 $html = $post_form->get_form( $post_wrapper ); 101 MC_Custom_Field::set_field( $post_wrapper, $html ); 102 // get_htmlはエスケープ済みマークアップを返す 103 return $post_wrapper->get_html(); 104 } 105 106 /** 107 * 一覧画面マークアップ取得 108 * 109 * @return string マークアップ 110 */ 111 public function get_list_page() { 102 112 $this->list_table = new MC_List_Table(); 103 113 $this->list_table->prepare_items(); … … 126 136 ob_clean(); 127 137 128 $html .= '</form>' . PHP_EOL 129 . '</div>'; 130 131 echo $html; 132 } 133 138 $html .= '</form>' . PHP_EOL . '</div>'; 139 140 return $html; 141 } 134 142 135 143 /** … … 184 192 true 185 193 ); 186 187 194 } 188 195 … … 198 205 'mincalendar_meta_box_id', 199 206 __( 'Min Calendar Meta Box', 'mincalendar' ), 200 array( $this, 'set_field' ), 207 array( $this, 'set_field' ), // カスタムフィールド追加 201 208 'mincalendar', 202 209 'normal' -
min-calendar/trunk/admin/class-appearance.php
r1217818 r1217917 306 306 } 307 307 308 309 308 /* 310 309 * 設定値取得 311 310 */ 312 311 $this->options = (array ) json_decode( get_option( 'mincalendar-options' ) ); 313 314 312 315 313 /* -
min-calendar/trunk/admin/class-manage-form-action.php
r1217906 r1217917 1 1 <?php 2 2 3 /** 3 4 * MC_Manage_Form_Action … … 28 29 /** 29 30 * 管理画面でMin Calendar Postページ表示処理 30 * 31 * 31 32 * wp-admin/admin.php?page=mincalendar&postid=1745&action=edit 32 33 * 33 34 * Min Calendar Postページ表示処理順序 34 * 35 * 35 36 * 1. 当メソッド(manage_post) 36 37 * 2. MC_Admin_Controller->admin_management_page … … 40 41 public function manage_post() 41 42 { 42 $action = MC_Admin_Utility::get_current_action(); 43 $action = false; 44 if ( isset( $_REQUEST['action'] ) && - 1 != $_REQUEST['action'] ) { 45 $action = $_REQUEST['action']; 46 } 43 47 // save 44 48 if ( 'save' === $action ) { … … 53 57 $this->delete(); 54 58 } 55 $post_id = isset( $_GET['postid'] ) ? (int) $_GET['postid'] : '';59 $post_id = isset( $_GET['postid'] ) ? (int) $_GET['postid'] : ''; 56 60 $post_wrapper = null; 57 61 … … 191 195 $deleted += 1; 192 196 } 193 $query = array();197 $query = array(); 194 198 $redirect_to = add_query_arg( $query, menu_page_url( 'mincalendar', false ) ); 195 199 wp_safe_redirect( $redirect_to ); -
min-calendar/trunk/admin/class-post-form.php
r1217818 r1217917 16 16 return $this->form( $post_wrapper ); 17 17 } 18 19 18 20 19 /** -
min-calendar/trunk/admin/class-validation.php
r1217818 r1217917 1 1 <?php 2 3 2 class MC_Validation 4 3 { 5 6 4 /** 7 5 * カラー表記が16進数かをチェック … … 29 27 } 30 28 31 32 29 /** 33 30 * サイズ指定が数字または数字+(px|em|%)の形かチェック … … 43 40 return false; 44 41 } 45 46 42 47 43 /** … … 59 55 } 60 56 61 62 57 /** 63 58 * 配置指定チェック … … 73 68 return false; 74 69 } 75 76 70 }
Note: See TracChangeset
for help on using the changeset viewer.