本文整理汇总了PHP中tag::compact方法的典型用法代码示例。如果您正苦于以下问题:PHP tag::compact方法的具体用法?PHP tag::compact怎么用?PHP tag::compact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tag
的用法示例。
在下文中一共展示了tag::compact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save($album_id)
{
access::verify_csrf();
$album = ORM::factory("item", $album_id);
access::required("edit", $album);
if (Input::instance()->post("save")) {
$titles = Input::instance()->post("title");
$descriptions = Input::instance()->post("description");
$filenames = Input::instance()->post("filename");
$internetaddresses = Input::instance()->post("internetaddress");
$tags = Input::instance()->post("tags");
$enable_tags = module::is_active("tag");
foreach (array_keys($titles) as $id) {
$item = ORM::factory("item", $id);
if ($item->loaded() && access::can("edit", $item)) {
$item->title = $titles[$id];
$item->description = $descriptions[$id];
$item->name = $filenames[$id];
$item->slug = $internetaddresses[$id];
$item->save();
if ($enable_tags) {
tag::clear_all($item);
foreach (explode(",", $tags[$id]) as $tag_name) {
if ($tag_name) {
tag::add($item, trim($tag_name));
}
}
tag::compact();
}
}
}
message::success(t("Captions saved"));
}
url::redirect($album->abs_url());
}
示例2: item_edit_form_completed
static function item_edit_form_completed($item, $form)
{
tag::clear_all($item);
foreach (explode(",", $form->edit_item->tags->value) as $tag_name) {
if ($tag_name) {
tag::add($item, trim($tag_name));
}
}
tag::compact();
}
示例3: item_edit_form_completed
static function item_edit_form_completed($item, $form)
{
tag::clear_all($item);
foreach (preg_split("/[,;]/", $form->edit_item->tags->value) as $tag_name) {
if ($tag_name) {
tag::add($item, str_replace(" ", ".", $tag_name));
}
}
tag::compact();
}
示例4: item_edit_form_completed
static function item_edit_form_completed($item, $form)
{
tag::clear_all($item);
foreach (explode(",", $form->edit_item->tags->value) as $tag_name) {
if ($tag_name) {
tag::add($item, trim($tag_name));
}
}
module::event("item_related_update", $item);
tag::compact();
}