• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Alias类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Alias的典型用法代码示例。如果您正苦于以下问题:PHP Alias类的具体用法?PHP Alias怎么用?PHP Alias使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Alias类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: GetURL

 public static function GetURL($p_publicationId, $p_languageId = null, $p_issueNo = null, $p_sectionNo = null, $p_articleNo = NULL, $p_port = null)
 {
     global $g_ado_db;
     global $_SERVER;
     if (is_null($p_port)) {
         if (!isset($_SERVER['SERVER_PORT'])) {
             $_SERVER['SERVER_PORT'] = 80;
         }
         $p_port = $_SERVER['SERVER_PORT'];
     }
     $publicationObj = new Publication($p_publicationId);
     if (!$publicationObj->exists()) {
         return new PEAR_Error(getGS('Publication does not exist.'));
     }
     if (!isset($p_languageId)) {
         $p_languageId = $publicationObj->getDefaultLanguageId();
     }
     $scheme = $_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://';
     $defaultAlias = new Alias($publicationObj->getDefaultAliasId());
     $uri = ShortURL::GetURI($p_publicationId, $p_languageId, $p_issueNo, $p_sectionNo, $p_articleNo);
     if (!is_string($uri) && PEAR::isError($uri)) {
         return $uri;
     }
     return $scheme . $defaultAlias->getName() . $uri;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:25,代码来源:ShortURL.php


示例2: postProcess

 public function postProcess()
 {
     if (isset($_POST['submitAdd' . $this->table])) {
         $search = strval(Tools::getValue('search'));
         $string = strval(Tools::getValue('alias'));
         $aliases = explode(',', $string);
         if (empty($search) or empty($string)) {
             $this->_errors[] = $this->l('aliases and result are both required');
         }
         if (!Validate::isValidSearch($search)) {
             $this->_errors[] = $search . ' ' . $this->l('is not a valid result');
         }
         foreach ($aliases as $alias) {
             if (!Validate::isValidSearch($alias)) {
                 $this->_errors[] = $alias . ' ' . $this->l('is not a valid alias');
             }
         }
         if (!sizeof($this->_errors)) {
             foreach ($aliases as $alias) {
                 $obj = new Alias(NULL, trim($alias), trim($search));
                 $obj->save();
             }
         }
     } else {
         parent::postProcess();
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:27,代码来源:AdminAliases.php


示例3: getDefaultSiteName

 protected function getDefaultSiteName()
 {
     $defaultAlias = new Alias($this->m_dbObject->getDefaultAliasId());
     if (!$defaultAlias->exists()) {
         return null;
     }
     $subdir = CampConfig::singleton()->getSetting('SUBDIR');
     return $defaultAlias->getName() . $subdir;
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:9,代码来源:MetaPublication.php


示例4: setUrl

 public function setUrl($url)
 {
     if ($url != $this->val('alias_url')) {
         $a = new Alias($this->db);
         $url = Alias::generateAliasUrl(myTrim($url));
         $new_url = $url;
         $a->loadByUrl($new_url);
         $counter = 0;
         while ($a->is_loaded && $a->val('alias_id') != $this->val('alias_id')) {
             $counter += 1;
             $new_url = $url . '-' . $counter;
             $a->loadByUrl($new_url);
         }
         $this->data['alias_url'] = $new_url;
     }
 }
开发者ID:lotcz,项目名称:zshop,代码行数:16,代码来源:alias.m.php


示例5: camp_is_alias_conflicting

/**
 * Check if the alias given is already in use.  If so, a user error message
 * is created.
 *
 * @param mixed $p_alias
 * 		Can be a string or an int.
 * @return void
 */
function camp_is_alias_conflicting($p_alias)
{
	global $ADMIN;

	if (!is_numeric($p_alias)) {
		// The alias given is a name, which means it doesnt exist yet.
		// Check if the name conflicts with any existing alias names.
		$aliases = Alias::GetAliases(null, null, $p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubId = $alias->getPublicationId();
			$pubObj = new Publication($pubId);
			$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=$pubId\">". $pubObj->getName() ."</A>";
			$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
			camp_html_add_msg($msg);
		}
	} else {
		// The alias given is a number, which means it already exists.
		// Check if the alias ID is already in use by another publication.
		$aliases = Alias::GetAliases($p_alias);
		$alias = array_pop($aliases);
		if ($alias) {
			$pubs = Publication::GetPublications(null, $alias->getId());
			if (count($pubs) > 0) {
				$pubObj = array_pop($pubs);
				$pubLink = "<A HREF=\"/$ADMIN/pub/edit.php?Pub=".$pubObj->getPublicationId().'">'. $pubObj->getName() ."</A>";
				$msg = getGS("The publication alias you specified conflicts with publication '$1'.", $pubLink);
				camp_html_add_msg($msg);
			}
		}
	}
}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:40,代码来源:pub_common.php


示例6: camp_is_alias_conflicting

/**
 * Check if the alias given is already in use.  If so, a user error message
 * is created.
 *
 * @param mixed $p_alias
 * 		Can be a string or an int.
 * @return void
 */
function camp_is_alias_conflicting($p_alias)
{
    global $ADMIN;
    $translator = \Zend_Registry::get('container')->getService('translator');
    if (!is_numeric($p_alias)) {
        // The alias given is a name, which means it doesnt exist yet.
        // Check if the name conflicts with any existing alias names.
        $aliases = Alias::GetAliases(null, null, $p_alias);
        $alias = array_pop($aliases);
        if ($alias) {
            $pubId = $alias->getPublicationId();
            $pubObj = new Publication($pubId);
            $pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub={$pubId}\">" . $pubObj->getName() . "</A>";
            $msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
            camp_html_add_msg($msg);
        }
    } else {
        // The alias given is a number, which means it already exists.
        // Check if the alias ID is already in use by another publication.
        $aliases = Alias::GetAliases($p_alias);
        $alias = array_pop($aliases);
        if ($alias) {
            $pubs = Publication::GetPublications(null, $alias->getId());
            if (count($pubs) > 0) {
                $pubObj = array_pop($pubs);
                $pubLink = "<A HREF=\"/{$ADMIN}/pub/edit.php?Pub=" . $pubObj->getPublicationId() . '">' . $pubObj->getName() . "</A>";
                $msg = $translator->trans("The publication alias you specified conflicts with publication '\$1'.", array('$1' => $pubLink), 'pub');
                camp_html_add_msg($msg);
            }
        }
    }
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:40,代码来源:pub_common.php


示例7: config

 private static function config()
 {
     Config::set('app.module.dir', __DIR__);
     Config::set('app.module.dirstorage', __DIR__ . DS . 'storage');
     lib('app');
     Alias::facade('Run', 'AppLib', 'Thin');
     Run::makeInstance();
     Config::set('directory.store', STORAGE_PATH);
 }
开发者ID:schpill,项目名称:blog,代码行数:9,代码来源:Bootstrap.php


示例8: applyAliasMulti

 function applyAliasMulti($values, $assoc)
 {
     $_this =& Alias::getInstance();
     foreach ($assoc as $key => $type) {
         if (isset($values[$key])) {
             $values[$key] = $_this->applyAlias($values[$key], $type);
         }
     }
     return $values;
 }
开发者ID:kevthunder,项目名称:cake-shop,代码行数:10,代码来源:alias.php


示例9: display_page_content

function display_page_content()
{
    ?>
	
				
	<div id="edit-header" class="aliasnav">
		<h1>Alias List</h1>
	</div>
	
	<p><strong>An Alias</strong> is a meta-redirect &ndash; one address can forward to another. In the first column are your current redirect addresses, and in the second column is the page/event/blog post/etc... that the alias will redirect to. </p>
	
<?php 
    $alias = Alias::FindAll();
    if (count($alias) > 0) {
        ?>
			
	<div id="table-header" class="alias">
		<strong class="item-link">Alias Link</strong>
		<span class="item-filename">Alias Destination</span>
		<span class="item-viewlink">Test the Alias</span>
	</div>
	
	<ul class="managelist"> 
<?php 
        foreach ($alias as $entry) {
            $slash = "/";
            if (substr($entry->alias, 0, 1) == "/") {
                $slash = "";
            }
            ?>

		<li>
			<a class="item-link" href="<?php 
            echo get_link("/admin/alias_edit/" . $entry->id);
            ?>
"><?php 
            echo SITE_URL . $slash . $entry->alias;
            ?>
</a>
			<span class="item-filename"><?php 
            echo $entry->path;
            ?>
</span>
			<span class="item-viewlink"><a href="<?php 
            echo "http://" . SITE_URL . $slash . $entry->alias;
            ?>
" target="_blank">Open</a></span>
		</li>
<?php 
        }
        echo "</ul>\n";
    } else {
        echo "<h3 class=\"empty-list\">There are no Alias' to edit. <a href=\"" . get_link("admin/alias_add") . "\">Please add one</a>. </h3>";
    }
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:55,代码来源:alias_list.php


示例10: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $db = Doctrine_Manager::connection();
     $q = LsDoctrineQuery::create()->from('Entity e')->leftJoin('e.Alias a')->where('NOT EXISTS( SELECT id FROM alias a WHERE a.entity_id = e.id AND a.context IS NULL AND a.name = e.name)')->limit($options['limit']);
     foreach ($q->execute() as $entity) {
         try {
             $db->beginTransaction();
             $primary = $entity->primary_ext;
             if ($primary == 'Person') {
                 $name = $entity->getExtensionObject('Person')->getFullName(false, $filterSuffix = true);
                 //change entity name
                 $entity->setEntityField('name', $name);
                 $entity->save();
             } else {
                 $name = $entity->rawGet('name');
             }
             //create primary Alias
             $a = new Alias();
             $a->Entity = $entity;
             $a->name = $name;
             $a->is_primary = true;
             $a->save();
             //create another Alias if there's a nickname
             if ($primary == 'Person' && $entity->name_nick) {
                 $a = new Alias();
                 $a->Entity = $entity;
                 $a->name = $primary == 'Person' ? $entity->name_nick . ' ' . $entity->name_last : $entity->name_nick;
                 $a->is_primary = false;
                 $a->save();
             }
             $db->commit();
         } catch (Exception $e) {
             $db->rollback();
             throw $e;
         }
     }
     LsCli::beep();
 }
开发者ID:silky,项目名称:littlesis,代码行数:41,代码来源:GenerateNamesTask.class.php


示例11: getAliases

    public function getAliases()
    {
        if (!Alias::isFeatureActive()) {
            return '';
        }
        $aliases = Db::getInstance()->executeS('
		SELECT a.alias
		FROM `' . _DB_PREFIX_ . 'alias` a
		WHERE `search` = \'' . pSQL($this->search) . '\'');
        $aliases = array_map('implode', $aliases);
        return implode(', ', $aliases);
    }
开发者ID:NathanGiesbrecht,项目名称:PrestaShopAutomationFramework,代码行数:12,代码来源:Alias.php


示例12: delete

 /**
  * Delete the publication and all of its aliases.
  *
  * @return boolean
  */
 public function delete()
 {
     $aliases = Alias::GetAliases(null, $this->m_data['Id']);
     if ($aliases && count($aliases) > 0) {
         foreach ($aliases as $alias) {
             $alias->delete();
         }
     }
     $tmpData = $this->m_data;
     $deleted = parent::delete();
     return $deleted;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:17,代码来源:Publication.php


示例13: testToArray

 public function testToArray()
 {
     $alias = new Alias();
     $alias->setName('name');
     $alias->setDescription('description');
     $alias->setPackage('bootstrap');
     $alias->setVersion('version');
     $alias->setSource('source');
     $this->assertSame(['name' => 'name', 'description' => 'description', 'package' => 'bootstrap', 'version' => 'version', 'source' => 'source'], $alias->toArray());
 }
开发者ID:raphhh,项目名称:samurai,代码行数:10,代码来源:AliasTest.php


示例14: smarty_function_set_publication

/**
 * Campsite set_publication function plugin
 *
 * Type:     function
 * Name:     set_publication
 * Purpose:
 *
 * @param array
 *     $p_params[name] The Name of the publication to be set
 *     $p_params[identifier] The Identifier of the publication to be set
 * @param object
 *     $p_smarty The Smarty object
 */
function smarty_function_set_publication($p_params, &$p_smarty)
{
    // gets the context variable
    $campsite = $p_smarty->getTemplateVars('gimme');
    if (isset($p_params['identifier'])) {
        $attrName = 'identifier';
        $attrValue = $p_params['identifier'];
        $publicationId = intval($p_params['identifier']);
    } elseif (isset($p_params['name'])) {
        $attrName = 'name';
        $attrValue = $p_params['name'];
        $publications = Publication::GetPublications($p_params['name']);
        if (!empty($publications)) {
            $publicationId = $publications[0]->getPublicationId();
        } else {
            $campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
            return false;
        }
    } elseif (isset($p_params['alias'])) {
        $aliasObj = new Alias($p_params['alias']);
        if (!$aliasObj->exists()) {
            $campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
            return false;
        }
        $publicationId = $aliasObj->getPublicationId();
    } else {
        $property = array_shift(array_keys($p_params));
        CampTemplate::singleton()->trigger_error("invalid parameter '{$property}' in set_publication");
        return false;
    }
    if ($campsite->publication->defined && $campsite->publication->identifier == $publicationId) {
        return;
    }
    $publicationObj = new MetaPublication($publicationId);
    if ($publicationObj->defined) {
        $campsite->publication = $publicationObj;
    } else {
        $campsite->publication->trigger_invalid_value_error($attrName, $attrValue, $p_smarty);
    }
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:53,代码来源:function.set_publication.php


示例15: import

 public function import($school)
 {
     if (EntityTable::getByExtensionQuery('Org')->addWhere('LOWER(org.name) LIKE ?', '%' . strtolower($school->instnm) . "%")->fetchOne()) {
         $this->printDebug("School exists in database: " . $school->instnm);
     } else {
         $address = new Address();
         $address->street1 = isset($school->addr) ? $school->addr : null;
         $address->street2 = isset($school->street2) ? $school->street2 : null;
         $address->city = $school->city;
         if ($state = AddressStateTable::retrieveByText($school->stabbr)) {
             $address->State = $state;
         }
         $address->postal = $school->zip;
         $aliases = explode("|", $school->ialias);
         $website = null;
         if (!preg_match('/^http\\:\\/\\//i', trim($school->webaddr))) {
             $website = "http://" . strtolower($school->webaddr);
         }
         $this->printDebug($website);
         $newschool = new Entity();
         $newschool->addExtension('Org');
         $newschool->addExtension('School');
         $newschool->name = $school->instnm;
         $newschool->website = $website;
         $newschool->addAddress($address);
         $newschool->save();
         foreach ($aliases as $alias) {
             try {
                 $newalias = new Alias();
                 $newalias->Entity = $newschool;
                 $newalias->name = $alias;
                 $newalias->save();
             } catch (Exception $e) {
                 $this->printDebug("An alias exception. No biggie. It's most likely that the name already exists. so we ignore it and move on: " . $e);
             }
         }
         $this->printDebug("Adding new school: " . $school->instnm);
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:39,代码来源:SchoolScraper.class.php


示例16: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $db = Doctrine_Manager::connection();
     //CREATE NEW PRIMARY ALIASES
     $q = Doctrine_Query::create()->from('Entity e')->where('NOT EXISTS (SELECT id FROM Alias a WHERE a.entity_id = e.id AND a.is_primary = ?)', true)->limit($options['limit']);
     foreach ($q->fetchArray() as $entity) {
         $a = new Alias();
         $a->name = $entity['name'];
         $a->is_primary = true;
         $a->entity_id = $entity['id'];
         $a->save(false);
     }
     //REMOVE DUPLIATE PRIMARY ALIASES
     $q = Doctrine_Query::create()->from('Alias a1')->where('a1.is_primary = ?', true)->andWhere('EXISTS (SELECT a2.id FROM Alias a2 WHERE a1.entity_id = a2.entity_id AND a2.is_primary = ? AND a1.id > a2.id)', true);
     foreach ($q->execute() as $alias) {
         $alias->delete();
     }
     //DONE
     LsCli::beep();
 }
开发者ID:silky,项目名称:littlesis,代码行数:23,代码来源:CleanupPrimaryAliasesTask.class.php


示例17: index

 public function index()
 {
     if (!empty($this->request->data['Admin']['icon'])) {
         $this->_saveFavicon();
     }
     if (!empty($this->request->data['Admin']['export'])) {
         $this->SiteExport->_exportSite($this->request->data['Admin']['export']);
     }
     if (!empty($this->request->data['Upgrade']['all'])) {
         $this->SiteUpdate->_runUpdates();
         $this->set('runUpdates', true);
     }
     if (!empty($this->request->data['Update']['index'])) {
         $this->view = 'index_upgrade';
     }
     if (!empty($this->request->data['Alias']['update'])) {
         App::uses('Alias', 'Model');
         $Alias = new Alias();
         $this->set('syncd', $Alias->sync());
         $this->view = 'index_upgrade';
     }
     $complete = $this->Session->read('Updates.complete');
     if (!empty($complete)) {
         $this->Session->delete('Updates');
         $this->Session->setFlash(__('Update check complete!!!'), 'flash_success');
     }
     $this->set('title_for_layout', 'Admin Dashboard');
     $this->set('page_title_for_layout', 'Admin Dashboard');
     $this->layout = 'default';
     // this is here so we can show "Add Post" links foreach Blog on the dashboard
     if (CakePlugin::loaded('Blogs')) {
         App::uses('Blog', 'Blogs.Model');
         $Blog = new Blog();
         $this->set('blogs', $Blog->find('all'));
     }
 }
开发者ID:ayaou,项目名称:Zuha,代码行数:36,代码来源:AdminController.php


示例18: init

 public static function init($cli)
 {
     register_shutdown_function(['\\Thin\\Bootstrap', 'finish']);
     Timer::start();
     lib('app');
     forever();
     $storage_dir = STORAGE_PATH;
     if (!is_writable(STORAGE_PATH)) {
         die('Please give 0777 right to ' . STORAGE_PATH);
     }
     if (!is_dir(CACHE_PATH)) {
         File::mkdir(CACHE_PATH);
     }
     $dir = APPLICATION_PATH;
     Config::set('app.module.dir', APPLICATION_PATH);
     Config::set('mvc.dir', APPLICATION_PATH);
     Config::set('app.module.dirstorage', $dir . DS . 'storage');
     Config::set('app.module.assets', $dir . DS . 'assets');
     Config::set('app.module.config', $dir . DS . 'config');
     Config::set('dir.raw.store', $storage_dir . DS . 'db');
     Config::set('dir.ardb.store', $storage_dir . DS . 'db');
     Config::set('dir.ephemere', $storage_dir . DS . 'ephemere');
     Config::set('dir.flight.store', $storage_dir . DS . 'flight');
     Config::set('dir.flat.store', $storage_dir . DS . 'flat');
     Config::set('dir.cache.store', $storage_dir . DS . 'cache');
     Config::set('dir.nosql.store', $storage_dir . DS . 'nosql');
     Config::set('dir.module.logs', $storage_dir . DS . 'logs');
     path('module', $dir);
     path('pages', $dir . DS . 'app' . DS . 'pages');
     path('layouts', $dir . DS . 'app' . DS . 'layouts');
     path('store', $storage_dir);
     path('config', Config::get('app.module.config'));
     path('cache', CACHE_PATH);
     loaderProject('entity');
     loaderProject('system');
     Alias::facade('DB', 'EntityProject', 'Thin');
     Alias::facade('System', 'SystemProject', 'Thin');
     System::Db()->firstOrCreate(['name' => SITE_NAME]);
     require_once path('config') . DS . 'application.php';
     if (!$cli) {
         if (fnmatch('*/mytests', $_SERVER['REQUEST_URI'])) {
             self::tests();
         } else {
             self::router();
         }
     }
 }
开发者ID:schpill,项目名称:jsoncms,代码行数:47,代码来源:index.php


示例19: init

 public static function init()
 {
     $oquery = urldecode(substr($_SERVER['REQUEST_URI'], 1));
     $p = explode('?', $oquery, 2);
     $query = $p[0];
     $newurl = Alias::get($query);
     if ($newurl) {
         if (!empty($p[1])) {
             $newurl .= '?' . $p[1];
         }
         if ($newurl === $oquery) {
             return;
         }
         header('Location: /' . $newurl, true, 301);
         exit;
     }
 }
开发者ID:infrajs,项目名称:urlalias,代码行数:17,代码来源:Alias.php


示例20: checkAlias

 function checkAlias($name)
 {
     $aliases = Alias::FindBySql('alias', "SELECT * FROM alias WHERE path LIKE '/{$name}%' OR path LIKE '{$name}%'");
     if (count($aliases)) {
         foreach ($aliases as $alias) {
             $pathParts = explode("/", $alias->path);
             if (substr($alias->path, 0, 1) == "/") {
                 $path = "/{$this->name}/" . $pathParts[2];
             } else {
                 $path = "/{$this->name}/" . $pathParts[1];
             }
             $alias->path = $path;
             $alias->save();
         }
     }
     return false;
 }
开发者ID:highchair,项目名称:hcd-trunk,代码行数:17,代码来源:area.php



注:本文中的Alias类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AlipayNotify类代码示例发布时间:2022-05-23
下一篇:
PHP Alert类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap