本文整理汇总了PHP中iaCore::util方法的典型用法代码示例。如果您正苦于以下问题:PHP iaCore::util方法的具体用法?PHP iaCore::util怎么用?PHP iaCore::util使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iaCore
的用法示例。
在下文中一共展示了iaCore::util方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url
public function url($action, $data = array(), $generate = false)
{
$data['action'] = $action;
$data['alias'] = isset($data['genre_alias']) ? $data['genre_alias'] : $data['title_alias'];
if (!isset($this->patterns[$action])) {
$action = 'view';
}
if ($generate) {
iaCore::util();
if (!defined('IA_NOUTF')) {
iaUtf8::loadUTF8Core();
iaUtf8::loadUTF8Util('ascii', 'validation', 'bad', 'utf8_to_ascii');
}
if (!utf8_is_ascii($data['alias'])) {
$data['alias'] = $iaCore->convertStr(utf8_to_ascii($data['alias']));
}
}
$url = iaDb::printf($this->patterns[$action], $data);
return $this->iaCore->packagesData[self::PACKAGE_NAME]['url'] . $url;
}
示例2: array
case 'add':
iaBreadcrumb::add(iaLanguage::get('albums'), IA_ADMIN_URL . 'lyrics/albums/');
// these fields are system and used in system template
$item = array('status' => 'active', 'account_username' => $_SESSION['user']['username'], 'featured' => true);
if ('edit' == $pageAction) {
$item = $iaAlbum->getById((int) $_GET['id']);
if (empty($item)) {
iaView::errorPage(iaView::ERROR_NOT_FOUND);
}
}
$fields = iaField::getAllFields(true, '', 'albums');
if (isset($_POST['save'])) {
$error = false;
$errorFields = array();
$messages = array();
iaCore::util();
if ($fields) {
list($data, $error, $messages, $errorFields) = iaField::parsePost($fields, $item, true);
}
// validate account
if (isset($_POST['account']) && !empty($_POST['account'])) {
$member_id = $iaDb->one('id', "`username` = '{$_POST['account']}' ", iaUsers::getTable());
if (!$member_id) {
$error = true;
$messages[] = iaLanguage::get('album_incorrect_account');
} else {
$data['member_id'] = $member_id;
}
} else {
$data['member_id'] = iaUsers::getIdentity()->id;
}
示例3: add_js
public static function add_js(array $params)
{
$iaView =& iaCore::instance()->iaView;
$order = isset($params['order']) ? $params['order'] : iaView::RESOURCE_ORDER_REGULAR;
if (isset($params['files'])) {
$iaCore = iaCore::instance();
$files = $params['files'];
if (is_string($files)) {
$files = explode(',', $files);
}
foreach ($files as $filename) {
$filename = trim($filename);
if (empty($filename)) {
continue;
}
$compress = true;
$remote = false;
if (false !== stristr($filename, 'http://') || false !== stristr($filename, 'https://')) {
$remote = true;
$compress = false;
$url = $filename;
} elseif (strstr($filename, '_IA_TPL_')) {
$url = str_replace('_IA_TPL_', IA_TPL_URL . 'js' . IA_URL_DELIMITER, $filename) . self::EXTENSION_JS;
$file = str_replace('_IA_TPL_', IA_HOME . 'templates' . IA_DS . $iaCore->get('tmpl') . IA_DS . 'js' . IA_DS, $filename) . self::EXTENSION_JS;
$tmp = str_replace('_IA_TPL_', 'compress/', $filename);
} elseif (strstr($filename, '_IA_URL_')) {
$url = str_replace('_IA_URL_', $iaView->assetsUrl, $filename) . self::EXTENSION_JS;
$file = str_replace('_IA_URL_', IA_HOME, $filename) . self::EXTENSION_JS;
$tmp = str_replace('_IA_URL_', 'compress/', $filename);
} else {
$url = $iaView->assetsUrl . 'js/' . $filename . self::EXTENSION_JS;
$file = IA_HOME . 'js/' . $filename . self::EXTENSION_JS;
$tmp = 'compress/' . $filename;
}
$lastModified = 0;
if ($compress) {
$excludedFiles = array('ckeditor/ckeditor', 'jquery/jquery', 'extjs/ext-all', '_IA_TPL_bootstrap.min');
// lang cache
if (file_exists($file)) {
$lastModified = filemtime($file);
}
if ($filename == '_IA_URL_tmp/cache/intelli.admin.lang.en') {
$url = str_replace('_IA_URL_', $iaView->assetsUrl, $filename) . self::EXTENSION_JS;
$file = str_replace('_IA_URL_', IA_HOME, $filename) . self::EXTENSION_JS;
$tmp = str_replace('_IA_URL_', 'compress/', $filename);
}
// start compress
if ($iaCore->get('compress_js', false) && !in_array($filename, $excludedFiles)) {
$minifiedFilename = IA_TMP . $tmp . self::EXTENSION_JS;
$minifiedLastModifiedTime = 0;
// modified time of the compressed file
if (file_exists($minifiedFilename)) {
$minifiedLastModifiedTime = filemtime($minifiedFilename);
} else {
$compileDir = IA_TMP . implode(IA_DS, array_slice(explode(IA_DS, $tmp), 0, -1));
iaCore::util()->makeDirCascade($compileDir, 0777, true);
}
if (file_exists($file)) {
$lastModified = filemtime($file);
}
if (($lastModified > $minifiedLastModifiedTime || $minifiedLastModifiedTime == 0) && $lastModified != 0) {
// need to compress
iaDebug::debug($minifiedFilename . ' - ' . $lastModified . ' - ' . $minifiedLastModifiedTime, 'compress', 'info');
require_once IA_INCLUDES . 'utils' . IA_DS . 'Minifier.php';
$minifiedCode = \JShrink\Minifier::minify(file_get_contents($file));
file_put_contents($minifiedFilename, $minifiedCode);
$lastModified = time();
}
$url = $iaView->assetsUrl . 'tmp/' . $tmp . self::EXTENSION_JS;
}
}
if (!$remote && $lastModified > 0) {
$url .= '?fm=' . $lastModified;
}
$iaView->resources->js->{$url} = $order;
}
} elseif (isset($params['code'])) {
$iaView->resources->js->{'code:' . $params['code']} = $order;
} elseif (isset($params['text'])) {
$iaView->resources->js->{'text:' . $params['text']} = $order;
}
}
示例4: str_replace
}
}
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
if (iaCore::ACTION_ADD == $pageAction) {
$html = 0;
if (isset($_POST['save'])) {
if ($_POST['type'] == 'text') {
$body = str_replace("'", "\\'", $_POST['body']);
} else {
$body = str_replace("'", "\\'", $_POST['html_body']);
$html = 1;
}
list($error, $msg) = $iaMailerPlugin->createQueue($_POST['from_name'], $_POST['from_mail'], $_POST['subj'], $body, $html, $_POST['groups'], $_POST['st']);
$iaView->setMessages($msg, $error ? iaView::ERROR : iaView::SUCCESS);
if (!$error) {
$iaUtil = iaCore::util();
iaUtil::go_to(IA_ADMIN_URL . 'mailer/');
}
}
if (empty($_POST)) {
$data = array('from_name' => iaUsers::getIdentity()->fullname, 'from_mail' => iaUsers::getIdentity()->email, 'type' => 'html', 'subj' => '', 'body' => '');
} else {
$data = $_POST;
}
$statuses = $iaMailerPlugin->getAccountsStatusList();
$iaView->assign('data', $data);
$iaView->assign('statuses', $statuses);
$iaView->assign('usergroups', $iaCore->factory('users')->getUsergroups());
$iaView->assign('check', !empty($_POST['type']) && 'html' == $_POST['type'] ? true : false);
} else {
if ($queue = $iaMailerPlugin->getQueues()) {