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


PHP model_cache::get方法代码示例

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


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

示例1: activate

 static function activate() {
   // Update the root item.  This is a quick hack because the search module is activated as part
   // of the official install, so this way we don't start off with a "your index is out of date"
   // banner.
   search::update(model_cache::get("item", 1));
   search::check_index();
 }
开发者ID:HelixiR,项目名称:gallery3,代码行数:7,代码来源:search_installer.php

示例2: lookup_by_name

 /**
  * Look up a group by name.
  * @param integer      $id the group name
  * @return Group_Model  the group object, or null if the name was invalid.
  */
 static function lookup_by_name($name)
 {
     $group = model_cache::get("group", $name, "name");
     if ($group->loaded) {
         return $group;
     }
     return null;
 }
开发者ID:brocki,项目名称:gallery3,代码行数:13,代码来源:group.php

示例3: unstar

 /**
  * Allows the given item to be displayed again.
  *
  * @param int $id  the item id
  */
 public function unstar($id)
 {
     $item = model_cache::get("item", $id);
     $msg = t("Un-starred <b>%title</b> item", array("title" => html::purify($item->title)));
     $this->_check_star_permissions($item);
     star::unstar($item);
     message::success($msg);
     json::reply(array("result" => "success", "reload" => 1));
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:14,代码来源:display.php

示例4: show

 /**
  * Allows the given item to be displayed again.
  *
  * @param int $id  the item id
  */
 public function show($id)
 {
     $item = model_cache::get("item", $id);
     $msg = t("Displayed <b>%title</b> item", array("title" => html::purify($item->title)));
     $this->_check_hide_permissions($item);
     hide::show($item);
     message::success($msg);
     json::reply(array("result" => "success", "reload" => 1));
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:14,代码来源:display.php

示例5: get_hidden_item_model

 /**
  * Returns the hidden_item model related to the given item.
  *
  * There is an attempt to fetch the model from the database through the model
  * cache. If it fails, a new unsaved model is created.
  *
  * @param Item_Model $item    the item
  * @return Hidden_Item_Model  the related hidden_item model
  */
 static function get_hidden_item_model(Item_Model $item)
 {
     try {
         $model = model_cache::get("item", $id);
     } catch (Exception $e) {
         $model = ORM::factory("hidden_item");
         $model->item_id = $item->id;
         $model->validate();
     }
     return $model;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:20,代码来源:hide.php

示例6: _lookup_by_field

 /**
  * Search the groups by the field and value.
  * @param string      $field_name column to look up the user by
  * @param string      $value value to match
  * @return Group_Definition  the group object, or null if the name was invalid.
  */
 private static function _lookup_by_field($field_name, $value)
 {
     try {
         $user = model_cache::get("group", $value, $field_name);
         if ($user->loaded()) {
             return $user;
         }
     } catch (Exception $e) {
         if (strpos($e->getMessage(), "MISSING_MODEL") === false) {
             throw $e;
         }
     }
     return null;
 }
开发者ID:andyst,项目名称:gallery3,代码行数:20,代码来源:group.php

示例7: site

 static function site($uri, $protocol = false)
 {
     if (($pos = strpos($uri, "?")) !== false) {
         list($uri, $query) = explode("?", $uri, 2);
         $query = "?{$query}";
     } else {
         $query = "";
     }
     $parts = explode("/", $uri, 3);
     if ($parts[0] == "albums" || $parts[0] == "photos") {
         $uri = model_cache::get("item", $parts[1])->relative_path();
     }
     return parent::site($uri . $query, $protocol);
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:14,代码来源:MY_url.php

示例8: restore

 public function restore($id)
 {
     // Allow the user to restore the original photo.
     // Make sure the current user has suficient access to view and edit the item.
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     // Figure out where the original was stashed at.
     $original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path());
     // Make sure the current item is a photo and that an original exists.
     if ($item->is_photo() && file_exists($original_image)) {
         // Delete the modified version of the photo.
         @unlink($item->file_path());
         // Copy the original image back over, display an error message if the copy fails.
         if (@rename($original_image, $item->file_path())) {
             // Re-generate the items resize and thumbnail.
             $item_data = model_cache::get("item", $id);
             $item_data->resize_dirty = 1;
             $item_data->thumb_dirty = 1;
             $item_data->save();
             graphics::generate($item_data);
             // If the item is the thumbnail for the parent album,
             //   fix the parent's thumbnail as well.
             $parent = $item_data->parent();
             if ($parent->album_cover_item_id == $item_data->id) {
                 copy($item_data->thumb_path(), $parent->thumb_path());
                 $parent->thumb_width = $item_data->thumb_width;
                 $parent->thumb_height = $item_data->thumb_height;
                 $parent->save();
             }
             // Display a success message and redirect to the items page.
             message::success(t("Your original image has been restored."));
             url::redirect($item->url());
         } else {
             // Display an error message if the copy failed.
             message::error(t("Image restore failed!"));
             url::redirect($item->url());
         }
     } else {
         // Display an error message if there is not an original photo.
         message::error(t("Image restore failed!"));
         url::redirect($item->url());
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:44,代码来源:keeporiginal.php

示例9: rotate

 public function rotate($id, $dir)
 {
     access::verify_csrf();
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     $item = $this->p_rotate($item, $dir);
     json::reply(self::child_json_encode($item));
 }
开发者ID:robertk,项目名称:gallery3-contrib,代码行数:9,代码来源:json_album.php

示例10: get

 /**
  * Load the corresponding Module_Model
  * @param string $module_name
  */
 static function get($module_name)
 {
     return model_cache::get("module", $module_name, "name");
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:8,代码来源:module.php

示例11: form_edit

 public function form_edit($id)
 {
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     if ($item->is_album()) {
         $form = album::get_edit_form($item);
     } else {
         $form = photo::get_edit_form($item);
     }
     print $form;
 }
开发者ID:estebandito,项目名称:gallery3,代码行数:12,代码来源:quick.php

示例12: _set

 /**
  * Internal method to set a permission
  *
  * @param  Group_Model $group
  * @param  string      $perm_name
  * @param  Item_Model  $item
  * @param  boolean     $value
  */
 private static function _set(Group_Model $group, $perm_name, $album, $value)
 {
     if (get_class($group) != "Group_Model") {
         throw new Exception("@todo PERMISSIONS_ONLY_WORK_ON_GROUPS");
     }
     if (!$album->loaded) {
         throw new Exception("@todo INVALID_ALBUM {$album->id}");
     }
     if (!$album->is_album()) {
         throw new Exception("@todo INVALID_ALBUM_TYPE not an album");
     }
     $access = model_cache::get("access_intent", $album->id, "item_id");
     $access->__set("{$perm_name}_{$group->id}", $value);
     $access->save();
     if ($perm_name == "view") {
         self::_update_access_view_cache($group, $album);
     } else {
         self::_update_access_non_view_cache($group, $perm_name, $album);
     }
     self::_update_htaccess_files($album, $group, $perm_name, $value);
     model_cache::clear();
 }
开发者ID:hiwilson,项目名称:gallery3,代码行数:30,代码来源:access.php

示例13: form_edit

 public function form_edit($id)
 {
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     switch ($item->type) {
         case "album":
             return print album::get_edit_form($item);
         case "photo":
             return print photo::get_edit_form($item);
         case "movie":
             return print movie::get_edit_form($item);
     }
 }
开发者ID:viosca,项目名称:gallery3,代码行数:14,代码来源:quick.php

示例14: parent

 /**
  * Return the parent of this node
  *
  * @return ORM
  */
 function parent()
 {
     if (!$this->parent_id) {
         return null;
     }
     return model_cache::get($this->model_name, $this->parent_id);
 }
开发者ID:joericochuyt,项目名称:gallery3,代码行数:12,代码来源:ORM_MPTT.php

示例15: root

 /**
  * Return the root Item_Model
  * @return Item_Model
  */
 static function root()
 {
     return model_cache::get("item", 1);
 }
开发者ID:qboy1987,项目名称:mooiyou,代码行数:8,代码来源:item.php


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