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


PHP reduce_multiples函数代码示例

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


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

示例1: _slug

 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     if (!empty($this->slug) && $this->slug !== '__generate__') {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($this->title), 'dash')), '-', true);
     if (empty($slug)) {
         $t = new Album();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     $s = new Slug();
     while ($s->where('id', "album.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('album.{$slug}')");
     $this->slug = $slug;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:25,代码来源:album.php

示例2: send_admin_notification

 /**
  * Send admin notification
  *
  * Sends an admin notification email
  *
  * @access	public
  * @param	string
  * @param	int
  * @param	int
  */
 function send_admin_notification($notify_address, $channel_id, $entry_id)
 {
     ee()->api->instantiate('channel_structure');
     ee()->load->model('channel_entries_model');
     $e = ee()->channel_entries_model->get_entry($entry_id, $channel_id);
     $c = ee()->api_channel_structure->get_channel_info($channel_id);
     $swap = array('name' => ee()->session->userdata('screen_name'), 'email' => ee()->session->userdata('email'), 'channel_name' => $c->row('channel_title'), 'entry_title' => $e->row('title'), 'entry_url' => reduce_double_slashes($c->row('channel_url') . '/' . $e->row('url_title')), 'comment_url' => reduce_double_slashes($c->row('comment_url') . '/' . $e->row('url_title')), 'cp_edit_entry_url' => cp_url('content_publish/entry_form', array('site_id' => $e->row('site_id'), 'channel_id' => $e->row('channel_id'), 'entry_id' => $e->row('entry_id')), TRUE));
     $template = ee()->functions->fetch_email_template('admin_notify_entry');
     $email_tit = ee()->functions->var_swap($template['title'], $swap);
     $email_msg = ee()->functions->var_swap($template['data'], $swap);
     // We don't want to send a notification to the user
     // triggering the event
     if (strpos($notify_address, ee()->session->userdata('email')) !== FALSE) {
         $notify_address = str_replace(ee()->session->userdata('email'), "", $notify_address);
     }
     $notify_address = reduce_multiples($notify_address, ',', TRUE);
     if ($notify_address != '') {
         //	Send email
         ee()->load->library('email');
         foreach (explode(',', $notify_address) as $addy) {
             ee()->email->EE_initialize();
             ee()->email->wordwrap = false;
             ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
             ee()->email->to($addy);
             ee()->email->reply_to(ee()->config->item('webmaster_email'));
             ee()->email->subject($email_tit);
             ee()->email->message(entities_to_ascii($email_msg));
             ee()->email->send();
         }
     }
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:41,代码来源:Notifications.php

示例3: clearLogs

 public function clearLogs()
 {
     $directory = reduce_multiples(DOCROOT . SITEPATH . BASEPATH . 'logs/', '/');
     if (!@is_dir($directory)) {
         show_error('Directory not found.<br/><em>Path: ' . $directory . '</em>');
     }
     return shell_exec('rm -fv ' . $directory . 'log-*.php');
 }
开发者ID:vsa-partners,项目名称:typologycms,代码行数:8,代码来源:Site_maintenance.php

示例4: zonepath

function zonepath($file = null, $zone = null)
{
    $zone = is_null($zone) ? CI()->zone : $zone;
    $path = SITEPATH . 'cms/' . $zone . '/';
    if (!is_null($file)) {
        $path .= '/' . $file;
    }
    return reduce_multiples($path, '/');
}
开发者ID:vsa-partners,项目名称:typologycms,代码行数:9,代码来源:misc_helper.php

示例5: _slug

 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     if (!empty($this->old_slug)) {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     if (empty($this->title)) {
         $info = pathinfo($this->filename);
         $base = $info['filename'];
     } else {
         $base = $this->title;
     }
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($base), 'dash')), '-', true);
     if ($slug === $this->slug) {
         return true;
     }
     if (empty($slug)) {
         $t = new Content();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     $s = new Slug();
     // Need to lock the table here to ensure that requests arriving at the same time
     // still get unique slugs
     if ($this->has_db_permission('lock tables')) {
         $this->db->query("LOCK TABLE {$s->table} WRITE");
         $locked = true;
     } else {
         $locked = false;
     }
     while ($s->where('id', "content.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('content.{$slug}')");
     if ($locked) {
         $this->db->query('UNLOCK TABLES');
     }
     if (empty($this->old_slug)) {
         if (!empty($this->slug) && $this->slug !== '__generate__') {
             $this->old_slug = ',' . $this->slug . ',';
         } else {
             if (!empty($this->title)) {
                 $this->old_slug = ',' . $slug . ',';
             }
         }
     }
     $this->slug = $slug;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:54,代码来源:content.php

示例6: test_reduce_multiples

 public function test_reduce_multiples()
 {
     $strs = array('Fred, Bill,, Joe, Jimmy' => 'Fred, Bill, Joe, Jimmy', 'Ringo, John, Paul,,' => 'Ringo, John, Paul,');
     foreach ($strs as $str => $expect) {
         $this->assertEquals($expect, reduce_multiples($str));
     }
     $strs = array('Fred, Bill,, Joe, Jimmy' => 'Fred, Bill, Joe, Jimmy', 'Ringo, John, Paul,,' => 'Ringo, John, Paul');
     foreach ($strs as $str => $expect) {
         $this->assertEquals($expect, reduce_multiples($str, ',', TRUE));
     }
 }
开发者ID:saiful1105020,项目名称:Under-Construction-Bracathon-Project-,代码行数:11,代码来源:string_helper_test.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $lang = new MY_Lang();
     $lang->load('install');
     $lang->load('main');
     //        $this->host = 'http://' . str_replace('index.php', '', $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']) . 'index.php/';
     $this->load->helper('string');
     $this->load->helper('form_csrf');
     $this->host = reduce_multiples($this->host);
     $this->loadedExt = get_loaded_extensions();
 }
开发者ID:RandomUsernameHere,项目名称:megainfo-corporate-cms,代码行数:12,代码来源:_install.php

示例8: index

 function index()
 {
     // Make sure the user is not already logged in.
     if ($this->authentication->isLoggedIn()) {
         // Already logged in
         redirect('/');
     }
     $form_action = $this->session->flashdata('redirect_uri') ? reduce_multiples(SITEPATH . $this->session->flashdata('redirect_uri'), '/') : $this->config->item('base_url');
     $this->layout->appendTitle('Please Login');
     $this->layout->setLayout('plain');
     $this->layout->setBodyClass('popup plain');
     $this->load->view('login/index', array('form_action' => $form_action));
 }
开发者ID:vsa-partners,项目名称:typologycms,代码行数:13,代码来源:login.php

示例9: get

 public function get($fields = array(), $return = false)
 {
     $item = parent::get($fields);
     $item_updated = array();
     if (count($item)) {
         // Make model specific updates to result array
         for ($i = 0; $i < count($item); $i++) {
             $row = $item[$i];
             if (empty($params['SELECT_SET']) || $params['SELECT_SET'] != 'basic') {
                 $row['sort_name'] = strtolower($row['title']);
                 $row['date'] = date('m-d-Y H:i', strtotime($row[$this->date_field['update']]));
                 $row['timestamp'] = date('U', strtotime($row[$this->date_field['update']]));
                 // Only perform the following if this is a file
                 if (!empty($row['type']) && $row['type'] == 'file') {
                     $var_length = (int) $this->FILE_CONF['file_dir_depth'] * 3;
                     $path_array = str_split(str_pad($row[$this->id_field], $var_length, '0', STR_PAD_LEFT), 3);
                     $upload_path = implode('/', $path_array);
                     /*
                     // To get the file's directory path. Don't need but lets keep around.		
                     unset($path_array[count($path_array)-1]);
                     $dir_path					= implode('/', $path_array);
                     $row['server_dir'] 			= DOCROOT . $this->FILE_CONF['file_location'] . $dir_path;
                     */
                     $base_view_path = $row[$this->id_field] . ($this->FILE_CONF['force_name_in_uri'] ? '/' . $row['file_name'] : '') . $row['ext'];
                     // Add file paths
                     //							$row['real_path'] 			= DOCROOT . zonepath($this->FILE_CONF['file_directory'] . '/' . $upload_path . $row['ext'], 'local');
                     $row['base_path'] = DOCROOT . zonepath($this->FILE_CONF['file_directory'] . '/' . $upload_path, 'local');
                     $row['server_path'] = $row['base_path'] . $row['ext'];
                     $row['view_path'] = reduce_multiples($this->FILE_CONF['file_website_location'] . $base_view_path, '/');
                     $row['manage_path'] = reduce_multiples(SITEPATH . $this->zone . CI()->SITE_CONF['file_uri_trigger'] . '/' . $base_view_path, '/');
                     // Add file size
                     $row['file_size'] = file_exists($row['server_path']) ? filesize($row['server_path']) : 0;
                     $row['file_size_display'] = file_exists($row['server_path']) ? $this->formatFileSize(filesize($row['server_path'])) : 0;
                 }
             }
             $item_updated[] = $row;
         }
         if (count($item_updated) > 1 && !empty($item_updated[0]['sort_name'])) {
             // Sort array
             $sort_array = array();
             foreach ($item_updated as $row) {
                 $sort_array[] = $row['sort_name'];
             }
             array_multisort($sort_array, SORT_ASC, $item_updated);
         }
     }
     return $item_updated;
 }
开发者ID:vsa-partners,项目名称:typologycms,代码行数:48,代码来源:file_model.php

示例10: del_asset

 /**
  *  @Description: description
  *       @Params: assetid
  *
  *  	 @returns: array (sectionid, entryid)
  */
 public function del_asset($assetid)
 {
     $this->db->select('*');
     $this->db->from('assetfields');
     $this->db->where('id', $assetid);
     $this->db->limit(1);
     $query = $this->db->get();
     $entryid = "";
     $fieldname = "";
     foreach ($query->result() as $row) {
         $entryid = $row->entryid;
         $fieldname = $row->fieldname;
     }
     //now get the sectionid
     $this->db->select('sectionid');
     $this->db->from('entry');
     $this->db->where('id', $entryid);
     $this->db->limit(1);
     $query2 = $this->db->get();
     $sectionid = "";
     foreach ($query2->result() as $row) {
         $sectionid = $row->sectionid;
     }
     //now do the delete
     $this->db->where('id', $assetid);
     $this->db->delete('assetfields');
     //now remove from contents table
     $this->db->select($fieldname);
     $this->db->from('content');
     $this->db->where('entryid', $entryid);
     $query = $this->db->get();
     $orig = "";
     foreach ($query->result() as $row) {
         $orig = $row->{$fieldname};
     }
     //remove id rebuild comma delimited string
     $orig = str_replace($assetid, "", $orig);
     //utlitise string helper to tidy comma output
     $orig = reduce_multiples($orig, ",", TRUE);
     $object = array($fieldname => $orig);
     $this->db->where('entryid', $entryid);
     $this->db->update('content', $object);
     $tmp = array('entryid' => $entryid, 'sectionid' => $sectionid);
     return $tmp;
 }
开发者ID:freeztime,项目名称:ignitedcms-pro,代码行数:51,代码来源:Stuff_entries.php

示例11: contents

 /**
  * Show the folders contents
  */
 public function contents($id = '', $filter = '')
 {
     if (!$this->file_folders_m->exists($id)) {
         show_error(lang('files.folders.not_exists'));
     }
     $this->load->library('table');
     // Make a breadcrumb trail
     $crumbs = $this->file_folders_m->breadcrumb($id);
     $breadcrumb = '';
     foreach ($crumbs as $item) {
         $breadcrumb .= $item['name'] . ' &raquo; ';
     }
     $this->data->crumbs = trim(reduce_multiples($breadcrumb, "&raquo; "));
     // Get a list of all child folders
     $this->file_folders_m->clear_folders();
     if (isset($crumbs[0]['id']) && $crumbs[0]['id'] != '') {
         $this->file_folders_m->folder_tree($crumbs[0]['id']);
     } else {
         $this->file_folders_m->folder_tree($id);
     }
     $sub_folders = $this->file_folders_m->get_folders();
     // Get the selected information.
     $this->data->folder = $this->file_folders_m->get($id);
     $this->data->selected_folder = 0;
     $this->data->id = $id;
     $this->data->selected_filter = $filter;
     $this->data->types = array('a' => lang('files.a'), 'v' => lang('files.v'), 'd' => lang('files.d'), 'i' => lang('files.i'), 'o' => lang('files.o'));
     $this->file_m->order_by('date_added', 'DESC');
     // Get all files
     if ($filter != '') {
         $this->data->files = $this->file_m->get_many_by(array('folder_id' => $id, 'type' => $filter));
     } else {
         $this->data->files = $this->file_m->get_many_by('folder_id', $id);
     }
     // Set a default label
     if (empty($sub_folders)) {
         $sub_folders = array(0 => lang('files.dropdown.no_subfolders'));
     } else {
         $sub_folders = array(0 => lang('files.dropdown.root')) + $sub_folders;
     }
     $this->data->sub_folders = $sub_folders;
     $this->load->view('admin/folders/contents', $this->data);
 }
开发者ID:vmichnowicz,项目名称:pyrocms,代码行数:46,代码来源:admin_folders.php

示例12: __construct

 function __construct()
 {
     parent::__construct();
     $this->checkPHPVersion();
     $this->load->helper(array('form', 'url', 'date', 'html_entities', 'string', 'encryption'));
     $this->load->library(array('session', 'xsl_transform'));
     $this->load->model('config_model');
     $this->SITE_CONF = $this->loadConfig('website');
     // Show output profiler?
     if ($this->input->get('show_profiler')) {
         $this->output->enable_profiler(TRUE);
     }
     $this->current_uri = reduce_multiples(SITEPATH . $this->uri->uri_string(), '/');
     // Set timezone
     if (!empty($this->SITE_CONF['timezone'])) {
         date_default_timezone_set($this->SITE_CONF['timezone']);
     }
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
         $this->is_ajax = TRUE;
     }
 }
开发者ID:vsa-partners,项目名称:typologycms,代码行数:21,代码来源:application.php

示例13: _slug

 function _slug($field)
 {
     if ($this->edit_slug()) {
         return true;
     }
     $this->load->helper(array('url', 'text', 'string'));
     $slug = reduce_multiples(strtolower(url_title(convert_accented_characters($this->title), 'dash')), '-', true);
     if (empty($slug)) {
         $t = new Text();
         $max = $t->select_max('id')->get();
         $slug = $max->id + 1;
     }
     if (is_numeric($slug)) {
         $slug = "{$slug}-1";
     }
     if ($this->slug === $slug || !empty($this->slug) && $this->slug !== '__generate__') {
         return;
     }
     $s = new Slug();
     // Need to lock the table here to ensure that requests arriving at the same time
     // still get unique slugs
     if ($this->has_db_permission('lock tables')) {
         $this->db->query("LOCK TABLE {$s->table} WRITE");
         $locked = true;
     } else {
         $locked = false;
     }
     $page_type = is_numeric($this->page_type) ? $this->page_type : 0;
     $prefix = $page_type === 1 ? 'page' : 'essay';
     while ($s->where('id', "{$prefix}.{$slug}")->count() > 0) {
         $slug = increment_string($slug, '-');
     }
     $this->db->query("INSERT INTO {$s->table}(id) VALUES ('{$prefix}.{$slug}')");
     if ($locked) {
         $this->db->query('UNLOCK TABLES');
     }
     $this->slug = $slug;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:38,代码来源:text.php

示例14: _member_delete_notifications

 /**
  * Send email notifications to email addresses for the respective member
  * group of the users being deleted
  *
  * @param  Array  $member_ids Array of member_ids being deleted
  * @return void
  */
 private function _member_delete_notifications($member_ids)
 {
     // Email notification recipients
     $group_query = ee()->db->distinct('member_id')->select('screen_name, email, mbr_delete_notify_emails')->join('member_groups', 'members.group_id = member_groups.group_id', 'left')->where('mbr_delete_notify_emails !=', '')->where_in('member_id', $member_ids)->get('members');
     foreach ($group_query->result() as $member) {
         $notify_address = $member->mbr_delete_notify_emails;
         $swap = array('name' => $member->screen_name, 'email' => $member->email, 'site_name' => stripslashes(ee()->config->item('site_name')));
         ee()->lang->loadfile('member');
         $email_title = ee()->functions->var_swap(lang('mbr_delete_notify_title'), $swap);
         $email_message = ee()->functions->var_swap(lang('mbr_delete_notify_message'), $swap);
         // No notification for the user themselves, if they're in the list
         if (strpos($notify_address, $member->email) !== FALSE) {
             $notify_address = str_replace($member->email, "", $notify_address);
         }
         // Remove multiple commas
         $notify_address = reduce_multiples($notify_address, ',', TRUE);
         if ($notify_address != '') {
             ee()->load->library('email');
             ee()->load->helper('text');
             foreach (explode(',', $notify_address) as $addy) {
                 ee()->email->EE_initialize();
                 ee()->email->wordwrap = FALSE;
                 ee()->email->from(ee()->config->item('webmaster_email'), ee()->config->item('webmaster_name'));
                 ee()->email->to($addy);
                 ee()->email->reply_to(ee()->config->item('webmaster_email'));
                 ee()->email->subject($email_title);
                 ee()->email->message(entities_to_ascii($email_message));
                 ee()->email->send();
             }
         }
     }
 }
开发者ID:vigm,项目名称:advancedMD,代码行数:39,代码来源:Members.php

示例15: get_cats_by_article

 /**
  * Get Category By Article.
  *
  * Get a list of categories an article is associated with.
  *
  * @access	public
  * @param	int	the unique id
  * @return	array
  */
 function get_cats_by_article($id)
 {
     $this->db->from('article2cat');
     $this->db->join('categories', 'category_id_rel = cat_id', 'left');
     $this->db->where('article_id_rel', (int) $id);
     $this->db->where('cat_display', 'yes');
     $query = $this->db->get();
     if ($query->num_rows() == 0) {
         return FALSE;
     }
     $this->load->helper('string');
     $output = '';
     foreach ($query->result_array() as $row) {
         $output .= ' ' . anchor('categories/' . $row['cat_uri'], $row['cat_name']) . ',';
     }
     return reduce_multiples($output, ',', TRUE);
 }
开发者ID:68kb,项目名称:68kb,代码行数:26,代码来源:categories_model.php


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