本文整理汇总了PHP中Horde::wrapInlineScript方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::wrapInlineScript方法的具体用法?PHP Horde::wrapInlineScript怎么用?PHP Horde::wrapInlineScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde
的用法示例。
在下文中一共展示了Horde::wrapInlineScript方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init
/**
*/
protected function _init()
{
global $injector, $notification, $page_output, $registry;
if (!$registry->hasMethod('images/selectGalleries') || !$registry->hasMethod('images/saveImage')) {
$e = new IMP_Exception('Image saving is not available.');
$e->logged = true;
throw $e;
}
/* Run through the action handlers. */
switch ($this->vars->actionID) {
case 'save_image':
$contents = $injector->getInstance('IMP_Factory_Contents')->create($this->indices);
if (!($mime_part = $contents->getMimePart($this->vars->id))) {
$notification->push(_("Could not load message."));
break;
}
$image_data = array('data' => $mime_part->getContents(), 'description' => $mime_part->getDescription(true), 'filename' => $mime_part->getName(true), 'type' => $mime_part->getType());
try {
$registry->images->saveImage($this->vars->gallery, $image_data);
} catch (Horde_Exception $e) {
$notification->push($e);
break;
}
echo Horde::wrapInlineScript(array('window.close();'));
exit;
}
/* Build the view. */
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/saveimage'));
$view->addHelper('Horde_Core_View_Helper_Image');
$view->addHelper('Text');
$view->action = self::url();
$view->gallerylist = $registry->images->selectGalleries(array('perm' => Horde_Perms::EDIT));
$view->id = $this->vars->id;
$view->muid = strval($this->indices);
$page_output->topbar = $page_output->sidebar = false;
$page_output->addInlineScript(array('$$("INPUT.horde-cancel").first().observe("click", function() { window.close(); })'), true);
$this->title = _("Save Image");
$this->output = $view->render('saveimage');
}
示例2: _init
/**
* @throws IMP_Exception
*/
protected function _init()
{
global $conf, $injector, $notification, $page_output;
if (!$this->indices) {
throw new IMP_Exception(_("No message index given."));
}
$page_output->addScriptFile('message-dimp.js');
$page_output->addScriptFile('textarearesize.js', 'horde');
$page_output->addScriptFile('toggle_quotes.js', 'horde');
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$js_vars = array();
switch ($this->vars->actionID) {
case 'strip_attachment':
try {
$this->indices = new IMP_Indices_Mailbox($this->indices->mailbox, $injector->getInstance('IMP_Message')->stripPart($this->indices, $this->vars->id));
$js_vars['-DimpMessage.strip'] = 1;
$notification->push(_("Attachment successfully stripped."), 'horde.success');
} catch (IMP_Exception $e) {
$notification->push($e);
}
break;
}
try {
$show_msg = new IMP_Ajax_Application_ShowMessage($this->indices);
$msg_res = $show_msg->showMessage(array('headers' => array_diff(array_keys($injector->getInstance('IMP_Message_Ui')->basicHeaders()), array('subject')), 'preview' => false));
} catch (IMP_Exception $e) {
$notification->notify(array('listeners' => array('status', 'audio')));
echo Horde::wrapInlineScript(array('parent.close()'));
exit;
}
$ajax_queue = $injector->getInstance('IMP_Ajax_Queue');
$ajax_queue->poll($this->indices->mailbox);
list(, $buid) = $this->indices->buids->getSingle();
foreach (array('from', 'to', 'cc', 'bcc', 'replyTo', 'log') as $val) {
if (!empty($msg_res[$val])) {
$js_vars['DimpMessage.' . $val] = $msg_res[$val];
}
}
if (!empty($msg_res['list_info']['exists'])) {
$js_vars['DimpMessage.reply_list'] = true;
$this->view->listinfo = Horde::popupJs(IMP_Basic_Listinfo::url(array('buid' => $buid, 'mailbox' => $this->indices->mailbox)), array('urlencode' => true));
}
$js_vars['DimpMessage.buid'] = $buid;
$js_vars['DimpMessage.mbox'] = $this->indices->mailbox->form_to;
$js_vars['DimpMessage.tasks'] = $injector->getInstance('Horde_Core_Factory_Ajax')->create('imp', $this->vars)->getTasks();
$page_output->addInlineJsVars($js_vars);
if (isset($msg_res['js'])) {
$page_output->addInlineScript(array_filter($msg_res['js']), true);
}
$this->_pages[] = 'message';
/* Determine if compose mode is disabled. */
if (IMP_Compose::canCompose()) {
$this->view->qreply = $injector->getInstance('IMP_Dynamic_Compose_Common')->compose($this, array('title' => _("Message") . ': ' . $msg_res['subject']));
$this->_pages[] = 'qreply';
$this->js_conf['qreply'] = 1;
}
$page_output->noDnsPrefetch();
$this->view->show_delete = $this->indices->mailbox->access_deletemsgs;
list($real_mbox, ) = $this->indices->getSingle();
$this->view->show_innocent = $real_mbox->innocent_show;
$this->view->show_spam = $real_mbox->spam_show;
$this->view->show_view_all = empty($msg_res['onepart']);
$this->view->show_view_source = !empty($conf['user']['allow_view_source']);
$this->view->save_as = $msg_res['save_as'];
$this->view->subject = isset($msg_res['subjectlink']) ? $msg_res['subjectlink'] : $msg_res['subject'];
$hdrs = array();
foreach ($msg_res['headers'] as $val) {
$hdrs[] = array_filter(array('id' => isset($val['id']) ? 'msgHeader' . $val['id'] : null, 'label' => $val['name'], 'val' => $val['value']));
}
$this->view->hdrs = $hdrs;
if (isset($msg_res['atc_label'])) {
$this->view->atc_label = $msg_res['atc_label'];
if (isset($msg_res['atc_list'])) {
$this->view->atc_list = $msg_res['atc_list'];
} else {
$this->view->atc_list = array();
}
if (isset($msg_res['atc_download'])) {
$this->view->atc_download = $msg_res['atc_download'];
}
} else {
$this->view->atc_list = array();
}
$this->view->msgtext = $msg_res['msgtext'];
Horde::startBuffer();
$notification->notify(array('listeners' => array('status', 'audio')));
$this->view->status = Horde::endBuffer();
$this->title = $msg_res['title'];
$this->view->title = $this->title;
}
示例3: Horde_Form
<?php
/**
* Copyright 2005-2015 Horde LLC (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (BSD). If you
* did not receive this file, see http://www.horde.org/licenses/bsdl.php.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @author Jan Schneider <jan@horde.org>
*/
require_once __DIR__ . '/lib/Application.php';
$hermes = Horde_Registry::appInit('hermes');
$vars = Horde_Variables::getDefaultVariables();
$form = new Horde_Form($vars, _("Stop Watch"));
$form->addVariable(_("Stop watch description"), 'description', 'text', true);
if ($form->validate($vars)) {
Hermes::newTimer($vars->get('description'));
echo Horde::wrapInlineScript(array('var t = ' . Horde_Serialize::serialize(sprintf(_("The stop watch \"%s\" has been started and will appear in the menu at the next refresh."), $vars->get('description')), Horde_Serialize::JSON) . ';', 'alert(t);', 'window.close();'));
exit;
}
$page_output->topbar = $page_output->sidebar = false;
$page_output->header(array('title' => _("Stop Watch")));
$form->renderActive(new Horde_Form_Renderer(), $vars, Horde::url('start.php'), 'post');
$page_output->footer();
示例4: key
<?php
/**
* Copyright 2002-2015 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('kronolith');
if (Kronolith::showAjaxView()) {
Horde::url('', true)->redirect();
}
if (!$GLOBALS['registry']->getAuth()) {
echo Horde::wrapInlineScript(array('window.close();'));
exit;
}
/* Get the lists of address books through API */
$source_list = $registry->call('contacts/sources');
/* If we self-submitted, use that source. Otherwise, choose a good
* source. */
$source = Horde_Util::getFormData('source');
if (empty($source) || !isset($source_list[$source])) {
/* We don't just pass the second argument to getFormData() because
* we want to trap for invalid sources, not just no source. */
$source = key($source_list);
}
/* Get the search as submitted (defaults to '' which should list everyone). */
$search = Horde_Util::getFormData('search');
if ($search || $prefs->getValue('display_contact')) {
$searchpref = Kronolith::getAddressbookSearchParams();
示例5: Horde_Date
if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
continue;
}
}
$newDate = new Horde_Date($vars->get('image_originalDate'));
$image->originalDate = (int) $newDate->timestamp();
$image->save();
++$count;
} catch (Ansel_Exception $e) {
$notification->push(sprintf(_("There was an error editing the dates: %s"), $e->getMessage()), 'horde.error');
echo Horde::wrapInlineScript(array('window.opener.location.href = window.opener.location.href;', 'window.close();'));
exit;
}
}
$notification->push(sprintf(_("Successfully modified the date on %d photos."), $count), 'horde.success');
echo Horde::wrapInlineScript(array('window.opener.location.href = window.opener.location.href;', 'window.close();'));
exit;
}
$keys = array_keys($images);
$html = '';
foreach ($keys as $key) {
$html .= '<img src="' . Ansel::getImageUrl($key, 'mini', false) . '" style="margin:2px;" alt="[thumbnail]" />';
}
$image = $GLOBALS['injector']->getInstance('Ansel_Storage')->getImage(array_pop($keys));
/* Display the form */
$vars->set('image', $images);
$vars->set('gallery', $gallery_id);
$vars->set('page', $page);
$vars->set('actionID', 'edit_dates');
$vars->set('image_list', $html);
$vars->set('image_originalDate', $image->originalDate);
示例6: _init
//.........这里部分代码省略.........
$redirect_dynamic = true;
$redirect_target = false;
switch ($this->vars->search_type) {
case 'filter':
$q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Mailbox::formFrom($this->vars->edit_query_filter), 'label' => $this->vars->search_label, 'type' => IMP_Search::CREATE_FILTER));
if ($this->vars->edit_query_filter) {
$notification->push(sprintf(_("Filter \"%s\" edited successfully."), $this->vars->search_label), 'horde.success');
$redirect_dynamic = false;
$redirect_target = 'prefs';
} else {
$notification->push(sprintf(_("Filter \"%s\" created succesfully."), $this->vars->search_label), 'horde.success');
}
break;
case 'vfolder':
$form = json_decode($this->vars->mboxes_form);
$q_ob = $imp_search->createQuery($c_list, array('id' => IMP_Mailbox::formFrom($this->vars->edit_query_vfolder), 'label' => $this->vars->search_label, 'mboxes' => IMP_Mailbox::formFrom($form->mbox), 'subfolders' => IMP_Mailbox::formFrom($form->subfolder), 'type' => IMP_Search::CREATE_VFOLDER));
if ($this->vars->edit_query_vfolder) {
$notification->push(sprintf(_("Virtual Folder \"%s\" edited successfully."), $this->vars->search_label), 'horde.success');
$redirect_target = 'prefs';
} else {
$notification->push(sprintf(_("Virtual Folder \"%s\" created succesfully."), $this->vars->search_label), 'horde.success');
$redirect_target = 'mailbox';
}
break;
default:
$form = json_decode($this->vars->mboxes_form);
$q_ob = $imp_search->createQuery($c_list, array('mboxes' => IMP_Mailbox::formFrom($form->mbox), 'subfolders' => IMP_Mailbox::formFrom($form->subfolder)));
$redirect_target = 'mailbox';
break;
}
/* Redirect to the mailbox page. */
if ($redirect_target) {
if ($dynamic_view && $redirect_dynamic) {
echo '<html><head>' . Horde::wrapInlineScript(array('window.parent.DimpBase.go("mbox", "' . $q_ob->mbox_ob->form_to . '")')) . '</head></html>';
exit;
}
switch ($redirect_target) {
case 'mailbox':
$q_ob->mbox_ob->url('mailbox')->redirect();
break;
case 'prefs':
$registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->redirect();
break;
}
exit;
}
}
/* Prepare the search view. */
$view = new Horde_View(array('templatePath' => IMP_TEMPLATES . '/search'));
$view->addHelper('Text');
$view->addHelper('Tag');
$view->addHelper('FormTag');
$view->action = self::url();
/* Determine if we are editing a search query. */
$q_ob = $default_mailbox->getSearchOb();
if ($this->vars->edit_query && $default_mailbox->search) {
if ($default_mailbox->vfolder) {
if (!$default_mailbox->editvfolder) {
$notification->push(_("Built-in Virtual Folders cannot be edited."), 'horde.error');
$registry->getServiceLink('prefs', 'imp')->add('group', 'searches')->redirect();
}
$view->edit_query = true;
$view->edit_query_vfolder = $default_mailbox->form_to;
} elseif ($imp_search->isFilter($q_ob)) {
if (!$imp_search->isFilter($q_ob, true)) {
$notification->push(_("Built-in Filters cannot be edited."), 'horde.error');
示例7: _reloadWindow
/**
* Reload the window.
*/
protected function _reloadWindow()
{
echo Horde::wrapInlineScript(array('opener.focus();' . 'opener.location.href="' . base64_decode($this->vars->reload) . '";', 'window.close();'));
exit;
}
示例8: outputInlineScript
/**
* Print pending inline javascript to the output buffer.
*
* @param boolean $raw Return the raw script (not wrapped in CDATA tags
* or observe wrappers)?
*/
public function outputInlineScript($raw = false)
{
if (empty($this->inlineScript)) {
return;
}
$script = array();
foreach ($this->inlineScript as $key => $val) {
$val = implode('', $val);
$script[] = !$raw && $key ? 'document.observe("dom:loaded",function(){' . $val . '});' : $val;
}
echo $raw ? implode('', $script) : Horde::wrapInlineScript($script);
$this->inlineScript = array();
}
示例9: addAttachmentCkeditor
/**
* AJAX action: Add an attachment to a compose message (from the ckeditor
* plugin).
*
* Variables used:
* - CKEditorFuncNum: (integer) CKEditor function identifier to call
* when returning URL data
* - composeCache: (string) The IMP_Compose cache identifier.
*
* @return Horde_Core_Ajax_Response_Raw text/html return containing
* javascript code to update the
* URL parameter in CKEditor.
*/
public function addAttachmentCkeditor()
{
global $injector;
$data = $url = null;
if (isset($this->vars->composeCache)) {
$imp_compose = $injector->getInstance('IMP_Factory_Compose')->create($this->vars->composeCache);
if ($imp_compose->canUploadAttachment()) {
try {
$atc_ob = $imp_compose->addAttachmentFromUpload('upload');
if ($atc_ob[0] instanceof IMP_Compose_Exception) {
throw $atc_ob[0];
}
$atc_ob[0]->related = true;
$data = array(IMP_Compose::RELATED_ATTR => 'src;' . $atc_ob[0]->id);
$url = strval($atc_ob[0]->viewUrl());
} catch (IMP_Compose_Exception $e) {
$data = $e->getMessage();
}
} else {
$data = _("Uploading attachments has been disabled on this server.");
}
} else {
$data = _("Your attachment was not uploaded. Most likely, the file exceeded the maximum size allowed by the server configuration.");
}
return new Horde_Core_Ajax_Response_Raw('<html>' . Horde::wrapInlineScript(array('window.parent.CKEDITOR.tools.callFunction(' . $this->vars->CKEditorFuncNum . ',' . json_encode($url) . ',' . json_encode($data) . ')')) . '</html>', 'text/html');
}
示例10: _init
/**
* @throws IMP_Exception
*/
protected function _init()
{
global $injector, $notification, $page_output;
if (!$this->indices) {
throw new IMP_Exception(_("No message index given."));
}
$page_output->addScriptFile('message.js');
$page_output->addScriptFile('external/CustomElements.js');
$page_output->addScriptFile('external/time-elements.js');
$page_output->addScriptFile('textarearesize.js', 'horde');
$page_output->addScriptFile('toggle_quotes.js', 'horde');
$page_output->addScriptPackage('IMP_Script_Package_Imp');
$page_output->addThemeStylesheet('message.css');
$page_output->addThemeStylesheet('message_view.css');
$js_vars = array();
switch ($this->vars->actionID) {
case 'strip_attachment':
try {
$this->indices = new IMP_Indices_Mailbox($this->indices->mailbox, $this->indices->stripPart($this->vars->id));
$js_vars['-ImpMessage.strip'] = 1;
$notification->push(_("Attachment successfully stripped."), 'horde.success');
} catch (IMP_Exception $e) {
$notification->push($e);
}
break;
}
try {
$show_msg = new IMP_Contents_Message($this->indices);
$msg_res = $show_msg->showMessage();
} catch (IMP_Exception $e) {
$notification->notify(array('listeners' => array('status', 'audio')));
echo Horde::wrapInlineScript(array('parent.close()'));
exit;
}
/* Add 'maillog' and 'poll' data to the AJAX queue. */
$ajax_queue = $injector->getInstance('IMP_Ajax_Queue');
$ajax_queue->maillog($this->indices);
$ajax_queue->poll($this->indices->mailbox);
list(, $buid) = $this->indices->buids->getSingle();
/* Need to be dynamically added, since formatting needs to be applied
* via javascript. */
foreach (array('from', 'to', 'cc', 'bcc') as $val) {
if ($tmp = $show_msg->getAddressHeader($val)) {
$js_vars['ImpMessage.' . $val] = $tmp;
}
}
if ($resent = $show_msg->getResentData()) {
$resent_js = array();
foreach ($resent as $val) {
$resent_js[] = array('date' => $val['date']->format($val['date']::DATE_LOCAL), 'from' => $show_msg->getAddressHeader($val['from']));
}
$js_vars['ImpMessage.resent'] = $resent_js;
}
if (isset($msg_res['log'])) {
$js_vars['ImpMessage.log'] = $msg_res['log'];
}
$list_info = $show_msg->contents->getListInformation();
if (!empty($list_info['exists'])) {
$js_vars['ImpMessage.reply_list'] = true;
$this->view->listinfo = Horde::popupJs(IMP_Basic_Listinfo::url(array('buid' => $buid, 'mailbox' => $this->indices->mailbox)), array('urlencode' => true));
}
$js_vars['ImpMessage.buid'] = $buid;
$js_vars['ImpMessage.mbox'] = $this->indices->mailbox->form_to;
if (isset($msg_res['atc'])) {
$js_vars['ImpMessage.msg_atc'] = $msg_res['atc'];
$this->js_text['atc_downloadall'] = _("Download All (%s)");
}
if (isset($msg_res['md'])) {
$js_vars['ImpMessage.msg_md'] = $msg_res['md'];
}
$js_vars['ImpMessage.tasks'] = $injector->getInstance('Horde_Core_Factory_Ajax')->create('imp', $this->vars)->getTasks();
$page_output->addInlineJsVars($js_vars);
if (isset($msg_res['js'])) {
$page_output->addInlineScript(array_filter($msg_res['js']), true);
}
$this->_pages[] = 'message';
$subject = $show_msg->getSubject();
$this->view->subject = isset($subject['subjectlink']) ? $subject['subjectlink'] : $subject['subject'];
$this->title = $subject['title'];
/* Determine if compose mode is disabled. */
if (IMP_Compose::canCompose()) {
$this->view->qreply = $injector->getInstance('IMP_Dynamic_Compose_Common')->compose($this, array('title' => _("Message") . ': ' . $subject['subject']));
$this->_pages[] = 'qreply';
$this->js_conf['qreply'] = 1;
}
$page_output->noDnsPrefetch();
$this->view->show_delete = $this->indices->mailbox->access_deletemsgs;
list($real_mbox, ) = $this->indices->getSingle();
$this->view->show_innocent = $real_mbox->innocent_show;
$this->view->show_spam = $real_mbox->spam_show;
$this->view->show_view_all = empty($msg_res['onepart']);
$this->view->show_view_source = $injector->getInstance('Horde_Core_Perms')->hasAppPermission('view_msg_source');
$this->view->save_as = $show_msg->getSaveAs();
if ($date = $show_msg->getDateOb()) {
$this->view->datestamp = $date->format($date::DATE_ISO_8601);
$this->view->fulldate = $date->format($date::DATE_FORCE);
$this->view->localdate = $date->format($date::DATE_LOCAL);
//.........这里部分代码省略.........
示例11: _init
//.........这里部分代码省略.........
case 'forward_both':
$fwd_map = array('forward_attach' => IMP_Compose::FORWARD_ATTACH, 'forward_auto' => IMP_Compose::FORWARD_AUTO, 'forward_body' => IMP_Compose::FORWARD_BODY, 'forward_both' => IMP_Compose::FORWARD_BOTH);
try {
$fwd_msg = $imp_compose->forwardMessage($fwd_map[$this->vars->actionID], $this->_getContents());
} catch (IMP_Exception $e) {
$notification->push($e, 'horde.error');
break;
}
$msg = $fwd_msg['body'];
$header = $this->_convertToHeader($fwd_msg);
$format = $fwd_msg['format'];
$rtemode = $rtemode || !is_null($rtemode) && $format == 'html';
$this->title = $fwd_msg['title'];
break;
case 'redirect_compose':
try {
$imp_compose->redirectMessage($this->indices);
$redirect = true;
$this->title = ngettext("Redirect", "Redirect Messages", count($this->indices));
} catch (IMP_Compose_Exception $e) {
$notification->push($e, 'horde.error');
}
break;
case 'redirect_send':
try {
$num_msgs = $imp_compose->sendRedirectMessage($this->vars->to);
$imp_compose->destroy('send');
if ($isPopup) {
if ($prefs->getValue('compose_confirm')) {
$notification->push(ngettext("Message redirected successfully.", "Messages redirected successfully", count($num_msgs)), 'horde.success');
$this->_popupSuccess();
return;
}
echo Horde::wrapInlineScript(array('window.close();'));
} else {
$notification->push(ngettext("Message redirected successfully.", "Messages redirected successfully", count($num_msgs)), 'horde.success');
$this->_mailboxReturnUrl()->redirect();
}
exit;
} catch (Horde_Exception $e) {
$notification->push($e);
$this->vars->actionID = 'redirect_compose';
}
break;
case 'auto_save_draft':
case 'save_draft':
case 'save_template':
case 'send_message':
// Drafts readonly is handled below.
if ($compose_disable && $this->vars->actionID == 'send_message') {
break;
}
try {
$header['from'] = strval($identity->getFromLine(null, $this->vars->from));
} catch (Horde_Exception $e) {
$header['from'] = '';
$notification->push($e);
break;
}
$header['to'] = $this->vars->to;
$header['cc'] = $this->vars->cc;
$header['bcc'] = $this->vars->bcc;
$header['subject'] = strval($this->vars->subject);
$message = strval($this->vars->message);
/* Save the draft. */
switch ($this->vars->actionID) {