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


PHP Q_Html::text方法代码示例

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


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

示例1: Q_response_notices

function Q_response_notices()
{
    $result = "";
    $notices = Q_Response::getNotices();
    // Get any notices that we should know about
    if (!empty($notices)) {
        $result .= "<ul class='Q_notices'>";
        foreach ($notices as $k => $n) {
            $key = Q_Html::text($k);
            $result .= "<li data-key='{$key}'>{$n}</li>\n";
        }
        $result .= "</ul>";
    }
    // Get any errors that we should display
    $errors = Q_Response::getErrors();
    if (!empty($errors)) {
        $result .= "<ul class='Q_errors'>";
        foreach ($errors as $e) {
            $field = '';
            if ($e instanceof Q_Exception and $fields = $e->inputFields()) {
                $field .= '<div class="Q_field_name">' . Q_Html::text(reset($fields)) . '</div>';
            }
            $result .= "<li>" . $e->getMessage() . "{$field}</li>";
        }
        $result .= "</ul>";
    }
    return $result ? "<div id='notices'>{$result}</div>" : '';
}
开发者ID:dmitriz,项目名称:Platform,代码行数:28,代码来源:notices.php

示例2: Streams_stream_response_Q_inplace

function Streams_stream_response_Q_inplace()
{
    $stream = isset(Streams::$cache['stream']) ? Streams::$cache['stream'] : null;
    if (!$stream) {
        throw new Exception("No stream");
    }
    if (isset($_REQUEST['title'])) {
        $result = $stream->title;
    } else {
        if (isset($_REQUEST['attributes'])) {
            if (is_array($_REQUEST['attributes'])) {
                reset($_REQUEST['attributes']);
                $result = $stream->getAttribute(key($_REQUEST['attributes']));
            } else {
                $result = $stream->attributes;
            }
        } else {
            $fieldNames = array_diff(Streams::getExtendFieldNames($stream->type), array('insertedTime', 'updatedTime'));
            $field = 'content';
            foreach ($fieldNames as $f) {
                if (isset($_REQUEST[$f])) {
                    $field = $f;
                    break;
                }
            }
            $result = $stream->{$field};
        }
    }
    $convert = Q::ifset($_REQUEST, 'convert', '["\\n"]');
    return Q_Html::text($result, json_decode($convert, true));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:31,代码来源:Q_inplace.php

示例3: Streams_inplace_tool

/**
 * This tool generates an inline editor to edit the content or attribute of a stream.
 * @class Streams inplace
 * @constructor
 * @param {array} $options Options for the tool
 *  An associative array of parameters, containing:
 * @param {string} [$options.inplaceType='textarea'] The type of the fieldInput. Can be "textarea" or "text"
 * @param {array} [$options.convert] The characters to convert to HTML. Pass an array containing zero or more of "\n", " "
 * @param {Streams_Stream} $options.stream A Streams_Stream object
 * @param {string} [$options.field] Optional, name of an field to change instead of the content of the stream
 * @param {string} [$options.attribute] Optional, name of an attribute to change instead of any field.
 * @param {string} [$options.beforeSave] Reference to a callback to call after a successful save. This callback can cancel the save by returning false.
 * @param {string} [$options.onSave] Reference to a callback or event to run after a successful save.
 * @param {string} [$options.onCancel] Reference to a callback or event to run after cancel.
 * @param {array} [$options.inplace=array()] Additional fields to pass to the child Q/inplace tool, if any
 * @uses Q inplace
 */
function Streams_inplace_tool($options)
{
    if (empty($options['stream'])) {
        if (empty($options['publisherId']) or empty($options['streamName'])) {
            throw new Q_Exception_RequiredField(array('field' => 'stream'));
        }
        $publisherId = $options['publisherId'];
        $streamName = $options['streamName'];
        $stream = Streams::fetchOne(null, $publisherId, $streamName);
        if (!$stream) {
            throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => "publisherId={$publisherId}, name={$streamName}"));
        }
    } else {
        $stream = $options['stream'];
    }
    $inplaceType = Q::ifset($options, 'inplaceType', 'textarea');
    $inplace = array('action' => $stream->actionUrl(), 'method' => 'PUT', 'type' => $inplaceType);
    if (isset($options['inplace'])) {
        $inplace = array_merge($options['inplace'], $inplace);
    }
    $convert = Q::ifset($options, 'convert', array("\n"));
    $inplace['hidden']['convert'] = json_encode($convert);
    if (!empty($options['attribute'])) {
        $field = 'attributes[' . urlencode($options['attribute']) . ']';
        $content = $stream->get($options['attribute'], '');
        $maxlength = $stream->maxSize_attributes - strlen($stream->maxSize_attributes) - 10;
    } else {
        $field = !empty($options['field']) ? $options['field'] : 'content';
        $content = $stream->{$field};
        $maxlength = $stream->maxSizeExtended($field);
    }
    switch ($inplaceType) {
        case 'text':
            $inplace['fieldInput'] = Q_Html::input($field, $content, array('placeholder' => Q::ifset($input, 'placeholder', null), 'maxlength' => $maxlength));
            $inplace['staticHtml'] = Q_Html::text($content);
            break;
        case 'textarea':
            $inplace['fieldInput'] = Q_Html::textarea($field, 5, 80, array('placeholder' => Q::ifset($inplace, 'placeholder', null), 'maxlength' => $maxlength), $content);
            $inplace['staticHtml'] = Q_Html::text($content, $convert);
            break;
        default:
            return "inplaceType must be 'textarea' or 'text'";
    }
    if (!$stream->testWriteLevel('suggest')) {
        if (!isset($options['classes'])) {
            $options['classes'] = '';
        }
        Q_Response::setToolOptions(array('publisherId' => $stream->publisherId, 'streamName' => $stream->name));
        $staticClass = $options['inplaceType'] === 'textarea' ? 'Q_inplace_tool_blockstatic' : 'Q_inplace_tool_static';
        return "<span class='Q_inplace_tool_container {$options['classes']}' style='position: relative;'>" . "<div class='{$staticClass}'>{$inplace['staticHtml']}</div></span>";
    }
    $toolOptions = array('publisherId' => $stream->publisherId, 'streamName' => $stream->name, 'inplaceType' => $options['inplaceType']);
    Q::take($options, array('attribute', 'field', 'convert'), $toolOptions);
    $toolOptions['inplace'] = $inplace;
    Q_Response::setToolOptions($toolOptions);
    return Q::tool("Q/inplace", $inplace);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:74,代码来源:tool.php

示例4: Q_columns_tool

/**
 * This tool contains functionality to show things in columns
 * @class Q columns
 * @constructor
 * @param {array}   [options] Provide options for this tool
 *  @param {array}  [options.animation] For customizing animated transitions
 *  @param {integer}  [options.animation.duration] The duration of the transition in milliseconds, defaults to 500
 *  @param {array}  [options.animation.hide] The css properties in "hide" state of animation
 *  @param {array}  [options.animation.show] The css properties in "show" state of animation
 *  @param {array}  [options.back] For customizing the back button on mobile
 *  @param {string}  [options.back.src] The src of the image to use for the back button
 *  @param {boolean} [options.back.triggerFromTitle] Whether the whole title would be a trigger for the back button. Defaults to true.
 *  @param {boolean} [options.back.hide] Whether to hide the back button. Defaults to false, but you can pass true on android, for example.
 *  @param {array}  [options.close] For customizing the back button on desktop and tablet
 *  @param {string}  [options.close.src] The src of the image to use for the close button
 *  @param {string}  [options.title] You can put a default title for all columns here (which is shown as they are loading)
 *  @param {string}  [options.column] You can put a default content for all columns here (which is shown as they are loading)
 *  @param {array}  [options.clickable] If not null, enables the Q/clickable tool with options from here. Defaults to null.
 *  @param {array}  [options.scrollbarsAutoHide] If not null, enables Q/scrollbarsAutoHide functionality with options from here. Enabled by default.
 *  @param {boolean} [options.fullscreen] Whether to use fullscreen mode on mobile phones, using document to scroll instead of relying on possibly buggy "overflow" CSS implementation. Defaults to true on Android, false everywhere else.
 *  @param {array}   [options.columns] In PHP only, an array of $name => $column pairs, where $column is in the form array('title' => $html, 'content' => $html, 'close' => true)
 * @return {string}
 */
function Q_columns_tool($options)
{
    $jsOptions = array('animation', 'back', 'close', 'title', 'scrollbarsAutoHide', 'fullscreen');
    Q_Response::setToolOptions(Q::take($options, $jsOptions));
    if (!isset($options['columns'])) {
        return '';
    }
    Q_Response::addScript('plugins/Q/js/tools/columns.js');
    Q_Response::addStylesheet('plugins/Q/css/columns.css');
    $result = '<div class="Q_columns_container Q_clearfix">';
    $columns = array();
    $i = 0;
    $closeSrc = Q::ifset($options, 'close', 'src', 'plugins/Q/img/x.png');
    $backSrc = Q::ifset($options, 'back', 'src', 'plugins/Q/img/back-v.png');
    foreach ($options['columns'] as $name => $column) {
        $close = Q::ifset($column, 'close', $i > 0);
        $Q_close = Q_Request::isMobile() ? 'Q_close' : 'Q_close Q_back';
        $closeHtml = !$close ? '' : (Q_Request::isMobile() ? '<div class="Q_close Q_back">' . Q_Html::img($backSrc, 'Back') . '</div>' : '<div class="Q_close">' . Q_Html::img($closeSrc, 'Close') . '</div>');
        $n = Q_Html::text($name);
        $columnClass = 'Q_column_' . Q_Utils::normalize($name) . ' Q_column_' . $i;
        if (isset($column['html'])) {
            $html = $column['html'];
            $columns[] = <<<EOT
\t<div class="Q_columns_column {$columnClass}" data-index="{$i}" data-name="{$n}">
\t\t{$html}
\t</div>
EOT;
        } else {
            $titleHtml = Q::ifset($column, 'title', '[title]');
            $columnHtml = Q::ifset($column, 'column', '[column]');
            $classes = $columnClass . ' ' . Q::ifset($column, 'class', '');
            $attrs = '';
            if (isset($column['data'])) {
                $json = Q::json_encode($column['data']);
                $attrs = 'data-more="' . Q_Html::text($json) . '"';
                foreach ($column['data'] as $k => $v) {
                    $attrs .= 'data-' . Q_Html::text($k) . '="' . Q_Html::text($v) . '" ';
                }
            }
            $data = Q::ifset($column, 'data', '');
            $columns[] = <<<EOT
\t<div class="Q_columns_column {$classes}" data-index="{$i}" data-name="{$n}" {$attrs}>
\t\t<div class="Q_columns_title">
\t\t\t{$closeHtml}
\t\t\t<h2 class="Q_title_slot">{$titleHtml}</h2>
\t\t</div>
\t\t<div class="Q_column_slot">{$columnHtml}</div>
\t</div>
EOT;
        }
        ++$i;
    }
    $result .= "\n" . implode("\n", $columns) . "\n</div>";
    return $result;
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:78,代码来源:tool.php

示例5: Streams_player_tool

function Streams_player_tool($options)
{
    extract($options);
    if (!isset($stream)) {
        throw new Q_Exception_MissingObject(array('name' => 'stream'));
    }
    if (!$stream->testReadLevel('content')) {
        $streamName_html = Q_Html::text($stream->name);
        return "<a href='#{$streamName_html}'>hidden</a>";
    }
    $options['streamName'] = $stream->name;
    $parts = explode('/', $stream->type);
    switch ($parts[0]) {
        case 'Streams/text/small':
        case 'Streams/text/medium':
        case 'Streams/text':
            return $stream->content;
        case 'Streams/date':
            // TODO: localize
            if (isset($parts[1]) and $parts[1] === 'birthday') {
                return date('M j', strtotime($stream->content));
            }
            return date('M j, Y', strtotime($stream->content));
        case 'Streams/number':
            if (isset($parts[1]) and $parts[1] === 'age') {
                if (!empty($streams['Streams/user/birthday']->content)) {
                    return Db::ageFromDateTime($streams['Streams/user/birthday']->content);
                }
                return null;
            }
            return $strem->content;
        case 'Streams/category':
            // TODO: implement
        // TODO: implement
        case 'Streams/chat':
            // TODO: implement
        // TODO: implement
        case 'Streams/community':
            // TODO: implement
        // TODO: implement
        default:
            $event = $stream->type . "/tool";
            if (Q::canHandle($event)) {
                return Q::tool($stream->type, $options);
            }
            return Q_Html::tag('div', array('class' => 'Streams_player_stream_content'), Q_Html::text($stream->content));
    }
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:48,代码来源:tool.php

示例6: Q_after_Q_tool_render

function Q_after_Q_tool_render($params, &$result)
{
    $info = $params['info'];
    $extra = $params['extra'];
    if (!is_array($extra)) {
        $extra = array();
    }
    $id_prefix = Q_Html::getIdPrefix();
    $tool_ids = Q_Html::getToolIds();
    $tag = Q::ifset($extra, 'tag', 'div');
    if (empty($tag)) {
        Q_Html::popIdPrefix();
        return;
    }
    $classes = '';
    $data_options = '';
    $count = count($info);
    foreach ($info as $name => $opt) {
        $classes = ($classes ? "{$classes} " : $classes) . implode('_', explode('/', $name)) . '_tool';
        $options = Q_Response::getToolOptions($name);
        if (isset($options)) {
            $friendly_options = str_replace(array('&quot;', '\\/'), array('"', '/'), Q_Html::text(Q::json_encode($options)));
        } else {
            $friendly_options = '';
        }
        $normalized = Q_Utils::normalize($name, '-');
        if (isset($options) or $count > 1) {
            $id = $tool_ids[$name];
            $id_string = $count > 1 ? "{$id} " : '';
            $data_options .= " data-{$normalized}='{$id_string}{$friendly_options}'";
        }
        $names[] = $name;
    }
    if (isset($extra['classes'])) {
        $classes .= ' ' . $extra['classes'];
    }
    $attributes = isset($extra['attributes']) ? ' ' . Q_Html::attributes($extra['attributes']) : '';
    $data_retain = !empty($extra['retain']) || Q_Response::shouldRetainTool($id_prefix) ? " data-Q-retain=''" : '';
    $data_replace = !empty($extra['replace']) || Q_Response::shouldReplaceWithTool($id_prefix) ? " data-Q-replace=''" : '';
    $names = $count === 1 ? ' ' . key($info) : 's ' . implode(" ", $names);
    $ajax = Q_Request::isAjax();
    $result = "<{$tag} id='{$id_prefix}tool' " . "class='Q_tool {$classes}'{$data_options}{$data_retain}{$data_replace}{$attributes}>" . "{$result}</{$tag}>";
    if (!Q_Request::isAjax()) {
        $result = "<!--\nbegin tool{$names}\n-->{$result}<!--\nend tool{$names} \n-->";
    }
    Q_Html::popIdPrefix();
}
开发者ID:dmitriz,项目名称:Platform,代码行数:47,代码来源:render.php

示例7: Q_inplace_tool

/**
 * This tool generates an inline editor, along with a form tag.
 * @class Q inplace
 * @constructor
 * @param {array} [$options] An associative array of parameters, containing:
 *   @param {string} $options.fieldInput  Required. HTML representing a text input, textarea, or select.
 *   @param {string} $options.staticHtml  Required. The static HTML to display when the input isn't showing.
 *   @param {string} [$options.type='textarea']  The type of the input. Can be "textarea", "text" or "select"
 *   @param {string} [$options.action=""]  The uri or url to submit to
 *   @param {string} [$options.method="put"]  The method to use for submitting the form.
 *   @param {boolean} [$options.editing]  If true, then renders the inplace tool in editing mode.
 *   @param {boolean} [$options.editOnClick=true]  If true, then edit mode starts only if "Edit" button is clicked.
 *   @param {boolean} [$options.selectOnEdit=true] If true, selects all the text when entering edit mode.
 *   @param {string} [$options.placeholder] Text to show in the staticHtml or input field when the editor is empty
 *   @param {array} [$options.hidden] An associative array of additional hidden fields to submit in the form
 *   @param {integer} [$options.maxWidth] The maximum width for the Q/autogrow
 *   @param {string} [$options.beforeSave] Reference to a callback to call after a successful save. This callback can cancel the save by returning false.
 *   @param {string} [$options.onSave] Reference to a callback or event to run after a successful save.
 *   @param {string} [$options.onCancel] Reference to a callback or event to run after cancel.
 */
function Q_inplace_tool($options)
{
    $action = '';
    $method = 'put';
    $fieldInput = '';
    $staticHtml = '';
    $type = 'textarea';
    $editOnClick = true;
    $selectOnEdit = true;
    extract($options);
    if (isset($inplace)) {
        extract($inplace);
    }
    if (!isset($fieldInput)) {
        throw new Q_Exception_RequiredField(array('field' => 'fieldInput'));
    }
    $staticClass = $type === 'textarea' ? 'Q_inplace_tool_blockstatic' : 'Q_inplace_tool_static';
    Q_Response::addScript('plugins/Q/js/tools/inplace.js');
    Q_Response::addStylesheet('plugins/Q/css/inplace.css');
    $formTag = Q_Html::form("{$action}", $method, array('class' => 'Q_inplace_tool_form'));
    $hiddenInputs = $options['hidden'] ? Q_Html::hidden($options['hidden']) : '';
    $classes = !empty($editing) ? 'Q_editing Q_nocancel' : '';
    $options = compact('editOnClick', 'selectOnEdit', 'showEditButtons', 'maxWidth', 'beforeSave', 'onSave', 'placeholder', 'type');
    Q_Response::setToolOptions($options);
    $sh = $staticHtml ? $staticHtml : '<span class="Q_placeholder">' . Q_Html::text($placeholder) . '</span>';
    return <<<EOT
<div class='Q_inplace_tool_container {$classes} Q_inplace_{$type}' style="position: relative;">
\t<div class='Q_inplace_tool_editbuttons'>
\t\t<button class='Q_inplace_tool_edit basic16 basic16_edit'>Edit</button>
\t</div>
\t<div class='{$staticClass}'>{$sh}</div>
\t{$formTag}
\t\t{$fieldInput}
\t\t{$hiddenInputs}
\t\t<div class='Q_inplace_tool_buttons'>
\t\t\t<button class='Q_inplace_tool_cancel basic16 basic16_cancel'>Cancel</button>
\t\t\t<button class='Q_inplace_tool_save basic16 basic16_save'>Save</button>
\t\t</div>
\t</form>
</div>

EOT;
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:63,代码来源:tool.php

示例8:

<p>
	This is just to let you know
	<?php 
echo Q_Html::text($user->displayName());
?>
, has started their subscription
	to <?php 
echo Q_Html::text($plan->title);
?>
	with <?php 
echo Q_Html::text($publisher->displayName());
?>
	at <?php 
echo Q_Html::text("{$symbol}{$amount}");
?>
 for <?php 
echo $months;
?>
 months.
</p>

<p>
	See you on <?php 
echo Q_Html::a($link, Q_Html::text($communityName));
?>
!
</p>
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:27,代码来源:startSubscription.php

示例9: compact

<div id="content">
	<div class='Streams_stream_info_pane'>
		<?php 
if ($stream->icon) {
    ?>
			<div class='Streams_stream_icon'>
				<?php 
    echo Q_Html::img($stream->iconUrl('80.png'));
    ?>
			</div>
		<?php 
}
?>
		<div class='Streams_stream_title'>
			<?php 
echo Q_Html::text($stream->title);
?>
		</div>
		<div class='Streams_stream_player'>
			<?php 
echo Q::tool('Streams/player', compact('stream'));
?>
		</div>
	</div>
	<div class='Streams_stream_activity_pane'>
		<div class='Streams_participants'>
			<?php 
echo Q::tool('Streams/participants', compact('stream'));
?>
		</div>
		<div class='Streams_stream_activity'>
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:stream.php

示例10: take

 /**
  * Takes some information out of an existing set of streams
  * @method take
  * @static
  * @param {array} $streams
  * @param {string} $name
  * @param {string} $readLevel
  *  Test each stream for at least this read level.
  *  If the test fails, return null in its stead.
  * @param {string|array} $field='content'
  *  Optional. Defaults to "content".
  *  Can be an array of fields, in which case the function returns an array.
  * @param {boolean} [$escape=false]
  *  Defaults to false. If true, escapes the values as HTML
  * @return {mixed}
  *  Returns the value of the field, or an array of values, depending on
  *  whether $field is an array or a string
  */
 static function take($streams, $name, $readLevel, $field = 'content', $escape = false)
 {
     if (!isset($streams[$name])) {
         return null;
     }
     $result = array();
     $was_array = is_array($field);
     $arr = $was_array ? $field : array($field);
     foreach ($arr as $f) {
         if (!isset($streams[$name]->{$f})) {
             return null;
         }
         if (!$streams[$name]->testReadLevel($readLevel)) {
             return null;
         }
         $result[$f] = !$escape ? $streams[$name]->{$f} : Q_Html::text($streams[$name]->{$f});
     }
     return $was_array ? $result : reset($result);
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:37,代码来源:Streams.php

示例11:

<p>
	This is just to let you know
	<?php 
echo Q_Html::text($user->displayName());
?>
	has been charged <?php 
Q_Html::text("{$symbol}{$amount}");
?>
	for <?php 
echo Q_Html::text($description);
?>
	by <?php 
echo Q_Html::text($publisher->displayName());
?>
</p>

<p>
	See all subscriptions for <?php 
echo Q_Html::a($link, Q_Html::text($publisher->displayName()));
?>
</p>
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:21,代码来源:charge.php

示例12: do_dump

 /**
  * @method do_dump
  * @static
  * @private
  * @param {&mixed} $var
  * @param {string} $var_name=null
  * @param {string} $indent=null
  * @param {string} $reference=null
  * @param {boolean} $as_text=false
  */
 private static function do_dump(&$var, $var_name = NULL, $indent = NULL, $reference = NULL, $as_text = false)
 {
     static $n = null;
     if (!isset($n)) {
         $n = Q_Config::get('Q', 'newline', "\n");
     }
     $do_dump_indent = $as_text ? "  " : "<span style='color:#eeeeee;'>|</span> &nbsp;&nbsp; ";
     $reference = $reference . $var_name;
     $keyvar = 'the_do_dump_recursion_protection_scheme';
     $keyname = 'referenced_object_name';
     $max_indent = self::$var_dump_max_levels;
     if (strlen($indent) >= strlen($do_dump_indent) * $max_indent) {
         echo $indent . $var_name . " (...){$n}";
         return;
     }
     if (is_array($var) && isset($var[$keyvar])) {
         $real_var =& $var[$keyvar];
         $real_name =& $var[$keyname];
         $type = ucfirst(gettype($real_var));
         if ($as_text) {
             echo "{$indent}{$var_name}<{$type}> = {$real_name}{$n}";
         } else {
             echo "{$indent}{$var_name} <span style='color:#a2a2a2'>{$type}</span> = <span style='color:#e87800;'>&amp;{$real_name}</span><br>";
         }
     } else {
         $var = array($keyvar => $var, $keyname => $reference);
         $avar =& $var[$keyvar];
         $type = ucfirst(gettype($avar));
         if ($type == "String") {
             $type_color = "green";
         } elseif ($type == "Integer") {
             $type_color = "red";
         } elseif ($type == "Double") {
             $type_color = "#0099c5";
             $type = "Float";
         } elseif ($type == "Boolean") {
             $type_color = "#92008d";
         } elseif ($type == "NULL") {
             $type_color = "black";
         } else {
             $type_color = '#92008d';
         }
         if (is_array($avar)) {
             $count = count($avar);
             if ($as_text) {
                 echo "{$indent}" . ($var_name ? "{$var_name} => " : "") . "<{$type}>({$count}){$n}{$indent}({$n}";
             } else {
                 echo "{$indent}" . ($var_name ? "{$var_name} => " : "") . "<span style='color:#a2a2a2'>{$type} ({$count})</span><br>{$indent}(<br>";
             }
             $keys = array_keys($avar);
             foreach ($keys as $name) {
                 $value =& $avar[$name];
                 $displayName = is_string($name) ? "['" . addslashes($name) . "']" : "[{$name}]";
                 self::do_dump($value, $displayName, $indent . $do_dump_indent, $reference, $as_text);
             }
             if ($as_text) {
                 echo "{$indent}){$n}";
             } else {
                 echo "{$indent})<br>";
             }
         } elseif (is_object($avar)) {
             $class = get_class($avar);
             if ($as_text) {
                 echo "{$indent}{$var_name}<{$type}>[{$class}]{$n}{$indent}({$n}";
             } else {
                 echo "{$indent}{$var_name} <span style='color:{$type_color}'>{$type} [{$class}]</span><br>{$indent}(<br>";
             }
             if ($avar instanceof Exception) {
                 $code = $avar->getCode();
                 $message = addslashes($avar->getMessage());
                 echo "{$indent}{$do_dump_indent}" . "code: {$code}, message: \"{$message}\"";
                 if ($avar instanceof Q_Exception) {
                     echo " inputFields: " . implode(', ', $avar->inputFields());
                 }
                 echo $as_text ? $n : "<br />";
             }
             if (class_exists('Q_Tree') and $avar instanceof Q_Tree) {
                 $getall = $avar->getAll();
                 self::do_dump($getall, "", $indent . $do_dump_indent, $reference, $as_text);
             } else {
                 if ($avar instanceof Q_Uri) {
                     $arr = $avar->toArray();
                     self::do_dump($arr, 'fields', $indent . $do_dump_indent, $reference, $as_text);
                     self::do_dump($route_pattern, 'route_pattern', $indent . $do_dump_indent, $reference, $as_text);
                 }
             }
             if ($avar instanceof Db_Row) {
                 foreach ($avar as $name => $value) {
                     $modified = $avar->wasModified($name) ? "<span style='color:blue'>*</span>:" : '';
                     self::do_dump($value, "{$name}{$modified}", $indent . $do_dump_indent, $reference, $as_text);
//.........这里部分代码省略.........
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:101,代码来源:Q.php

示例13: Q_form_tool

/**
 * This tool is meant to be wrapped in a <form> tag
 * @param {array} $options An associative array of parameters, containing:
 * @param {array} $options.fields an associative array of fieldname => fieldinfo pairs,
 *   where fieldinfo contains the following:
 *     "type" => the type of the field (@see Q_Html::smartTag())
 *     "attributes" => additional attributes for the field input
 *     "value" => the initial value of the field input
 *     "options" => options for the field input (if type is "select", "checkboxes" or "radios")
 *     "message" => initial message, if any to put in the field's message space
 *     "label" => the label for the field
 *     "extra" => if set, this is html to replace the first cell, displacing the label
 *     "placeholder" => if set, this is the placeholder text for the input
 *     "fillFromRequest" => Defaults to true.
 *       If true, uses $_REQUEST to fill any fields with same name.
 *       Currently doesn't work for names which specify arrays, such as a[b].
 * @param {string} [$options.onSubmit] Optional. Name of the javascript function or url to pass to Q.handle on submit
 * @param {string} [$options.onResponse] Name of the javascript function or url to pass to Q.handle on response
 * @param {string} [$options.onSuccess] Name of javascript function or url to pass to Q.handle on success
 * @param {string} [$options.loader] Optional. Name of a javascript function which takes (action, method, params, slots, callback) as arguments.
 *    It should call the callback and pass it an object with the response info. Can be used to implement caching, etc.
 *    instead of the default HTTP request.
 *    If "loader" is Q.getter and request should be done bypasing cache, assign true to .ignoreCache property of the tool
 * @param {array|string} [$options.slotsToRequest] Optional. A string or array of slot names to request in response. Should include "form".
 * @param {array|string} [$options.contentElements] Optional. Array of $slotName => $cssSelector pairs for child element of the form to fill with HTML returned from the slot.
 */
function Q_form_tool($options)
{
    if (empty($options['fields'])) {
        $options['fields'] = array();
    }
    if (!array_key_exists('fillFromRequest', $options)) {
        $options['fillFromRequest'] = true;
    }
    if (empty($options['contentElements'])) {
        $options['contentElements'] = array();
    }
    $field_defaults = array('type' => 'text', 'attributes' => array(), 'value' => null, 'options' => array(), 'message' => '', 'placeholder' => null);
    $tr_array = array();
    $messages_td = false;
    $colspan = '';
    foreach ($options['fields'] as $name => $field) {
        if (isset($field['message'])) {
            $messages_td = true;
            $colspan = "colspan='2'";
        }
    }
    foreach ($options['fields'] as $name => $field) {
        if (!is_array($field)) {
            $name2 = '"' . addslashes($name) . '"';
            throw new Q_Exception_WrongType(array('field' => "\$options[{$name2}]", 'type' => 'array'));
        }
        $field2 = array_merge($field_defaults, $field);
        $type = $field2['type'];
        if ($type === 'hidden') {
            continue;
        }
        $attributes = array('name' => $name, 'id' => $name);
        $value = $field2['value'];
        $o = $field2['options'];
        $message = $field2['message'];
        if (!empty($options['fillFromRequest']) and !in_array($type, array('button', 'submit'))) {
            if (isset($_REQUEST[$name])) {
                $value = $_REQUEST[$name];
            } else {
                if ($type === 'static' or $type === 'date') {
                    $parts = array($name . '_hour' => 0, $name . '_minute' => 0, $name . '_second' => 0, $name . '_month' => date('m'), $name . '_day' => date('d'), $name . '_year' => date('Y'));
                    $provided = Q::ifset($_REQUEST, array_keys($parts), null);
                    if (isset($provided)) {
                        $mktime = Q::take($_REQUEST, $parts);
                        $value = call_user_func_array('mktime', $mktime);
                    }
                }
            }
        }
        if (isset($field2['placeholder'])) {
            $attributes['placeholder'] = $field2['placeholder'];
        }
        if ($field2['attributes']) {
            $attributes = array_merge($attributes, $field2['attributes']);
        }
        if (ctype_alnum($type)) {
            if (isset($attributes['class'])) {
                if (is_array($attributes['class'])) {
                    foreach ($attributes['class'] as $k => $v) {
                        $attributes['class'][$k] .= " {$type}";
                    }
                } else {
                    $attributes['class'] .= " {$type}";
                }
            } else {
                $attributes['class'] = " {$type}";
            }
        }
        $label = isset($field['label']) ? $field['label'] : Q_Html::text($name);
        $label = Q_Html::tag('label', array('for' => $attributes['id']), $label);
        $name_text = Q_Html::text($name);
        $extra = isset($field['extra']) ? $field['extra'] : null;
        switch ($type) {
            case 'textarea':
//.........这里部分代码省略.........
开发者ID:dmitriz,项目名称:Platform,代码行数:101,代码来源:tool.php

示例14: Q_exception_native

function Q_exception_native($params)
{
    extract($params);
    /**
     * @var Exception $exception 
     */
    if ($is_ajax = Q_Request::isAjax()) {
        $json = @Q::json_encode(array('errors' => Q_Exception::toArray(array($exception))));
        $callback = Q_Request::callback();
        switch (strtolower($is_ajax)) {
            case 'iframe':
                // Render an HTML layout for ajax
                if (!Q_Response::$batch) {
                    header("Content-type: text/html");
                }
                echo <<<EOT
<!doctype html><html lang=en>
<head><meta charset=utf-8><title>Q Result</title></head>
<body>
<script type="text/javascript">
window.result = function () { return {$json} };
</script>
</body>
</html>
EOT;
                break;
            case 'json':
                // Render a JSON layout for ajax
            // Render a JSON layout for ajax
            default:
                header("Content-type: " . ($callback ? "application/javascript" : "application/json"));
                echo $callback ? "{$callback}({$json})" : $json;
        }
    } else {
        if (Q::textMode()) {
            echo Q_Exception::coloredString($exception);
            exit;
        }
        $message = $exception->getMessage();
        $file = $exception->getFile();
        $line = $exception->getLine();
        if (is_callable(array($exception, 'getTraceAsStringEx'))) {
            $trace_string = $exception->getTraceAsStringEx();
        } else {
            $trace_string = $exception->getTraceAsString();
        }
        if ($exception instanceof Q_Exception_PhpError or !empty($exception->messageIsHtml)) {
            // do not sanitize $message
        } else {
            $message = Q_Html::text($message);
        }
        $content = "<h1 class='exception_message'>{$message}</h1>";
        if (Q_Config::get('Q', 'exception', 'showFileAndLine', true)) {
            $content .= "<h3 class='exception_fileAndLine'>in {$file} ({$line})</h3>";
        }
        if (Q_Config::get('Q', 'exception', 'showTrace', true)) {
            $content .= "<pre class='exception_trace'>{$trace_string}</pre>";
        }
        $content .= str_repeat(' ', 512);
        // because of chrome
        $title = "Exception occurred";
        $dashboard = "";
        echo Q::view('Q/layout/html.php', compact('content', 'dashboard', 'title'));
    }
    $app = Q_Config::get('Q', 'app', null);
    $colored = Q_Exception::coloredString($exception);
    Q::log("{$app}: Exception in " . ceil(Q::milliseconds()) . "ms:\n\n{$colored}\n", null, true, array('maxLength' => 10000));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:68,代码来源:native.php

示例15:

<p>
	Hey <?php 
echo Q_Html::text($user->displayName(array('short' => true)));
?>
,
	this is just a quick confirmation that you've successfully paid
	<?php 
Q_Html::text("{$symbol}{$amount}");
?>
 to
	<?php 
echo Q_Html::a(Q_Request::baseUrl(), Q_Html::text($publisher->displayName()));
?>
	for <?php 
echo Q_Html::text($description);
?>
.
</p>
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:18,代码来源:charged.php


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