本文整理汇总了PHP中Event::data方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::data方法的具体用法?PHP Event::data怎么用?PHP Event::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _add_layer
public function _add_layer()
{
$this->layers = Event::$data;
$this->layers = $this->_create_layer();
// Return layers object with new Cloudmade Layer
Event::$data = $this->layers;
}
示例2: _make_clickable
/**
* Put clickable links into description
*/
public function _make_clickable()
{
// Access the report description
$report_description = Event::$data;
$report_description = $this->_convert_to_clickable($report_description);
// Return new description
Event::$data = $report_description;
}
示例3: _embed_youtube
public function _embed_youtube()
{
// Access the report description
$report_description = Event::$data;
$report_description = $this->_auto_embed($report_description);
// Return new description
Event::$data = $report_description;
}
示例4: render
public static function render($print = false)
{
Benchmark::start(self::$benchmark_name);
$template = new View('toolbar');
if (Kohana::config('debug_toolbar.panels.database')) {
$template->set('queries', self::queries());
}
if (Kohana::config('debug_toolbar.panels.logs')) {
$template->set('logs', self::logs());
}
if (Kohana::config('debug_toolbar.panels.vars_and_config')) {
$template->set('configs', self::configs());
}
if (Kohana::config('debug_toolbar.panels.files')) {
$template->set('files', self::files());
}
if (Kohana::config('debug_toolbar.firephp_enabled')) {
self::firephp();
}
switch (Kohana::config('debug_toolbar.align')) {
case 'right':
case 'center':
case 'left':
$template->set('align', Kohana::config('debug_toolbar.align'));
break;
default:
$template->set('align', 'left');
}
$template->set('scripts', file_get_contents(Kohana::find_file('views', 'toolbar', true, 'js')));
Benchmark::stop(self::$benchmark_name);
if (Kohana::config('debug_toolbar.panels.benchmarks')) {
$template->set('benchmarks', self::benchmarks());
}
if (Event::$data) {
if (Kohana::config('debug_toolbar.auto_render') or Kohana::config('debug_toolbar.secret_key') !== FALSE and isset($_GET[Kohana::config('debug_toolbar.secret_key')])) {
// try to add css to <head>, otherwise, send to template
$styles = file_get_contents(Kohana::find_file('views', 'toolbar', false, 'css'));
if (stripos(Event::$data, '</head>') !== FALSE) {
Event::$data = str_ireplace('</head>', $styles . '</head>', Event::$data);
} else {
$template->set('styles', $styles);
}
// try to add js and HTML just before the </body> tag,
// otherwise just append it to the output
if (stripos(Event::$data, '</body>') !== FALSE) {
Event::$data = str_ireplace('</body>', $template->render() . '</body>', Event::$data);
} else {
Event::$data .= $template->render();
}
}
} else {
if ($print) {
$template->render(TRUE);
} else {
return $template->render();
}
}
}
示例5: viewSetup
protected function viewSetup()
{
$this->subview = new View('media/update');
$this->subview->tab = 'main';
$this->subview->section = 'general';
$data = Event::$data;
Event::run('bluebox.media.widget');
Event::$data = $data;
if (self::$components) {
$this->subview->set('components', self::$components);
return TRUE;
}
return FALSE;
}
示例6: webgrind_redirect
/**
* Appends a javascript redirect if to webgrind if XDEBUG_PROFILE is present.
*/
public function webgrind_redirect()
{
// check for XDEBUG_PROFILE
if (strpos(Router::$query_string, 'XDEBUG_PROFILE')) {
$js = self::js_new_window();
// check for body tag and insert js after that or if no body tag
// then prepend it to view data.
if ($pos = stripos(Event::$data, '<body>')) {
$replace = substr(Event::$data, $pos, 6) . $js;
Event::$data = substr_replace(Event::$data, $replace, $pos, 6);
} else {
Event::$data = $js . Event::$data;
}
}
}
示例7: _callListener
protected function _callListener(callable $listener, Event $event)
{
$data = $event->data();
$length = count($data);
if ($length) {
$data = array_values($data);
}
switch ($length) {
case 0:
return $listener($event);
case 1:
return $listener($event, $data[0]);
case 2:
return $listener($event, $data[0], $data[1]);
case 3:
return $listener($event, $data[0], $data[1], $data[2]);
default:
array_unshift($data, $event);
return call_user_func_array($listener, $data);
}
}
示例8: _add_ivr_comment_filter
/**
* This bit makes the reports::fetch_incidents() filter by IVR comments
*/
public function _add_ivr_comment_filter()
{
$params = $this->get_get_params();
if ($params['time'] != 'N/A') {
$filter_params = Event::$data;
//get the table prefix
$table_prefix = Kohana::config('database.default.table_prefix');
$sql = 'i.id IN (SELECT DISTINCT data.incident_id FROM ' . $table_prefix . 'ivrapi_data AS data ';
$sql .= 'LEFT JOIN ' . $table_prefix . 'ivrapi_data_comments AS comments ON comments.ivr_data_id = data.id ';
//don't bother if we don't care about time
if ($params['time'] != '2') {
$sql .= 'LEFT JOIN ' . $table_prefix . 'incident_category AS ic ON ic.incident_id = data.incident_id ';
}
//get the operator
$operator = $params['operator'];
//create the where text
$i = 0;
foreach ($params['conditions'] as $key) {
//skip this
if ($key == 'undefined') {
continue;
}
$i++;
if ($i == 1) {
$sql .= ' WHERE ';
}
if ($i > 1) {
$sql .= $operator;
}
$sql .= $this->condition_mapping[$key] . ' = 1 ';
}
//deal with the time component
$sql .= $this->time_mapping[$params['time']];
$sql .= ' ) ';
array_push($filter_params, $sql);
Event::$data = $filter_params;
}
}
示例9: test
public function test()
{
Event::$data = Event::$data . '<!-- Powered by Kohana-->';
}
示例10: test_filter
function test_filter()
{
$trace = debug_backtrace();
$event = $trace[2]['args'][0];
Event::$data = $event . Event::$data;
}
示例11: trigger
/**
* Ejecuta los handlers asociados al evento
*
* @param string $event evento
* @param array $args argumentos
* @return mixed
*/
public static function trigger($event, $args = array())
{
$value = false;
if (isset(self::$_events[$event])) {
foreach (self::$_events[$event] as $handler) {
$value = call_user_func_array($handler, $args);
}
}
self::$data = null;
return $value;
}
示例12: _add_incident_filter
/**
* This method will add in some Density Map specific filtering
*/
public function _add_incident_filter()
{
//We're going to assume that the big map plugin will handle the AND / OR / Simple Groups stuff
//check for the "dm" get parameter
if (isset($_GET['dm']) and !is_array($_GET['dm']) and intval($_GET['dm']) >= 0) {
//get the table prefix
$table_prefix = Kohana::config('database.default.table_prefix');
//get the params
$cat_id = intval($_GET['dm']);
$params = Event::$data;
array_push($params, 'i.id IN (SELECT DISTINCT incident_id FROM ' . $table_prefix . 'incident_category WHERE category_id = ' . $cat_id . ')');
Event::$data = $params;
}
}
示例13: run
/**
* Runs an event.
* @param string $name
* @param null $data
* @return void
*/
public static function run($name, $data = null)
{
if (!empty(self::$_events[$name])) {
self::$data = $data;
$callbacks = self::get($name);
foreach ($callbacks as $callback) {
call_user_func($callback);
}
$clear_data = '';
self::$data =& $clear_data;
}
// Mark event as running
self::$_has_run[$name] = $name;
}
示例14: render
/**
* Renders the Debug Toolbar
*
* @param bool print rendered output
* @return string debug toolbar rendered output
*/
public static function render($print = false)
{
Benchmark::start(self::$benchmark_name);
$template = new View('toolbar');
// Database panel
if (Kohana::config('debug_toolbar.panels.database') === TRUE) {
$template->set('queries', self::get_queries());
}
// Logs panel
if (Kohana::config('debug_toolbar.panels.logs') === TRUE) {
$template->set('logs', self::get_logs());
}
// Vars and Config panel
if (Kohana::config('debug_toolbar.panels.vars_and_config') === TRUE) {
$template->set('configs', self::get_configs());
}
// Files panel
if (Kohana::config('debug_toolbar.panels.files') === TRUE) {
$template->set('files', self::get_files());
}
// FirePHP
if (Kohana::config('debug_toolbar.firephp_enabled') === TRUE) {
self::firephp();
}
// Set alignment for toolbar
switch (Kohana::config('debug_toolbar.align')) {
case 'right':
case 'center':
case 'left':
$template->set('align', Kohana::config('debug_toolbar.align'));
break;
default:
$template->set('align', 'left');
}
// Javascript for toolbar
$template->set('scripts', file_get_contents(Kohana::find_file('views', 'toolbar', TRUE, 'js')));
// CSS for toolbar
$styles = file_get_contents(Kohana::find_file('views', 'toolbar', FALSE, 'css'));
Benchmark::stop(self::$benchmark_name);
// Benchmarks panel
if (Kohana::config('debug_toolbar.panels.benchmarks') === TRUE) {
$template->set('benchmarks', self::get_benchmarks());
}
if (Event::$data and self::is_enabled()) {
// Try to add css just before the </head> tag
if (stripos(Event::$data, '</head>') !== FALSE) {
Event::$data = str_ireplace('</head>', $styles . '</head>', Event::$data);
} else {
// No </head> tag found, append styles to output
$template->set('styles', $styles);
}
// Try to add js and HTML just before the </body> tag
if (stripos(Event::$data, '</body>') !== FALSE) {
Event::$data = str_ireplace('</body>', $template->render() . '</body>', Event::$data);
} else {
// Closing <body> tag not found, just append toolbar to output
Event::$data .= $template->render();
}
} else {
$template->set('styles', $styles);
return $template->render($print);
}
}
示例15: add_jquery
public function add_jquery()
{
$current_url = url::site(url::current());
$script = <<<EOT
<script type="text/javascript">
\$(document).ready(function(){\t
\tvar elements = \$('input:not(:hidden, :submit, #captcha, [class*=no_ajax]), textarea:not(.no_ajax), select:not(.no_ajax)');
\t
\t// add a span element to all inputs for the ajax messages
\t
\t\$(\$('<span class="{$this->message_class}"></span>')).insertAfter(elements);
\t\t\t\t\t\t
\t// on change event, validate element using current url & element's name / value
\t\$(elements).change(function(){
\t\t
\t\tvar element = \$(this);
\t\t// add a loading class to the element, and remove it after ajax call
\t\telement.addClass('loading').ajaxStop(function(){
\t\t\telement.removeClass('loading');
\t\t});
\t\t
\t\t\$(this).parents('form').ajaxSubmit({
\t\t\turl: '{$current_url}?element='+element.attr('name'),
\t\t\tsuccess: function(data){
\t\t\t\t
\t\t\t\tdata = jQuery.trim(data);
\t\t\t\tvar message = element.next('span.{$this->message_class}');
\t\t\t\t// if an error message is present, remove it
\t\t\t\t\$('span[class*=error]',element.parents('p')).not(message).remove();
\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\t\t\t\tif(data) // if error
\t\t\t\t{
\t\t\t\t\tmessage.text(data)
\t\t\t\t\t\t.removeClass()
\t\t\t\t\t\t.addClass('{$this->message_class} {$this->error_class}');
\t\t\t\t}
\t\t\t\telse // if valid
\t\t\t\t{
\t\t\t\t\tmessage.text('{$this->valid_message}')
\t\t\t\t\t\t.removeClass()
\t\t\t\t\t\t.addClass('{$this->message_class} {$this->valid_class}');
\t\t\t\t}
\t\t\t\t
\t\t\t}
\t\t});
\t});
\t
\t// on blur event, validate all required elements that are empty
\t\$('form .required').blur(function(){
\t\t
\t\tif(\$(this).val() == '')
\t\t{
\t\t\t\$(this).change();
\t\t}
\t});
});
</script>
EOT;
Event::$data = str_replace("</body>", $script . " </body>", Event::$data);
}