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


PHP Slug::dbinsert方法代码示例

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


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

示例1: param

     // Slug edit form...:
     // Make sure we got a slug_ID:
     param('slug_ID', 'string', true);
     break;
 case 'create':
     // Create new slug...
     $edited_Slug = new Slug();
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('slug');
     // Check that current user has permission to create slugs:
     $current_User->check_perm('slugs', 'edit', true);
     // load data from request
     if ($edited_Slug->load_from_Request()) {
         // We could load data from form without errors:
         // Insert in DB:
         $edited_Slug->dbinsert();
         $Messages->add(T_('New slug created.'), 'success');
         // Redirect so that a reload doesn't write to the DB twice:
         header_redirect('?ctrl=slugs', 303);
         // Will EXIT
         // We have EXITed already at this point!!
     }
     $action = 'new';
     break;
 case 'update':
     // Update slug...
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('slug');
     // Check that current user has permission to edit slugs:
     $current_User->check_perm('slugs', 'edit', true);
     // Make sure we got an slug_ID:
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:slugs.ctrl.php

示例2: elseif

 /**
  * Get the item tinyslug. If not exists -> create new
  *
  * @return string|boolean tinyslug on success, false otherwise
  */
 function get_tinyslug()
 {
     global $preview;
     $tinyslug_ID = $this->tiny_slug_ID;
     if ($tinyslug_ID != NULL) {
         // the tiny slug for this item was already created
         $SlugCache =& get_SlugCache();
         $Slug =& $SlugCache->get_by_ID($tinyslug_ID, false, false);
         return $Slug === false ? false : $Slug->get('title');
     } elseif ($this->ID > 0 && !$preview) {
         // create new tiny Slug for this item
         // Note: This may happen only in case of posts created before the tiny slug was introduced
         global $DB;
         load_funcs('slugs/model/_slug.funcs.php');
         $Slug = new Slug();
         $Slug->set('title', getnext_tinyurl());
         $Slug->set('itm_ID', $this->ID);
         $Slug->set('type', 'item');
         $DB->begin();
         if (!$Slug->dbinsert()) {
             // Slug dbinsert failed
             $DB->rollback();
             return false;
         }
         $this->set('tiny_slug_ID', $Slug->ID);
         // Update Item preserving mod date:
         if (!$this->dbupdate(false)) {
             // Item dbupdate failed
             $DB->rollback();
             return false;
         }
         $DB->commit();
         // update last tinyurl value on database
         // Note: This doesn't have to be part of the above transaction, no problem if it doesn't succeed to update, or if override a previously updated value.
         global $Settings;
         $Settings->set('tinyurl', $Slug->get('title'));
         $Settings->dbupdate();
         return $Slug->get('title');
     }
     return false;
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:46,代码来源:_item.class.php


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