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

PHP Formatter类代码示例

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

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



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

示例1: generate

 /**
  * generate
  *
  */
 public function generate()
 {
     $this->out('Generate .cake ...');
     $d = new Dotcake(APP, App::paths(), CAKE_CORE_INCLUDE_PATH);
     $contents = json_encode($d->generate());
     if (array_key_exists('format', $this->params)) {
         $format = $this->params['format'];
         switch ($format) {
             case 'tab':
                 $formatter = new Formatter();
                 $contents = $formatter->reformat($contents);
                 break;
             case 'ws':
                 // no break
             // no break
             case 'whitespace':
                 // can use JSON_PRETTY_PRINT option since PHP5.4
                 $formatter = new Formatter('    ');
                 // 4 spaces
                 $contents = $formatter->reformat($contents);
                 break;
             default:
                 $this->out(__d('cake_console', "'{$format}' is invalid format option. You can use 'tab', 'ws' or 'whitespace' as option value."));
                 exit(0);
         }
     }
     $this->createFile(APP . '.cake', $contents);
 }
开发者ID:dotcake,项目名称:dotcake,代码行数:32,代码来源:DotcakeShell.php


示例2: convertDate

 /**
  * Convert a date (number) to a database date representation (string).
  *
  * @param long dateTime The date (number)
  * @param boolean whether the returned string should be surrounted by quotes.
  * @return string
  */
 public static function convertDate($dateTime, $timeZone = 'GMT', $withQuotes = true)
 {
     if ($dateTime == null) {
         return $withQuotes ? "null" : null;
     }
     $format = new Formatter($timeZone);
     $sDate = $format->dateFormat($dateTime, "Y-m-d H:i:s");
     return $withQuotes ? "'{$sDate}'" : $sDate;
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:16,代码来源:SQLUtils.php


示例3: processor_folding

function processor_folding($formatter, $value = "", $options = array())
{
    // unique id of the folding area
    $id = isset($GLOBALS['_folding_id_']) ? $GLOBALS['_folding_id_'] : 0;
    $id++;
    $GLOBALS['_folding_id_'] = $id;
    if ($value[0] == '#' and $value[1] == '!') {
        list($line, $value) = explode("\n", $value, 2);
    }
    $init_state = 'none';
    $title = _("More");
    $class = '';
    $opened = '';
    // parse args
    if (isset($line[0]) and ($p = strpos($line, ' ')) !== false) {
        $tag = substr($line, 0, $p);
        $args = substr($line, $p + 1);
        if (preg_match("/^(?:(open|\\+))?(?(1)[ ]*,[ ]*)?((?:(?:[a-zA-Z][a-z0-9_-]+)[ ]*)*)?(?(2)[ ]*,[ ]*)?/", $args, $matches)) {
            $class = isset($matches[2][0]) ? ' ' . $matches[2] : '';
            $tmp = substr($args, strlen($matches[0]));
            if (isset($tmp[0])) {
                $title = $tmp;
            }
            if ($matches[1] == 'open' or $matches[1] == '+') {
                $init_state = 'block';
                $opened = ' class="opened"';
            }
        }
    }
    // FIXME footnote prefix
    $fn_prefix = 'fn' . substr(md5(substr($value, 0, 32)), 0, 3);
    // allow wiki syntax in folding content
    ob_start();
    $params = array('notoc' => 1);
    $params['nosisters'] = 1;
    $f = new Formatter($formatter->page, $params);
    $f->foot_prefix = $fn_prefix;
    $f->get_javascripts();
    // trash default javascripts
    $f->pi['#linenum'] = 0;
    // do not use linenum
    $f->send_page($value, $params);
    $out = ob_get_contents();
    ob_end_clean();
    $onclick = " onclick=\"var f=document.getElementById('folding_{$id}');var s=f.style.display=='block';" . "f.style.display=s?'none':'block';this.className=s?'':'opened';\"";
    return <<<HERE
<div class="folding-area{$class}">
<dl class="folding">
<dt{$onclick}{$opened}>{$title}</dt>
<dd id="folding_{$id}" style="display:{$init_state};">{$out}</dd>
</dl>
</div>
HERE;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:54,代码来源:folding.php


示例4: macro_WantedPages

function macro_WantedPages($formatter, $value = '')
{
    global $DBInfo;
    $pages = $DBInfo->getPageLists();
    $pagelinks = $formatter->pagelinks;
    // save
    $save = $formatter->sister_on;
    $formatter->sister_on = 0;
    $cache = new Cache_text("pagelinks");
    foreach ($pages as $page) {
        $dum = '';
        $p = new WikiPage($page);
        $f = new Formatter($p);
        $pi = $f->page->get_instructions($dum);
        if (in_array($pi['#format'], array('wiki', 'monimarkup'))) {
            continue;
        }
        $links = $f->get_pagelinks();
        if ($links) {
            $lns =& $links;
            foreach ($lns as $link) {
                if (!$link or $DBInfo->hasPage($link)) {
                    continue;
                }
                if ($link and !$wants[$link]) {
                    $wants[$link] = "[\"{$page}\"]";
                } else {
                    $wants[$link] .= " [\"" . $page . "\"]";
                }
            }
        }
    }
    $formatter->pagelinks = $pagelinks;
    // save
    $formatter->sister_on = $save;
    if (!count($wants)) {
        return '';
    }
    $pagelinks = $formatter->pagelinks;
    // save
    $formatter->sister_on = 0;
    asort($wants);
    $out = "<ul>\n";
    while (list($name, $owns) = each($wants)) {
        $owns = str_replace('<', '&lt;', $owns);
        $nowns = preg_replace_callback("/(" . $formatter->wordrule . ")/", array(&$formatter, 'link_repl'), $owns);
        $out .= "<li>" . $formatter->link_repl($name, htmlspecialchars($name)) . ": {$nowns}</li>";
    }
    $out .= "</ul>\n";
    $formatter->sister_on = $save;
    $formatter->pagelinks = $pagelinks;
    // save
    return $out;
}
开发者ID:NessunKim,项目名称:MW_Skins,代码行数:54,代码来源:WantedPages.php


示例5: test_names

 public function test_names()
 {
     $tests = array('smith' => 'Smith', 'sMith' => 'Smith', 'SMITH' => 'Smith', 'mr     extra   space' => 'Mr Extra Space', 'p smith' => 'P Smith', 'mr p smith' => 'Mr P Smith', 'mr. p. smith' => 'Mr. P. Smith', 'john smith' => 'John Smith', 'mcdonald' => 'McDonald', 'joy macdonald' => 'Joy Macdonald', 'robert MacDonald' => 'Robert MacDonald', 'Macon' => 'Macon', 'mcdoNald-SMYTHE' => 'McDonald-Smythe', 'smythe-Mcdonald' => 'Smythe-McDonald', 'von MacDonald iii' => 'von MacDonald III', "o'grady" => "O'Grady", "van o'grady" => "van O'Grady", "van o'grady jr." => "van O'Grady Jr.", 'de la rue' => 'de la Rue', 'de la rue 1st.' => 'de la Rue 1st.', 'ap DAVIs' => 'ap Davis', 'john ap davis' => 'John ap Davis', 'smythington-twistle' => 'Smythington-Twistle', 'smythington-twistle-de-groot' => 'Smythington-Twistle-De-Groot', 'mary-jo von syMington-mcDonald-twistle 3RD' => 'Mary-Jo von Symington-McDonald-Twistle 3rd', 'st john' => 'St John', 'st. john iV' => 'St. John IV');
     foreach ($tests as $input => $expected) {
         $this->assertEquals($expected, Formatter::name($input));
     }
 }
开发者ID:romaninsh,项目名称:validation,代码行数:7,代码来源:formatter.test.php


示例6: getList

 protected function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_USERS_OVERVIEW')));
     // Initiate pagination
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data = array('start' => ($page - 1) * 25, 'limit' => 25);
     $user_total = $this->model_user_user->getTotalUsers();
     foreach ($this->model_user_user->getUsers($data) as $result) {
         $this->data['users'][] = array_merge($result, array('status' => $result['status'] ? Language::getVar('SUMO_NOUN_ENABLED') : Language::getVar('SUMO_NOUN_DISABLED'), 'date_added' => Formatter::date($result['date_added']), 'date_last_seen' => $result['date_last_seen'] != '0000-00-00 00:00:00' ? Formatter::date($result['date_last_seen']) : '&mdash;', 'edit' => $this->url->link('user/user/update', 'token=' . $this->session->data['token'] . '&user_id=' . $result['user_id'], 'SSL')));
     }
     $pagination = new Pagination();
     $pagination->total = $user_total;
     $pagination->page = $page;
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('sale/return', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data = array_merge($this->data, array('pagination' => $pagination->renderAdmin(), 'insert' => $this->url->link('user/user/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('user/user/delete', 'token=' . $this->session->data['token'], 'SSL'), 'u_users' => $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL'), 'u_permissions' => $this->url->link('user/user_permission', 'token=' . $this->session->data['token'], 'SSL')));
     $this->template = 'user/user_list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:26,代码来源:user.php


示例7: getPmaMatches

 /**
  * Parses result of preg_match_all
  *
  * @return array
  */
 public function getPmaMatches()
 {
     $result['count'] = $this->pmaCount;
     $result['expr'] = Formatter::arrayToTree($this->pmaMatches[0]);
     $result['mtch'] = Formatter::arrayToTree($this->pmaMatches[1]);
     return $result;
 }
开发者ID:rdohms,项目名称:PHPRegExpTester,代码行数:12,代码来源:RegExpHandler.php


示例8: updateInvoice

 public function updateInvoice($invoiceID, $data)
 {
     // Delete invoice-lines and add 'em later again
     $this->query('DELETE FROM PREFIX_invoice_line WHERE invoice_id = :invoiceID', array('invoiceID' => $invoiceID));
     $this->query('DELETE FROM PREFIX_invoice_total WHERE invoice_id = :invoiceID', array('invoiceID' => $invoiceID));
     $totalTax = $total = 0;
     foreach ($data['amount'] as $line => $amount) {
         // Recalculate tax-amount based on the tax-percentage
         if ($data['tax_percentage'][$line] > 0) {
             $data['tax'][$line] = round($data['amount'][$line] * $data['quantity'][$line] * ($data['tax_percentage'][$line] / 100), 4);
             $totalTax += $data['tax'][$line];
         } else {
             $data['tax'][$line] = 0;
         }
         $total += $amount * $data['quantity'][$line];
         $this->query('INSERT INTO PREFIX_invoice_line (invoice_id, product_id, product, quantity, amount, tax_percentage, description) VALUES (
             :invoiceID,
             :productID,
             :product,
             :quantity,
             :amount,
             :taxPercentage,
             :description)', array('invoiceID' => $invoiceID, 'productID' => $data['product_id'][$line], 'product' => $data['product'][$line], 'quantity' => $data['quantity'][$line], 'amount' => $data['amount'][$line], 'taxPercentage' => $data['tax_percentage'][$line], 'description' => $data['description'][$line]));
     }
     foreach ($data['totals'] as $sortOrder => $productTotal) {
         $labelInject = isset($productTotal['label_inject']) ? $productTotal['label_inject'] : '';
         $this->query("INSERT INTO PREFIX_invoice_total\n                SET invoice_id        = :id,\n                    sort_order      = :sortOrder,\n                    label           = :label,\n                    label_inject    = :labelInject,\n                    value           = :value,\n                    value_hr        = :valueHR", array('id' => $invoiceID, 'sortOrder' => $sortOrder, 'label' => $productTotal['label'], 'labelInject' => $labelInject, 'value' => $productTotal['value'], 'valueHR' => Formatter::currency($productTotal['value'])));
     }
     // Totalamount is always the last line.
     $total = $productTotal['value'];
     $invoicePrefix = $this->config->get('invoice_prefix');
     // Customer country numeric? Change to plain text
     if (preg_match("/^\\d+\$/", $data['customer_country'])) {
         $countryData = $this->query("SELECT name FROM PREFIX_country WHERE country_id = :countryID", array('countryID' => $data['customer_country']))->fetch();
         $data['customer_country'] = !empty($countryData) ? $countryData['name'] : '-';
     }
     $this->query('UPDATE PREFIX_invoice SET
         invoice_no = :invoiceNO,
         customer_id = :customerID,
         customer_no = :customerNo,
         customer_name = :customerName,
         customer_address = :customerAddress,
         customer_postcode = :customerPostcode,
         customer_city = :customerCity,
         customer_country = :customerCountry,
         customer_email = :customerEmail,
         payment_amount = :paymentAmount,
         payment_tax_percentage = :paymentTax,
         shipping_amount = :shippingAmount,
         shipping_tax_percentage = :shippingTax,
         discount = :discount,
         total_amount = :amount,
         sent_date = :sentDate,
         notes = :notes,
         template = :template,
         term = :term,
         auto = :auto,
         reference = :reference
         WHERE invoice_id = :invoiceID', array('invoiceNO' => $invoicePrefix . str_pad($invoiceID, 5, 0, STR_PAD_LEFT), 'customerNo' => $customerNo, 'customerID' => $data['customer_id'], 'customerName' => $data['customer_name'], 'customerAddress' => $data['customer_address'], 'customerPostcode' => $data['customer_postcode'], 'customerCity' => $data['customer_city'], 'customerCountry' => $data['customer_country'], 'customerEmail' => $data['customer_email'], 'paymentAmount' => $data['payment_amount'], 'paymentTax' => $data['payment_tax'], 'shippingAmount' => $data['shipping_amount'], 'shippingTax' => $data['shipping_tax'], 'discount' => json_encode($data['discount']), 'amount' => $total, 'sentDate' => Formatter::dateReverse($data['sent_date']), 'notes' => $data['notes'], 'template' => $data['template'], 'term' => $data['term'], 'auto' => $data['auto'], 'reference' => $data['reference'], 'invoiceID' => $invoiceID));
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:60,代码来源:invoice.php


示例9: getReturns

 public function getReturns($data = array())
 {
     $values = array('language' => $this->config->get('language_id'));
     $sql = "SELECT *, CONCAT(r.firstname, ' ', r.lastname) AS customer, (\n                        SELECT rs.name\n                        FROM PREFIX_return_status AS rs\n                        WHERE rs.return_status_id = r.return_status_id AND rs.language_id = :language\n                    ) AS status\n                FROM PREFIX_return AS r";
     $implode = array();
     if (!empty($data['filter_return_id'])) {
         $implode[] = "r.return_id = :filter_return_id";
         $values['filter_return_id'] = $data['filter_return_id'];
     }
     if (!empty($data['filter_order_id'])) {
         $implode[] = "r.order_id = :filter_order_id";
         $values['filter_order_id'] = $data['filter_order_id'];
     }
     if (!empty($data['filter_customer'])) {
         $implode[] = "CONCAT(r.firstname, ' ', r.lastname) LIKE :filter_customer";
         $values['filter_customer'] = $data['filter_customer'] . '%';
     }
     if (!empty($data['filter_product'])) {
         $implode[] = "r.product = :filter_product";
         $values['filter_product'] = $data['filter_product'];
     }
     if (!empty($data['filter_model'])) {
         $implode[] = "r.model = :filter_model";
         $values['filter_model'] = $data['filter_model'];
     }
     if (!empty($data['filter_return_status_id'])) {
         $implode[] = "r.return_status_id = :filter_return_status_id";
         $values['filter_return_status_id'] = $data['filter_return_status_id'];
     }
     if (!empty($data['filter_date_added'])) {
         $implode[] = "DATE(r.date_added) = DATE('" . Formatter::dateRevers($data['filter_date_added']) . "')";
     }
     if (!empty($data['filter_date_modified'])) {
         $implode[] = "DATE(r.date_modified) = DATE('" . Formatter::dateRevers($data['filter_date_modified']) . "')";
     }
     if ($implode) {
         $sql .= " WHERE " . implode(" AND ", $implode);
     }
     $sort_data = array('r.return_id', 'r.order_id', 'customer', 'r.product', 'r.model', 'status', 'r.date_added', 'r.date_modified');
     if (isset($data['sort']) && in_array($data['sort'], $sort_data)) {
         $sql .= " ORDER BY " . $data['sort'];
     } else {
         $sql .= " ORDER BY r.return_id";
     }
     if (isset($data['order']) && $data['order'] == 'DESC') {
         $sql .= " DESC";
     } else {
         $sql .= " ASC";
     }
     if (isset($data['start']) || isset($data['limit'])) {
         if ($data['start'] < 0) {
             $data['start'] = 0;
         }
         if ($data['limit'] < 1) {
             $data['limit'] = 20;
         }
         $sql .= " LIMIT " . (int) $data['start'] . "," . (int) $data['limit'];
     }
     return $this->fetchAll($sql, $values);
 }
开发者ID:wardvanderput,项目名称:SumoStore,代码行数:60,代码来源:return.php


示例10: removeDir

 /**
  * Recursively remove given directory
  *
  * @param string $dir            
  * @return boolean
  */
 public static function removeDir($dir)
 {
     if (!Formatter::endsWith($dir, DIRECTORY_SEPARATOR) && !Formatter::endsWith($dir, self::DIR_SEPARATOR)) {
         $dir .= self::DIR_SEPARATOR;
     }
     if (!is_dir($dir)) {
         return false;
     }
     if ($handle = opendir($dir)) {
         $dirsToVisit = array();
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != "..") {
                 if (is_dir($dir . $file)) {
                     $dirsToVisit[] = $dir . $file;
                 } else {
                     if (is_file($dir . $file)) {
                         unlink($dir . $file);
                     }
                 }
             }
         }
         closedir($handle);
         foreach ($dirsToVisit as $i => $w) {
             self::removeDirectory($w);
         }
     }
     rmdir($dir);
     return true;
 }
开发者ID:czahoo,项目名称:api-framework,代码行数:35,代码来源:FileHelper.php


示例11: testYiiDateFormatToJQueryDateFormat

 /**
  * Ensure that yiiDateFormatToJQueryDateFormat correctly translates between format languages
  */
 public function testYiiDateFormatToJQueryDateFormat()
 {
     $formats = array('d MMM y' => 'd M yy', 'd/MMM/y' => 'd/M/yy', 'd/MM/y' => 'd/mm/yy', 'd/MM M/y' => 'd/mm m/yy', 'd/MM M/y MMM' => 'd/mm m/yy M');
     foreach ($formats as $fmt => $expected) {
         $newFormat = Formatter::yiiDateFormatToJQueryDateFormat($fmt);
         $this->assertEquals($expected, $newFormat);
     }
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:11,代码来源:FormatterTest.php


示例12: doValidate

 public function doValidate($ctx)
 {
     $formattedValue = $ctx->getRequest()->getString($this->getName(), null);
     // Validate only if there is a value
     if ($formattedValue === null || $formattedValue === '') {
         return true;
     }
     $format = new Formatter($ctx->getUser()->getTimezone(), $ctx->getUser()->getLocale());
     $value = $format->getNumber($formattedValue);
     if ($value === false) {
         $msg = sprintf(Application::getTranslator()->_('The field %1$s must be a valid number'), $this->getLabel());
         $this->addFieldError($ctx, $this->getName(), $msg);
         return false;
     }
     if ($this->minValue) {
         if ($this->minValue->isExclusive()) {
             if ($value <= $this->minValue->getValue()) {
                 $msg = sprintf(Application::getTranslator()->_('The value of the %1$s field must be greater than %2$s'), $this->getLabel(), $this->minValue->getValue());
                 $this->addFieldError($ctx, $this->getName(), $msg);
                 return false;
             }
         } else {
             if ($value < $this->minValue->getValue()) {
                 $msg = sprintf(Application::getTranslator()->_('The value of the %1$s field must be greater or equal to %2$s'), $this->getLabel(), $this->minValue->getValue());
                 $this->addFieldError($ctx, $this->getName(), $msg);
                 return false;
             }
         }
     }
     if ($this->maxValue) {
         if ($this->maxValue->isExclusive()) {
             if ($value >= $this->maxValue->getValue()) {
                 $msg = sprintf(Application::getTranslator()->_('The value of the %1$s field must be smaller than %2$s'), $this->getLabel(), $this->maxValue->getValue());
                 $this->addFieldError($ctx, $this->getName(), $msg);
                 return false;
             }
         } else {
             if ($value > $this->maxValue->getValue()) {
                 $msg = sprintf(Application::getTranslator()->_('The value of the %1$s field must be smaller or equal to %2$s'), $this->getLabel(), $this->maxValue->getValue());
                 $this->addFieldError($ctx, $this->getName(), $msg);
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:46,代码来源:NumberConstraint.php


示例13: searchCustom

 public function searchCustom($keyword, $pagesize = 10, $option = array())
 {
     $keyword = Formatter::clean($keyword);
     //$keyword = Apache_Solr_Service::phrase($keyword);
     $solr = $this->_getSolr();
     $params = array('group' => 'true', 'group.limit' => $pagesize, 'group.field' => 'type');
     $params['sort'] = "score desc, played_count desc";
     $rs = $solr->search($keyword, 0, $pagesize, $params);
     return $rs;
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:10,代码来源:SearchHelper.php


示例14: actionIndex

 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = new AdminGUserModel();
     $userInfo = null;
     if (isset($_GET['AdminGUserModel'])) {
         $model->attributes = $_GET['AdminGUserModel'];
         $user_phone = Formatter::formatPhone($_GET['AdminGUserModel']['user_phone']);
         $userInfo = GUserModel::model()->findByAttributes(array('user_phone' => $user_phone));
     }
     $this->render('index', array('model' => $model, 'userInfo' => $userInfo));
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:14,代码来源:AdminUserController.php


示例15: arrayToTree

 /**
  * Convert and array to a string representation in tree format
  *
  * @param string $array 
  * @return string
  */
 public static function arrayToTree($array)
 {
     $tree = "";
     foreach ($array as $key => $item) {
         if (is_array($item)) {
             $item = Formatter::arrayToTree($item);
         }
         $tree .= "[" . $key . "] " . self::sanitize($item) . PHP_EOL;
     }
     return $tree;
 }
开发者ID:rdohms,项目名称:PHPRegExpTester,代码行数:17,代码来源:Formatter.php


示例16: do_new

function do_new($formatter, $options)
{
    global $DBInfo;
    if (!$options['value']) {
        $title = _("Create a new page");
        $formatter->send_header("", $options);
        $formatter->send_title($title, "", $options);
        $url = $formatter->link_url($formatter->page->urlname);
        if ($DBInfo->hasPage('MyNewPage')) {
            $p = $DBInfo->getPage('MyNewPage');
            $f = new Formatter($p, $options);
            $f->use_rating = 0;
            $f->send_page('', $options);
        }
        $msg = _("Page Name");
        $fixname = _("Normalize this page name");
        $btn = _("Create a new page");
        print <<<FORM
<div class='addPage'>
<form method='get' action='{$url}'>
<table style='border:0'><tr><th class='addLabel'><labe>{$msg}: </label></th><td><input type='hidden' name='action' value='new' />
    <input name='value' size='30' /></td></tr>
<tr><th class='addLabel'><input type='checkbox' name='fixname' checked='checked' /></th><td>{$fixname}</td></tr>
<td></td><td><input type='submit' value='{$btn}' /></td>
</tr></table>
    </form>
</div>
FORM;
        $formatter->send_footer();
    } else {
        $pgname = $options['value'];
        if ($options['fixname']) {
            $pgname = normalize($pgname);
        }
        $options['page'] = $pgname;
        $page = new WikiPage($pgname);
        $f = new Formatter($page, $options);
        do_edit($f, $options);
        return true;
    }
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:41,代码来源:new.php


示例17: test_Mixins

 function test_Mixins()
 {
     foreach ($this->load_files('Mixins') as $item) {
         $out = str_replace('.css', '_out.css', $item);
         $original = file_get_contents($item);
         $expected = file_get_contents($out);
         $css = Mixins::parse($original);
         $css = Formatter::minify($css);
         $expected = Formatter::minify($expected);
         $this->assertEqual($expected, $css);
     }
 }
开发者ID:behaba,项目名称:csscaffold,代码行数:12,代码来源:Scaffold_Modules.php


示例18: ArtistsByAlbum

 public static function ArtistsByAlbum($id)
 {
     $artists = AlbumArtistModel::model()->getArtistsByAlbum($id);
     $i = 0;
     $html = "";
     foreach ($artists as $artist) {
         $html .= $i > 0 ? "<span>&nbsp;-&nbsp;</span>" : "";
         $html .= '<a href="' . URLHelper::buildFriendlyURL("artist", $artist->artist_id, Common::makeFriendlyUrl($artist->artist_name)) . '" title="' . $artist->artist_name . '">' . Formatter::substring($artist->artist_name, " ", 3, 15) . '</a>';
         $i++;
     }
     return $html;
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:12,代码来源:ArtistHelper.php


示例19: NumberFormatter

 /**
  * Constructor
  * 
  * @return  void
  */
 function NumberFormatter($arr_config)
 {
     parent::Formatter($arr_config);
     if ($this->arr_config['decimals'] == '') {
         $this->arr_config['decimals'] = 2;
     }
     if ($this->arr_config['dec_point'] == '') {
         $this->arr_config['dec_point'] = '.';
     }
     if ($this->arr_config['thousands_sep'] == '') {
         $this->arr_config['thousands_sep'] = ',';
     }
 }
开发者ID:BackupTheBerlios,项目名称:openology-svn,代码行数:18,代码来源:NumberFormatter.php


示例20: log

 private function log()
 {
     $logDir = Config::getInstance()->getString('logging/logDir');
     $logFile = "{$logDir}/" . $this->logFileName;
     $this->ensureDirExists($logFile);
     $fDate = Formatter::dateTimeUTC($this->endTime);
     $diff = $this->endTime - $this->startTime;
     $text = $this->text ? $this->text : "-";
     // If text is empty, set it to '-'.
     $fd = fopen($logFile, "a");
     fwrite($fd, "{$fDate}\t{$text}\t{$diff}\n");
     fclose($fd);
 }
开发者ID:fruition-sciences,项目名称:phpfw,代码行数:13,代码来源:TimeLogger.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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