PHP Class Item, yincart Code Examples

This page contains top rated real world PHP examples of class Item from package yincart extracted from open source projects. You can rate examples to help us improve the quality of examples
Inheritance: extends BaseItem
Example #1
Show file File: ubb.php Project: MortalROs/Naxasius-Game-Engine
0
 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;
 }
Example #2
Show file File: comment.php Project: NavaINT1876/ccustoms
0
 /**
  * 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;
 }
Example #3
Show file File: Item.php Project: doostan/menu
0
 public function addChild($title)
 {
     $child = new Item($title);
     $child->setParent($this);
     $this->children[] = $child;
     return $child;
 }
Example #4
Show file File: ItemTest.php Project: nidzix/Newscoop
0
 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());
 }
Example #5
Show file File: ItemTest.php Project: BD-ES/Q
0
 /**
  * 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());
 }
Example #6
Show file File: Type.php Project: anime-db/catalog-bundle
0
 /**
  * @param Item $item
  *
  * @return Type
  */
 public function setItem(Item $item)
 {
     if ($this->item !== $item) {
         $this->item = $item->setType($this);
     }
     return $this;
 }
Example #7
Show file File: QueueController.class.php Project: hmmbug/unbindery
0
 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;
 }
Example #8
Show file File: invtype.php Project: biow0lf/evedev-kb
0
 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;
 }
Example #9
Show file File: Item.php Project: purchased-at/sdk-php
0
 public static function fromJson($json)
 {
     $r = new Item();
     $r->setId($json->id);
     $r->setSku($json->sku);
     return $r;
 }
Example #10
Show file File: item.php Project: alexmixaylov/real
0
 /**
  * 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());
 }
Example #11
Show file File: Writer.php Project: agentmedia/phine-framework
0
 /**
  * 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);
 }
Example #12
Show file File: Item_Test.php Project: praxigento/mobi_mod_mage2_pv
0
 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]));
 }
Example #13
Show file File: wardrobe_controller.php Project: juhapekkamoilanen/Tsoha-Bootstrap
0
 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));
     }
 }
Example #14
Show file File: Container.php Project: thytanium/laravel-menu
0
 /**
  * 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);
 }
Example #15
Show file File: Package.php Project: cpapdotcom/asendia
0
 public function withItem(Item $item)
 {
     $instance = clone $this;
     $items = $instance->getProperty('Item', []);
     $items[] = $item->withPckId($this->getProperty('PckId'));
     return $instance->withProperty('Item', $items);
 }
Example #16
Show file File: utils.php Project: netcon-source/apps
0
 /**
  * @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;
     }
 }
Example #17
Show file File: Package.php Project: dermo666/shippingCostExercise
0
 /**
  * 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;
     }
 }
Example #18
Show file File: Diamond.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 4) {
         return array(array(DIAMOND_BLOCK, 0, 1));
     } else {
         return array();
     }
 }
Example #19
Show file File: Cobblestone.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 1) {
         return array(array(COBBLESTONE, 0, 1));
     } else {
         return array();
     }
 }
Example #20
Show file File: Item.php Project: zhangjiachao/magento2
0
 /**
  * @param string $class
  * @param Item $parent
  */
 public function __construct($class, Item $parent = null)
 {
     $this->class = $class;
     $this->parent = $parent;
     if ($parent) {
         $parent->addChild($this);
     }
 }
Example #21
Show file File: StoneBricks.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 1) {
         return array(array(STONE_BRICKS, $this->meta & 0x3, 1));
     } else {
         return array();
     }
 }
Example #22
Show file File: GoldOre.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 4) {
         return array(array(GOLD_ORE, 0, 1));
     } else {
         return array();
     }
 }
Example #23
Show file File: NetherBrick.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 1) {
         return array(array(NETHER_BRICKS, 0, 1));
     } else {
         return array();
     }
 }
Example #24
Show file File: LineItem.php Project: josephholsten/swaplady
0
 public static function findItems($id)
 {
     $items = new Item();
     $subquery = $items->_db->select();
     $subquery->from('line_items', 'item_id');
     $subquery->where('user_id = ?', $id);
     return $items->fetchAll('id IN (' . $subquery . ')');
 }
Example #25
Show file File: controllers.php Project: MattCouv/dev.batata.fr
0
function get_items()
{
    global $smarty, $fpdo;
    $oItem = new Item($fpdo);
    $items_results = $oItem->getAll();
    $smarty->assign('items', $items_results);
    $smarty->display('showitems.tpl');
}
Example #26
Show file File: Obsidian.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 5) {
         return array(array(OBSIDIAN, 0, 1));
     } else {
         return array();
     }
 }
Example #27
Show file File: GlowingRedstoneOre.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 4) {
         return array(array(REDSTONE_DUST, 0, mt_rand(4, 5)));
     } else {
         return array();
     }
 }
Example #28
Show file File: IronDoor.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 1) {
         return array(array(IRON_DOOR, 0, 1));
     } else {
         return array();
     }
 }
Example #29
Show file File: DoubleSlab.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 1) {
         return array(array(SLAB, $this->meta & 0x7, 2));
     } else {
         return array();
     }
 }
Example #30
Show file File: LapisOre.php Project: ungarscool1/Multicraft
0
 public function getDrops(Item $item, Player $player)
 {
     if ($item->isPickaxe() >= 3) {
         return array(array(DYE, 4, mt_rand(4, 8)));
     } else {
         return array();
     }
 }
Frequently Used Methods