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

PHP Symphony类代码示例

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

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



在下文中一共展示了Symphony类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: initializeContext

 /**
  * Initialize contextual XML (formerly params)
  */
 public function initializeContext()
 {
     $this->View->context->register(array('system' => array('site-name' => Symphony::Configuration()->core()->symphony->sitename, 'site-url' => URL, 'admin-url' => URL . '/symphony', 'symphony-version' => Symphony::Configuration()->core()->symphony->version), 'date' => array('today' => DateTimeObj::get('Y-m-d'), 'current-time' => DateTimeObj::get('H:i'), 'this-year' => DateTimeObj::get('Y'), 'this-month' => DateTimeObj::get('m'), 'this-day' => DateTimeObj::get('d'), 'timezone' => date_default_timezone_get())));
     if ($this->User) {
         $this->View->context->register(array('session' => self::instance()->User->fields()));
     }
 }
开发者ID:symphonycms,项目名称:symphony-3,代码行数:10,代码来源:class.controller.php


示例2: __construct

 /**
  * The constructor for `JSONPage`. This sets the page status to `Page::HTTP_STATUS_OK`,
  * the default content type to `application/json` and initialises `$this->_Result`
  * with an `array`. The constructor also starts the Profiler for this
  * page template.
  *
  * @see toolkit.Profiler
  */
 public function __construct()
 {
     $this->_Result = array();
     $this->setHttpStatus(self::HTTP_STATUS_OK);
     $this->addHeaderToPage('Content-Type', 'application/json');
     Symphony::Profiler()->sample('Page template created', PROFILE_LAP);
 }
开发者ID:valery,项目名称:symphony-2,代码行数:15,代码来源:class.jsonpage.php


示例3: upgrade

    public static function upgrade()
    {
        if (version_compare(self::$existing_version, '2.3.4beta1', '<=')) {
            // Detect mod_rewrite #1808
            try {
                $htaccess = file_get_contents(DOCROOT . '/.htaccess');
                if ($htaccess !== false && !preg_match('/SetEnv HTTP_MOD_REWRITE No/', $htaccess)) {
                    $rewrite = '
<IfModule !mod_rewrite.c>
    SetEnv HTTP_MOD_REWRITE No
</IfModule>

<IfModule mod_rewrite.c>';
                    $htaccess = str_replace('<IfModule mod_rewrite.c>', $rewrite, $htaccess);
                    file_put_contents(DOCROOT . '/.htaccess', $htaccess);
                }
            } catch (Exception $ex) {
            }
            // Extend token field to enable more secure tokens
            try {
                Symphony::Database()->query('ALTER TABLE `tbl_forgotpass` CHANGE `token` `token` VARCHAR(16);');
            } catch (Exception $ex) {
            }
        }
        if (version_compare(self::$existing_version, '2.3.4beta2', '<=')) {
            // Extend session_id field for default Suhosin installs
            try {
                Symphony::Database()->query('ALTER TABLE `tbl_sessions` CHANGE `session` `session` VARCHAR(128);');
            } catch (Exception $ex) {
            }
        }
        // Update the version information
        return parent::upgrade();
    }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:34,代码来源:2.3.4.php


示例4: processDependencies

 public function processDependencies(array $params = array())
 {
     $datasources = $this->getDependencies();
     if (!is_array($datasources) || empty($datasources)) {
         return;
     }
     $datasources = array_map(create_function('$a', "return str_replace('\$ds-', '', \$a);"), $datasources);
     $datasources = array_map(create_function('$a', "return str_replace('-', '_', \$a);"), $datasources);
     $env = array('today' => DateTimeObj::get('Y-m-d'), 'current-time' => DateTimeObj::get('H:i'), 'this-year' => DateTimeObj::get('Y'), 'this-month' => DateTimeObj::get('m'), 'this-day' => DateTimeObj::get('d'), 'timezone' => DateTimeObj::get('P'), 'enm-newsletter-id' => $this->newsletter_id);
     $this->_env['param'] = $env;
     $this->_env['env']['pool'] = $params;
     $dependencies = array();
     foreach ($datasources as $handle) {
         $profiler = Symphony::Profiler();
         $profiler->seed();
         $pool[$handle] =& DatasourceManager::create($handle, NULL, false);
         $dependencies[$handle] = $pool[$handle]->getDependencies();
     }
     $dsOrder = $this->__findDatasourceOrder($dependencies);
     foreach ($dsOrder as $handle) {
         $ds = $pool[$handle];
         $ds->processParameters($this->_env);
         $ds->grab($this->_env['env']['pool']);
         unset($ds);
     }
     $this->processParameters($this->_env);
 }
开发者ID:jonmifsud,项目名称:email_newsletter_manager,代码行数:27,代码来源:class.recipientsource.php


示例5: __construct

 public function __construct($add, $orderable = true)
 {
     $this->child_name = $child_name;
     $this->page = Symphony::Parent()->Page;
     $this->duplicator = $this->page->createElement('div');
     $this->duplicator->addClass('duplicator-widget');
     $controls = $this->page->createElement('ol');
     $controls->addClass('controls');
     $this->duplicator->appendChild($controls);
     $add_item = $this->page->createElement('li', $add);
     $add_item->addClass('add');
     $controls->appendChild($add_item);
     $this->templates = $this->page->createElement('ol');
     $this->templates->setAttribute('class', 'templates');
     $this->duplicator->appendChild($this->templates);
     $content = $this->page->createElement('div');
     $content->addClass('content');
     $this->duplicator->appendChild($content);
     $this->tabs = $this->page->createElement('ol');
     $this->tabs->addClass('tabs');
     $content->appendChild($this->tabs);
     if ($orderable) {
         $this->duplicator->addClass('orderable-widget');
     }
     $this->instances = $this->page->createElement('ol');
     $this->instances->addClass('instances');
     $content->appendChild($this->instances);
     $this->reflection = new ReflectionObject($this->duplicator);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:29,代码来源:class.duplicator.php


示例6: __construct

 /**
  * The constructor for the `XSLTPage` ensures that an `XSLTProcessor`
  * is available, and then sets an instance of it to `$this->Proc`, otherwise
  * it will throw a `SymphonyErrorPage` exception.
  */
 public function __construct()
 {
     if (!XsltProcess::isXSLTProcessorAvailable()) {
         Symphony::Engine()->throwCustomError(__('No suitable XSLT processor was found.'));
     }
     $this->Proc = new XsltProcess();
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:12,代码来源:class.xsltpage.php


示例7: lookup

 public static function lookup($ip)
 {
     $ch = curl_init();
     // Notice: the request back to the service API includes your domain name
     // and the version of Symphony that you're using
     $version = Symphony::Configuration()->get('version', 'symphony');
     $domain = $_SERVER[SERVER_NAME];
     curl_setopt($ch, CURLOPT_URL, "http://api.josephdenne.com/_geoloc/array/?symphony=" . $version . "&domain=" . $domain . "&ip=" . $ip);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $geoinfo = curl_exec($ch);
     $info = curl_getinfo($ch);
     curl_close($ch);
     if ($geoinfo === false || $info['http_code'] != 200) {
         return;
     } else {
         $geoinfo = explode(',', $geoinfo);
     }
     $result = new XMLElement("geolocation");
     $included = array('id', 'lookups', 'country', 'region', 'city', 'lat', 'lon', 'error');
     $i = 0;
     foreach ($included as $geoloc) {
         $result->appendChild(new XMLElement($geoloc, $geoinfo[$i]));
         $i++;
     }
     return $result;
 }
开发者ID:josephdenne,项目名称:geolocation_service,代码行数:27,代码来源:class.geolocation_service.php


示例8: action

 public function action()
 {
     if (isset($_POST['action']['save'])) {
         $fields = $_POST['fields'];
         $permissions = $fields['permissions'];
         $name = trim($fields['name']);
         $page_access = $fields['page_access'];
         if (strlen($name) == 0) {
             $this->_errors['name'] = __('This is a required field');
             return;
         } elseif ($this->_driver->roleExists($name)) {
             $this->_errors['name'] = __('A role with the name <code>%s</code> already exists.', array($name));
             return;
         }
         ASDCLoader::instance()->query("INSERT INTO `tbl_members_roles` VALUES (NULL, '{$name}')");
         $role_id = ASDCLoader::instance()->lastInsertID();
         if (is_array($page_access) && !empty($page_access)) {
             foreach ($page_access as $page_id) {
                 ASDCLoader::instance()->query("INSERT INTO `tbl_members_roles_forbidden_pages` VALUES (NULL, {$role_id}, {$page_id})");
             }
         }
         if (is_array($permissions) && !empty($permissions)) {
             $sql = "INSERT INTO `tbl_members_roles_event_permissions` VALUES ";
             foreach ($permissions as $event_handle => $p) {
                 foreach ($p as $action => $level) {
                     $sql .= "(NULL,  {$role_id}, '{$event_handle}', '{$action}', '{$level}'),";
                 }
             }
             Symphony::Database()->query(trim($sql, ','));
         }
         redirect(extension_members::baseURL() . 'roles_edit/' . $role_id . '/created/');
     }
 }
开发者ID:bauhouse,项目名称:members,代码行数:33,代码来源:content.roles_new.php


示例9: entrySaved

 public function entrySaved($context)
 {
     require_once MANIFEST . '/jit-recipes.php';
     require_once MANIFEST . '/jit-precaching.php';
     require_once TOOLKIT . '/class.fieldmanager.php';
     $fm = new FieldManager(Symphony::Engine());
     $section = $context['section'];
     if (!$section) {
         require_once TOOLKIT . '/class.sectionmanager.php';
         $sm = new SectionManager(Symphony::Engine());
         $section = $sm->fetch($context['entry']->get('section_id'));
     }
     // iterate over each field in this entry
     foreach ($context['entry']->getData() as $field_id => $data) {
         // get the field meta data
         $field = $fm->fetch($field_id);
         // iterate over the field => recipe mapping
         foreach ($cached_recipes as $cached_recipe) {
             // check a mapping exists for this section/field combination
             if ($section->get('handle') != $cached_recipe['section']) {
                 continue;
             }
             if ($field->get('element_name') != $cached_recipe['field']) {
                 continue;
             }
             // iterate over the recipes mapped for this section/field combination
             foreach ($cached_recipe['recipes'] as $cached_recipe_name) {
                 // get the file name, includes path relative to workspace
                 $file = $data['file'];
                 if (!isset($file) || is_null($file)) {
                     continue;
                 }
                 // trim the filename from path
                 $uploaded_file_path = explode('/', $file);
                 array_pop($uploaded_file_path);
                 // image path relative to workspace
                 if (is_array($uploaded_file_path)) {
                     $uploaded_file_path = implode('/', $uploaded_file_path);
                 }
                 // iterate over all JIT recipes
                 foreach ($recipes as $recipe) {
                     // only process if the recipe has a URL Parameter (name)
                     if (is_null($recipe['url-parameter'])) {
                         continue;
                     }
                     // if not using wildcard, only process specified recipe names
                     if ($cached_recipe_name != '*' && $cached_recipe_name != $recipe['url-parameter']) {
                         continue;
                     }
                     // process the image using the usual JIT URL and get the result
                     $image_data = file_get_contents(URL . '/image/' . $recipe['url-parameter'] . $file);
                     // create a directory structure that matches the JIT URL structure
                     General::realiseDirectory(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $uploaded_file_path);
                     // save the image to disk
                     file_put_contents(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $file, $image_data);
                 }
             }
         }
     }
 }
开发者ID:nickdunn,项目名称:jit_precaching,代码行数:60,代码来源:extension.driver.php


示例10: __geocodeAddress

 private function __geocodeAddress($address, $can_return_default = true)
 {
     $coordinates = null;
     $cache_id = md5('maplocationfield_' . $address);
     $cache = new Cacheable(Symphony::Database());
     $cachedData = $cache->check($cache_id);
     // no data has been cached
     if (!$cachedData) {
         include_once TOOLKIT . '/class.gateway.php';
         $ch = new Gateway();
         $ch->init();
         $ch->setopt('URL', 'https://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&key=' . $this->get('api_key'));
         $response = json_decode($ch->exec());
         if ($response->status === 'OK') {
             $coordinates = $response->results[0]->geometry->location;
         } else {
             return false;
         }
         if ($coordinates && is_object($coordinates)) {
             // cache lifetime in minutes
             $cache->write($cache_id, $coordinates->lat . ', ' . $coordinates->lng, $this->_geocode_cache_expire);
         }
     } else {
         $coordinates = $cachedData['data'];
     }
     // coordinates is an array, split and return
     if ($coordinates && is_object($coordinates)) {
         return $coordinates->lat . ', ' . $coordinates->lng;
     } elseif ($coordinates) {
         return $coordinates;
     } elseif ($can_return_default) {
         return $this->_default_coordinates;
     }
 }
开发者ID:symphonists,项目名称:maplocationfield,代码行数:34,代码来源:field.maplocation.php


示例11: grab

 public function grab(&$param_pool)
 {
     self::__init();
     $result = new XMLElement($this->dsParamROOTELEMENT);
     $rows = Symphony::Database()->fetch("SELECT *\n\t\t\t\tFROM `tbl_sessions` \n\t\t\t\tWHERE `session_data` != 'sym-|a:0:{}sym-members|a:0:{}' \n\t\t\t\tAND `session_data` REGEXP 'sym-members'\n\t\t\t\tAND `session_expires` > (UNIX_TIMESTAMP() - " . self::AGE . ") \n\t\t\t\tORDER BY `session_expires` DESC");
     $added = array();
     if (count($rows) > 0) {
         foreach ($rows as $r) {
             $raw = $r['session_data'];
             $data = self::session_real_decode($raw);
             if (!isset($data['sym-members'])) {
                 continue;
             }
             $record = ASDCLoader::instance()->query(sprintf("SELECT\n\t\t\t\t\t\t\t\temail.value AS `email`,\n\t\t\t\t\t\t\t\tMD5(email.value) AS `hash`,\n\t\t\t\t\t\t\t\tcreated_by.username AS `username`\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM `tbl_entries_data_%d` AS `created_by`\n\t\t\t\t\t\t\tLEFT JOIN `tbl_entries_data_%d` AS `email` ON created_by.member_id = email.entry_id\n\t\t\t\t\t\t\tWHERE `created_by`.username = '%s'\n\t\t\t\t\t\t\tLIMIT 1", self::findFieldID('created-by', 'comments'), self::findFieldID('email-address', 'members'), ASDCLoader::instance()->escape($data['sym-members']['username'])));
             if ($record->length() == 0) {
                 continue;
             }
             $member = $record->current();
             // This is so we dont end up with accidental duplicates. No way to select
             // distinct via the SQL since we grab raw session data
             if (in_array($member->username, $added)) {
                 continue;
             }
             $added[] = $member->username;
             $result->appendChild(new XMLElement('member', General::sanitize($member->username), array('email-hash' => $member->hash)));
         }
     } else {
         $result->setValue('No Records Found.');
         //This should never happen!
     }
     return $result;
 }
开发者ID:bauhouse,项目名称:sym-forum-ensemble,代码行数:32,代码来源:data.whosonline.php


示例12: fetchMemberFromID

 /**
  * Given a Member ID, return Member
  *
  * @param integer $member_id
  * @return Entry
  */
 public function fetchMemberFromID($member_id)
 {
     if (!Identity::$driver instanceof Extension) {
         Identity::$driver = Symphony::ExtensionManager()->create('members');
     }
     return Identity::$driver->getMemberDriver()->initialiseMemberObject($member_id);
 }
开发者ID:andrewminton,项目名称:members,代码行数:13,代码来源:class.identity.php


示例13: save

 public static function save(Utility $utility)
 {
     $file = UTILITIES . "/{$utility->name}";
     FileWriter::write($file, $utility->body, Symphony::Configuration()->core()->symphony->{'file-write-mode'});
     //General::writeFile($file, $utility->body,Symphony::Configuration()->core()->symphony->{'file-write-mode'});
     return file_exists($file);
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:7,代码来源:class.utility.php


示例14: saveVersion

 public function saveVersion(&$context)
 {
     $section = $context['section'];
     $entry = $context['entry'];
     $fields = $context['fields'];
     // if saved from an event, no section is passed, so resolve
     // section object from the entry
     if (is_null($section)) {
         $sm = new SectionManager(Symphony::Engine());
         $section = $sm->fetch($entry->get('section_id'));
     }
     // if we *still* can't resolve a section then something is
     // probably quite wrong, so don't try and save version history
     if (is_null($section)) {
         return;
     }
     // does this section have en Entry Version field, should we store the version?
     $has_entry_versions_field = FALSE;
     // is this an update to an existing version, or create a new version?
     $is_update = $fields['entry-versions'] != 'yes';
     // find the Entry Versions field in the section and remove its presence from
     // the copied POST array, so that its value is not saved against the version
     foreach ($section->fetchFields() as $field) {
         if ($field->get('type') == 'entry_versions') {
             unset($fields[$field->get('element_name')]);
             $has_entry_versions_field = TRUE;
         }
     }
     if (!$has_entry_versions_field) {
         return;
     }
     $version = EntryVersionsManager::saveVersion($entry, $fields, $is_update, $entry_version_field_name);
     $context['messages'][] = array('version', 'passed', $version);
 }
开发者ID:andrewminton,项目名称:entry_versions,代码行数:34,代码来源:extension.driver.php


示例15: import

 /**
  * Process the data so it can be imported into the entry.
  * @param  $value   The value to import
  * @param  $entry_id    If a duplicate is found, an entry ID will be provided.
  * @return The data returned by the field object
  */
 public function import($value, $entry_id = null)
 {
     $destination = $this->field->get('destination');
     $filename = str_replace('/workspace/', '/', $destination) . '/' . str_replace($destination, '', trim($value));
     // Check if the file exists:
     if (file_exists(DOCROOT . $destination . '/' . trim($value))) {
         // File exists, create the link:
         // Check if there already exists an entry with this filename. If so, this entry will not be stored (filename must be unique)
         $sql = 'SELECT COUNT(*) AS `total` FROM `tbl_entries_data_' . $this->field->get('id') . '` WHERE `file` = \'' . $filename . '\';';
         $total = Symphony::Database()->fetchVar('total', 0, $sql);
         if ($total == 0) {
             $fileData = $this->field->processRawFieldData($value, $this->field->__OK__);
             $fileData['file'] = trim($filename);
             $fileData['size'] = filesize(DOCROOT . $destination . '/' . $value);
             $fileData['mimetype'] = mime_content_type(DOCROOT . $destination . '/' . $value);
             $fileData['meta'] = serialize($this->field->getMetaInfo(DOCROOT . $destination . '/' . $value, $fileData['mimetype']));
             return $fileData;
         } else {
             // File already exists, don't store:
             return false;
         }
     } else {
         // File is stored in the CSV, but does not exists. Save it anyway, for database sake:
         if (!empty($value)) {
             $fileData = $this->field->processRawFieldData($value, $this->field->__OK__);
             $fileData['file'] = trim($filename);
             $fileData['size'] = filesize(DOCROOT . $destination . '/' . $value);
             $fileData['mimetype'] = '';
             // mime_content_type(DOCROOT . $destination . '/' . $value);
             $fileData['meta'] = serialize($this->field->getMetaInfo(DOCROOT . $destination . '/' . $value, $fileData['mimetype']));
             return $fileData;
         }
     }
     return false;
 }
开发者ID:michael-e,项目名称:importcsv,代码行数:41,代码来源:ImportDriver_upload.php


示例16: delete

 public function delete($section_id)
 {
     $query = "SELECT `id`, `sortorder` FROM tbl_sections WHERE `id` = '{$section_id}'";
     $details = Symphony::Database()->fetchRow(0, $query);
     ## Delete all the entries
     include_once TOOLKIT . '/class.entrymanager.php';
     $entryManager = new EntryManager($this->_Parent);
     $entries = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_entries` WHERE `section_id` = '{$section_id}'");
     $entryManager->delete($entries);
     ## Delete all the fields
     $fieldManager = new FieldManager($this->_Parent);
     $fields = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '{$section_id}'");
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $field_id) {
             $fieldManager->delete($field_id);
         }
     }
     ## Delete the section
     Symphony::Database()->delete('tbl_sections', " `id` = '{$section_id}'");
     ## Update the sort orders
     Symphony::Database()->query("UPDATE tbl_sections SET `sortorder` = (`sortorder` - 1) WHERE `sortorder` > '" . $details['sortorder'] . "'");
     ## Delete the section associations
     Symphony::Database()->delete('tbl_sections_association', " `parent_section_id` = '{$section_id}'");
     return true;
 }
开发者ID:aaronsalmon,项目名称:symphony-2,代码行数:25,代码来源:class.sectionmanager.php


示例17: view

 public function view()
 {
     $section_handle = (string) $this->context[0];
     $page = isset($this->context[1]) ? (int) $this->context[1] : 1;
     if (empty($section_handle)) {
         die('Invalid section handle');
     }
     $config = (object) Symphony::Configuration()->get('elasticsearch');
     ElasticSearch::init();
     $type = ElasticSearch::getTypeByHandle($section_handle);
     if ($page === 1) {
         // delete all documents in this index
         $query = new Elastica_Query(array('query' => array('match_all' => array())));
         $type->type->deleteByQuery($query);
     }
     // get new entries
     $em = new EntryManager(Symphony::Engine());
     $entries = $em->fetchByPage($page, $type->section->get('id'), (int) $config->{'reindex-batch-size'}, NULL, NULL, FALSE, FALSE, TRUE);
     foreach ($entries['records'] as $entry) {
         ElasticSearch::indexEntry($entry, $type->section);
     }
     $entries['total-entries'] = 0;
     // last page, count how many entries in the index
     if ($entries['remaining-pages'] == 0) {
         // wait a few seconds, allow HTTP requests to complete...
         sleep(5);
         $entries['total-entries'] = $type->type->count();
     }
     header('Content-type: application/json');
     echo json_encode(array('pagination' => array('total-pages' => (int) $entries['total-pages'], 'total-entries' => (int) $entries['total-entries'], 'remaining-pages' => (int) $entries['remaining-pages'], 'next-page' => $page + 1)));
     exit;
 }
开发者ID:nickdunn,项目名称:elasticsearch,代码行数:32,代码来源:content.reindex.php


示例18: convertToXML

 /**
  * Given a CSV file, generate a resulting XML tree
  *
  * @param  string $data
  * @return string
  */
 public static function convertToXML($data)
 {
     $headers = array();
     // Get CSV settings
     $settings = array('csv-delimiter' => ',', 'csv-enclosure' => '"', 'csv-escape' => '\\');
     $settings = array_merge($settings, (array) Symphony::Configuration()->get('remote_datasource'));
     // DOMDocument
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->formatOutput = true;
     $root = $doc->createElement('data');
     $doc->appendChild($root);
     foreach (str_getcsv($data, PHP_EOL) as $i => $row) {
         if (empty($row)) {
             continue;
         }
         if ($i == 0) {
             foreach (str_getcsv($row, $settings['csv-delimiter'], $settings['csv-enclosure'], $settings['csv-escape']) as $i => $head) {
                 if (class_exists('Lang')) {
                     $head = Lang::createHandle($head);
                 }
                 $headers[] = $head;
             }
         } else {
             self::addRow($doc, $root, str_getcsv($row, $settings['csv-delimiter'], $settings['csv-enclosure'], $settings['csv-escape']), $headers);
         }
     }
     $output = $doc->saveXML($doc->documentElement);
     return trim($output);
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:35,代码来源:class.csv.php


示例19: render

    public static function render($e)
    {
        $lines = NULL;
        foreach (self::__nearByLines($e->getLine(), $e->getFile()) as $line => $string) {
            $lines .= sprintf('%d: %s', ++$line, $string);
        }
        $trace = NULL;
        foreach ($e->getTrace() as $t) {
            $trace .= sprintf('[%s:%d] %s%s%s();' . "\n", isset($t['file']) ? $t['file'] : NULL, isset($t['line']) ? $t['line'] : NULL, isset($t['class']) ? $t['class'] : NULL, isset($t['type']) ? $t['type'] : NULL, $t['function']);
        }
        $queries = NULL;
        if (is_object(Symphony::Database())) {
            $debug = Symphony::Database()->debug();
            if (count($debug['query']) > 0) {
                foreach ($debug['query'] as $query) {
                    $queries .= sprintf('%s; [%01.4f]' . "\n", preg_replace('/[\\r\\n\\t]+/', ' ', $query['query']), isset($query['time']) ? $query['time'] : NULL);
                }
            }
        }
        return sprintf('%s: %s
			
An error occurred in %s around line %d
%s

Backtrace
===========================
%s

Database Query Log
===========================
%s', $e instanceof ErrorException ? GenericErrorHandler::$errorTypeStrings[$e->getSeverity()] : 'Fatal Error', $e->getMessage(), $e->getFile(), $e->getLine(), $lines, $trace, $queries);
    }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:32,代码来源:class.errorhandler.php


示例20: frontendPrePageResolve

 public function frontendPrePageResolve($context)
 {
     if (!self::$resolved) {
         // get languages from configuration
         if (self::$languages = Symphony::Configuration()->get('languages', 'multilingual')) {
             self::$languages = explode(',', str_replace(' ', '', self::$languages));
             // detect language from path
             if (preg_match('/^\\/([a-z]{2})\\//', $context['page'], $match)) {
                 // set language from path
                 self::$language = $match[1];
             } else {
                 // detect language from browser
                 self::$language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
             }
             // check if language is supported
             if (!in_array(self::$language, self::$languages)) {
                 // set to default otherwise
                 self::$language = self::$languages[0];
             }
             // redirect root page
             if (!$context['page']) {
                 header('Location: ' . URL . '/' . self::$language . '/');
                 exit;
             }
         }
         self::$resolved = true;
     }
 }
开发者ID:ShinShinman,项目名称:multilingual,代码行数:28,代码来源:extension.driver.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP SyncObject类代码示例发布时间:2022-05-23
下一篇:
PHP SymfonyRequirements类代码示例发布时间: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