當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tags::add方法代碼示例

本文整理匯總了PHP中Tags::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tags::add方法的具體用法?PHP Tags::add怎麽用?PHP Tags::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tags的用法示例。


在下文中一共展示了Tags::add方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: insert_initial_data

 /**
  * Insert initial data
  *
  * @author Johnny Karhinen, http://fullkorn.nu, johnny@fullkorn.nu
  * @return boolean
  */
 protected function insert_initial_data()
 {
     Tags::add('page_welcome');
     Tags::add('Puff 1');
     Tags::add('Puff 2');
     Tags::add('Puff 3');
     $this->new_content('# A First Level Header' . "\n\n" . '## A Second Level Header' . "\n\n" . 'Some of these words *are emphasized*.' . "\n" . 'Some of these words _are emphasized also_.' . "\n\n" . 'Use two asterisks for **strong emphasis**.' . "\n" . 'Or, if you prefer, __use two underscores instead__.' . "\n\n" . 'Unordered (bulleted) lists use asterisks, pluses, and hyphens (*, +, and -) as list markers. These three markers are interchangable; this:' . "\n\n" . '*   Candy.' . "\n" . '*   Gum.' . "\n" . '*   Booze.' . "\n\n" . 'Ordered (numbered) lists use regular numbers, followed by periods, as list markers:' . "\n\n" . '1.  Red' . "\n" . '2.  Green' . "\n" . '3.  Blue' . "\n\n" . 'More basics at [Daring Fireball](http://daringfireball.net/projects/markdown/basics).', array('page_welcome'));
     $this->new_content('### Help' . "\n\n" . 'You can access the admin with [this link](admin).' . "\n\n" . 'See online help [here](http://larvit.se/pajas).' . "\n\n" . 'Wiki [here](https://github.com/lillem4n/kohana-module-pajas/wiki)', array('Puff 1'));
     $this->new_content('### Col 2' . "\n\n" . 'Lorem ipsum dolor sit amet, consectetur adipizscing elit. Fusce velit quam, pharetra id, vehicula eu, consectetur ut, orci. Donec odio. Donec non neque. Ut rutrum lectus nec elit. Ut id quam. Cras aliquam erat eu mi. Aliquam orci neque, lobortis a, tempus ut, lacinia sit amet, purus.', array('Puff 2'));
     $this->new_content('### Col 3' . "\n\n" . 'Lorem ipsum dolor sit amet, consectetur adipizscing elit. Fusce velit quam, pharetra id, vehicula eu, consectetur ut, orci. Donec odio. Donec non neque. Ut rutrum lectus nec elit. Ut id quam. Cras aliquam erat eu mi. Aliquam orci neque, lobortis a, tempus ut, lacinia sit amet, purus.', array('Puff 3'));
     // We set the URI to 'welcome' since that is Kohanas default route
     $this->new_page('Hello world!', 'welcome', array(1 => 1, 2 => 2, 3 => 3, 4 => 4));
     return TRUE;
 }
開發者ID:rockymontana,項目名稱:kohana-module-pajas,代碼行數:20,代碼來源:content.php

示例2: Icons

     }
     break;
 case 'addTagChildFolder':
     $tag = $this->params['tag'];
     $tagName = $this->params['tagName'];
     if (!$tagName) {
         $tagName = $itext['TXT_TAG_NEW'];
     }
     // Check if root node is selected
     if ($tag === 'root') {
         // Get real Page-ID of Root-Node
         $tags = $tagMgr->getList();
         $tag = $tags[0]['ID'];
     }
     // Add new child node
     $new_id = $tagMgr->add($tag, $tagName);
     if ($new_id != false) {
         $icons = new Icons();
         $jsQueue->add($new_id, HISTORYTYPE_TAG, 'TAG_ADD', sGuiUS(), NULL);
     } else {
         $koala->alert($itext['TXT_ERROR_ACCESS_DENIED']);
     }
     break;
 case 'deleteTag':
     $tagID = $this->params['tagID'];
     $siteID = $this->params['site'];
     // Delete tag
     $successfullyDeleted = $tagMgr->remove($tagID);
     if (in_array($tagID, $successfullyDeleted)) {
         foreach ($successfullyDeleted as $successfullyDeletedItem) {
             $jsQueue->add($successfullyDeletedItem, HISTORYTYPE_TAG, 'OBJECT_DELETE', sGuiUS(), 'tag', NULL, NULL, $successfullyDeletedItem . '-' . $siteID, 'name');
開發者ID:nrueckmann,項目名稱:yeager,代碼行數:31,代碼來源:tags.php

示例3: onAddNewTag

    function onAddNewTag()
    {
        if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
            echo 'CATS has lost your session data!';
            return;
        }
        $tags = new Tags($this->_siteID);
        $arr = $tags->add(isset($_POST['tag_parent_id']) ? $_POST['tag_parent_id'] : null, $_POST['tag_title'], "-");
        if (isset($_POST['tag_parent_id'])) {
            printf('
				<li id="id_li_tag_%d">
					<a href="javascript:;" onclick="doDelete(%d);"><img src="images/actions/delete.gif" /></a>
					<div id="id_tag_%d"><a href="javascript:;" onclick="editTag(%d);">%s</a><div></div></div>
				</li>', $arr['id'], $arr['id'], $arr['id'], $arr['id'], $arr['tag_title']);
        } else {
            printf('
				<li id="id_li_tag_%d">
					<a href="javascript:;" onclick="doDelete(%d);"><img src="images/actions/delete.gif" /></a> %s
					<ul>
						<li>
							<img src="images/actions/add.gif" />
							<form method="post" action="%s?m=settings&amp;a=ajax_tags_add">
								<input type="hidden" name="tag_parent_id" value="%d" />
								<input type="text" name="tag_title" value="" />
								<input type="button" value="Add" onclick="doAdd(this.form);" />
							</form>
						</li>
					</ul>
				</li>', $arr['id'], $arr['id'], $arr['tag_title'], CATSUtility::getIndexName(), $arr['id']);
        }
        return;
    }
開發者ID:rankinp,項目名稱:OpenCATS,代碼行數:32,代碼來源:SettingsUI.php

示例4: action_view

 /**
  * 查看相片
  */
 public function action_view()
 {
     $tag = new Tags();
     $this->template->pid = $pid = $this->request->param('id');
     $imgSelect = DB::select('i.id', 'i.cate_id', 'i.uploadtime', 'i.picname', 'i.userid', 'i.disk_id', 'i.picname', 'i.custom_name', array('i.disk_id', 'disk_domain'), 'i.click', 'i.comment_num', 'i.support', 'i.oppose', array('i.disk_name', 'img_dir'))->from(array('imgs', 'i'))->order_by('i.id', 'DESC');
     $imgInfo = $imgSelect->where('i.id', '=', (int) $pid)->fetch_row();
     $this->template->pageTitle = $imgInfo['custom_name'];
     $imgInfo['cate_name'] = DB::select('cate_name')->from('img_categories')->where('cate_id', '=', (int) $imgInfo['cate_id'])->fetch_one();
     $user = ORM::factory('user', $imgInfo['userid']);
     $imgInfo['username'] = $user->username;
     $imgInfo['avatar'] = $user->avatar;
     $imgInfo['uid'] = $user->uid;
     $imgInfo['sign'] = ORM::factory('user_field', (int) $imgInfo['userid'])->sign;
     $this->template->imgInfo = $imgInfo;
     if (empty($imgInfo)) {
         $this->show_message('非法訪問', 0, array(), true);
     }
     if ($user->status != 'approved' || $user->expire_time < time()) {
         $links[] = array('text' => '返回首頁', 'href' => '/');
         $this->show_message('該用戶已經過期或者禁止,不允許訪問其所屬的圖片', 1, $links, true, 10000);
     }
     $this->template->tags = $tags = $tag->get($pid, 'img');
     $select = DB::select('c.*', 'u.username', 'u.avatar')->from(array('comments', 'c'))->where('c.item_id', '=', (int) $pid)->where('c.app', '=', 'img')->join(array('users', 'u'), 'LEFT')->on('u.uid', '=', 'c.author');
     $this->template->commentList = $select->execute()->as_array();
     if ($this->isPost()) {
         $tags = trim($this->getPost('tags'));
         $pid = (int) $this->getPost('pid');
         $tags = explode(' ', $tags);
         $tag->add($pid, 'img', $tags, $imgInfo['userid']);
         $this->request->redirect('/' . $pid . '.html');
     }
     // 更新訪問量
     DB::update('users')->set(array('visit' => DB::expr("visit + 1")))->where('uid', '=', (int) $imgInfo['userid'])->execute();
     DB::update('imgs')->set(array('click' => DB::expr('click + 1')))->where('id', '=', (int) $pid)->execute();
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:38,代碼來源:pic.php

示例5: action_add

 /**
  * 添加專題
  *
  */
 public function action_add()
 {
     $this->checklogin();
     $this->template->pageTitle = '添加專題';
     $this->_add_css('styles/album/add_topics.css');
     $this->_add_script('scripts/copy.js');
     $specialpic = ORM::factory('specialpic');
     if ($this->isPost()) {
         $post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('content', 'not_empty');
         if ($post->check()) {
             $specialpic->values($post);
             $specialpic->uid = $this->auth['uid'];
             $specialpic->save();
             $specialpic->sid;
             // 添加專題標簽
             $tag = new Tags();
             $tags = trim($this->getPost('tags'));
             $tags = explode(' ', $tags);
             $tag->add($specialpic->sid, 'img_subject', $tags, $this->auth['uid']);
             $links[] = array('text' => '返回專題列表', 'href' => '/picsubject/list');
             $this->show_message('發現專題圖片操作成功。', 1, $links, true);
         } else {
             // 校驗失敗,獲得錯誤提示
             $str = '';
             $this->template->registerErr = $errors = $post->errors('default/pic/pic');
             foreach ($errors as $item) {
                 $str .= $item . '<br>';
             }
             $this->show_message($str);
         }
     }
     $pid = $this->getQuery('id');
     $arr = explode('-', $pid);
     $select = DB::select('imgs.picname', 'imgs.userid', 'imgs.custom_name', 'd.disk_domain', 'd.disk_name', array('imgs.disk_name', 'img_dir'))->from('imgs')->join(array('img_disks', 'd'))->on('d.disk_domain', '=', 'imgs.disk_id')->where('imgs.id', 'in', $arr)->where('imgs.userid', '=', $this->auth['uid']);
     $rows = $select->execute()->as_array();
     $str = '';
     foreach ($rows as $item) {
         $temp_img = $item['img_dir'] . '/' . $item['picname'];
         list($width, $height) = getimagesize($temp_img);
         if ($width >= 640) {
             $temp_img = $this->thumb->create($temp_img, 640, 640, 's');
             $temp_img = Str::changeLoad($temp_img, false);
         } else {
             $temp_img = Str::changeLoad($temp_img, true);
         }
         $str .= '<p>' . "<img src=\"" . URL::domain() . $temp_img . '" alt="' . $item['custom_name'] . '"/></p><p style="text-align:center;">' . $item['custom_name'] . '</p>';
     }
     $this->template->content = $str;
 }
開發者ID:BGCX261,項目名稱:zhongyycode-svn-to-git,代碼行數:53,代碼來源:picsubject.php


注:本文中的Tags::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。