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

PHP trim_array函数代码示例

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

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



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

示例1: trim_if_string

 /**
  * Trim if variable is a string, otherwise trim as an array
  *
  * @param  mixed $data
  * @return mixed
  */
 function trim_if_string($data)
 {
     if (is_array($data) or is_object($data)) {
         return trim_array($data);
     }
     return trim($data);
 }
开发者ID:steveneaston,项目名称:helpers,代码行数:13,代码来源:helpers.php


示例2: storeSecurity

 function storeSecurity(&$pParamHash)
 {
     if (@$this->verifyId($pParamHash['content_id'])) {
         // We'll first nuke any security mappings for this content_id
         $sql = "DELETE FROM `" . BIT_DB_PREFIX . "gatekeeper_security_map`\n\t\t\t\t\tWHERE `content_id` = ?";
         $rs = $this->mDb->query($sql, array($pParamHash['content_id']));
     }
     if (!empty($pParamHash['access_level']) || @$this->verifyId($pParamHash['security_id']) && $pParamHash['security_id'] != 'public') {
         if ($this->verifySecurity($pParamHash) && !empty($pParamHash['security_store'])) {
             trim_array($pParamHash);
             if (!empty($pParamHash['security_store'])) {
                 global $gBitUser;
                 $table = BIT_DB_PREFIX . "gatekeeper_security";
                 if (!@$this->verifyId($pParamHash['security_id'])) {
                     $pParamHash['security_store']['user_id'] = $gBitUser->mUserId;
                     $pParamHash['security_id'] = $this->mDb->GenID('gatekeeper_security_id_seq');
                     $pParamHash['security_store']['security_id'] = $pParamHash['security_id'];
                     $result = $this->mDb->associateInsert($table, $pParamHash['security_store']);
                 } else {
                     $result = $this->mDb->associateUpdate($table, $pParamHash['security_store'], array("security_id" => $pParamHash['security_id']));
                 }
             }
         }
         if (@$this->verifyId($pParamHash['content_id']) && @$this->verifyId($pParamHash['security_id'])) {
             $sql = "INSERT INTO `" . BIT_DB_PREFIX . "gatekeeper_security_map` ( `content_id`, `security_id` ) VALUES (?,?)";
             $rs = $this->mDb->query($sql, array($pParamHash['content_id'], $pParamHash['security_id']));
         }
     }
     return count($this->mErrors) == 0;
 }
开发者ID:bitweaver,项目名称:gatekeeper,代码行数:30,代码来源:LibertyGatekeeper.php


示例3: HookGrant_editEditeditbeforeheader

function HookGrant_editEditeditbeforeheader()
{
    global $ref, $baseurl, $usergroup, $grant_edit_groups, $collection;
    // Do we have access to do any of this, or is it a template
    if (!in_array($usergroup, $grant_edit_groups) || $ref < 0) {
        return;
    }
    // Check for Ajax POST to delete users
    $grant_edit_action = getvalescaped("grant_edit_action", "");
    if ($grant_edit_action != "") {
        if ($grant_edit_action == "delete") {
            $remove_user = escape_check(getvalescaped("remove_user", "", TRUE));
            if ($remove_user != "") {
                sql_query("delete from grant_edit where resource='{$ref}' and user={$remove_user}");
                exit("SUCCESS");
            }
        }
        exit("FAILED");
    }
    # If 'users' is specified (i.e. access is private) then rebuild users list
    $users = getvalescaped("users", false);
    if ($users != false) {
        # Build a new list and insert
        $users = resolve_userlist_groups($users);
        $ulist = array_unique(trim_array(explode(",", $users)));
        $urefs = sql_array("select ref value from user where username in ('" . join("','", $ulist) . "')");
        if (count($urefs) > 0) {
            $inserttext = array();
            $grant_edit_expiry = getvalescaped("grant_edit_expiry", "");
            foreach ($urefs as $uref) {
                if ($grant_edit_expiry != "") {
                    $inserttext[] = $uref . ",'" . $grant_edit_expiry . "'";
                } else {
                    $inserttext[] = $uref . ",NULL";
                }
            }
            if ($collection != "") {
                global $items;
                foreach ($items as $collection_resource) {
                    sql_query("delete from grant_edit where resource='{$collection_resource}' and user in (" . implode(",", $urefs) . ")");
                    sql_query("insert into grant_edit(resource,user,expiry) values ({$collection_resource}," . join("),(" . $collection_resource . ",", $inserttext) . ")");
                    #log this
                    global $lang;
                    resource_log($collection_resource, 's', "", "Grant Edit -  " . $users . " - " . $lang['expires'] . ": " . ($grant_edit_expiry != "" ? nicedate($grant_edit_expiry) : $lang['never']));
                }
            } else {
                sql_query("delete from grant_edit where resource='{$ref}' and user in (" . implode(",", $urefs) . ")");
                sql_query("insert into grant_edit(resource,user,expiry) values ({$ref}," . join("),(" . $ref . ",", $inserttext) . ")");
                #log this
                global $lang;
                resource_log($ref, 's', "", "Grant Edit -  " . $users . " - " . $lang['expires'] . ": " . ($grant_edit_expiry != "" ? nicedate($grant_edit_expiry) : $lang['never']));
            }
        }
    }
    return true;
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:56,代码来源:edit.php


示例4: comparble_version

function comparble_version($version_number)
{
    $version_number = explode(".", $version_number);
    $version_number = array_map("intval", $version_number);
    $version_number = trim_array($version_number);
    $version_number = array_map(function ($e) {
        return str_pad($e, 10, "0", STR_PAD_LEFT);
    }, $version_number);
    return implode(".", $version_number);
}
开发者ID:ValentinMinder,项目名称:pocketcampus,代码行数:10,代码来源:get_config.php


示例5: compress

 /**
  * Compress content
  *
  * @return Response
  */
 public function compress(Request $request, Response $response)
 {
     $acceptEncoding = $request->getHeaderLine('accept-encoding');
     $encodings = array_flip(trim_array(explode(',', $acceptEncoding)));
     if (isset($encodings['gzip'])) {
         return $this->compressBody($response, 'gzip', 'gzcompress');
     }
     if (isset($encodings['deflate'])) {
         return $this->compressBody($response, 'deflate', 'gzdeflate');
     }
     return $response;
 }
开发者ID:odan,项目名称:psr7-full-stack,代码行数:17,代码来源:CompressMiddleware.php


示例6: index

 public function index($category = null, $products = null)
 {
     if (is_null($category)) {
         //show all categories
         /*  breadcrumbs */
         $this->breadcrumbs->unshift('products', site_url('products'));
         $this->breadcrumbs->unshift('Home', site_url('home'));
         $this->data['title'] = 'Our categories';
         $cat = $this->model_products->getCategories();
         $this->data['content'] = $this->smarty->load('categories', $cat);
     } elseif (!is_null($category) && is_null($products)) {
         //if category part in the URL and no product number
         $category = $this->security->xss_clean($category);
         $this->data['title'] = $category . '- items';
         $prod = $this->model_products->getProducts($category);
         if ($prod) {
             /*  breadcrumbs */
             $this->breadcrumbs->unshift($prod[0]["name"], site_url("products/") . $prod[0]['cat_machine']);
             $this->breadcrumbs->unshift('products', site_url('products'));
             $this->breadcrumbs->unshift('Home', site_url('home'));
             $this->data['title'] = 'Phoneshop - ' . $prod[0]["cat_machine"];
             $this->data['content'] = $this->smarty->load('category', $prod, 'category');
         }
     } elseif (!is_null($category) && !is_null($products)) {
         //if category part in the URL and no product number
         $products = $this->security->xss_clean($products);
         $item = $this->model_products->getItem($products);
         $images = explode(',', $item['images']);
         $images = trim_array($images);
         if ($item) {
             /*  breadcrumbs */
             $this->breadcrumbs->unshift($item["title"], site_url("products/") . $item['cat_name'] . '/' . $item['machine_name']);
             $this->breadcrumbs->unshift($item["cat_title"], site_url("products") . '/' . $item['cat_name']);
             $this->breadcrumbs->unshift('products', site_url('products'));
             $this->breadcrumbs->unshift('Home', site_url('home'));
             $this->smarty->assign('images', $images);
             $this->data['title'] = 'Phoneshop - ' . $item['title'];
             $this->data['content'] = $this->smarty->load('item', $item);
         }
     }
     $this->load->view('templates/main', $this->data);
     //show the template main
 }
开发者ID:sanekagr,项目名称:phoneshop,代码行数:43,代码来源:products.php


示例7: email_collection

function email_collection($colrefs,$collectionname,$fromusername,$userlist,$message,$feedback,$access=-1,$expires="",$useremail="",$from_name="",$cc="",$themeshare=false,$themename="",$themeurlsuffix="")
	{
	# Attempt to resolve all users in the string $userlist to user references.
	# Add $collection to these user's 'My Collections' page
	# Send them an e-mail linking to this collection
	#  handle multiple collections (comma seperated list)
	global $baseurl,$email_from,$applicationname,$lang,$userref, $email_multi_collections ;
	
	if ($useremail==""){$useremail=$email_from;}
	
	if (trim($userlist)=="") {return ($lang["mustspecifyoneusername"]);}
	$userlist=resolve_userlist_groups($userlist);
	$ulist=trim_array(explode(",",$userlist));
	$emails=array();
	$key_required=array();
	if ($feedback) {$feedback=1;} else {$feedback=0;}
	$reflist=trim_array(explode(",",$colrefs));
	
	$emails_keys=resolve_user_emails($ulist);
	$emails=$emails_keys['emails'];
	$key_required=$emails_keys['key_required'];

	# Add the collection(s) to the user's My Collections page
	$urefs=sql_array("select ref value from user where username in ('" . join("','",$ulist) . "')");
	if (count($urefs)>0)
		{
		# Delete any existing collection entries
		sql_query("delete from user_collection where collection in ('" .join("','", $reflist) . "') and user in ('" . join("','",$urefs) . "')");
		
		# Insert new user_collection row(s)
		#loop through the collections
			for ($nx1=0;$nx1<count($reflist);$nx1++)
			{	#loop through the users
				for ($nx2=0;$nx2<count($urefs);$nx2++)
				{
		sql_query("insert into user_collection(collection,user,request_feedback) values ($reflist[$nx1], $urefs[$nx2], $feedback )");
		if ($access == 0) {
			foreach (get_collection_resources($reflist[$nx1]) as $resource)	{
				open_access_to_user($urefs[$nx2],$resource,$expires);
			}
		}
				
			#log this
		collection_log($reflist[$nx1],"S",0, sql_value ("select username as value from user where ref = $urefs[$nx2]",""));

				}
			}
		}
	
	# Send an e-mail to each resolved user
	
	# htmlbreak is for composing list
	$htmlbreak="\r\n";
	global $use_phpmailer;
	if ($use_phpmailer){$htmlbreak="<br><br>";$htmlbreaksingle="<br>";} 
	
	if ($fromusername==""){$fromusername=$applicationname;} // fromusername is used for describing the sender's name inside the email
	if ($from_name==""){$from_name=$applicationname;} // from_name is for the email headers, and needs to match the email address (app name or user name)
	
	$templatevars['message']=str_replace(array("\\n","\\r","\\"),array("\n","\r",""),$message);	
	if (trim($templatevars['message'])==""){$templatevars['message']=$lang['nomessage'];} 
	
	$templatevars['fromusername']=$fromusername;
	$templatevars['from_name']=$from_name;
	
	if(count($reflist)>1){$subject=$applicationname.": ".$lang['mycollections'];}
	else { $subject=$applicationname.": ".$collectionname;}
	
	if ($fromusername==""){$fromusername=$applicationname;}
	
	$externalmessage=$lang["emailcollectionmessageexternal"];
	$internalmessage=$lang["emailcollectionmessage"];
	$viewlinktext=$lang["clicklinkviewcollection"];
	if ($themeshare) // Change the text if sharing a theme category
		{
		$externalmessage=$lang["emailthemecollectionmessageexternal"];
		$internalmessage=$lang["emailthememessage"];
		$viewlinktext=$lang["clicklinkviewcollections"];
		}
		
	##  loop through recipients
	for ($nx1=0;$nx1<count($emails);$nx1++)
		{
		## loop through collections
		$list="";
		$list2="";
		$origviewlinktext=$viewlinktext; // Save this text as we may change it for internal theme shares for this user
		if ($themeshare && !$key_required[$nx1]) # don't send a whole list of collections if internal, just send the theme category URL
			{
			$url="";
			$subject=$applicationname.": " . $themename;
			$url=$baseurl . "/pages/themes.php" . $themeurlsuffix;			
			$viewlinktext=$lang["clicklinkviewthemes"];
			$emailcollectionmessageexternal=false;
			if ($use_phpmailer){
					$link="<a href=\"$url\">" . $themename . "</a>";	
					
					$list.= $htmlbreak.$link;	
					// alternate list style				
					$list2.=$htmlbreak.$themename.' -'.$htmlbreaksingle.$url;
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:collections_functions.php


示例8: check_view_display_condition

function check_view_display_condition($fields, $n)
{
    #Check if field has a display condition set
    $displaycondition = true;
    if ($fields[$n]["display_condition"] != "") {
        //echo $fields[$n]["display_condition"] . "<br>";
        $fieldstocheck = array();
        #' Set up array to use in jQuery script function
        $s = explode(";", $fields[$n]["display_condition"]);
        $condref = 0;
        foreach ($s as $condition) {
            $displayconditioncheck = false;
            $s = explode("=", $condition);
            for ($cf = 0; $cf < count($fields); $cf++) {
                if ($s[0] == $fields[$cf]["name"]) {
                    $checkvalues = $s[1];
                    $validvalues = explode("|", strtoupper($checkvalues));
                    $v = trim_array(explode(",", strtoupper($fields[$cf]["value"])));
                    foreach ($validvalues as $validvalue) {
                        if (in_array($validvalue, $v)) {
                            $displayconditioncheck = true;
                        }
                        # this is  a valid value
                    }
                    if (!$displayconditioncheck) {
                        $displaycondition = false;
                    }
                }
            }
            # see if next field needs to be checked
            $condref++;
        }
        # check next condition
    }
    return $displaycondition;
}
开发者ID:claytondaley,项目名称:resourcespace,代码行数:36,代码来源:view.php


示例9: trim_array

<?php

/* --------Drop down list ---------------- */
# Translate all options
$options = trim_array(explode(",", $fields[$n]["options"]));
$adjusted_dropdownoptions = hook("adjustdropdownoptions");
if ($adjusted_dropdownoptions) {
    $options = $adjusted_dropdownoptions;
}
$option_trans = array();
for ($m = 0; $m < count($options); $m++) {
    $option_trans[$options[$m]] = i18n_get_translated($options[$m]);
}
if ($auto_order_checkbox) {
    asort($option_trans);
}
if (substr($value, 0, 1) == ',') {
    $value = substr($value, 1);
}
// strip the leading comma if it exists
?>
<select class="stdwidth" name="<?php 
echo $name;
?>
" id="<?php 
echo $name;
?>
" <?php 
echo $help_js;
if ($edit_autosave) {
    ?>
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:3.php


示例10: trim_array

function trim_array(&$var)
{
    if (is_string($var)) {
        $var = trim($var);
    } else {
        if (is_array($var)) {
            foreach ($var as $key => $value) {
                trim_array($var[$key]);
            }
        }
    }
}
开发者ID:ECP-Black,项目名称:ECP,代码行数:12,代码来源:functions.php


示例11: filter_match

function filter_match($filter,$name,$value)
	{
	# In the given filter string, does name/value match?
	# Returns:
	# 0 = no match for name
	# 1 = matched name but value was not present
	# 2 = matched name and value was correct
	$s=explode(";",$filter);
	foreach ($s as $condition)
		{
		$s=explode("=",$condition);
		$checkname=$s[0];
		if ($checkname==$name)
			{
			$checkvalues=$s[1];
			
			$s=explode("|",strtoupper($checkvalues));
			$v=trim_array(explode(",",strtoupper($value)));
			foreach ($s as $checkvalue)
				{
				if (in_array($checkvalue,$v)) {return 2;}
				}
			return 1;
			}
		}
	return 0;
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:27,代码来源:resource_functions.php


示例12: header

                } else {
                    $url = $groupInfo['after_registration_page'];
                }
            }
            header('Location: ' . $url);
            exit;
        }
    } else {
        $gBitSystem->setHttpStatus(HttpStatusCodes::HTTP_BAD_REQUEST);
        $gBitSmarty->assignByRef('errors', $newUser->mErrors);
    }
    $gBitSmarty->assignByRef('reg', $reg);
} else {
    if ($gBitSystem->isFeatureActive('custom_user_fields')) {
        $fields = explode(',', $gBitSystem->getConfig('custom_user_fields'));
        trim_array($fields);
        $gBitSmarty->assign('customFields', $fields);
    }
    for ($i = 0; $i < BaseAuth::getAuthMethodCount(); $i++) {
        $instance = BaseAuth::init($i);
        if ($instance && $instance->canManageAuth()) {
            $auth_reg_fields = $instance->getRegistrationFields();
            foreach (array_keys($auth_reg_fields) as $auth_field) {
                $auth_reg_fields[$auth_field]['value'] = $auth_reg_fields[$auth_field]['default'];
            }
            $gBitSmarty->assign('auth_reg_fields', $auth_reg_fields);
            break;
        }
    }
}
$languages = array();
开发者ID:bitweaver,项目名称:users,代码行数:31,代码来源:register.php


示例13: check_display_condition

function check_display_condition($n, $field)
{
    global $fields, $scriptconditions, $required_fields_exempt;
    $displaycondition = true;
    $s = explode(";", $field["display_condition"]);
    $condref = 0;
    foreach ($s as $condition) {
        $displayconditioncheck = false;
        $s = explode("=", $condition);
        for ($cf = 0; $cf < count($fields); $cf++) {
            if ($s[0] == $fields[$cf]["name"]) {
                $scriptconditions[$condref]["field"] = $fields[$cf]["ref"];
                # add new jQuery code to check value
                $scriptconditions[$condref]['type'] = $fields[$cf]['type'];
                $scriptconditions[$condref]['options'] = $fields[$cf]['options'];
                $checkvalues = $s[1];
                $validvalues = explode("|", strtoupper($checkvalues));
                $scriptconditions[$condref]["valid"] = "\"";
                $scriptconditions[$condref]["valid"] .= implode("\",\"", $validvalues);
                $scriptconditions[$condref]["valid"] .= "\"";
                $v = trim_array(explode(",", strtoupper($fields[$cf]["value"])));
                foreach ($validvalues as $validvalue) {
                    if (in_array($validvalue, $v)) {
                        $displayconditioncheck = true;
                    }
                    # this is  a valid value
                }
                if (!$displayconditioncheck) {
                    $displaycondition = false;
                    $required_fields_exempt[] = $field["ref"];
                }
                #add jQuery code to update on changes
                if ($fields[$cf]["type"] == 2) {
                    # construct the value from the ticked boxes
                    # Note: it seems wrong to start with a comma, but this ensures it is treated as a comma separated list by split_keywords(), so if just one item is selected it still does individual word adding, so 'South Asia' is split to 'South Asia','South','Asia'.
                    $options = trim_array(explode(",", $fields[$cf]["options"]));
                    ?>
<script type="text/javascript">
						jQuery(document).ready(function() {<?php 
                    for ($m = 0; $m < count($options); $m++) {
                        $checkname = $fields[$cf]["ref"] . "_" . md5($options[$m]);
                        echo "\n\t\t\t\t\t\t\t\tjQuery('input[name=\"" . $checkname . "\"]').change(function (){\n\t\t\t\t\t\t\t\t\tcheckDisplayCondition" . $field["ref"] . "();\n\t\t\t\t\t\t\t\t\t});";
                    }
                    ?>
							});
						</script><?php 
                } else {
                    if ($fields[$cf]['type'] == 12) {
                        $options = explode(',', $fields[$cf]['options']);
                        ?>

							<script type="text/javascript">
							jQuery(document).ready(function() {

							<?php 
                        foreach ($options as $option) {
                            $element_id = 'field_' . $fields[$cf]['ref'] . '_' . sha1($option);
                            $jquery = sprintf('
										jQuery("#%s").change(function() {
											checkDisplayCondition%s();
										});
								', $element_id, $field["ref"]);
                            echo $jquery;
                        }
                        ?>
							
							});
							</script>

							<?php 
                    } else {
                        ?>
						<script type="text/javascript">
						jQuery(document).ready(function() {
							jQuery('#field_<?php 
                        echo $fields[$cf]["ref"];
                        ?>
').change(function (){

							checkDisplayCondition<?php 
                        echo $field["ref"];
                        ?>
();

							});
						});
						</script>
					<?php 
                    }
                }
            }
        }
        # see if next field needs to be checked
        $condref++;
    }
    # check next condition
    ?>
	<script type="text/javascript">
	function checkDisplayCondition<?php 
    echo $field["ref"];
//.........这里部分代码省略.........
开发者ID:claytondaley,项目名称:resourcespace,代码行数:101,代码来源:edit.php


示例14: setArticleTags

 function setArticleTags()
 {
     $id = db_escape_string($_REQUEST["id"]);
     $tags_str = db_escape_string($_REQUEST["tags_str"]);
     $tags = array_unique(trim_array(explode(",", $tags_str)));
     db_query($this->link, "BEGIN");
     $result = db_query($this->link, "SELECT int_id FROM ttrss_user_entries WHERE\n\t\t\t\tref_id = '{$id}' AND owner_uid = '" . $_SESSION["uid"] . "' LIMIT 1");
     if (db_num_rows($result) == 1) {
         $tags_to_cache = array();
         $int_id = db_fetch_result($result, 0, "int_id");
         db_query($this->link, "DELETE FROM ttrss_tags WHERE\n\t\t\t\tpost_int_id = {$int_id} AND owner_uid = '" . $_SESSION["uid"] . "'");
         foreach ($tags as $tag) {
             $tag = sanitize_tag($tag);
             if (!tag_is_valid($tag)) {
                 continue;
             }
             if (preg_match("/^[0-9]*\$/", $tag)) {
                 continue;
             }
             //					print "<!-- $id : $int_id : $tag -->";
             if ($tag != '') {
                 db_query($this->link, "INSERT INTO ttrss_tags\n\t\t\t\t\t\t\t\t(post_int_id, owner_uid, tag_name) VALUES ('{$int_id}', '" . $_SESSION["uid"] . "', '{$tag}')");
             }
             array_push($tags_to_cache, $tag);
         }
         /* update tag cache */
         sort($tags_to_cache);
         $tags_str = join(",", $tags_to_cache);
         db_query($this->link, "UPDATE ttrss_user_entries\n\t\t\t\tSET tag_cache = '{$tags_str}' WHERE ref_id = '{$id}'\n\t\t\t\t\t\tAND owner_uid = " . $_SESSION["uid"]);
     }
     db_query($this->link, "COMMIT");
     $tags = get_article_tags($this->link, $id);
     $tags_str = format_tags_string($tags, $id);
     $tags_str_full = join(", ", $tags);
     if (!$tags_str_full) {
         $tags_str_full = __("no tags");
     }
     print json_encode(array("tags_str" => array("id" => $id, "content" => $tags_str, "content_full" => $tags_str_full)));
 }
开发者ID:nvdnkpr,项目名称:Tiny-Tiny-RSS,代码行数:39,代码来源:rpc.php


示例15: update_rss_feed


//.........这里部分代码省略.........
                }
            }
            db_query("COMMIT");
            _debug("assigning labels...", $debug_enabled);
            assign_article_to_label_filters($entry_ref_id, $article_filters, $owner_uid, $article_labels);
            _debug("looking for enclosures...", $debug_enabled);
            // enclosures
            $enclosures = array();
            $encs = $item->get_enclosures();
            if (is_array($encs)) {
                foreach ($encs as $e) {
                    $e_item = array($e->link, $e->type, $e->length);
                    array_push($enclosures, $e_item);
                }
            }
            if ($debug_enabled) {
                _debug("article enclosures:", $debug_enabled);
                print_r($enclosures);
            }
            db_query("BEGIN");
            foreach ($enclosures as $enc) {
                $enc_url = db_escape_string($enc[0]);
                $enc_type = db_escape_string($enc[1]);
                $enc_dur = db_escape_string($enc[2]);
                $result = db_query("SELECT id FROM ttrss_enclosures\n\t\t\t\t\t\tWHERE content_url = '{$enc_url}' AND post_id = '{$entry_ref_id}'");
                if (db_num_rows($result) == 0) {
                    db_query("INSERT INTO ttrss_enclosures\n\t\t\t\t\t\t\t(content_url, content_type, title, duration, post_id) VALUES\n\t\t\t\t\t\t\t('{$enc_url}', '{$enc_type}', '', '{$enc_dur}', '{$entry_ref_id}')");
                }
            }
            db_query("COMMIT");
            // check for manual tags (we have to do it here since they're loaded from filters)
            foreach ($article_filters as $f) {
                if ($f["type"] == "tag") {
                    $manual_tags = trim_array(explode(",", $f["param"]));
                    foreach ($manual_tags as $tag) {
                        if (tag_is_valid($tag)) {
                            array_push($entry_tags, $tag);
                        }
                    }
                }
            }
            // Skip boring tags
            $boring_tags = trim_array(explode(",", mb_strtolower(get_pref('BLACKLISTED_TAGS', $owner_uid, ''), 'utf-8')));
            $filtered_tags = array();
            $tags_to_cache = array();
            if ($entry_tags && is_array($entry_tags)) {
                foreach ($entry_tags as $tag) {
                    if (array_search($tag, $boring_tags) === false) {
                        array_push($filtered_tags, $tag);
                    }
                }
            }
            $filtered_tags = array_unique($filtered_tags);
            if ($debug_enabled) {
                _debug("filtered article tags:", $debug_enabled);
                print_r($filtered_tags);
            }
            // Save article tags in the database
            if (count($filtered_tags) > 0) {
                db_query("BEGIN");
                foreach ($filtered_tags as $tag) {
                    $tag = sanitize_tag($tag);
                    $tag = db_escape_string($tag);
                    if (!tag_is_valid($tag)) {
                        continue;
                    }
开发者ID:cs-team,项目名称:tiny_tiny_rss-openshift-quickstart,代码行数:67,代码来源:rssfuncs.php


示例16: dirname

<?php
include dirname(__FILE__) . "/../../../include/db.php";
include dirname(__FILE__) . "/../../../include/authenticate.php";
include dirname(__FILE__) . "/../../../include/general.php";

$field=getvalescaped("field","");
$keyword=getvalescaped("term","");

$fielddata=get_resource_type_field($field);
$readonly=getval("readonly","");
?>[ <?php

# Return matches
$first=true;
$exactmatch=false;
$options=trim_array(explode(",",$fielddata["options"]));
for ($m=0;$m<count($options);$m++)
	{
	$trans=i18n_get_translated($options[$m]);
	if ($trans!="" && substr(strtolower($trans),0,strlen($keyword))==strtolower($keyword))
		{
		if (!$first) { ?>, <?php }
		$first=false;
		
		if (strtolower($trans)==strtolower($keyword)) {$exactmatch=true;}
		?>"<?php echo $trans ?>"<?php
		}
	}
	
if (!$exactmatch && !$readonly)
	{
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:suggest_keywords.php


示例17: trim_array

if (!hook("customchkboxes")) {
    # Translate all options
    $options = trim_array(explode(",", $field["options"]));
    $option_trans = array();
    $option_trans_simple = array();
    for ($m = 0; $m < count($options); $m++) {
        $trans = i18n_get_translated($options[$m]);
        $option_trans[$options[$m]] = $trans;
        $option_trans_simple[] = $trans;
    }
    if ($auto_order_checkbox) {
        natsort($option_trans);
    }
    $options = array_keys($option_trans);
    # Set the options array to the keys, so it is now effectively sorted by translated string
    $set = trim_array(explode(",", $value));
    $wrap = 0;
    $l = average_length($option_trans_simple);
    $cols = 10;
    if ($l > 5) {
        $cols = 6;
    }
    if ($l > 10) {
        $cols = 4;
    }
    if ($l > 15) {
        $cols = 3;
    }
    if ($l > 25) {
        $cols = 2;
    }
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:31,代码来源:2.php


示例18: search_form_to_search_query

function search_form_to_search_query($fields, $fromsearchbar = false)
{
    # Take the data in the the posted search form that contained $fields, and assemble
    # a search query string that can be used for a standard search.
    #
    # This is used to take the advanced search form and assemble it into a search query.
    global $auto_order_checkbox, $checkbox_and;
    $search = "";
    if (getval("year", "") != "") {
        if ($search != "") {
            $search .= ", ";
        }
        $search .= "year:" . getval("year", "");
    }
    if (getval("month", "") != "") {
        if ($search != "") {
            $search .= ", ";
        }
        $search .= "month:" . getval("month", "");
    }
    if (getval("day", "") != "") {
        if ($search != "") {
            $search .= ", ";
        }
        $search .= "day:" . getval("day", "");
    }
    if (getval("allfields", "") != "") {
        if ($search != "") {
            $search .= ", ";
        }
        $search .= join(", ", explode(" ", getvalescaped("allfields", "")));
        # prepend 'all fields' option
    }
    if (getval("resourceids", "") != "") {
        $listsql = "!list" . join(":", trim_array(split_keywords(getvalescaped("resourceids", ""))));
        $search = $listsql . " " . $search;
    }
    for ($n = 0; $n < count($fields); $n++) {
        switch ($fields[$n]["type"]) {
            case 0:
                # -------- Text boxes
            # -------- Text boxes
            case 1:
            case 5:
                $name = "field_" . $fields[$n]["ref"];
                $value = getvalescaped($name, "");
                if ($value != "") {
                    $vs = split_keywords($value);
                    for ($m = 0; $m < count($vs); $m++) {
                        if ($search != "") {
                            $search .= ", ";
                        }
                        $search .= $fields[$n]["name"] . ":" . strtolower($vs[$m]);
                    }
                }
                break;
            case 2:
                # -------- Dropdowns / check lists
            # -------- Dropdowns / check lists
            case 3:
                if ($fields[$n]["display_as_dropdown"]) {
                    # Process dropdown box
                    $name = "field_" . $fields[$n]["ref"];
                    $value = getvalescaped($name, "");
                    if ($value != "") {
                        /*
                        $vs=split_keywords($value);
                        for ($m=0;$m<count($vs);$m++)
                        	{
                        	if ($search!="") {$search.=", ";}
                        	$search.=$fields[$n]["name"] . ":" . strtolower($vs[$m]);
                        	}
                        */
                        if ($search != "") {
                            $search .= ", ";
                        }
                        $search .= $fields[$n]["name"] . ":" . $value;
                    }
                } else {
                    # Process checkbox list
                    $options = trim_array(explode(",", $fields[$n]["options"]));
                    $p = "";
                    $c = 0;
                    for ($m = 0; $m < count($options); $m++) {
                        $name = $fields[$n]["ref"] . "_" . md5($options[$m]);
                        $value = getvalescaped($name, "");
                        if ($value == "yes") {
                            $c++;
                            if ($p != "") {
                                $p .= ";";
                            }
                            $p .= strtolower(i18n_get_translated($options[$m]));
                        }
                    }
                    if ($c == count($options) && !$checkbox_and) {
                        # all options ticked - omit from the search (unless using AND matching)
                        $p = "";
                    }
                    if ($p != "") {
                        if ($search != "") {
//.........这里部分代码省略.........
开发者ID:vongalpha,项目名称:resourcespace,代码行数:101,代码来源:search_functions.php


示例19: substr

        if (substr($key, 0, 11) == "permission_") {
            # Found a permisison.
            $reverse = $value == "reverse";
            $key = substr($key, 11);
            if (!$reverse && getval("checked_" . $key, "") != "" || $reverse && !getval("checked_" . $key, "") != "") {
                $perms[] = urldecode($key);
            }
        }
    }
    if (getval("other", "") != "") {
        $perms[] = getvalescaped("other", "");
    }
    sql_query("update usergroup set permissions='" . join(",", $perms) . "' where ref='{$ref}'");
}
$group = get_usergroup($ref);
$permissions = trim_array(explode(",", $group["permissions"]));
$permissions_done = array();
function DrawOption($permission, $description, $reverse = false, $reload = false)
{
    global $permissions, $permissions_done;
    $checked = in_array($permission, $permissions);
    if ($reverse) {
        $checked = !$checked;
    }
    ?>
	<input type="hidden" name="permission_<?php 
    echo urlencode($permission);
    ?>
" value="<?php 
    echo $reverse ? "reverse" : "normal";
    ?>
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:admin_group_permissions.php


示例20: save_proposed_changes

function save_proposed_changes($ref)
{
    global $userref, $auto_order_checkbox, $multilingual_text_fields, $languages, $language;
    # Loop through the field data and save (if necessary)
    $errors = array();
    $ 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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