• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP word_wrap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: openevent

function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '')
{
    global $cpath, $timeFormat, $dateFormat_week;
    # Strip all dollar signs from printable array entries; regex functions will mutilate them
    foreach ($arr as $key => $val) {
        $arr[$key] = str_replace('$', '$', $val);
    }
    $return = '';
    $event_text = stripslashes(urldecode($arr['event_text']));
    # build tooltip
    $title = makeTitle($arr, $time);
    # for iCal pseudo tag <http> comptability
    if (ereg('<([[:alpha:]]+://)([^<>[:space:]]+)>', $event_text, $matches)) {
        $full_event_text = $matches[1] . $matches[2];
        $event_text = $matches[2];
    } else {
        $full_event_text = $event_text;
        //$event_text = strip_tags($event_text, '<b><i><u><img>');
    }
    if (!empty($link_class)) {
        $link_class = ' class="' . $link_class . '"';
    }
    if (!empty($event_text)) {
        //$event_text=str_replace("\n","£",$event_text);
        $title = strip_tags(str_replace('<br />', "\n", $title));
        if ($lines > 0) {
            $event_text = word_wrap($event_text, $length, $lines);
        }
        if (!ereg('([[:alpha:]]+://[^<>[:space:]]+)', $full_event_text, $res) || $arr['description']) {
            $escaped_date = addslashes($event_date);
            $escaped_time = addslashes($time);
            $escaped_uid = addslashes($uid);
            $event_data = addslashes(serialize($arr));
            // fix for URL-length bug in IE: populate and submit a hidden form on click
            static $popup_data_index = 0;
            $return = "\n\t\t\t\t<script language='Javascript' type='text/javascript'><!--\n\t\t\t\tvar eventData = new EventData('{$escaped_date}', '{$escaped_time}', '{$escaped_uid}','{$cpath}','{$event_data}');\n\t\t\t\tdocument.popup_data[{$popup_data_index}] = eventData;\n\t\t\t\t// --></script>";
            $return .= '<a' . $link_class . ' title="' . $title . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">';
            $popup_data_index++;
        } else {
            $return .= '<a' . $link_class . ' title="' . $title . '" href="' . $res[1] . '">';
        }
        $return .= $pre_text . $event_text . $post_text . '</a>' . "\n";
        //$return = str_replace("£","\n",$return);
    }
    return $return;
}
开发者ID:bilsan,项目名称:schedule-generator,代码行数:46,代码来源:date_functions.php


示例2: _parse_single

 public function _parse_single($key, $val, $string)
 {
     $newval = $val;
     $find = "/" . $this->l_delim . "" . $key . ".*" . $this->r_delim . "/U";
     preg_match($find, $string, $matches);
     if (!empty($matches)) {
         $temp = trim($matches[0], "{}");
         $res = explode(":", $temp);
         // var_dump($res);
         if (count($res) > 1) {
             switch ($res[1]) {
                 case "allcaps":
                     $newval = strtoupper($val);
                     break;
                 case "money":
                     $newval = number_format((int) $val, 2, ".", ",");
                     break;
                 case "caps":
                     $newval = ucwords(strtolower($val));
                     break;
                 case "nocaps":
                     $newval = strtolower($val);
                     break;
                 case "ucfirst":
                     $newval = ucfirst($val);
                     break;
                 case "bool1":
                     $newval = $val == 1 ? "True" : "False";
                     break;
                 case "bool2":
                     $newval = $val == 1 ? "Yes" : "No";
                     break;
                 case "bool3":
                     $newval = $val == 1 ? "Active" : "Inactive";
                     break;
                 case "climit":
                     $int = count($res) < 3 ? 128 : $res[2];
                     $newval = character_limiter($val, $int);
                     break;
                 case "htmlchars":
                     $newval = quotes_to_entities($val);
                     break;
                 case "wlimit":
                     $int = count($res) < 3 ? 25 : $res[2];
                     $newval = word_limiter($val, $int);
                     break;
                 case "wrap":
                     $int = count($res) < 3 ? 76 : $res[2];
                     $newval = word_wrap($val, $int);
                     break;
                 case "hilite":
                     $str = count($res) < 3 ? "" : $res[2];
                     $color = count($res) < 4 ? "#990000" : $res[3];
                     $newval = highlight_phrase($val, $str, "<span style=\"color:{$color}\">", "</span>");
                     break;
                 case "safe_mailto":
                     $alt_text = count($res) < 3 ? "" : $res[2];
                     $newval = safe_mailto($val, $alt_text);
                     break;
                 case "url_title":
                     $sep = count($res) < 3 ? "dash" : $res[2];
                     $newval = url_title($val, $sep);
                     break;
                 case "remove_img":
                     $newval = strip_image_tags($val);
                     break;
                 case "hash":
                     $hash = count($res) < 3 ? "md5" : $res[2];
                     $newval = dohash($val, $hash);
                     break;
                 case "stripslashes":
                     $newval = stripslashes($val);
                     break;
                 case "strip_tags":
                     $allowed = count($res) < 3 ? "" : $res[2];
                     $newval = strip_tags($val, $allowed);
                     break;
                     /** other output string format options here **/
             }
             return str_replace($matches[0], $newval, $string);
         }
     }
     return parent::_parse_single($key, $val, $string);
 }
开发者ID:silentworks,项目名称:vaspasian,代码行数:84,代码来源:Vaspasian_Parser.php


示例3: openevent

function openevent($calendar_name, $start, $end, $arr, $lines, $wrap, $pre_text, $post_text, $link_class, $url)
{
    $event_text = stripslashes(urldecode($arr["event_text"]));
    # for iCal pseudo tag <http> comptability
    if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>", $event_text, $matches)) {
        $full_event_text = $matches[1] . $matches[2];
        $event_text = $matches[2];
    } else {
        $full_event_text = $event_text;
        $event_text = strip_tags($event_text, '<b><i><u>');
    }
    if (isset($arr["organizer"])) {
        $organizer = addslashes($arr["organizer"]);
    }
    if (isset($arr["attendee"])) {
        $attendee = addslashes($arr["attendee"]);
    }
    if (isset($arr["location"])) {
        $location = addslashes($arr["location"]);
    }
    if (isset($arr["status"])) {
        $status = addslashes($arr["status"]);
    }
    if (isset($arr["description"])) {
        $description = addslashes(stripslashes(urldecode($arr["description"])));
    }
    if (isset($arr["url"])) {
        $url = addslashes(stripslashes(urldecode($arr["url"])));
    }
    if (!empty($event_text)) {
        if ($lines > 0) {
            $event_text = word_wrap($event_text, $wrap, $lines);
        }
        if (!ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, $res) || $description) {
            $escaped_event = addslashes($full_event_text);
            $escaped_calendar = addslashes($calendar_name);
            $escaped_start = addslashes($start);
            $escaped_end = addslashes($end);
            // fix for URL-length bug in IE: populate and submit a hidden form on click
            static $popup_data_index = 0;
            echo <<<END

    <script language="Javascript" type="text/javascript"><!--
    var eventData = new EventData('{$escaped_event}', '{$escaped_calendar}', '{$escaped_start}', '{$escaped_end}', '{$description}', '{$status}', '{$location}', '{$organizer}', '{$attendee}', '{$url}');
    document.popup_data[{$popup_data_index}] = eventData;
    // --></script>

END;
            echo '<a class="' . $link_class . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">';
            $popup_data_index++;
        } else {
            echo '<a class="' . $link_class . '" href="' . $res[1] . '">';
        }
        echo $pre_text . $event_text . $post_text . '</a>' . "\n";
    }
}
开发者ID:karl,项目名称:monket-calendar,代码行数:56,代码来源:date_functions.php


示例4: current_url

<div class="body" style="padding-left:20px">
	
	<!--getting the current url-->
	<?php 
//returns current url as string
$data = current_url();
$data2 = word_wrap($data, 100);
//replacing slaches with dashes in url
$data2 = str_replace('/', '-', $data);
?>
	
	<!--javascript confirm box for confirming bookmard adding-->
	<script type="text/javascript">
	function confirmBookmark()
	{
	     var r=confirm("Do you really want to Bookmark This Ad?")
	    if (r==true)
	      return true;
	    else
	      return false;
	}
	</script>
	<!--end of cinfirm box-->
	
	<!--form for bookmark keyword and button-->
	<form action ="<?php 
echo site_url('Full_ads/bookmarking/' . $data2);
?>
" method="post" id="search-form_3" onsubmit="return(confirmBookmark());">
		<?php 
echo form_error('bkmark');
开发者ID:Sanjula007,项目名称:Vehicle_portal,代码行数:31,代码来源:Bookmark_btn.php


示例5: get_vtodo

 function get_vtodo()
 {
     global $template, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines, $show_completed, $show_todos;
     preg_match("!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_completed off -->!is", $this->page, $match1);
     preg_match("!<\\!-- switch show_important on -->(.*)<\\!-- switch show_important off -->!is", $this->page, $match2);
     preg_match("!<\\!-- switch show_normal on -->(.*)<\\!-- switch show_normal off -->!is", $this->page, $match3);
     $completed = trim($match1[1]);
     $important = trim($match2[1]);
     $normal = trim($match3[1]);
     $nugget2 = '';
     if (is_array($master_array['-2'])) {
         foreach ($master_array['-2'] as $vtodo_times) {
             foreach ($vtodo_times as $val) {
                 $vtodo_text = stripslashes(urldecode($val["vtodo_text"]));
                 if ($vtodo_text != "") {
                     if (isset($val["description"])) {
                         $description = stripslashes(urldecode($val["description"]));
                     } else {
                         $description = "";
                     }
                     $completed_date = $val['completed_date'];
                     $event_calna = $val['calname'];
                     $status = $val["status"];
                     $priority = $val['priority'];
                     $start_date = $val["start_date"];
                     $due_date = $val['due_date'];
                     $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text);
                     $vtodo_array = base64_encode(serialize($vtodo_array));
                     $vtodo_text = word_wrap(strip_tags(str_replace('<br />', ' ', $vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines);
                     $data = array('{VTODO_TEXT}', '{VTODO_ARRAY}');
                     $rep = array($vtodo_text, $vtodo_array);
                     // Reset this TODO's category.
                     $temp = '';
                     if ($status == 'COMPLETED' || isset($val['completed_date']) && isset($val['completed_time'])) {
                         if ($show_completed == 'yes') {
                             $temp = $completed;
                         }
                     } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) {
                         $temp = $important;
                     } else {
                         $temp = $normal;
                     }
                     // Do not include TODOs which do not have the
                     // category set.
                     if ($temp != '') {
                         $nugget1 = str_replace($data, $rep, $temp);
                         $nugget2 .= $nugget1;
                     }
                 }
             }
         }
     }
     // If there are no TODO items, completely hide the TODO list.
     if ($nugget2 == '' || $show_todos != 'yes') {
         $this->page = preg_replace('!<\\!-- switch vtodo on -->(.*)<\\!-- switch vtodo off -->!is', '', $this->page);
     } else {
         $this->page = preg_replace('!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_normal off -->!is', $nugget2, $this->page);
     }
 }
开发者ID:jbogota,项目名称:blog-king,代码行数:59,代码来源:template.php


示例6: test_default_word_wrap_charlim

 public function test_default_word_wrap_charlim()
 {
     $string = "Here is a longer string of text that will help us demonstrate the default charlim of this function.";
     $this->assertEquals(strpos(word_wrap($string), "\n"), 73);
 }
开发者ID:rishikeshwalawalkar,项目名称:GetARide,代码行数:5,代码来源:text_helper_test.php


示例7: word_wrap

<?php

function word_wrap($string, $lineWidth)
{
    $exploded = explode(' ', $string);
    $spaceWidth = 1;
    $spaceLeft = $lineWidth;
    $currentLine = '';
    $results = array();
    for ($i = 0; $i < count($exploded); $i++) {
        $word = $exploded[$i];
        if (strlen($word) + $spaceWidth > $spaceLeft) {
            $exploded[$i] = '<br>' . $word;
            $spaceLeft = $lineWidth - strlen($word);
            $results[] = $currentLine;
            $currentLine = '';
        } else {
            $spaceLeft = $spaceLeft - (strlen($word) + $spaceWidth);
            $currentLine = $currentLine . ' ' . $word;
        }
    }
    return $results;
    //return implode(' ', $exploded);
}
word_wrap("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris condimentum eleifend massa vitae auctor. Suspendisse vel consectetur elit. Maecenas facilisis, justo ac suscipit faucibus, odio turpis laoreet est, eget suscipit diam tortor vulputate erat.", 50);
开发者ID:AUCSC,项目名称:news,代码行数:25,代码来源:wordwrap.php


示例8: format_field

function format_field($value, $type, $ticket = NULL)
{
    global $CONFIG;
    global $AppUI;
    global $canEdit;
    switch ($type) {
        case "user":
            if ($value) {
                $output = query2result("SELECT CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = '{$value}'");
            } else {
                $output = "-";
            }
            break;
        case "status":
            if ($canEdit) {
                $output = create_selectbox("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            } else {
                $output = chooseSelectedValue("type_toggle", array("Open" => $AppUI->_("Open"), "Processing" => $AppUI->_("Processing"), "Closed" => $AppUI->_("Closed"), "Deleted" => $AppUI->_("Deleted")), $value);
            }
            break;
        case "priority_view":
            $priority = $CONFIG["priority_names"][$value];
            $color = $CONFIG["priority_colors"][$value];
            if ($value == 3) {
                $priority = "<strong>{$priority}</strong>";
            }
            if ($value == 4) {
                $priority = "<blink><strong>{$priority}</strong></blink>";
            }
            $output = "<font color=\"{$color}\">{$priority}</font>";
            break;
        case "priority_select":
            if ($canEdit) {
                $output = create_selectbox("priority_toggle", $CONFIG["priority_names"], $value);
            } else {
                $output = chooseSelectedValue("priority_toggle", $CONFIG["priority_names"], $value);
            }
            break;
        case "assignment":
            $options[0] = "-";
            $query = "SELECT user_id as id, CONCAT_WS(' ',contact_first_name,contact_last_name) as name FROM users u LEFT JOIN contacts ON u.user_contact = contact_id ORDER BY name";
            $result = do_query($query);
            while ($row = result2hash($result)) {
                $options[$row["id"]] = $row["name"];
            }
            if ($canEdit) {
                $output = create_selectbox("assignment_toggle", $options, $value);
            } else {
                $output = chooseSelectedValue("assignment_toggle", $options, $value);
            }
            break;
        case "view":
            if ($CONFIG["index_link"] == "latest") {
                $latest_value = query2result("SELECT ticket FROM tickets WHERE parent = '{$value}' ORDER BY ticket DESC LIMIT 1");
                if ($latest_value) {
                    $value = $latest_value;
                }
            }
            $output = "<a href=index.php?m=ticketsmith&a=view&ticket={$value}>{$value}&nbsp;";
            $output .= "<img src=images/icons/pencil.gif border=0></a>";
            break;
        case "attach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&ticket={$value}>";
            $output .= "Link</a>";
            break;
        case "doattach":
            $output = "<A href=index.php?m=ticketsmith&a=attach&newparent={$value}&dosql=reattachticket&ticket={$ticket}>";
            $output .= "Link</a>";
            break;
        case "open_date":
            $output = get_time_ago($value);
            if ($CONFIG["warning_active"]) {
                if (time() - $value > $CONFIG["warning_age"] * 3600) {
                    $output = "<font color=\"" . $CONFIG["warning_color"] . "\"><xb>" . $output . "</strong></font>";
                }
            }
            break;
        case "activity_date":
            if (!$value) {
                $output = "<em>" . $AppUI->_('none') . "</em>";
            } else {
                $output = get_time_ago($value);
            }
            $latest_followup_type = query2result("SELECT type FROM tickets WHERE parent = '{$ticket}' ORDER BY timestamp DESC LIMIT 1");
            if ($latest_followup_type) {
                $latest_followup_type = preg_replace("/(\\w+)\\s.*/", "\\1", $latest_followup_type);
                $output .= " [{$latest_followup_type}]";
            }
            break;
        case "elapsed_date":
            $output = date($CONFIG["date_format"], $value);
            $time_ago = get_time_ago($value);
            $output .= " <em>({$time_ago})</em>";
            break;
        case "body":
            if ($CONFIG["wordwrap"]) {
                $value = word_wrap($value, 78);
            }
            $value = htmlspecialchars($value);
            $output = "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"10\">\n";
//.........这里部分代码省略.........
开发者ID:hightechcompany,项目名称:dotproject,代码行数:101,代码来源:common.inc.php


示例9: stripslashes

 $vtodo_text = stripslashes(urldecode($val["vtodo_text"]));
 if ($vtodo_text != "") {
     if (isset($val["description"])) {
         $description = urldecode($val["description"]);
     } else {
         $description = "";
     }
     $completed_date = $val['completed_date'];
     $event_calna = $val['calname'];
     $status = $val["status"];
     $priority = $val['priority'];
     $start_date = $val["start_date"];
     $due_date = $val['due_date'];
     $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text);
     $vtodo_array = base64_encode(serialize($vtodo_array));
     $vtodo_text = word_wrap(strip_tags(str_replace('<br>', ' ', $vtodo_text), '<b><i><u>'), 21, $tomorrows_events_lines);
     $vtodo_link = "<a class=\"psf\" href=\"javascript:openTodoInfo('{$vtodo_array}')\">";
     if ($status == 'COMPLETED' || isset($val['completed_date']) && isset($val['completed_time'])) {
         if ($show_completed == 'yes') {
             $vtodo_text = "<S>{$vtodo_text}</S>";
             echo "<tr><td>{$vtodo_link}<img src=\"images/completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
             echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n";
         }
     } elseif (isset($val['priority']) && $val['priority'] != 0 && $val['priority'] <= 5) {
         echo "<tr><td>{$vtodo_link}<img src=\"images/important.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
         echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n";
     } else {
         echo "<tr><td>{$vtodo_link}<img src=\"images/not_completed.gif\" alt=\" \" width=\"13\" height=\"11\" border=\"0\" align=\"middle\"></a></td>\n";
         echo "<td><img src=\"images/spacer.gif\" width=\"2\" height=\"1\" border\"0\" /></td><td>{$vtodo_link}<font class=\"G10B\"> {$vtodo_text}</font></a></td></tr>\n";
     }
 }
开发者ID:dalinhuang,项目名称:sutoj,代码行数:31,代码来源:sidebar.php


示例10: text_helper

 public function text_helper()
 {
     $this->load->helper('text');
     $string = "Here is a nice text string consisting of eleven words.";
     $string = word_limiter($string, 4, "...");
     $this->htmlp($string);
     $string = "Here is a nice text string consisting of eleven words.";
     $string = character_limiter($string, 20, "...");
     $this->htmlp($string);
     $string = ascii_to_entities($string);
     $this->htmlp($string);
     $string = convert_accented_characters($string);
     $this->htmlp($string);
     $string = "darn shit sucks dinner";
     $disallowed = array('darn', 'shucks', 'golly', 'phooey');
     $string = word_censor($string, $disallowed, 'Beep!');
     $this->htmlp($string);
     $string = highlight_code($string);
     $this->htmlp($string);
     $string = "Here is a nice text string about nothing in particular.";
     $this->htmlp(highlight_phrase($string, "nice text", '<span style="color:#990000;">', '</span>'));
     $string = "Here is a simple string of text that will help us demonstrate this function.";
     $this->htmlp(word_wrap($string, 25));
     $str = 'this_string_is_entirely_too_long_and_might_break_my_design.jpg';
     $this->htmlp(ellipsize($str, 32, 0.5));
 }
开发者ID:jaffarsolo,项目名称:ci3-examples,代码行数:26,代码来源:Helpers.php


示例11: foreach

                                    <th>Phone</th>
                                    <th>Name</th>
                                    <th>Message</th>
                                    <th>status</th>
                                    <th>Registered</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                                <?php 
if (isset($testimonies)) {
    foreach ($testimonies as $testimony) {
        $icon = $testimony['status'] == 0 ? '<span><i class="material-icons red-text">error</i></span>' : '<span><i class="material-icons blue-text">verified_user</i></span>';
        echo '<tr>
                                        <td>' . $testimony['phone'] . '</td>
                                        <td>' . $testimony['name'] . '</td>
                                        <td>' . word_wrap($testimony['message']) . '</td>
                                        <td>' . $icon . '</td>
                                        <td>' . $testimony['dateadd'] . '</td>
                                        <td><a href="' . site_url('home/actiontestimony/confirm/' . $testimony['id']) . '" title="confirm and publish testimony"><i class="material-icons blue-text">done_all</i></a>
                                        <a href="' . site_url('home/actiontestimony/refute/' . $testimony['id']) . '" title="Refuse and delete testimony"><i class="material-icons red-text">delete_forever</i></a>
                                        </td>
                                    </tr>';
        ?>
                                <?php 
    }
}
?>
                        </table>   
                    </div>
                </div>
        </div>
开发者ID:larrytech7,项目名称:cog,代码行数:31,代码来源:testimonies.php


示例12: erzeuge_umbruch

function erzeuge_umbruch($text, $breite)
{
    //bricht text nach breite zeichen um
    if (strstr($text, "&gt;&nbsp;")) {
        // Alte Version für Quotes beibehalten
        //text in feld einlesen mit \n als trennzeichen
        $arr_text = explode("\n", $text);
        //fuer jeden Feldeintrag Zeilenumbruch hinzufuegen
        while (list($k, $zeile) = @each($arr_text)) {
            //nur Zeilen umbrechen die nicht gequotet sind
            if (!strstr($zeile, "&gt;&nbsp;")) {
                $arr_text[$k] = wordwrap($zeile, $breite, "\n", 0);
            }
        }
        return implode("\n", $arr_text);
    } else {
        // neue version, verhaut die umbrüche nicht mehr
        $text = word_wrap($text, $breite, $returns = "AUTO", $spacer = "", $joiner = ' ');
        return $text;
    }
}
开发者ID:netzhuffle,项目名称:mainchat,代码行数:21,代码来源:functions-community.php


示例13: testWordWrap

 public function testWordWrap()
 {
     $output = word_wrap('The quick brown fox jumps over the lazy dog.', 15);
     $this->assertRegExp('/lazy dog/', $output);
 }
开发者ID:groovey,项目名称:support,代码行数:5,代码来源:HelperCustomTest.php


示例14: openevent

function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '')
{
    global $cpath, $master_array;
    $event_text = stripslashes(urldecode($arr["event_text"]));
    if (empty($start)) {
        $title = $event_text;
    } else {
        $title = $arr['event_start'] . ' - ' . $arr['event_end'] . ': ' . $event_text;
    }
    # for iCal pseudo tag <http> comptability
    if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>", $event_text, $matches)) {
        $full_event_text = $matches[1] . $matches[2];
        $event_text = $matches[2];
    } else {
        $full_event_text = $event_text;
        $event_text = strip_tags($event_text, '<b><i><u><img>');
    }
    if (!empty($event_text)) {
        if ($lines > 0) {
            $event_text = word_wrap($event_text, $length, $lines);
        }
        if (!ereg("([[:alpha:]]+://[^<>[:space:]]+)", $full_event_text, $res) || $arr['description']) {
            $escaped_date = addslashes($event_date);
            $escaped_time = addslashes($time);
            $escaped_uid = addslashes($uid);
            $event_data = addslashes(serialize($master_array[$event_date][$time][$uid]));
            // fix for URL-length bug in IE: populate and submit a hidden form on click
            static $popup_data_index = 0;
            $return = "\n    <script language=\"Javascript\" type=\"text/javascript\"><!--\n    var eventData = new EventData('{$escaped_date}', '{$escaped_time}', '{$escaped_uid}','{$cpath}','{$event_data}');\n    document.popup_data[{$popup_data_index}] = eventData;\n    // --></script>";
            $return .= '<a class="' . $link_class . '" title="' . $title . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">';
            $popup_data_index++;
        } else {
            $return .= '<a class="' . $link_class . '" title="' . $title . '" href="' . $res[1] . '">';
        }
        $return .= $pre_text . $event_text . $post_text . '</a>' . "\n";
    }
    return $return;
}
开发者ID:jbogota,项目名称:blog-king,代码行数:38,代码来源:date_functions.php


示例15: site_url

								  <td scope="col"><a href="<?php 
        echo site_url();
        ?>
admin/clientservices/<?php 
        echo $clist['clientId'];
        ?>
/notall"><?php 
        echo $clist['userName'];
        ?>
</a></td>
								  <td scope="col"><?php 
        echo $clist['serviceName'];
        ?>
</td>
								  <td scope="col"><?php 
        echo word_wrap($clist['serviceDescription'], 76);
        //echo wordwrap($clist['serviceDescription'], 20, "\n", true);
        ?>
</td>
								  <td scope="col"><?php 
        echo $clist['startingDate'];
        ?>
</td>
								  <td scope="col"><?php 
        echo $clist['endingDate'];
        ?>
</td>
								  <td scope="col">
									  <select class="selActions" id="<?php 
        echo $clist['id'];
        ?>
开发者ID:ricain59,项目名称:fortaff,代码行数:31,代码来源:clientservices.php


示例16: getAttachmentUrl

function getAttachmentUrl($apli, $post_id, $att_id, $att_path, $att_type, $att_size, $att_inline = 0, $compteur, $visible = 0, $Mmod)
{
    global $icon_dir, $img_dir, $forum;
    global $mimetype_default, $mime_dspfmt, $mime_renderers;
    global $DOCUMENTROOT;
    load_mimetypes();
    $att_name = substr(strstr(basename($att_path), '.'), 1);
    $att_name = substr(strstr(basename($att_name), '.'), 1);
    $att_path = $DOCUMENTROOT . $att_path;
    if (!is_file($att_path)) {
        return '&nbsp;<span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non trouvÈ") . ' : ' . $att_name . '</span>';
    }
    if ($att_inline) {
        if (isset($mime_dspfmt[$att_type])) {
            $display_mode = $mime_dspfmt[$att_type];
        } else {
            $display_mode = $mime_dspfmt[$mimetype_default];
        }
    } else {
        $display_mode = ATT_DSP_LINK;
    }
    if ($Mmod) {
        global $userdata;
        $marqueurM = "&amp;Mmod=" . substr($userdata[2], 8, 6);
    } else {
        $marqueurM = "";
    }
    $att_url = "getfile.php?att_id={$att_id}&amp;apli={$apli}" . $marqueurM . "&amp;att_name=" . rawurlencode($att_name);
    if ($visible != 1) {
        $visible_wrn = '&nbsp;<span class="text-danger" style="font-size: .65rem;">' . upload_translate("Fichier non visible") . '</span>';
    }
    switch ($display_mode) {
        case ATT_DSP_IMG:
            // display as an embedded image
            $size = @getImageSize("{$att_path}");
            //         $img_size = verifsize( $size );
            $img_size = 'style="max-width: 100%; height:auto;"';
            $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_IMG]);
            eval("\$ret=stripSlashes(\"{$text}\");");
            break;
        case ATT_DSP_PLAINTEXT:
            // display as embedded text, PRE-formatted
            $att_contents = str_replace("\\", "\\\\", htmlSpecialChars(join('', file($att_path)), ENT_COMPAT | ENT_HTML401, cur_charset));
            $att_contents = word_wrap($att_contents);
            $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_PLAINTEXT]);
            eval("\$ret=\"{$text}\";");
            break;
        case ATT_DSP_HTML:
            // display as embedded HTML text
            //au choix la source ou la page
            $att_contents = word_wrap(nl2br(scr_html(join("", file($att_path)))));
            //$att_contents = removeHack (join ("", file ($att_path)));
            $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_HTML]);
            eval("\$ret=stripSlashes(\"{$text}\");");
            break;
        case ATT_DSP_SWF:
            // Embedded Macromedia Shockwave Flash
            $size = @getImageSize("{$att_path}");
            $img_size = verifsize($size);
            $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_SWF]);
            eval("\$ret=stripSlashes(\"{$text}\");");
            break;
        default:
            // display as link
            $Fichier = new FileManagement();
            // essai class PHP7
            //         $Fichier = new File("");
            //         $att_size = $Fichier->Pretty_Size($att_size);
            $att_size = $Fichier->file_size_format($att_size, 1);
            $att_icon = att_icon($att_name);
            $text = str_replace('"', '\\"', $mime_renderers[ATT_DSP_LINK]);
            eval("\$ret=stripSlashes(\"{$text}\");");
            break;
    }
    return $ret;
}
开发者ID:Jireck-npds,项目名称:npds_dune,代码行数:76,代码来源:upload.func.forum.php


示例17: word_wrap

        ?>
</td>
			  <td><?php 
        echo word_wrap($meta->name, 10);
        ?>
</td>
			  <td><?php 
        echo word_wrap($meta->title, 10);
        ?>
</td>
			  <td><?php 
        echo word_wrap($meta->meta_description, 10);
        ?>
</td>
			  <td><?php 
        echo word_wrap($meta->meta_keyword, 10);
        ?>
</td>
			 <td><li><a href="<?php 
        echo admin_url('managemetas/editmetas/' . $meta->id);
        ?>
"><img src="<?php 
        echo base_url();
        ?>
images/edit-new.png" alt="Edit" title="Edit" /></a></li></td>
        	</tr>
				
           <?php 
    }
    //Foreach End
}
开发者ID:BersnardC,项目名称:DROPINN,代码行数:31,代码来源:view_managemetas.php


示例18: get_vtodo

    function get_vtodo()
    {
        global $phpiCal_config, $getdate, $master_array, $next_day, $timeFormat, $tomorrows_events_lines;
        preg_match('!<\\!-- switch show_completed on -->(.*)<\\!-- switch show_completed off -->!Uis', $this->page, $match1);
        preg_match('!<\\!-- switch show_important on -->(.*)<\\!-- switch show_important off -->!Uis', $this->page, $match2);
        preg_match('!<\\!-- switch show_normal on -->(.*)<\\!-- switch show_normal off -->!Uis', $this->page, $match3);
        $completed = trim($match1[1]);
        $important = trim($match2[1]);
        $normal = trim($match3[1]);
        $nugget2 = '';
        $todo_popup_data_index = 0;
        if (is_array(@$master_array['-2'])) {
            foreach ($master_array['-2'] as $vtodo_times) {
                foreach ($vtodo_times as $val) {
                    if (isset($val['vtodo_text']) && !empty($val['vtodo_text'])) {
                        $vtodo_text = sanitizeForWeb(stripslashes(urldecode($val['vtodo_text'])));
                        if (isset($val['description']) && !empty($val['description'])) {
                            $description = sanitizeForWeb(stripslashes(urldecode($val['description'])));
                        } else {
                            $description = '';
                        }
                        $completed_date = $val['completed_date'];
                        $event_calna = $val['calname'];
                        $status = $val['status'];
                        $priority = $val['priority'];
                        $start_date = $val['start_date'];
                        $due_date = $val['due_date'];
                        $vtodo_array = array('cal' => $event_calna, 'completed_date' => $completed_date, 'description' => $description, 'due_date' => $due_date, 'priority' => $priority, 'start_date' => $start_date, 'status' => $status, 'vtodo_text' => $vtodo_text);
                        $vtodo_array = base64_encode(urlencode(serialize($vtodo_array)));
                        $todo_text = str_replace('"', '\\"', $vtodo_text);
                        $todo = <<<HEREDOC
<script language="Javascript" type="text/javascript">
<!--
var todoData = new TodoData("{$vtodo_array}", "{$todo_text}");
document.todo_popup_data[{$todo_popup_data_index}] = todoData;
// -->
</script>

HEREDOC;
                        $todo .= '<a class="psf" title="' . @$title . '" href="#" onclick="openTodoInfo(' . $todo_popup_data_index . '); return false;">';
                        $todo_popup_data_index++;
                        $vtodo_array = $todo;
                        $vtodo_text = word_wrap(str_replace('<br />', ' ', $vtodo_text), 21, $phpiCal_config->tomorrows_events_lines);
                        $data = array('{VTODO_TEXT}', '{VTODO_ARRAY}');
                        $rep = array($vtodo_text, $vtodo_array 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP words函数代码示例发布时间:2022-05-23
下一篇:
PHP word_limiter函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap