本文整理汇总了PHP中Item类的典型用法代码示例。如果您正苦于以下问题:PHP Item类的具体用法?PHP Item怎么用?PHP Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: output
function output($message = null, $allowHtml = false, $addslashes = false)
{
$message = preg_replace('/\\%name\\%/', $this->Session->read('Game.Character.name'), $message);
$message = preg_replace('/\\%class\\%/', $this->Session->read('Game.Type.name'), $message);
$message = preg_replace('/\\%hisher\\%/', 'his', $message);
if ($allowHtml != true) {
$message = htmlspecialchars($message);
}
/* Items */
preg_match_all('/\\[item\\](.*?)\\[\\/item\\]/', $message, $items);
if (isset($items[1]) && !empty($items[1])) {
// Laat de makers het niet zien...
App::import('Model', 'Item');
$Item = new Item();
$Item->contain();
$items = $Item->find('all', array('fields' => array('Item.id', 'Item.name', 'Item.quality'), 'conditions' => array('Item.name' => $items[1])));
foreach ($items as $item) {
$message = str_replace('[item]' . $item['Item']['name'] . '[/item]', '<span class="item_' . $item['Item']['quality'] . '" onmouseover="showMouseInfo(url + \'items/view/' . addslashes($item['Item']['name']) . '\');" onmouseout="hideMouseInfo();">[' . addslashes($item['Item']['name']) . ']</span>', $message);
}
}
// Quests
preg_match_all('/\\[quest\\](.*?)\\[\\/quest\\]/', $message, $quests);
if (isset($quests[1]) && !empty($quests[1])) {
foreach ($quests[1] as $quest) {
$message = str_replace('[quest]' . $quest . '[/quest]', '<span class="quest" onmouseover="showMouseInfo(url + \'quests/view/' . $quest . '\');" onmouseout="hideMouseInfo();">' . htmlspecialchars($quest) . '</span>', $message);
}
}
if ($addslashes === true) {
$message = addslashes($message);
}
return $message;
}
开发者ID:MortalROs,项目名称:Naxasius-Game-Engine,代码行数:32,代码来源:ubb.php
示例2: renderComments
/**
* Render comments and respond form html.
*
* @param AppView $view The view the comments are rendered on
* @param Item $item The item whos comments are rendered
*
* @return string The html output
*
* @since 2.0
*/
public function renderComments($view, $item)
{
if ($item->getApplication()->isCommentsEnabled()) {
// get application params
$params = $this->app->parameter->create($item->getApplication()->getParams()->get('global.comments.'));
if ($params->get('twitter_enable') && !function_exists('curl_init')) {
$this->app->error->raiseWarning(500, JText::_('To use Twitter, CURL needs to be enabled in your php settings.'));
$params->set('twitter_enable', false);
}
// get active author
$active_author = $this->activeAuthor();
// get comment content from session
$content = $this->app->system->session->get('com_zoo.comment.content');
$params->set('content', $content);
// get comments and build tree
$comments = $item->getCommentTree(Comment::STATE_APPROVED);
// build captcha
$captcha = false;
if ($plugin = $params->get('captcha', false) and (!$params->get('captcha_guest_only', 0) or !$this->app->user->get()->id)) {
$captcha = JCaptcha::getInstance($plugin);
}
if ($item->isCommentsEnabled() || count($comments) - 1) {
// create comments html
return $view->partial('comments', compact('item', 'active_author', 'comments', 'params', 'captcha'));
}
}
return null;
}
开发者ID:NavaINT1876,项目名称:ccustoms,代码行数:38,代码来源:comment.php
示例3: addChild
public function addChild($title)
{
$child = new Item($title);
$child->setParent($this);
$this->children[] = $child;
return $child;
}
开发者ID:doostan,项目名称:menu,代码行数:7,代码来源:Item.php
示例4: testGetTypeDir
public function testGetTypeDir()
{
$storage = $this->getMock('Newscoop\\Storage', array('isDir'), array(''));
$storage->expects($this->once())->method('isDir')->with($this->equalTo('item'))->will($this->returnValue(TRUE));
$item = new Item('item', $storage);
$this->assertEquals('dir', $item->getType());
}
开发者ID:nidzix,项目名称:Newscoop,代码行数:7,代码来源:ItemTest.php
示例5: testGetCreationTime
/**
* Test right the execution of an item callback.
*
* @covers ::__construct
* @covers ::getCreationTime
* @return void
*/
public function testGetCreationTime()
{
$item = new Item(function ($string) {
return strtolower($string);
}, 'HoLa MuNdo');
$this->assertNotNull($item->getCreationTime());
}
开发者ID:BD-ES,项目名称:Q,代码行数:14,代码来源:ItemTest.php
示例6: setItem
/**
* @param Item $item
*
* @return Type
*/
public function setItem(Item $item)
{
if ($this->item !== $item) {
$this->item = $item->setType($this);
}
return $this;
}
开发者ID:anime-db,项目名称:catalog-bundle,代码行数:12,代码来源:Type.php
示例7: load
public static function load($name, $options = array())
{
$db = Settings::getProtected('db');
$auth = Settings::getProtected('auth');
$auth->forceAuthentication();
$username = $auth->getUsername();
if (array_key_exists('include-removed', $options) && $options['include-removed'] == true) {
$includeRemoved = true;
} else {
$includeRemoved = false;
}
$items = array();
$results = $db->loadQueue($name, $includeRemoved);
if (strpos($name, 'proof') != false) {
$type = 'proof';
} else {
if (strpos($name, 'review') != false) {
$type = 'review';
}
}
foreach ($results as $result) {
$itemID = $result['item_id'];
$projectID = $result['project_id'];
$item = new Item($db);
$item->loadWithProjectID($itemID, $projectID, $username, $type);
array_push($items, $item);
}
return $items;
}
开发者ID:hmmbug,项目名称:unbindery,代码行数:29,代码来源:QueueController.class.php
示例8: details
function details()
{
global $smarty;
$item = new dogma($this->typeID);
if (!$item->isValid()) {
$this->page->setTitle('Error');
return 'This ID is not a valid dogma ID.';
}
$this->page->setTitle('Item details - ' . $item->get('typeName'));
$this->page->addHeader('<meta name="robots" content="noindex, nofollow" />');
$smarty->assignByRef('item', $item);
if ($item->get('itt_cat') == 6) {
//we have a ship, so get it from the db
$ship = Ship::getByID($item->get('typeID'));
$smarty->assign('shipImage', $ship->getImage(64));
$smarty->assign('armour', array('armorHP', 'armorEmDamageResonance', 'armorExplosiveDamageResonance', 'armorKineticDamageResonance', 'armorThermalDamageResonance'));
$smarty->assign('shield', array('shieldCapacity', 'shieldRechargeRate', 'shieldEmDamageResonance', 'shieldExplosiveDamageResonance', 'shieldKineticDamageResonance', 'shieldThermalDamageResonance'));
$smarty->assign('propulsion', array('maxVelocity', 'agility', 'droneCapacity', 'capacitorCapacity', 'rechargeRate'));
$smarty->assign('fitting', array('hiSlots', 'medSlots', 'lowSlots', 'rigSlots', 'upgradeCapacity', 'droneBandwidth', 'launcherSlotsLeft', 'turretSlotsLeft', 'powerOutput', 'cpuOutput'));
$smarty->assign('targetting', array('maxTargetRange', 'scanResolution', 'maxLockedTargets', 'scanRadarStrength', 'scanLadarStrength', 'scanMagnetometricStrength', 'scanGravimetricStrength', 'signatureRadius'));
$smarty->assign('miscellaneous', array('techLevel', 'propulsionFusionStrength', 'propulsionIonStrength', 'propulsionMagpulseStrength', 'propulsionPlasmaStrength'));
$html = $smarty->fetch(get_tpl('invtype_ship'));
} else {
$i = new Item($this->typeID);
$smarty->assign('itemImage', $i->getIcon(64, false));
$smarty->assign('akey', session::isAdmin() ? session::makeKey() : false);
$html = $smarty->fetch(get_tpl('invtype_item'));
}
return $html;
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:30,代码来源:invtype.php
示例9: fromJson
public static function fromJson($json)
{
$r = new Item();
$r->setId($json->id);
$r->setSku($json->sku);
return $r;
}
开发者ID:purchased-at,项目名称:sdk-php,代码行数:7,代码来源:Item.php
示例10: __construct
/**
* Constructor
* @param Element|String $element
* @param Item $item
* @param array $options
*/
function __construct($element, Item $item = null, $options = array())
{
// get Zoo app
$this->app = App::getInstance('zoo');
// set inner vars
if (isset($options['elementId'])) {
$this->_identifier = $options['elementId'];
$this->_item = $item;
$this->_element = $this->_item->getElement($this->_identifier);
} else {
if (is_object($element)) {
$this->_element = $element;
$this->_item = $element->getItem();
$this->_identifier = $element->identifier;
} else {
$this->_identifier = $element;
}
}
// set repeatable flag
if (is_object($this->_element) && is_subclass_of($this->_element, 'ElementRepeatable')) {
$this->_isRepeatable = true;
}
// set Item object
if (!$this->_item && $item) {
$this->_item = $item;
}
// get current value for export)
if ($this->_item && $this->_identifier && isset($this->_item->elements[$this->_identifier])) {
$this->_value = $this->_item->elements[$this->_identifier];
}
$this->_config = JBModelConfig::model();
$this->_exportParams = $this->_config->getGroup('export.items', array());
$this->_importParams = $this->_config->getGroup('import.items', array());
$this->_lastImportParams = $this->_config->getGroup('import.last.items', array());
}
开发者ID:alexmixaylov,项目名称:real,代码行数:41,代码来源:item.php
示例11: AddItem
/**
* Adds an item
* @param Item $rssItem The rss item
* @param bool $useCDATA Wrap description with CDATA
*/
private function AddItem(Item $rssItem, $useCDATA = true)
{
$itemEl = $this->domDoc->createElement("item");
if ($rssItem->Title != null) {
$this->AppendTextChild($itemEl, "title", $rssItem->Title);
}
if ($rssItem->Link != null) {
$this->AppendTextChild($itemEl, "link", $rssItem->Link);
}
if ($rssItem->Description != null) {
if ($useCDATA) {
$this->AppendCDATAChild($itemEl, "description", $rssItem->Description);
} else {
$this->AppendTextChild($itemEl, "description", $rssItem->Description);
}
}
if ($rssItem->GetPubDate() != null) {
$this->AppendTextChild($itemEl, "pubDate", $rssItem->GetPubDate()->ToString(\DATE_RSS));
}
if ($rssItem->Author != null) {
$this->AppendTextChild($itemEl, "author", $rssItem->Author);
}
if ($rssItem->Comments != null) {
$this->AppendTextChild($itemEl, "comments", $rssItem->Comments);
}
if ($rssItem->Guid != null) {
$this->AppendTextChild($itemEl, "guid", $rssItem->Guid);
}
//objects
$this->AddCategory($itemEl, $rssItem->GetCategory());
$this->AddSource($itemEl, $rssItem->GetSource());
$this->AddEnclosure($itemEl, $rssItem->GetEnclosure());
$this->channel->appendChild($itemEl);
}
开发者ID:agentmedia,项目名称:phine-framework,代码行数:39,代码来源:Writer.php
示例12: test_getItemsByOrderId
public function test_getItemsByOrderId()
{
/** === Test Data === */
$ORDER_ID = 32;
$ITEM_ID = 64;
$TBL_ORDER = 'sale order item';
$TBL_PV_ITEM = 'pv item';
/** === Setup Mocks === */
// $tblOrder = [$asOrder => $this->_resource->getTableName(Cfg::ENTITY_MAGE_SALES_ORDER_ITEM)];
$this->mResource->shouldReceive('getTableName')->once()->andReturn($TBL_ORDER);
// $tblPvItem = [$asPvItem => $this->_resource->getTableName(Entity::ENTITY_NAME)];
$this->mResource->shouldReceive('getTableName')->once()->andReturn($TBL_PV_ITEM);
// $query = $conn->select();
$mQuery = $this->_mockDbSelect();
$this->mConn->shouldReceive('select')->once()->andReturn($mQuery);
// $query->from($tblOrder, $cols);
$mQuery->shouldReceive('from')->once();
// $query->joinLeft($tblPvItem, $on, $cols);
$mQuery->shouldReceive('joinLeft')->once();
// $query->where($where);
$mQuery->shouldReceive('where')->once();
// $rows = $conn->fetchAll($query);
$mRow = [];
$mRows = [$mRow];
$this->mConn->shouldReceive('fetchAll')->once()->andReturn($mRows);
// $item = $this->_manObj->create(Entity::class, $row);
$mItem = $this->_mock(\Praxigento\Pv\Data\Entity\Sale\Item::class);
$this->mManObj->shouldReceive('create')->once()->with(\Praxigento\Pv\Data\Entity\Sale\Item::class, $mRow)->andReturn($mItem);
// $result[$item->getSaleItemId()] = $item;
$mItem->shouldReceive('getSaleItemId')->once()->andReturn($ITEM_ID);
/** === Call and asserts === */
$res = $this->obj->getItemsByOrderId($ORDER_ID);
$this->assertTrue(is_array($res));
$this->assertTrue(isset($res[$ITEM_ID]));
}
开发者ID:praxigento,项目名称:mobi_mod_mage2_pv,代码行数:35,代码来源:Item_Test.php
示例13: save_new_item_to_wardrobe
public static function save_new_item_to_wardrobe()
{
self::check_logged_in();
$params = $_POST;
// Alustetaan uusi Item-luokan olion käyttäjän syöttämillä arvoilla
// Tallennetaan erikseen attribuutit muuttujaan..
$attributes = array('type' => $params['type'], 'brand' => $params['brand'], 'color' => $params['color'], 'color_2nd' => $params['color_2nd'], 'material' => $params['material'], 'image' => $params['image']);
//..ja luodaan olio attributestaulukon avulla
$item = new Item($attributes);
// kutsutaan item:in metodia errors, joka tarkistaa olivatko
// attribuutit valideja
$errors = $item->errors();
if (count($errors) == 0) {
// Validi item, tallennetaan
// Kutsutaan alustamamme olion save metodia, joka tallentaa olion tietokantaan
$item->save();
//tallennetaan mys käyttäjän vaatekaappiin
Wardrobe::add_item_for_person($item->item_id, $_SESSION['user']);
// Ohjataan käyttäjä lisäyksen jälkeen vaatteen esittelysivulle
Redirect::to('/wardrobe/wardrobe.html', array('message' => 'Item added to your wardrobe!'));
} else {
// Invalidi syöte
// Luodaan uusi näkymä johon välitetään syötetyt arvot
View::make('wardrobe/new_item.html', array('errors' => $errors, 'attributes' => $attributes));
}
}
开发者ID:juhapekkamoilanen,项目名称:Tsoha-Bootstrap,代码行数:26,代码来源:wardrobe_controller.php
示例14: push
/**
* Push menu item
* @param $identifier
* @param Item $item
*/
public function push($identifier, Item $item)
{
if (!$item->getTemplate()) {
$item->setTemplate($this->menus[$identifier]->getTemplate() . '-item');
}
$this->menus[$identifier]->push($item);
}
开发者ID:thytanium,项目名称:laravel-menu,代码行数:12,代码来源:Container.php
示例15: withItem
public function withItem(Item $item)
{
$instance = clone $this;
$items = $instance->getProperty('Item', []);
$items[] = $item->withPckId($this->getProperty('PckId'));
return $instance->withProperty('Item', $items);
}
开发者ID:cpapdotcom,项目名称:asendia,代码行数:7,代码来源:Package.php
示例16: fetch
/**
* @brief Fetch a feed from remote
* @param url remote url of the feed
* @returns an instance of OC_News_Feed
*/
public static function fetch($url)
{
$spfeed = new \SimplePie_Core();
$spfeed->set_feed_url($url);
$spfeed->enable_cache(false);
if (!$spfeed->init()) {
return null;
}
//temporary try-catch to bypass SimplePie bugs
try {
$spfeed->handle_content_type();
$title = $spfeed->get_title();
$items = array();
if ($spitems = $spfeed->get_items()) {
foreach ($spitems as $spitem) {
$itemUrl = $spitem->get_permalink();
$itemTitle = $spitem->get_title();
$itemGUID = $spitem->get_id();
$itemBody = $spitem->get_content();
$item = new Item($itemUrl, $itemTitle, $itemGUID, $itemBody);
$spAuthor = $spitem->get_author();
if ($spAuthor !== null) {
$item->setAuthor($spAuthor->get_name());
}
//date in Item is stored in UNIX timestamp format
$itemDate = $spitem->get_date('U');
$item->setDate($itemDate);
// associated media file, for podcasts
$itemEnclosure = $spitem->get_enclosure();
if ($itemEnclosure !== null) {
$enclosureType = $itemEnclosure->get_type();
$enclosureLink = $itemEnclosure->get_link();
if (stripos($enclosureType, "audio/") !== FALSE) {
$enclosure = new Item_Enclosure();
$enclosure->setMimeType($enclosureType);
$enclosure->setLink($enclosureLink);
$item->setEnclosure($enclosure);
}
}
$items[] = $item;
}
}
$feed = new Feed($url, $title, $items);
$favicon = $spfeed->get_image_url();
if ($favicon !== null && self::checkFavicon($favicon)) {
// use favicon from feed
$feed->setFavicon($favicon);
} else {
// try really hard to find a favicon
$webFavicon = self::discoverFavicon($url);
if ($webFavicon !== null) {
$feed->setFavicon($webFavicon);
}
}
return $feed;
} catch (Exception $e) {
return null;
}
}
开发者ID:netcon-source,项目名称:apps,代码行数:64,代码来源:utils.php
示例17: canAddItem
/**
* Check whether Item can be added
*
* @param Item $item
*
* @return boolean
*/
public function canAddItem(Item $item)
{
if ($this->getTotalPrice() + $item->getPrice() > $this->maxPricePerPackage) {
return false;
} else {
return true;
}
}
开发者ID:dermo666,项目名称:shippingCostExercise,代码行数:15,代码来源:Package.php
示例18: getDrops
public function getDrops(Item $item, Player $player)
{
if ($item->isPickaxe() >= 4) {
return array(array(DIAMOND_BLOCK, 0, 1));
} else {
return array();
}
}
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:8,代码来源:Diamond.php
示例19: getDrops
public function getDrops(Item $item, Player $player)
{
if ($item->isPickaxe() >= 1) {
return array(array(COBBLESTONE, 0, 1));
} else {
return array();
}
}
开发者ID:ungarscool1,项目名称:Multicraft,代码行数:8,代码来源:Cobblestone.php
示例20: __construct
/**
* @param string $class
* @param Item $parent
*/
public function __construct($class, Item $parent = null)
{
$this->class = $class;
$this->parent = $parent;
if ($parent) {
$parent->addChild($this);
}
}
开发者ID:zhangjiachao,项目名称:magento2,代码行数:12,代码来源:Item.php
注:本文中的Item类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论