本文整理汇总了PHP中sfLoader::loadHelpers方法的典型用法代码示例。如果您正苦于以下问题:PHP sfLoader::loadHelpers方法的具体用法?PHP sfLoader::loadHelpers怎么用?PHP sfLoader::loadHelpers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfLoader
的用法示例。
在下文中一共展示了sfLoader::loadHelpers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticateUserRequest
public function authenticateUserRequest()
{
$authResult = $this->authenticateKey($this->request->getParameter('_key'));
switch ($authResult) {
case self::AUTH_FAIL_KEY:
$this->response->setStatusCode(401);
sfLoader::loadHelpers('Partial');
$partial = get_partial('global/401');
$this->response->setContent($partial);
$this->response->setHttpHeader('WWW-Authenticate', 'Your request must include a query parameter named "_key" with a valid API key value. To obtain an API key, visit http://api.littlesis.org/register');
$this->response->sendHttpHeaders();
$this->response->sendContent();
throw new sfStopException();
break;
case self::AUTH_FAIL_LIMIT:
$this->response = sfContext::getInstance()->getResponse();
$this->response->setStatusCode(403);
$user = Doctrine::getTable('ApiUser')->findOneByApiKey($this->request->getParameter('_key'));
sfLoader::loadHelpers('Partial');
$partial = get_partial('global/403', array('request_limit' => $user->request_limit));
$this->response->setContent($partial);
$this->response->sendHttpHeaders();
$this->response->sendContent();
throw new sfStopException();
break;
case self::AUTH_SUCCESS:
break;
default:
throw new Exception("Invalid return value from LsApi::autheticate()");
}
}
示例2: getDecorator
public function getDecorator()
{
sfLoader::loadHelpers('Url');
sfLoader::loadHelpers('Tag');
$decorator = link_to('%s', '@hyperword_processor?word=%s', array('class' => 'hyperword'));
return str_replace('%25s', '%s', $decorator);
}
示例3: getCacheManifestFilesForConfig
protected function getCacheManifestFilesForConfig($config, $callback, $files = array())
{
$context = $this->getContext();
// compatibility with symfony 1.0:
if (method_exists($context, 'getConfiguration') && method_exists($context->getConfiguration(), 'loadHelpers')) {
$context->getConfiguration()->loadHelpers('Asset');
} else {
if (method_exists('sfLoader', 'loadHelpers')) {
sfLoader::loadHelpers('Asset');
//maintain compatibility to symfony versions prior to 1.3
}
}
foreach ($config as $key => $value) {
if (is_string($value)) {
$files[] = $callback($value);
} else {
if (is_array($value)) {
foreach ($value as $filename => $options) {
$files[] = $callback($filename);
}
}
}
}
return $files;
}
示例4: extractSummaryArray
public static function extractSummaryArray($body, $min, $total)
{
//replace whitespaces with space
$body = preg_replace("/(\\r?\\n[ \\t]*)+/", " ", $body);
//find paragraphs
$matches = array();
preg_match_all("/<p>(.+)<\\/p>/isU", $body, $matches, PREG_SET_ORDER);
//put paragraphs to a fresh array and calculate total length
$total_length = 0;
$paragraphs = array();
foreach ($matches as $match) {
$len = 0;
if (($len = strlen($match[1])) > $min) {
$paragraphs[] = $match[1];
$total_length += strlen($match[1]);
}
}
//chop paragraphs
sfLoader::loadHelpers('Text');
$final = array();
for ($i = 0; $i < sizeof($paragraphs); $i++) {
$share = (int) ($total * strlen($paragraphs[$i]) / $total_length);
if ($share < $min) {
$total_length -= strlen($paragraphs[$i]);
continue;
}
$final[] = truncate_text($paragraphs[$i], $share, "", true);
}
return $final;
}
示例5: __construct
public function __construct(array $workflowtemplate, $workflowversionid) {
sfLoader::loadHelpers('Partial');
$this->workflowtemplate = $workflowtemplate;
$this->version = $workflowversionid;
$this->setUserSettings($workflowtemplate['sender_id']);
$this->sendWorkflowCompletedEmail();
}
示例6: loadHelper
public function loadHelper() {
sfLoader::loadHelpers('Date');
sfLoader::loadHelpers('Url');
sfLoader::loadHelpers('CalculateDate');
sfLoader::loadHelpers('ColorBuilder');
sfLoader::loadHelpers('I18N');
sfLoader::loadHelpers('Icon');
}
示例7: __construct
public function __construct(sfContext $context_in, myUser $user) {
sfLoader::loadHelpers('I18N');
sfLoader::loadHelpers('Date');
sfLoader::loadHelpers('Url');
sfLoader::loadHelpers('CalculateDate');
sfLoader::loadHelpers('ColorBuilder');
$this->context = $context_in;
$this->user = $user;
}
示例8: render
public function render($name, $value = null, $attributes = array(), $errors = array())
{
sfLoader::loadHelpers('Javascript');
if ($this->getOption("plain")) {
return $value . input_hidden_tag($name, $value);
} else {
return input_auto_complete_tag($name, $value, 'tag/searchTag?src=' . $this->getOption('src'), array('autocomplete' => 'off', 'size' => '15'), array('use_style' => 'true'));
}
}
示例9: prepareRelData
public static function prepareRelData($rel)
{
sfLoader::loadHelpers(array("Asset", "Url"));
try {
$url = url_for(RelationshipTable::generateRoute($rel));
} catch (Exception $e) {
$url = "http://littlesis.org/relationship/view/id/" . $rel['id'];
}
return array("id" => self::integerize($rel["id"]), "entity1_id" => self::integerize($rel["entity1_id"]), "entity2_id" => self::integerize($rel["entity2_id"]), "category_id" => self::integerize($rel["category_id"]), "category_ids" => (array) self::integerize($rel["category_ids"]), "is_current" => self::integerize($rel["is_current"]), "end_date" => @$rel["end_date"], "value" => 1, "label" => $rel["label"], "url" => $url, "x1" => @$rel["x1"], "y1" => @$rel["y1"], "fixed" => true);
}
示例10: executeGetIFrame
/**
* Action loads an IFrame for the email, when settings are set IFRAME and HTML
* the template getIframeSuccess.php adds the needed fields to the iframe
* @param sfWebRequest $request
* @return <type>
*/
public function executeGetIFrame(sfWebRequest $request) {
sfLoader::loadHelpers('Url', 'I18N');
$serverUrl = str_replace('/layout', '', url_for('layout/index', true));
$versionId = $request->getParameter('versionid');
$templateId = $request->getParameter('workflowid');
$userId = $request->getParameter('userid');
$userSettings = new UserMailSettings($userId);
$context = sfContext::getInstance();
$sf_i18n = $context->getI18N();
$sf_i18n->setCulture($userSettings->userSettings['language']);
$this->linkto = $context->getI18N()->__('Direct link to workflow' ,null,'sendstationmail');
$wfSettings = WorkflowVersionTable::instance()->getWorkflowVersionById($versionId);
$workflow = $wfSettings[0]->getWorkflowTemplate()->toArray();
$detailObj = new WorkflowDetail(false);
$detailObj->setServerUrl($serverUrl);
$detailObj->setCulture($userSettings->userSettings['language']);
$detailObj->setContext($context);
$editObj = new WorkflowEdit(false);
$editObj->setServerUrl($serverUrl);
$editObj->setContext($context);
$editObj->setCulture($userSettings->userSettings['language']);
$editObj->setUserId($userId);
$this->slots = $editObj->buildSlots($wfSettings , $versionId);
$content['workflow'][0] = $context->getI18N()->__('You have to fill out the fields in the workflow' ,null,'sendstationmail');
$content['workflow'][1] = $workflow[0]['name'];
$content['workflow'][2] = $context->getI18N()->__('Slot' ,null,'sendstationmail');
$content['workflow'][3] = $context->getI18N()->__('Yes' ,null,'sendstationmail');
$content['workflow'][4] = $context->getI18N()->__('No' ,null,'sendstationmail');
$content['workflow'][5] = $context->getI18N()->__('Field' ,null,'sendstationmail');
$content['workflow'][6] = $context->getI18N()->__('Value' ,null,'sendstationmail');
$content['workflow'][7] = $context->getI18N()->__('File' ,null,'sendstationmail');
$content['workflow'][8] = $context->getI18N()->__('Accept Workflow' ,null,'sendstationmail');
$content['workflow'][9] = $context->getI18N()->__('Deny Workflow' ,null,'sendstationmail');
$content['workflow'][10] = $context->getI18N()->__('Save' ,null,'sendstationmail');
$this->error = $request->getParameter('error',0);
$this->serverPath = $serverUrl;
$this->workflowverion = $versionId;
$this->userid = $userId;
$this->workflow = $templateId;
$this->text = $content;
$this->setLayout(false);
$this->setTemplate('getIFrame');
return sfView::SUCCESS;
}
示例11: display_page_header
function display_page_header($module, $document, $id, $metadata, $current_version, $options = array())
{
$is_archive = $document->isArchive();
$mobile_version = c2cTools::mobileVersion();
$content_class = $module . '_content';
$lang = $document->getCulture();
$version = $is_archive ? $document->getVersion() : NULL;
$slug = '';
$prepend = _option($options, 'prepend', '');
$separator = _option($options, 'separator', '');
$nav_options = _option($options, 'nav_options');
$item_type = _option($options, 'item_type', '');
$nb_comments = _option($options, 'nb_comments');
$creator_id = _option($options, 'creator_id');
if (!$is_archive) {
if ($module != 'users') {
$slug = get_slug($document);
$url = "@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug={$slug}";
} else {
$url = "@document_by_id_lang?module={$module}&id={$id}&lang={$lang}";
}
} else {
$url = "@document_by_id_lang_version?module={$module}&id={$id}&lang={$lang}&version={$version}";
}
if (!empty($prepend)) {
$prepend .= $separator;
}
echo display_title($prepend . $document->get('name'), $module, true, 'default_nav', $url);
if (!$mobile_version) {
echo '<div id="nav_space"> </div>';
sfLoader::loadHelpers('WikiTabs');
$tabs = tabs_list_tag($id, $lang, $document->isAvailable(), 'view', $version, $slug, $nb_comments);
echo $tabs;
// liens internes vers les sections repliables du document
if ($nav_options == null) {
include_partial("{$module}/nav_anchor");
} else {
include_partial("{$module}/nav_anchor", array('section_list' => $nav_options));
}
// boutons vers des fonctions annexes et de gestion du document
include_partial("{$module}/nav", isset($creator_id) ? array('id' => $id, 'document' => $document, 'creator_id' => $creator_id) : array('id' => $id, 'document' => $document));
if ($module != 'users') {
sfLoader::loadHelpers('Button');
echo '<div id="nav_share" class="nav_box">' . button_share() . '</div>';
}
}
echo display_content_top('doc_content', $item_type);
echo start_content_tag($content_class);
if ($merged_into = $document->get('redirects_to')) {
include_partial('documents/merged_warning', array('merged_into' => $merged_into));
}
if ($is_archive) {
include_partial('documents/versions_browser', array('id' => $id, 'document' => $document, 'metadata' => $metadata, 'current_version' => $current_version));
}
}
示例12: loadCoreAndStandardHelpers
/**
* Load core and standard helpers to be use in the template.
*/
protected function loadCoreAndStandardHelpers()
{
static $coreHelpersLoaded = 0;
if ($coreHelpersLoaded) {
return;
}
$coreHelpersLoaded = 1;
$core_helpers = array('Helper', 'Url', 'Asset', 'Tag', 'Escaping');
$standard_helpers = sfConfig::get('sf_standard_helpers');
$helpers = array_unique(array_merge($core_helpers, $standard_helpers));
sfLoader::loadHelpers($helpers);
}
示例13: __construct
/**
*
* @param int $currentWorklfowSlotId, workflowslotid of the current slot
* @param int $nextSlotId , SlotId of the next slot
*/
public function __construct($currentWorklfowSlotId, $nextWorkflowSlotId, $workflowtemplateId, $workflowversionId) {
sfLoader::loadHelpers('EndAction');
$this->setWorkflowTemplateSettings($workflowtemplateId);
if($this->checkState() == 1) {
sfLoader::loadHelpers('Partial');
$this->workflowVersionId = $workflowversionId;
$this->setCurrentSlot($currentWorklfowSlotId);
$this->setNextSlot($nextWorkflowSlotId);
$this->setUserSettings();
$this->sendSlotReachedMail();
}
}
示例14: getSlotEditor
public function getSlotEditor($slot)
{
$options = array('size' => '80x10', 'id' => 'edit_textarea' . $slot->getName(), 'tinymce_options' => sfConfig::get('app_sfSimpleCMS_tinymce_options', 'width: "100%"'));
$script = '';
if (sfConfig::get('app_sfSimpleCMS_rich_editing', false)) {
sfLoader::loadHelpers(array('Javascript'));
sfContext::getInstance()->getResponse()->addJavascript('/sfSimpleCMSPlugin/js/tiny_mce_AJAX.js', 'last');
$script = javascript_tag('setTextareaToTinyMCE("edit_textarea' . $slot->getName() . '");');
$options['rich'] = 'TinyMCE';
}
return $script . textarea_tag('slot_content', $slot->getValue(), $options);
}
示例15: convertValueForDisplay
static function convertValueForDisplay($value, $field, $excerpt = 40)
{
if (is_null($value)) {
return 'NULL';
}
if (!($mod = self::loadModification($field))) {
return $value;
}
$table = Doctrine::getTable($mod['object_model']);
$columns = $table->getColumns();
if ($mod['object_model'] == 'Entity') {
if (!array_key_exists($field['field_name'], $columns)) {
if ($extensionName = EntityTable::getExtensionNameByFieldName($field['field_name'])) {
$table = Doctrine::getTable($extensionName);
}
}
} elseif ($mod['object_model'] == 'Relationship') {
if (!array_key_exists($field['field_name'], $columns)) {
$table = Doctrine::getTable(RelationshipTable::getCategoryNameByFieldName($field['field_name']));
}
}
if ($alias = self::getFieldNameAlias($field)) {
$class = $table->getRelation($alias)->getClass();
if ($record = Doctrine::getTable($class)->find($value, Doctrine::HYDRATE_ARRAY)) {
if ($class == 'Entity') {
sfLoader::loadHelpers('Ls');
return entity_link($record, null);
} elseif ($class == 'sfGuardUser') {
sfLoader::loadHelpers('Ls');
return user_link($record);
}
return $record;
}
}
if (in_array($field['field_name'], array('start_date', 'end_date'))) {
return Dateable::convertForDisplay($value);
}
$def = $table->getColumnDefinition($field['field_name']);
switch ($def['type']) {
case 'integer':
return (double) $value;
break;
case 'boolean':
return $value ? 'yes' : 'no';
break;
}
if ($excerpt) {
$short = LsString::excerpt($value, $excerpt);
return $short == $value ? $value : '<span title="' . strip_tags($value) . '">' . $short . '</span>';
}
return $value;
}