本文整理汇总了PHP中convertStringToArray函数的典型用法代码示例。如果您正苦于以下问题:PHP convertStringToArray函数的具体用法?PHP convertStringToArray怎么用?PHP convertStringToArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了convertStringToArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace_glossary_tag
function replace_glossary_tag($matches)
{
global $content;
$inner = trim($matches[2]);
// search keyword in glossary table
$keyword = trim($matches[1]);
if ($keyword !== '') {
$keyword = html_entity_decode($keyword, ENT_QUOTES, PHPWCMS_CHARSET);
// check against cache
if (!isset($content['glossary_cache'][$keyword])) {
$like = aporeplace($keyword);
$where = 'glossary_status=1 AND glossary_highlight=1 AND (';
$where .= "glossary_keyword LIKE '" . $like . "' OR ";
$where .= "glossary_keyword LIKE '" . $like . ",%' OR ";
$where .= "glossary_keyword LIKE '%, " . $like . ",%' OR ";
$where .= "glossary_keyword LIKE '%, " . $like . "'";
$where .= ')';
// retrieve only single keyword that matches best
$entry = _dbGet('phpwcms_glossary', 'glossary_title, glossary_keyword, glossary_text, COUNT(glossary_id) AS count_all', $where, 'glossary_id', 'count_all DESC', '1');
if (isset($entry[0])) {
// get keywords to store each in cache
$keywords = convertStringToArray($entry[0]['glossary_keyword']);
$title = empty($entry[0]['glossary_title']) ? $inner : html($entry[0]['glossary_title']);
$text = trim(clean_slweg($entry[0]['glossary_text']));
// store glossary item in cache
foreach ($keywords as $key) {
$content['glossary_cache'][$key] = array('title' => $title, 'text' => $text);
}
}
}
// create ABBR
if (isset($content['glossary_cache'][$keyword])) {
$inner = '<abbr class="glossary" title="' . $content['glossary_cache'][$keyword]['title'] . ' :: ' . $content['glossary_cache'][$keyword]['text'] . '">' . $inner . '</abbr>';
}
}
return $inner;
}
示例2: intval
if (isset($_GET['page'])) {
$_SESSION['seolog_page'] = intval($_GET['page']);
}
// set default values for paginating
if (empty($_SESSION['list_user_count'])) {
$_SESSION['list_user_count'] = 25;
}
// paginate and search form processing
if (isset($_POST['do_pagination'])) {
$_SESSION['list_active'] = empty($_POST['showactive']) ? 0 : 1;
$_SESSION['list_inactive'] = empty($_POST['showinactive']) ? 0 : 1;
$_SESSION['filter_seo'] = clean_slweg($_POST['filter']);
if (empty($_SESSION['filter_seo'])) {
unset($_SESSION['filter_seo']);
} else {
$_SESSION['filter_seo'] = convertStringToArray($_SESSION['filter_seo'], ' ');
$_POST['filter'] = $_SESSION['filter_seo'];
}
$_SESSION['seolog_page'] = intval($_POST['page']);
}
if (empty($_SESSION['seolog_page'])) {
$_SESSION['seolog_page'] = 1;
}
$_entry['list_active'] = isset($_SESSION['list_active']) ? $_SESSION['list_active'] : 1;
$_entry['list_inactive'] = isset($_SESSION['list_inactive']) ? $_SESSION['list_inactive'] : 1;
$_entry['query'] = '';
if (isset($_SESSION['filter_seo']) && is_array($_SESSION['filter_seo']) && count($_SESSION['filter_seo'])) {
$_entry['filter_array'] = array();
foreach ($_SESSION['filter_seo'] as $_entry['filter']) {
//usr_name, usr_login, usr_email
$_entry['filter_array'][] = "CONCAT(domain,query) LIKE '%" . aporeplace($_entry['filter']) . "%'";
示例3: sanitize_filename
} else {
$fileName = sanitize_filename($_FILES["file"]["name"]);
$fileExt = check_image_extension($_FILES["file"]["tmp_name"], $fileName);
$fileExt = $fileExt === false ? which_ext($fileName) : $fileExt;
$fileHash = md5($fileName . microtime());
$fileType = is_mimetype_format($_FILES["file"]["type"]) ? $_FILES["file"]["type"] : get_mimetype_by_extension($fileExt);
$fileSize = intval($_FILES["file"]["size"]);
// Check against forbidden file names
$forbiddenUploadName = array('.htaccess', 'web.config', 'lighttpd.conf', 'nginx.conf');
if (in_array(strtolower($fileName), $forbiddenUploadName)) {
$file_error["file"] = sprintf($BL['be_fprivup_err7'], $fileName);
}
// Only allowed file extensions
if (empty($file_error["file"])) {
if (is_string($phpwcms['allowed_upload_ext'])) {
$phpwcms['allowed_upload_ext'] = convertStringToArray(strtolower($phpwcms['allowed_upload_ext']));
}
if ($fileExt === '') {
$file_error["file"] = sprintf($BL['be_fprivup_err9'], implode(', ', $phpwcms['allowed_upload_ext']));
} elseif (is_array($phpwcms['allowed_upload_ext']) && count($phpwcms['allowed_upload_ext']) && !in_array(strtolower($fileExt), $phpwcms['allowed_upload_ext'])) {
$file_error["file"] = sprintf($BL['be_fprivup_err8'], strtoupper($fileName), implode(', ', $phpwcms['allowed_upload_ext']));
}
}
}
if (empty($file_error)) {
if (isset($file_vars)) {
$fileVarsField = ',f_vars';
$fileVarsValue = ',' . _dbEscape(serialize($file_vars));
} else {
$fileVarsField = '';
$fileVarsValue = '';
示例4: initJSPlugin
/**
* Simple MooTools Plugin Loader
*/
function initJSPlugin($plugin = '', $more = false)
{
// enhance teplate JS parser for MooTools More
// sample: <!-- JS: MORE:Fx/Fx.Elements,Fx/Fx.Accordion -->
if (is_string($plugin) && $more === false && substr(strtoupper($plugin), 0, 5) == 'MORE:') {
$plugin = trim(substr($plugin, 5));
$more = true;
}
if ($more === false) {
$plugin = 'mootools.' . $plugin . '.js';
if (empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
initJSLib();
$GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH . 'lib/mootools/plugin-1.4/' . $plugin);
}
} else {
// Load MooTools More Plugins - simple Wrapper 'Fx/Fx.Slide,Fx/Fx.Scroll...'
// it does not check dependents
if (!is_array($plugin)) {
$plugin = convertStringToArray($plugin);
}
if (count($plugin)) {
initJSLib();
// add mootools more core
array_unshift($plugin, 'More/More');
foreach ($plugin as $more) {
if (empty($GLOBALS['block']['custom_htmlhead'][$more]) && is_file(PHPWCMS_TEMPLATE . 'lib/mootools/more-1.4/' . $more . '.js')) {
$GLOBALS['block']['custom_htmlhead'][$more] = getJavaScriptSourceLink(TEMPLATE_PATH . 'lib/mootools/more-1.4/' . $more . '.js');
}
}
}
}
return TRUE;
}
示例5: sanitize_multiple_emails
function sanitize_multiple_emails($string)
{
$string = preg_replace('/\\s|\\,]/', ';', $string);
$string = convertStringToArray($string, ';');
$string = implode(';', $string);
return $string;
}
示例6: intval
$content["guestbook"]["aliasID"] = intval($_POST["cguestbook_aliasID"]);
if (!$content["guestbook"]["aliasID"]) {
$content["guestbook"]["aliasID"] = '';
}
$content["guestbook"]["time"] = intval($_POST["cguestbook_time"]);
$content["guestbook"]["cookie"] = empty($_POST["cguestbook_cookie"]) ? 0 : 1;
$content["guestbook"]["captcha"] = empty($_POST["cguestbook_captcha"]) ? 0 : 1;
$content["guestbook"]["gb_login_show"] = empty($_POST["cguestbook_login_show"]) ? 0 : 1;
$content["guestbook"]["gb_login_post"] = empty($_POST["cguestbook_login_post"]) ? 0 : 1;
$content["guestbook"]["gb_urlcheck"] = empty($_POST["cguestbook_urlcheck"]) ? 0 : 1;
$content["guestbook"]["notify"] = empty($_POST["cguestbook_notify"]) ? 0 : 1;
$content["guestbook"]["notify_email"] = clean_slweg($_POST["cguestbook_notify_email"]);
if (empty($content["guestbook"]["notify_email"])) {
$content["guestbook"]["notify"] = 0;
} else {
$content["guestbook"]["notify_email"] = convertStringToArray(str_replace(',', ';', $content["guestbook"]["notify_email"]), ';');
foreach ($content["guestbook"]["notify_email"] as $key => $item) {
if (!is_valid_email($item)) {
unset($content["guestbook"]["notify_email"][$key]);
}
}
$content["guestbook"]["notify_email"] = implode(';', $content["guestbook"]["notify_email"]);
if ($content["guestbook"]["notify_email"] == '') {
$content["guestbook"]["notify"] = 0;
}
}
$content["guestbook"]["captcha_maxchar"] = intval($_POST['cguestbook_captchamaxchar']);
if (!$content["guestbook"]["captcha_maxchar"]) {
$content["guestbook"]["captcha_maxchar"] = 5;
} elseif ($content["guestbook"]["captcha_maxchar"] > 15) {
$content["guestbook"]["captcha_maxchar"] = 15;
示例7: preg_replace_callback
}
// render JavaScript Plugins and/or JavaScript scripts that should be loaded in <head>
$content['all'] = preg_replace_callback('/<!--\\s+JS:(.*?)\\s+-->/s', 'renderHeadJS', $content['all']);
$content['all'] = preg_replace_callback('/<!--\\s+CSS:(.*?)\\s+-->/s', 'renderHeadCSS', $content['all']);
// test for frontend.js
if (!isset($GLOBALS['block']['custom_htmlhead']['frontend.js']) && preg_match('/MM_swapImage|BookMark_Page|clickZoom|mailtoLink/', $content['all'])) {
initFrontendJS();
}
//check for additional template based onLoad JavaScript Code
if ($block["jsonload"]) {
if (empty($pagelayout["layout_jsonload"])) {
$pagelayout["layout_jsonload"] = '';
} else {
$pagelayout["layout_jsonload"] .= ';';
}
$pagelayout["layout_jsonload"] = convertStringToArray($pagelayout["layout_jsonload"] . $block["jsonload"], ';');
$block['js_ondomready'][] = ' ' . implode(';' . LF . ' ', $pagelayout["layout_jsonload"]) . ';';
$pagelayout["layout_jsonload"] = '';
}
// set OnLoad (DomReady) JavaScript
if (count($block['js_ondomready'])) {
jsOnDomReady(implode(LF, $block['js_ondomready']));
}
// set OnUnLoad JavaScript
if (count($block['js_onunload'])) {
jsOnUnLoad(implode(LF, $block['js_onunload']));
}
// set Inline JS
if (count($block['js_inline'])) {
$block['custom_htmlhead']['inline'] = ' <script' . SCRIPT_ATTRIBUTE_TYPE . '>' . LF . SCRIPT_CDATA_START . LF;
$block['custom_htmlhead']['inline'] .= implode(LF, $block['js_inline']);
示例8: intval
$guestbook['post']['show'] = intval($_POST['guestbook_show']);
if ($guestbook['post']['show'] > 2) {
$guestbook['post']['show'] = 0;
}
// email error
if (!is_valid_email($guestbook['post']['email'])) {
$guestbook['error']['email'] = 'Proof the email address: it is empty or false.';
}
// name error
if (empty($guestbook['post']['name'])) {
$guestbook['error']['name'] = 'Don't forget to insert your name.';
}
// banned stuff
$guestbook['ban_count'] = 0;
if ($guestbook['ban']) {
$guestbook['ban'] = convertStringToArray($guestbook['ban'], ' ');
if (is_array($guestbook['ban']) && count($guestbook['ban'])) {
foreach ($guestbook['ban'] as $key => $value) {
if ($value = trim($value)) {
$guestbook['ban'][$key] = '/' . preg_quote($value, '/') . '/i';
$guestbook['ban_count']++;
}
}
}
if ($guestbook['ban_count']) {
$guestbook['post']['msg'] = preg_replace($guestbook['ban'], $guestbook['replace'], $guestbook['post']['msg']);
}
}
// processing image upload
if (!empty($guestbook["image_upload"])) {
$guestbook['error']['image'] = array();
示例9: render_if_not_category
function render_if_not_category($matches)
{
$cat_ids = convertStringToArray($matches[1]);
if (!count($cat_ids)) {
return '';
}
$current = intval($GLOBALS['content']['cat_id']);
foreach ($cat_ids as $id) {
$id = intval($id);
if ($id !== $current) {
return str_replace('{IF_NOTCAT_ID}', $id, $matches[2]);
}
}
return '';
}
示例10: _dbSaveCategories
function _dbSaveCategories($categories = array(), $type = '', $pid = 0, $seperator = ',')
{
$pid = intval($pid);
$type = trim($type);
if (is_string($categories)) {
$categories = convertStringToArray($categories, $seperator);
}
// delete all related categories first
if ($type && $pid) {
$sql = 'DELETE FROM ' . DB_PREPEND . 'phpwcms_categories WHERE cat_pid=' . $pid . " AND cat_type=" . _dbEscape($type);
_dbQuery($sql, 'DELETE');
}
if (is_array($categories) && count($categories) && $type && $pid) {
$data = array('cat_type' => $type, 'cat_pid' => $pid, 'cat_status' => 1, 'cat_createdate' => date('Y-m-d H:i:s'), 'cat_changedate' => date('Y-m-d H:i:s'), 'cat_name' => '', 'cat_info' => '');
foreach ($categories as $value) {
$value = trim($value);
if ($value != '') {
$data['cat_name'] = $value;
_dbInsert('phpwcms_categories', $data);
}
}
}
}
示例11: parse_downloads
function parse_downloads($match)
{
if (isset($match[1])) {
$value = array();
$value['cnt_object']['cnt_files']['id'] = convertStringToArray($match[1]);
if (isset($value['cnt_object']['cnt_files']['id']) && is_array($value['cnt_object']['cnt_files']['id']) && count($value['cnt_object']['cnt_files']['id'])) {
global $phpwcms;
$value['cnt_object']['cnt_files']['caption'] = isset($match[3]) ? @html_entity_decode(trim($match[3]), ENT_QUOTES, PHPWCMS_CHARSET) : '';
$value['files_direct_download'] = 0;
$value['files_template'] = 'download-inline';
if (!empty($match[2])) {
$match[2] = explode('=', trim($match[2]));
if (!empty($match[2][1])) {
$value['files_template'] = trim($match[2][1]);
if (which_ext($value['files_template']) == '') {
$value['files_template'] .= '.tmpl';
}
}
}
$IS_NEWS_CP = true;
$crow = array();
$news = array('files_result' => '');
// include content part files renderer
include PHPWCMS_ROOT . '/include/inc_front/content/cnt7.article.inc.php';
if ($news['files_result']) {
return $news['files_result'];
}
}
}
return isset($match[3]) ? $match[3] : '';
}
示例12: intval
if (isset($_GET['page'])) {
$_SESSION['detail_page'] = intval($_GET['page']);
}
// set default values for paginating
if (empty($_SESSION['list_count'])) {
$_SESSION['list_count'] = 25;
}
// paginate and search form processing
if (isset($_POST['do_pagination'])) {
$_SESSION['list_active'] = empty($_POST['showactive']) ? 0 : 1;
$_SESSION['list_inactive'] = empty($_POST['showinactive']) ? 0 : 1;
$_SESSION['filter_shop_category'] = clean_slweg($_POST['filter']);
if (empty($_SESSION['filter_shop_category'])) {
unset($_SESSION['filter_shop_category']);
} else {
$_SESSION['filter_shop_category'] = convertStringToArray($_SESSION['filter_shop_category'], ' ');
$_POST['filter'] = $_SESSION['filter_shop_category'];
}
$_SESSION['detail_page'] = intval($_POST['page']);
}
if (empty($_SESSION['detail_page'])) {
$_SESSION['detail_page'] = 1;
}
$_entry['list_active'] = isset($_SESSION['list_active']) ? $_SESSION['list_active'] : 1;
$_entry['list_inactive'] = isset($_SESSION['list_inactive']) ? $_SESSION['list_inactive'] : 1;
// set correct status query
if ($_entry['list_active'] != $_entry['list_inactive']) {
if (!$_entry['list_active']) {
$_entry['query'] .= 'cat_status=0';
}
if (!$_entry['list_inactive']) {
示例13: intval
break;
case 'list':
/*
* Liste
*/
$content['form']["fields"][$field_counter]['size'] = intval($_POST['cform_field_size'][$key]) ? intval($_POST['cform_field_size'][$key]) : 3;
$content['form']["fields"][$field_counter]['max'] = intval($_POST['cform_field_max'][$key]) ? 1 : 0;
//mutiple or not
break;
case 'newsletter':
/*
* Newsletter
*/
$content['form']["fields"][$field_counter]['size'] = intval($_POST['cform_field_size'][$key]) ? intval($_POST['cform_field_size'][$key]) : '';
$content['form']["fields"][$field_counter]['max'] = '';
$content['form']["fields"][$field_counter]['value'] = convertStringToArray($content['form']["fields"][$field_counter]['value'], "\n", 'UNIQUE', false);
$newletter_array = array();
$newletter_array['double_optin'] = 0;
$newletter_array['subject'] = 'Verify your newsletter subscription';
foreach ($content['form']["fields"][$field_counter]['value'] as $newsletter) {
$newsletter = explode('=', $newsletter, 2);
$newsletter[0] = trim($newsletter[0]);
$newsletter[1] = empty($newsletter[1]) ? '' : trim($newsletter[1]);
if (empty($newsletter[0]) || empty($newsletter[1])) {
continue;
} else {
switch ($newsletter[0]) {
case 'all':
$newletter_array['all'] = $newsletter[1];
break;
case 'email_field':
示例14: array
} else {
// Take article Post data
$article_err = array();
$article["article_catid"] = intval($_POST["article_cid"]);
$article["article_title"] = clean_slweg($_POST["article_title"], 255);
$article["article_alias"] = proof_alias($article["article_id"], $_POST["article_alias"], 'ARTICLE');
$article["article_subtitle"] = clean_slweg($_POST["article_subtitle"], 255);
$article["article_menutitle"] = clean_slweg($_POST["article_menutitle"], 255);
$article["article_description"] = clean_slweg($_POST["article_description"]);
$article["article_summary"] = str_replace('<p></p>', '<p> </p>', slweg($_POST["article_summary"]));
$article["article_notitle"] = isset($_POST["article_notitle"]) ? 1 : 0;
$article["article_hidesummary"] = isset($_POST["article_hidesummary"]) ? 1 : 0;
$article["article_aktiv"] = isset($_POST["article_aktiv"]) ? 1 : 0;
$article["article_begin"] = clean_slweg($_POST["article_begin"]);
$article["article_end"] = clean_slweg($_POST["article_end"]);
$article["article_keyword"] = implode(', ', convertStringToArray(clean_slweg($_POST["article_keyword"]), ','));
$article["article_lang"] = isset($_POST["article_lang"]) ? clean_slweg($_POST["article_lang"]) : '';
$article['article_lang_type'] = $article["article_lang"] == '' || empty($_POST["article_lang_type"]) ? '' : in_array($_POST["article_lang_type"], array('category', 'article')) ? $_POST["article_lang_type"] : '';
$article['article_lang_id'] = $article['article_lang_type'] == '' || empty($_POST["article_lang_id"]) ? 0 : intval($_POST["article_lang_id"]);
$article["article_redirect"] = clean_slweg($_POST["article_redirect"]);
$set_begin = isset($_POST["set_begin"]) ? 1 : 0;
$set_end = isset($_POST["set_end"]) ? 1 : 0;
$article['article_nosearch'] = isset($_POST['article_nosearch']) ? 1 : '';
$article['article_nositemap'] = isset($_POST['article_nositemap']) ? 1 : 0;
$article['article_aliasid'] = intval($_POST["article_aliasid"]);
$article['article_headerdata'] = isset($_POST["article_headerdata"]) ? 1 : 0;
$article['article_morelink'] = isset($_POST["article_morelink"]) ? 1 : 0;
$article['article_noteaser'] = isset($_POST["article_noteaser"]) ? 1 : 0;
$article["article_pagetitle"] = clean_slweg($_POST["article_pagetitle"]);
$article['article_paginate'] = isset($_POST["article_paginate"]) ? 1 : 0;
$article['article_sort'] = empty($_POST["article_sort"]) ? 0 : intval($_POST["article_sort"]);
示例15: array_unique
$acat_hidden = 1;
if (isset($_POST["acat_hiddenactive"])) {
$acat_hidden = 2;
}
}
$acat_cntpart = '';
if (isset($_POST['acat_cp']) && is_array($_POST['acat_cp'])) {
$acat_cntpart = $_POST['acat_cp'];
$acat_cntpart = array_unique($acat_cntpart);
$acat_cntpart = implode(',', $acat_cntpart);
}
$acat_class = empty($_POST["acat_class"]) ? '' : preg_replace('/[^a-zA-Z0-9_\\- ]/', '', clean_slweg($_POST["acat_class"], 150));
if (empty($_POST["acat_keywords"])) {
$acat_keywords = '';
} else {
$acat_keywords = substr(implode(', ', convertStringToArray(clean_slweg($_POST["acat_keywords"], 255))), 0, 255);
}
$acat_breadcrumb = 0;
if (!empty($_POST["acat_breadcrumb_nothidden"])) {
$acat_breadcrumb = 1;
}
if (!empty($_POST["acat_breadcrumb_nolink"])) {
$acat_breadcrumb += 2;
}
if (isset($_POST["acat_id"]) && $_POST["acat_id"] === 'index') {
// write index page config into flat file
$sql = "<?php\n";
$sql .= "\$indexpage['acat_name']\t\t= '" . str_replace("''", "\\'", clean_slweg($_POST["acat_name"])) . "';\n";
$sql .= "\$indexpage['acat_info']\t\t= '" . str_replace("''", "\\'", clean_slweg($_POST["acat_info"], 32000)) . "';\n";
$sql .= "\$indexpage['acat_alias']\t\t= '" . proof_alias($_POST["acat_id"], $_POST["acat_alias"]) . "';\n";
$sql .= "\$indexpage['acat_aktiv']\t\t= " . (isset($_POST["acat_aktiv"]) ? 1 : 0) . ";\n";