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

PHP wordwrap函数代码示例

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

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



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

示例1: send

 public function send($to, $subject, $message, $from = NULL, $attachments = NULL)
 {
     if ($attachments != NULL) {
         throw new ServiceException("INVALID_CONFIGURATION", "Default mailer does not support sending attachments");
     }
     if (Logging::isDebug()) {
         Logging::logDebug("Sending mail to [" . Util::array2str($to) . "]: [" . $message . "]");
     }
     if (!$this->enabled) {
         return;
     }
     $isHtml = stripos($message, "<html>") !== FALSE;
     $f = $from != NULL ? $from : $this->env->settings()->setting("mail_notification_from");
     $validRecipients = $this->getValidRecipients($to);
     if (count($validRecipients) === 0) {
         Logging::logDebug("No valid recipient email addresses, no mail sent");
         return;
     }
     $toAddress = '';
     $headers = $isHtml ? 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=utf-8' . "\r\n" : 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n";
     $headers .= 'From:' . $f;
     if (count($validRecipients) == 1) {
         $toAddress = $this->getRecipientString($validRecipients[0]);
     } else {
         $headers .= PHP_EOL . $this->getBccHeaders($validRecipients);
     }
     mail($toAddress, $subject, $isHtml ? $message : str_replace("\n", "\r\n", wordwrap($message)), $headers);
 }
开发者ID:Zveroloff,项目名称:kloudspeaker,代码行数:28,代码来源:MailSender.class.php


示例2: send_notification_email

 function send_notification_email($to_email, $subject, $message, $reply_to = '', $reply_to_name = '', $plain_text = true, $attachments = array())
 {
     $content_type = $plain_text ? 'text/plain' : 'text/html';
     $reply_to_name = $reply_to_name == '' ? wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) : $reply_to_name;
     //senders name
     $reply_to = ($reply_to == '' or $reply_to == '[admin_email]') ? get_option('admin_email') : $reply_to;
     //senders e-mail address
     if ($to_email == '[admin_email]') {
         $to_email = get_option('admin_email');
     }
     $recipient = $to_email;
     //recipient
     $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n Reply-To: \"{$reply_to_name}\" <{$reply_to}>\r\n Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\r\n";
     //optional headerfields
     $subject = wp_specialchars_decode(strip_tags(stripslashes($subject)), ENT_QUOTES);
     $message = do_shortcode($message);
     $message = wordwrap(stripslashes($message), 70, "\r\n");
     //in case any lines are longer than 70 chars
     if ($plain_text) {
         $message = wp_specialchars_decode(strip_tags($message), ENT_QUOTES);
     }
     $header = apply_filters('frm_email_header', $header, compact('to_email', 'subject'));
     if (!wp_mail($recipient, $subject, $message, $header, $attachments)) {
         $header = "From: \"{$reply_to_name}\" <{$reply_to}>\r\n";
         mail($recipient, $subject, $message, $header);
     }
     do_action('frm_notification', $recipient, $subject, $message);
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:28,代码来源:FrmNotification.php


示例3: write

 public static function write($image, $fontfile, $x, $y, $text, $color, $maxwidth, $size = 11, $spacingx = 2, $spacingy = 2, $mx = 1, $my = 1, $angle = 0)
 {
     if (!Common::isFile($fontfile)) {
         echo GWF_HTML::err('ERR_FILE_NOT_FOUND', array(htmlspecialchars($fontfile)));
         return false;
     }
     $dim = GWF_GDText::getFontSize($fontfile, $size, $angle);
     $fontwidth = $dim->w;
     $fontheight = $dim->h;
     if ($maxwidth != NULL) {
         // 			die(''.$maxwidth);
         $maxcharsperline = floor($maxwidth / $fontwidth);
         $text = wordwrap($text, $maxcharsperline, "\n", 1);
         // 			die($text);
     }
     // 		die(var_dump($color));
     $lines = explode("\n", $text);
     $x += $mx;
     $y += $my;
     foreach ($lines as $line) {
         $y += $fontheight + $spacingy;
         imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $line);
     }
     return true;
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:25,代码来源:GWF_GDText.php


示例4: printevent

function printevent($record, $prettydate)
{
    print "\n" . strtoupper($record["title"]) . "\n";
    $again = repeatfirstinstance($record, $prettydate);
    if ($again) {
        print "See {$again[date]} for details\n";
    } else {
        print hmmpm($record["eventtime"]) . "\n";
        if ($record["locname"]) {
            print "{$record[locname]}, {$record[address]}\n";
        } else {
            print "{$record[address]}\n";
        }
        print wordwrap($record["printdescr"], 68) . "\n";
        if (!$record["hideemail"]) {
            $email = preg_replace("/@/", " at ", $record["email"]);
            $email = preg_replace("/\\./", " dot ", $email);
            if ($record["weburl"] != "") {
                print "{$email}, {$record[weburl]}\n";
            } else {
                print "{$email}\n";
            }
        } else {
            if ($record["weburl"] != "") {
                print "{$record[weburl]}\n";
            }
        }
    }
}
开发者ID:kirkendall,项目名称:shiftcal,代码行数:29,代码来源:viewbulletin.php


示例5: block

 /**
  * Formats a message as a block of text.
  *
  * @param string|array $messages The message to write in the block
  * @param string|null $type The block type (added in [] on first line)
  * @param string|null $style The style to apply to the whole block
  * @param string $prefix The prefix for the block
  * @param bool $padding Whether to add vertical padding
  */
 public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
 {
     $this->autoPrependBlock();
     $messages = is_array($messages) ? array_values($messages) : array($messages);
     $lines = array();
     // add type
     if (null !== $type) {
         $messages[0] = sprintf('[%s] %s', $type, $messages[0]);
     }
     // wrap and add newlines for each element
     foreach ($messages as $key => $message) {
         $message = OutputFormatter::escape($message);
         $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - Helper::strlen($prefix), PHP_EOL, true)));
         if (count($messages) > 1 && $key < count($messages) - 1) {
             $lines[] = '';
         }
     }
     if ($padding && $this->isDecorated()) {
         array_unshift($lines, '');
         $lines[] = '';
     }
     foreach ($lines as &$line) {
         $line = sprintf('%s%s', $prefix, $line);
         $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
         if ($style) {
             $line = sprintf('<%s>%s</>', $style, $line);
         }
     }
     $this->writeln($lines);
     $this->newLine();
 }
开发者ID:a53ali,项目名称:CakePhP,代码行数:40,代码来源:SymfonyStyle.php


示例6: dumpSql

 /**
  * Returns syntax highlighted SQL command.
  * @param  string
  * @return string
  */
 public static function dumpSql($sql)
 {
     static $keywords1 = 'SELECT|(?:ON\\s+DUPLICATE\\s+KEY)?UPDATE|INSERT(?:\\s+INTO)?|REPLACE(?:\\s+INTO)?|DELETE|CALL|UNION|FROM|WHERE|HAVING|GROUP\\s+BY|ORDER\\s+BY|LIMIT|OFFSET|SET|VALUES|LEFT\\s+JOIN|INNER\\s+JOIN|TRUNCATE';
     static $keywords2 = 'ALL|DISTINCT|DISTINCTROW|IGNORE|AS|USING|ON|AND|OR|IN|IS|NOT|NULL|LIKE|RLIKE|REGEXP|TRUE|FALSE';
     // insert new lines
     $sql = " {$sql} ";
     $sql = preg_replace("#(?<=[\\s,(])({$keywords1})(?=[\\s,)])#i", "\n\$1", $sql);
     // reduce spaces
     $sql = preg_replace('#[ \\t]{2,}#', " ", $sql);
     $sql = wordwrap($sql, 100);
     $sql = preg_replace("#([ \t]*\r?\n){2,}#", "\n", $sql);
     // syntax highlight
     $sql = htmlSpecialChars($sql);
     $sql = preg_replace_callback("#(/\\*.+?\\*/)|(\\*\\*.+?\\*\\*)|(?<=[\\s,(])({$keywords1})(?=[\\s,)])|(?<=[\\s,(=])({$keywords2})(?=[\\s,)=])#is", function ($matches) {
         if (!empty($matches[1])) {
             // comment
             return '<em style="color:gray">' . $matches[1] . '</em>';
         }
         if (!empty($matches[2])) {
             // error
             return '<strong style="color:red">' . $matches[2] . '</strong>';
         }
         if (!empty($matches[3])) {
             // most important keywords
             return '<strong style="color:blue">' . $matches[3] . '</strong>';
         }
         if (!empty($matches[4])) {
             // other keywords
             return '<strong style="color:green">' . $matches[4] . '</strong>';
         }
     }, $sql);
     return '<pre class="dump">' . trim($sql) . "</pre>\n";
 }
开发者ID:exesek,项目名称:nette20login,代码行数:38,代码来源:Helpers.php


示例7: combine

 /**
  *  Create a cache file from the given list of files and return the cache file name
  *  @name   combine
  *  @type   method
  *  @access public
  *  @param  array file list
  *  @return string cache file name
  */
 public function combine($fileList)
 {
     if (count($fileList) > 0) {
         $cacheFile = '';
         $alphabet = array_map('chr', array_merge(range(48, 57), range(97, 122), range(65, 90)));
         //  a lot is going on on this line; first we take the md5 checksums of the files in the list, then this goes into a json blob, which is m5'd on its own and then wordwrapped at every 3rd character and lastly, the result gets exploded on the wordwrap added newlines. Leaving us with a 11 item array.
         $checksum = explode(PHP_EOL, wordwrap(md5(json_encode(array_map('md5_file', $fileList))), 3, PHP_EOL, true));
         while (count($checksum)) {
             $cacheFile .= $alphabet[hexdec(array_shift($checksum)) % count($alphabet)];
         }
         $cacheFile = $this->_cachePath . '/' . $cacheFile . '.' . pathinfo($fileList[0], PATHINFO_EXTENSION);
         //  if the cache file exists, we gently push the modification time to now (this should make removing old obselete files easier to find)
         if (realpath($cacheFile) && touch($cacheFile)) {
             return basename($cacheFile);
         }
         //  as no cache file was found (or we couldn't push the modification time), we need to generate it
         $fp = fopen($cacheFile, 'w+');
         if ($fp) {
             foreach ($fileList as $file) {
                 $source = trim(file_get_contents($file)) . PHP_EOL;
                 if (substr($file, 0, strlen($this->_cachePath)) == $this->_cachePath) {
                     $source = '/*' . basename($file) . '*/' . $source;
                 }
                 fputs($fp, $source);
             }
             return basename($cacheFile);
         }
     }
     return false;
 }
开发者ID:rspieker,项目名称:konsolidate_scaffold,代码行数:38,代码来源:source.class.php


示例8: addItem

 /**
  * splits item into new lines if necessary
  * @param string $item
  * @return CalendarStream
  */
 public function addItem($item)
 {
     $line_breaks = array("\r\n", "\n", "\r");
     $item = str_replace($line_breaks, '\\n', $item);
     $this->stream .= wordwrap($item, 70, Constants::CRLF . ' ', true) . Constants::CRLF;
     return $this;
 }
开发者ID:enko,项目名称:ics,代码行数:12,代码来源:CalendarStream.php


示例9: sendNewPassword

 public function sendNewPassword($email, $newPassword)
 {
     $msg = "Here is your new password " . $newPassword . " Have fun!!!";
     $msg = wordwrap($msg, 70);
     #send mail
     mail($email, "Your new password", $msg, 'From: ' . WEBMASTER_EMAIL);
 }
开发者ID:RhenusoneRosalia,项目名称:portfolio,代码行数:7,代码来源:Email.php


示例10: lbf_report

function lbf_report($pid, $encounter, $cols, $id, $formname)
{
    require_once $GLOBALS["srcdir"] . "/options.inc.php";
    $arr = array();
    $shrow = getHistoryData($pid);
    $fres = sqlStatement("SELECT * FROM layout_options " . "WHERE form_id = ? AND uor > 0 " . "ORDER BY group_name, seq", array($formname));
    while ($frow = sqlFetchArray($fres)) {
        $field_id = $frow['field_id'];
        $currvalue = '';
        if ($frow['edit_options'] == 'H') {
            if (isset($shrow[$field_id])) {
                $currvalue = $shrow[$field_id];
            }
        } else {
            $currvalue = lbf_current_value($frow, $id, $encounter);
            if ($currvalue === FALSE) {
                continue;
            }
            // should not happen
        }
        // For brevity, skip fields without a value.
        if ($currvalue === '') {
            continue;
        }
        // $arr[$field_id] = $currvalue;
        // A previous change did this instead of the above, not sure if desirable? -- Rod
        $arr[$field_id] = wordwrap($currvalue, 30, "\n", true);
    }
    echo "<table>\n";
    display_layout_rows($formname, $arr);
    echo "</table>\n";
}
开发者ID:gidsil,项目名称:openemr,代码行数:32,代码来源:report.php


示例11: feedbackAction

 public function feedbackAction()
 {
     $this->view->disable();
     if ($this->request->isPost()) {
         $name = $this->request->getPost('name');
         $email = $this->request->getPost('email');
         $comment = $this->request->getPost('comment');
         if (empty($name)) {
             return;
         }
         if (empty($email)) {
             return;
         }
         if (empty($comment)) {
             return;
         }
         $headers = 'From: [email protected]' . "\n" . 'Reply-To: ' . $email . "\n" . 'Content-Type: text/html; charset="utf-8"';
         $subject = 'Новое сообщение в форме обратной связи';
         $subject = '=?utf-8?B?' . base64_encode($subject) . '?=';
         $message = 'Новое сообщение в форме обратной связи от ' . $name . '(' . $email . '):' . "<br/><br/>" . $comment;
         $message = wordwrap($message, 70);
         mail('[email protected]', $subject, $message, $headers);
         print 'y';
     }
 }
开发者ID:olegabr,项目名称:kladrapi,代码行数:25,代码来源:ContactsController.php


示例12: modify

 /**
  * modify the value
  *
  * @access	public
  * @param	string		value
  * @return	string		modified value
  */
 function modify($value, $params = array())
 {
     /**
      * width
      */
     if (!isset($params['width'])) {
         $params['width'] = 72;
     }
     settype($params['width'], 'integer');
     /**
      * character used for linebreaks
      */
     if (!isset($params['break'])) {
         $params['break'] = "\n";
     }
     /**
      * cut at the specified width
      */
     if (!isset($params['cut'])) {
         $params['cut'] = 'no';
     }
     $params['cut'] = $params['cut'] === 'yes' ? true : false;
     $value = wordwrap($value, $params['width'], $params['break'], $params['cut']);
     if (isset($params['nl2br']) && $params['nl2br'] === 'yes') {
         $value = nl2br($value);
     }
     return $value;
 }
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:35,代码来源:Wordwrapper.php


示例13: LicenceUploaded

function LicenceUploaded()
{
    $tmp_file = $_FILES['fichier']['tmp_name'];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    if (!is_dir($content_dir)) {
        mkdir($content_dir);
    }
    if (!is_uploaded_file($tmp_file)) {
        MainPage('{error_unable_to_upload_file}');
        exit;
    }
    $type_file = $_FILES['fichier']['type'];
    if (!strstr($type_file, 'key')) {
        MainPage('{error_file_extension_not_match} :key');
        exit;
    }
    $name_file = $_FILES['fichier']['name'];
    if (file_exists($content_dir . "/" . $name_file)) {
        @unlink($content_dir . "/" . $name_file);
    }
    if (!move_uploaded_file($tmp_file, $content_dir . "/" . $name_file)) {
        MainPage("{error_unable_to_move_file} : " . $content_dir . "/" . $name_file);
        exit;
    }
    $_GET["moved_file"] = $content_dir . "/" . $name_file;
    include_once "ressources/class.sockets.inc";
    $socket = new sockets();
    $res = $socket->getfile("aveserver_licencemanager:{$content_dir}/{$name_file}");
    $res = str_replace("\r", "", $res);
    $res = wordwrap($res, 50, "\n", true);
    $res = nl2br($res);
    MainPage($res);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:33,代码来源:licencemanager.aveserver.php


示例14: dpp_set_post_content

function dpp_set_post_content($entry, $form)
{
    //Gravity Forms has validated the data
    //Our Custom Form Submitted via PHP will go here
    // Lets get the IDs of the relevant fields and prepare an email message
    $message = print_r($entry, true);
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    // Send for debugging
    // mail('[email protected]', 'Getting the Gravity Form Field IDs', $message);
    // Post the form to a specific URL
    function post_to_url($url, $data)
    {
        $fields = '';
        foreach ($data as $key => $value) {
            $fields .= $key . '=' . $value . '&';
        }
        rtrim($fields, '&');
        $post = curl_init();
        curl_setopt($post, CURLOPT_URL, $url);
        curl_setopt($post, CURLOPT_POST, count($data));
        curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($post);
        curl_close($post);
    }
    // Handle the form differently based on form ID
    if ($form["id"] == 1) {
        // Application Page
        $data = array("first_name" => $entry["7"], "last_name" => $entry["8"], "phone" => $entry["4"], "email" => $entry["3"], "loan_type" => $entry["5"], "loan_amount" => $entry["10"], "gross_income" => $entry["12"], "monthly_payment" => $entry["11"], "state" => $entry["9"], "time_to_call" => $entry["6"], "formName" => "Application");
        post_to_url("https://login.debtpaypro.com/post/d5b826014a9552022f1292804afc72d2bc27b721/", $data);
    }
}
开发者ID:RagnarDanneskjold,项目名称:goodbyeloans.com,代码行数:33,代码来源:debtpaypro-integration.php


示例15: CreateRealShipInfoText

function CreateRealShipInfoText($ship_data)
{
    global $db;
    global $game, $SHIPIMAGE_PATH;
    $text = '<font color=#000000><table widht=500 border=0 cellpadding=0 cellspacing=0><tr><td width=250><table width=* border=0 cellpadding=0 cellspacing=0><tr><td valign=top><u>' . constant($game->sprache("TEXT30")) . '</u><br><b>' . $ship_data['name'] . '</b><br><br></td></tr><tr><td valign=top><u>' . constant($game->sprache("TEXT31")) . '</u><br>' . str_replace("\r\n", '<br>', wordwrap($ship_data['description'], 40, "<br>", 1)) . '<br><br></td></tr><tr><td valign=top><u>' . constant($game->sprache("TEXT32")) . '</u><br><img src=' . $SHIPIMAGE_PATH . 'ship' . $ship_data['owner_race'] . '_' . $ship_data['ship_torso'] . '.jpg></td></tr><tr><td valign=top><u>' . constant($game->sprache("TEXT27")) . '</u><br>';
    for ($t = 0; $t < 10; $t++) {
        if ($ship['component_' . ($t + 1)] >= 0) {
            $text .= '-&nbsp;' . $ship_components[$ship['race']][$t][$ship['component_' . ($t + 1)]]['name'] . '<br>';
        } else {
            $text .= constant($game->sprache("TEXT33"));
        }
    }
    $text .= '<br></td></tr></table></td><td width=250><table width=* border=0 cellpadding=0 cellspacing=0><tr><td valign=top><u>' . constant($game->sprache("TEXT28")) . '</u><br>';
    $text .= '<u>' . constant($game->sprache("TEXT13")) . '</u> <b>' . $ship_data['value_1'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT14")) . '</u> <b>' . $ship_data['value_2'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT15")) . '</u> <b>' . $ship_data['value_3'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT18")) . '</u> <b>' . $ship_data['value_6'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT19")) . '</u> <b>' . $ship_data['value_7'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT20")) . '</u> <b>' . $ship_data['value_8'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT21")) . '</u> <b>' . $ship_data['value_9'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT22")) . '</u> <b>' . $ship_data['value_10'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT23")) . '</u> <b>' . $ship_data['value_11'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT24")) . '</u> <b>' . $ship_data['value_12'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT29")) . '</u> <b>' . $ship_data['value_14'] . '/' . $ship_data['value_13'] . '</b><br><br>';
    $text .= '<u>' . constant($game->sprache("TEXT16")) . '</u> <b>' . $ship_data['value_4'] . '</b><br>';
    $text .= '<u>' . constant($game->sprache("TEXT17")) . '</u> <b>' . $ship_data['hitpoints'] . '/' . $ship_data['value_5'] . '</b><br>';
    $text .= '<br></td></tr><tr><td valign=top><u>' . constant($game->sprache("TEXT34")) . '</u>:<br><img src=' . $game->GFX_PATH . 'menu_unit1_small.gif>' . $ship_data['unit_1'] . '&nbsp;&nbsp;<img src=' . $game->GFX_PATH . 'menu_unit2_small.gif>' . $ship_data['unit_2'] . '&nbsp;&nbsp;<img src=' . $game->GFX_PATH . 'menu_unit3_small.gif>' . $ship_data['unit_3'] . '&nbsp;&nbsp;<img src=' . $game->GFX_PATH . 'menu_unit4_small.gif>' . $ship_data['unit_4'] . '&nbsp;&nbsp;<img src=' . $game->GFX_PATH . 'menu_unit5_small.gif>' . $ship_data['unit_5'] . '&nbsp;&nbsp;<img src=' . $game->GFX_PATH . 'menu_unit6_small.gif>' . $ship_data['unit_6'] . '<br></td></tr></table></td></tr></table>';
    $text .= '</td></tr></table></td></tr></table><br></font>';
    $text = str_replace("'", '', $text);
    $text = str_replace('"', '', $text);
    return $text;
}
开发者ID:startrekfinalfrontier,项目名称:UI,代码行数:32,代码来源:trade.php


示例16: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (null === ($issueNumber = $input->getArgument('issue'))) {
         $issueNumber = $this->getHelper('git')->getIssueNumber();
     }
     $comments = [];
     $tracker = $this->getIssueTracker();
     $issue = $tracker->getIssue($issueNumber);
     $styleHelper = $this->getHelper('gush_style');
     $styleHelper->title(sprintf('Issue #%s - %s by %s [<fg=' . '%s>%s</>]', $issue['number'], $issue['title'], $issue['user'], 'closed' === $issue['state'] ? 'red' : 'green', $issue['state']));
     $styleHelper->detailsTable([['Org/Repo', $input->getOption('issue-org') . '/' . $input->getOption('issue-project')], ['Link', $issue['url']], ['Labels', implode(', ', $issue['labels']) ?: '<comment>None</comment>'], ['Milestone', $issue['milestone'] ?: '<comment>None</comment>'], ['Assignee', $issue['assignee'] ?: '<comment>None</comment>']]);
     $styleHelper->section('Body');
     $styleHelper->text(explode("\n", $issue['body']));
     if (true === $input->getOption('with-comments')) {
         $comments = $tracker->getComments($issueNumber);
         $styleHelper->section('Comments');
         foreach ($comments as $comment) {
             $styleHelper->text(sprintf('<fg=white>Comment #%s</> by %s on %s', $comment['id'], $comment['user'], $comment['created_at']->format('r')));
             $styleHelper->detailsTable([['Link', $comment['url']]]);
             $styleHelper->text(explode("\n", wordwrap($comment['body'], 100)));
             $styleHelper->text([]);
         }
     }
     return self::COMMAND_SUCCESS;
 }
开发者ID:gushphp,项目名称:gush,代码行数:28,代码来源:IssueShowCommand.php


示例17: wrapCell

 /**
  * Wrap one cell.  Guard against modifying non-strings and
  * then call through to wordwrap().
  *
  * @param mixed $cell
  * @param string $cellWidth
  * @return mixed
  */
 protected function wrapCell($cell, $cellWidth)
 {
     if (!is_string($cell)) {
         return $cell;
     }
     return wordwrap($cell, $cellWidth, "\n", true);
 }
开发者ID:consolidation,项目名称:output-formatters,代码行数:15,代码来源:WordWrapper.php


示例18: email

function email($e_mail, $subject, $message, $headers)
 {
  // add headers for utf-8 message
  $headers .= "\r\n";
  $headers .= 'From: ijgc-online.com <[email protected]>' . "\r\n";
  $headers .= "MIME-Version: 1.0\r\n";
  $headers .= "Content-type: text/plain; charset=utf-8\r\n";
  $headers .= "Content-Transfer-Encoding: quoted-printable\r\n";

  // encode subject
  //=?UTF-8?Q?encoded_text?=

  // work a round: for subject with wordwrap
  // not fixed, no possibility to have one in a single char
  $subject = wordwrap($subject, 25, "\n", FALSE);
  $subject = explode("\n", $subject);
  array_walk($subject, imap8bit);
  $subject = implode("\r\n ", $subject);
  $subject = "=?UTF-8?Q?".$subject."?=";

  // encode e-mail message
  $message = imap_8bit($message);

  return(mail("$e_mail", "$subject", "$message", "$headers"));
 }
开发者ID:bryanbacus,项目名称:skripsi-martin,代码行数:25,代码来源:sendmail.php


示例19: execute

 public function execute()
 {
     $versions = Config::getInstalledPhpVersions();
     $currentVersion = Config::getCurrentPhpName();
     if (empty($versions)) {
         return $this->logger->notice("Please install at least one PHP with your prefered version.");
     }
     if ($currentVersion === false or !in_array($currentVersion, $versions)) {
         $this->logger->writeln("* (system)");
     }
     foreach ($versions as $version) {
         $versionPrefix = Config::getVersionInstallPrefix($version);
         if ($currentVersion == $version) {
             $this->logger->writeln($this->formatter->format(sprintf('* %-15s', $version), 'bold'));
         } else {
             $this->logger->writeln($this->formatter->format(sprintf('  %-15s', $version), 'bold'));
         }
         if ($this->options->dir) {
             $this->logger->writeln(sprintf("    Prefix:   %s", $versionPrefix));
         }
         // TODO: use Build class to get the variants
         if ($this->options->variants && file_exists($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants')) {
             $info = unserialize(file_get_contents($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants'));
             echo "    Variants: ";
             echo wordwrap(VariantParser::revealCommandArguments($info), 75, " \\\n              ");
             echo "\n";
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:29,代码来源:ListCommand.php


示例20: getLines

 /**
  * Get an array of lines.
  * If preserving whitespace, lines are not wrapped or left trimmed, but
  * tabs are replaced with 7 spaces.
  */
 protected function getLines() : array
 {
     if ($this->preserveWhitespace) {
         return explode("\n", str_replace("\t", str_repeat(" ", 7), $this->message));
     }
     return array_map("ltrim", explode("\n", wordwrap($this->message, $this->wrapColumn)));
 }
开发者ID:ntzm,项目名称:php-cowsay,代码行数:12,代码来源:AbstractCow.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP workshop_get_assessments函数代码示例发布时间:2022-05-23
下一篇:
PHP words函数代码示例发布时间: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