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


PHP utf8_wordwrap函数代码示例

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


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

示例1: xmultiquote_get_xmessage_string

function xmultiquote_get_xmessage_string($message_parser) {
    global $config;
    $ids = xmultiquote_get_ids();

    $xmessages = array();
    foreach ($ids as $id) {
        $post_data = xmultiquote_get_post($id);

        if ($config['allow_bbcode']) {
            $message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($post_data['post_text'])) . "[/quote]\n";
        } else {
            $offset = 0;
            $quote_string = "> ";
            $message = censor_text(trim($post_data['post_text']));
            // see if we are nesting. It's easily tricked but should work for one level of nesting
            if (strpos($message, ">") !== false) {
                $offset = 10;
            }
            $message = utf8_wordwrap($message, 75 + $offset, "\n");

            $message = $quote_string . $message;
            $message = str_replace("\n", "\n" . $quote_string, $message);
            $message =  $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
        }

        $message_parser->message = $message;
        $message_parser->decode_message($post_data['bbcode_uid']);

        $message = $message_parser->message;

        $xmessages[] = $message;
    }

    return implode("\n\n", $xmessages);
}
开发者ID:reekoheek,项目名称:phpbb3-xmultiquote,代码行数:35,代码来源:functions.php

示例2: main

 function main($id, $mode)
 {
     global $config, $template, $phpbb_admin_path, $phpEx;
     $collect_url = "http://www.phpbb.com/stats/receive_stats.php";
     $this->tpl_name = 'acp_send_statistics';
     $this->page_title = 'ACP_SEND_STATISTICS';
     // generate a unique id if necessary
     if (!isset($config['questionnaire_unique_id'])) {
         $install_id = unique_id();
         set_config('questionnaire_unique_id', $install_id);
     } else {
         $install_id = $config['questionnaire_unique_id'];
     }
     $collector = new phpbb_questionnaire_data_collector($install_id);
     // Add data provider
     $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
     $template->assign_vars(array('U_COLLECT_STATS' => $collect_url, 'RAW_DATA' => $collector->get_data_for_form(), 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.{$phpEx}")));
     $raw = $collector->get_data_raw();
     foreach ($raw as $provider => $data) {
         if ($provider == 'install_id') {
             $data = array($provider => $data);
         }
         $template->assign_block_vars('providers', array('NAME' => htmlspecialchars($provider)));
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = utf8_wordwrap(serialize($value), 75, "\n", true);
             }
             $template->assign_block_vars('providers.values', array('KEY' => utf8_htmlspecialchars($key), 'VALUE' => utf8_htmlspecialchars($value)));
         }
     }
 }
开发者ID:ahmatjan,项目名称:Crimson,代码行数:33,代码来源:acp_send_statistics.php

示例3: test_utf8_wordwrap_utf8_cut

 public function test_utf8_wordwrap_utf8_cut()
 {
     $text = "0123456 0123 012345 01234";
     $greek = $this->turn_into_greek($text);
     $expected = $this->turn_into_greek(wordwrap($text, 5, "\n", true));
     $phpbb_utf8_wordwrap = utf8_wordwrap($greek, 5, "\n", true);
     $this->assertEquals($expected, $phpbb_utf8_wordwrap, 'Checking UTF-8 cutting long words');
 }
开发者ID:josh-js,项目名称:phpbb,代码行数:8,代码来源:utf8_wordwrap_test.php

示例4: censor_text

}
// Decode text for message display
$post_data['bbcode_uid'] = $mode == 'quote' && !$preview && !$refresh && !sizeof($error) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
$message_parser->decode_message($post_data['bbcode_uid']);
if ($mode == 'quote' && !$submit && !$preview && !$refresh) {
    if ($config['allow_bbcode']) {
        $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
    } else {
        $offset = 0;
        $quote_string = "> ";
        $message = censor_text(trim($message_parser->message));
        // see if we are nesting. It's easily tricked but should work for one level of nesting
        if (strpos($message, ">") !== false) {
            $offset = 10;
        }
        $message = utf8_wordwrap($message, 75 + $offset, "\n");
        $message = $quote_string . $message;
        $message = str_replace("\n", "\n" . $quote_string, $message);
        $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
    }
}
if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) {
    $post_data['post_subject'] = (strpos($post_data['post_subject'], 'Re: ') !== 0 ? 'Re: ' : '') . censor_text($post_data['post_subject']);
}
$attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
$post_data['post_text'] = $message_parser->message;
if (sizeof($post_data['poll_options']) || !empty($post_data['poll_title'])) {
    $message_parser->message = $post_data['poll_title'];
    $message_parser->bbcode_uid = $post_data['bbcode_uid'];
    $message_parser->decode_message();
开发者ID:PetsFundation,项目名称:Pets,代码行数:31,代码来源:posting.php

示例5: process

 /**
  * Process queue
  * Using lock file
  */
 function process()
 {
     global $db, $config, $phpEx, $phpbb_root_path, $user;
     set_config('last_queue_run', time(), true);
     // Delete stale lock file
     if (file_exists($this->cache_file . '.lock') && !file_exists($this->cache_file)) {
         @unlink($this->cache_file . '.lock');
         return;
     }
     if (!file_exists($this->cache_file) || file_exists($this->cache_file . '.lock') && filemtime($this->cache_file) > time() - $config['queue_interval']) {
         return;
     }
     $fp = @fopen($this->cache_file . '.lock', 'wb');
     fclose($fp);
     @chmod($this->cache_file . '.lock', 0777);
     include $this->cache_file;
     foreach ($this->queue_data as $object => $data_ary) {
         @set_time_limit(0);
         if (!isset($data_ary['package_size'])) {
             $data_ary['package_size'] = 0;
         }
         $package_size = $data_ary['package_size'];
         $num_items = !$package_size || sizeof($data_ary['data']) < $package_size ? sizeof($data_ary['data']) : $package_size;
         // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs...
         if (sizeof($data_ary['data']) > $package_size * 2.5) {
             $num_items = sizeof($data_ary['data']);
         }
         switch ($object) {
             case 'email':
                 // Delete the email queued objects if mailing is disabled
                 if (!$config['email_enable']) {
                     unset($this->queue_data['email']);
                     continue 2;
                 }
                 break;
             case 'jabber':
                 if (!$config['jab_enable']) {
                     unset($this->queue_data['jabber']);
                     continue 2;
                 }
                 include_once $phpbb_root_path . 'includes/functions_jabber.' . $phpEx;
                 $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], $config['jab_password'], $config['jab_use_ssl']);
                 if (!$this->jabber->connect()) {
                     messenger::error('JABBER', $user->lang['ERR_JAB_CONNECT']);
                     continue 2;
                 }
                 if (!$this->jabber->login()) {
                     messenger::error('JABBER', $user->lang['ERR_JAB_AUTH']);
                     continue 2;
                 }
                 break;
             default:
                 return;
         }
         for ($i = 0; $i < $num_items; $i++) {
             // Make variables available...
             extract(array_shift($this->queue_data[$object]['data']));
             switch ($object) {
                 case 'email':
                     $err_msg = '';
                     $to = !$to ? 'undisclosed-recipients:;' : $to;
                     if ($config['smtp_delivery']) {
                         $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
                     } else {
                         ob_start();
                         $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers);
                         $err_msg = ob_get_clean();
                     }
                     if (!$result) {
                         @unlink($this->cache_file . '.lock');
                         messenger::error('EMAIL', $err_msg);
                         continue 2;
                     }
                     break;
                 case 'jabber':
                     foreach ($addresses as $address) {
                         if ($this->jabber->send_message($address, $msg, $subject) === false) {
                             messenger::error('JABBER', $this->jabber->get_log());
                             continue 3;
                         }
                     }
                     break;
             }
         }
         // No more data for this object? Unset it
         if (!sizeof($this->queue_data[$object]['data'])) {
             unset($this->queue_data[$object]);
         }
         // Post-object processing
         switch ($object) {
             case 'jabber':
                 // Hang about a couple of secs to ensure the messages are
                 // handled, then disconnect
                 $this->jabber->disconnect();
                 break;
         }
//.........这里部分代码省略.........
开发者ID:jvinhit,项目名称:php,代码行数:101,代码来源:functions_messenger.php

示例6: setDescription

 /**
  * Set page description for current execution.
  *
  * @param array $tag_params
  * @param array $children
  */
 private function setDescription($tag_params, $children)
 {
     global $language;
     // set from language constant
     if (isset($tag_params['constant'])) {
         $language_handler = MainLanguageHandler::getInstance();
         $constant = fix_chars($tag_params['constant']);
         $this->page_description = $language_handler->getText($constant);
         // set from article
     } else {
         if (isset($tag_params['article']) && class_exists('articles')) {
             $manager = ArticleManager::getInstance();
             $text_id = fix_chars($tag_params['article']);
             // get article from database
             $item = $manager->getSingleItem(array('content'), array('text_id' => $text_id));
             if (is_object($item)) {
                 $content = strip_tags(Markdown($item->content[$language]));
                 $data = explode("\n", utf8_wordwrap($content, 150, "\n", true));
                 if (count($data) > 0) {
                     $this->page_description = $data[0];
                 }
             }
         }
     }
 }
开发者ID:tareqy,项目名称:Caracal,代码行数:31,代码来源:page_info.php

示例7: process

 /**
  * Process queue
  * Using lock file
  */
 function process()
 {
     global $db, $config, $phpEx, $phpbb_root_path, $user;
     $lock = new \phpbb\lock\flock($this->cache_file);
     $lock->acquire();
     // avoid races, check file existence once
     $have_cache_file = file_exists($this->cache_file);
     if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval']) {
         if (!$have_cache_file) {
             set_config('last_queue_run', time(), true);
         }
         $lock->release();
         return;
     }
     set_config('last_queue_run', time(), true);
     include $this->cache_file;
     foreach ($this->queue_data as $object => $data_ary) {
         @set_time_limit(0);
         if (!isset($data_ary['package_size'])) {
             $data_ary['package_size'] = 0;
         }
         $package_size = $data_ary['package_size'];
         $num_items = !$package_size || sizeof($data_ary['data']) < $package_size ? sizeof($data_ary['data']) : $package_size;
         /*
         * This code is commented out because it causes problems on some web hosts.
         * The core problem is rather restrictive email sending limits.
         * This code is nly useful if you have no such restrictions from the
         * web host and the package size setting is wrong.
         
         // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs...
         if (sizeof($data_ary['data']) > $package_size * 2.5)
         {
         	$num_items = sizeof($data_ary['data']);
         }
         */
         switch ($object) {
             case 'email':
                 // Delete the email queued objects if mailing is disabled
                 if (!$config['email_enable']) {
                     unset($this->queue_data['email']);
                     continue 2;
                 }
                 break;
             case 'jabber':
                 if (!$config['jab_enable']) {
                     unset($this->queue_data['jabber']);
                     continue 2;
                 }
                 include_once $phpbb_root_path . 'includes/functions_jabber.' . $phpEx;
                 $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']);
                 if (!$this->jabber->connect()) {
                     $messenger = new messenger();
                     $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']);
                     continue 2;
                 }
                 if (!$this->jabber->login()) {
                     $messenger = new messenger();
                     $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']);
                     continue 2;
                 }
                 break;
             default:
                 $lock->release();
                 return;
         }
         for ($i = 0; $i < $num_items; $i++) {
             // Make variables available...
             extract(array_shift($this->queue_data[$object]['data']));
             switch ($object) {
                 case 'email':
                     $err_msg = '';
                     $to = !$to ? 'undisclosed-recipients:;' : $to;
                     if ($config['smtp_delivery']) {
                         $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
                     } else {
                         $result = phpbb_mail($to, $subject, $msg, $headers, $this->eol, $err_msg);
                     }
                     if (!$result) {
                         $messenger = new messenger();
                         $messenger->error('EMAIL', $err_msg);
                         continue 2;
                     }
                     break;
                 case 'jabber':
                     foreach ($addresses as $address) {
                         if ($this->jabber->send_message($address, $msg, $subject) === false) {
                             $messenger = new messenger();
                             $messenger->error('JABBER', $this->jabber->get_log());
                             continue 3;
                         }
                     }
                     break;
             }
         }
         // No more data for this object? Unset it
         if (!sizeof($this->queue_data[$object]['data'])) {
//.........这里部分代码省略.........
开发者ID:mysteriou,项目名称:educafacile.com,代码行数:101,代码来源:functions_messenger.php

示例8: explode

 $heim = "";
 $exp_heim = explode(" ", $row['heim']);
 foreach ($exp_heim as $subs_heim => $sub_heim) {
     if ($sub_heim != "Freihausen") {
         $heim = $heim . utf8_wordwrap($sub_heim, 9, "<br />", true) . " ";
     } else {
         $heim = $heim . utf8_wordwrap($sub_heim, 10, "<br />", true) . " ";
     }
 }
 $gast = "";
 $exp_gast = explode(" ", $row['gast']);
 foreach ($exp_gast as $subs_gast => $sub_gast) {
     if ($sub_gast != "Freihausen") {
         $gast = $gast . utf8_wordwrap($sub_gast, 9, "<br />", true) . " ";
     } else {
         $gast = $gast . utf8_wordwrap($sub_gast, 10, "<br />", true) . " ";
     }
 }
 echo "<div style=\"float:left; clear: both; margin-bottom: 10px; border-bottom: 1px dashed #000000\">\n";
 echo "<span style=\"float: left; text-align: center; width: 77px; overflow: hidden;\">" . $heim . "</span>\n";
 echo "<span style=\"width: 15px; float: left; text-align: center; overflow: hidden;\">-</span>\n";
 echo "<span style=\"float: left; text-align: center; width: 77px; overflow: hidden;\">" . $gast . "</span>\n";
 if ($row['tore_heim'] >= 0 and $row['tore_gast'] >= 0) {
     echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">" . $row['tore_heim'] . ":" . $row['tore_gast'] . "</span>\n";
 } else {
     echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">" . "-:-" . "</span>\n";
 }
 echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">";
 echo $row['spieltag'] . ". Spieltag ";
 if ($row['runde'] == 1) {
     echo "Hinrunde";
开发者ID:hahne,项目名称:svf,代码行数:31,代码来源:insert_game.php

示例9: next_game

 function next_game($liga_id, $team, $runde, $spieltag)
 {
     $Teams = "SELECT *\r\n\t       FROM `tabelle_{$liga_id}`\r\n\t       ";
     mysql_query('SET character_set_client = utf8');
     mysql_query('SET character_set_results = utf8');
     mysql_query('SET character_set_connection = utf8');
     $result_Teams = mysql_query($Teams) or die(mysql_error());
     $num_teams = mysql_num_rows($result_Teams);
     $datetime = getdate();
     $sql_next = "SELECT *\r\nFROM `ergebnisse_{$liga_id}`\r\nWHERE `runde` = '{$runde}'\r\nAND `spieltag` = '{$spieltag}'\r\nAND (`heim` = '{$team}' OR `gast` = '{$team}')\r\nLIMIT 0 , 30";
     mysql_query('SET character_set_client = utf8');
     mysql_query('SET character_set_results = utf8');
     mysql_query('SET character_set_connection = utf8');
     $result = mysql_query($sql_next) or die(mysql_error());
     if (mysql_num_rows($result)) {
         if ($row = mysql_fetch_assoc($result)) {
             $spiel_id = $row['id'];
             $title = $team;
             if ($team == 'SV Freihausen') {
                 $title = '1. Mannschaft';
             }
             if ($team == 'SV Freihausen II') {
                 $title = '2. Mannschaft';
             }
             echo "<span style=\"float: left; clear: both; width: 100%; text-align: center;\">{$title}:</span>\n";
             setlocale(LC_TIME, 'de_DE');
             $dtime = strftime("%e. %B %Y");
             echo "<span style=\"float: left; clear: both; text-align: center; width: 100%;\">" . strftime("%a, %d. %b %Y<br />%H:%M Uhr", strtotime($row['datum'])) . "</span>\n";
             echo "<div style=\"clear: both; width: 100%;\">\n";
             echo "<div style=\"width: 49%; float: left; overflow: hidden\">\n";
             mysql_query('SET character_set_client = utf8');
             mysql_query('SET character_set_results = utf8');
             mysql_query('SET character_set_connection = utf8');
             $result_Teams = mysql_query($Teams) or die(mysql_error());
             if (mysql_num_rows($result_Teams)) {
                 while ($row_Teams = mysql_fetch_assoc($result_Teams)) {
                     if ($row_Teams['name'] == $row['heim']) {
                         //echo "<div style=\"width: 100%;\">\n";
                         echo "<div style=\"width: 50px; margin: auto;\"><img src=\"" . $row_Teams['logo_medium'] . "\" alt=\"\" /></div>\n";
                         //echo "</div>";
                     }
                 }
             }
             echo "</div>\n";
             echo "<div style=\"width: 49%; float: left; overflow: hidden\">\n";
             mysql_query('SET character_set_client = utf8');
             mysql_query('SET character_set_results = utf8');
             mysql_query('SET character_set_connection = utf8');
             $result_Teams = mysql_query($Teams) or die(mysql_error());
             if (mysql_num_rows($result_Teams)) {
                 while ($row_Teams = mysql_fetch_assoc($result_Teams)) {
                     if ($row_Teams['name'] == $row['gast']) {
                         echo "<div style=\"width: 100%;\">\n";
                         echo "<div style=\"width:50px; margin: 5px auto;\"><img src=\"" . $row_Teams['logo_medium'] . "\" alt=\"\" /></div>\n";
                         echo "</div>";
                     }
                 }
             }
             echo "</div>\n";
             echo "</div>\n";
             $heim = "";
             $exp_heim = explode(" ", $row['heim']);
             foreach ($exp_heim as $subs_heim => $sub_heim) {
                 if ($sub_heim != "Freihausen") {
                     $heim = $heim . utf8_wordwrap($sub_heim, 9, "<br />", true) . " ";
                 } else {
                     $heim = $heim . utf8_wordwrap($sub_heim, 10, "<br />", true) . " ";
                 }
             }
             $gast = "";
             $exp_gast = explode(" ", $row['gast']);
             foreach ($exp_gast as $subs_gast => $sub_gast) {
                 if ($sub_gast != "Freihausen") {
                     $gast = $gast . utf8_wordwrap($sub_gast, 9, "<br />", true) . " ";
                 } else {
                     $gast = $gast . utf8_wordwrap($sub_gast, 10, "<br />", true) . " ";
                 }
             }
             echo "<div style=\"float:left; clear: both;\">\n";
             echo "<span style=\"float: left; text-align: center; width: 77px; overflow: hidden;\">" . $heim . "</span>\n";
             echo "<span style=\"width: 15px; float: left; text-align: center; overflow: hidden;\">-</span>\n";
             echo "<span style=\"float: left; text-align: center; width: 77px; overflow: hidden;\">" . $gast . "</span>\n";
             echo "</div>\n";
             if ($row['tore_heim'] >= 0 and $row['tore_gast'] >= 0) {
                 echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">" . $row['tore_heim'] . ":" . $row['tore_gast'] . "</span>\n";
             } else {
                 echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">" . "-:-" . "</span>\n";
             }
             echo "<span style=\"float: left; text-align: center; width: 100%; overflow: hidden;\">";
             echo $row['spieltag'] . ". Spieltag ";
             if ($row['runde'] == 1) {
                 echo "Hinrunde";
             }
             if ($row['runde'] == 2) {
                 echo "R&uuml;ckrunde";
             }
             echo "</span>";
             echo "<p style=\"float: left; text-align: center; width: 100%; overflow: hidden;\"><a href=\"modules/report_popin.php?id={$liga_id}&spiel_id={$spiel_id}&team=" . urlencode($team) . "&runde={$runde}&spieltag={$spieltag}\"  onclick=\"return reportPopin(this)\">Spielbericht</a></p>";
             $next_spieltag = 1;
             $next_runde = $row['runde'];
//.........这里部分代码省略.........
开发者ID:hahne,项目名称:svf,代码行数:101,代码来源:class.next_game.php

示例10: post


//.........这里部分代码省略.........
        // Preview
        if (!sizeof($error) && $preview) {
            $post_data['post_time'] = $mode == 'edit' ? $post_data['post_time'] : $current_time;
            $preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false);
            $preview_signature = $mode == 'edit' ? $post_data['user_sig'] : $user->data['user_sig'];
            $preview_signature_uid = $mode == 'edit' ? $post_data['user_sig_bbcode_uid'] : $user->data['user_sig_bbcode_uid'];
            $preview_signature_bitfield = $mode == 'edit' ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield'];
            // Signature
            if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('u_gb_sig')) {
                $parse_sig = new parse_message($preview_signature);
                $parse_sig->bbcode_uid = $preview_signature_uid;
                $parse_sig->bbcode_bitfield = $preview_signature_bitfield;
                // Not sure about parameters for bbcode/smilies/urls... in signatures
                $parse_sig->format_display($config['allow_sig_bbcode'], true, $config['allow_sig_smilies']);
                $preview_signature = $parse_sig->message;
                unset($parse_sig);
            } else {
                $preview_signature = '';
            }
            $preview_subject = censor_text($post_data['post_subject']);
            if (!sizeof($error)) {
                $template->assign_vars(array('PREVIEW_SUBJECT' => $preview_subject, 'PREVIEW_MESSAGE' => $preview_message, 'PREVIEW_SIGNATURE' => $preview_signature, 'S_DISPLAY_PREVIEW' => true));
            }
        }
        // Decode text for message display
        $post_data['bbcode_uid'] = $mode == 'quote' && !$preview && !$refresh && !sizeof($error) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid;
        $message_parser->decode_message($post_data['bbcode_uid']);
        if ($mode == 'quote' && !$submit && !$preview && !$refresh) {
            if ($config['allow_bbcode']) {
                $message_parser->message = '[quote=&quot;' . $post_data['quote_username'] . '&quot;]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
            } else {
                $offset = 0;
                $quote_string = "&gt; ";
                $message = censor_text(trim($message_parser->message));
                // see if we are nesting. It's easily tricked but should work for one level of nesting
                if (strpos($message, "&gt;") !== false) {
                    $offset = 10;
                }
                $message = utf8_wordwrap($message, 75 + $offset, "\n");
                $message = $quote_string . $message;
                $message = str_replace("\n", "\n" . $quote_string, $message);
                $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n";
            }
        }
        if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) {
            $post_data['post_subject'] = (strpos($post_data['post_subject'], 'Re: ') !== 0 ? 'Re: ' : '') . censor_text($post_data['post_subject']);
        }
        $post_data['post_text'] = $message_parser->message;
        // MAIN POSTING PAGE BEGINS HERE
        // Generate smiley listing
        generate_smilies('inline', 0);
        // Do show topic type selection only in first post.
        $topic_type_toggle = false;
        $s_topic_icons = false;
        if ($post_data['enable_icons'] && $auth->acl_get('u_gb_icons')) {
            $s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']);
        }
        $bbcode_checked = isset($post_data['enable_bbcode']) ? !$post_data['enable_bbcode'] : ($config['allow_bbcode'] ? !$user->optionget('bbcode') : 1);
        $smilies_checked = isset($post_data['enable_smilies']) ? !$post_data['enable_smilies'] : ($config['allow_smilies'] ? !$user->optionget('smilies') : 1);
        $urls_checked = isset($post_data['enable_urls']) ? !$post_data['enable_urls'] : 0;
        $sig_checked = $post_data['enable_sig'];
        // If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting
        $notify_set = $mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set'] ? $user->data['user_notify'] : $post_data['notify_set'];
        $notify_checked = isset($notify) ? $notify : ($mode == 'post' ? $user->data['user_notify'] : $notify_set);
        // Page title & action URL, include session_id for security purpose
        $s_action = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&amp;u={$this->user_id}&amp;gbmode={$mode}", true, $user->session_id);
        $s_action .= $post_id ? "&amp;p={$post_id}" : '';
        switch ($mode) {
            case 'post':
                $page_title = $user->lang['POST_GUESTBOOK'];
                break;
            case 'quote':
            case 'reply':
                $page_title = $user->lang['POST_GUESTBOOK'];
                break;
            case 'delete':
            case 'edit':
                $page_title = $user->lang['EDIT_POST'];
                break;
        }
        // Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed.
        if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) {
            $template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
        }
        $s_hidden_fields = '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
        if ($mode == 'edit') {
            $s_hidden_fields .= build_hidden_fields(array('edit_post_message_checksum' => $post_data['post_checksum'], 'edit_post_subject_checksum' => $post_data['post_subject_md5']));
        }
        // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
        if (isset($captcha) && $captcha->is_solved() !== false) {
            $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
        }
        add_form_key('posting');
        // Start assigning vars for main posting page ...
        $template->assign_vars(array('L_POST_A' => $page_title, 'L_ICON' => $user->lang['POST_ICON'], 'L_MESSAGE_BODY_EXPLAIN' => intval($config['max_post_chars']) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', 'TOPIC_TITLE' => censor_text($post_data['topic_title']), 'USERNAME' => !$preview && $mode != 'quote' || $preview ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], 'BBCODE_STATUS' => $bbcode_status ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $post_data['post_time'] ? $user->format_date($post_data['post_time']) : '', 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $post_data['post_edit_reason'], 'S_PRIVMSGS' => false, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']) ? true : false, 'S_EDIT_POST' => $mode == 'edit' ? true : false, 'S_EDIT_REASON' => false, 'S_DISPLAY_USERNAME' => !$user->data['is_registered'] || $mode == 'edit' && $post_data['poster_id'] == ANONYMOUS ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_BBCODE_CHECKED' => $bbcode_checked ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => $smilies_checked ? ' checked="checked"' : '', 'S_SIG_ALLOWED' => $auth->acl_get('u_gb_sig') && $config['allow_sig'] && $user->data['is_registered'] ? true : false, 'S_SIGNATURE_CHECKED' => $sig_checked ? ' checked="checked"' : '', 'S_NOTIFY_ALLOWED' => !$user->data['is_registered'] || $mode == 'edit' && $user->data['user_id'] != $post_data['poster_id'] || !$config['allow_topic_notify'] || !$config['email_enable'] ? false : true, 'S_NOTIFY_CHECKED' => $notify_checked ? ' checked="checked"' : '', 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => $urls_checked ? ' checked="checked"' : '', 'S_TYPE_TOGGLE' => '', 'S_SAVE_ALLOWED' => false, 'S_HAS_DRAFTS' => false, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'SIGNATURE' => '', 'S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields));
        // Build custom bbcodes array
        display_custom_bbcodes();
        $template->set_filenames(array('body' => 'posting_body.html'));
        make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
    }
开发者ID:paul999,项目名称:profile-guestbook,代码行数:101,代码来源:class_guestbook.php

示例11: msg_email

 /**
  * Send out emails
  */
 function msg_email($is_html = false)
 {
     global $config;
     if (empty($config['email_enable'])) {
         return false;
     }
     // Addresses to send to?
     if (empty($this->addresses) || empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc'])) {
         // Send was successful. ;)
         return true;
     }
     $contact_name = htmlspecialchars_decode($config['board_contact_name']);
     $board_contact = ($contact_name !== '' ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>';
     if (empty($this->replyto)) {
         $this->replyto = $board_contact;
     }
     if (empty($this->from)) {
         $this->from = $board_contact;
     }
     $encode_eol = $config['smtp_delivery'] ? "\r\n" : $this->eol;
     // Build to, cc and bcc strings
     $to = $cc = $bcc = '';
     foreach ($this->addresses as $type => $address_ary) {
         if ($type == 'im') {
             continue;
         }
         foreach ($address_ary as $which_ary) {
             ${$type} .= (${$type} != '' ? ', ' : '') . ($which_ary['name'] != '' ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']);
         }
     }
     // Build header
     $headers = $this->build_header($to, $cc, $bcc, $is_html);
     // Send message ...
     $mail_to = $to == '' ? 'undisclosed-recipients:;' : $to;
     $err_msg = '';
     if ($config['smtp_delivery']) {
         $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers);
     } else {
         $result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, $this->eol, $err_msg);
     }
     if (!$result) {
         $this->error('EMAIL', $err_msg);
         return false;
     }
     return true;
 }
开发者ID:MarkDHamill,项目名称:digests,代码行数:49,代码来源:html_messenger.php

示例12: textWrap

 /**
  * Wrap text - WT_Report_HTML
  *
  * @param string $str  Text to wrap
  * @param int    $width Width in points the text has to fit into
  *
  * @return string
  */
 function textWrap($str, $width)
 {
     // Calculate the line width
     $lw = (int) ($width / ($this->getCurrentStyleHeight() / 2));
     // Wordwrap each line
     //@@ indi source texts, note text, indi sub-titles, footer texts
     $lines = explode("\n", $str);
     // Line Feed counter
     $lfct = count($lines);
     $wraptext = '';
     foreach ($lines as $line) {
         $wtext = utf8_wordwrap($line, $lw, "\n", true);
         $wraptext .= $wtext;
         // Add a new line as long as it’s not the last line
         if ($lfct > 1) {
             $wraptext .= "\n";
         }
         $lfct--;
     }
     return $wraptext;
 }
开发者ID:sadr110,项目名称:webtrees,代码行数:29,代码来源:HTML.php

示例13: smarty_modifier_wordwrap_new

/**
 * Smarty wordwrap modifier plugin
 *
 * Type:     modifier<br />
 * Name:     wordwrap_new<br />
 * Purpose:  wrap a string of text at a given length, hopefully in a way that doesn't break things!  Call this before nl2br.
 * @author   ordog (lol)
 * @param string $string The source string
 * @param integer $length The length to wrap to, defaults to 80
 * @param string $break The string to break up lines by, defaults to " "
 * @param boolean $cut If $cut is true, the string is always wrapped at the specified width
 * @return string The wordwrapped string
 */
function smarty_modifier_wordwrap_new($string, $length = 80, $break = " ", $cut = false)
{
    // We'll use this to do the cutting for us.
    $string = preg_replace("/(\\B{" . $length . "})(\\B+)/Su", "\\1" . $break . "\\2", $string);
    return utf8_wordwrap($string, $length, $break, $cut);
}
开发者ID:kamilpacaq,项目名称:drydock,代码行数:19,代码来源:modifier.wordwrap_new.php

示例14: sendTransactionMail

 /**
  * Send email for transaction using specified template.
  *
  * @param object $transaction
  * @param string $template
  * @return boolean
  */
 private function sendTransactionMail($transaction, $template)
 {
     global $language;
     $result = false;
     // require contact form
     if (!class_exists('contact_form')) {
         return $result;
     }
     $email_address = null;
     $contact_form = contact_form::getInstance();
     // template replacement data
     $fields = array('transaction_id' => $transaction->id, 'transaction_uid' => $transaction->uid, 'status' => $transaction->status, 'handling' => $transaction->handling, 'shipping' => $transaction->shipping, 'total' => $transaction->total, 'weight' => $transaction->weight, 'payment_method' => $transaction->payment_method, 'delivery_method' => $transaction->delivery_method, 'remark' => $transaction->remark, 'token' => $transaction->token, 'timestamp' => $transaction->timestamp);
     $timestamp = strtotime($transaction->timestamp);
     $fields['date'] = date($this->getLanguageConstant('format_date_short'), $timestamp);
     $fields['time'] = date($this->getLanguageConstant('format_time_short'), $timestamp);
     // get currency
     $currency_manager = ShopCurrenciesManager::getInstance();
     $currency = $currency_manager->getSingleItem($currency_manager->getFieldNames(), array('id' => $transaction->currency));
     if (is_object($currency)) {
         $fields['currency'] = $currency->currency;
     }
     // add buyer information
     $buyer_manager = ShopBuyersManager::getInstance();
     $buyer = $buyer_manager->getSingleItem($buyer_manager->getFieldNames(), array('id' => $transaction->buyer));
     if (is_object($buyer)) {
         $fields['buyer_first_name'] = $buyer->first_name;
         $fields['buyer_last_name'] = $buyer->last_name;
         $fields['buyer_email'] = $buyer->email;
         $fields['buyer_uid'] = $buyer->uid;
         $email_address = $buyer->email;
     }
     // add system user information
     $user_manager = UserManager::getInstance();
     $user = $user_manager->getSingleItem($user_manager->getFieldNames(), array('id' => $transaction->system_user));
     if (is_object($user)) {
         $fields['user_name'] = $user->username;
         $fields['user_fullname'] = $user->fullname;
         $fields['user_email'] = $user->email;
         if (is_null($email_address) || empty($email_address)) {
             $email_address = $user->email;
         } else {
             if ($email_address != $user->email) {
                 $email_address = $email_address . ',' . $user->email;
             }
         }
     }
     // add buyer address
     $address_manager = ShopDeliveryAddressManager::getInstance();
     $address = $address_manager->getSingleItem($address_manager->getFieldNames(), array('id' => $transaction->address));
     if (is_object($address)) {
         $fields['address_name'] = $address->name;
         $fields['address_street'] = $address->street;
         $fields['address_street2'] = $address->street2;
         $fields['address_phone'] = $address->phone;
         $fields['address_city'] = $address->city;
         $fields['address_zip'] = $address->zip;
         $fields['address_state'] = $address->state;
         $fields['address_country'] = $address->country;
     }
     // create item table
     switch ($transaction->type) {
         case TransactionType::SHOPPING_CART:
             $item_manager = ShopTransactionItemsManager::getInstance();
             $items = $item_manager->getItems($item_manager->getFieldNames(), array('transaction' => $transaction->id));
             if (count($items) > 0) {
                 // create items table
                 $text_table = str_pad($this->getLanguageConstant('column_name'), 40);
                 $text_table .= str_pad($this->getLanguageConstant('column_price'), 8);
                 $text_table .= str_pad($this->getLanguageConstant('column_amount'), 6);
                 $text_table .= str_pad($this->getLanguageConstant('column_item_total'), 8);
                 $text_table .= "\n" . str_repeat('-', 40 + 8 + 6 + 8) . "\n";
                 $html_table = '<table border="0" cellspacing="5" cellpadding="0">';
                 $html_table .= '<thead><tr>';
                 $html_table .= '<td>' . $this->getLanguageConstant('column_name') . '</td>';
                 $html_table .= '<td>' . $this->getLanguageConstant('column_price') . '</td>';
                 $html_table .= '<td>' . $this->getLanguageConstant('column_amount') . '</td>';
                 $html_table .= '<td>' . $this->getLanguageConstant('column_item_total') . '</td>';
                 $html_table .= '</td></thead><tbody>';
                 foreach ($items as $item) {
                     // append item name with description
                     if (empty($data['description'])) {
                         $line = $item->name[$language] . ' (' . $item->description . ')';
                     } else {
                         $line = $item->name[$language];
                     }
                     $line = utf8_wordwrap($line, 40, "\n", true);
                     $line = mb_split("\n", $line);
                     // append other columns
                     $line[0] = $line[0] . str_pad($item->price, 8, ' ', STR_PAD_LEFT);
                     $line[0] = $line[0] . str_pad($item->amount, 6, ' ', STR_PAD_LEFT);
                     $line[0] = $line[0] . str_pad($item->total, 8, ' ', STR_PAD_LEFT);
                     // add this item to text table
                     $text_table .= implode("\n", $line) . "\n\n";
//.........这里部分代码省略.........
开发者ID:tareqy,项目名称:Caracal,代码行数:101,代码来源:shop.php

示例15: main

 function main($id, $mode)
 {
     global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx;
     if (!class_exists('phpbb_questionnaire_data_collector')) {
         include $phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx;
     }
     $collect_url = "https://www.phpbb.com/stats/receive_stats.php";
     $this->tpl_name = 'acp_help_phpbb';
     $this->page_title = 'ACP_HELP_PHPBB';
     $submit = $request->is_set_post('submit') ? true : false;
     $form_key = 'acp_help_phpbb';
     add_form_key($form_key);
     $error = array();
     if ($submit && !check_form_key($form_key)) {
         $error[] = $user->lang['FORM_INVALID'];
     }
     // Do not write values if there is an error
     if (sizeof($error)) {
         $submit = false;
     }
     // generate a unique id if necessary
     if (!isset($config['questionnaire_unique_id'])) {
         $install_id = unique_id();
         $config->set('questionnaire_unique_id', $install_id);
     } else {
         $install_id = $config['questionnaire_unique_id'];
     }
     $collector = new phpbb_questionnaire_data_collector($install_id);
     // Add data provider
     $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
     $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
     /**
      * Event to modify ACP help phpBB page and/or listen to submit
      *
      * @event core.acp_help_phpbb_submit_before
      * @var	boolean	submit			Do we display the form or process the submission
      * @since 3.2.0-RC2
      */
     $vars = array('submit');
     extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars)));
     if ($submit) {
         $config->set('help_send_statistics', $request->variable('help_send_statistics', false));
         $response = $request->variable('send_statistics_response', '');
         $config->set('help_send_statistics_time', time());
         if (!empty($response)) {
             if (strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false) {
                 trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action));
             } else {
                 trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action));
             }
         }
         trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action));
     }
     $template->assign_vars(array('U_COLLECT_STATS' => $collect_url, 'S_COLLECT_STATS' => !empty($config['help_send_statistics']) ? true : false, 'RAW_DATA' => $collector->get_data_for_form(), 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.{$phpEx}"), 'U_ACTION' => $this->u_action, 'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400));
     $raw = $collector->get_data_raw();
     foreach ($raw as $provider => $data) {
         if ($provider == 'install_id') {
             $data = array($provider => $data);
         }
         $template->assign_block_vars('providers', array('NAME' => htmlspecialchars($provider)));
         foreach ($data as $key => $value) {
             if (is_array($value)) {
                 $value = utf8_wordwrap(serialize($value), 75, "\n", true);
             }
             $template->assign_block_vars('providers.values', array('KEY' => utf8_htmlspecialchars($key), 'VALUE' => utf8_htmlspecialchars($value)));
         }
     }
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:69,代码来源:acp_help_phpbb.php


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