本文整理汇总了PHP中common_path函数的典型用法代码示例。如果您正苦于以下问题:PHP common_path函数的具体用法?PHP common_path怎么用?PHP common_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了common_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onInitializePlugin
/**
* Setup the info for the subscription handler. Allow overriding
* to point at another cloud hub (not currently used).
*
* @return void
*/
function onInitializePlugin()
{
$this->domain = common_config('rsscloud', 'domain');
$this->port = common_config('rsscloud', 'port');
$this->path = common_config('rsscloud', 'path');
$this->funct = common_config('rsscloud', 'function');
$this->protocol = common_config('rsscloud', 'protocol');
// set defaults
$local_server = parse_url(common_path('main/rsscloud/request_notify'));
if (empty($this->domain)) {
$this->domain = $local_server['host'];
}
if (empty($this->port)) {
$this->port = '80';
}
if (empty($this->path)) {
$this->path = $local_server['path'];
}
if (empty($this->funct)) {
$this->funct = '';
}
if (empty($this->protocol)) {
$this->protocol = 'http-post';
}
}
示例2: onEndShowScripts
function onEndShowScripts($action)
{
$timeline = $this->_getTimeline($action);
// If there's not a timeline on this page,
// just return true
if (empty($timeline)) {
return true;
}
$base = $action->selfUrl();
if (mb_strstr($base, '?')) {
$url = $base . '&realtime=1';
} else {
$url = $base . '?realtime=1';
}
$scripts = $this->_getScripts();
foreach ($scripts as $script) {
$action->script($script);
}
$user = common_current_user();
if (!empty($user->id)) {
$user_id = $user->id;
} else {
$user_id = 0;
}
if ($action->boolean('realtime')) {
$realtimeUI = ' RealtimeUpdate.initPopupWindow();';
} else {
$pluginPath = common_path('plugins/Realtime/');
$realtimeUI = ' RealtimeUpdate.initActions("' . $url . '", "' . $timeline . '", "' . $pluginPath . '");';
}
$script = ' $(document).ready(function() { ' . $realtimeUI . $this->_updateInitialize($timeline, $user_id) . '}); ';
$action->inlineScript($script);
return true;
}
示例3: _getScripts
function _getScripts()
{
$scripts = parent::_getScripts();
$scripts[] = 'http://' . $this->webserver . ($this->webport == 80 ? '' : ':' . $this->webport) . '/meteor.js';
$scripts[] = common_path('plugins/Meteor/meteorupdater.js');
return $scripts;
}
示例4: handle
/**
* Class handler.
*
* @param array $args query arguments
*
* @return boolean false if user doesn't exist
*/
function handle($args)
{
parent::handle($args);
$type = $this->trimmed('type');
$short_name = '';
if ($type == 'people') {
$type = 'peoplesearch';
// TRANS: ShortName in the OpenSearch interface when trying to find users.
$short_name = _('People Search');
} else {
$type = 'noticesearch';
// TRANS: ShortName in the OpenSearch interface when trying to find notices.
$short_name = _('Notice Search');
}
header('Content-Type: application/opensearchdescription+xml');
$this->startXML();
$this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
$short_name = common_config('site', 'name') . ' ' . $short_name;
$this->element('ShortName', null, $short_name);
$this->element('Contact', null, common_config('site', 'email'));
$this->element('Url', array('type' => 'text/html', 'method' => 'get', 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
$this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
$this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png'));
$this->element('AdultContent', null, 'false');
$this->element('Language', null, common_language());
$this->element('OutputEncoding', null, 'UTF-8');
$this->element('InputEncoding', null, 'UTF-8');
$this->elementEnd('OpenSearchDescription');
$this->endXML();
}
示例5: showTagsDropdown
function showTagsDropdown()
{
$tag = $this->trimmed('tag');
$tags = $this->getAllTags();
$content = array();
foreach ($tags as $t) {
$content[$t] = $t;
}
if ($tags) {
$this->elementStart('dl', array('id' => 'filter_tags'));
$this->element('dt', null, _('Tags'));
$this->elementStart('dd');
$this->elementStart('ul');
$this->elementStart('li', array('id' => 'filter_tags_all', 'class' => 'child_1'));
$this->element('a', array('href' => common_local_url($this->trimmed('action'), array('nickname' => $this->target->getNickname()))), _m('TAGS', 'All'));
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'filter_tags_item'));
$this->elementStart('form', array('name' => 'bytag', 'id' => 'form_filter_bytag', 'action' => common_path('?action=' . $this->getActionName()), 'method' => 'post'));
$this->elementStart('fieldset');
// TRANS: Fieldset legend on gallery action page.
$this->element('legend', null, _('Select tag to filter'));
// TRANS: Dropdown field label on gallery action page for a list containing tags.
$this->dropdown('tag', _('Tag'), $content, _('Choose a tag to narrow list.'), false, $tag);
$this->hidden('nickname', $this->target->getNickname());
// TRANS: Submit button text on gallery action page.
$this->submit('submit', _m('BUTTON', 'Go'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
}
}
示例6: _getScripts
function _getScripts()
{
$scripts = parent::_getScripts();
$ours = array('jquery.comet.js', 'cometupdate.js');
foreach ($ours as $script) {
$scripts[] = common_path('plugins/Comet/' . $script);
}
return $scripts;
}
示例7: theme_path
/**
* Gets the full URL of a file in a theme dir based on its relative name
*
* @param string $relative relative path within the theme directory
* @param string $theme name of the theme; defaults to current theme
*
* @return string URL of the file
*/
function theme_path($relative, $theme = null)
{
if (!$theme) {
$theme = common_config('site', 'theme');
}
$server = common_config('theme', 'server');
if ($server) {
return 'http://' . $server . '/' . $theme . '/' . $relative;
} else {
return common_path('theme/' . $theme . '/' . $relative);
}
}
示例8: showContent
function showContent()
{
if (empty($this->user)) {
$this->element('p', array('class' => 'notespdf-generate-error'), _m('Login first!'));
} else {
$this->element('h2', null, 'Grupos Disponibles');
// Obtenemos los grupos a los que pertenece el usuario.
$groupsUser = $this->user->getGroups()->fetchAll();
// Si no pertenece a ninguno, le animamos a que se una a alguno de los existentes.
if (empty($groupsUser)) {
$this->elementStart('p', array('class' => 'notes-empty-groups'));
$this->raw("Todavía no perteneces a ningún grupo.");
$this->element('br');
$this->raw("Prueba uniéndote a alguno de los ");
$this->element('a', array('href' => common_root_url() . 'groups/'), "Grupos Disponibles");
$this->elementEnd('p');
} else {
// Obtenemos los grupos que contienen tweets puntuados.
$groupsGraded = Grades::getIDsGroupsWithGrades();
$this->elementStart('ul');
foreach ($groupsUser as $group) {
$this->elementStart('li', array('class' => 'notespdf-group-item'));
$avatar = $group->getAvatar();
$this->element('img', array('src' => $avatar, 'width' => '48', 'height' => '48'));
$this->elementStart('p');
$name = $group->getBestName();
$this->raw($name);
$this->elementEnd('p');
// Si el grupo no tiene puntuaciones no se pueden generar apuntes
if (!in_array($group->id, $groupsGraded)) {
$butGenerate = new Notesgroupsform($this, $group->id, 'true');
$butGenerate->show();
$this->elementStart('div');
$this->elementStart('p', array('class' => 'notes-error-group-text'));
$this->raw("No es posible generar apuntes. Grupo sin puntuaciones.");
$this->elementEnd('p');
$path = common_path('local/plugins/NotesPDF/css/x.gif');
$this->element('img', array('class' => 'notes-error-group', 'src' => $path));
$this->elementEnd('div');
} else {
$butGenerate = new Notesgroupsform($this, $group->id);
$butGenerate->show();
}
$this->elementEnd('li');
}
$this->elementEnd('ul');
}
}
}
示例9: handle
function handle()
{
$nick = $this->user->nickname;
$profile = $this->user->getProfile();
if (empty($this->xrd)) {
$xrd = new XRD();
} else {
$xrd = $this->xrd;
}
if (empty($xrd->subject)) {
$xrd->subject = self::normalize($this->uri);
}
if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) {
// Possible aliases for the user
$uris = array($this->user->uri, $profile->profileurl);
// FIXME: Webfinger generation code should live somewhere on its own
$path = common_config('site', 'path');
if (empty($path)) {
$uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server'));
}
foreach ($uris as $uri) {
if ($uri != $xrd->subject) {
$xrd->alias[] = $uri;
}
}
Event::handle('EndXrdActionAliases', array(&$xrd, $this->user));
}
if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) {
$xrd->links[] = array('rel' => self::PROFILEPAGE, 'type' => 'text/html', 'href' => $profile->profileurl);
// XFN
$xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11', 'type' => 'text/html', 'href' => $profile->profileurl);
// FOAF
$xrd->links[] = array('rel' => 'describedby', 'type' => 'application/rdf+xml', 'href' => common_local_url('foaf', array('nickname' => $nick)));
$xrd->links[] = array('rel' => 'http://apinamespace.org/atom', 'type' => 'application/atomsvc+xml', 'href' => common_local_url('ApiAtomService', array('id' => $nick)), 'property' => array(array('type' => 'http://apinamespace.org/atom/username', 'value' => $nick)));
if (common_config('site', 'fancy')) {
$apiRoot = common_path('api/', true);
} else {
$apiRoot = common_path('index.php/api/', true);
}
$xrd->links[] = array('rel' => 'http://apinamespace.org/twitter', 'href' => $apiRoot, 'property' => array(array('type' => 'http://apinamespace.org/twitter/username', 'value' => $nick)));
Event::handle('EndXrdActionLinks', array(&$xrd, $this->user));
}
if (common_config('discovery', 'cors')) {
header('Access-Control-Allow-Origin: *');
}
header('Content-type: application/xrd+xml');
print $xrd->toXML();
}
示例10: __construct
/**
* Constructor
*
* Determines the proper directory and path for this theme.
*
* @param string $name Name of the theme; defaults to config value
*/
function __construct($name = null)
{
if (empty($name)) {
$name = common_config('site', 'theme');
}
// Check to see if it's in the local dir
$localroot = self::localRoot();
$fulldir = $localroot . '/' . $name;
if (file_exists($fulldir) && is_dir($fulldir)) {
$this->dir = $fulldir;
$this->path = common_path('local/theme/' . $name . '/');
return;
}
// Check to see if it's in the distribution dir
$instroot = self::installRoot();
$fulldir = $instroot . '/' . $name;
if (file_exists($fulldir) && is_dir($fulldir)) {
$this->dir = $fulldir;
$path = common_config('theme', 'path');
if (empty($path)) {
$path = common_config('site', 'path') . '/theme/';
}
if ($path[strlen($path) - 1] != '/') {
$path .= '/';
}
if ($path[0] != '/') {
$path = '/' . $path;
}
$server = common_config('theme', 'server');
if (empty($server)) {
$server = common_config('site', 'server');
}
$ssl = common_config('theme', 'ssl');
if (is_null($ssl)) {
// null -> guess
if (common_config('site', 'ssl') == 'always' && !common_config('theme', 'server')) {
$ssl = true;
} else {
$ssl = false;
}
}
$protocol = $ssl ? 'https' : 'http';
$this->path = $protocol . '://' . $server . $path . $name;
}
}
示例11: showProviders
function showProviders(array $providers)
{
$out = $this->out;
$out->elementStart('div', 'provider-list');
// TRANS: Heading for feed mirroring selection form.
$out->element('h2', null, _m('Select a feed provider'));
$out->elementStart('table');
foreach ($providers as $provider) {
$icon = common_path('plugins/SubMirror/images/providers/' . $provider['id'] . '.png');
$targetUrl = common_local_url('mirrorsettings', array('provider' => $provider['id']));
$out->elementStart('tr', array('class' => 'provider'));
$out->elementStart('td');
$out->elementStart('div', 'provider-heading');
$out->element('img', array('src' => $icon));
$out->element('a', array('href' => $targetUrl), $provider['name']);
$out->elementEnd('div');
$out->elementEnd('td');
$out->elementEnd('tr');
}
$out->elementEnd('table');
$out->elementEnd('div');
}
示例12: handle
/**
* Handle request
*
* This is the main method for handling a request. Note that
* most preparation should be done in the prepare() method;
* by the time handle() is called the action should be
* more or less ready to go.
*
* @param array $args $_REQUEST args; handled in prepare()
*
* @return void
*/
function handle($args)
{
parent::handle($args);
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
return;
}
$file = basename($this->trimmed('filename'));
$url = common_path() . 'local/plugins/Guia/files/';
$dir = substr($_SERVER['SCRIPT_FILENAME'], 0, -9) . 'local/plugins/Guia/files/';
$pathURL = $url . $file;
$pathDIR = $dir . $file;
if (is_file($pathDIR)) {
// Definir headers
header("Content-type: application/pdf");
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . $file . "\"");
readfile($pathURL);
} else {
die("El archivo no existe.");
}
}
示例13: updateXRD
public function updateXRD(XML_XRD $xrd)
{
if (Event::handle('StartWebFingerProfileLinks', array($xrd, $this->object))) {
$xrd->links[] = new XML_XRD_Element_Link(self::PROFILEPAGE, $this->object->getUrl(), 'text/html');
// XFN
$xrd->links[] = new XML_XRD_Element_Link('http://gmpg.org/xfn/11', $this->object->getUrl(), 'text/html');
// FOAF
$xrd->links[] = new XML_XRD_Element_Link('describedby', common_local_url('foaf', array('nickname' => $this->object->nickname)), 'application/rdf+xml');
$link = new XML_XRD_Element_Link('http://apinamespace.org/atom', common_local_url('ApiAtomService', array('id' => $this->object->nickname)), 'application/atomsvc+xml');
// XML_XRD must implement changing properties first $link['http://apinamespace.org/atom/username'] = $this->object->nickname;
$xrd->links[] = clone $link;
if (common_config('site', 'fancy')) {
$apiRoot = common_path('api/', true);
} else {
$apiRoot = common_path('index.php/api/', true);
}
$link = new XML_XRD_Element_Link('http://apinamespace.org/twitter', $apiRoot);
// XML_XRD must implement changing properties first $link['http://apinamespace.org/twitter/username'] = $this->object->nickname;
$xrd->links[] = clone $link;
Event::handle('EndWebFingerProfileLinks', array($xrd, $this->object));
}
}
示例14: cssLink
/**
* output a css link
*
* @param string $src relative path within the theme directory, or an absolute path
* @param string $theme 'theme' that contains the stylesheet
* @param string media 'media' attribute of the tag
*
* @return void
*/
function cssLink($src, $theme = null, $media = null)
{
if (Event::handle('StartCssLinkElement', array($this, &$src, &$theme, &$media))) {
$url = parse_url($src);
if (empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) {
if (file_exists(Theme::file($src, $theme))) {
$src = Theme::path($src, $theme);
} else {
$src = common_path($src, GNUsocial::isHTTPS());
}
$src .= '?version=' . GNUSOCIAL_VERSION;
}
$this->element('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $src, 'media' => $media));
Event::handle('EndCssLinkElement', array($this, $src, $theme, $media));
}
}
示例15: showContent
function showContent()
{
$this->elementStart('a', array('href' => common_local_url('twitterauthorization', null, array('signin' => true))));
$this->element('img', array('src' => common_path('plugins/TwitterBridge/Sign-in-with-Twitter-lighter.png'), 'alt' => 'Sign in with Twitter'));
$this->elementEnd('a');
}