当前位置: 首页>>代码示例>>PHP>>正文


PHP Alias类代码示例

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


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


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