本文整理汇总了PHP中URLHelper类的典型用法代码示例。如果您正苦于以下问题:PHP URLHelper类的具体用法?PHP URLHelper怎么用?PHP URLHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了URLHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
global $perm, $template_factory;
parent::before_filter($action, $args);
$perm->check(Config::get()->LOCK_RULE_ADMIN_PERM ? Config::get()->LOCK_RULE_ADMIN_PERM : 'admin');
$layout = $template_factory->open('layouts/base');
$this->set_layout($layout);
PageLayout::setTitle(_('Verwaltung der Sperrebenen'));
Navigation::activateItem('/admin/locations/lock_rules');
URLHelper::bindLinkParam('lock_rule_type', $this->lock_rule_type);
if (!$this->lock_rule_type || !$GLOBALS['perm']->have_perm('root')) {
$this->lock_rule_type = 'sem';
}
if ($this->lock_rule_type == 'sem') {
$this->lock_rule_permissions = $GLOBALS['perm']->have_perm('root') ? array('tutor', 'dozent', 'admin', 'root') : array('tutor', 'dozent');
} elseif ($this->lock_rule_type == 'inst') {
$this->lock_rule_permissions = array('admin', 'root');
} elseif ($this->lock_rule_type == 'user') {
$this->lock_rule_permissions = array('tutor', 'dozent', 'admin', 'root');
}
$this->rule_type_names = array('sem' => _('Veranstaltung'), 'inst' => _('Einrichtung'), 'user' => _('Person'));
$this->sidebar = Sidebar::Get();
$this->sidebar->setTitle(_('Sperrebenen'));
$this->sidebar->setImage('sidebar/lock-sidebar.png');
}
示例2: actionView
public function actionView()
{
$radioId = Yii::app()->request->getParam("id", 0);
$radioName = WapRadioModel::model()->findByPk($radioId)->name;
$albumId = WapRadioModel::model()->getAlbumByRadio($radioId, "c2.id");
$radioAvatar = RadioModel::model()->getAvatarUrl($radioId, 's1');
$album = WapAlbumModel::model()->published()->findByPk($albumId);
if (!$album) {
$this->forward("/site/error", true);
}
$songsOfAlbum = WapSongModel::model()->getSongsOfAlbum($albumId);
$artists = AlbumArtistModel::model()->getArtistsByAlbum($albumId);
$phone = yii::app()->user->getState('msisdn');
$errorCode = 'success';
$errorDescription = '';
$registerText = WapAlbumModel::model()->getCustomMetaData('REG_TEXT');
///meta tag
$AlbumDetail = AlbumModel::model()->findByPk($albumId);
$artistId = !empty($artists) ? $artists[0]->artist_id : $AlbumDetail->artist_id;
$ArtistInfo = ArtistModel::model()->findByPk($artistId);
$this->itemName = $AlbumDetail->name;
$this->artist = $ArtistInfo->name;
$this->thumb = AlbumModel::model()->getAvatarUrl($albumId, 's1');
$this->url = URLHelper::buildFriendlyURL("album", $albumId, Common::makeFriendlyUrl($ArtistInfo->name));
$this->description = strip_tags($AlbumDetail->description);
//get other radio
$parent_id = Yii::app()->params['horoscope']['parent_id'];
$radioListOther = WapRadioModel::model()->getHoroscopes($parent_id);
$this->render('detail', array('album' => $album, 'songsOfAlbum' => $songsOfAlbum, 'errorCode' => $errorCode, 'errorDescription' => $errorDescription, 'registerText' => $registerText, 'radioListOther' => $radioListOther, 'radioAvatar' => $radioAvatar));
}
示例3: map
/**
* Mapping function where to find what
* @param type $object the object
* @param type $function the called function
* @return string output
*/
private static function map($object, $function)
{
/**
* If you want to add an object to the helper simply add to this array
*/
$mapping = array('User' => array('link' => function ($obj) {
return URLHelper::getLink('dispatch.php/profile', array('username' => $obj->username));
}, 'name' => function ($obj) {
return htmlReady($obj->getFullname());
}, 'avatar' => function ($obj) {
return Avatar::getAvatar($obj->id, $obj->username)->getImageTag(Avatar::SMALL, array('title' => htmlReady($obj->getFullname('no_title'))));
}), 'Course' => array('link' => function ($obj) {
return URLHelper::getLink('seminar_main.php', array('auswahl' => $obj->id));
}, 'name' => function ($obj) {
return htmlReady($obj->name);
}, 'avatar' => function ($obj) {
return CourseAvatar::getAvatar($obj->id)->getImageTag($size = CourseAvatar::SMALL, array('title' => htmlReady($obj->name)));
}));
/*
* Some php magic to call the right function if it exists
*/
if ($object && $mapping[get_class($object)]) {
return $mapping[get_class($object)][$function]($object);
}
return "";
}
示例4: afterStoreCallback
public function afterStoreCallback()
{
if (!$this->material['host_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
PersonalNotifications::add($this->material['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/details/" . $this->material->getId() . "#review_" . $this->getId()), $this->isNew() ? sprintf(_("%s hat ein Review zu '%s' geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']) : sprintf(_("%s hat ein Review zu '%s' verändert."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']), "review_" . $this->getId(), Icon::create("support", "clickable"));
}
//only push if the comment is from this server and the material-server is different
if ($this->material['host_id'] && !$this['host_id'] && $this->isDirty()) {
$remote = new LernmarktplatzHost($this->material['host_id']);
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_review_id'] = $data['data']['review_id'];
unset($data['data']['review_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
if (!$remote->isMe()) {
$remote->pushDataToEndpoint("add_review/" . $this->material['foreign_material_id'], $data);
}
}
}
示例5: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
// Lock context to user id
$this->owner = $GLOBALS['user'];
$this->context_id = $this->owner->id;
$this->full_access = true;
if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
$username = Request::username('username', $GLOBALS['user']->username);
$user = User::findByUsername($username);
if ($user && $user->id !== $GLOBALS['user']->id) {
$this->owner = $user;
$this->context_id = $user->id;
$this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
URLHelper::bindLinkParam('username', $username);
}
}
$this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
$this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
if ($this->userConfig['area_close'] == 1) {
$this->redirect('document/closed/index');
}
if (Request::isPost()) {
CSRFProtection::verifySecurityToken();
}
if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
$message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
PageLayout::postMessage(MessageBox::error($message));
$this->redirect('document/files/index');
}
}
示例6: afterStoreCallback
public function afterStoreCallback()
{
if ($this->isDirty()) {
//add notification to writer of review
if (!$this->review['host_id'] && $this->review['user_id'] !== $this['user_id']) {
PersonalNotifications::add($this->review['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat einen Kommentar zu Ihrem Review geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
//add notification to all users of this servers who discussed this review but are neither the new
//commentor nor the writer of the review
$statement = DBManager::get()->prepare("\n SELECT user_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NULL\n GROUP BY user_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $user_id) {
if (!in_array($user_id, array($this->review['user_id'], $this['user_id']))) {
PersonalNotifications::add($user_id, URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat auch einen Kommentar geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
}
//only push if the comment is from this server and the material-server is different
if (!$this['host_id']) {
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_comment_id'] = $data['data']['comment_id'];
unset($data['data']['comment_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
$statement = DBManager::get()->prepare("\n SELECT host_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NOT NULL\n GROUP BY host_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
$hosts = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
if ($this->review['host_id'] && !in_array($this->review['host_id'], $hosts)) {
$hosts[] = $this->review['host_id'];
}
if ($this->review->material['host_id'] && !in_array($this->review->material['host_id'], $hosts)) {
$hosts[] = $this->review->material['host_id'];
}
foreach ($hosts as $host_id) {
$remote = new LernmarktplatzHost($host_id);
if (!$remote->isMe()) {
$review_id = $this->review['foreign_review_id'] ?: $this->review->getId();
if ($this->review['foreign_review_id']) {
if ($this->review->host_id === $remote->getId()) {
$host_hash = null;
} else {
$host_hash = md5($this->review->host['public_key']);
}
} else {
$host_hash = md5($myHost['public_key']);
}
$remote->pushDataToEndpoint("add_comment/" . $review_id . "/" . $host_hash, $data);
}
}
}
}
}
示例7: before_filter
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
// Remove cid
URLHelper::removeLinkParam('cid');
unset($_SESSION['SessionSeminar']);
$this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
Navigation::activateItem('/profile/index');
URLHelper::addLinkParam('username', Request::username('username'));
PageLayout::setHelpKeyword('Basis.Homepage');
SkipLinks::addIndex(_('Benutzerprofil'), 'user_profile', 100);
$this->user = User::findCurrent();
// current logged in user
$this->perm = $GLOBALS['perm'];
// perms of current logged in user
$this->current_user = User::findByUsername(Request::username('username', $this->user->username));
// current selected user
// get additional informations to selected user
$this->profile = new ProfileModel($this->current_user->user_id, $this->user->user_id);
// set the page title depending on user selection
if ($this->current_user['user_id'] == $this->user->id && !$this->current_user['locked']) {
PageLayout::setTitle(_('Mein Profil'));
UserConfig::get($this->user->id)->store('PROFILE_LAST_VISIT', time());
} elseif ($this->current_user['user_id'] && ($this->perm->have_perm('root') || !$this->current_user['locked'] && get_visibility_by_id($this->current_user['user_id']))) {
PageLayout::setTitle(_('Profil') . ' - ' . $this->current_user->getFullname());
object_add_view($this->current_user->user_id);
} else {
PageLayout::setTitle(_('Profil'));
$action = 'not_available';
}
}
示例8: absolute_url_for
public function absolute_url_for($to)
{
$old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']);
$args = func_get_args();
$url = call_user_func_array(array($this, 'url_for'), $args);
URLHelper::setBaseURL($old_base);
return $url;
}
示例9: isActive
/**
* Determine whether this navigation item is active.
*/
public function isActive()
{
$active = parent::isActive();
if ($active) {
URLHelper::addLinkParam('username', Request::username('username'));
}
return $active;
}
示例10: url
/**
* Returns the absolute url to a page with an optional trailing slash.
*
* @param string $url
* @param bool $trailing_slash
* @return string
*/
public static function url($url, $trailing_slash = true)
{
$url = URLHelper::stripBase($url);
if ($trailing_slash) {
$url = StringHelper::stripEnd($url, '/');
$url .= '/';
}
return BASE_URL . $url;
}
示例11: callMobilePhone
function callMobilePhone($phone_num)
{
CellPhone::openSerialPort();
CellPhone::callPhone($phone_num);
CellPhone::closeSerialPort();
$msg = 'Calling ' . $phone_num . '...<INPUT TYPE="image" SRC="' . URLHelper::getWebBaseURL() . 'images/hangup.gif" BORDER="0" >';
$data = array("phone_num" => $phone_num, "msg" => $msg);
return $data;
}
示例12: markupHashtags
public static function markupHashtags($markup, $matches)
{
if (self::$course_hashes) {
$url = URLHelper::getLink("plugins.php/Blubber/forum/forum", array('hash' => $matches[2], 'cid' => self::$course_hashes));
} else {
$url = URLHelper::getLink("plugins.php/Blubber/forum/globalstream", array('hash' => $matches[2]));
}
return $matches[1] . '<a href="' . $url . '" class="hashtag">#' . $markup->quote($matches[2]) . '</a>';
}
示例13: validateForm
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state)
{
parent::validateForm($form, $form_state);
$embed_provider = $form_state->getValue('embed_provider');
$this->prepareEmbedProviderValidation($embed_provider);
if (!URLHelper::isValid($embed_provider, TRUE)) {
$form_state->setErrorByName('embed_provider', $this->t('The provider url was not valid.'));
}
}
示例14: getColumnName
function getColumnName($id, $print_view = false)
{
$res_obj = ResourceObject::Factory($this->show_columns[$id]);
if (!$print_view) {
$ret = '<a class="tree" href="' . URLHelper::getLink('?show_object=' . $this->show_columns[$id] . '&view=' . (Request::option('view') == 'openobject_group_schedule' ? 'openobject_schedule' : 'view_schedule')) . '">' . htmlReady($res_obj->getName()) . '</a>' . ($res_obj->getSeats() ? '<br>(' . $res_obj->getSeats() . ')' : '');
} else {
$ret = '<span style="font-size:10pt;">' . htmlReady($res_obj->getName()) . '</span>';
}
return $ret . chr(10);
}
示例15: loadContent
/**
* load help content from db
*/
public function loadContent()
{
$help_content = HelpContent::getContentByRoute();
foreach ($help_content as $row) {
$this->addPlainText($row['label'] ?: '', $this->interpolate($row['content'], $this->variables), $row['icon'] ? Icon::create($row['icon'], 'info_alt') : null, URLHelper::getURL('dispatch.php/help_content/edit/' . $row['content_id']), URLHelper::getURL('dispatch.php/help_content/delete/' . $row['content_id']));
}
if (!count($help_content) && $this->help_admin) {
$this->addPlainText('', '', null, null, null, URLHelper::getURL('dispatch.php/help_content/edit/new' . '?help_content_route=' . get_route()));
}
}