false, 'base_dir' => 'pages/', ); } /** * Start up */ public function __construct() { AddPageFromTemplate::loadTextDomain(); add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); add_action( 'admin_init', array( $this, 'page_init' ) ); } /** * getter的ななにか * @param $varname * @return null */ static public function get_($varname) { $options = get_option( self::APFT_OPTION_NAME ); if (isset($options[$varname])) { return $options[$varname]; } else { $defaults = self::getDefaults(); return $defaults[$varname]; } } /** * Add options page */ public function add_plugin_page() { // This page will be under "Settings" add_options_page( 'Settings Admin', 'Add Page From Template', 'manage_options', 'apft-setting-admin', array( $this, 'create_admin_page' ) ); } /** * Options page callback */ public function create_admin_page() { // Set class property $this->options = get_option( self::APFT_OPTION_NAME ); ?>
'; printf( '', $checked ); _e("Aggressive means 'Do flush_rewrite when load a page.'", 'apft'); echo '
'; } /** * ベースディレクトリの設定部分 */ public function base_dir_callback() { if (isset( $this->options['base_dir'] )) { $base_dir = esc_attr( $this->options['base_dir']); } else { $base_dir = 'pages/'; } printf( '', $base_dir ); _e('Specify Base Directory. The paged template files should be located at the base directory. (Default: pages/)', 'apft'); } /** * Returns page slug. * * @see _get_page_link() */ private function getPageLink($slug){ global $wp_rewrite; $link = $wp_rewrite->get_page_permastruct(); $link = str_replace('%pagename%', $slug, $link); $link = home_url($link); $link = user_trailingslashit($link, 'page'); return apply_filters( '_get_page_link', $link, 0 ); } /** * テンプレートファイル一覧の設定部分 */ public function template_files_callback() { $templates = AP_TemplateSearcher::getTemplates(); ?>| slug; ?> | status), 'apft'); ?> | path)); $themeName = basename(get_stylesheet_directory()); $editUrl = home_url('/wp-admin/theme-editor.php?file='.$filepath.'&theme='.$themeName); ?>| |