• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了sfLoader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()");
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:LsApiRequestFilter.class.php


示例2: run_propel_init_admin

function run_propel_init_admin($task, $args)
{
    if (count($args) < 2) {
        throw new Exception('You must provide your module name.');
    }
    if (count($args) < 3) {
        throw new Exception('You must provide your model class name.');
    }
    $app = $args[0];
    $module = $args[1];
    $model_class = $args[2];
    $theme = isset($args[3]) ? $args[3] : 'default';
    try {
        $author_name = $task->get_property('author', 'symfony');
    } catch (pakeException $e) {
        $author_name = 'Your name here';
    }
    $constants = array('PROJECT_NAME' => $task->get_property('name', 'symfony'), 'APP_NAME' => $app, 'MODULE_NAME' => $module, 'MODEL_CLASS' => $model_class, 'AUTHOR_NAME' => $author_name, 'THEME' => $theme);
    $moduleDir = sfConfig::get('sf_root_dir') . '/' . sfConfig::get('sf_apps_dir_name') . '/' . $app . '/' . sfConfig::get('sf_app_module_dir_name') . '/' . $module;
    // create module structure
    $finder = pakeFinder::type('any')->ignore_version_control()->discard('.sf');
    $dirs = sfLoader::getGeneratorSkeletonDirs('sfPropelAdmin', $theme);
    foreach ($dirs as $dir) {
        if (is_dir($dir)) {
            pake_mirror($finder, $dir, $moduleDir);
            break;
        }
    }
    // customize php and yml files
    $finder = pakeFinder::type('file')->ignore_version_control()->name('*.php', '*.yml');
    pake_replace_tokens($finder, $moduleDir, '##', '##', $constants);
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:32,代码来源:sfPakePropelAdminGenerator.php


示例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;
 }
开发者ID:muliadi,项目名称:jfportabledevice,代码行数:25,代码来源:BasejfPortableDeviceActions.class.php


示例4: loadMapBuilderClasses

  /**
   * Loads map builder classes.
   *
   * This method is ORM dependant.
   *
   * @throws sfException
   */
  protected function loadMapBuilderClasses()
  {
    // we must load all map builder classes to be able to deal with foreign keys (cf. editSuccess.php template)
    $classes = sfFinder::type('file')->ignore_version_control()->name('*MapBuilder.php')->in(sfLoader::getModelDirs());
    foreach ($classes as $class)
    {
      $class_map_builder = basename($class, '.php');
      $maps[$class_map_builder] = new $class_map_builder();
      if (!$maps[$class_map_builder]->isBuilt())
      {
        $maps[$class_map_builder]->doBuild();
      }

      if ($this->className == str_replace('MapBuilder', '', $class_map_builder))
      {
        $this->map = $maps[$class_map_builder];
      }
    }
    if (!$this->map)
    {
      throw new sfException('The model class "'.$this->className.'" does not exist.');
    }

    $this->tableMap = $this->map->getDatabaseMap()->getTable(constant($this->className.'Peer::TABLE_NAME'));
  }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:32,代码来源:sfPropelCrudGenerator.class.php


示例5: 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);
 }
开发者ID:bshaffer,项目名称:sfHyperwordPlugin,代码行数:7,代码来源:HyperwordToolkit.class.php


示例6: 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;
 }
开发者ID:hoydaa,项目名称:snippets.hoydaa.org,代码行数:30,代码来源:myUtils.class.php


示例7: loadHelper

 public function loadHelper() {
     sfLoader::loadHelpers('Date');
     sfLoader::loadHelpers('Url');
     sfLoader::loadHelpers('CalculateDate');
     sfLoader::loadHelpers('ColorBuilder');
     sfLoader::loadHelpers('I18N');
     sfLoader::loadHelpers('Icon');
 }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:8,代码来源:WorkflowEdit.class.php


示例8: __construct

    public function __construct(array $workflowtemplate, $workflowversionid) {
        sfLoader::loadHelpers('Partial');
        $this->workflowtemplate = $workflowtemplate;
        $this->version = $workflowversionid;
        $this->setUserSettings($workflowtemplate['sender_id']);
        $this->sendWorkflowCompletedEmail();

    }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:8,代码来源:SendWorkflowCompletedEmail.class.php


示例9: get_config_dirs

function get_config_dirs($configPath)
{
    $dirs = array();
    foreach (sfLoader::getConfigPaths($configPath) as $dir) {
        $dirs[] = $dir;
    }
    return array_map('strip_paths', $dirs);
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:8,代码来源:configTest.php


示例10: __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;
 }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:9,代码来源:WorkflowOverview.class.php


示例11: 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'));
     }
 }
开发者ID:psskhal,项目名称:symfony-sample,代码行数:9,代码来源:sfWidgetFormSearchTag.class.php


示例12: 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);
 }
开发者ID:silky,项目名称:littlesis,代码行数:10,代码来源:NetworkMapTable.class.php


示例13: configure

 /**
  * Configures template for this view.
  */
 public function configure()
 {
     $this->setDecorator(false);
     $this->setTemplate($this->actionName . $this->getExtension());
     if ('global' == $this->moduleName) {
         $this->setDirectory(sfConfig::get('sf_app_template_dir'));
     } else {
         $this->setDirectory(sfLoader::getTemplateDir($this->moduleName, $this->getTemplate()));
     }
 }
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:13,代码来源:sfPartialView.class.php


示例14: 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;
    }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:62,代码来源:actions.class.php


示例15: 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">&nbsp;</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));
    }
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:55,代码来源:ViewerHelper.php


示例16: configure

 public function configure()
 {
     $response = $this->getContext()->getResponse();
     $response->setParameter($this->moduleName . '_' . $this->actionName . '_layout', false, 'symfony/action/view');
     $response->setContentType('application/x-javascript');
     $this->setTemplate($this->actionName . $this->viewName . $this->getExtension());
     // Set template directory
     if (!$this->directory) {
         $this->setDirectory(sfLoader::getTemplateDir($this->moduleName, $this->getTemplate()));
     }
 }
开发者ID:royalterra,项目名称:pdns-gui,代码行数:11,代码来源:sfJavascriptView.class.php


示例17: 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);
 }
开发者ID:net7,项目名称:Talia-CMS,代码行数:12,代码来源:sfSimpleCMSSlotRichText.class.php


示例18: __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();
     }
 }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:17,代码来源:SendSlotReachedEmail.class.php


示例19: 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;
 }
开发者ID:silky,项目名称:littlesis,代码行数:52,代码来源:ModificationFieldTable.class.php


示例20: evalTemplate

 /**
  * Evaluates a template file.
  *
  * @param string The template file path
  *
  * @return string The evaluated template
  */
 protected function evalTemplate($templateFile)
 {
     $templateFile = sfLoader::getGeneratorTemplate($this->getGeneratorClass(), $this->getTheme(), $templateFile);
     // eval template file
     ob_start();
     require $templateFile;
     $content = ob_get_clean();
     // replace [?php and ?]
     $content = $this->replacePhpMarks($content);
     $retval = "<?php\n" . "// auto-generated by " . $this->getGeneratorClass() . "\n" . "// date: %s\n?>\n%s";
     $retval = sprintf($retval, date('Y/m/d H:i:s'), $content);
     return $retval;
 }
开发者ID:taryono,项目名称:school,代码行数:20,代码来源:sfGenerator.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfLogger类代码示例发布时间:2022-05-23
下一篇:
PHP sfInflector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap