本文整理汇总了PHP中XoopsLists::getImgListAsArray方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsLists::getImgListAsArray方法的具体用法?PHP XoopsLists::getImgListAsArray怎么用?PHP XoopsLists::getImgListAsArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsLists
的用法示例。
在下文中一共展示了XoopsLists::getImgListAsArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_bookmark
/**
* @desc Muestra el formulario para agregar un nuevo sitio
*/
function edit_bookmark()
{
global $xoopsModule, $xoopsConfig, $xoopsSecurity, $rmTpl;
$id = rmc_server_var($_GET, 'id', 0);
if ($id <= 0) {
redirectMsg('bookmarks.php', __('Site ID not provided!', 'mywords'), 1);
die;
}
$book = new MWBookmark($id);
if ($book->isNew()) {
redirectMsg('bookmarks.php', __('Social site not exists!', 'mywords'), 1);
die;
}
$temp = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/mywords/images/icons');
foreach ($temp as $icon) {
$icons[] = array('url' => XOOPS_URL . "/modules/mywords/images/icons/{$icon}", 'name' => $icon);
}
MWFunctions::include_required_files();
RMBreadCrumb::get()->add_crumb(__('Social Sites', 'mywords'), 'bookmarks.php');
RMBreadCrumb::get()->add_crumb(__('Edit Site', 'mywords'));
xoops_cp_header();
$show_edit = true;
include $rmTpl->get_template('admin/mywords_bookmarks.php', 'module', 'mywords');
$rmTpl->assign('xoops_pagetitle', __('Edit Social Site', 'mywords'));
$rmTpl->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
$rmTpl->add_script('../include/js/scripts.php?file=bookmarks.js');
xoops_cp_footer();
}
示例2: __construct
/**
* @param null $obj
*/
public function __construct($obj = null)
{
$xoops = Xoops::getInstance();
parent::__construct('', 'xlanguage_form', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
// language name
$xlanguage_select = new Xoops\Form\Select(_AM_XLANGUAGE_NAME, 'xlanguage_name', $obj->getVar('xlanguage_name'));
$xlanguage_select->addOptionArray(XoopsLists::getLocaleList());
$this->addElement($xlanguage_select, true);
// language description
$this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_DESCRIPTION, 'xlanguage_description', 5, 30, $obj->getVar('xlanguage_description')), true);
// language charset
$autoload = XoopsLoad::loadConfig('xlanguage');
$charset_select = new Xoops\Form\Select(_AM_XLANGUAGE_CHARSET, 'xlanguage_charset', $obj->getVar('xlanguage_charset'));
$charset_select->addOptionArray($autoload['charset']);
$this->addElement($charset_select);
// language code
$this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_CODE, 'xlanguage_code', 5, 10, $obj->getVar('xlanguage_code')), true);
// language weight
$this->addElement(new Xoops\Form\Text(_AM_XLANGUAGE_WEIGHT, 'xlanguage_weight', 1, 4, $obj->getVar('xlanguage_weight')));
// language image
$image_option_tray = new Xoops\Form\ElementTray(_AM_XLANGUAGE_IMAGE, '');
$image_array = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('root-path') . '/media/xoops/images/flags/' . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . '/');
$image_select = new Xoops\Form\Select('', 'xlanguage_image', $obj->getVar('xlanguage_image'));
$image_select->addOptionArray($image_array);
$image_select->setExtra("onchange='showImgSelected(\"image\", \"xlanguage_image\", \"/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
$image_tray = new Xoops\Form\ElementTray('', ' ');
$image_tray->addElement($image_select);
$image_tray->addElement(new Xoops\Form\Label('', "<div style='padding: 8px;'><img style='width:24px; height:24px; ' src='" . \XoopsBaseConfig::get('url') . "/media/xoops/images/flags/" . \Xoops\Module\Helper::getHelper('xlanguage')->getConfig('theme') . "/" . $obj->getVar("xlanguage_image") . "' name='image' id='image' alt='' /></div>"));
$image_option_tray->addElement($image_tray);
$this->addElement($image_option_tray);
$this->addElement(new Xoops\Form\Hidden('xlanguage_id', $obj->getVar('xlanguage_id')));
/**
* Buttons
*/
$button_tray = new Xoops\Form\ElementTray('', '');
$button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
$button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$button->setClass('btn btn-success');
$button_tray->addElement($button);
$button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
$button_2->setClass('btn btn-warning');
$button_tray->addElement($button_2);
switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
case 'xoops_xlanguage':
$button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
$button_3->setExtra('onclick="tinyMCEPopup.close();"');
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
break;
case 'index':
default:
$button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
$button_3->setExtra("onclick='javascript:history.go(-1);'");
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
break;
}
$this->addElement($button_tray);
}
示例3: __construct
/**
* @param BannersBanner|XoopsObject $obj
*/
public function __construct(BannersBanner &$obj)
{
$xoops = Xoops::getInstance();
$helper = Banners::getInstance();
if ($obj->isNew()) {
$blank_img = 'blank.gif';
$html_banner = 0;
} else {
if (substr_count($obj->getVar('banner_imageurl'), $xoops_upload_url . '/banners/') == 0) {
$blank_img = 'blank.gif';
} else {
$namefile = substr_replace($obj->getVar('banner_imageurl'), '', 0, strlen($xoops_upload_url . '/banners/'));
$pathfile = $xoops_root_path . '/uploads/banners/' . $namefile;
if (is_file($pathfile)) {
$blank_img = str_replace($xoops_upload_url . '/banners/', '', $obj->getVar('banner_imageurl', 'e'));
} else {
$blank_img = 'blank.gif';
}
}
$html_banner = $obj->getVar('banner_htmlbanner');
}
$title = $obj->isNew() ? sprintf(_AM_BANNERS_BANNERS_ADD) : sprintf(_AM_BANNERS_BANNERS_EDIT);
parent::__construct($title, 'form', 'banners.php', 'post', true);
$this->setExtra('enctype="multipart/form-data"');
$client_Handler = $helper->getHandlerBannerclient();
$client_select = new Xoops\Form\Select(_AM_BANNERS_CLIENTS_NAME, 'cid', $obj->getVar('banner_cid'));
$client_select->addOptionArray($client_Handler->getList());
$this->addElement($client_select, true);
$imptotal = new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMPRESSIONSP, 'imptotal', 1, 255, $obj->getVar('banner_imptotal'));
//$imptotal->setPattern('^[0-9]*[0-9]+$|^[0-9]+[0-9]*$', _AM_BANNERS_BANNERS_IMPRESSIONSP_PATTERN);
$this->addElement($imptotal, true);
$imgtray_img = new Xoops\Form\ElementTray(_AM_BANNERS_BANNERS_IMAGE, '<br /><br />');
$imgtray_img->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_IMGURL, 'imageurl', 8, 255, $obj->getVar('banner_imageurl')));
$imgpath_img = sprintf(_AM_BANNERS_BANNERS_IMAGE_PATH, $xoops_upload_path . '/banners/');
$imageselect_img = new Xoops\Form\Select($imgpath_img, 'banners_imageurl', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray($xoops_upload_path . '/banners');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra('onchange="showImgSelected(\'xo-banners-img\', \'banners_imageurl\', \'banners\', \'\', \'' . $xoops_upload_url . '\' )"');
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/banners/" . $blank_img . "' name='image_img' id='xo-banners-img' alt='' />"));
$fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new Xoops\Form\File(_AM_BANNERS_BANNERS_UPLOADS, 'banners_imageurl'), false);
$fileseltray_img->addElement(new Xoops\Form\Label(''), false);
$imgtray_img->addElement($fileseltray_img);
$this->addElement($imgtray_img);
$this->addElement(new Xoops\Form\Text(_AM_BANNERS_BANNERS_CLICKURL, 'clickurl', 5, 255, $obj->getVar('banner_clickurl')), false);
$this->addElement(new Xoops\Form\RadioYesNo(_AM_BANNERS_BANNERS_USEHTML, 'htmlbanner', $html_banner));
$this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_BANNERS_CODEHTML, 'htmlcode', $obj->getVar('banner_htmlcode'), 5, 5), false);
if (!$obj->isNew()) {
$this->addElement(new Xoops\Form\Hidden('bid', $obj->getVar('banner_bid')));
}
$this->addElement(new Xoops\Form\Hidden('op', 'save'));
$this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
}
示例4: __construct
/**
* @param SmiliesSmiley|XoopsObject $obj
*/
public function __construct(SmiliesSmiley $obj)
{
$xoops = Xoops::getInstance();
if ($obj->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('smilies/', '', $obj->getVar('smiley_url', 'e'));
}
$title = $obj->isNew() ? sprintf(_AM_SMILIES_ADD) : sprintf(_AM_SMILIES_EDIT);
parent::__construct($title, 'form', $xoops->getEnv('PHP_SELF'), 'post', true);
$this->setExtra('enctype="multipart/form-data"');
$this->addElement(new Xoops\Form\Text(_AM_SMILIES_CODE, 'smiley_code', 2, 25, $obj->getVar('smiley_code')), true);
$this->addElement(new Xoops\Form\Text(_AM_SMILIES_DESCRIPTION, 'smiley_emotion', 4, 50, $obj->getVar('smiley_emotion')), true);
$imgtray_img = new Xoops\Form\ElementTray(_AM_SMILIES_FILE, '<br />');
$imgpath_img = sprintf(_AM_SMILIES_IMAGE_PATH, \XoopsBaseConfig::get('uploads-url') . '/smilies/');
$imageselect_img = new Xoops\Form\Select($imgpath_img, 'smiley_url', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-url') . '/smilies');
$imageselect_img->addOptionArray($image_array_img);
$imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smiley_url\', \'smilies\', \'\', \'' . \XoopsBaseConfig::get('uploads-url') . '\' )"');
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt=''>"));
$fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new Xoops\Form\File(_AM_SMILIES_UPLOADS, 'smiley_url'), false);
$fileseltray_img->addElement(new Xoops\Form\Label(''), false);
$imgtray_img->addElement($fileseltray_img);
$this->addElement($imgtray_img);
$this->addElement(new Xoops\Form\RadioYesNo(_AM_SMILIES_OFF, 'smiley_display', $obj->getVar('smiley_display')));
$this->addElement(new Xoops\Form\Hidden('smiley_id', $obj->getVar('smiley_id')));
/**
* Buttons
*/
$button_tray = new Xoops\Form\ElementTray('', '');
$button_tray->addElement(new Xoops\Form\Hidden('op', 'save'));
$button = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
$button->setClass('btn btn-success');
$button_tray->addElement($button);
$button_2 = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
$button_2->setClass('btn btn-warning');
$button_tray->addElement($button_2);
switch (basename($xoops->getEnv('PHP_SELF'), '.php')) {
case 'xoops_smilies':
$button_3 = new Xoops\Form\Button('', 'button', XoopsLocale::A_CLOSE, 'button');
$button_3->setExtra('onclick="tinyMCEPopup.close();"');
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
break;
case 'smilies':
default:
$button_3 = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
$button_3->setExtra("onclick='javascript:history.go(-1);'");
$button_3->setClass('btn btn-danger');
$button_tray->addElement($button_3);
break;
}
$this->addElement($button_tray);
}
示例5: getForm
/**
* @param bool $action
* @return XoopsThemeForm
*/
public function getForm($action = false)
{
global $xoopsDB, $xoopsModuleConfig;
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_PRESENTER_CAT_ADD) : sprintf(_AM_PRESENTER_CAT_EDIT);
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Cat_pid
include_once XOOPS_ROOT_PATH . '/class/tree.php';
$categoriesHandler =& xoops_getModuleHandler('categories', 'presenter');
$criteria = new CriteriaCompo();
$categories = $categoriesHandler->getObjects($criteria);
if ($categories) {
$categories_tree = new XoopsObjectTree($categories, 'cat_id', 'cat_pid');
$cat_pid = $categories_tree->makeSelBox('cat_pid', 'cat_title', '--', $this->getVar('cat_pid', 'e'), false);
$form->addElement(new XoopsFormLabel(_AM_PRESENTER_CAT_PID, $cat_pid));
}
// Cat_title
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_TITLE, 'cat_title', 50, 255, $this->getVar('cat_title')), true);
// Cat_desc
$form->addElement(new XoopsFormTextArea(_AM_PRESENTER_CAT_DESC, 'cat_desc', $this->getVar('cat_desc'), 4, 47), true);
// Cat_image
$cat_image = $this->getVar('cat_image') ? $this->getVar('cat_image') : 'blank.gif';
$uploadir = '/uploads/presenter/images/categories';
$imgtray = new XoopsFormElementTray(_AM_PRESENTER_CAT_IMAGE, '<br />');
$imgpath = sprintf(_AM_PRESENTER_FORMIMAGE_PATH, $uploadir);
$imageselect = new XoopsFormSelect($imgpath, 'cat_image', $cat_image);
$image_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $uploadir);
foreach ($image_array as $image) {
$imageselect->addOption("{$image}", $image);
}
$imageselect->setExtra("onchange='showImgSelected(\"image_cat_image\", \"cat_image\", \"" . $uploadir . "\", \"\", \"" . XOOPS_URL . "\")'");
$imgtray->addElement($imageselect);
$imgtray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . "/" . $uploadir . "/" . $cat_image . "' name='image_cat_image' id='image_cat_image' alt='' />"));
$fileseltray = new XoopsFormElementTray('', '<br />');
$fileseltray->addElement(new XoopsFormFile(_AM_PRESENTER_FORMUPLOAD, 'cat_image', $xoopsModuleConfig['maxsize']));
$fileseltray->addElement(new XoopsFormLabel(''));
$imgtray->addElement($fileseltray);
$form->addElement($imgtray);
// Cat_weight
$form->addElement(new XoopsFormText(_AM_PRESENTER_CAT_WEIGHT, 'cat_weight', 50, 255, $this->getVar('cat_weight')), false);
// Cat_color
// $form->addElement(new XoopsFormColorPicker(_AM_PRESENTER_CAT_COLOR, 'cat_color', $this->getVar('cat_color')), false);
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例6: editCategory
/**
* editCategory()
*
* @param integer $catid
* @return
*/
function editCategory($category_obj = null)
{
global $xoopsModule;
$category_handler =& xoops_getmodulehandler('category', 'newbb');
if (empty($category_obj)) {
$category_obj =& $category_handler->create();
}
$groups_cat_access = null;
include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/class/xoopsformloader.php";
if (!$category_obj->isNew()) {
$sform = new XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . " " . $category_obj->getVar('cat_title'), "op", xoops_getenv('PHP_SELF'));
} else {
$sform = new XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, "op", xoops_getenv('PHP_SELF'));
$category_obj->setVar('cat_title', '');
$category_obj->setVar('cat_image', '');
$category_obj->setVar('cat_description', '');
$category_obj->setVar('cat_order', 0);
$category_obj->setVar('cat_url', 'http://www.myxoops.org myXOOPS Support');
}
$sform->addElement(new XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $category_obj->getVar('cat_order')), false);
$sform->addElement(new XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $category_obj->getVar('cat_title', 'E')), true);
$sform->addElement(new XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $category_obj->getVar('cat_description', 'E'), 10, 60), false);
$imgdir = "/modules/" . $xoopsModule->getVar("dirname") . "/images/category";
$cat_image = $category_obj->getVar("cat_image");
$cat_image = empty($cat_image) ? 'blank.gif' : $cat_image;
$graph_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . "/");
array_unshift($graph_array, _NONE);
$cat_image_select = new XoopsFormSelect('', 'cat_image', $category_obj->getVar('cat_image'));
$cat_image_select->addOptionArray($graph_array);
$cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\"");
$cat_image_tray = new XoopsFormElementTray(_AM_NEWBB_IMAGE, ' ');
$cat_image_tray->addElement($cat_image_select);
$cat_image_tray->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_URL . $imgdir . "/" . $cat_image . " 'name='img' id='img' alt='' />"));
$sform->addElement($cat_image_tray);
$sform->addElement(new XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $category_obj->getVar('cat_url', 'E')), false);
$sform->addElement(new XoopsFormHidden('cat_id', $category_obj->getVar("cat_id")));
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormHidden('op', 'save'));
$butt_save = new XoopsFormButton('', '', _SUBMIT, 'submit');
$butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"');
$button_tray->addElement($butt_save);
if ($category_obj->getVar("cat_id")) {
$butt_delete = new XoopsFormButton('', '', _CANCEL, 'submit');
$butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"');
$button_tray->addElement($butt_delete);
}
$sform->addElement($button_tray);
$sform->display();
}
示例7: getForm
/**
* @return XoopsThemeForm
*/
function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
}
// Get User Config
$config_handler =& xoops_gethandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
// New and edit form
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true);
$form->setExtra('enctype="multipart/form-data"');
// Name
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
// Name description
$maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
// Upload part
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br />');
$imgtray_img->setDescription($maxpixel . $maxsize);
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
// Weight
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
// Display
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
// Hidden
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('avatar_type', 's'));
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
// Button
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例8: __construct
/**
* @param UserrankRank|XoopsObject $obj
*/
public function __construct(XoopsObject $obj)
{
if ($obj->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('ranks/', '', $obj->getVar('rank_image', 'e'));
}
$title = $obj->isNew() ? sprintf(_AM_USERRANK_ADD) : sprintf(_AM_USERRANK_EDIT);
parent::__construct($title, 'form', 'userrank.php', 'post', true);
$this->setExtra('enctype="multipart/form-data"');
$this->addElement(new Xoops\Form\Text(_AM_USERRANK_TITLE, 'rank_title', 4, 50, $obj->getVar('rank_title')), true);
$min = new Xoops\Form\Text(_AM_USERRANK_MINPOST, 'rank_min', 1, 10, $obj->getVar('rank_min'));
$min->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST);
$this->addElement($min);
$max = new Xoops\Form\Text(_AM_USERRANK_MAXPOST, 'rank_max', 1, 10, $obj->getVar('rank_max'));
$max->setPattern('^\\d+$', _AM_USERRANK_ERROR_POST);
$this->addElement($max);
$imgtray_img = new Xoops\Form\ElementTray(_AM_USERRANK_IMAGE, '<br />');
$imgpath_img = sprintf(_AM_USERRANK_IMAGE_PATH, \XoopsBaseConfig::get('uploads-path') . '/ranks/');
$imageselect_img = new Xoops\Form\Select($imgpath_img, 'rank_image', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(\XoopsBaseConfig::get('uploads-path') . '/ranks');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . \XoopsBaseConfig::get('uploads-url') . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . \XoopsBaseConfig::get('uploads-url') . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
$fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new Xoops\Form\File(_AM_USERRANK_UPLOAD, 'rank_image'), false);
$fileseltray_img->addElement(new Xoops\Form\Label(''), false);
$imgtray_img->addElement($fileseltray_img);
$this->addElement($imgtray_img);
if (!$obj->isNew()) {
$rank_special = $obj->getVar('rank_special');
} else {
$rank_special = 0;
}
$special_tray = new Xoops\Form\ElementTray(_AM_USERRANK_SPECIAL, '<br />');
$special_tray->setDescription(_AM_USERRANK_SPECIAL_CAN);
$special_tray->addElement(new Xoops\Form\RadioYesNo('', 'rank_special', $rank_special));
$this->addElement($special_tray);
if (!$obj->isNew()) {
$this->addElement(new Xoops\Form\Hidden('rank_id', $obj->getVar('rank_id')));
}
$this->addElement(new Xoops\Form\Hidden('op', 'userrank_save'));
$this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
}
示例9: getForm
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('ranks/', '', $this->getVar('rank_image', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_USERRANK_ADD) : sprintf(_AM_SYSTEM_USERRANK_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_TITLE, 'rank_title', 50, 50, $this->getVar('rank_title'), true));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MINPOST, 'rank_min', 10, 10, $this->getVar('rank_min')));
$form->addElement(new XoopsFormText(_AM_SYSTEM_USERRANK_MAXPOST, 'rank_max', 10, 10, $this->getVar('rank_max')));
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_IMAGE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_USERRANK_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/ranks/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'rank_image', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/ranks');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-ranks-img\", \"rank_image\", \"ranks\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/ranks/" . $blank_img . "' name='image_img' id='xo-ranks-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_USERRANK_UPLOAD, 'rank_image', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$rank_special = $this->getVar('rank_special');
} else {
$rank_special = 0;
}
$special_tray = new XoopsFormElementTray(_AM_SYSTEM_USERRANK_SPECIAL, '<br />');
$special_tray->setDescription(_AM_SYSTEM_USERRANK_SPECIAL_CAN);
$special_tray->addElement(new XoopsFormRadioYN('', 'rank_special', $rank_special));
$form->addElement($special_tray);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('rank_id', $this->getVar('rank_id')));
}
$form->addElement(new XoopsFormHidden('op', 'userrank_save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例10: __construct
public function __construct(AvatarsAvatar $obj)
{
if ($obj->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('avatars/', '', $obj->getVar('avatar_file', 'e'));
}
//$xoops = Xoops::getInstance();
// New and edit form
$title = $obj->isNew() ? XoopsLocale::A_ADD : XoopsLocale::A_EDIT;
$action = $_SERVER['REQUEST_URI'];
parent::__construct($title, 'avatar_form', $action, "post", true);
$this->setExtra('enctype="multipart/form-data"');
// Name
$this->addElement(new Xoops\Form\Text(XoopsLocale::NAME, 'avatar_name', 5, 255, $obj->getVar('avatar_name', 'e')), true);
// Upload part
$imgtray_img = new Xoops\Form\ElementTray(XoopsLocale::FILE, '<br />');
$avatars_path = \XoopsBaseConfig::get('uploads-path') . '/avatars';
$imageselect_img = new Xoops\Form\Select(sprintf(XoopsLocale::F_FILE_EXISTS_IN, $avatars_path . '/'), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray($avatars_path);
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$xoops_upload_url = \XoopsBaseConfig::get('uploads-url');
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . $xoops_upload_url . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new Xoops\Form\Label('', "<br /><img src='" . $xoops_upload_url . "/avatars/" . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
$fileseltray_img = new Xoops\Form\ElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new Xoops\Form\File(XoopsLocale::A_UPLOAD, 'avatar_file'), false);
// , $xoops->getModuleConfig('avatars_imagefilesize')
$imgtray_img->addElement($fileseltray_img);
$this->addElement($imgtray_img);
// Weight
$weight = new Xoops\Form\Text(XoopsLocale::DISPLAY_ORDER, 'avatar_weight', 1, 4, $obj->getVar('avatar_weight', 'e'), '');
$weight->setPattern('^\\d+$', XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER);
$this->addElement($weight, true);
// Display
$this->addElement(new Xoops\Form\RadioYesNo(XoopsLocale::DISPLAY_THIS_ITEM, 'avatar_display', $obj->getVar('avatar_display', 'e'), XoopsLocale::YES, XoopsLocale::NO));
// Hidden
if ($obj->isNew()) {
$this->addElement(new Xoops\Form\Hidden('avatar_type', 's'));
}
$this->addElement(new Xoops\Form\Hidden('op', 'save'));
$this->addElement(new Xoops\Form\Hidden('avatar_id', $obj->getVar('avatar_id', 'e')));
// Button
$this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
}
示例11: b_xmobile_qr_edit
function b_xmobile_qr_edit($options)
{
$qrimage = empty($options[0]) ? 0 : intval($options[0]);
$qr_mod_dir = empty($options[1]) ? "" : htmlspecialchars($options[1]);
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$qrimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/modules/xmobile/images/qr/');
$i = 0;
$qr = "<select name='options[0]'>";
$qr .= "<option value='" . $i . "' " . ($qrimage == $i ? "selected='selected'" : "") . ">---</option>";
foreach ($qrimg_array as $v) {
$qr .= "<option value='" . ++$i . "' " . ($qrimage == $i ? "selected='selected'" : "") . ">" . htmlspecialchars($v) . "</option>";
}
$qr .= "</select>";
$form = _BLOCK_XMOBILE_QR_CODE . " " . $qr . " " . _BLOCK_XMOBILE_QR_CODE_DESC . "<br />\n" . _BLOCK_XMOBILE_QR_MOD_DIR . "<input type='text' name='options[1]' value='" . $qr_mod_dir . "'>";
return $form;
}
示例12: getForm
/**
* @param bool $action
*
* @return XoopsThemeForm
*/
function getForm($action = false)
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('smilies/', '', $this->getVar('smile_url', 'e'));
}
if ($action === false) {
$action = $_SERVER['REQUEST_URI'];
}
$title = $this->isNew() ? sprintf(_AM_SYSTEM_SMILIES_ADD) : sprintf(_AM_SYSTEM_SMILIES_EDIT);
$form = new XoopsThemeForm($title, 'form', $action, 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_CODE, 'code', 26, 25, $this->getVar('code')), true);
$form->addElement(new XoopsFormText(_AM_SYSTEM_SMILIES_DESCRIPTION, 'emotion', 50, 50, $this->getVar('emotion')), true);
$imgtray_img = new XoopsFormElementTray(_AM_SYSTEM_SMILIES_FILE, '<br />');
$imgpath_img = sprintf(_AM_SYSTEM_SMILIES_IMAGE_PATH, XOOPS_UPLOAD_PATH . '/smilies/');
$imageselect_img = new XoopsFormSelect($imgpath_img, 'smile_url', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/smilies');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra('onchange="showImgSelected(\'xo-smilies-img\', \'smile_url\', \'smilies\', \'\', \'' . XOOPS_UPLOAD_URL . '\' )"');
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/smilies/" . $blank_img . "' name='image_img' id='xo-smilies-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br />', '<br /><br />');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_SMILIES_UPLOADS, 'smile_url', 500000), false);
$fileseltray_img->addElement(new XoopsFormLabel(''), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
if (!$this->isNew()) {
$form->addElement(new XoopsFormHidden('smilies_id', $this->getVar('id')));
$display = $this->getVar('display');
} else {
$display = 0;
}
$form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_SMILIES_OFF, 'display', $display));
$form->addElement(new XoopsFormHidden('op', 'save_smilie'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
}
示例13: getForm
/**
* @return XoopsThemeForm
*/
public function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = $this->getVar('avatar_file', 'e');
}
// Get User Config
$config_handler = xoops_getHandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
$form->setExtra('enctype="multipart/form-data"');
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
$maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
$uploadirectory_img = '';
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>');
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH);
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
// if (preg_match('#avt#', $image_img)) {
if (false !== strpos(image_img, 'avt')) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
}
$imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例14: getSubjectsList
/**
* gets list of subject icon image file names in a certain directory
* if directory is not specified, default directory will be searched
*
* @static
*
* @param string $sub_dir
*
* @return array
*/
public static function getSubjectsList($sub_dir = '')
{
$xoops_root_path = \XoopsBaseConfig::get('root-path');
if ($sub_dir != '') {
$subjects = XoopsLists::getImgListAsArray($xoops_root_path . '/images/subject/' . $sub_dir, $sub_dir . '/');
} else {
$subjects = XoopsLists::getImgListAsArray($xoops_root_path . '/images/subject/');
}
return $subjects;
}
示例15: editpartner
function editpartner($showmenu = false, $id = 0)
{
global $xoopsDB, $smartpartner_partner_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
if (!isset($smartpartner_partner_handler)) {
$smartpartner_partner_handler =& smartpartner_gethandler('partner');
}
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
// If there is a parameter, and the id exists, retrieve data: we're editing a partner
if ($id != 0) {
// Creating the partner object
$partnerObj = new SmartpartnerPartner($id);
if ($partnerObj->notLoaded()) {
redirect_header("partner.php", 1, _AM_SPARTNER_NOPARTNERSELECTED);
exit;
}
switch ($partnerObj->status()) {
case _SPARTNER_STATUS_SUBMITTED:
$breadcrumb_action1 = _AM_SPARTNER_SUBMITTED_PARTNERS;
$breadcrumb_action2 = _AM_SPARTNER_APPROVING;
$page_title = _AM_SPARTNER_SUBMITTED_TITLE;
$page_info = _AM_SPARTNER_SUBMITTED_INFO;
$button_caption = _AM_SPARTNER_APPROVE;
$new_status = _SPARTNER_STATUS_ACTIVE;
break;
case _SPARTNER_STATUS_ACTIVE:
$breadcrumb_action1 = _AM_SPARTNER_ACTIVE_PARTNERS;
$breadcrumb_action2 = _AM_SPARTNER_EDITING;
$page_title = _AM_SPARTNER_ACTIVE_EDITING;
$page_info = _AM_SPARTNER_ACTIVE_EDITING_INFO;
$button_caption = _AM_SPARTNER_MODIFY;
$new_status = _SPARTNER_STATUS_ACTIVE;
break;
case _SPARTNER_STATUS_INACTIVE:
$breadcrumb_action1 = _AM_SPARTNER_INACTIVE_PARTNERS;
$breadcrumb_action2 = _AM_SPARTNER_EDITING;
$page_title = _AM_SPARTNER_INACTIVE_EDITING;
$page_info = _AM_SPARTNER_INACTIVE_EDITING_INFO;
$button_caption = _AM_SPARTNER_MODIFY;
$new_status = _SPARTNER_STATUS_INACTIVE;
break;
case _SPARTNER_STATUS_REJECTED:
$breadcrumb_action1 = _AM_SPARTNER_REJECTED_PARTNERS;
$breadcrumb_action2 = _AM_SPARTNER_EDITING;
$page_title = _AM_SPARTNER_REJECTED_EDITING;
$page_info = _AM_SPARTNER_REJECTED_EDITING_INFO;
$button_caption = _AM_SPARTNER_MODIFY;
$new_status = _SPARTNER_STATUS_REJECTED;
break;
case "default":
default:
break;
}
if ($showmenu) {
smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
}
echo "<br />\n";
smartpartner_collapsableBar('editpartner', 'editpartmericon', $page_title, $page_info);
} else {
// there's no parameter, so we're adding a partner
$partnerObj =& $smartpartner_partner_handler->create();
$breadcrumb_action1 = _AM_SPARTNER_PARTNERS;
$breadcrumb_action2 = _AM_SPARTNER_CREATE;
$button_caption = _AM_SPARTNER_CREATE;
$new_status = _SPARTNER_STATUS_ACTIVE;
if ($showmenu) {
smartpartner_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2);
}
smartpartner_collapsableBar('addpartner', 'addpartmericon', _AM_SPARTNER_PARTNER_CREATING, _AM_SPARTNER_PARTNER_CREATING_DSC);
}
// PARTNER FORM
$sform = new XoopsThemeForm(_AM_SPARTNER_PARTNERS, "op", xoops_getenv('PHP_SELF'));
$sform->setExtra('enctype="multipart/form-data"');
// TITLE
$title_text = new XoopsFormText(_AM_SPARTNER_TITLE, 'title', 50, 255, $partnerObj->title('e'));
$sform->addElement($title_text, true);
// Parent Category
$mytree = new SmartTree($xoopsDB->prefix("smartpartner_categories"), "categoryid", "parentid");
ob_start();
$mytree->makeMySelBox("name", "weight", explode('|', $partnerObj->categoryid()), 0, 'categoryid', '', true);
//makeMySelBox($title,$order="",$preset_id=0, $none=0, $sel_name="", $onchange="")
$parent_cat_select = new XoopsFormLabel(_AM_SPARTNER_CATEGORY_BELONG, ob_get_contents());
$parent_cat_select->setDescription(_AM_SPARTNER_BELONG_CATEGORY_DSC);
$sform->addElement($parent_cat_select);
ob_end_clean();
// LOGO
$logo_array =& XoopsLists::getImgListAsArray(smartpartner_getImageDir());
$logo_select = new XoopsFormSelect('', 'image', $partnerObj->image());
$logo_select->addOption('-1', '---------------');
$logo_select->addOptionArray($logo_array);
$logo_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . SMARTPARTNER_DIRNAME . '/images' . "\", \"\", \"" . XOOPS_URL . "\")'");
$logo_tray = new XoopsFormElementTray(_AM_SPARTNER_LOGO, ' ');
$logo_tray->addElement($logo_select);
$logo_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . smartpartner_getImageDir('', false) . $partnerObj->image() . "' name='image3' id='image3' alt='' />"));
$logo_tray->setDescription(_AM_SPARTNER_LOGO_DSC);
$sform->addElement($logo_tray);
// LOGO UPLOAD
$max_size = 5000000;
$file_box = new XoopsFormFile(_AM_SPARTNER_LOGO_UPLOAD, "logo_file", $max_size);
$file_box->setExtra("size ='45'");
$file_box->setDescription(sprintf(_AM_SPARTNER_LOGO_UPLOAD_DSC, $xoopsModuleConfig['img_max_width'], $xoopsModuleConfig['img_max_height']));
//.........这里部分代码省略.........