本文整理汇总了PHP中xoonips_getutility函数的典型用法代码示例。如果您正苦于以下问题:PHP xoonips_getutility函数的具体用法?PHP xoonips_getutility怎么用?PHP xoonips_getutility使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoonips_getutility函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
$textutil =& xoonips_getutility('text');
$xoopsOption['template_main'] = 'xoonips_import_log.html';
if ($this->_params['result']) {
include XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('result', $this->_params['result']);
$xoopsTpl->assign('filename', $textutil->html_special_chars($this->_params['filename']));
$xoopsTpl->assign('number_of_items', $this->_number_of_items());
$xoopsTpl->assign('uname', $textutil->html_special_chars($this->_params['uname']));
$xoopsTpl->assign('errors', $this->_params['errors']);
$xoopsTpl->assign('log', $textutil->html_special_chars($this->_get_item_log()));
include XOOPS_ROOT_PATH . '/footer.php';
} else {
include XOOPS_ROOT_PATH . '/header.php';
$xoopsTpl->assign('result', false);
$xoopsTpl->assign('filename', $this->_params['filename']);
$xoopsTpl->assign('number_of_items', $this->_number_of_items());
$xoopsTpl->assign('uname', $this->_params['uname']);
$xoopsTpl->assign('errors', $this->_params['errors']);
$xoopsTpl->assign('log', $this->_get_item_log());
include XOOPS_ROOT_PATH . '/footer.php';
}
}
示例2: xoonips_extra_param_restore
/**
*
* @return array associative array of extra parameters
*/
function xoonips_extra_param_restore()
{
$formdata =& xoonips_getutility('formdata');
$extra_param_name = $formdata->getValueArray('post', 'extra_param_name', 's', false);
$extra_params = array();
foreach ($extra_param_name as $name) {
if (!isset($_POST[$name])) {
continue;
}
if (is_array($_POST[$name])) {
$extra_params[$name] = $formdata->getValueArray('post', $name, 's', false);
} else {
$extra_params[$name] = $formdata->getValue('post', $name, 's', false);
}
}
if (!empty($extra_params)) {
return $extra_params;
}
// try to get serialized extra_param request
$extra_param = $formdata->getValue('post', 'extra_param', 's', false);
$extra_params = @unserialize($extra_param);
if (is_array($extra_params)) {
return $extra_params;
}
return array();
}
示例3: item_get_userlist
function item_get_userlist($upage)
{
global $xoopsDB;
global $xoopsUser;
// myuid
$myuid = $xoopsUser->getVar('uid', 'n');
$xusers_handler =& xoonips_getormhandler('xoonips', 'users');
$tables['users'] = $xoopsDB->prefix('users');
$tables['xusers'] = $xoopsDB->prefix('xoonips_users');
$join_criteria = new XooNIpsJoinCriteria('users', 'uid', 'uid');
$criteria = new Criteria($tables['users'] . '.level', 0, '>');
$criteria->setSort($tables['users'] . '.uname');
$fields = array();
$fields[] = $tables['xusers'] . '.uid';
$fields[] = $tables['users'] . '.uname';
$xusers_objs =& $xusers_handler->getObjects($criteria, false, implode(',', $fields), false, $join_criteria);
$textutil =& xoonips_getutility('text');
$users = array();
$users[] = array('uid' => 0, 'uname' => $textutil->html_special_chars(_AM_XOONIPS_MAINTENANCE_ITEM_LABEL_ALLUSERS), 'selected' => 'selected="selected"');
foreach ($xusers_objs as $xusers_obj) {
$uid = $xusers_obj->getVar('uid', 'e');
$uname = $textutil->html_special_chars($xusers_obj->getExtraVar('uname'));
$users[] = array('uid' => $uid, 'uname' => $uname, 'selected' => '');
}
return $users;
}
示例4: doAction
function doAction()
{
$textutil =& xoonips_getutility('text');
$this->_view_params['url_to_back'] = 'oaipmh_search.php?action=search';
$this->_view_params['repository_name'] = $this->getRepositoryName($this->_formdata->getValue('post', 'identifier', 's', false));
$this->_view_params['metadata'] = $this->getMetadataArray($this->_formdata->getValue('post', 'identifier', 's', false));
$this->_view_params['hidden'] = array(array('name' => 'search_cache_id', 'value' => $this->_formdata->getValue('post', 'search_cache_id', 'i', false)), array('name' => 'search_flag', 'value' => '0'), array('name' => 'repository_id', 'value' => $this->_formdata->getValue('post', 'repository_id', 'i', false)), array('name' => 'keyword', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'keyword', 's', false))), array('name' => 'order_by', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_by', 's', false))), array('name' => 'order_dir', 'value' => $textutil->html_special_chars($this->_formdata->getValue('post', 'order_dir', 's', false))), array('name' => 'page', 'value' => $this->_formdata->getValue('post', 'page', 'i', false)), array('name' => 'metadata_per_page', 'value' => $this->_formdata->getValue('post', 'metadata_per_page', 'i', false)));
}
示例5: xoonips_item_list_header
function xoonips_item_list_header()
{
$formdata =& xoonips_getutility('formdata');
$order_by = $formdata->getValue('post', 'order_by', 's', false);
$order_dir = $formdata->getValue('post', 'order_dir', 'i', false);
$item_per_page = $formdata->getValue('post', 'item_per_page', 'i', false);
return array('order_by' => $order_by, 'order_dir' => $order_dir, 'item_per_page' => $item_per_page);
}
示例6: XooNIpsAction
function XooNIpsAction()
{
$this->_params = array();
$this->_response = new XooNIpsResponse();
$this->_error =& $this->_response->getError();
$this->_view_params = array();
$this->_formdata =& xoonips_getutility('formdata');
}
示例7: render
/**
*
* @brief return XoopsXmlRpcTag that has response of this request
*
* @return XoopsXmlRpcTag
*/
function render()
{
$unicode =& xoonips_getutility('unicode');
$index = $this->response->getSuccess();
$struct = new XoopsXmlRpcStruct();
$struct->add('id', new XoopsXmlRpcInt($index['id']));
$struct->add('name', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['name'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
$struct->add('parent', new XoopsXmlRpcInt($index['parent']));
$struct->add('open_level', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['open_level'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
$struct->add('path', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($index['path'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
return $struct;
}
示例8: render
function render()
{
global $xoopsOption, $xoopsConfig, $xoopsUser, $xoopsUserIsAdmin, $xoopsLogger, $xoopsTpl;
$textutil =& xoonips_getutility('text');
//create handler to include item_type.class.php
$item_lock_handler =& xoonips_getormhandler('xoonips', 'item_lock');
$xoopsOption['template_main'] = 'xoonips_transfer_user_item_confirm.html';
include XOOPS_ROOT_PATH . '/header.php';
$this->setXooNIpsStyleSheet($xoopsTpl);
$xoopsTpl->assign('token_hidden', $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 600, 'xoonips_transfer_user_item_confirm'));
$xoopsTpl->assign('to_uname', $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])));
$xoopsTpl->assign('transfer_items', $this->get_transfer_item_template_vars());
$xoopsTpl->assign('not_subscribed_group_message', sprintf(_MD_XOONIPS_TRANSFER_USER_ITEM_CONFIRM_USER_IS_NOT_SUBSCRIBED_TO_GROUPS, $textutil->html_special_chars($this->get_uname_by_uid($this->_params['to_uid'])), $this->get_gname_csv()));
foreach ($this->_params as $key => $val) {
$xoopsTpl->assign($key, $val);
}
include XOOPS_ROOT_PATH . '/footer.php';
}
示例9: getRepositoryArrays
/**
*
* note: repository name is truncated in 70 chars
* @access private
* @return array of associative array of repository
*/
function getRepositoryArrays()
{
$textutil =& xoonips_getutility('text');
$handler =& xoonips_getormhandler('xoonips', 'oaipmh_repositories');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('last_success_date', null, '!='));
$criteria->add(new Criteria('enabled', 1));
$criteria->add(new Criteria('deleted', 0));
$rows =& $handler->getObjects($criteria);
if (!$rows) {
return array();
}
$result = array();
foreach ($rows as $row) {
$result[] = array('repository_id' => $row->getVar('repository_id', 's'), 'repository_name' => $textutil->truncate(trim($row->getVar('repository_name', 's')) != '' ? $row->getVar('repository_name', 's') : $row->getVar('URL', 's'), 70, '...'), 'metadata_count' => $row->getVar('metadata_count', 's'));
}
return $result;
}
示例10: render
/**
*
* @brief return XoopsXmlRpcTag that has response of this request
*
* @return XoopsXmlRpcTag
*/
function render()
{
$metadata = $this->response->getSuccess();
$resp = new XoopsXmlRpcStruct();
$unicode =& xoonips_getutility('unicode');
$resp->add('id', new XoopsXmlRpcInt($metadata['id']));
$resp->add('filetype', new XoopsXmlRpcString($metadata['filetype']));
$resp->add('originalname', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['originalname'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
$resp->add('size', new XoopsXmlRpcInt($metadata['size']));
$resp->add('mimetype', new XoopsXmlRpcString($metadata['mimetype']));
$resp->add('caption', new XoopsXmlRpcString(htmlspecialchars($unicode->encode_utf8($metadata['caption'], xoonips_get_server_charset()), ENT_QUOTES, 'UTF-8')));
$resp->add('thumbnail', new XoopsXmlRpcBase64($metadata['thumbnail']));
$resp->add('registration_date', new XoopsXmlRpcDatetime($metadata['registration_date']));
$resp->add('last_modified_date', new XoopsXmlRpcDatetime($metadata['last_modified_date']));
$resp->add('download_count', new XoopsXmlRpcInt($metadata['download_count']));
$resp->add('download_count_sum', new XoopsXmlRpcInt($metadata['download_count_sum']));
return $resp;
}
示例11: xoonips_admin_system_check_mysql
function xoonips_admin_system_check_mysql(&$category)
{
// mysql class
$mysqlinfo =& xoonips_getutility('mysqlinfo');
// version
$name = 'MySQL version';
$res = new XooNIpsAdminSystemCheckResult($name);
$version = $mysqlinfo->getVersion('full');
$res->setResult(_XASC_STATUS_OK, $version, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
$category->registerResult($res);
unset($res);
if ($mysqlinfo->isVersion41orHigher()) {
$keys = array('character_set_database' => true, 'character_set_client' => false, 'character_set_connection' => false, 'character_set_results' => false);
foreach ($keys as $key => $is_database) {
$res = new XooNIpsAdminSystemCheckResult($key);
$charset = $mysqlinfo->getVariable($key);
$accept_charsets = $mysqlinfo->getAcceptableCharsets($is_database, _CHARSET);
if (in_array($charset, $accept_charsets)) {
$res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
} else {
$res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
$res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
$category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
}
$category->registerResult($res);
unset($res);
}
} else {
$key = 'character_set';
$res = new XooNIpsAdminSystemCheckResult($key);
$charset = $mysqlinfo->getVariable($key);
$accept_charsets = $mysqlinfo->getAcceptableCharsets(true, _CHARSET);
if (in_array($charset, $accept_charsets)) {
$res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK);
} else {
$res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL);
$res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets));
$category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL);
}
$category->registerResult($res);
unset($res);
}
}
示例12: execute
/**
* load and execute xoonips logic.
*
* @param[in] XooNIpsXmlRpcRequest $request
* @param[out] XooNIpsXmlRpcResponse $response
* result of logic(success/fault, response, error)
*/
function execute(&$request, &$response)
{
// load logic instance
$factory =& XooNIpsLogicFactory::getInstance();
$logic =& $factory->create($request->getMethodName());
if (!is_object($logic)) {
$response->setResult(false);
$error =& $response->getError();
$logic = $request->getMethodName();
$error->add(XNPERR_SERVER_ERROR, "can't create a logic of {$logic}");
return;
}
// execute logic
$params =& $request->getParams();
$xoonips_response = new XooNIpsResponse();
if (count($params) < 3) {
$response->setResult(false);
$error =& $response->getError();
$error->add(XNPERR_MISSING_PARAM);
return false;
} else {
if (count($params) > 3) {
$response->setResult(false);
$error =& $response->getError();
$error->add(XNPERR_EXTRA_PARAM);
return false;
}
}
$vars = array();
$vars[0] = $params[0];
$unicode =& xoonips_getutility('unicode');
$vars[1] = array();
foreach ($params[1] as $key => $val) {
$vars[1][$key] = $unicode->decode_utf8($val, xoonips_get_server_charset(), 'h');
}
$vars[2] = $params[2];
$logic->execute($vars, $xoonips_response);
//
$response->setResult($xoonips_response->getResult());
$response->setError($xoonips_response->getError());
$response->setSuccess($xoonips_response->getSuccess());
}
示例13: xmlEndElementHandler
/**
*
* @param
* @return void
*/
function xmlEndElementHandler($parser, $name)
{
global $xoopsDB;
$binder_item_links =& $this->_import_item->getVar('binder_item_links');
$unicode =& xoonips_getutility('unicode');
switch (implode('/', $this->_tag_stack)) {
case "ITEM/DETAIL":
if (count($binder_item_links) == 0) {
$this->_import_item->setErrors(E_XOONIPS_TAG_NOT_FOUND, " no binder_item_link" . $this->_get_parser_error_at());
}
break;
case "ITEM/DETAIL/BINDER_ITEM_LINK":
$handler =& xoonips_getormhandler('xnpbinder', 'binder_item_link');
$link =& $handler->create();
$link->set('item_id', intval($unicode->decode_utf8($this->_cdata, xoonips_get_server_charset(), 'h')));
$binder_item_links[] =& $link;
break;
}
parent::xmlEndElementHandler($parser, $name);
}
示例14: smarty_modifier_xoonips_escape
/**
* Smarty xoonips_escape modifier plugin
*
* Type: modifier<br>
* Name: xoonips_escape<br>
* Purpose: Escape the string according to escapement type
* @param string $text input
* @param string $type type of escape html, xml or javascript
* @return string
*/
function smarty_modifier_xoonips_escape($text, $type = 'html')
{
if (!function_exists('xoonips_getutility')) {
// return empty string if xoonips function not loaded.
return '';
}
$textutil =& xoonips_getutility('text');
switch ($type) {
case 'html':
$text = $textutil->html_special_chars($text);
break;
case 'xml':
$text = $textutil->xml_special_chars($text, _CHARSET);
break;
case 'javascript':
$text = $textutil->javascript_special_chars($text);
break;
}
return $text;
}
示例15: xoonips_get_backend
function xoonips_get_backend()
{
$formdata =& xoonips_getutility('formdata');
$itemtype = $formdata->getValue('get', 'itemtype', 's', true);
$action = $formdata->getValue('get', 'action', 's', true);
// check item type name
$item_type_handler =& xoonips_getormhandler('xoonips', 'item_type');
$criteria = new CriteriaCompo(new Criteria('name', $itemtype));
$criteria->add(new Criteria('mid', NULL, '!='));
if ($item_type_handler->getCount($criteria) != 1) {
die('illegal request');
}
// check action name
if (!preg_match('/^[a-z][_a-z]*$/', $action)) {
die('illegal request');
}
$backend = '../' . $itemtype . '/backend/' . $action . '.php';
if (!file_exists($backend)) {
die('illegal request');
}
return $backend;
}