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


PHP Item::get方法代码示例

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


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

示例1: get_fallback

 public function get_fallback()
 {
     date_default_timezone_set("UTC");
     $cache = array();
     $folder = Item::get($this, $this->abs_path, $cache);
     $items = $folder->get_content($cache);
     uasort($items, array("Item", "cmp"));
     $html = "<table>";
     $html .= "<tr>";
     $html .= "<th></th>";
     $html .= "<th><span>Name</span></th>";
     $html .= "<th><span>Last modified</span></th>";
     $html .= "<th><span>Size</span></th>";
     $html .= "</tr>";
     if ($folder->get_parent($cache)) {
         $html .= "<tr>";
         $html .= "<td><img src='" . $this->app_abs_href . "client/icons/96/folder-parent.png' alt='folder-parent'/></td>";
         $html .= "<td><a href='..'>Parent Directory</a></td>";
         $html .= "<td></td>";
         $html .= "<td></td>";
         $html .= "</tr>";
     }
     foreach ($items as $item) {
         $type = $item->is_folder ? "folder" : "default";
         $html .= "<tr>";
         $html .= "<td><img src='" . $this->app_abs_href . "client/icons/96/" . $type . ".png' alt='" . $type . "'/></td>";
         $html .= "<td><a href='" . $item->abs_href . "'>" . basename($item->abs_path) . "</a></td>";
         $html .= "<td>" . date("Y-m-d H:i", $item->date) . "</td>";
         $html .= "<td>" . ($item->size !== null ? intval($item->size / 1000) . " KB" : "") . "</td>";
         $html .= "</tr>";
     }
     $html .= "</table>";
     return $html;
 }
开发者ID:kirkdwilson,项目名称:LibraryBox-h5ai-Interface,代码行数:34,代码来源:App.php

示例2: startMap

 public function startMap($map)
 {
     if ($map == "map1") {
         $this->mapsRunning["map1"] = "map1";
         $hunter = array_rand($this->map1);
         unset($this->map1[$hunter]);
         $player = $this->getServer()->getPlayer($hunter);
         $this->getServer()->getPlayer($hunter)->teleport(new Vector3(108, 1, 165));
         $player->getInventory()->setArmorItem("Head", Item::get(310));
         $player->getInventory()->setArmorItem("Chest", Item::get(311));
         $player->getInventory()->setArmorItem("Legs", Item::get(312));
         $player->getInventory()->setArmorItem("Feet", Item::get(313));
         $player->getInventory()->addItem(Item::get(276));
         foreach ($this->getServer()->getOnlinePlayers() as $p) {
             if (isset($this->map1[$p->getName()])) {
                 $p->teleport(new Vector3(121, 4, 157));
                 $p->sendPopup(TextFormat::GREEN . "Find a place to hide!");
                 $p->getInventory()->setArmorItem("Head", Item::get(298));
                 $p->getInventory()->setArmorItem("Chest", Item::get(299));
                 $p->getInventory()->setArmorItem("Legs", Item::get(300));
                 $p->getInventory()->setArmorItem("Feet", Item::get(334));
             }
         }
     }
 }
开发者ID:Blubberboy333,项目名称:HideNSeek,代码行数:25,代码来源:Main.php

示例3: rawurlencode

 /**
  * Provide link to publish a comment if user has edit rights
  *
  * @param string to display before link
  * @param string to display after link
  * @param string link text
  * @param string link title
  * @param string class name
  * @param string glue between url params
  * @param boolean save context?
  */
 function get_publish_link($before = ' ', $after = ' ', $text = '#', $title = '#', $class = '', $glue = '&amp;', $save_context = true)
 {
     global $current_User, $admin_url;
     if (!is_logged_in()) {
         return false;
     }
     $this->get_Item();
     if ($this->status == 'published' || !$current_User->check_perm('blog_comments', '', false, $this->Item->get('blog_ID'))) {
         // If User has permission to edit comments:
         return false;
     }
     if ($text == '#') {
         $text = get_icon('publish', 'imgtag') . ' ' . T_('Publish!');
     }
     if ($title == '#') {
         $title = T_('Publish this comment!');
     }
     $r = $before;
     $r .= '<a href="';
     $r .= $admin_url . '?ctrl=comments' . $glue . 'action=publish' . $glue . 'comment_ID=' . $this->ID;
     if ($save_context) {
         $r .= $glue . 'redirect_to=' . rawurlencode(regenerate_url('', '', '', '&'));
     }
     $r .= '" title="' . $title . '"';
     if (!empty($class)) {
         $r .= ' class="' . $class . '"';
     }
     $r .= '>' . $text . '</a>';
     $r .= $after;
     return $r;
 }
开发者ID:LFSF,项目名称:oras,代码行数:42,代码来源:_comment.class.php

示例4: index

 function index()
 {
     $this->load->helper('url');
     $items = new Item();
     $items->get();
     $data['items'] = $items;
     $this->load->view('welcome_message', $data);
 }
开发者ID:kulor,项目名称:orm_rest_api,代码行数:8,代码来源:welcome.php

示例5: index

 public function index()
 {
     $item = new Item();
     $data['listings'] = $item->get();
     // Create the view
     $this->template->title = 'Listings';
     $this->template->content->view('marketplace/index', $data);
     $this->template->publish();
 }
开发者ID:frosoco,项目名称:frosoco-local,代码行数:9,代码来源:marketplace.php

示例6: get_items

 public function get_items($href, $pattern = null)
 {
     $cache = [];
     $root = $this->context->to_path($href);
     $paths = $this->get_paths($root, $pattern);
     $items = array_map(function ($path) {
         return Item::get($this->context, $path, $cache)->to_json_object();
     }, $paths);
     return $items;
 }
开发者ID:Txuritan,项目名称:h5ai,代码行数:10,代码来源:class-search.php

示例7: Item

 function items_get()
 {
     $items = new Item();
     $items->get();
     $results = $this->object_to_array($items);
     if ($results) {
         $this->response($results, 200);
         // 200 being the HTTP response code
     } else {
         $this->response(array('error' => 'Couldn\'t find any items!'), 404);
     }
 }
开发者ID:kulor,项目名称:orm_rest_api,代码行数:12,代码来源:api.php

示例8: get_content

 public function get_content(&$cache)
 {
     $content = array();
     if ($this->app->get_http_code($this->abs_href) !== App::$MAGIC_SEQUENCE) {
         return $content;
     }
     $files = $this->app->read_dir($this->abs_path);
     foreach ($files as $file) {
         $item = Item::get($this->app, $this->abs_path . "/" . $file, $cache);
         $content[$item->abs_path] = $item;
     }
     $this->is_content_fetched = true;
     return $content;
 }
开发者ID:kirkdwilson,项目名称:LibraryBox-h5ai-Interface,代码行数:14,代码来源:Item.php

示例9: get_content

 public function get_content(&$cache)
 {
     $items = [];
     if (!$this->context->is_managed_href($this->href)) {
         return $items;
     }
     $files = $this->context->read_dir($this->path);
     foreach ($files as $file) {
         $item = Item::get($this->context, $this->path . '/' . $file, $cache);
         $items[$item->path] = $item;
     }
     $this->is_content_fetched = true;
     return $items;
 }
开发者ID:arter97,项目名称:h5ai,代码行数:14,代码来源:class-item.php

示例10: get_content

 public function get_content(&$cache)
 {
     $items = array();
     if (!$this->app->is_managed_url($this->url)) {
         return $items;
     }
     $files = $this->app->read_dir($this->path);
     foreach ($files as $file) {
         $item = Item::get($this->app, $this->path . "/" . $file, $cache);
         $items[$item->path] = $item;
     }
     $this->is_content_fetched = true;
     return $items;
 }
开发者ID:kiyor,项目名称:h5ai,代码行数:14,代码来源:class-item.php

示例11: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     // Item naming and enchantments will be in QuickHeal v1.5.0 — coming once MCPE v0.12 is publicly released.
     $config = $this->getConfig();
     $player = $event->getPlayer();
     $item = $config->get("id");
     $playerhealth = $player->getHealth();
     $health = $config->get("health");
     $sethealth = $playerhealth + $health;
     if ($item == "282" and $playerhealth !== 20) {
         $id = 282;
         $damage = 0;
         $count = 1;
         $mstew = Item::get($id, $damage, $count);
         $player->setHealth($sethealth);
         $player->getInventory()->removeItem($mstew);
         $id = 281;
         $damage = 0;
         $count = 1;
         $bowl = Item::get($id, $damage, $count);
         $player->getInventory()->addItem($bowl);
         if ($item == "459" and $playerhealth !== 20) {
             $id = 459;
             $damage = 0;
             $count = 1;
             $bstew = Item::get($id, $damage, $count);
             $player->setHealth($sethealth);
             $player->getInventory()->removeItem($bstew);
             $id = 281;
             $damage = 0;
             $count = 1;
             $bowl = Item::get($id, $damage, $count);
             $player->getInventory()->addItem($bowl);
         } else {
             if ($item !== "282" or "459") {
                 $damage = 0;
                 $count = 1;
                 $itemusing = Item::get($item, $damage, $count);
                 $player->setHealth($sethealth);
                 $player->getInventory()->removeItem($itemusing);
                 // Implement custom addItem code in the future.
             }
         }
     }
 }
开发者ID:xHFx,项目名称:QuickHeal,代码行数:45,代码来源:Main.php

示例12: onInteract

 public function onInteract(PlayerInteractEvent $event)
 {
     // Proper item naming and enchantments will be in QuickHeal v1.5.0 — coming once PocketMine implements naming & enchantments.
     $config = $this->getConfig();
     $player = $event->getPlayer();
     $item = $config->get("id");
     $playerHp = $player->getHealth();
     $health = $config->get("health");
     $healthPk = new SetHealthPacket();
     $setHp->health = $playerHp + $health;
     if ($playerHp <= $player->getMaxHealth()) {
         $damage = 0;
         $count = 1;
         $removeItem = Item::get($item, $damage, $count);
         $player->dataPacket($setHp);
         $player->getInventory()->removeItem($removeItem);
     }
 }
开发者ID:seanmcpe,项目名称:QuickHeal,代码行数:18,代码来源:Main.php

示例13: onRun

 public function onRun($currentTick)
 {
     $server = Server::getInstance();
     $level = $server->getDefaultLevel();
     $x = $this->plugin->config["x"];
     $y = $this->plugin->config["y"];
     $z = $this->plugin->config["z"];
     $pos = new Vector3($x, $y, $z);
     $tile = $level->getTile($pos);
     $chest = Block::get(Block::CHEST);
     $items = array($this->plugin->config["contents"]);
     $contents = array_rand($items);
     $level->setBlock($pos, $chest);
     $tile->getInventory()->setContents([Item::get(Item::DIAMOND_SWORD), Item::get(Item::DIAMOND_PICKAXE)]);
     //                                                              ^ ($items[$contents])
     $server->broadcastMessage("CRATE SPAWNED");
     if ($chest->firstEmpty() == -1) {
         $air = Block::get(Block::AIR);
         $level->setBlock($pos, $air);
     }
 }
开发者ID:seanmcpe,项目名称:LootCrate,代码行数:21,代码来源:LootCrate.php

示例14: get_html

 public function get_html($path = null)
 {
     if (!$path) {
         $path = $this->context->get_current_path();
     }
     $fallback_images_href = $this->context->get_setup()->get('PUBLIC_HREF') . 'images/fallback/';
     $cache = [];
     $folder = Item::get($this->context, $path, $cache);
     $items = $folder->get_content($cache);
     uasort($items, ['Item', 'cmp']);
     $html = '<table>';
     $html .= '<tr>';
     $html .= '<th class="fb-i"></th>';
     $html .= '<th class="fb-n"><span>Name</span></th>';
     $html .= '<th class="fb-d"><span>Last modified</span></th>';
     $html .= '<th class="fb-s"><span>Size</span></th>';
     $html .= '</tr>';
     if ($folder->get_parent($cache)) {
         $html .= '<tr>';
         $html .= '<td class="fb-i"><img src="' . $fallback_images_href . 'folder-parent.png" alt="folder-parent"/></td>';
         $html .= '<td class="fb-n"><a href="..">Parent Directory</a></td>';
         $html .= '<td class="fb-d"></td>';
         $html .= '<td class="fb-s"></td>';
         $html .= '</tr>';
     }
     foreach ($items as $item) {
         $type = $item->is_folder ? 'folder' : 'file';
         $html .= '<tr>';
         $html .= '<td class="fb-i"><img src="' . $fallback_images_href . $type . '.png" alt="' . $type . '"/></td>';
         $html .= '<td class="fb-n"><a href="' . $item->href . '">' . basename($item->path) . '</a></td>';
         $html .= '<td class="fb-d">' . date('Y-m-d H:i', $item->date) . '</td>';
         $html .= '<td class="fb-s">' . ($item->size !== null ? intval($item->size / 1000) . ' KB' : '') . '</td>';
         $html .= '</tr>';
     }
     $html .= '</table>';
     return $html;
 }
开发者ID:Txuritan,项目名称:h5ai,代码行数:37,代码来源:class-fallback.php

示例15: beforeSave

 public function beforeSave()
 {
     if (!$this->id) {
         $event = new Event(['cart_id' => $this->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]);
         $event->save();
     } else {
         $cur = Item::get($this->id);
         if ($cur->item_id != $this->item_id) {
             $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 2, 'info' => $cur->item_offer_price_id]);
             $event->save();
             $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 1, 'info' => $this->item_offer_price_id]);
             $event->save();
         } else {
             if ($cur->item_offer_price_id != $this->item_offer_price_id) {
                 $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 3, 'info' => $this->item_offer_price_id]);
                 $event->save();
             }
             if ($cur->count != $this->count) {
                 $event = new Event(['cart_id' => $this->cart->cart_id, 'user_id' => \Users\User::$cur->id, 'cart_event_type_id' => 4, 'info' => $this->item_offer_price_id . "|" . ($this->count - $cur->count)]);
                 $event->save();
             }
         }
     }
 }
开发者ID:krvd,项目名称:cms-Inji,代码行数:24,代码来源:Item.php


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