当前位置: 首页>>代码示例>>PHP>>正文


PHP General::sanitize方法代码示例

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


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

示例1: view

 public function view()
 {
     $this->setPageType('table');
     $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create new formatter'), 'create button'));
     $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col'));
     $aTableBody = array();
     $formatters = $this->_driver->listAll();
     if (!is_array($formatters) || empty($formatters)) {
         $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead)))));
     } else {
         $tfm = new TextformatterManager($this->_Parent);
         foreach ($formatters as $id => $data) {
             $formatter = $tfm->create($id);
             $about = $formatter->about();
             $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name']));
             $td2 = Widget::TableData($about['templatedtextformatters-type']);
             $td3 = Widget::TableData(General::sanitize($about['description']));
             $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox'));
             // Add a row to the body array, assigning each cell to the row
             $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3));
         }
     }
     $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable');
     $this->Form->appendChild($table);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete')));
     $div->appendChild(Widget::Select('with-selected', $options));
     $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($div);
 }
开发者ID:holdensmagicalunicorn,项目名称:templatedtextformatters,代码行数:31,代码来源:content.index.php

示例2: render

 public static function render($e)
 {
     if (is_null($e->getTemplatePath())) {
         header('HTTP/1.0 500 Server Error');
         echo '<h1>Symphony Fatal Error</h1><p>' . $e->getMessage() . '</p>';
         exit;
     }
     $xml = new DOMDocument('1.0', 'utf-8');
     $xml->formatOutput = true;
     $root = $xml->createElement('data');
     $xml->appendChild($root);
     $root->appendChild($xml->createElement('heading', General::sanitize($e->getHeading())));
     $root->appendChild($xml->createElement('message', General::sanitize($e->getMessageObject() instanceof SymphonyDOMElement ? (string) $e->getMessageObject() : trim($e->getMessage()))));
     if (!is_null($e->getDescription())) {
         $root->appendChild($xml->createElement('description', General::sanitize($e->getDescription())));
     }
     header('HTTP/1.0 500 Server Error');
     header('Content-Type: text/html; charset=UTF-8');
     header('Symphony-Error-Type: ' . $e->getErrorType());
     foreach ($e->getHeaders() as $header) {
         header($header);
     }
     $output = parent::__transform($xml, basename($e->getTemplatePath()));
     header(sprintf('Content-Length: %d', strlen($output)));
     echo $output;
     exit;
 }
开发者ID:pointybeard,项目名称:symphony-3,代码行数:27,代码来源:class.symphony.php

示例3: view

 public function view()
 {
     $params = array();
     $filter = $_GET['filter'];
     if ($_GET['template']) {
         $this->template = General::sanitize($_GET['template']);
     }
     // Environment parameters
     if ($filter == 'env') {
         $params = array_merge($params, $this->__getEnvParams());
         // Page parameters
     } elseif ($filter == 'page') {
         $params = array_merge($params, $this->__getPageParams());
         // Data source parameters
     } elseif ($filter == 'ds') {
         $params = array_merge($params, $this->__getDSParams());
         // All parameters
     } else {
         $params = array_merge($params, $this->__getEnvParams());
         $params = array_merge($params, $this->__getPageParams());
         $params = array_merge($params, $this->__getDSParams());
     }
     sort($params);
     $this->_Result = $params;
 }
开发者ID:valery,项目名称:symphony-2,代码行数:25,代码来源:content.ajaxparameters.php

示例4: grab

 public function grab(&$param_pool)
 {
     $result = new XMLElement($this->dsParamROOTELEMENT);
     foreach ($this->_env as $key => $value) {
         switch ($key) {
             case 'param':
                 //$group = new XMLElement('params');
                 foreach ($this->_env[$key] as $key => $value) {
                     $param = new XMLElement($key, General::sanitize($value));
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
             case 'env':
                 //$group = new XMLElement('pool');
                 foreach ($this->_env[$key]['pool'] as $key => $value) {
                     $param = new XMLElement($key);
                     if (is_array($value)) {
                         $param->setAttribute('count', count($value));
                         foreach ($value as $key => $value) {
                             $item = new XMLElement('item', General::sanitize($value));
                             $item->setAttribute('handle', Lang::createHandle($value));
                             $param->appendChild($item);
                         }
                     } else {
                         $param->setValue(General::sanitize($value));
                     }
                     $result->appendChild($param);
                 }
                 //$result->appendChild($group);
                 break;
         }
     }
     return $result;
 }
开发者ID:ErisDS,项目名称:Bugaroo,代码行数:35,代码来源:data.zzz_param_pool.php

示例5: __viewShow

		public function __viewShow() {
			$this->setPageType('form');
			$title = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $this->_log->request_time);
			$this->setTitle("Redirection Manager &ndash; {$title}");
			$this->appendSubheading("<a href=\"{$this->_uri}/logs/\">Redirection Logs</a> &mdash; {$title}");
			
			$values = unserialize($this->_log->request_args);
			
			foreach ($values as $type => $array) {
				if (!empty($array)) {
					$type = strtoupper($type);
					
					$fieldset = new XMLElement('fieldset');
					$fieldset->setAttribute('class', 'settings');
					$fieldset->appendChild(new XMLElement('legend', "{$type} Values"));
					
					$pre = new XMLElement('pre');
					$code = new XMLElement('code');
					
					ob_start();
					print_r($array);
					
					$code->setValue(General::sanitize(ob_get_clean()));
					
					$pre->appendChild($code);
					$fieldset->appendChild($pre);
					
					$this->Form->appendChild($fieldset);
				}
			}
		}
开发者ID:nick-ryall,项目名称:redirection_manager,代码行数:31,代码来源:content.logs.php

示例6: parseInput

 private function parseInput()
 {
     $query = General::sanitize($_REQUEST['q']);
     $this->forceOverwrite = isset($_REQUEST['force']) && General::sanitize($_REQUEST['force']) == 'true';
     if (empty($query)) {
         throw new Exception(__('Query cannot be empty'));
     } else {
         if (strpos($query, 'zipball') !== FALSE || strpos($query, '.zip') !== FALSE) {
             // full url
             $this->downloadUrl = $query;
             $this->extensionHandle = self::handleFromPath($query);
         } else {
             if (strpos($query, '/') !== FALSE) {
                 $this->extensionHandle = self::handleFromPath($query);
                 $this->downloadUrl = "https://github.com/{$query}/zipball/master";
             } else {
                 // do a search for this handle
                 $this->searchExtension($query);
             }
         }
     }
     // check if directory exists
     $this->alreadyExists = file_exists($this->getDestinationDirectory());
     if (!$this->forceOverwrite && $this->alreadyExists) {
         throw new Exception(__('Extension %s already exists', array($this->extensionHandle)));
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:27,代码来源:content.download.php

示例7: action

 function action()
 {
     if (@array_key_exists('save', $_POST['action'])) {
         $this->_errors = array();
         // Polish up some field content
         $fields = $_POST['fields'];
         if (isset($fields['pages'])) {
             $fields['pages'] = implode(',', $fields['pages']);
         }
         $fields['content_formatted'] = DocumentationForm::applyFormatting($fields['content'], true, $this->_errors);
         if ($fields['content_formatted'] === false) {
             $fields['content_formatted'] = General::sanitize(DocumentationForm::applyFormatting($fields['content']));
         }
         if (!isset($fields['title']) || trim($fields['title']) == '') {
             $this->_errors['title'] = __('Title is a required field');
         }
         if (!isset($fields['pages']) || trim($fields['pages']) == '') {
             $this->_errors['pages'] = __('Page is a required field');
         }
         if (!isset($fields['content']) || trim($fields['content']) == '') {
             $this->_errors['content'] = __('Content is a required field');
         }
         if (empty($this->_errors)) {
             if (!Symphony::Database()->insert($fields, 'tbl_documentation')) {
                 $this->pageAlert(__('Unknown errors occurred while attempting to save. Please check your <a href="%s">activity log</a>.', array(URL . '/symphony/system/log/')), Alert::ERROR);
             } else {
                 $doc_id = Symphony::Database()->getInsertID();
                 redirect(URL . "/symphony/extension/documenter/edit/{$doc_id}/created/");
             }
         }
     }
     if (is_array($this->_errors) && !empty($this->_errors)) {
         $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
     }
 }
开发者ID:symphonists,项目名称:documenter,代码行数:35,代码来源:content.new.php

示例8: view

 public function view()
 {
     $name = General::sanitize($_REQUEST['name']);
     $section = General::sanitize($_REQUEST['section']);
     $filters = self::processFilters($_REQUEST['filters']);
     $rootelement = Lang::createHandle($name);
     $doc_parts = array();
     // Add Documentation (Success/Failure)
     $this->addEntrySuccessDoc($doc_parts, $rootelement, $filters);
     $this->addEntryFailureDoc($doc_parts, $rootelement, $filters);
     // Filters
     $this->addDefaultFiltersDoc($doc_parts, $rootelement, $filters);
     // Frontend Markup
     $this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters);
     $this->addSendMailFilterDoc($doc_parts, $filters);
     /**
      * Allows adding documentation for new filters. A reference to the $documentation
      * array is provided, along with selected filters
      *
      * @delegate AppendEventFilterDocumentation
      * @param string $context
      * '/blueprints/events/(edit|new|info)/'
      * @param array $selected
      *  An array of all the selected filters for this Event
      * @param array $documentation
      *  An array of all the documentation XMLElements, passed by reference
      * @param string $rootelment
      *  The name of this event, as a handle.
      */
     Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/', array('selected' => $filters, 'documentation' => &$doc_parts, 'rootelement' => $rootelement));
     $documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts));
     $documentation = str_replace('\'', '\\\'', $documentation);
     $documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>';
     $this->_Result = $documentation;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:35,代码来源:content.ajaxeventdocumentation.php

示例9: __buildPageXML

 public function __buildPageXML($page, $page_types, $qf)
 {
     $lang_code = FLang::getLangCode();
     $oPage = new XMLElement('page');
     $oPage->setAttribute('handle', $page['handle']);
     $oPage->setAttribute('id', $page['id']);
     // keep current first
     $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lang_code]), array('lang' => $lang_code, 'handle' => $page['plh_h-' . $lang_code])));
     // add others
     foreach (FLang::getLangs() as $lc) {
         if ($lang_code != $lc) {
             $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lc]), array('lang' => $lc, 'handle' => $page['plh_h-' . $lc])));
         }
     }
     if (in_array($page['id'], array_keys($page_types))) {
         $xTypes = new XMLElement('types');
         foreach ($page_types[$page['id']] as $type) {
             $xTypes->appendChild(new XMLElement('type', $type));
         }
         $oPage->appendChild($xTypes);
     }
     if ($page['children'] != '0') {
         if ($children = PageManager::fetch(false, array($qf . 'id, handle, title'), array(sprintf('`parent` = %d', $page['id'])))) {
             foreach ($children as $c) {
                 $oPage->appendChild($this->__buildPageXML($c, $page_types, $qf));
             }
         }
     }
     return $oPage;
 }
开发者ID:siimsoni,项目名称:page_lhandles,代码行数:30,代码来源:class.datasource.MultilingualNavigation.php

示例10: appendFormattedElement

 public function appendFormattedElement(&$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL)
 {
     if (is_null($data) || !is_array($data) || is_null($data['value'])) {
         return;
     }
     $wrapper->appendChild(new XMLElement($this->get('element_name'), $encode ? General::sanitize($data['value']) : $data['value'], array('handle' => $data['handle'])));
 }
开发者ID:symphonists,项目名称:html_panel,代码行数:7,代码来源:field.html_panel.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: displayPublishPanel

 function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null)
 {
     $note = isset($data['value']) ? $data['value'] : $this->get('note');
     $editable = $this->get('editable');
     # Add <div>
     $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
     $wrapper->appendChild($div);
     # Editable
     if (isset($editable) && $editable) {
         $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
         $edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit"));
         $wrapper->appendChild($edit);
         # Add <textarea>
         $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
         $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL);
         $label->appendChild($textarea);
         $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
         $label->appendChild($control);
         if ($flagWithError != NULL) {
             $wrapper->appendChild(Widget::Error($label, $flagWithError));
         } else {
             $wrapper->appendChild($label);
         }
     }
 }
开发者ID:hotdoy,项目名称:EDclock,代码行数:25,代码来源:field.publishnotes.php

示例13: get

 public static function get()
 {
     $response = new XMLElement('response');
     foreach (self::$_sections as $section) {
         $section_xml = new XMLElement('section');
         $meta = $section->get();
         foreach ($meta as $key => $value) {
             $section_xml->setAttribute(Lang::createHandle($key), $value);
         }
         $fields = $section->fetchFields();
         foreach ($fields as $field) {
             $meta = $field->get();
             unset($meta['field_id']);
             $field_xml = new XMLElement($meta['element_name'], null);
             foreach (self::$_field_attributes as $attr) {
                 $field_xml->setAttribute(Lang::createHandle($attr), $meta[$attr]);
             }
             foreach ($meta as $key => $value) {
                 if (in_array($key, self::$_field_attributes)) {
                     continue;
                 }
                 $value = General::sanitize($value);
                 if ($value != '') {
                     $field_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value)));
                 }
             }
             $section_xml->appendChild($field_xml);
         }
         $response->appendChild($section_xml);
     }
     REST_API::sendOutput($response);
 }
开发者ID:MST-SymphonyCMS,项目名称:rest_api,代码行数:32,代码来源:rest.sections.php

示例14: sort

 /**
  * This method is invoked from the `Sortable` class and it contains the
  * logic for sorting (or unsorting) the resource index. It provides a basic
  * wrapper to the `ResourceManager`'s `fetch()` method.
  *
  * @see toolkit.ResourceManager#getSortingField
  * @see toolkit.ResourceManager#getSortingOrder
  * @see toolkit.ResourceManager#fetch
  * @param string $sort
  *  The field to sort on which should match one of the table's column names.
  *  If this is not provided the default will be determined by
  *  `ResourceManager::getSortingField`
  * @param string $order
  *  The direction to sort in, either 'asc' or 'desc'. If this is not provided
  *  the value will be determined by `ResourceManager::getSortingOrder`.
  * @param array $params
  *  An associative array of params (usually populated from the URL) that this
  *  function uses. The current implementation will use `type` and `unsort` keys
  * @throws Exception
  * @throws SymphonyErrorPage
  * @return array
  *  An associative of the resource as determined by `ResourceManager::fetch`
  */
 public function sort(&$sort, &$order, array $params)
 {
     $type = $params['type'];
     if (!is_null($sort)) {
         General::sanitize($sort);
     }
     // If `?unsort` is appended to the URL, then sorting information are reverted
     // to their defaults
     if (isset($params['unsort'])) {
         ResourceManager::setSortingField($type, 'name', false);
         ResourceManager::setSortingOrder($type, 'asc');
         redirect(Administration::instance()->getCurrentPageURL());
     }
     // By default, sorting information are retrieved from
     // the filesystem and stored inside the `Configuration` object
     if (is_null($sort) && is_null($order)) {
         $sort = ResourceManager::getSortingField($type);
         $order = ResourceManager::getSortingOrder($type);
         // If the sorting field or order differs from what is saved,
         // update the config file and reload the page
     } elseif ($sort !== ResourceManager::getSortingField($type) || $order !== ResourceManager::getSortingOrder($type)) {
         ResourceManager::setSortingField($type, $sort, false);
         ResourceManager::setSortingOrder($type, $order);
         redirect(Administration::instance()->getCurrentPageURL());
     }
     return ResourceManager::fetch($params['type'], array(), array(), $sort . ' ' . $order);
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:50,代码来源:class.resourcespage.php

示例15: view

 public function view()
 {
     $params = array();
     $filter = $_GET['query'];
     if ($_GET['template']) {
         $this->template = General::sanitize($_GET['template']);
     }
     // Environment parameters
     if ($filter == 'env') {
         $params = array_merge($params, $this->__getEnvParams());
         // Page parameters
     } elseif ($filter == 'page') {
         $params = array_merge($params, $this->__getPageParams());
         // Data source parameters
     } elseif ($filter == 'ds') {
         $params = array_merge($params, $this->__getDSParams());
         // All parameters
     } else {
         $params = array_merge($params, $this->__getEnvParams());
         $params = array_merge($params, $this->__getPageParams());
         $params = array_merge($params, $this->__getDSParams());
     }
     foreach ($params as $param) {
         if (empty($filter) || strripos($param, $filter) !== false) {
             $this->_Result[] = $param;
         }
     }
     sort($this->_Result);
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:29,代码来源:content.ajaxparameters.php


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