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


PHP format_str函数代码示例

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


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

示例1: func_execute_active_handler

function func_execute_active_handler()
{
    if (isset($_GET['q'])) {
        $q = format_str($_GET['q']);
        $query = (array) explode('/', $q);
        $GLOBALS['page'] = $query[0];
    } else {
        $query = "";
        $GLOBALS['page'] = "";
    }
    $page = $GLOBALS['func_registry'][$GLOBALS['page']];
    if (!$page) {
        header('HTTP/1.0 404 Not Found');
        die('404 - Page not found.');
    }
    if (isset($page['security']) && $page['security']) {
        user_ensure_authenticated();
    }
    if (isset($page['admin']) && $page['admin']) {
        user_ensure_admin();
    }
    if (function_exists('config_log_request')) {
        config_log_request();
    }
    if (function_exists($page['callback'])) {
        return call_user_func($page['callback'], $query);
    }
    return false;
}
开发者ID:soross,项目名称:0f523140-f3b3-4653-89b0-eb08c39940ad,代码行数:29,代码来源:common.inc.php

示例2: tweet_post

function tweet_post()
{
    $args = func_get_args();
    $cate = $args[2];
    $content = format_str($_POST['text'], false);
    if (!$cate or !$content) {
        die("Invalid argument!");
    }
    include_once 'sinaoauth.inc.php';
    $c = new WeiboClient(SINA_AKEY, SINA_SKEY, $GLOBALS['user']['sinakey']['oauth_token'], $GLOBALS['user']['sinakey']['oauth_token_secret']);
    if ($_FILES['upload']['tmp_name']) {
        $msg = $c->upload($content, $_FILES['upload']['tmp_name']);
    } else {
        $msg = $c->update($content);
    }
    if ($msg === false || $msg === null) {
        echo "Error occured";
        return false;
    }
    if (isset($msg['error_code']) && isset($msg['error'])) {
        echo 'Error_code: ' . $msg['error_code'] . ';  Error: ' . $msg['error'];
        return false;
    }
    include_once "uuid.inc.php";
    $v4uuid = str_replace("-", "", UUID::v4());
    connect_db();
    $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "')";
    if ($msg['thumbnail_pic']) {
        $add = "INSERT INTO pending_tweets (\r\n                     site_id, tweet_id, user_site_id, content, post_datetime,\r\n                     type, tweet_site_id,\r\n                     post_screenname, profile_image_url, source, thumbnail)\r\n                     VALUES (1, '{$v4uuid}', '" . $msg['user']['id'] . "', '{$content}', '" . date("Y-m-d H:i:s", strtotime($msg["created_at"])) . "',\r\n                     {$cate}, '" . $msg['id'] . "', '" . $msg["user"]["name"] . "', '" . $msg["user"]["profile_image_url"] . "', '" . $msg["source"] . "', '" . $msg['thumbnail_pic'] . "')";
    }
    $added = mysql_query($add) or die("Could not add entry!");
    echo "0";
}
开发者ID:soross,项目名称:0f523140-f3b3-4653-89b0-eb08c39940ad,代码行数:33,代码来源:tweet.inc.php

示例3: get_home_voices

function get_home_voices()
{
    $home_voices = array();
    $sql_1 = "SELECT uv.*, u.profile_pic\n    FROM user_voices uv\n    LEFT JOIN users u ON u.id=uv.user_id\n\n    WHERE uv.is_blocked='0'\n    ORDER BY RAND()\n    LIMIT 20\n    ";
    $home_voices = @format_str(@mysql_exec($sql_1));
    return $home_voices;
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:7,代码来源:model_home.php

示例4: get_ppoints

/**
 * function to get all Patronage Points details for a User
 * [Params]
 * $user_id = user
 * $user_ppoints_id = to get a specific point data (leave empty to pull all data instead)
 * $fetch_total_only = set as `true` to get total count only, instead of full data set from user_petronage_points table
*/
function get_ppoints($user_id, $user_ppoints_id = '', $fetch_total_only = false)
{
    if ($user_id <= 0) {
        return false;
    }
    if ($fetch_total_only != false) {
        $sql_1 = "SELECT total_patronage_points FROM user_info WHERE user_id='{$user_id}'";
        $upp_res = @mysql_exec($sql_1, 'single');
        if (!is_array($upp_res) || count($upp_res) < 0) {
            return false;
        }
        return (int) @$upp_res['total_patronage_points'];
    } else {
        $sql_1 = "SELECT * FROM user_petronage_points WHERE user_id='{$user_id}' ";
        if ($user_ppoints_id > 0) {
            $sql_1 .= " AND id='{$user_ppoints_id}'";
        }
        $sql_1 .= " ORDER BY received_on DESC";
        $upp_res = @format_str(@mysql_exec($sql_1));
        //var_dump("<pre>", $upp_res);
        if (!is_array($upp_res) || count($upp_res) < 0) {
            return false;
        }
        return $upp_res;
    }
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:33,代码来源:patronage_points_func.php

示例5: get_member_info

function get_member_info($member_id, $user_id)
{
    if ($member_id <= 0) {
        return false;
    }
    #/ All Fields
    $fetch_fields = array('package_id', 'email_add', 'screen_name', 'profile_pic', 'first_name', 'middle_name', 'last_name', 'company_name', 'identify_by', 'joined_on', 'country_code', 'state', 'city', 'address_ln_1', 'address_ln_2', 'zip', 'phone_number');
    #/ Get user_permission
    $user_permissions = array();
    $sql_1 = "SELECT fields_perm FROM user_permissions WHERE user_id='{$member_id}'";
    $up_ar = @format_str(@mysql_exec($sql_1, 'single'));
    if (is_array($up_ar) && array_key_exists('fields_perm', $up_ar)) {
        $user_permissions = @explode(',', @$up_ar['fields_perm']);
    }
    #/ Filter fields based on permissions
    if ($member_id != $user_id) {
        if (!empty($user_permissions)) {
            $fetch_fields = array_diff($fetch_fields, $user_permissions);
        }
    }
    $fetch_fields_str = implode(',', $fetch_fields);
    //var_dump("<pre>", $user_permissions, $fetch_fields, $fetch_fields_str); die();
    if (empty($fetch_fields_str)) {
        return false;
    }
    #/ Get Member's Info
    $fetch_fields_str = str_replace('country_code', 'ui.country_code', $fetch_fields_str);
    $sql_2 = "SELECT u.id as user_id,\n    {$fetch_fields_str},\n    (CASE\n    WHEN identify_by='screen_name' THEN screen_name\n    WHEN identify_by='full_name' THEN CONCAT(first_name, ' ', middle_name, ' ', last_name)\n    WHEN identify_by='company_name' THEN company_name\n    ELSE 'Member'\n    END) AS user_ident,\n    c.country_name,\n    st.state_name\n\n    FROM users u\n    LEFT JOIN user_info ui ON ui.user_id=u.id\n    LEFT JOIN countries c USING(country_code)\n    LEFT JOIN states st ON st.state_code=ui.state\n\n    WHERE u.id='{$member_id}'\n    AND u.is_blocked='0'\n    ";
    $members_ar = @format_str(@mysql_exec($sql_2, 'single'));
    //var_dump("<pre>", $members_ar); die();
    return array($members_ar, $user_permissions);
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:32,代码来源:profile_func.php

示例6: format_string

function format_string(&$string)
{
    if (is_array($string)) {
        return format_arr($string);
    } else {
        format_str($string);
    }
}
开发者ID:ehmedov,项目名称:www,代码行数:8,代码来源:req.php

示例7: format_str

/**
 * Function format_str
 * Formats string and arrays (Please upgrade as per your need)
 * version 6.3
 * Author: Raheel Hasan
 * $in = input string/array
 * $max_length (def: 0) = set it to an int value and it will cut-out all chars after this length. Set to "{INTVAL}:dot" and it will also insert dots after int value
 * $add_space (def: false) = set it to a value and it will Add Space after this length
 * $escape_mysql (def:false) = set to TRUE if escaping/sanitizing for mysql query. This will apply mysql_real_escape
 * $utf (default: false) = set as TRUE in-order to FORCE and convert result into UTF-8 (from ISO-8859-1).
 * OR set to 'utf-ignore' to ignore between UTF-8 to UTF8 only (or iso-ignore) - use this when the source is in utf but require fixes
 * $rem_inline (default: true) = set as TRUE in-order to remove all inline xss.
 * $all (default: true) = set it to FALSE and it will NOT format Tags and ignore < and > from formating
 *
 * NOTE:
 * If the meta charset is not on UTF, you will have to convert strings manually everywhere (between db save and retrive).
 * For this, either Save (in db) as normal and Retrive as utf, -or- Save as utf and Retrive as normal.
 * But DONOT do utf conversion on both sides.
 */
function format_str($in, $max_length = 0, $add_space = false, $escape_mysql = false, $utf = false, $rem_inline = true, $all = true)
{
    $out = $in;
    if (is_array($out)) {
        $out_x = array();
        foreach ($out as $k => $v) {
            $k = strip_tags($k);
            $k = remove_x($k);
            $k = format_str($k);
            $v = format_str($v, $max_length, $add_space, $escape_mysql, $utf, $rem_inline, $all);
            $out_x[$k] = $v;
        }
        $out = $out_x;
    } else {
        if ($rem_inline) {
            $out = preg_replace('/<(.*?)(on[a-z]{1,}[\\s]{0,}=[\\s]{0,})(.*?)>/ims', '<$1 x$2 $3>', $out);
        }
        if ($utf != false && stristr($utf, 'ignore') == false) {
            $out = @iconv("ISO-8859-1", "UTF-8//TRANSLIT//IGNORE", $out);
            //if(is_string($utf)){
            //$out = @iconv("{$utf}", "UTF-8//IGNORE", $out);
            //}
        }
        if ($add_space != false) {
            $out = preg_replace("/([^\\s]{{$add_space}})/ims", '$1 ', $out);
        }
        $max_length_i = @explode(':', $max_length);
        $max_length_ic = @$max_length_i[0];
        if ($max_length_ic > 0) {
            $cur_len = strlen($out);
            $out = substr($out, 0, $max_length_ic);
            $out .= $cur_len > $max_length_ic && isset($max_length_i[1]) && $max_length_i[1] == 'dot' ? ' ...' : '';
        }
        if ($all) {
            $out = str_replace('<', '&lt;', $out);
            $out = str_replace('>', '&gt;', $out);
        }
        $out = str_replace("'", '&#39;', $out);
        $out = str_replace('"', '&quot;', $out);
        $out = str_replace("(", '&#x28;', $out);
        $out = str_replace(")", '&#x29;', $out);
        $out = str_replace("\\", '&#92;', $out);
        //most important
        //$out = trim($out);
        if ($utf == 'utf-ignore') {
            $out = @iconv("UTF-8", "UTF-8//IGNORE", $out);
        } else {
            if ($utf == 'iso-ignore') {
                $out = @iconv("ISO-8859-1", "UTF-8//IGNORE", $out);
            }
        }
        if ($escape_mysql != false) {
            $out = mysql_real_escape_string($out);
        }
        $out = trim($out);
    }
    return $out;
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:77,代码来源:format_str.php

示例8: cust_order_status

function cust_order_status()
{
    $sql_1 = "SELECT\n\n    DISTINCT order_status,\n    COUNT(*) AS t_os\n\n    FROM cust_orders\n\n    GROUP BY order_status\n    ORDER BY t_os DESC\n    LIMIT 10\n    ";
    $ret = '';
    $result = @mysql_exec($sql_1);
    if (count($result) > 0) {
        $ret = @format_str($result);
        #/ Set Gradient
        $ret = color_pie_chart($ret);
    }
    return $ret;
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:12,代码来源:model_stats.php

示例9: get_package_info

function get_package_info($pk_id, $get_benefits = false)
{
    if (empty($pk_id)) {
        return false;
    }
    $sql_part = '';
    if ($get_benefits != false) {
        $sql_part = "";
    }
    $sql_1 = "SELECT title, cost, is_basic, is_recursive, recursive_cost\n    FROM membership_packages mp\n    WHERE is_active='1'\n    AND id='{$pk_id}'\n    ";
    $package_info = @format_str(@mysql_exec($sql_1));
    return $package_info;
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:13,代码来源:model_package.php

示例10: get_uppers

/**
 * find all PARENT ids of Recursive Relationship - with just 1 sql query call
 *
 * @param $f1 = node id
 * @param $table_name = name of the table
 * @param $dir = direction of breadcrumbs
 * @param $parent_field_name = field name of parent id
*/
function get_uppers($f1, $table_name, $dir = 'left', $parent_field_name = 'parent_id', $ori = '1')
{
    $frm = array();
    static $res_ary = array();
    $res = false;
    $breadcr = '&laquo;&laquo;';
    if ($dir == 'right') {
        $breadcr = '&raquo;&raquo;';
    }
    ## get dataset
    if ($ori != '0') {
        $sql = "select id, {$parent_field_name}, title from {$table_name}";
        //echo $sql;
        $res = mysql_exec($sql);
        if ($res !== false) {
            foreach ($res as $k => $v) {
                $res_ary["{$table_name}"][$v['id']] = array();
                $res_ary["{$table_name}"][$v['id']][] = $v;
            }
        }
    }
    $res = @$res_ary["{$table_name}"][$f1];
    //var_dump($res_ary); //die();
    ##--
    ## process dataset recursively
    if ($res != false) {
        foreach ($res as $k => $v) {
            $frm[] = format_str($v['title']);
            $t1 = get_uppers($v[$parent_field_name], $table_name, $dir, $parent_field_name, '0');
            if (!empty($t1)) {
                $frm = array_merge($frm, $t1);
            }
        }
        //end foreach....
        if ($ori != '0') {
            //var_dump($frm);
            $frm = array_reverse($frm);
            $frm[count($frm) - 1] = '<u>' . $frm[count($frm) - 1] . '</u>';
            $frm = implode(" {$breadcr} ", $frm);
        }
    }
    ##--
    return $frm;
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:52,代码来源:func_tree.php

示例11: while

        <br />
        <?php 
    echo "No Results / Records Found !";
    if ($search_it) {
        echo "&nbsp;Please clear the Filter and try again !";
    }
    ?>
        <br /><br />
        </td>
	    </tr>
        <?php 
} else {
    $c = 0;
    ## Customer Orders table start from here
    while ($recrd) {
        $recrd = format_str($recrd);
        $c++;
        $skip_flag = false;
        $title = $recrd["title"];
        if ($sr_title !== false && $sr_title != '') {
            $title = $src->get_highlighted($title, 'title');
            if ($title == '--continue--continue--continue--continue--') {
                $skip_flag = true;
            }
            //fail safe
        }
        $seo_tag = $recrd["seo_tag"];
        if ($sr_seo_tag !== false && $sr_seo_tag != '') {
            $seo_tag = $src->get_highlighted($seo_tag, 'seo_tag');
            if ($seo_tag == '--continue--continue--continue--continue--') {
                $skip_flag = true;
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:31,代码来源:site_pages.php

示例12: format_str

        <div style="width:130px; float:left;">Percentage Points:</div>
        <div style="float:left;"><input type="text" id="percentage_points" name="percentage_points" maxlength="2" value="<?php 
echo format_str(@$empt['percentage_points']);
?>
" style="width:40px; border:1px solid #000261;" /> %
        <span class="submsg">&nbsp;(numeric only)</span>
        <span class="submsg">&nbsp;Percentage based Patronage Points for this Action.</span>
        <span class="submsg">&nbsp;Applied only if Direct Points is set to '0' in the above field.</span>
        </div>

        <div style="clear:both; height:20px;"></div>

        <div style="width:130px; float:left;">Limits Per Day:</div>
        <div style="float:left;"><input type="text" id="limits_per_day" name="limits_per_day" maxlength="3" value="<?php 
echo format_str(@$empt['limits_per_day']);
?>
" style="width:40px; border:1px solid #000261;" />
        <span style="color:#CC0000;">&nbsp;&nbsp;*</span>
        <span class="submsg">&nbsp;(numbers only)</span>
        <span class="submsg">&nbsp;Usage Limits per Day per Member</span>
        </div>

        <div style="clear:both; height:20px;"></div>


        <div style="width:130px; float:left;">Is Active?</div>
        <div style="float:left;"><input type="checkbox" name="is_active" id="is_active" value="1" <?php 
if (@$empt['is_active'] != '0') {
    echo "checked='checked'";
}
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:30,代码来源:p_points_config_opp.php

示例13: format_str

                <span class="submsg">&nbsp;&nbsp;Firefox: first do Italic, then Bold. Chrome: Bold, then Italic</span><br /><br />
            </div>

            <!--<input type="hidden" name="m_value" id="m_value" value="" />-->
            <input type="text" name="m_value" id="m_value" style="font-size:1px; border:none; background:none;" />
        </div>


        <div style="clear:both; height:15px;"></div>
        <div style="width:130px; float:left;">&nbsp;</div><div><hr /></div>
        <div style="clear:both; height:15px;"></div>


        <div style="width:130px; float:left;">Setting / Value2:</div>
        <div style="float:left;"><input type="text" id="content_settings" name="content_settings" maxlength="150" value="<?php 
echo format_str(@$empt['content_settings']);
?>
" style="width:250px; border:1px solid #000261;" />
        <span class="submsg">&nbsp;&nbsp;for technical values only (will not be displayed) / please dont alter this</span><br /><br />
        </div>

        <div style="clear:both; height:15px;"></div>

        <div style="width:130px; float:left;">Category:</div>
        <div style="float:left;">
            <?php 
$sql_cats = "SELECT DISTINCT m_cat FROM site_misc_data ORDER BY m_cat";
$m_cats = mysql_exec($sql_cats);
?>
            <span class="submsg">for reference and grouping only / will not be displayed</span><br /><br />
            <div id="m_cat_select">
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:31,代码来源:site_misc_opp.php

示例14: preview_img

    $("#profile_pic").change(function(){
        if($('#pImage_profile_pic').validationEngine('validate')) {return false;}
        preview_img(this, 'profile_thumb'); //preview image
    });
});
</script>

<div class="website_fun">
<div class="container middle_content">
<div class="content_holder">

<div class="mid_bdy body-main" style="padding-top:30px;">

    <h1><strong><?php 
echo format_str($pg_meta['page_title']);
?>
</strong></h1>
    <br />

    <div>
        <?php 
if ($success != false) {
    ?>

        <div>Thank you for completing your <b>Profile</b> at collaborateUSA.com,
        please <a href="<?php 
    echo $consts['DOC_ROOT'];
    ?>
signin"><b>Signin</b></a> to your Account.<br /><br />
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:29,代码来源:signup_paypal_succ.php

示例15: get_home_packages

//var_dump("<pre>", $site_misc_data); die();
#/ Packages
$home_packages = false;
if ($user_idc <= 0) {
    $home_packages = get_home_packages();
    //var_dump("<pre>", $home_packages); die();
}
#/ Home Voices
$home_voices = get_home_voices();
//var_dump("<pre>", $home_voices); die();
#/ Other info
$other_pg_inf = get_page_info('12');
//var_dump("<pre>", $other_pg_inf); die();
/////////////////////////////////////////////////////////////////////
#/ Fill pg_meta
$pg_meta = array('meta_keywords' => format_str($page_info['meta_keywords']), 'meta_descr' => format_str($page_info['meta_descr']));
$current_pgx = 'home';
$load_bx_slider = true;
$load_owl_carousel = true;
include_once "includes/header.php";
/////////////////////////////////////////////////////////////////////
?>

<script src="<?php 
echo DOC_ROOT;
?>
assets/js/func_home.js"></script>

<?php 
##------------------------------- Section 1 -------------------------------##
?>
开发者ID:centaurustech,项目名称:collaborate-usa,代码行数:31,代码来源:home.php


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