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


PHP prettify函数代码示例

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


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

示例1: smarty_function_header

function smarty_function_header($params, &$smarty)
{
    $self = $smarty->getTemplateVars('self');
    $theme = $smarty->getTemplateVars('theme');
    $title = $smarty->getTemplateVars('page_title');
    $inflector = new Inflector();
    $item_name = prettify($inflector->singularize($smarty->getTemplateVars('controller')));
    if (empty($title) || $title === 'Index') {
        switch ($smarty->getTemplateVars('action')) {
            case 'view':
                $title = $item_name . ' Details';
                break;
            case 'edit':
                $title = 'Editing ' . $item_name . ' Details';
                break;
            case 'new':
                $title = 'Create new ' . $item_name;
                break;
            case 'index':
            default:
                $title = $item_name;
                break;
        }
    }
    return '<h1 class="page_title">' . $title . '</h1>';
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:26,代码来源:function.header.php

示例2: toHTML

 public function toHTML()
 {
     // change to facilitate lists
     $id = 'search_' . $this->fieldname;
     $name = 'Search[' . $this->fieldname . ']';
     if (count($this->options) > get_config('AUTOCOMPLETE_SELECT_LIMIT')) {
         $html = '';
         $selected = $this->value;
         if (empty($selected)) {
             $selected = $this->default;
         }
         $html .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $selected . '" />';
         $text_value = isset($this->options[$selected]) ? $this->options[$selected] : '';
         $html .= '<input alt="Autocomplete enabled" type="text" id="' . $id . '_text" value="' . $text_value . '" class="uz-autocomplete  ui-autocomplete-input icon slim" data-id="' . $id . '" data-action="array"  />';
         $html .= '<script type="text/javascript">' . 'var ' . $id . '=' . json_encode(dataObject::toJSONArray($this->options)) . '</script>';
     } else {
         $html = '<select id="' . $id . '" name="' . $name . '">';
         foreach ($this->options as $val => $opt) {
             $selected = '';
             if ($this->value === "{$val}" || is_null($this->value) && $this->default === "{$val}") {
                 $selected = 'selected="selected"';
             }
             $html .= '<option value="' . $val . '" ' . $selected . '>' . h(prettify($opt)) . '</option>';
         }
         $html .= '</select></li>';
     }
     return $this->labelHTML() . $html;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:28,代码来源:SelectSearchField.php

示例3: smarty_block_view_section

function smarty_block_view_section($params, $content, &$smarty, $repeat)
{
    if (!empty($content)) {
        $attrs = array();
        $attrs['class'][] = 'heading';
        if (isset($params['class'])) {
            $attrs['class'][] = $params['class'];
        }
        if (isset($params['dont_prettify'])) {
            $heading = $params['heading'];
        } else {
            $heading = prettify($params['heading']);
        }
        if ($heading === 'EGS_HIDDEN_SECTION') {
            return '';
        }
        // convert attrs array to a string
        if (isset($params['expand'])) {
            $attrs['class'][] = 'expand';
            $attrs['class'][] = $params['expand'];
            $data['expand'] = $params['expand'] == 'closed' ? 'hidden' : '';
        }
        $data['attrs'] = build_attribute_string($attrs);
        $data['heading'] = $heading;
        $data['content'] = $content;
        // fetch smarty plugin template
        return smarty_plugin_template($smarty, $data, 'block.view_section');
    }
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:29,代码来源:block.view_section.php

示例4: getObjectPolicyValue

 function getObjectPolicyValue()
 {
     $policy_detail = DataObjectFactory::Factory('SystemObjectPolicy');
     $policy_detail->load($this->object_policies_id);
     $policy_value = $policy_detail->getComponentTitle() . ' ' . prettify($policy_detail->get_field()) . ' ' . $policy_detail->getFormatted('operator') . ' ' . $policy_detail->getvalue();
     return $policy_value;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:7,代码来源:SystemPolicyControlList.php

示例5: sendMessage

/**
 * Write a message to channel/user
 */
function sendMessage($socket, $channel, $msg)
{
    if (strlen($msg) > 2) {
        //Avoid sending empty lines to server, since all data should contain a line break, 2 chars is minimum
        $msg = prettify($msg);
        sendData($socket, "PRIVMSG {$channel} :{$msg}");
    }
}
开发者ID:fathkay,项目名称:VikingBot,代码行数:11,代码来源:functions.php

示例6: toSQL

 function toSQL()
 {
     $sql = 'ALTER COLUMN ' . $this->name . ' ';
     foreach ($this->options->toArray() as $key => $val) {
         if ($val === true) {
             $sql .= prettify($key);
         }
     }
     return $sql;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:10,代码来源:AlterTableComponent.php

示例7: toHTML

 /**
  * @param void
  * @return string
  *
  * returns the HTML representation of the status checkboxes, each with a label
  * NOTE: This SearchField doesn't have an encompassing label, so will need to be considered should containing elements be required
  */
 public function toHTML()
 {
     $html = '';
     foreach ($this->statuses as $status) {
         $checked = '';
         if ($this->value_set && isset($this->value[$status]) || !$this->value_set && in_array($status, $this->default)) {
             $checked = 'checked="checked"';
         }
         $html .= '<label>' . prettify($status) . '</label><input type="checkbox" class="checkbox" name="Search[' . $this->fieldname . '][' . $status . ']" ' . $checked . '/>';
     }
     return $html;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:19,代码来源:POrderSearchField.php

示例8: build

 public function build($params, $data = false)
 {
     $script = '';
     $url = '?';
     $attrs = ' ';
     foreach ($params as $key => $val) {
         //special cases
         if (substr($key, 0, 1) === '_') {
             $attrs .= str_replace('_', '', $key) . '="' . $val . '" ';
             continue;
         }
         if ($key == 'value' || $key == 'img' || $key == 'alt') {
             continue;
         }
         //module and submodule
         if ($key == 'modules') {
             if (isset($val[0])) {
                 $url .= 'module=' . $val[0] . '&amp;';
                 //only allow submodule if module is set
                 if (isset($val[1])) {
                     $url .= 'submodule=' . $val[1] . '&amp;';
                 }
             }
             //everything else
         } else {
             $url .= strtolower($key) . '=' . urlencode($val) . '&amp;';
         }
     }
     //remove last ampersand
     $url = substr($url, 0, -5);
     $url = '/' . $url;
     if (isset($params['link'])) {
         $url = $params['link'];
     }
     if (empty($params['value'])) {
         $params['value'] = 'link';
     }
     if (isset($params['img'])) {
         $params['value'] = '<img src="' . $params['img'] . '" alt="' . $params['alt'] . '" />';
         $string = '<a ' . $attrs . ' href="' . $url . '">' . $params['value'] . '</a>';
     } else {
         if ($data) {
             $string = '<a ' . $attrs . ' href="' . $url . '">' . $params['value'] . '</a>';
         } else {
             $string = '<a ' . $attrs . ' href="' . $url . '">' . prettify($params['value']) . '</a>';
         }
     }
     return $string;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:49,代码来源:EGSLinkBuilder.php

示例9: toHTML

 public function toHTML()
 {
     $value = $this->value;
     if (!empty($value)) {
         $value['count'] = count($value['field']);
     } else {
         /*
          * if the array hasn't been sent, set the value to 1 
          * and set some dummy data (or perhaps test in the loop 
          * we need to set the loop at 1 to load the default single row.
          */
         $value = array('', '', '');
         //
         $value['count'] = 1;
     }
     $html .= '<dd><div id="matrix_' . $this->fieldname . '">';
     for ($i = 0; $i <= $value['count'] - 1; $i++) {
         // generate the matrix line
         $html .= '<p id="p:' . $this->fieldname . ':' . $i . '" class="matrix_field">';
         // generate the field selector
         $html .= '    <select style="clear: both;" id="search:' . $this->fieldname . ':field:' . $i . '" name="Search[' . $this->fieldname . '][field][]">';
         foreach ($this->options as $val => $opt) {
             $selected = '';
             if ($value['field'][$i] == $val || is_null($this->value) && $this->default == $val) {
                 $selected = 'selected="selected"';
             }
             $html .= '        <option value="' . $val . '" ' . $selected . '>' . h(prettify($opt)) . '</option>';
         }
         $html .= '    </select>';
         // generate the operator selector
         $html .= '    <select id="search:' . $this->fieldname . ':operator:' . $i . '" name="Search[' . $this->fieldname . '][operator][]">';
         foreach ($this->operators as $val => $opt) {
             $selected = '';
             if ($value['operator'][$i] == $val) {
                 $selected = 'selected="selected"';
             }
             $html .= '        <option value="' . $val . '" ' . $selected . '>' . h(prettify($opt)) . '</option>';
         }
         $html .= '    </select>';
         // generate the value input
         $html .= '    <input id="search:' . $this->fieldname . ':value:' . $i . '" type="text" name="Search[' . $this->fieldname . '][value][]" value="' . $value['value'][$i] . '" />';
         $html .= '	<a href="#" class="remove_matrix" id="search:' . $this->fieldname . ':delete:' . $i . '"><img src="' . THEME_URL . THEME . '/graphics/delete.png" /></a>';
         $html .= '</p>';
     }
     $html .= '</div>';
     $html .= '<p style="clear:both;"><a href="#" class="clone_matrix" rel="' . $this->fieldname . '"><img src="' . THEME_URL . THEME . '/graphics/add.png" style="float: left; margin-right: 5px;"/>Add a new constraint</a></p>';
     $html .= '</dd><br />';
     return $this->labelHTML() . $html;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:49,代码来源:MatrixSearchField.php

示例10: save_model

 public function save_model($modelName, $dataIn = array(), &$errors = array(), &$warnings = array(), $duplicates = '')
 {
     // Need to define error array here due to too many nested levels
     $flash = Flash::Instance();
     $edi_errors = array();
     if ($duplicates != 'R') {
         // Do not reject duplicates - so check if record exists
         $model = new $modelName();
         $identifierFields = $model->getIdentifierFields();
         $identifierValues = array();
         foreach ($identifierFields as $key => $field) {
             if (isset($dataIn[$modelName][$field]) && $model->checkUniqueness($field)) {
                 $identifier_string = $field . ' : ' . $dataIn[$modelName][$field] . ',';
                 $identifierValues[$key] = $dataIn[$modelName][$field];
             } else {
                 unset($identifierFields[$key]);
             }
         }
         if (count($identifierFields) > 0 && count($identifierFields) == count($identifierValues)) {
             $model->loadBy($identifierFields, $identifierValues);
             if ($model->isLoaded()) {
                 if ($duplicates == 'I') {
                     // Ignore duplicates so return true
                     $warnings[] = 'Duplicate  ' . $identifier_string . ' Ignored';
                     return true;
                 } else {
                     // replace/update duplicate so set id field value
                     $dataIn[$modelName][$model->idField] = $model->{$model->idField};
                 }
             }
         }
     }
     $result = parent::save($modelName, $dataIn, $edi_errors);
     if (count($edi_errors) > 0) {
         // Add the Identifier Values to the errors to identify the data in error
         // Assumes the $dataIn array is an array of [ModelName][ModelData]
         // and that the input $modelName is the identifying model for the data
         $model = new $modelName();
         foreach ($model->getIdentifierFields() as $field) {
             $errors[] = prettify($field) . ' : ' . $dataIn[$modelName][$field];
         }
         $flash->addErrors($edi_errors);
         foreach ($edi_errors as $error) {
             $errors[] = $error;
         }
     }
     return $result;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:48,代码来源:EdiController.php

示例11: addPlots

 function addPlots($data)
 {
     $plots = array();
     $labels = array();
     $i = 0;
     foreach ($data as $key => $plot_data) {
         $plot = new BarPlot(array_values($plot_data));
         $plot->setLegend(prettify($key));
         $plot->setFillColor(self::$colours[$i]);
         $i++;
         $plots[] = $plot;
         $labels = array_merge($labels, array_keys($plot_data));
     }
     $group_plot = new GroupBarPlot($plots);
     $this->grapher->add($group_plot);
     $this->grapher->xaxis->setTickLabels($labels);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:17,代码来源:EGSBar.php

示例12: smarty_function_eglet

function smarty_function_eglet($params, &$smarty)
{
    $container = new EGletContainer();
    $eglet_name = $params['name'];
    $renderer = call_user_func(array($eglet_name, 'getRenderer'));
    $eglet = new $eglet_name($renderer);
    if (isset($params['title'])) {
        $title = $params['title'];
    } else {
        $title = prettify($params['name']);
    }
    $container->addEGlet($title, $eglet);
    if (isset($params['populate'])) {
        $container->populate();
        $container->render($params, $smarty);
    }
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:17,代码来源:function.eglet.php

示例13: __construct

 function __construct()
 {
     $this->css_title = empty($_SESSION['css']) ? $this->css : $_SESSION['css'];
     $this->css = 'styles/' . $this->css_title . '/' . $this->css_title . '.php';
     if ($_SERVER[QUERY_STRING]) {
         $query_string = htmlspecialchars(strip_tags($_SERVER[QUERY_STRING]));
         $crumbs = explode('/', $query_string);
         $bread = '?';
         foreach ($crumbs as $crumb) {
             $bread .= $crumb == '' ? 'index' : $crumb . '/';
             $breadcrumbs .= '<a href="' . $bread . '">' . prettify($crumb) . '</a> : ';
         }
         $this->breadcrumbs = '<a href="/" title="Home Page">Home</a> : ' . substr($breadcrumbs, 0, -2);
     } else {
         $this->breadcrumbs = '<a href="index.php" title="home page">home</a> : ';
     }
     $this->page = $_SERVER[SCRIPT_FILENAME];
     $this->pagetitle = prettify($crumb);
 }
开发者ID:Jaciss,项目名称:protoframe,代码行数:19,代码来源:Frame.php

示例14: toSQL

 function toSQL()
 {
     //username varchar not null primary key
     $sql = $this->name . ' ' . $this->type;
     foreach ($this->options as $key => $val) {
         $sql .= ' ' . prettify($key);
     }
     $refs = $this->references->toArray();
     if (count($refs) > 0) {
         $string = 'REFERENCES ' . $refs['table'] . '(' . $refs['column'] . ')';
         if (!empty($refs['on_update'])) {
             $string .= ' ON UPDATE ' . prettify($refs['on_update']);
         }
         if (!empty($refs['on_delete'])) {
             $string .= ' ON DELETE ' . prettify($refs['on_delete']);
         }
         $sql .= ' ' . $string;
     }
     return $sql;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:20,代码来源:AddColumnComponent.php

示例15: smarty_block_heading_cell

function smarty_block_heading_cell($params, $content, &$smarty, $repeat)
{
    if (!empty($content)) {
        // why isn't this being done way sooner?!
        if (substr($params['field'], -2) == 'id') {
            return '';
        }
        // attribute variables
        $attrs = array();
        // merge data attributes with attributes array
        $attrs = array_merge($attrs, build_data_attributes($params));
        if ($smarty->getTemplateVars('no_ordering') !== TRUE) {
            $link = $smarty->getTemplateVars('self');
            $link['value'] = prettify($content);
            $action = $smarty->getTemplateVars('action');
            if (empty($action)) {
                $action = 'index';
            }
            $link['action'] = $action;
            if (isset($params['field'])) {
                $link['orderby'] = $params['field'];
                $attrs['data-column'] = $params['field'];
            }
            $content = link_to($link, $data = true);
            // WTF
        } else {
            $content = prettify($content);
        }
        $model = $params['model'];
        if ($model && $model->getField($params['field'])->type == 'numeric' || $params['field'] == 'right') {
            $attrs['class'][] = 'right';
        }
        if (isset($params['class'])) {
            $attrs['class'][] = $params['class'];
        }
        // build the attribute string based on the attribute array
        $attrs = build_attribute_string($attrs);
        // return the built string
        return '<th ' . $attrs . '>' . $content . '</th>' . "\n";
    }
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:41,代码来源:block.heading_cell.php


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