本文整理汇总了PHP中Sanitize::stripAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Sanitize::stripAll方法的具体用法?PHP Sanitize::stripAll怎么用?PHP Sanitize::stripAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sanitize
的用法示例。
在下文中一共展示了Sanitize::stripAll方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _save
function _save($params)
{
$this->action = 'index';
$isNew = Sanitize::getInt($this->data['FieldOption'], 'optionid') ? false : true;
$text = Sanitize::getString($this->data['FieldOption'], 'text');
$value = Sanitize::stripAll($this->data['FieldOption'], 'value');
$field_id = Sanitize::getInt($this->data['FieldOption'], 'fieldid');
$location = Sanitize::getString($this->data, 'location', 'content');
$limit = $this->limit;
$limitstart = $this->offset;
$total = 0;
// Begin validation
$validation_ids = array();
$text == '' and $validation_ids[] = "option_text";
$value == '' and $validation_ids[] = "option_value";
if (!empty($validation_ids)) {
return json_encode(compact('validation_ids'));
}
// Begin save
$result = $this->FieldOption->save($this->data);
if ($result != 'success') {
$msg = "An option with this value already exists for this field.";
return $this->ajaxError($msg);
}
// Begin update display
$option_id = $this->data['FieldOption']['optionid'];
$field_id = $this->data['FieldOption']['fieldid'];
$rows = $this->FieldOption->getList($field_id, $limitstart, $limit, $total);
$this->_db->setQuery("\n SELECT \n fieldid,type,name,title,groupid,location \n FROM \n #__jreviews_fields \n WHERE \n fieldid = " . $field_id);
$field = current($this->_db->loadAssocList());
// Reloads the whole list to display the new/updated record
$page = Sanitize::stripWhitespace($this->listViewTable($rows, $total, $field));
$action = 'success';
return json_encode(compact('action', 'page', 'option_id'));
}
示例2: _addOption
function _addOption()
{
$this->autoRender = false;
$this->autoLayout = false;
$response = array();
$option = $this->data['FieldOption']['text'] = Sanitize::getString($this->data, 'text');
$value = $this->data['FieldOption']['value'] = Sanitize::stripAll($this->data, 'text');
$fieldid = $this->data['FieldOption']['fieldid'] = Sanitize::getInt($this->data, 'field_id');
$fieldName = Sanitize::getString($this->data, 'name');
// Begin validation
if ($value == '') {
$validation = __t("The field is empty.", true);
$response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\"> " . $validation . "</span>');";
return $this->ajaxResponse($response);
}
// Save
$result = $this->FieldOption->save($this->data);
switch ($result) {
case 'success':
// Begin update display
$option = $this->data['FieldOption']['text'];
$value = $this->data['FieldOption']['value'];
$response = "\n jQuery('#{$fieldName}').addOption('{$value}','" . addslashes($option) . "');\n jQuery('#jr_fieldOption{$fieldid}').val(''); \n jQuery('#submitButton{$fieldid}').removeAttr('disabled');\n ";
return $this->ajaxResponse($response);
case 'duplicate':
$validation = sprintf(__t("%s already exists", true), $value);
break;
case 'db_error':
$validation = s2Messages::submitErrorGeneric();
break;
}
$response[] = "jQuery('#{$fieldName}').selectOptions('" . addslashes($option) . "');";
$response[] = "jQuery('#jr_fieldOption{$fieldid}').siblings('.jr_loadingSmall').after('<span class=\"jr_validation\"> " . $validation . "</span>');";
return $this->ajaxResponse($response);
}
示例3: tmp1
public function tmp1()
{
$this->modelClass = null;
if ($this->request->data) {
$result = Sanitize::stripAll($this->request->data['text1']);
} else {
$result = "no data.";
}
$this->set("result", $result);
}
示例4: search
public function search()
{
if ($this->request->is('post')) {
$date = Sanitize::stripAll($this->request->data["SanmaData"]['date']);
$company = Sanitize::stripAll($this->request->data['SanmaData']['company']);
$person_c = Sanitize::stripAll($this->request->data['SanmaData']['person_c']);
$contact = Sanitize::stripAll($this->request->data['SanmaData']['contact']);
$person_m = Sanitize::stripAll($this->request->data['SanmaData']['person_m']);
$this->redirect("./table/" . $company . "/" . $person_c . "/" . $contact . "/" . $person_m);
} else {
$result = "no data.";
}
$this->set("result", $result);
}
示例5: index
public function index()
{
$details = false;
$mstr = @$this->request->query['mstr'];
$mid = @$this->request->query['mid'];
$kod = @$this->request->query['kod'];
$this->set('mstr', $mstr);
$this->set('mid', $mid);
$this->set('kod', $kod);
if ($kod) {
$code = $this->Dataobject->find('all', array('conditions' => array('dataset' => 'kody_pocztowe', 'kody_pocztowe.kod' => $kod)));
if ($code && $code[0]) {
return $this->redirect('/dane/kody_pocztowe/' . $code[0]->getId());
} else {
$this->Session->setFlash('Podany kod pocztowy nie zostały odnaleziony');
}
} elseif ($mid) {
$details = true;
$miejscowosc = $this->API->Dane()->getObject('miejscowosci', $mid);
$this->set('miejscowosc', $miejscowosc->getData());
$ustr = @$this->request->query['ustr'];
$this->set('ustr', $ustr);
if ($miejscowosc) {
$this->addStatusbarCrumb(array('text' => $miejscowosc->getData('nazwa')));
$adresy = $this->API->searchAddresses($miejscowosc->getId(), $ustr);
$this->set('adresy', $adresy);
}
} elseif ($mstr) {
$details = true;
$this->paginate = array('conditions' => array('dataset' => 'miejscowosci', 'q' => Sanitize::stripAll($mstr)), 'paramType' => 'querystring');
$miejscowosci = $this->Paginator->paginate('Dataobject');
$pagination = $this->Dataobject->pagination;
$total = $this->Dataobject->total;
if (!$total) {
$this->Session->setFlash('Podana miejscowość nie została odnaleziona');
} elseif ($total === 1 && ($mid = $miejscowosci[0]['Dataobject']->object_id)) {
$this->redirect('/kody_pocztowe?mstr=' . $mstr . '&mid=' . $mid);
} else {
$this->set('miejscowosci', $miejscowosci);
}
$this->set(compact('pagination', 'total'));
}
$this->set('details', $details);
$application = $this->getApplication();
$this->set('title_for_layout', $application['name']);
}
示例6: testStripAll
/**
* testStripAll method
*
* @return void
*/
public function testStripAll()
{
$string = '<img """><script>alert("xss")</script>"/>';
$expected = '"/>';
$result = Sanitize::stripAll($string);
$this->assertEquals($expected, $result);
$string = '<IMG SRC=javascript:alert('XSS')>';
$expected = '';
$result = Sanitize::stripAll($string);
$this->assertEquals($expected, $result);
$string = '<<script>alert("XSS");//<</script>';
$expected = '<';
$result = Sanitize::stripAll($string);
$this->assertEquals($expected, $result);
$string = '<img src="http://google.com/images/logo.gif" onload="window.location=\'http://sam.com/\'" />' . "\n" . "<p>This is ok \t\n text</p>\n" . '<link rel="stylesheet" href="/css/master.css" type="text/css" media="screen" title="my sheet" charset="utf-8">' . "\n" . '<script src="xss.js" type="text/javascript" charset="utf-8"></script>';
$expected = '<p>This is ok text</p>';
$result = Sanitize::stripAll($string);
$this->assertEquals($expected, $result);
}
示例7: admin_add
/**
* [ADMIN] 検索インデックス登録
*
* TODO 2013/8/8 ryuring
* この機能は、URLより、baserCMSで管理されたコンテンツのタイトルとコンテンツ本体を取得し、検索インデックスに登録する為の機能だったが、
* CakePHP2より、Viewの扱いが変更となった(ClassRegistryで管理されなくなった)為、requestAction 時のタイトルを取得できなくなった。
* よって機能自体を一旦廃止する事とする。
* 実装の際は、自動取得ではなく、手動で、タイトルとコンテンツ本体等を取得する仕様に変更する。
*
* @return void
* @access public
*/
public function admin_add()
{
$this->pageTitle = '検索インデックス登録';
if ($this->request->data) {
$url = $this->request->data['Content']['url'];
$url = str_replace(FULL_BASE_URL . $this->request->base, '', $url);
if (!$this->Content->find('count', array('conditions' => array('Content.url' => $url)))) {
// ルーティングのデフォルト設定を再読み込み(requestActionでルーティング設定がダブって登録されてしまう為)
Router::reload();
// URLのデータを取得
try {
$content = $this->requestAction($url, array('return' => 1));
} catch (Exception $e) {
$content = $e;
}
Router::reload();
// 元の設定を復元
Router::setRequestInfo($this->request);
if (!is_a($content, 'Exception')) {
$content = preg_replace('/<!-- BaserPageTagBegin -->.*?<!-- BaserPageTagEnd -->/is', '', $content);
} elseif (preg_match('/\\.html/', $url)) {
App::uses('HttpSocket', 'Network/Http');
$socket = new HttpSocket();
// ※ Router::url() では、スマートURLオフの場合、/app/webroot/ 内のURLが正常に取得できない
$HttpSocketResponse = $socket->get(siteUrl() . preg_replace('/^\\//', '', $url));
$code = $HttpSocketResponse->code;
if ($code != 200) {
unset($content);
} else {
if (preg_match('/<body>(.*?)<\\/body>/is', $HttpSocketResponse->body, $matches)) {
$content = $matches[1];
} else {
$content = '';
}
}
} else {
unset($content);
}
if (isset($content)) {
$content = Sanitize::stripAll($content);
$content = strip_tags($content);
$data = array('Content' => array('title' => $this->request->data['Content']['title'], 'detail' => $content, 'url' => $url, 'type' => 'その他', 'status' => true, 'priority' => 0.5));
$this->Content->create($data);
if ($this->Content->save()) {
$this->setMessage('検索インデックスに ' . $url . ' を追加しました。');
$this->redirect(array('action' => 'index'));
} else {
$this->setMessage('保存中にエラーが発生しました。', true);
}
} else {
$this->Content->invalidate('url', '入力したURLは存在しないか、検索インデックスに登録できるURLではありません。');
$this->setMessage('保存中にエラーが発生しました。', true);
}
} else {
$this->Content->invalidate('url', '既に登録済のURLです。');
$this->setMessage('入力エラーです。内容を修正してください。', true);
}
}
$this->help = 'contents_add';
}
示例8: onBeforeDisplayContent
function onBeforeDisplayContent(&$article, &$params)
{
if (!class_exists('cmsFramework')) {
return;
}
// Make sure this is a Joomla article page
$option = Sanitize::getString($_REQUEST, 'option', '');
$view = Sanitize::getString($_REQUEST, 'view', '');
$layout = Sanitize::getString($_REQUEST, 'layout', '');
$id = Sanitize::getInt($_REQUEST, 'id');
if (!($option == 'com_content' && $view == 'article' && $id)) {
return;
}
/**
* Retrieve $listing array from memory
*/
$_this =& cmsFramework::getInstance();
$Config = Configure::read('JreviewsSystem.Config');
$title = trim(Sanitize::getString($Config, 'type_metatitle'));
$keywords = trim(Sanitize::getString($Config, 'type_metakey'));
$description = trim(Sanitize::getString($Config, 'type_metadesc'));
$listing =& $_this->listing;
// Has all the data that's also available in the detail.thtml theme file so you can create any sort of conditionals with it
if ($title != '' || $keywords != '' || $description != '') {
if (isset($_this->listing) && is_array($_this->listing)) {
// Instantiate the CustomFields helper class
$CustomFields =& RegisterClass::getInstance('CustomFieldsHelper');
// Get and process all tags
$tags = plgContentJreviews::extractTags($title . $keywords . $description);
$tags_array = array();
foreach ($tags as $tag) {
switch ($tag) {
case 'title':
$tags_array['{title}'] = Sanitize::stripAll($listing['Listing'], 'title');
break;
case 'section':
$tags_array['{section}'] = Sanitize::stripAll($listing['Section'], 'title');
break;
case 'category':
$tags_array['{category}'] = Sanitize::stripAll($listing['Category'], 'title');
break;
case 'metakey':
$tags_array['{metakey}'] = Sanitize::stripAll($listing['Listing'], 'metakey');
break;
case 'metadesc':
$tags_array['{metadesc}'] = Sanitize::stripAll($listing['Listing'], 'metadesc');
break;
default:
if (substr($tag, 0, 3) == 'jr_') {
$field = $CustomFields->fieldText($tag, $listing, false, false, ',');
$tags_array['{' . $tag . '}'] = !empty($field) ? $field : '';
}
break;
}
}
# Process title
$title != '' and $title = str_replace(array_keys($tags_array), $tags_array, $title) and cmsFramework::meta('title', $title);
# Process description
$description != '' and $description = str_replace(array_keys($tags_array), $tags_array, $description) and cmsFramework::meta('description', $description);
# Process keywords
$keywords != '' and $keywords = str_replace(array_keys($tags_array), $tags_array, $keywords) and cmsFramework::meta('keywords', $keywords);
}
} elseif (isset($article->parameters) && $article->parameters->get('show_page_title') && $article->parameters->get('num_leading_articles') == '' && $article->parameters->get('filter_type') == '') {
$title = $article->parameters->get('page_title');
$title != '' and cmsFramework::meta('title', $title);
}
if (isset($_this->crumbs) && !empty($_this->crumbs)) {
cmsFramework::setPathway($_this->crumbs);
}
unset($_this);
}
示例9: admin_add
/**
* [ADMIN] 検索インデックス登録
*
* @return void
* @access public
*/
function admin_add()
{
$this->pageTitle = '検索インデックス コンテンツ登録';
if ($this->data) {
$url = $this->data['Content']['url'];
$url = str_replace(FULL_BASE_URL . $this->base, '', $url);
if (!$this->Content->find('count', array('conditions' => array('Content.url' => $url)))) {
// ルーティングのデフォルト設定を再読み込み(requestActionでルーティング設定がダブって登録されてしまう為)
Router::reload();
// URLのデータを取得
$content = $this->requestAction($url, array('return' => 1));
$View =& ClassRegistry::getObject('View');
// requestActionでインスタンス化されたViewを削除
// (管理システムではなく公開ページのView情報になっている可能性がある為)
ClassRegistry::removeObject('View');
// ルーティングのデフォルト設定を再読み込み(元の設定に復元する為)
Router::reload();
// 元の設定を復元
Router::setRequestInfo(array($this->params, array('base' => $this->base, 'webroot' => $this->webroot)));
$title = '';
if (!is_a($content, 'ErrorHandler')) {
$content = preg_replace('/<!-- BaserPageTagBegin -->.*?<!-- BaserPageTagEnd -->/is', '', $content);
$title = $View->pageTitle;
} elseif (preg_match('/\\.html/', $url)) {
App::import('Core', 'HttpSocket');
$socket = new HttpSocket();
// ※ Router::url() では、スマートURLオフの場合、/app/webroot/ 内のURLが正常に取得できない
$content = $socket->get(siteUrl() . $url);
$code = $socket->response['status']['code'];
if ($code != 200) {
unset($content);
} else {
if (preg_match('/<title>([^<]+)<\\/title>/', $content, $matches)) {
$title = $matches[1];
$content = preg_replace('/<title>[^<]+<\\/title>/', '', $content);
}
}
} else {
unset($content);
}
if (isset($content)) {
$content = Sanitize::stripAll($content);
$content = strip_tags($content);
$data = array('Content' => array('title' => $title, 'detail' => $content, 'url' => $url, 'type' => 'その他', 'status' => true, 'priority' => 0.5));
$this->Content->create($data);
if ($this->Content->save()) {
$this->Session->setFlash('検索インデックスに ' . $url . ' を追加しました。');
$this->redirect('index');
} else {
$this->Session->setFlash('保存中にエラーが発生しました。');
}
} else {
$this->Content->invalidate('url', '入力したURLは存在しないか、検索インデックスに登録できるURLではありません。');
$this->Session->setFlash('保存中にエラーが発生しました。');
}
} else {
$this->Content->invalidate('url', '既に登録済のURLです。');
$this->Session->setFlash('入力エラーです。内容を修正してください。');
}
}
}
示例10: _save
function _save()
{
/*******************************************************************
* This method is processed inside an iframe
* To access any of the DOM elements via jQuery it's necessary to prepend
* all jQuery calls with $parentFrame (i.e. $parentFrame.jQuery)
********************************************************************/
$this->autoRender = false;
$this->autoLayout = false;
$response = array();
$parentFrame = 'window.parent';
$validation = '';
$listing_id = Sanitize::getInt($this->data['Listing'], 'id', 0);
$isNew = $this->Listing->isNew = $listing_id == 0 ? true : false;
$this->data['email'] = Sanitize::getString($this->data, 'email');
$this->data['name'] = Sanitize::getString($this->data, 'name');
$this->data['categoryid_hidden'] = Sanitize::getInt($this->data['Listing'], 'categoryid_hidden');
$cat_id = Sanitize::getVar($this->data['Listing'], 'catid');
$this->data['Listing']['catid'] = is_array($cat_id) ? (int) array_pop(array_filter($cat_id)) : (int) $cat_id;
/*J16*/
$this->data['Listing']['title'] = Sanitize::getString($this->data['Listing'], 'title', '');
$this->data['Listing']['created_by_alias'] = Sanitize::getString($this->data, 'name', '');
if ($this->cmsVersion == CMS_JOOMLA15) {
$this->data['sectionid_hidden'] = Sanitize::getInt($this->data['Listing'], 'sectionid_hidden');
$this->data['Listing']['sectionid'] = Sanitize::getInt($this->data['Listing'], 'sectionid');
} else {
$this->data['Listing']['language'] = '*';
$this->data['Listing']['access'] = 1;
}
$category_id = $this->data['Listing']['catid'] ? $this->data['Listing']['catid'] : $this->data['categoryid_hidden'];
# Get criteria info
$criteria = $this->Criteria->findRow(array('conditions' => array('Criteria.id =
(SELECT criteriaid FROM #__jreviews_categories WHERE id = ' . (int) $category_id . ' AND `option` = "com_content")
')));
if (!$criteria) {
$validation = __t("The category selected is invalid.", true, true);
$response[] = "{$parentFrame}.jQuery('#jr_listingFormValidation').html('{$validation}');";
$response[] = "{$parentFrame}.jQuery('.button').removeAttr('disabled');";
$response[] = "{$parentFrame}.jQuery('.jr_loadingSmall').hide();";
return $this->makeJS($response);
}
$this->data['Criteria']['id'] = $criteria['Criteria']['criteria_id'];
# Override global configuration
isset($criteria['ListingType']) and $this->Config->override($criteria['ListingType']['config']);
# Perform access checks
if ($isNew && !$this->Access->canAddListing()) {
return $this->makeJS("{$parentFrame}.s2Alert('" . __t("You are not allowed to submit listings in this category.", true, true) . "')");
} elseif (!$isNew) {
$query = "SELECT created_by FROM #__content WHERE id = " . $listing_id;
$this->_db->setQuery($query);
$listing_owner = $this->_db->loadResult();
if (!$this->Access->canEditListing($listing_owner)) {
return $this->makeJS("{$parentFrame}.s2Alert('" . s2Messages::accessDenied() . "')");
}
}
# Load the notifications observer model component and initialize it.
# Done here so it only loads on save and not for all controlller actions.
$this->components = array('security', 'notifications');
$this->__initComponents();
if ($this->invalidToken == true) {
return $this->makeJS("{$parentFrame}.s2Alert('" . s2Messages::invalidToken() . "')");
}
# Override configuration
$category = $this->Category->findRow(array('conditions' => array('Category.id = ' . $this->data['Listing']['catid'])));
$this->Config->override($category['ListingType']['config']);
if ($this->Access->loadWysiwygEditor()) {
$this->data['Listing']['introtext'] = Sanitize::stripScripts(Sanitize::stripWhitespace(Sanitize::getVar($this->data['__raw']['Listing'], 'introtext')));
$this->data['Listing']['fulltext'] = Sanitize::stripScripts(Sanitize::stripWhitespace(Sanitize::getVar($this->data['__raw']['Listing'], 'fulltext')));
$this->data['Listing']['introtext'] = html_entity_decode($this->data['Listing']['introtext'], ENT_QUOTES, cmsFramework::getCharset());
$this->data['Listing']['fulltext'] = html_entity_decode($this->data['Listing']['fulltext'], ENT_QUOTES, cmsFramework::getCharset());
} else {
$this->data['Listing']['introtext'] = Sanitize::stripAll($this->data['Listing'], 'introtext', '');
if (isset($this->data['Listing']['fulltext'])) {
$this->data['Listing']['fulltext'] = Sanitize::stripAll($this->data['Listing'], 'fulltext', '');
} else {
$this->data['Listing']['fulltext'] = '';
}
}
$this->data['Listing']['introtext'] = str_replace('<br>', '<br />', $this->data['Listing']['introtext']);
$this->data['Listing']['fulltext'] = str_replace('<br>', '<br />', $this->data['Listing']['fulltext']);
if ($this->Access->canAddMeta()) {
$this->data['Listing']['metadesc'] = Sanitize::getString($this->data['Listing'], 'metadesc');
$this->data['Listing']['metakey'] = Sanitize::getString($this->data['Listing'], 'metakey');
}
// Title alias handling
$slug = '';
$alias = Sanitize::getString($this->data['Listing'], 'alias');
if ($isNew && $alias == '') {
$slug = S2Router::sefUrlEncode($this->data['Listing']['title']);
if (trim(str_replace('-', '', $slug)) == '') {
$slug = date("Y-m-d-H-i-s");
}
} elseif ($alias != '') {
// Alias filled in so we convert it to a valid alias
$slug = S2Router::sefUrlEncode($alias);
if (trim(str_replace('-', '', $slug)) == '') {
$slug = date("Y-m-d-H-i-s");
}
}
$slug != '' and $this->data['Listing']['alias'] = $slug;
//.........这里部分代码省略.........
示例11: facebookOpenGraph
/**
* Facebook Open Graph implementation
*
* @param mixed $listing
* @param mixed $meta
*/
function facebookOpenGraph(&$listing, $meta)
{
// http://developers.facebook.com/docs/opengraph/
$option = Sanitize::getString($_REQUEST, 'option', '');
$view = Sanitize::getString($_REQUEST, 'view', '');
$id = Sanitize::getInt($_REQUEST, 'id');
// Make sure this is a Joomla article page
if (!($option == 'com_content' && $view == 'article' && $id)) {
return;
}
$Config = Configure::read('JreviewsSystem.Config');
if (empty($Config)) {
$cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
$Config = S2Cache::read($cache_file);
}
$facebook_xfbml = Sanitize::getBool($Config, 'facebook_opengraph') && Sanitize::getBool($Config, 'facebook_appid');
// Make sure FB is enabled and we have an FB App Id
if (!$facebook_xfbml) {
return;
}
extract($meta);
$title == '' and $title = $listing['Listing']['title'];
$description == '' and $description = Sanitize::htmlClean(Sanitize::stripAll($listing['Listing'], 'summary'));
$image = isset($listing['Listing']['images'][0]) ? cmsFramework::makeAbsUrl(_DS . _JR_WWW_IMAGES . $listing['Listing']['images'][0]['path']) : null;
if (!$image) {
$img_src = '/<img[^>]+src[\\s=\'"]+([^"\'>\\s]+(jpg)+)/is';
preg_match($img_src, $listing['Listing']['summary'], $matches);
if (isset($matches[1])) {
$image = $matches[1];
}
}
$url = cmsFramework::makeAbsUrl($listing['Listing']['url'], array('sef' => true, 'ampreplace' => true));
$fields = $listing['Field']['pairs'];
// You can add other Open Graph meta tags by adding the attribute, custom field pair to the array below
$tags = array('title' => $title, 'url' => $url, 'image' => $image, 'site_name' => cmsFramework::getConfig('sitename'), 'description' => $description, 'type' => Sanitize::getString($listing['ListingType']['config'], 'facebook_opengraph_type'), 'latitude' => Sanitize::getString($Config, 'geomaps.latitude'), 'longitude' => Sanitize::getString($Config, 'geomaps.longitude'), 'street-address' => Sanitize::getString($Config, 'geomaps.address1'), 'locality' => Sanitize::getString($Config, 'geomaps.city'), 'region' => Sanitize::getString($Config, 'geomaps.state'), 'postal-code' => Sanitize::getString($Config, 'geomaps.postal_code'), 'country-name' => Sanitize::getString($Config, 'geomaps.country', Sanitize::getString($Config, 'geomaps.default_country')));
cmsFramework::addScript('<meta property="fb:app_id" content="' . Sanitize::getString($Config, 'facebook_appid') . '"/>');
Sanitize::getString($Config, 'facebook_admins') != '' and cmsFramework::addScript('<meta property="fb:admins" content="' . str_replace(' ', '', $Config->facebook_admins) . '"/>');
// cmsFramework::addScript('<meta property="fb:admins" content="YOUR-ADMIN-ID"/>'); // It's app_id or this, not both
# Loop through the tags array to add the additional FB meta tags
foreach ($tags as $attr => $fname) {
$content = '';
if (substr($fname, 0, 3) == 'jr_') {
// It's a custom field
$content = isset($fields[$fname]) ? htmlspecialchars($fields[$fname]['text'][0], ENT_QUOTES, 'utf-8') : '';
} elseif ($fname != '') {
// It's a static text, not a custom field
$content = htmlspecialchars($fname);
}
$content != '' and cmsFramework::addScript('<meta property="og:' . $attr . '" content="' . $content . '"/>');
}
}
示例12: processNewFieldOptions
function processNewFieldOptions($options, $field)
{
$processedOptions = array();
// Process new field options and modify the $data array
$FieldOption = ClassRegistry::getClass('FieldOptionModel');
$click2add = Sanitize::getBool($field['_params'], 'click2add');
!is_array($options) and $options = array($options);
foreach ($options as $option) {
if ($click2add && strstr($option, '|click2add')) {
$data = array();
$option_parts = explode('|', $option);
// Build array to pass to the FieldOptions model
$data['FieldOption']['fieldid'] = Sanitize::getInt($field, 'fieldid');
$data['FieldOption']['value'] = Sanitize::stripAll($option_parts, 0);
$data['FieldOption']['text'] = trim(Sanitize::getString($option_parts, 0));
// If it's a dependent field add the relevant control field data
if (count($option_parts) == 4) {
$option_parts[3] == 'null' and $option_parts[3] = '';
$controlledBy = $data['FieldOption']['controlledBy'] = array($option_parts[2] => $option_parts[3]);
$control_field = key($controlledBy);
$control_value = is_array(current($controlledBy)) ? array_values(current($controlledBy)) : array(current($controlledBy));
if ($control_field != '' && $control_value != '**') {
$data['FieldOption']['control_field'] = $control_field;
$data['FieldOption']['control_value'] = $control_value;
}
}
if (in_array($FieldOption->save($data), array('success', 'duplicate'))) {
$processedOptions[] = $data['FieldOption']['value'];
}
} else {
$processedOptions[] = $option;
}
}
return $processedOptions;
}