コード例 #1
0
 static function add_field()
 {
     echo '<fieldset><p>';
     // Add check box for enabling
     BsaUtil::add_checkbox(self::OPTION_NAME);
     // Add description
     echo '</p><p>' . __('Please input token from Baidu Zhanzhang:', 'bjh-site-assistant');
     // Add text field, name OPTIONS_GROUP[OPTION_TOKEN] will let form submit to save to the right option
     $txtfield = '</p><p><input type="text" class="large-text" id="%s" name="%s[%s]" value="%s" %s>' . '</p></fieldset><br />';
     echo sprintf($txtfield, self::OPTION_TOKEN, BsaConst::OPTIONS_GROUP, self::OPTION_TOKEN, BsaUtil::get_value(self::OPTION_TOKEN, ''), BsaUtil::is_enabled(self::OPTION_NAME) ? '' : 'readonly');
     // echo '</p><p><input type="text" class="large-text" id="' . self::OPTION_TOKEN . '" '
     //    . (BsaUtil::is_enabled(self::OPTION_NAME) ? '' : 'disabled')
     //    . ' name="' . BsaConst::OPTIONS_GROUP . '[' . self::OPTION_TOKEN . ']" value="'
     //    . BsaUtil::get_value(self::OPTION_TOKEN, '')
     //    . '"></p></fieldset><br />';
     BsaUtil::control_field(self::OPTION_NAME, self::OPTION_TOKEN);
 }
コード例 #2
0
 static function add_field()
 {
     echo '<fieldset><p>';
     // Add check box for enabling
     BsaUtil::add_checkbox(self::OPTION_NAME);
     // Add description
     echo '</p><p>' . __('Please input the content to be displayed as copyright at the end of articles. ' . '%link% is reserved as the link of the article.', 'bjh-site-assistant');
     // Add text area, name OPTIONS_GROUP[OPTION_INFO] will let form submit to save to the right option
     // Enable to input the copyright info only if the option is checked
     $txtArea = '</p><p><textarea class="large-text" id="%s" name="%s[%s]" %s rows="3">%s</textarea>' . '</p></fieldset><br />';
     echo sprintf($txtArea, self::OPTION_INFO, BsaConst::OPTIONS_GROUP, self::OPTION_INFO, BsaUtil::is_enabled(self::OPTION_NAME) ? '' : 'readonly', BsaUtil::get_value(self::OPTION_INFO, ''));
     // echo '</p><p><textarea class="large-text" id="'. self::OPTION_INFO . '" '
     //    . (BsaUtil::is_enabled(self::OPTION_NAME) ? '' : 'disabled')
     //    . ' name="' . BsaConst::OPTIONS_GROUP . '[' . self::OPTION_INFO . ']" rows="3">'
     //    . BsaUtil::get_value(self::OPTION_INFO, '')
     //    . '</textarea></p></fieldset><br />';
     BsaUtil::control_field(self::OPTION_NAME, self::OPTION_INFO);
 }