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


PHP repeater函数代码示例

本文整理汇总了PHP中repeater函数的典型用法代码示例。如果您正苦于以下问题:PHP repeater函数的具体用法?PHP repeater怎么用?PHP repeater使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_repeater

 public function test_repeater()
 {
     $strs = array('a' => 'aaaaaaaaaa', '&nbsp;' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', '<br>' => '<br><br><br><br><br><br><br><br><br><br>');
     foreach ($strs as $str => $expect) {
         $this->assertEquals($expect, repeater($str, 10));
     }
 }
开发者ID:saiful1105020,项目名称:Under-Construction-Bracathon-Project-,代码行数:7,代码来源:string_helper_test.php

示例2: _get_search_cache

 function _get_search_cache($search_ca_code, $search_field, $search_text, $spt = FALSE)
 {
     if ($spt) {
         $this->db->where("wr_num between '" . $spt . "' and '" . ($spt + $this->config->item('cf_search_part')) . "'");
     }
     if ($search_ca_code) {
         $code_exp = explode('.', $search_ca_code);
         if (!isset($code_exp[1])) {
             $limit_code = $search_ca_code + 1;
         } else {
             $code_ori = substr($code_exp[1], 0, -3);
             $code_num = substr($code_exp[1], -3) + 1;
             $code_plus = repeater('0', 3 - strlen($code_num)) . $code_num;
             $limit_code = $code_exp[0] . '.' . $code_ori . $code_plus;
         }
         $this->db->where(array('ca_code >=' => $search_ca_code, 'ca_code <' => $limit_code));
     }
     if (!$search_field || !$search_text) {
         return FALSE;
     }
     // 검색어를 구분자로 나눈다. 여기서는 공백
     $s = explode(' ', $search_text);
     // 검색필드를 구분자로 나눈다.
     $field = explode('.', trim($search_field));
     $opt = '';
     $where = ' ( ';
     foreach ($s as $sval) {
         // 검색어
         $search_str = trim($sval);
         if ($search_str == '') {
             continue;
         }
         $opt2 = '';
         $where .= $opt . '(';
         foreach ($field as $fval) {
             // 필드의 수만큼 다중 필드 검색 (필드1+필드2...)
             $where .= $opt2;
             switch ($fval) {
                 case 'mb_id':
                 case 'wr_name':
                     $where .= $this->db->protect_identifiers($fval) . ' = ' . $this->db->escape($search_str);
                     break;
                     // LIKE 보다 INSTR 속도가 빠름 (누가 그래?)
                 // LIKE 보다 INSTR 속도가 빠름 (누가 그래?)
                 default:
                     if (preg_match('/[a-zA-Z]/', $search_str)) {
                         $where .= 'INSTR(LOWER(' . $this->db->protect_identifiers($fval) . '), LOWER(' . $this->db->escape($search_str) . '))';
                     } else {
                         $where .= 'INSTR(' . $this->db->protect_identifiers($fval) . ', ' . $this->db->escape($search_str) . ')';
                     }
                     break;
             }
             $opt2 = ' or ';
         }
         $where .= ')';
         $opt = ' and ';
     }
     $where .= ' ) ';
     $this->db->where($where, null, FALSE);
 }
开发者ID:ubiopen,项目名称:KI_Board,代码行数:60,代码来源:board_model.php

示例3: form

 /**
  * Get search form
  *
  * @subpackage	Helpers
  * @param	int
  * @return 	string
  */
 function form($data = '')
 {
     // Set the default options
     $defaults = array('show_categories' => 'no', 'class' => 'search_form', 'id' => '', 'style' => '');
     $options = $this->_ci->settings->get_params($data['attributes'], $defaults);
     $this->_ci->load->helper('form');
     // Should we load up the categories
     $cats = '';
     if ($options['show_categories'] == 'yes') {
         $this->_ci->load->library('categories/categories_library');
         $cats = $this->_ci->categories_model->get_categories();
         $this->_ci->categories_library->category_tree($cats);
         $cats = $this->_ci->categories_library->get_categories();
         $cat_options['0'] = lang('lang_search_all');
         foreach ($cats as $row) {
             $indent = $row['cat_parent'] != 0 ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
             $cat_options[$row['cat_id']] = $indent . $row['cat_name'];
         }
         $cats = form_dropdown('category', $cat_options, 'id="cats" class="category"');
     }
     $attributes = array('class' => $options['class'], 'id' => $options['id'], 'style' => $options['style']);
     $output = form_open('search/do_search', $attributes);
     $output .= str_replace('{kb:cats}', $cats, $data['content']);
     $output .= form_close();
     return $output;
 }
开发者ID:68kb,项目名称:68kb,代码行数:33,代码来源:Search_parser.php

示例4: _index

 public function _index($id = 0, $fileType = 'i')
 {
     // if (!$this->input->is_ajax_request()) {
     // 	die('Ajax requests only...');
     // }
     //$this->template->set_layout(FALSE);
     $data = new stdClass();
     $data->showSizeSlider = $showSizeSlider;
     $data->showAlignButtons = $showAlignButtons;
     $data->fileType = $fileType;
     $data->folders = $this->file_folders_m->get_folders();
     $data->subfolders = array();
     $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array());
     // Select the images for the current folder. In the future the selection of the type could become dynamic.
     // For future reference: a => audio, v => video, i => image, d => document, o => other.
     if ($data->current_folder) {
         $data->current_folder->items = $this->file_m->order_by('date_added', 'DESC')->where('type', $fileType)->get_many_by('folder_id', $data->current_folder->id);
         $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);
         foreach ($subfolders as $subfolder) {
             $data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
         }
         // Set a default label
         $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders : array($data->current_folder->id => lang('files.dropdown_no_subfolders'));
     }
     // Array for select
     $data->folders_tree = array();
     foreach ($data->folders as $folder) {
         $data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     Asset::add_path('imagepicker', IMAGEPICKER_PATH . 'imagepicker/');
     $this->template->set_layout('modal')->append_js('imagepicker::imagepicker.js')->append_css('imagepicker::imagepicker.css')->build('files/admin/index', $data);
 }
开发者ID:jacksun101,项目名称:PyroAddons,代码行数:32,代码来源:admin.php

示例5: ice_category_select

 /**
  * Generate a category select list
  *
  * @param	string - The field name
  */
 public function ice_category_select($data = array())
 {
     $name = $data['attributes']['name'];
     $this->_ci->load->library('categories/categories_library');
     $this->_ci->load->model('categories/categories_model');
     $cats = $this->_ci->categories_model->get_categories();
     $this->_ci->categories_library->category_tree($cats);
     $cats = $this->_ci->categories_library->get_categories();
     $cat_options['0'] = lang('lang_search_all');
     foreach ($cats as $row) {
         $indent = $row['cat_parent'] != 0 ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
         $cat_options[$row['cat_id']] = $indent . $row['cat_name'];
     }
     return form_dropdown($name, $cat_options, '', 'class="category_select"');
 }
开发者ID:68kb,项目名称:68kb,代码行数:20,代码来源:Categories_parser.php

示例6: index

	public function index($id = 0)
	{
		$data->folders			= $this->file_folders_m->get_folders();
		$data->subfolders		= array();
		$data->current_folder	= $id && isset($data->folders[$id])
								? $data->folders[$id]
								: ($data->folders ? current($data->folders) : array());

		if ($data->current_folder)
		{
			$data->current_folder->items = $this->file_m
				->order_by('date_added', 'DESC')
				->where('type !=', 'i')
				->get_many_by('folder_id', $data->current_folder->id);

			$subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);

			foreach ($subfolders as $subfolder)
			{
				$data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
			}

			// Set a default label
			$data->subfolders = $data->subfolders
				? array($data->current_folder->id => lang('files.dropdown_root')) + $data->subfolders
				: array($data->current_folder->id => lang('files.dropdown_no_subfolders'));
		}

		// Array for select
		$data->folders_tree = array();
		foreach ($data->folders as $folder)
		{
			$data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
		}

		$data->file_types = array(
			'a' => lang('files.type_a'),
			'v' => lang('files.type_v'),
			'd' => lang('files.type_d'),
			'i' => lang('files.type_i'),
			'o' => lang('files.type_o')
		);

		$this->template
			->title('Files')
			->build('files/index', $data);
	}
开发者ID:JamieLomas,项目名称:pyrocms,代码行数:47,代码来源:files.php

示例7: __construct

 /**
  * Constructor
  *
  * Loads dependencies.
  *
  * @access	public
  * @return	void
  */
 public function __construct()
 {
     parent::__construct();
     $this->config->load('files');
     $this->lang->load('files');
     $this->load->models(array('file_m', 'file_folders_m'));
     $this->load->library('form_validation');
     $this->form_validation->set_rules($this->_validation_rules);
     $this->_folders = $this->file_folders_m->get_folders();
     // Get the parent -> childs
     $this->data->folders_tree = array();
     foreach ($this->_folders as $folder) {
         $this->data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     $this->template->set_partial('shortcuts', 'admin/partials/shortcuts')->set_partial('nav', 'admin/partials/nav', array('file_folders' => $this->_folders, 'current_id' => 0));
     $this->_path = FCPATH . $this->config->item('files_folder');
     $this->_check_dir();
 }
开发者ID:phonglanpls,项目名称:jz-proj-2012,代码行数:26,代码来源:admin.php

示例8: index

	public function index($id = FALSE)
	{
		//list of folders for the sidebar
		$folders = $this->file_folders_m->get_many_by('parent_id', 0);
		
		//for dropdown list
		$sub_folders = $this->file_folders_m->get_folders();

		$active_folder = array();

		if(!empty($folders) and !$id)
		{
			$active_folder = $folders[0];
			$active_folder->items = $this->file_m->get_many_by(array('folder_id' => $active_folder->id, 'type' => 'i'));
		}
		elseif(!empty($folders) and $id)
		{
			$active_folder = $this->file_folders_m->get($id);
			$active_folder->items = $this->file_m->get_many_by(array('folder_id' => $id, 'type' => 'i'));
		}
		
		$folder_options = array();
		
		if(!empty($sub_folders))
		{
			foreach($sub_folders as $row)
			{
				if ($row['name'] != '-') //$id OR $row['parent_id'] > 0)
				{
					$indent = ($row['parent_id'] != 0 && isset($row['depth'])) ? repeater('&nbsp;&raquo;&nbsp;', $row['depth']) : '';
					$folder_options[$row['id']] = $indent.$row['name'];
				}
			}
		}
		
		$this->template
			->set('folders', $folders)
			->set('folder_options', $folder_options)
			->set('active_folder', $active_folder)
			->title('Images')
			->build('image/index');
	}
开发者ID:reith2004,项目名称:pyrocms,代码行数:42,代码来源:image.php

示例9: index

 public function index($id = 0)
 {
     $data->folders = $this->file_folders_m->get_folders();
     $data->subfolders = array();
     $data->current_folder = $id && isset($data->folders[$id]) ? $data->folders[$id] : ($data->folders ? current($data->folders) : array());
     if ($data->current_folder) {
         $data->current_folder->items = $this->file_m->select('files.*, file_folders.location')->join('file_folders', 'file_folders.id = files.folder_id')->order_by('files.date_added', 'DESC')->where('files.type', 'i')->get_many_by('files.folder_id', $data->current_folder->id);
         $subfolders = $this->file_folders_m->folder_tree($data->current_folder->id);
         foreach ($subfolders as $subfolder) {
             $data->subfolders[$subfolder->id] = repeater('&raquo; ', $subfolder->depth) . $subfolder->name;
         }
         // Set a default label
         $data->subfolders = $data->subfolders ? array($data->current_folder->id => lang('files:root')) + $data->subfolders : array($data->current_folder->id => lang('files:no_subfolders'));
     }
     // Array for select
     $data->folders_tree = array();
     foreach ($data->folders as $folder) {
         $data->folders_tree[$folder->id] = repeater('&raquo; ', $folder->depth) . $folder->name;
     }
     $this->template->title('Images')->append_css('admin/basic_layout.css')->build('image/index', $data);
 }
开发者ID:gamchantoi,项目名称:sisfo-ft,代码行数:21,代码来源:image.php

示例10: album_row

    function album_row($albums, $parent, $lvl)
    {
        ?>
					<?php 
        if (isset($albums[$parent])) {
            foreach ($albums[$parent] as $album) {
                ?>
						<tr>
							<td><?php 
                echo form_checkbox('action_to[]', $album->id);
                ?>
</td>
			        <td><?php 
                echo repeater('-- ', $lvl);
                ?>
 <?php 
                echo $album->title;
                ?>
</td>
			        <td><?php 
                echo $album->num_photos;
                ?>
</td>
			        <td><?php 
                echo date('M d, Y', $album->updated_on);
                ?>
</td>
			        <td><?php 
                echo anchor('photos/' . $album->slug, lang('photo_albums.view_label'), 'target="_blank"') . ' | ' . anchor('admin/photos/manage/' . $album->id, lang('photo_albums.manage_label')) . ' | ' . anchor('admin/photos/edit/' . $album->id, lang('photo_albums.edit_label')) . ' | ' . anchor('admin/photos/delete/' . $album->id, lang('photo_albums.delete_label'), array('class' => 'confirm'));
                ?>
			        </td>
			      </tr>
			      <?php 
                album_row($albums, $album->id, $lvl + 1);
                ?>
			      <?php 
            }
        }
    }
开发者ID:Tapha,项目名称:pyrocms,代码行数:39,代码来源:index.php

示例11: display_field

 function display_field($data)
 {
     $this->EE->lang->loadfile('lonely_cat');
     $this->EE->load->library('api');
     $this->EE->api->instantiate(array('channel_categories', 'channel_structure'));
     // If there is no category set, fetch the default category if set.
     if (!$data) {
         $data = $this->EE->api_channel_structure->get_channel_info($this->EE->input->get_post('channel_id'))->row('deft_category');
     }
     $options = array();
     $cats = $this->_fetch_categories($data);
     $cat_group = NULL;
     // 		 debug($cats);
     if ($this->settings['hide_none'] == 'no') {
         $options['0'] = $this->EE->lang->line('none');
     }
     foreach ($cats as $val) {
         $indent = $val['5'] != 1 ? repeater(NBS . NBS . NBS, $val['5']) : '';
         $options[$val['3']][$val['0']] = $indent . $val['1'];
     }
     return form_dropdown($this->field_name, $options, $data);
 }
开发者ID:GDmac,项目名称:lonely_cat.ee2_addon,代码行数:22,代码来源:ft.lonely_cat.php

示例12: gallery_row

    function gallery_row($tree, $parent, $lvl)
    {
        ?>
		<?php 
        if (isset($tree[$parent])) {
            foreach ($tree[$parent] as $gallery) {
                ?>
			<tr>
				<td><input type="checkbox" name="delete[<?php 
                echo $gallery->slug;
                ?>
]" /></td>
                <td><?php 
                echo repeater('-- ', $lvl);
                ?>
 <?php 
                echo $gallery->title;
                ?>
</td>
                <td><?php 
                echo $gallery->num_photos;
                ?>
</td>
                <td><?php 
                echo date('M d, Y', $gallery->updated_on);
                ?>
</td>
                <td><?php 
                echo anchor('galleries/' . $gallery->slug, 'View', 'target="_blank"') . ' | ' . anchor('admin/galleries/manage/' . $gallery->slug, 'Manage') . ' | ' . anchor('admin/galleries/edit/' . $gallery->slug, 'Edit') . ' | ' . anchor('admin/galleries/delete/' . $gallery->slug, 'Delete', array('class' => 'confirm'));
                ?>
                    </td>
                 </tr>
                 <?php 
                gallery_row($tree, $gallery->id, $lvl + 1);
                ?>
            <?php 
            }
        }
    }
开发者ID:BenneX,项目名称:pyrocms,代码行数:39,代码来源:index.php

示例13: display_field

 function display_field($data)
 {
     $this->EE->lang->loadfile('lonely_cat');
     $this->EE->load->library('api');
     $this->EE->api->instantiate(array('channel_categories', 'channel_structure'));
     $this->channel_id = $this->EE->input->get_post('channel_id');
     // If no category is set, check if one has
     // already been set in the categories array
     if (!$data and isset($this->EE->api_channel_categories->categories)) {
         foreach ($this->EE->api_channel_categories->categories as $cat_id => $cat) {
             if ($cat[4]) {
                 $data = $cat[0];
                 break;
             }
         }
     }
     // If there is no category set, fetch the default category if set.
     if (!$data && $this->channel_id) {
         $data = $this->EE->api_channel_structure->get_channel_info($this->channel_id)->row('deft_category');
     }
     $tmp = array();
     $options = array();
     $cats = $this->_fetch_categories();
     $cat_group = NULL;
     foreach ($cats as $val) {
         $indent = $val['parent_id'] != 1 ? repeater(NBS . NBS . NBS, $val['parent_id']) : '';
         $tmp[$val['cat_group_name']][$val['cat_id']] = $indent . $val['cat_name'];
     }
     $options[''] = $this->EE->lang->line('loncat_none');
     if (count($tmp) === 1) {
         foreach ($tmp[$val['cat_group_name']] as $cat_id => $cat) {
             $options[$cat_id] = $cat;
         }
     } else {
         $options = array_merge($options, $tmp);
     }
     return form_dropdown($this->field_name, $options, $data);
 }
开发者ID:grimsmath,项目名称:lavillafdn,代码行数:38,代码来源:ft.lonely_cat.php

示例14: update

 function update()
 {
     if (!IS_MEMBER || !$this->input->post('type')) {
         return FALSE;
     }
     // 게시판 관리자 검증 필요
     // if (!IS_ADMIN) { ... }
     $w = $this->input->post('w');
     $ca_code = str_replace('-', '.', $this->input->post('ca_code'));
     if ($this->input->post('ca_name')) {
         $ca_name = $this->input->post('ca_name');
     }
     if ($w == '') {
         $this->Categoryform_model->insert($ca_code, $ca_name);
     } else {
         if ($w == 'u') {
             $this->Categoryform_model->update($ca_code, $ca_name);
         } else {
             if ($w == 'd') {
                 $code_exp = explode('.', $ca_code);
                 if (!isset($code_exp[1])) {
                     $limit_code = $ca_code + 1;
                 } else {
                     $code_ori = substr($code_exp[1], 0, -3);
                     $code_num = substr($code_exp[1], -3) + 1;
                     $code_plus = repeater('0', 3 - strlen($code_num)) . $code_num;
                     $limit_code = $code_exp[0] . '.' . $code_ori . $code_plus;
                 }
                 $this->Categoryform_model->delete($ca_code, $limit_code);
             } else {
                 exit('Access Error');
             }
         }
     }
     echo 'TRUE';
 }
开发者ID:ubiopen,项目名称:KI_Board,代码行数:36,代码来源:category.php

示例15: contents

	/**
	 * Show the folders contents
	 */
	public function contents($id = 0, $filter = '')
	{
		if ($id)
		{
			$folder = $this->file_folders_m->get($id);
		}
		elseif ($path = $this->input->get('path'))
		{
			$folder = $this->file_folders_m->get_by_path($path);
			$filter = $this->input->get('filter');
		}

		if ( ! (isset($folder) && $folder))
		{
			if ($this->input->is_ajax_request())
			{
				$status		= 'error';
				$message	= lang('file_folders.not_exists');

				$data = array();
				$data['messages'][$status] = $message;
				$message = $this->load->view('admin/partials/notices', $data, TRUE);

				return $this->template->build_json(array(
					'status'	=> $status,
					'message'	=> $message
				));
			}

			show_error(lang('file_folders.not_exists'));
			return;
		}
		elseif ( ! isset($folder->root_id))
		{
			$folder->root_id		= $this->_folders[$folder->id]->root_id;
			$folder->virtual_path	= $this->_folders[$folder->id]->virtual_path;
		}

		$this->load->library('table');

		// Make a breadcrumb trail
		$this->data->crumbs = $this->file_folders_m->breadcrumb($folder->id);

		// Get a list of all child folders
		$sub_folders = $this->file_folders_m->folder_tree($folder->root_id);

		// Array for select
		$this->data->sub_folders = array();
		foreach ($sub_folders as $sub_folder)
		{
			$this->data->sub_folders[$sub_folder->virtual_path] = repeater('&raquo; ', $sub_folder->depth) . $sub_folder->name;
		}

		$root_folder = $this->_folders[$folder->root_id];

		// Set a default label
		$this->data->sub_folders = $this->data->sub_folders
			? array($root_folder->virtual_path => lang('files.dropdown_root')) + $this->data->sub_folders
			: array($root_folder->virtual_path => lang('files.dropdown_no_subfolders'));

		// Get the selected information.
		$this->data->folder				= $folder;
		$this->data->selected_filter	= $filter;

		// Avaliable type filters
		$this->data->types = array();

		$this->db
			->select('type as letter')
			->group_by('type');

		$types = $this->file_m->get_many_by('folder_id', $folder->id);

		foreach ($types as $type)
		{
			$this->data->types[$type->letter] = lang('files.type_' . $type->letter);
		}

		asort($this->data->types);

		// Get all files
		in_array($filter, array('a', 'v', 'd', 'i', 'o')) && $this->db->where('type', $filter);

		$this->data->files = $this->file_m
			->order_by('date_added', 'DESC')
			->get_many_by('folder_id', $folder->id);

		// Response ajax
		if ($this->input->is_ajax_request())
		{
			$content	= $this->load->view('admin/folders/contents', $this->data, TRUE);
			$navigation	= $this->load->view('admin/partials/nav', array(
				'file_folders'	=> $this->_folders,
				'current_id'	=> $folder->root_id
			), TRUE);

			return $this->template->build_json(array(
//.........这里部分代码省略.........
开发者ID:JamieLomas,项目名称:pyrocms,代码行数:101,代码来源:admin_folders.php


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