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

PHP filter_text函数代码示例

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

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



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

示例1: urlnicify

 static function urlnicify($url, $id = '')
 {
     if ('' == $url) {
         return $url;
     }
     $url = trim($url);
     $url = strip_tags($url);
     $url = filter_text($url);
     $temp = explode("/", $url);
     $url = $temp[count($temp) - 1];
     $url = preg_replace('|[^a-z0-9-~+_. #=&;,/:]|i', '', $url);
     $url = str_replace('/', '', $url);
     $url = str_replace(' ', '-', $url);
     $url = str_replace('&', '', $url);
     $url = str_replace("'", "", $url);
     $url = str_replace(';//', '://', $url);
     $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
     $url = strtolower($url);
     //Últims canvis
     $url = trim(mb_eregi_replace("[^ A-Za-z0-9_-]", "", $url));
     $url = mb_eregi_replace("[ \t\n\r]+", "-", $url);
     $url = mb_eregi_replace("[ -]+", "-", $url);
     $url = trim($url, '-');
     if ($id == '') {
         return $url;
     }
     return $url . "-" . $id;
 }
开发者ID:omatech,项目名称:editora-utils,代码行数:28,代码来源:Strings.php


示例2: mobile_content_detail

function mobile_content_detail()
{
    $_id = func_arg(0) != "" ? func_arg(0) : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('ContentPage');
    $dt = $lilo_mongo->findOne(array("_id" => $lilo_mongo->mongoid($_id)));
    $output = array('title' => "No Title", 'text' => "no Text", 'alias' => "no alias", 'document_update' => date("Y-m-d H:i:s"), 'state_document' => "");
    if ($dt) {
        $tgl = "";
        if ($dt['document_update'] != "") {
            $tgl = date('Y-m-d H:i:s', $dt['document_update']->sec);
        }
        $title = !isset($dt['title']) ? "" : $dt['title'];
        $text = !isset($dt['text']) ? "" : $dt['text'];
        $alias = !isset($dt['alias']) ? "" : $dt['alias'];
        $state_document = !isset($dt['state_document']) ? "" : $dt['state_document'];
        $output = array('title' => $title, 'alias' => $alias, 'text' => replace_text_content(filter_text($text)), 'document_update' => $tgl, 'state_document' => $state_document);
    }
    return json_encode($output);
}
开发者ID:azanium,项目名称:Klumbi-Web,代码行数:21,代码来源:content.php


示例3: mobile_stream_news

function mobile_stream_news()
{
    $_id = func_arg(0) != "" ? func_arg(0) : "";
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Articles');
    $lilo_mongo->selectCollection('ContentNews');
    $dt = $lilo_mongo->findOne(array("_id" => $lilo_mongo->mongoid($_id)));
    $output = array('title' => "No Title", 'text' => "no Text", 'update' => date("Y-m-d H:i:s"), 'state_document' => "");
    if ($dt) {
        $tgl = "";
        if ($dt['update'] != "") {
            $tgl = date('Y-m-d H:i:s', $dt['update']->sec);
        }
        $path_upload = URL_ASSET_IMAGE . "images/";
        $title = !isset($dt['title']) ? "" : $dt['title'];
        $text = !isset($dt['text']) ? "" : $dt['text'];
        $state_document = !isset($dt['state_document']) ? "" : $dt['state_document'];
        $picture = !isset($dt['picture']) ? "" : $dt['picture'];
        $output = array('title' => $title, 'text' => replace_text_content(filter_text($text)), 'update' => $tgl, 'imageName' => $picture, 'pathImage' => $path_upload, 'state_document' => $state_document);
    }
    return json_encode($output);
}
开发者ID:azanium,项目名称:Klumbi-Web,代码行数:22,代码来源:stream.php


示例4: sections

 function sections($config)
 {
     global $COURSE, $CFG, $USER, $THEME;
     // probably inefficient, but it works
     get_all_mods($COURSE->id, $mods, $modnames, $modnamesplural, $modnamesused);
     // sections
     $sections = get_all_sections($COURSE->id);
     // name for sections
     $sectionname = get_string("name{$COURSE->format}", "format_{$COURSE->format}");
     // TODO: this fallback should be unnecessary
     if ($sectionname == "[[name{$COURSE->format}]]") {
         $sectionname = get_string("name{$COURSE->format}");
     }
     $return = array();
     // check what the course format is like
     // highlight for current week or highlighted topic
     if (in_array($COURSE->format, array('weeks', 'weekscss'))) {
         $format = 'week';
         $highlight = ceil((time() - $COURSE->startdate) / 604800);
     } else {
         $format = 'topic';
         $highlight = $COURSE->marker;
     }
     $modinfo = unserialize($COURSE->modinfo);
     // I think $display is the section currently being displayed
     // Why are we calling course_set_display?
     // For Moodle 2.0 we should just use $PAGE and check type
     // and also $PAGE->activityrecord
     $path = str_replace($CFG->httpswwwroot . '/', '', $CFG->pagepath);
     if (substr($path, 0, 7) == 'course/') {
         //TODO: this code is hackish, we shouldn't use course_set_display
         # get current section being displayed
         $week = optional_param('week', -1, PARAM_INT);
         if ($week != -1) {
             // the course format should already be doing this
             $display = course_set_display($COURSE->id, $week);
         } else {
             if (isset($USER->display[$COURSE->id])) {
                 $display = $USER->display[$COURSE->id];
             } else {
                 $display = course_set_display($COURSE->id, 0);
             }
         }
     } elseif (substr($path, 0, 4) == 'mod/') {
         // Moodle 2: use $PAGE->activityrecord->section;
         $id = optional_param('id', -1, PARAM_INT);
         if ($id == -1) {
             $display = 0;
         } else {
             $sql = "select section from {$CFG->prefix}course_sections where id=(select section from {$CFG->prefix}course_modules where id={$id})";
             $row = get_record_sql($sql);
             $display = $row->section;
         }
     } else {
         $display = 0;
     }
     foreach ($sections as $section) {
         // don't show the flowing sections
         if (!($section->visible && $section->section && $section->section <= $COURSE->numsections)) {
             continue;
         }
         $text = trim($section->summary);
         if (empty($text)) {
             $text = ucwords($sectionname) . " " . $section->section;
         } else {
             $text = $this->truncate_html(filter_text($text, $COURSE->id), $config);
         }
         // expand section if it's the one currently displayed
         $expand = false;
         if ($section->section == $display) {
             $expand = true;
         }
         $sectionstyle = 'yui_menu_icon_section';
         // highlight marked section
         if ($section->section == $highlight) {
             $sectionstyle .= ' highlight';
         }
         $iconpath = $CFG->wwwroot;
         if ($THEME->custompix) {
             $iconpath .= "/theme/" . current_theme() . "/pix";
         } else {
             $iconpath .= '/pix';
             //$iconpath .= '/';
         }
         $iconpath = $CFG->wwwroot . "/theme/" . current_theme() . "/pix";
         // decide what URL we want to use
         // A lot of this should really be done by the course format
         //
         // = intoaction config values =
         // * 'introhide' link to the section page (this effectively
         //   hides the other sections
         // * 'introscroll' link to the fragment id of the section on
         //   on the current page
         // whether or not any of the sections are hidden
         $hidden = false;
         foreach (array('topic', 'week') as $param) {
             if (isset($_GET[$param]) && $_GET[$param] != 'all') {
                 $hidden = true;
             }
         }
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:outline.php


示例5: CreateTopic

function CreateTopic($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold, $posttype)
{
    global $user, $userinfo, $EditedMessage, $cookie, $prefix, $pollcomm, $anonpost, $db, $module_name;
    $author = FixQuotes($author);
    $subject = FixQuotes(filter_text($subject, "nohtml"));
    $comment = format_url($comment);
    if ($posttype == "exttrans") {
        $comment = FixQuotes(nl2br(htmlspecialchars(check_words($comment))));
    } elseif ($posttype == "plaintext") {
        $comment = FixQuotes(nl2br(filter_text($comment)));
    } else {
        $comment = FixQuotes(filter_text($comment));
    }
    if (is_user($user)) {
        getusrinfo($user);
    }
    if (is_user($user) && !$xanonpost) {
        getusrinfo($user);
        $name = $userinfo[username];
        $email = $userinfo[femail];
        $url = $userinfo[user_website];
        $score = 1;
    } else {
        $name = "";
        $email = "";
        $url = "";
        $score = 0;
    }
    $ip = $_SERVER["REMOTE_HOST"];
    if (empty($ip)) {
        $ip = $_SERVER["REMOTE_ADDR"];
    }
    $pollID = intval($pollID);
    $result = $db->sql_query("select count(*) from " . $prefix . "_poll_desc where pollID='{$pollID}'");
    $fake = $db->sql_numrows($result);
    if ($fake == 1) {
        if ($anonpost == 0 and is_user($user) or $anonpost == 1) {
            $db->sql_query("insert into " . $prefix . "_pollcomments values (NULL, '{$pid}', '{$pollID}', now(), '{$name}', '{$email}', '{$url}', '{$ip}', '{$subject}', '{$comment}', '{$score}', '0')");
            update_points(9);
        } else {
            echo "Nice try...";
            die;
        }
    } else {
        include "header.php";
        echo "According to my records, the topic you are trying " . "to reply to does not exist. If you're just trying to be " . "annoying, well then too bad.";
        include "footer.php";
        die;
    }
    if ($pollcomm == 1) {
        if (isset($cookie[4])) {
            $options .= "&mode={$cookie['4']}";
        } else {
            $options .= "&mode=thread";
        }
        if (isset($cookie[5])) {
            $options .= "&order={$cookie['5']}";
        } else {
            $options .= "&order=0";
        }
        if (isset($cookie[6])) {
            $options .= "&thold={$cookie['6']}";
        } else {
            $options .= "&thold=0";
        }
    } else {
        $options = "";
    }
    Header("Location: modules.php?name={$module_name}&op=results&pollID={$pollID}{$options}");
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:70,代码来源:comments.php


示例6: fn_print_mandatory_section

function fn_print_mandatory_section(&$course, &$mods, &$modnamesused, &$sections)
{
    global $CFG, $USER, $THEME;
    $labeltext = '';
    $activitytext = '';
    /// Determine order using all sections.
    $orderedmods = array();
    foreach ($sections as $section) {
        $modseq = explode(",", $section->sequence);
        if (!empty($modseq)) {
            foreach ($modseq as $modnum) {
                if (!empty($mods[$modnum]) && $mods[$modnum]->mandatory && $mods[$modnum]->visible) {
                    $orderedmods[] = $mods[$modnum];
                }
            }
        }
    }
    $modinfo = unserialize($course->modinfo);
    foreach ($orderedmods as $mod) {
        if ($mod->mandatory && $mod->visible) {
            $instancename = urldecode($modinfo[$mod->id]->name);
            if (!empty($CFG->filterall)) {
                $instancename = filter_text("<nolink>{$instancename}</nolink>", $course->id);
            }
            if (!empty($modinfo[$mod->id]->extra)) {
                $extra = urldecode($modinfo[$mod->id]->extra);
            } else {
                $extra = "";
            }
            if (!empty($modinfo[$mod->id]->icon)) {
                $icon = "{$CFG->pixpath}/" . urldecode($modinfo[$mod->id]->icon);
            } else {
                $icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
            }
            if ($mod->indent) {
                print_spacer(12, 20 * $mod->indent, false);
            }
            if ($mod->modname == "label") {
                if (!$mod->visible) {
                    $labeltext .= "<span class=\"dimmed_text\">";
                }
                $labeltext .= format_text($extra, FORMAT_HTML);
                if (!$mod->visible) {
                    $labeltext .= "</span>";
                }
                $labeltext .= '<br />';
            } else {
                if ($mod->modname == "resource") {
                    $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
                    $alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
                    $labeltext .= "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font><br />";
                } else {
                    // Normal activity
                    $act_compl = is_activity_complete($mod, $USER->id);
                    if ($act_compl === false) {
                        $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
                        $alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
                        $activitytext .= "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font><br />";
                    }
                }
            }
        }
    }
    print_simple_box('<div align="right">' . $labeltext . '</div>', 'center', '100%');
    //    print_simple_box('<div align="left">'.$activitytext.'</div>', 'center', '100%');
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:66,代码来源:lib.php


示例7: dg_tw_publish_tweet

function dg_tw_publish_tweet($tweet = array(), $query = false)
{
    global $dg_tw_queryes, $dg_tw_publish, $dg_tw_tags, $dg_tw_cats, $dg_tw_ft, $wpdb;
    $post_type = isset($dg_tw_ft['post_type']) ? $dg_tw_ft['post_type'] : 'post';
    $dg_tw_start_post = get_default_post_to_edit($post_type, true);
    $username = dg_tw_tweet_user($tweet);
    $current_query = $query != false ? $query : array('tag' => '', 'value' => '');
    $tweet_time = strtotime($tweet->created_at);
    $tweet_date = date("Y-m-d H:i:s", $tweet_time);
    $querystr = "SELECT *\r\n\t\t\t\t\tFROM {$wpdb->postmeta}\r\n\t\t\t\t\tWHERE (meta_key = 'dg_tw_id' AND meta_value = '" . (int) $tweet->id_str . "')\r\n\t\t\t\t\tGROUP BY post_id";
    $postid = $wpdb->get_results($querystr);
    $author_tag = !empty($dg_tw_ft['authortag']) ? ',' . $username : '';
    $post_tags = htmlspecialchars($dg_tw_tags . ',' . $current_query['tag'] . $author_tag);
    if (!count($postid)) {
        if (!empty($tweet->retweeted_status)) {
            $content = "RT @" . $tweet->retweeted_status->user->screen_name . ":" . $tweet->retweeted_status->text;
            $tweet_content = dg_tw_regexText($content);
        } else {
            $tweet_content = dg_tw_regexText($tweet->text);
        }
        $post_title = filter_text($tweet, $dg_tw_ft['title_format'], "", $dg_tw_ft['maxtitle'], $dg_tw_ft['title_remove_url']);
        $post_content = filter_text($tweet, $dg_tw_ft['body_format'], $tweet_content);
        do_action('dg_tw_before_images_placed');
        if (strstr($post_content, '%tweet_images%') || $dg_tw_ft['featured_image']) {
            $images_list = dg_tw_put_attachments($dg_tw_start_post->ID, $tweet);
            if ($dg_tw_ft['featured_image']) {
                set_post_thumbnail($dg_tw_start_post->ID, end($images_list['ids']));
            }
            $post_content = str_replace('%tweet_images%', $images_list['html'], $post_content);
            do_action('dg_tw_images_placed');
        }
        $post_status = strval($dg_tw_publish);
        if ($username == "usdatagov") {
            $post_status = "publish";
        }
        $post = array('ID' => $dg_tw_start_post->ID, 'post_author' => $dg_tw_ft['author'], 'post_content' => $post_content, 'post_name' => dg_tw_slug($post_title), 'post_status' => $post_status, 'post_title' => $post_title, 'tags_input' => $post_tags, 'post_type' => $post_type, 'post_date' => $tweet_date);
        $post = apply_filters('dg_tw_before_post_tweet', $post);
        $dg_tw_this_post = wp_insert_post($post, true);
        //adding category after the post insert.
        $tags = wp_get_post_tags($dg_tw_this_post);
        foreach ($tags as $tag) {
            switch ($tag->name) {
                case "SafetyDataGov":
                    $category_id = get_cat_ID("safety");
                    break;
                case "usdatagov":
                    $category_id = get_cat_ID("developers");
                    break;
                case "HealthDataGov":
                    $category_id = get_cat_ID("health");
                    break;
                case "energydatagov":
                    $category_id = get_cat_ID("energy");
                    break;
                default:
                    $category_id = "";
            }
        }
        wp_set_post_categories($dg_tw_this_post, array($category_id));
        do_action('dg_tw_after_post_published', $dg_tw_this_post);
        if ($dg_tw_this_post) {
            //Set the format of a post
            $format = isset($dg_tw_ft['format']) ? $dg_tw_ft['format'] : 'standard';
            set_post_format($dg_tw_this_post, $format);
            /*POST METAS*/
            $query_string = urlencode($current_query['value']);
            $query_string = $query != false ? $query['value'] : $query_string;
            add_post_meta($dg_tw_this_post, 'dg_tw_query', $query_string);
            add_post_meta($dg_tw_this_post, 'dg_tw_id', $tweet->id_str);
            add_post_meta($dg_tw_this_post, 'dg_tw_author', $username);
            add_post_meta($dg_tw_this_post, 'dg_tw_author_avatar', $tweet->user->profile_image_url_https);
            /*END POST METAS*/
            // adding acf values
            $tweet_url = 'https://twitter.com/' . $username . '/status/' . $tweet->id_str;
            update_field("field_5176000e6c97e", $username, $dg_tw_this_post);
            update_field("field_517600256c97f", $username, $dg_tw_this_post);
            update_field("field_517600346c980", $tweet->user->profile_image_url_https, $dg_tw_this_post);
            update_field("field_517600586c981", $tweet_url, $dg_tw_this_post);
        }
    } else {
        return "already";
    }
    return "true";
}
开发者ID:ac1714,项目名称:twitter-posts-to-blog,代码行数:84,代码来源:functions.php


示例8: r_comments

function r_comments($id, $title)
{
    global $admin, $prefix, $db, $module_name;
    $id = intval($id);
    $result = $db->sql_query("SELECT cid, userid, date, comments, score from " . $prefix . "_reviews_comments where rid='{$id}' ORDER BY date DESC");
    while ($row = $db->sql_fetchrow($result)) {
        $cid = intval($row['cid']);
        $uname = stripslashes($row['userid']);
        $date = $row['date'];
        $comments = stripslashes($row['comments']);
        $score = intval($row['score']);
        OpenTable();
        $title = htmlspecialchars(urldecode(check_html($title, "nohtml")));
        echo "\r\n\t<b>{$title}</b><br>";
        if ($uname == "Anonymous") {
            echo "" . _POSTEDBY . " {$uname} " . _ON . " {$date}<br>";
        } else {
            echo "" . _POSTEDBY . " <a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username={$uname}\">{$uname}</a> " . _ON . " {$date}<br>";
        }
        echo "" . _MYSCORE . " ";
        display_score($score);
        if (is_admin($admin)) {
            echo "<br><b>" . _ADMIN . "</b> [ <a href=\"modules.php?name={$module_name}&rop=del_comment&amp;cid={$cid}&amp;id={$id}\">" . _DELETE . "</a> ]</font><hr noshade size=1><br><br>";
        } else {
            echo "</font><hr noshade size=1><br><br>";
        }
        $comments = FixQuotes(nl2br(filter_text($comments)));
        echo "\r\n\t{$comments}\r\n\t";
        CloseTable();
        echo "<br>";
    }
}
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:32,代码来源:index.php


示例9: blog_print_attachments

function blog_print_attachments($blogentry, $return = NULL)
{
    // if return=html, then return a html string.
    // if return=text, then return a text-only string.
    // otherwise, print HTML for non-images, and return image HTML
    global $CFG;
    $filearea = blog_file_area_name($blogentry);
    $imagereturn = "";
    $output = "";
    if ($basedir = blog_file_area($blogentry)) {
        if ($files = get_directory_list($basedir)) {
            $strattachment = get_string("attachment", "forum");
            foreach ($files as $file) {
                include_once $CFG->libdir . '/filelib.php';
                $icon = mimeinfo("icon", $file);
                $type = mimeinfo("type", $file);
                $ffurl = get_file_url("{$filearea}/{$file}");
                $image = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"\" />";
                if ($return == "html") {
                    $output .= "<a href=\"{$ffurl}\">{$image}</a> ";
                    $output .= "<a href=\"{$ffurl}\">{$file}</a><br />";
                } else {
                    if ($return == "text") {
                        $output .= "{$strattachment} {$file}:\n{$ffurl}\n";
                    } else {
                        if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                            // Image attachments don't get printed as links
                            $imagereturn .= "<br /><img src=\"{$ffurl}\" alt=\"\" />";
                        } else {
                            echo "<a href=\"{$ffurl}\">{$image}</a> ";
                            echo filter_text("<a href=\"{$ffurl}\">{$file}</a><br />");
                        }
                    }
                }
            }
        }
    }
    if ($return) {
        return $output;
    }
    return $imagereturn;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:42,代码来源:lib.php


示例10: generatecsv


//.........这里部分代码省略.........
    $csv_output .= "Aтрибуты" . $delim;
    $csv_output .= "Значения_атрибутов" . $delim;
    $csv_output .= "\n";
    //End Placing columns in first row
    // Patch dlan
    // if both fields are empty we select all orders
    if ($start == "" && $end == "") {
        $orders = vam_db_query("SELECT orders_id, date_purchased, customers_name, cc_owner, customers_company, customers_email_address, billing_street_address, billing_city, billing_state, billing_postcode, billing_country, customers_telephone, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_state, delivery_postcode, delivery_country, cc_type, cc_number, cc_expires \nFROM orders ORDER BY orders_id");
        // if $start is empty we select all orders up to $end
    } else {
        if ($start == "" && $end != "") {
            $orders = vam_db_query("SELECT orders_id, date_purchased, customers_name, cc_owner, customers_company, customers_email_address, billing_street_address, billing_city, billing_state, billing_postcode, billing_country, customers_telephone, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_state, delivery_postcode, delivery_country, cc_type, cc_number, cc_expires \nFROM orders WHERE orders_id <= {$end} ORDER BY orders_id");
            // if $end is empty we select all orders from $start
        } else {
            if ($start != "" && $end == "") {
                $orders = vam_db_query("SELECT orders_id, date_purchased, customers_name, cc_owner, customers_company, customers_email_address, billing_street_address, billing_city, billing_state, billing_postcode, billing_country, customers_telephone, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_state, delivery_postcode, delivery_country, cc_type, cc_number, cc_expires \nFROM orders WHERE orders_id >= {$start} ORDER BY orders_id");
                // if both fields are filed in we select orders betwenn $start and $end
            } else {
                $orders = vam_db_query("SELECT orders_id, date_purchased, customers_name, cc_owner, customers_company, customers_email_address, billing_street_address, billing_city, billing_state, billing_postcode, billing_country, customers_telephone, delivery_name, delivery_company, delivery_street_address, delivery_city, delivery_state, delivery_postcode, delivery_country, cc_type, cc_number, cc_expires \nFROM orders WHERE orders_id >= {$start} AND orders_id <= {$end} ORDER BY orders_id");
            }
        }
    }
    //patch
    //$csv_output ="\n";
    while ($row_orders = mysql_fetch_array($orders)) {
        //start one loop
        $csv_output_ordersbefore = $csv_output;
        $Orders_id = $row_orders["orders_id"];
        $Date1 = $row_orders["date_purchased"];
        //list($Date, $Time) = explode (' ',$Date1);
        $Date = date('m/d/Y', strtotime($Date1));
        $Time = date('H:i:s', strtotime($Date1));
        $Name_On_Card1 = $row_orders["customers_name"];
        $Name_On_Card = filter_text($Name_On_Card1);
        // order changed
        list($First_Name, $Last_Name) = explode(', ', $Name_On_Card1);
        // order changed
        $Company = filter_text($row_orders["customers_company"]);
        $email = filter_text($row_orders["customers_email_address"]);
        $Billing_Address_1 = filter_text($row_orders["billing_street_address"]);
        $Billing_Address_2 = "";
        $Billing_City = filter_text($row_orders["billing_city"]);
        $Billing_State = filter_text($row_orders["billing_state"]);
        $Billing_Zip = filter_text($row_orders["billing_postcode"]);
        $Billing_Country = str_replace("(48 Contiguous Sta", "", $row_orders["billing_country"]);
        $Billing_Phone = filter_text($row_orders["customers_telephone"]);
        $ShipTo_Name1 = $row_orders["delivery_name"];
        $ShipTo_Name = filter_text($ShipTo_Name1);
        // order changed
        list($ShipTo_First_Name, $ShipTo_Last_Name) = explode(', ', $ShipTo_Name1);
        // order changed
        $ShipTo_Company = filter_text($row_orders["delivery_company"]);
        $ShipTo_Address_1 = filter_text($row_orders["delivery_street_address"]);
        $ShipTo_Address_2 = "";
        $ShipTo_City = filter_text($row_orders["delivery_city"]);
        $ShipTo_State = filter_text($row_orders["delivery_state"]);
        $ShipTo_Zip = filter_text($row_orders["delivery_postcode"]);
        $ShipTo_Country = str_replace("(48 Contiguous Sta", "", $row_orders["delivery_country"]);
        $ShipTo_Phone = "";
        $Card_Type = $row_orders["cc_type"];
        $Card_Number = $row_orders["cc_number"];
        $Exp_Date = $row_orders["cc_expires"];
        $Bank_Name = "";
        $Gateway = "";
        $AVS_Code = "";
        $Transaction_ID = "";
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:67,代码来源:exportorders.php


示例11: format_string

/** Given a simple string, this function returns the string
 *  processed by enabled filters if $CFG->filterall is enabled
 *
 *  @param string  $string     The string to be filtered.
 *  @param boolean $striplinks To strip any link in the result text.
 *  @param int     $courseid   Current course as filters can, potentially, use it
 *  @return string
 */
function format_string($string, $striplinks = false, $courseid = NULL)
{
    global $CFG, $course;
    //We'll use a in-memory cache here to speed up repeated strings
    static $strcache;
    //Calculate md5
    $md5 = md5($string . '<+>' . $striplinks);
    //Fetch from cache if possible
    if (isset($strcache[$md5])) {
        return $strcache[$md5];
    }
    if (empty($courseid)) {
        if (!empty($course->id)) {
            // An ugly hack for better compatibility
            $courseid = $course->id;
            // (copied from format_text)
        }
    }
    if (!empty($CFG->filterall)) {
        $string = filter_text($string, $courseid);
    }
    if ($striplinks) {
        //strip links in string
        $string = preg_replace('/(<a[^>]+?>)(.+?)(<\\/a>)/is', '$2', $string);
    }
    //Store to cache
    $strcache[$md5] = $string;
    return $string;
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:37,代码来源:elgglib.php


示例12: forum_print_attachments

/**
 * if return=html, then return a html string.
 * if return=text, then return a text-only string.
 * otherwise, print HTML for non-images, and return image HTML
 */
function forum_print_attachments($post, $return = NULL)
{
    global $CFG;
    $filearea = forum_file_area_name($post);
    $imagereturn = "";
    $output = "";
    if ($basedir = forum_file_area($post)) {
        if ($files = get_directory_list($basedir)) {
            $strattachment = get_string("attachment", "forum");
            foreach ($files as $file) {
                $icon = mimeinfo("icon", $file);
                $type = mimeinfo("type", $file);
                $ffurl = get_file_url("{$filearea}/{$file}");
                $image = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"\" />";
                if ($return == "html") {
                    $output .= "<a href=\"{$ffurl}\">{$image}</a> ";
                    $output .= "<a href=\"{$ffurl}\">{$file}</a><br />";
                } else {
                    if ($return == "text") {
                        $output .= "{$strattachment} {$file}:\n{$ffurl}\n";
                    } else {
                        if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                            // Image attachments don't get printed as links
                            $imagereturn .= "<br /><img src=\"{$ffurl}\" alt=\"\" />";
                        } else {
                            echo "<a href=\"{$ffurl}\">{$image}</a> ";
                            echo filter_text("<a href=\"{$ffurl}\">{$file}</a><br />");
                        }
                    }
                }
            }
        }
    }
    if ($return) {
        return $output;
    }
    return $imagereturn;
}
开发者ID:r007,项目名称:PMoodle,代码行数:43,代码来源:lib.php


示例13: get_sections

 function get_sections()
 {
     global $CFG, $USER, $DB, $OUTPUT;
     if (!empty($this->instance)) {
         get_all_mods($this->course->id, $mods, $modnames, $modnamesplural, $modnamesused);
         $context = get_context_instance(CONTEXT_COURSE, $this->course->id);
         $isteacher = has_capability('moodle/course:update', $context);
         $courseFormat = $this->course->format == 'topics' ? 'topic' : 'week';
         // displaysection - current section
         $week = optional_param($courseFormat, -1, PARAM_INT);
         if ($week != -1) {
             $displaysection = course_set_display($this->course->id, $week);
         } else {
             if (isset($USER->display[$this->course->id])) {
                 $displaysection = $USER->display[$this->course->id];
             } else {
                 $displaysection = course_set_display($this->course->id, 0);
             }
         }
         $genericName = get_string("name" . $this->course->format, $this->blockname);
         $allSections = get_all_sections($this->course->id);
         $sections = array();
         if ($this->course->format != 'social' && $this->course->format != 'scorm') {
             foreach ($allSections as $k => $section) {
                 if ($k <= $this->course->numsections) {
                     // get_all_sections() may return sections that are in the db but not displayed because the number of the sections for this course was lowered - bug [CM-B10]
                     if (!empty($section)) {
                         $newSec = array();
                         $newSec['visible'] = $section->visible;
                         if (!empty($section->name)) {
                             $strsummary = trim($section->name);
                         } else {
                             $strsummary = ucwords($genericName) . " " . $k;
                             // just a default name
                         }
                         $strsummary = $this->trim($strsummary);
                         $strsummary = trim($this->clearEnters($strsummary));
                         $newSec['name'] = $strsummary;
                         // url
                         if ($displaysection != 0) {
                             $newSec['url'] = "{$CFG->wwwroot}/course/view.php?id={$this->course->id}&{$courseFormat}={$k}";
                         } else {
                             $newSec['url'] = "#section-{$k}";
                         }
                         // resources
                         $modinfo = unserialize($this->course->modinfo);
                         $newSec['resources'] = array();
                         $sectionmods = explode(",", $section->sequence);
                         foreach ($sectionmods as $modnumber) {
                             if (empty($mods[$modnumber])) {
                                 continue;
                             }
                             $mod = $mods[$modnumber];
                             if ($mod->visible or $isteacher) {
                                 $instancename = urldecode($modinfo[$modnumber]->name);
                                 if (!empty($CFG->filterall)) {
                                     $instancename = filter_text($instancename, $this->course->id);
                                 }
                                 if (!empty($modinfo[$modnumber]->extra)) {
                                     $extra = urldecode($modinfo[$modnumber]->extra);
                                 } else {
                                     $extra = "";
                                 }
                                 // don't do anything for labels
                                 if ($mod->modname != 'label') {
                                     // Normal activity
                                     if ($mod->visible) {
                                         if (!strlen(trim($instancename))) {
                                             $instancename = $mod->modfullname;
                                         }
                                         $instancename = $this->truncate_description($instancename);
                                         $resource = array();
                                         if ($mod->modname != 'resource') {
                                             $resource['name'] = $this->truncate_description($instancename, 200);
                                             $resource['url'] = "{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}";
                                             $icon = $OUTPUT->pix_url("icon", $mod->modname);
                                             if (is_object($icon)) {
                                                 $resource['icon'] = $icon->__toString();
                                             } else {
                                                 $resource['icon'] = '';
                                             }
                                         } else {
                                             require_once $CFG->dirroot . '/mod/resource/lib.php';
                                             $info = resource_get_coursemodule_info($mod);
                                             if (isset($info->icon)) {
                                                 $resource['name'] = $this->truncate_description($info->name, 200);
                                                 $resource['url'] = "{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}";
                                                 $icon = $OUTPUT->pix_url("icon", $mod->modname);
                                                 if (is_object($icon)) {
                                                     $resource['icon'] = $icon->__toString();
                                                 } else {
                                                     $resource['icon'] = '';
                                                 }
                                             } else {
                                                 if (!isset($info->icon)) {
                                                     $resource['name'] = $this->truncate_description($info->name, 200);
                                                     $resource['url'] = "{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}";
                                                     $icon = $OUTPUT->pix_url("icon", $mod->modname);
                                                     if (is_object($icon)) {
                                                         $resource['icon'] = $icon->__toString();
//.........这里部分代码省略.........
开发者ID:edwinphillips,项目名称:moodle-block_course_menu,代码行数:101,代码来源:block_course_menu.php


示例14: get_sections

 function get_sections()
 {
     global $CFG, $USER, $DB, $OUTPUT;
     if (!empty($this->instance) && $this->page->course->id != SITEID) {
         require_once $CFG->dirroot . "/course/lib.php";
         $context = get_context_instance(CONTEXT_COURSE, $this->course->id);
         $canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
         $genericName = get_string("sectionname", 'format_' . $this->course->format);
         $modinfo = get_fast_modinfo($this->page->course);
         $mods = $modinfo->get_cms();
         //keep backwards compatibillity with moodle 2.3
         if (!isset($this->course->numsections) && function_exists('course_get_format')) {
             $this->course = course_get_format($this->course)->get_course();
         }
         $allSections = $modinfo->get_section_info_all();
         $sections = array();
         if ($this->course->format != 'social' && $this->course->format != 'scorm') {
             foreach ($allSections as $k => $section) {
                 if (!isset($this->course->numsections) || $k <= $this->course->numsections) {
                     if (!empty($section)) {
                         $newSec = array();
                         $newSec['visible'] = $section->visible;
                         $newSec['uservisible'] = !empty($section->uservisible) ? $section->uservisible : 0;
                         $newSec['availableinfo'] = !empty($section->availableinfo) ? $section->availableinfo : 0;
                         $newSec['id'] = $section->section;
                         $newSec['index'] = $k;
                         if (!empty($section->name)) {
                             $strsummary = trim($section->name);
                         } else {
                             $strsummary = ucwords($genericName) . " " . $k;
                             // just a default name
                         }
                         $strsummary = $this->trim($strsummary);
                         $newSec['name'] = $strsummary;
                         $newSec['url'] = course_get_url($this->course, $k);
                         // resources
                         $newSec['resources'] = array();
                         $sectionmods = explode(",", $section->sequence);
                         foreach ($sectionmods as $modnumber) {
                             if (empty($mods[$modnumber])) {
                                 continue;
                             }
                             $mod = $mods[$modnumber];
                             if ($mod->visible or $canviewhidden) {
                                 $instancename = urldecode($modinfo->cms[$modnumber]->name);
                                 if (!empty($CFG->filterall)) {
                                     $instancename = filter_text($instancename, $this->course->id);
                                 }
                                 // don't do anything for labels
                                 if ($mod->modname != 'label') {
                                     // Normal activity
                                     if ($mod->visible or $canviewhidden) {
                                         if (!strlen(trim($instancename))) {
                                             $instancename = $mod->modfullname;
                                         }
                                         $resource = array();
                                         if ($mod->modname != 'resource') {
                                             $resource['name'] = $instancename;
                                             $resource['url'] = "{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}";
                                             $icon = $OUTPUT->pix_url("icon", $mod->modname);
                                             if (is_object($icon)) {
                                                 $resource['icon'] = $icon->__toString();
                                             } else {
                                                 $resource['icon'] = '';
                                             }
                                         } else {
                                             require_once $CFG->dirroot . '/mod/resource/lib.php';
                                             $info = resource_get_coursemodule_info($mod);
                                             if (isset($info->icon)) {
                                                 $resource['name'] = $info->name;
                                                 $resource['url'] = "{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}";
                                                 $icon = $OUTPUT->pix_url("icon", $mod->modname);
                                                 if (is_object($icon)) {
                          

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP filter_text_input函数代码示例发布时间:2022-05-15
下一篇:
PHP filter_tags函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap