本文整理汇总了PHP中use_helper函数的典型用法代码示例。如果您正苦于以下问题:PHP use_helper函数的具体用法?PHP use_helper怎么用?PHP use_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了use_helper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show_georef_map
function show_georef_map($lon, $lat, $layer)
{
$lang = sfContext::getInstance()->getUser()->getCulture();
if (empty($layer)) {
$layer = sfContext::getInstance()->getModuleName();
}
$html = '<div class="section" id="georef_container" style="display:none;">';
$html .= '<div id="map" style="height:400px;width:100%">';
$html .= '<div id="mapLoading">' . image_tag(sfConfig::get('app_static_url') . '/static/images/indicator.gif');
$html .= __('Map is loading...') . '</div>';
$html .= '</div>';
$html .= '</div>';
$async_map = sfConfig::get('app_async_map', false) && !sfContext::getInstance()->getRequest()->getParameter('debug', false);
$js = "\n C2C.map_init = function() {\n Ext.get('georef_container').show();\n var lon = Ext.getDom('lon') && Ext.getDom('lon').value || 0;\n var lat = Ext.getDom('lat') && Ext.getDom('lat').value || 0;\n c2corg.Map({\n div: 'map',\n lang: '{$lang}',\n loading: 'mapLoading',\n layers: ['{$layer}'],\n connected: true,\n georef: {\n initialState: {\n lon: lon,\n lat: lat,\n zoom: 15\n },\n callback: function(lonlat) {\n if (lonlat) {\n Ext.getDom('lon').value = Math.round(lonlat.lon*1E6)/1E6;\n Ext.getDom('lat').value = Math.round(lonlat.lat*1E6)/1E6;\n } else {\n Ext.getDom('lon').value = '';\n Ext.getDom('lat').value = '';\n }\n c2corg.coords.update_degminsec('lon');\n c2corg.coords.update_degminsec('lat');\n }\n }\n });\n };";
// asynchronous map loading
if ($async_map) {
use_helper('MyMinify');
$c2c_script_url = minify_get_combined_files_url(array('/static/js/carto/build/carto.min.js', "/static/js/carto/build/lang-{$lang}.min.js", '/static/js/popup.js', '/static/js/carto/embedded.js'), (bool) sfConfig::get('app_minify_debug'));
$js .= "C2C.async_map_init = function() {\n \$.ajax({\n url: '{$c2c_script_url}',\n dataType: 'script',\n cache: true\n }).done(function() {\n C2C.map_init();\n Ext.EventManager.fireDocReady();\n });\n };";
}
// if coordinates not set, open automatically open the map
if (!$lon && !$lat && !in_array($layer, array('sites', 'users', 'images', 'portals'))) {
if ($async_map) {
$js .= "C2C.async_map_init()";
} else {
$js .= "\$(window).load(C2C.map_init)";
}
}
$html .= javascript_queue($js);
return $html;
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:OamMapHelper.php
示例2: _save
/**
* Saves the settings.
*/
private final function _save()
{
$data = $_POST['setting'];
// CSRF checks
if (isset($_POST['csrf_token'])) {
$csrf_token = $_POST['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL . 'setting')) {
Flash::set('error', __('Invalid CSRF token found!'));
Observer::notify('csrf_token_invalid', AuthUser::getUserName());
redirect(get_url('setting'));
}
} else {
Flash::set('error', __('No CSRF token found!'));
Observer::notify('csrf_token_not_found', AuthUser::getUserName());
redirect(get_url('setting'));
}
if (!isset($data['allow_html_title'])) {
$data['allow_html_title'] = 'off';
}
use_helper('Kses');
$allowed = array('img' => array('src' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
$data['admin_title'] = kses(trim($data['admin_title']), $allowed);
Setting::saveFromData($data);
Flash::set('success', __('Settings have been saved!'));
redirect(get_url('setting'));
}
开发者ID:sindotnet,项目名称:cona,代码行数:29,代码来源:SettingController.php
示例3: update_event
public function update_event()
{
if (!isset($_POST['save'])) {
Flash::set('error', __('Could not update this event!'));
} else {
use_helper('Kses');
/* Prepare the data */
$data = $_POST['event'];
if (isset($data['id'])) {
$data['id'] = kses(trim($data['id']), array());
}
$event = new CalendarEvent();
if (isset($data['id'])) {
$event->id = $data['id'];
$event->created_by_id = $data['created_by_id'];
}
$event->title = $data['title'];
$event->date_from = $data['date_from'];
$event->date_to = $data['date_to'];
$event->description = $data['description'];
/* Check data and, if correct, save to DB */
if ($event->checkData() && $event->save()) {
if (isset($data['id'])) {
Flash::set('success', __('The event has been updated.'));
} else {
Flash::set('success', __('A new event has been created.'));
}
redirect(get_url('plugin/calendar/events'));
} else {
Flash::setNow('error', __('There are errors in the form.'));
$this->display(CALENDAR_VIEWS . '/update', array('event' => $event));
}
}
}
开发者ID:hoglaeser,项目名称:wolfcms-calendar-plugin,代码行数:34,代码来源:CalendarController.php
示例4: file_link_to_add
function file_link_to_add($entity, $entity_id, $options = array())
{
// Convert options string to option array
if (is_string($options)) {
$options = _convert_string_option($options);
}
$label = 'Add file';
// CUSTOMIZE LABEL TEXT
if (isset($options['label'])) {
$label = $options['label'];
}
// ICON
if (isset($options['icon']) && $options['icon'] == 'true') {
use_helper('sfIcon');
$label = icon_tag('folder_add') . ' ' . $label;
}
$url = "files/create?entity={$entity}&entity_id={$entity_id}";
// swicth link to with or without modalBox
if (isset($options['modalbox']) && $options['modalbox'] == 'true') {
use_helper('ModalBox');
return m_link_to($label, $url);
} else {
return link_to($label, $url);
}
}
开发者ID:sgrove,项目名称:cothinker,代码行数:25,代码来源:sfFileGalleryHelper.php
示例5: stop_remote_pager
function stop_remote_pager()
{
use_helper('Javascript');
// until prototype implements a stop() method for the PeriodicalExecuter,
// the following (almost a hack) is the only simple way to stop it
return javascript_tag("pager_watch.callback = function () {};");
}
开发者ID:kotow,项目名称:work,代码行数:7,代码来源:PagerHelper.php
示例6: tab_tag
function tab_tag($tab_name, $active_link, $active_tab, $url, $tab_class, $commCount = 0, $forum_link = false)
{
$tab_title = __($tab_name . '_tab_help');
$tab_text = __(ucfirst($tab_name));
if ($commCount) {
$tab_text = '<span class="reduced">' . $commCount . '</span>' . '<span>' . $tab_text . ' (' . $commCount . ')' . '</span>';
} else {
$tab_text = '<span>' . $tab_text . '</span>';
}
if ($forum_link) {
if ($active_link) {
use_helper('Forum');
$link = f_link_to($tab_text, $url, array('class' => $tab_class, 'title' => $tab_title));
} else {
$link = '<div class="' . $tab_class . '" title="' . $tab_title . '">' . $tab_text . '</div>';
}
} else {
$options_array = array('class' => $tab_class, 'title' => $tab_title);
if (!$active_link) {
$options_array['tag'] = 'div';
}
$link = link_to_if($active_link, $tab_text, $url, $options_array);
}
return '<li' . setActiveIf($tab_name, $active_tab) . '>' . $link . '</li>';
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:25,代码来源:WikiTabsHelper.php
示例7: input_asset_tag
function input_asset_tag($name, $value, $options = array())
{
use_helper('Javascript', 'I18N');
$type = 'all';
if (isset($options['images_only'])) {
$type = 'image';
unset($options['images_only']);
}
$form_name = 'this.previousSibling.previousSibling.form.name';
if (isset($options['form_name'])) {
$form_name = '\'' . $options['form_name'] . '\'';
unset($options['form_name']);
}
$html = '';
if (is_file(sfConfig::get('sf_web_dir') . $value)) {
$ext = substr($value, strpos($value, '.') - strlen($value) + 1);
if (in_array($ext, array('png', 'jpg', 'gif'))) {
$image_path = $value;
} else {
if (!is_file(sfConfig::get('sf_plugins_dir') . '/sfMediaLibraryPlugin/web/images/' . $ext . '.png')) {
$ext = 'unknown';
}
$image_path = '/sfMediaLibraryPlugin/images/' . $ext;
}
$html .= link_to_function(image_tag($image_path, array('alt' => 'File', 'height' => '64')), "window.open('{$value}')");
$html .= '<br />';
}
$html .= input_tag($name, $value, $options);
$html .= ' ' . image_tag('/sfMediaLibraryPlugin/images/folder_open', array('alt' => __('Insert Image'), 'style' => 'cursor: pointer; vertical-align: middle', 'onclick' => 'sfMediaLibrary.openWindow({ form_name: ' . $form_name . ', field_name: \'' . $name . '\', type: \'' . $type . '\', scrollbars: \'yes\' })'));
$html .= init_media_library();
return $html;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:32,代码来源:sfMediaLibraryHelper.php
示例8: _get_sympal_content_slot
/**
* Include a content slot in your template.
*
* This replaces get_sympal_content_slot() and is intended to be easier
* to use. This also taps into the app.yml config for its options
*
* @param string $name The name of the slot
* @param array $options An array of options for this slot
*
* Available options include
* * content An sfSympalContent instance to render the slot for
* * type The rendering type to use for this slot (e.g. Markdown)
* * default_value A default value to give this slot the first time it's created
* * edit_mode How to edit this slot (popup (default), inline)
*/
function _get_sympal_content_slot($name, $options = array())
{
if (isset($options['content'])) {
$content = $options['content'];
unset($options['content']);
} else {
$content = sfSympalContext::getInstance()->getCurrentContent();
}
// mark this content record as having content slots
$content->setEditableSlotsExistOnPage(true);
// merge the default config for this slot into the given config
$slotOptions = sfSympalConfig::get($content->Type->slug, 'content_slots', array());
if (isset($slotOptions[$name])) {
$options = array_merge($slotOptions[$name], $options);
}
// retrieve the slot
if ($name instanceof sfSympalContentSlot) {
$slot = $name;
$name = $name->getName();
} else {
$slot = $content->getOrCreateSlot($name, $options);
unset($options['default_value']);
}
$slot->setContentRenderedFor($content);
/**
* Either render the raw value or the editor for the slot
*/
if (sfSympalContext::getInstance()->shouldLoadFrontendEditor()) {
use_helper('SympalContentSlotEditor');
return get_sympal_content_slot_editor($content, $slot, $options);
} else {
return $slot->render();
}
}
开发者ID:RafalJachimczyk,项目名称:sympal,代码行数:49,代码来源:SympalContentSlotHelper.php
示例9: comment_save
function comment_save(&$page)
{
// check if we need to save a comment
if (!isset($_POST['comment'])) {
return;
}
global $__FROG_CONN__;
if ($page->comment_status != Comment::OPEN) {
return;
}
$data = $_POST['comment'];
if (is_null($data)) {
return;
}
if (!isset($data['author_name']) or trim($data['author_name']) == '') {
return;
}
if (!isset($data['author_email']) or trim($data['author_email']) == '') {
return;
}
if (!isset($data['body']) or trim($data['body']) == '') {
return;
}
use_helper('Kses');
$allowed_tags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'b' => array(), 'blockquote' => array('cite' => array()), 'br' => array(), 'code' => array(), 'em' => array(), 'i' => array(), 'p' => array(), 'strike' => array(), 'strong' => array());
// get the setting for comments moderations
//$sql = 'SELECT value FROM '.TABLE_PREFIX.'setting WHERE name=\'auto_approve_comment\'';
//$stmt = $__FROG_CONN__->prepare($sql);
//$stmt->execute();
//$auto_approve_comment = (int) $stmt->fetchColumn();
$auto_approve_comment = 1;
$sql = 'INSERT INTO ' . TABLE_PREFIX . 'comment (page_id, author_name, author_email, author_link, body, is_approved, created_on) VALUES (' . '\'' . $page->id . '\', ' . $__FROG_CONN__->quote(strip_tags($data['author_name'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_email'])) . ', ' . $__FROG_CONN__->quote(strip_tags($data['author_link'])) . ', ' . $__FROG_CONN__->quote(kses($data['body'], $allowed_tags)) . ', ' . $__FROG_CONN__->quote($auto_approve_comment) . ', ' . $__FROG_CONN__->quote(date('Y-m-d H:i:s')) . ')';
$__FROG_CONN__->exec($sql);
Observer::notify('comment_after_add');
}
开发者ID:albertobraschi,项目名称:toad,代码行数:35,代码来源:index.php
示例10: filterSympalContent
public function filterSympalContent(sfEvent $event, $content)
{
if (sfSympalConfig::get('sfSympalCommentsPlugin', 'installed') && sfSympalConfig::get('sfSympalCommentsPlugin', 'enabled') && sfSympalConfig::get($event['content']->getType()->getSlug(), 'enable_comments')) {
use_helper('Comments');
$content .= get_sympal_comments($event['content']);
}
return $content;
}
开发者ID:slemoigne,项目名称:sympal,代码行数:8,代码来源:sfSympalCommentsPluginConfiguration.class.php
示例11: formatHelp
/**
* @param string $help
*
* @return string
*/
public function formatHelp($help)
{
if (!$help) {
return '';
}
use_helper('Partial');
return get_partial('help/link-modal', array('name' => 'jenkins/addBuild/parameter-description', 'title' => "Parameter", 'params' => array('help' => $help)));
}
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:13,代码来源:sfWidgetFormSchemaFormatterJobParameter.class.php
示例12: op_activity_image_tag
/**
* Returns an <img> tag for the activity image
*
* @param ActivityImage $activityImage
* @param mixed[] $options
* @return string
*/
function op_activity_image_tag($activityImage, $options = array())
{
use_helper('sfImage');
if ($activityImage->relatedExists('File')) {
return op_image_tag_sf_image($activityImage->File, $options);
} else {
return op_image_tag($activityImage->uri, $options);
}
}
开发者ID:te-koyama,项目名称:openpne,代码行数:16,代码来源:opActivityHelper.php
示例13: button_to_modal_box_preview
function button_to_modal_box_preview($name, $id_formulario, $informe)
{
use_helper('Javascript');
$js = "\n function preview_informe()\n {\n Modalbox.show('" . url_for('informes/preview?id_informe=' . $informe->getPrimaryKey()) . "', {title: '" . __('Vista preliminar del informe') . "', width: 700});\n }";
$html = content_tag('script', $js, array('type' => 'text/javascript'));
$html .= button_to_function($name, 'preview_informe();', array('class' => 'sf_action_show', 'submit' => $id_formulario));
$html .= "\n";
return $html;
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:9,代码来源:MiModalBoxHelper.php
示例14: toHTML
/**
* Returns the rich text editor as HTML.
*
* @return string Rich text editor HTML representation
*/
public function toHTML()
{
$options = $this->options;
// we need to know the id for things the rich text editor
// in advance of building the tag
$id = _get_option($options, 'id', $this->name);
// use tinymce's gzipped js?
$tinymce_file = _get_option($options, 'tinymce_gzip') ? '/tiny_mce_gzip.php' : '/tiny_mce.js';
// tinymce installed?
// $js_path = sfConfig::get('sf_rich_text_js_dir') ? '/'.sfConfig::get('sf_rich_text_js_dir').$tinymce_file : '/sf/tinymce/js'.$tinymce_file;
$js_path = sfConfig::get('sf_rich_text_js_dir') ? '/' . sfConfig::get('sf_rich_text_js_dir') . $tinymce_file : '/sf/tinymce/js' . $tinymce_file;
if (!is_readable(sfConfig::get('sf_web_dir') . $js_path)) {
throw new sfConfigurationException('You must install TinyMCE to use this helper (see rich_text_js_dir settings).');
}
sfContext::getInstance()->getResponse()->addJavascript($js_path);
use_helper('Javascript');
$tinymce_options = '';
$style_selector = '';
// custom CSS file?
if ($css_file = _get_option($options, 'css')) {
$css_path = stylesheet_path($css_file);
sfContext::getInstance()->getResponse()->addStylesheet($css_path);
$css = file_get_contents(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $css_path);
$styles = array();
preg_match_all('#^/\\*\\s*user:\\s*(.+?)\\s*\\*/\\s*\\015?\\012\\s*\\.([^\\s]+)#Smi', $css, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$styles[] = $match[1] . '=' . $match[2];
}
$tinymce_options .= ' content_css: "' . $css_path . '",' . "\n";
$tinymce_options .= ' theme_advanced_styles: "' . implode(';', $styles) . '"' . "\n";
$style_selector = 'styleselect,separator,';
}
$culture = sfContext::getInstance()->getUser()->getCulture();
$tinymce_js = '
tinyMCE.init({
mode: "exact",
language: "' . strtolower(substr($culture, 0, 2)) . '",
elements: "' . $id . '",
plugins: "table,advimage,advlink,flash",
theme: "advanced",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_path_location: "bottom",
theme_advanced_buttons1: "' . $style_selector . 'justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap",
theme_advanced_buttons2: "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code",
theme_advanced_buttons3: "tablecontrols",
extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
relative_urls: false,
debug: false
' . ($tinymce_options ? ',' . $tinymce_options : '') . '
' . (isset($options['tinymce_options']) ? ',' . $options['tinymce_options'] : '') . '
});';
if (isset($options['tinymce_options'])) {
unset($options['tinymce_options']);
}
return content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')) . content_tag('textarea', $this->content, array_merge(array('name' => $this->name, 'id' => get_id_from_name($id, null)), _convert_options($options)));
}
开发者ID:taryono,项目名称:school,代码行数:62,代码来源:sfRichTextEditorTinyMCE.class.php
示例15: link_to_login
function link_to_login($name, $uri = null)
{
use_helper('Javascript');
if ($uri && sfContext::getInstance()->getUser()->isAuthenticated()) {
return link_to($name, $uri);
} else {
return link_to_function($name, visual_effect('blind_down', 'login', array('duration' => 0.5)));
}
}
开发者ID:emacsattic,项目名称:symfony,代码行数:9,代码来源:GlobalHelper.php
示例16: getInlineObjectGalleryFromValue
/**
* get the InlineGallery from current value
*/
protected function getInlineObjectGalleryFromValue()
{
# why is use_helper not available ?
require_once dirname(__FILE__) . '/../../../../../lib/vendor/symfony/lib/helper/HelperHelper.php';
use_helper('InlineObject');
$parser = get_inline_object_parser();
$objects = $parser->parseTypes($this->getObject()->getValue());
return $objects[1][0];
}
开发者ID:phiamo,项目名称:sfSympalGalleryPlugin,代码行数:12,代码来源:sfSympalGallerySlotForm.class.php
示例17: link_to_add_new_comment
function link_to_add_new_comment($name, $record, $comment = null)
{
use_helper('Javascript');
$params = array();
$params['update'] = $comment && $comment->getId() ? 'add_new_comment_form_holder_' . $comment->getId() : 'add_new_comment_form_holder';
$params['url'] = '@cscomments_comments_add';
$comment_id = $comment ? $comment->getId() : null;
$params['with'] = "'comment_id=" . $comment_id . "&model=" . get_class($record) . "&record_id=" . $record->getId() . "&return_uri=" . urlencode(sfContext::getInstance()->getRequest()->getUri()) . "'";
return link_to_remote($name, $params);
}
开发者ID:bshaffer,项目名称:Symplist,代码行数:10,代码来源:CommentHelper.php
示例18: op_api_activity
function op_api_activity($activity)
{
use_helper('opActivity');
$viewMemberId = sfContext::getInstance()->getUser()->getMemberId();
$member = $activity->getMember();
$images = array();
foreach ($activity->getImages() as $activityImage) {
$images[] = array('small_size' => op_activity_image_uri($activityImage, array('size' => '48x48'), true), 'full_size' => op_activity_image_uri($activityImage, array(), true));
}
return array('id' => $activity->getId(), 'member' => op_api_member($member), 'body' => $activity->getBody(), 'body_html' => op_activity_linkification(nl2br(op_api_force_escape($activity->getBody()))), 'uri' => $activity->getUri(), 'source' => $activity->getSource(), 'source_uri' => $activity->getSourceUri(), 'image_uris' => $images, 'created_at' => date('r', strtotime($activity->getCreatedAt())));
}
开发者ID:te-koyama,项目名称:openpne,代码行数:11,代码来源:opJsonApiHelper.php
示例19: has_helper
function has_helper($helper = null)
{
if (is_null($helper)) {
throw new sfException('Missing first argument from has_helper');
} else {
try {
use_helper($helper);
} catch (Exception $e) {
return false;
}
return true;
}
}
开发者ID:bshaffer,项目名称:Symplist,代码行数:13,代码来源:csAdminGenHelper.php
示例20: urlFor
public static function urlFor()
{
use_helper('Url');
$args = func_get_arg(0);
if (array_key_exists('url', $args)) {
$absolute = false;
if (array_key_exists('absolute', $args)) {
$absolute = $args['absolute'];
}
return url_for($args['url'], $absolute);
}
throw new sfException('Invalid arguments');
}
开发者ID:pycmam,项目名称:sfSmarty3Plugin,代码行数:13,代码来源:Url.class.php
注:本文中的use_helper函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论