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


PHP General::clip_words方法代码示例

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


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

示例1: make_table


//.........这里部分代码省略.........
        $vars['num_pages'] = $pages = $this->get_pages();
        $vars['num_entries'] = $num_rows;
        $vars['prev_url'] = ($prev = $this->prev_link()) ? SELF_URL . '?' . $prev . '&' . $this->GET_2_url('start') : '';
        $vars['next_url'] = ($next = $this->next_link()) ? SELF_URL . '?' . $next . '&' . $this->GET_2_url('start') : '';
        $vars['this_page'] = $this->get_page();
        $vars['results_per_page_get_vars'] = $this->GET_2_input('results_per_page');
        $vars['results_per_page'] = $results_per_page;
        $vars['page_browser'] = $template->parse_template('PAGE_BROWSER', $vars);
        $vars['pagination'] = $this->pagination();
        foreach ($this->cols_array as $key => $value) {
            $name = $this->cols_array[$key]['name'];
            if ($_GET['order'] == $key) {
                if ($_GET['dir'] == 'asc') {
                    $name .= '▲';
                } else {
                    $name .= '▼';
                }
                //down
                $dir = $_GET['dir'] == 'desc' ? 'asc' : 'desc';
            } else {
                if (!isset($_GET['order']) && $key == $this->order_by) {
                    if ($this->order_dir == 'ASC') {
                        $name .= '▲';
                        // up
                        $dir = 'desc';
                    } else {
                        $name .= '▼';
                        //down
                        $dir = 'asc';
                    }
                } else {
                    $dir = $this->order_dir == 'ASC' ? 'asc' : 'desc';
                }
            }
            $vars[$key . '_sort'] = $this->make_btn_link(SELF_URL . '?' . $this->GET_2_url(array('order', 'dir')) . '&order=' . rawurlencode($key) . '&dir=' . $dir, $name, array('class' => 'button', 'style' => 'display:block'));
        }
        $return_string .= $template->parse_template('PRE', $vars);
        $alternatig_rows = 0;
        foreach ($result as $entry) {
            $entry = array_merge($vars, $entry);
            foreach ($entry as $key => $value) {
                $entry[$key . '_name'] = $this->cols_array[$key]['name'];
                if ($this->cols_array[$key]['options'] && ($this->cols_array[$key]['type'] == 'check' || $this->cols_array[$key]['type'] == 'radio' || $this->cols_array[$key]['type'] == 'select')) {
                    $options[$key] = $this->get_options($this->cols_array[$key]['options'], $this->cols_array[$key]['options_sort'], $this->cols_array[$key]['options_insert_id']);
                    $v = explode('&delim;', $value);
                    $v = General::trim_array($v);
                    $value = array();
                    foreach ($v as $k) {
                        if ($options[$key][$k]) {
                            $value[] = $options[$key][$k];
                        } else {
                            $value[] = $k;
                        }
                    }
                    $value = count($value) ? implode(', ', $value) : '';
                }
                if ($this->cols_array[$key]['type'] == 'timestamp') {
                    $value = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : '';
                }
                if ($this->cols_array[$key]['type'] == 'upload') {
                    $value = rawurlencode($value);
                } elseif ($this->cols_array[$key]['type'] != 'textarea') {
                    $value = htmlspecialchars($value);
                }
                if ($this->cols_array[$key]['type'] == 'textarea' && !$this->cols_array[$key]['html']) {
                    $value = nl2br(htmlspecialchars($value));
                }
                if ($this->cols_array[$key]['max_length'] && strlen($value) > $this->cols_array[$key]['max_length']) {
                    $value = General::clip_words($value, $this->cols_array[$key]['max_length']);
                }
                if ($transform = $this->cols_array[$key]['transform']) {
                    if (is_callable($transform)) {
                        $value = $transform($key, $value);
                    } else {
                        eval($transform);
                    }
                }
                $entry[$key] = $value;
            }
            if ($this->edit_enabled) {
                $icons['edit'] = Html::img('/Libraries/Icons/16x16/edit.png', '');
                $icons['delete'] = Html::img('/Libraries/Icons/16x16/cancel.png', '');
                $entry['edit_btn_url'] = SELF_URL . '?edit=' . $entry['id'] . '&' . $this->GET_2_url();
                $entry['delete_btn_url'] = SELF_URL . '?delete=' . $entry['id'] . '&' . $this->GET_2_url('delete', 'noframe');
                $btns['edit'] = Html::a($entry['edit_btn_url'], $icons['edit'], array('title' => 'Eintrag bearbeiten'));
                $btns['delete'] = Html::a($entry['delete_btn_url'], $icons['delete'], array('title' => 'Eintrag löschen', 'onclick' => 'return delete_confirm(this,\'' . $entry['id'] . '\')'));
                $entry['edit_btn'] = $btns['edit'];
                $entry['delete_btn'] = $btns['delete'];
                $entry['edit_btns'] = implode(' ', $btns);
            }
            $entry['alt_row'] = ' alt_row_' . $alternatig_rows;
            $return_string .= $template->parse_template('LOOP', $entry);
            $alternatig_rows = $alternatig_rows == 1 ? 0 : 1;
        }
        if (!count($result)) {
            $return_string .= $template->parse_template('NO_RESULTS', $vars);
        }
        $return_string .= $template->parse_template('POST', $vars);
        return $return_string;
    }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:101,代码来源:Scaffold.php

示例2: next_dates

 function next_dates()
 {
     $show_sql = "SELECT * FROM `{$this->db_table}` WHERE `DTSTART` >= '" . Date::now() . "' AND `CLASS` = 'PUBLIC' ORDER BY `DTSTART` ASC LIMIT 0,{$this->num_show_next_dates}";
     $vars = array();
     $template = new Template(INSTALL_PATH . '/Module/Kalender/Templates/NextDates.template.html');
     $return = $template->parse_template('PRE', $vars);
     $entries = $this->connection->db_assoc($show_sql);
     foreach ($entries as $entry) {
         $date = $entry['DTSTART'];
         $entry['start_tag'] = Date::tag($date);
         $entry['start_num_monat'] = Date::monat($date);
         $entry['start_monat'] = Date::month_name($entry['start_num_monat'], 'kurz');
         $entry['start_jahr'] = Date::jahr($date);
         $date = $entry['DTEND'];
         if ($date) {
             $entry['end_tag'] = Date::tag($date);
             $entry['end_num_monat'] = Date::monat($date);
             $entry['end_monat'] = Date::month_name($entry['end_num_monat'], 'kurz');
             $entry['end_jahr'] = Date::jahr($date);
         }
         $entry['clip'] = General::clip_words($entry['SUMMARY'], 50);
         $return .= $template->parse_template('LOOP', $entry);
     }
     $return .= $template->parse_template('POST', $vars);
     return $return;
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:26,代码来源:Kalender.php

示例3: make_table

 function make_table($sql = '', $template = '')
 {
     $db_table = $this->table;
     $vars = is_array($this->template_vars) ? $this->template_vars : array();
     $order_by = $this->order_by ? $this->order_by : 'id';
     $order_dir = $this->order_dir ? $this->order_dir : 'ASC';
     $results_per_page = $this->results_per_page ? $this->results_per_page : '';
     $start_by = $_GET['start'] ? $_GET['start'] : 0;
     if ($sql == '') {
         $sql = "SELECT * FROM `{$db_table}` ORDER BY `{$order_by}` {$order_dir}";
     }
     $vars['pages'] = $this->get_pages($sql);
     $vars['page'] = $this->get_page();
     if ($results_per_page || $start_by) {
         if (!$this->num_rows) {
             $num_rows = $this->num_rows = $this->connection->db_num_rows($sql);
         } else {
             $num_rows = $this->num_rows;
         }
         if (!$results_per_page) {
             $results_per_page = $num_rows;
         }
         $sql .= " LIMIT {$start_by},{$results_per_page}";
     }
     $result = $this->connection->db_assoc($sql);
     $template = new Template($template);
     $vars['next_link'] = ($next = $this->next_link()) ? "?{$next}" : '';
     $vars['next_link'] .= $this->room && $vars['next_link'] ? "&room=" . $this->room : '';
     $vars['prev_link'] = ($prev = $this->prev_link()) ? "?{$prev}" : '';
     $vars['prev_link'] .= $this->room && $vars['prev_link'] ? "&room=" . $this->room : '';
     $return_string = '';
     $return_string .= $template->parse_template('PRE', $vars);
     $alternatig_rows = 0;
     $loop_count = 0;
     $einzel = 0;
     $row = '';
     for ($i = 0; $i < ($count = count($result)); $i++) {
         $loop_count++;
         $result[$i] = array_merge($vars, $result[$i]);
         foreach ($result[$i] as $key => $value) {
             if (is_array($this->cols_array[$key]['options'])) {
                 $result[$i][$key] = $this->cols_array[$key]['options'][$value];
             }
             if ($this->cols_array[$key]['type'] == 'timestamp') {
                 $result[$i][$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : '';
             }
             if ($this->cols_array[$key]['type'] == 'upload') {
                 $result[$i][$key] = rawurlencode($value);
             } elseif (!$this->cols_array[$key]['html']) {
                 $result[$i][$key] = htmlspecialchars($value);
             }
         }
         $result[$i]['Dateiname'] = rawurlencode($result[$i]['Dateiname']);
         $result[$i]['Titelbild'] = rawurlencode($result[$i]['Titelbild']);
         $result[$i]['clip_name'] = General::clip_words($result[$i]['Name'], 22);
         $room = $_GET['room'] ? $_GET['room'] : $result[$i]['RoomId'];
         $result[$i]['einzel_link'] = SELF . '?room=' . $room . '&amp;start=' . $_GET['start'];
         if (!$this->exhibition_room_selection) {
             $result[$i]['einzel_link'] .= '&amp;Einzelansicht=' . $einzel;
         }
         $result[$i]['alt_row'] = ' alt_row_' . $alternatig_rows;
         $row .= $template->parse_template('LOOP', $result[$i]);
         if ($loop_count == 4 || $i == $count - 1) {
             if ($i == $count - 1) {
                 for ($j = $loop_count; $j < 4; $j++) {
                     $row .= '<td class="gal_element">&nbsp;</td>';
                 }
             }
             $return_string .= '<tr>' . $row . '</tr>';
             $row = '';
             $loop_count = 0;
         }
         $alternatig_rows = $alternatig_rows == 1 ? 0 : 1;
         //$einzel = ($einzel == $this->results_per_page-1) ? 0 : $einzel++;
         $einzel++;
     }
     $return_string .= $template->parse_template('POST', $vars);
     return $return_string;
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:79,代码来源:GalerieScaffold.php


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