本文整理汇总了PHP中htmlentities2函数的典型用法代码示例。如果您正苦于以下问题:PHP htmlentities2函数的具体用法?PHP htmlentities2怎么用?PHP htmlentities2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了htmlentities2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add_email_to_db
function add_email_to_db()
{
global $wpdb, $current_user;
if ($_REQUEST['action'] == 'add') {
$email_name = $_REQUEST['email_name'];
$email_subject = $_REQUEST['email_subject'];
$email_text = $_REQUEST['email_text'];
if (!function_exists('espresso_member_data')) {
$current_user->ID = 1;
}
$sql = array('email_name' => $email_name, 'email_text' => $email_text, 'email_subject' => $email_subject, 'wp_user' => $current_user->ID);
$sql_data = array('%s', '%s', '%s', '%s');
if ($wpdb->insert(EVENTS_EMAIL_TABLE, $sql, $sql_data)) {
?>
<div id="message" class="updated fade"><p><strong>The email <?php
echo htmlentities2($_REQUEST['email_name']);
?>
has been added.</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong>The email <?php
echo htmlentities2($_REQUEST['email_name']);
?>
was not saved. <?php
print mysql_error();
?>
.</strong></p></div>
<?php
}
}
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:33,代码来源:add_email_to_db.php
示例2: event_espresso_form_builder_insert
function event_espresso_form_builder_insert()
{
global $wpdb, $current_user;
//$wpdb->show_errors();
$event_id = empty($_REQUEST['event_id']) ? 0 : $_REQUEST['event_id'];
$event_name = empty($_REQUEST['event_name']) ? '' : $_REQUEST['event_name'];
$question = $_POST['question'];
$question_type = $_POST['question_type'];
$question_values = empty($_POST['values']) ? NULL : $_POST['values'];
$required = !empty($_POST['required']) ? $_POST['required'] : 'N';
$admin_only = !empty($_POST['admin_only']) ? $_POST['admin_only'] : 'N';
$sequence = $_POST['sequence'] ? $_POST['sequence'] : '0';
if (!function_exists('espresso_member_data')) {
$current_user->ID = 1;
}
if ($wpdb->query("INSERT INTO " . EVENTS_QUESTION_TABLE . " (question_type, question, response, required, admin_only, sequence,wp_user)" . " VALUES ('" . $question_type . "', '" . $question . "', '" . $question_values . "', '" . $required . "', '" . $admin_only . "', " . $sequence . ",'" . $current_user->ID . "')")) {
?>
<div id="message" class="updated fade"><p><strong>The question <?php
echo htmlentities2($_REQUEST['question']);
?>
has been added.</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong>The question <?php
echo htmlentities2($_REQUEST['question']);
?>
was not saved. <?php
//$wpdb->print_error();
?>
.</strong></p></div>
<?php
}
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:35,代码来源:insert_question.php
示例3: smarty_modifier_escape
/**
* Smarty escape modifier plugin
*
* Type: modifier<br>
* Name: escape<br>
* Purpose: Escape the string according to escapement type
* @link http://smarty.php.net/manual/en/language.modifier.escape.php
* escape (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @param html|htmlall|url|quotes|hex|hexentity|javascript
* @return string
*/
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
{
switch ($esc_type) {
case 'html':
return htmlspecialchars2($string, ENT_QUOTES, $char_set);
case 'htmlall':
return htmlentities2($string, ENT_QUOTES, $char_set);
case 'url':
return rawurlencode($string);
case 'urlpathinfo':
return str_replace('%2F', '/', rawurlencode($string));
case 'quotes':
// escape unescaped single quotes
return preg_replace("%(?<!\\\\)'%", "\\'", $string);
case 'hex':
// escape every character into hex
$return = '';
for ($x = 0; $x < strlen($string); $x++) {
$return .= '%' . bin2hex($string[$x]);
}
return $return;
case 'hexentity':
$return = '';
for ($x = 0; $x < strlen($string); $x++) {
$return .= '&#x' . bin2hex($string[$x]) . ';';
}
return $return;
case 'decentity':
$return = '';
for ($x = 0; $x < strlen($string); $x++) {
$return .= '&#' . ord($string[$x]) . ';';
}
return $return;
case 'javascript':
// escape quotes and backslashes, newlines, etc.
return strtr($string, array('\\' => '\\\\', "'" => "\\'", '"' => '\\"', "\r" => '\\r', "\n" => '\\n', '</' => '<\\/'));
case 'mail':
// safe way to display e-mail address on a web page
return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
case 'nonstd':
// escape non-standard chars, such as ms document quotes
$_res = '';
for ($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
$_ord = ord(substr($string, $_i, 1));
// non-standard char, escape it
if ($_ord >= 126) {
$_res .= '&#' . $_ord . ';';
} else {
$_res .= substr($string, $_i, 1);
}
}
return $_res;
default:
return $string;
}
}
开发者ID:mon1k,项目名称:smarty,代码行数:69,代码来源:modifier.escape.php
示例4: esc_xss
/**
* Escape string conter XSS attack
*
* @since 1.0
* @param String $value
* @param String $type
* @return String
*/
private static function esc_xss($value, $type)
{
switch ($type) {
case 'html':
$value = self::rip_tags($value);
break;
case 'code':
$value = htmlentities2($value);
break;
}
return $value;
}
开发者ID:Luanramos,项目名称:jogar-mais-social-share-buttons,代码行数:20,代码来源:utils.helper.php
示例5: wpi_get_author_name
/**
* author display_name
*
*/
function wpi_get_author_name($type = 'hcard')
{
global $authordata;
$name = $display_name = apply_filters('the_author', $authordata->display_name);
$name = $display_name = ent2ncr(htmlentities2($name));
$author_url = $authordata->user_url;
$author_url = $author_url != 'http://' ? $author_url : WPI_URL;
switch ($type) {
case 'link':
/** simple links
*
*/
$attribs = array('href' => $author_url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . ''s Website', 'rev' => 'author:' . $authordata->user_nicename);
$output = _t('a', $display_name, $attribs);
break;
case 'hcard':
/** convert to microformats
* address:a:span
*/
// split the name
$name = explode('name', $name);
if (is_array($name)) {
if (Wpi::hasCount($name)) {
if (isset($name[0])) {
$output = _t('span', $name[0], array('class' => 'nickname'));
}
if (isset($name[1])) {
$output = _t('span', $name[0], array('class' => 'given-name')) . ' ';
$output .= _t('span', $name[1], array('class' => 'family-name'));
}
}
} else {
$output = _t('span', $author_name, array('class' => 'nickname'));
}
// author post url;
$url = get_author_posts_url($authordata->ID, $authordata->user_nicename);
$url = apply_filters(wpiFilter::FILTER_LINKS, $url);
$attribs = array('href' => $url, 'class' => 'url fn dc-creator', 'rel' => 'colleague foaf.homepage foaf.maker', 'title' => 'Visit ' . $display_name . ''s Author page', 'rev' => 'author:' . $authordata->user_nicename);
$output = _t('a', $output, $attribs);
// microID sha-1 hash
$hash = get_microid_hash($authordata->user_email, $author_url);
// wrap hcard
$output = _t('cite', $output, array('class' => 'vcard microid-' . $hash));
break;
default:
$output = $name;
break;
}
return apply_filters(wpiFilter::FILTER_AUTHOR_NAME . $type, $output);
}
开发者ID:Creativebq,项目名称:wp-istalker,代码行数:54,代码来源:author.php
示例6: affwp_search_users
function affwp_search_users()
{
if (empty($_POST['search'])) {
die('-1');
}
if (!current_user_can('manage_affiliates')) {
die('-1');
}
$search_query = htmlentities2(trim($_POST['search']));
do_action('affwp_pre_search_users', $search_query);
$args = array();
if (isset($_POST['status'])) {
$status = mb_strtolower(htmlentities2(trim($_POST['status'])));
switch ($status) {
case 'none':
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
$args = array('exclude' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
break;
case 'any':
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
$args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
break;
default:
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999, 'status' => $status));
$args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
}
}
//make sure we filter the search columns so they only include the columns we want to search
//this filter was exposed by WordPress in WP 3.6.0
add_filter('user_search_columns', function ($search_columns, $search, WP_User_Query $WP_User_Query) {
return array('user_login', 'display_name', 'user_email');
}, 10, 3);
//add search string to args
$args['search'] = mb_strtolower(htmlentities2(trim($_POST['search'])));
//get users matching search
$found_users = get_users($args);
if ($found_users) {
$user_list = '<ul>';
foreach ($found_users as $user) {
$user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
}
$user_list .= '</ul>';
echo json_encode(array('results' => $user_list, 'id' => 'found'));
} else {
echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
}
die;
}
开发者ID:nerrad,项目名称:AffiliateWP,代码行数:48,代码来源:ajax-actions.php
示例7: affwp_search_users
function affwp_search_users()
{
if (empty($_POST['search'])) {
die('-1');
}
if (!current_user_can('manage_affiliates')) {
die('-1');
}
$search_query = htmlentities2(trim($_POST['search']));
do_action('affwp_pre_search_users', $search_query);
$args = array();
if (isset($_POST['status'])) {
$status = mb_strtolower(htmlentities2(trim($_POST['status'])));
switch ($status) {
case 'none':
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
$args = array('exclude' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
break;
case 'any':
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999));
$args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
break;
default:
$affiliates = affiliate_wp()->affiliates->get_affiliates(array('number' => 9999, 'status' => $status));
$args = array('include' => array_map('absint', wp_list_pluck($affiliates, 'user_id')));
}
}
$found_users = array_filter(get_users($args), function ($user) {
$q = mb_strtolower(htmlentities2(trim($_POST['search'])));
$user_login = mb_strtolower($user->user_login);
$display_name = mb_strtolower($user->display_name);
$user_email = mb_strtolower($user->user_email);
// Detect query term matches from these user fields (in order of priority)
return false !== mb_strpos($user_login, $q) || false !== mb_strpos($display_name, $q) || false !== mb_strpos($user_email, $q);
});
if ($found_users) {
$user_list = '<ul>';
foreach ($found_users as $user) {
$user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
}
$user_list .= '</ul>';
echo json_encode(array('results' => $user_list, 'id' => 'found'));
} else {
echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
}
die;
}
开发者ID:companyjuice,项目名称:AffiliateWP,代码行数:47,代码来源:ajax-actions.php
示例8: add_to_calendar
function add_to_calendar()
{
global $wpdb, $current_user, $org_options;
$event_id = $_REQUEST['id'];
$results = $wpdb->get_results("SELECT * FROM " . get_option('events_detail_tbl') . " WHERE id =" . $event_id);
foreach ($results as $result) {
$event_id = $result->id;
$event_name = $result->event_name;
$event_desc = $result->event_desc;
$start_date = $result->start_date;
$end_date = $result->end_date;
$start_time = $result->start_time;
$end_time = $result->end_time;
$calendar_category = $_REQUEST['calendar_category'];
$linky = home_url() . '/?page_id=' . $org_options['event_page_id'] . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . $event_name;
$sql = "INSERT INTO " . WP_CALENDAR_TABLE . " SET event_title='" . mysql_escape_string($event_name) . "', event_desc='" . mysql_escape_string($event_desc) . "', event_begin='" . mysql_escape_string($start_date) . "', event_recur='S', event_repeats='0', event_end='" . mysql_escape_string($end_date) . "', event_time='" . mysql_escape_string($start_time) . "', event_author=" . $current_user->ID . ", event_category=" . mysql_escape_string($calendar_category) . ", event_link='" . mysql_escape_string($linky) . "'";
}
if ($wpdb->query($sql)) {
?>
<div id="message" class="updated fade"><p><strong><?php
_e('The event', 'event_espresso');
?>
<a href="<?php
echo $_SERVER["REQUEST_URI"];
?>
#event-id-<?php
echo $wpdb->insert_id;
?>
"><?php
echo htmlentities2($event_name);
?>
</a> <?php
_e('has been added.', 'event_espresso');
?>
</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong><?php
_e('There was an error in your submission, please try again. The event was not saved!', 'event_espresso');
print mysql_error();
?>
.</strong></p></div>
<?php
}
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:46,代码来源:add_to_calendar.php
示例9: update_event_email
function update_event_email()
{
global $wpdb;
$email_id = $_REQUEST['email_id'];
$email_name = $_REQUEST['email_name'];
$email_subject = $_REQUEST['email_subject'];
$email_text = $_REQUEST['email_text'];
$sql = array('email_name' => $email_name, 'email_text' => $email_text, 'email_subject' => $email_subject);
$update_id = array('id' => $email_id);
$sql_data = array('%s', '%s', '%s');
if ($wpdb->update(EVENTS_EMAIL_TABLE, $sql, $update_id, $sql_data, array('%d'))) {
?>
<div id="message" class="updated fade"><p><strong><?php
_e('The email', 'event_espresso');
?>
<?php
echo stripslashes(htmlentities2($_REQUEST['email_name']));
?>
<?php
_e('has been updated', 'event_espresso');
?>
.</strong></p></div>
<?php
} else {
?>
<div id="message" class="error"><p><strong><?php
_e('The email', 'event_espresso');
?>
<?php
echo stripslashes(htmlentities2($_REQUEST['email_name']));
?>
<?php
_e('was not updated', 'event_espresso');
?>
. <?php
print mysql_error();
?>
.</strong></p></div>
<?php
}
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:42,代码来源:update_email.php
示例10: affwp_search_users
function affwp_search_users()
{
if (empty($_POST['user_name'])) {
die('-1');
}
if (!current_user_can('manage_affiliates')) {
die('-1');
}
$search_query = htmlentities2(trim($_POST['user_name']));
do_action('affwp_pre_search_users', $search_query);
$found_users = get_users(array('number' => 9999, 'search' => $search_query . '*'));
if ($found_users) {
$user_list = '<ul>';
foreach ($found_users as $user) {
$user_list .= '<li><a href="#" data-id="' . esc_attr($user->ID) . '" data-login="' . esc_attr($user->user_login) . '">' . esc_html($user->user_login) . '</a></li>';
}
$user_list .= '</ul>';
echo json_encode(array('results' => $user_list, 'id' => 'found'));
} else {
echo json_encode(array('results' => '<p>' . __('No users found', 'affiliate-wp') . '</p>', 'id' => 'fail'));
}
die;
}
开发者ID:jwondrusch,项目名称:AffiliateWP,代码行数:23,代码来源:ajax-actions.php
示例11: ga_options_do_network_errors
protected function ga_options_do_network_errors()
{
if (isset($_REQUEST['updated']) && $_REQUEST['updated']) {
?>
<div id="setting-error-settings_updated" class="updated settings-error">
<p>
<strong><?php
_e('Settings saved.', 'google-apps-login');
?>
</strong>
</p>
</div>
<?php
}
if (isset($_REQUEST['error_setting']) && is_array($_REQUEST['error_setting']) && isset($_REQUEST['error_code']) && is_array($_REQUEST['error_code'])) {
$error_code = $_REQUEST['error_code'];
$error_setting = $_REQUEST['error_setting'];
if (count($error_code) > 0 && count($error_code) == count($error_setting)) {
for ($i = 0; $i < count($error_code); ++$i) {
?>
<div id="setting-error-settings_<?php
echo $i;
?>
" class="error settings-error">
<p>
<strong><?php
echo htmlentities2($this->get_error_string($error_setting[$i] . '|' . $error_code[$i]));
?>
</strong>
</p>
</div>
<?php
}
}
}
}
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:36,代码来源:core_google_apps_login.php
示例12: _setContent
private function _setContent()
{
$content = false;
if (is_object($this->osd)) {
$blog_name = htmlentities2($this->osd->blog_name);
$title = sprintf(__('%s Search', WPI_META), $blog_name);
$desc = $blog_name . ', ' . $this->osd->blog_desc;
$email = 'postmaster+abuse@' . parse_url($this->osd->blog_url, PHP_URL_HOST);
$search_uri = $this->osd->blog_url . '/' . $this->osd->search_param;
$xml = "\t" . '<ShortName>' . $title . '</ShortName>' . "\n";
$xml .= "\t" . '<Description>' . $desc . '</Description>' . "\n";
$xml .= "\t" . '<Contact>' . $email . '</Contact>' . "\n";
$xml .= "\t" . '<Url type="' . $this->osd->blog_html_type . '" method="get" template="' . $search_uri . '"></Url>' . "\n";
$xml .= "\t" . '<LongName>' . $title . '</LongName>' . "\n";
if ($this->osd->blog_favicon) {
$xml .= "\t" . '<Image height="16" width="16" type="image/vnd.microsoft.icon">' . $this->osd->blog_favicon . '</Image>' . "\n";
}
$xml .= "\t" . '<Query role="example" searchTerms="blogging" />';
$xml .= "\n\t" . '<Developer>ChaosKaizer</Developer>';
$xml .= "\n\t" . '<Attribution>Search data &copy; ' . date('Y', $_SERVER['REQUEST_TIME']) . ', ' . $blog_name . ', Some Rights Reserved. CC by-nc 2.5.</Attribution>';
$xml .= "\n\t" . '<SyndicationRight>open</SyndicationRight>';
$xml .= "\n\t" . '<AdultContent>false</AdultContent>';
$xml .= "\n\t" . '<Language>' . $this->osd->language . '</Language>';
$xml .= "\n\t" . '<OutputEncoding>UTF-8</OutputEncoding>';
$xml .= "\n\t" . '<InputEncoding>UTF-8</InputEncoding>' . "\n";
}
$this->content = $xml;
unset($xml);
}
开发者ID:Creativebq,项目名称:wp-istalker,代码行数:29,代码来源:osd.php
示例13: espresso_google_map_link
function espresso_google_map_link($atts)
{
extract($atts);
$address = "{$address}";
$city = "{$city}";
$state = "{$state}";
$zip = "{$zip}";
$country = "{$country}";
$text = isset($text) ? "{$text}" : "";
$type = isset($type) ? "{$type}" : "";
$map_w = isset($map_w) ? "{$map_w}" : 400;
$map_h = isset($map_h) ? "{$map_h}" : 400;
$gaddress = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode($gaddress));
switch ($type) {
case 'text':
default:
$text = $text == '' ? __('Map and Directions', 'event_espresso') : $text;
break;
case 'url':
$text = $google_map;
break;
case 'map':
$google_map_link = '<a href="' . $google_map . '" target="_blank">' . '<img id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2('http://maps.googleapis.com/maps/api/staticmap?center=' . urlencode($gaddress) . '&zoom=14&size=' . $map_w . 'x' . $map_h . '&markers=color:green|label:|' . urlencode($gaddress) . '&sensor=false') . '" /></a>';
return $google_map_link;
}
$google_map_link = '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
return $google_map_link;
}
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:29,代码来源:main.php
示例14: searchandreplace_action
function searchandreplace_action()
{
if (isset($_POST['submitted'])) {
check_admin_referer('searchandreplace_nonce');
$myecho = '';
if (empty($_POST['search_text'])) {
$myecho .= '<div class="error"><p><strong>» ' . __('You must specify some text to replace!', FB_SAR_TEXTDOMAIN) . '</strong></p></div><br class="clear">';
} else {
$myecho .= '<div class="updated fade">';
$myecho .= '<p><strong>» ' . __('Performing search', FB_SAR_TEXTDOMAIN);
if (!isset($_POST['sall'])) {
$_POST['sall'] = NULL;
}
if ($_POST['sall'] == 'srall') {
$myecho .= ' ' . __('and replacement', FB_SAR_TEXTDOMAIN);
}
$myecho .= ' ...</strong></p>';
$myecho .= '<p>» ' . __('Searching for', FB_SAR_TEXTDOMAIN) . ' <code>' . stripslashes(htmlentities2($_POST['search_text'])) . '</code>';
if (isset($_POST['replace_text']) && $_POST['sall'] == 'srall') {
$myecho .= __('and replacing with', FB_SAR_TEXTDOMAIN) . ' <code>' . stripslashes(htmlentities2($_POST['replace_text'])) . '</code></p>';
}
$myecho .= '</div><br class="clear" />';
if (!isset($_POST['replace_text'])) {
$_POST['replace_text'] = NULL;
}
$error = searchandreplace_doit($_POST['search_text'], $_POST['replace_text'], $_POST['sall'], isset($_POST['content']), isset($_POST['guid']), isset($_POST['id']), isset($_POST['title']), isset($_POST['excerpt']), isset($_POST['meta_value']), isset($_POST['comment_content']), isset($_POST['comment_author']), isset($_POST['comment_author_email']), isset($_POST['comment_author_url']), isset($_POST['comment_count']), isset($_POST['cat_description']), isset($_POST['tag']), isset($_POST['user_id']), isset($_POST['user_login']), isset($_POST['singups']));
if ($error != '') {
$myecho .= $error;
} else {
$myecho .= '<p>' . __('Completed successfully!', FB_SAR_TEXTDOMAIN) . '</p></div>';
}
}
echo $myecho;
}
}
开发者ID:Vinnica,项目名称:theboxerboston.com,代码行数:35,代码来源:search-and-replace.php
示例15: openid_login_errors
/**
* Setup OpenID errors to be displayed to the user.
*/
function openid_login_errors()
{
$self = basename($GLOBALS['pagenow']);
if ($self != 'wp-login.php') {
return;
}
if (array_key_exists('openid_error', $_REQUEST)) {
global $error;
$error = htmlentities2($_REQUEST['openid_error']);
}
}
开发者ID:gerasiov,项目名称:wordpress-openid,代码行数:14,代码来源:login.php
示例16: _e
?>
</p>
<p><input type="submit" name="submit" value="<?php
_e('Upload File');
?>
" /></p>
</form>
</div><?php
break;
case 'upload':
$imgalt = basename(isset($_POST['imgalt']) ? $_POST['imgalt'] : '');
$img1_name = strlen($imgalt) ? $imgalt : basename($_FILES['img1']['name']);
$img1_name = preg_replace('/[^a-z0-9_.]/i', '', $img1_name);
$img1_size = $_POST['img1_size'] ? intval($_POST['img1_size']) : intval($_FILES['img1']['size']);
$img1_type = strlen($imgalt) ? $_POST['img1_type'] : $_FILES['img1']['type'];
$imgdesc = htmlentities2($_POST['imgdesc']);
$pi = pathinfo($img1_name);
$imgtype = strtolower($pi['extension']);
if (in_array($imgtype, $allowed_types) == false) {
die(sprintf(__('File %1$s of type %2$s is not allowed.'), $img1_name, $imgtype));
}
if (strlen($imgalt)) {
$pathtofile = get_settings('fileupload_realpath') . "/" . $imgalt;
$img1 = $_POST['img1'];
} else {
$pathtofile = get_settings('fileupload_realpath') . "/" . $img1_name;
$img1 = $_FILES['img1']['tmp_name'];
}
// makes sure not to upload duplicates, rename duplicates
$i = 1;
$pathtofile2 = $pathtofile;
开发者ID:johnwonder,项目名称:WordPressLearn,代码行数:31,代码来源:upload.php
示例17: WpUserState
<?php
/**************************************************************************************************
* basic example of using WpUserState class
**************************************************************************************************/
include 'D:/xampp/htdocs/myblog/personal/uwiuw/version/class/UserState.php';
$WpUserState = new WpUserState('sqlModule.php');
$userRegister = new userRegister();
$result = $userRegister::isProtectedUser(2, TRUE);
$hasildebug = print_r($result, TRUE);
echo '<pre style="font-size:14px">' . '$userRegister : ' . htmlentities2($hasildebug) . '</pre>';
开发者ID:uwiuw,项目名称:myphpclass,代码行数:11,代码来源:_example_WpUserState.php
示例18: get_series_link
/**
* get_series_link() - returns what the url is for the series id passed as the parameter.
* requires series_id
*
* @package Organize Series WordPress Plugin
* @since 2.0
*
* @uses get_series_permastruct() - gets the permastructure for series.
* @uses get_term() - get's the series information from the taxonomy tables.
* @uses get_option() - with the parameter 'home' calls up the uri for the home directory of the WordPress install.
* @uses str_replace()
* @uses apply_filters() - with 'series_link' as the callback for pluggable filtering of the series_link.
*
* @param int $series_id - the series_id we want the link for.
*
* @return string - the final constructed series link.
*/
function get_series_link($series_id = '')
{
global $orgseries;
$series_token = '%' . SERIES_QUERYVAR . '%';
if (empty($series_id) || $series_id == null) {
$series_slug = get_query_var(SERIES_QUERYVAR);
}
if (is_numeric($series_id)) {
$series_slug = get_term_field('slug', $series_id, 'series');
} else {
if ($series_slug_get = get_term_by('name', htmlentities2($series_id), 'series')) {
$series_slug = $series_slug_get;
}
}
if (empty($series_slug) || $series_slug == null || $series_slug == '') {
return false;
}
$serieslink = get_term_link($series_slug, 'series');
return apply_filters('series_link', $serieslink, $series_id);
}
开发者ID:briancfeeney,项目名称:portigal,代码行数:37,代码来源:orgSeries-template-tags.php
示例19: output
//.........这里部分代码省略.........
\t\t\t}
EOF;
}
$started_column_replace = false;
for ($i = 1; $i <= 12; $i++) {
if (!empty($column_css_classes['span' . $i])) {
if (!$started_column_replace) {
$started_column_replace = true;
$function .= <<<EOF
\t\t\tif(\$tag=='vc_column' || \$tag=='vc_column_inner') {
EOF;
}
$function .= <<<EOF
\t\t\t\t\$class_string = str_replace('vc_span{$i}', '{$column_css_classes['span' . $i]}', \$class_string);
EOF;
}
}
if ($started_column_replace) {
$function .= <<<EOF
\t\t\t}
EOF;
}
$function .= <<<EOF
\t\t\treturn \$class_string;
\t\t}
\t\t// Filter to Replace default css class for vc_row shortcode and vc_column
\t\tadd_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
\t\t?>
EOF;
echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
} else {
$function = <<<EOF
\t\t<?php
\t\tfunction custom_css_classes_for_vc_row_and_vc_column(\$class_string, \$tag) {
\t\t\tif(\$tag=='vc_row' || \$tag=='vc_row_inner') {
\t\t\t\t\$class_string = str_replace('vc_row-fluid', 'my_row-fluid', \$class_string);
\t\t\t}
\t\t\tif(\$tag=='vc_column' || \$tag=='vc_column_inner') {
\t\t\t\t\$class_string = preg_replace('/vc_span(\\d{1,2})/', 'my_span\$1', \$class_string);
\t\t\t}
\t\t\treturn \$class_string;
\t\t}
\t\t// Filter to Replace default css class for vc_row shortcode and vc_column
\t\tadd_filter('vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2);
\t\t?>
EOF;
echo '<div class="vc_filter_function"><pre>' . htmlentities2($function) . '</pre></div>';
}
?>
</div>
<?php
settings_fields($this->option_group . '_' . $tab);
?>
<?php
do_settings_sections($this->page . '_' . $tab);
?>
<?php
wp_nonce_field('wpb_js_settings_save_action', 'wpb_js_nonce_field');
?>
<input type="hidden" name="vc_action" value="" id="vc-settings-<?php
echo $tab;
?>
开发者ID:scottnkerr,项目名称:eeco,代码行数:67,代码来源:class-vc-settings.php
示例20: GeographLinks
function GeographLinks(&$posterText, $thumbs = false)
{
global $imageCredits, $CONF, $global_thumb_count;
//look for [[gridref_or_photoid]] and [[[gridref_or_photoid]]]
if (preg_match_all('/\\[\\[(\\[?)(\\w{0,3} ?\\d+ ?\\d*)(\\]?)\\]\\]/', $posterText, $g_matches)) {
$thumb_count = 0;
foreach ($g_matches[2] as $i => $g_id) {
//photo id?
if (is_numeric($g_id)) {
if ($global_thumb_count > $CONF['global_thumb_limit'] || $thumb_count > $CONF['post_thumb_limit']) {
$posterText = preg_replace("/\\[?\\[\\[{$g_id}\\]\\]\\]?/", "[[<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_id}</a>]]", $posterText);
} else {
if (!isset($g_image)) {
$g_image = new GridImage();
}
$ok = $g_image->loadFromId($g_id);
if ($g_image->moderation_status == 'rejected') {
$posterText = str_replace("[[[{$g_id}]]]", '<img src="/photos/error120.jpg" width="120" height="90" alt="image no longer available"/>', $posterText);
} elseif ($ok) {
$g_title = $g_image->grid_reference . ' : ' . htmlentities2($g_image->title);
if ($g_matches[1][$i]) {
if ($thumbs) {
$g_title .= ' by ' . htmlentities($g_image->realname);
$g_img = $g_image->getThumbnail(120, 120, false, true);
$posterText = str_replace("[[[{$g_id}]]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\" target=\"_blank\" title=\"{$g_title}\">{$g_img}</a>", $posterText);
if (isset($imageCredits[$g_image->realname])) {
$imageCredits[$g_image->realname]++;
} else {
$imageCredits[$g_image->realname] = 1;
}
} else {
//we don't place thumbnails in non forum links
$posterText = str_replace("[[[{$g_id}]]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_title}</a>", $posterText);
}
} else {
$posterText = preg_replace("/(?<!\\[)\\[\\[{$g_id}\\]\\]/", "<a href=\"http://{$_SERVER['HTTP_HOST']}/photo/{$g_id}\">{$g_title}</a>", $posterText);
}
}
$global_thumb_count++;
}
$thumb_count++;
} else {
//link to grid ref
$posterText = str_replace("[[{$g_id}]]", "<a href=\"http://{$_SERVER['HTTP_HOST']}/gridref/{$g_id}\">" . str_replace(' ', '+', $g_id) . "</a>", $posterText);
}
}
}
if ($CONF['CONTENT_HOST'] != $_SERVER['HTTP_HOST']) {
$posterText = str_replace($CONF['CONTENT_HOST'], $_SERVER['HTTP_HOST'], $posterText);
}
$posterText = preg_replace('/(?<!["\'>F=])(https?:\\/\\/[\\w\\.-]+\\.\\w{2,}\\/?[\\w\\~\\-\\.\\?\\,=\'\\/\\\\+&%\\$#\\(\\)\\;\\:]*)(?<!\\.)(?!["\'])/e', "smarty_function_external(array('href'=>\"\$1\",'text'=>'Link','nofollow'=>1,'title'=>\"\$1\"))", $posterText);
$posterText = preg_replace('/(?<![\\/F\\.])(www\\.[\\w\\.-]+\\.\\w{2,}\\/?[\\w\\~\\-\\.\\?\\,=\'\\/\\\\+&%\\$#\\(\\)\\;\\:]*)(?<!\\.)(?!["\'])/e', "smarty_function_external(array('href'=>\"http://\$1\",'text'=>'Link','nofollow'=>1,'title'=>\"\$1\"))", $posterText);
return $posterText;
}
|
请发表评论