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

PHP wp_strip_all_tags函数代码示例

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

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



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

示例1: create

 /**
  * Creates a patchchat post by
  *   creating a user,
  *   creating a new patchchat post,
  *   creating first comment to post,
  *   adding an 'instant reply' comment from admin,
  *   building a new transient,
  *   return new transient to new user
  *
  * @author  caseypatrickdriscoll
  *
  * @edited 2015-08-03 16:32:16 - Adds user signon after creation
  * @edited 2015-08-28 20:11:39 - Adds PatchChat_Settings::instant_reply
  * @edited 2015-08-28 20:19:22 - Adds PatchChat_Settings::bot
  */
 public static function create($patchchat)
 {
     $email = $patchchat['email'];
     $text = $patchchat['text'];
     $username = substr($email, 0, strpos($email, "@"));
     $password = wp_generate_password(10, false);
     $title = substr($text, 0, 40);
     $time = current_time('mysql');
     $text = wp_strip_all_tags($text);
     /* Create User */
     $user_id = wp_create_user($username, $password, $email);
     // TODO: Add the user's name to the user
     // TODO: Check to see if user logged in, no need to create again
     wp_new_user_notification($user_id, $password);
     $user = get_user_by('id', $user_id);
     $creds = array('user_login' => $user->user_login, 'user_password' => $password, 'remember' => true);
     $user_signon = wp_signon($creds, false);
     /* Create PatchChat Post */
     $post = array('post_title' => $title, 'post_type' => 'patchchat', 'post_author' => $user_id, 'post_status' => 'new', 'post_date' => $time);
     $post_id = wp_insert_post($post);
     /* Create First Comment */
     $comment = array('comment_post_ID' => $post_id, 'user_id' => $user_id, 'comment_content' => $text, 'comment_date' => $time, 'comment_author_IP' => $_SERVER['REMOTE_ADDR'], 'comment_agent' => $_SERVER['HTTP_USER_AGENT']);
     $comment_id = wp_insert_comment($comment);
     /* Insert default action comment reply */
     $options = array('chatid' => $post_id, 'displayname' => $user->display_name);
     $comment = array('comment_post_ID' => $post_id, 'user_id' => PatchChat_Settings::bot(), 'comment_content' => PatchChat_Settings::instant_reply($options), 'comment_type' => 'auto', 'comment_date' => current_time('mysql'));
     $comment_id = wp_insert_comment($comment);
     // Will build the Transient
     PatchChat_Transient::get($post_id);
     return PatchChat_Controller::get_user_state($user_id);
 }
开发者ID:patchdotworks,项目名称:patchchat,代码行数:46,代码来源:class-patchchat-controller.php


示例2: fb_strip_and_format_desc

function fb_strip_and_format_desc($post)
{
    $desc_no_html = "";
    $desc_no_html = strip_shortcodes($desc_no_html);
    // Strip shortcodes first in case there is HTML inside the shortcode
    $desc_no_html = wp_strip_all_tags($desc_no_html);
    // Strip all html
    $desc_no_html = trim($desc_no_html);
    // Trim the final string, we may have stripped everything out of the post so this will make the value empty if that's the case
    // Check if empty, may be that the strip functions above made excerpt empty, doubhtful but we want to be 100% sure.
    if (empty($desc_no_html)) {
        $desc_no_html = $post->post_content;
        // Start over, this time with the post_content
        $desc_no_html = strip_shortcodes($desc_no_html);
        // Strip shortcodes first in case there is HTML inside the shortcode
        $desc_no_html = str_replace(']]>', ']]>', $desc_no_html);
        // Angelo Recommendation, if for some reason ]]> happens to be in the_content, rare but We've seen it happen
        $desc_no_html = wp_strip_all_tags($desc_no_html);
        $excerpt_length = apply_filters('excerpt_length', 55);
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $desc_no_html = wp_trim_words($desc_no_html, $excerpt_length, $excerpt_more);
        $desc_no_html = trim($desc_no_html);
        // Trim the final string, we may have stripped everything out of the post so this will make the value empty if that's the case
    }
    $desc_no_html = str_replace(array("\r\n", "\r", "\n"), ' ', $desc_no_html);
    // I take it Facebook doesn't like new lines?
    return $desc_no_html;
}
开发者ID:hscale,项目名称:webento,代码行数:28,代码来源:fb-open-graph.php


示例3: sm_blockquotes_insert

function sm_blockquotes_insert($atts, $content = null)
{
    $atts = shortcode_atts(array('cite' => 'Citation', 'type' => 'left', 'content' => !empty($content) ? $content : 'Content Goes Here'), $atts);
    extract($atts);
    $shape = '';
    $cite = wp_strip_all_tags($cite);
    $content = wp_strip_all_tags($content);
    /*
     * Blockquotes
     */
    if (strtolower($type) == 'left') {
        $shape .= "<div class = 'sm_blockquote left_text'> {$content} ";
        $shape .= "<cite class = 'sm_blockquote_cite' >- {$cite}</cite></div>";
        return $shape;
    }
    if (strtolower($type) == 'center') {
        $shape .= "<div class = 'sm_blockquote center_text'> {$content} ";
        $shape .= "<cite class = 'sm_blockquote_cite' >- {$cite}</cite></div>";
        return $shape;
    }
    if (strtolower($type) == 'right') {
        $shape .= "<div class = 'sm_blockquote right_text'> {$content} ";
        $shape .= "<cite class = 'sm_blockquote_cite' >- {$cite}</cite></div>";
        return $shape;
    }
}
开发者ID:oogloouet,项目名称:sm-shortcodes,代码行数:26,代码来源:sm-blockquotes.php


示例4: smart_excerpt

/**
 * Smart Excerpt
 *
 * Returns an excerpt which is not longer than the given length and always
 * ends with a complete sentence. If first sentence is longer than length,
 * it will add the standard ellipsis… Length is the number of characters.
 *
 * Usage: <?php smart_excerpt(450); >
 *
 * http://www.distractedbysquirrels.com/blog/wordpress-improved-dynamic-excerpt
 */
function smart_excerpt($length, $postId = false)
{
    if ($postId) {
        $post = get_post($postId);
        $text = $post->post_excerpt;
    } else {
        global $post;
        $text = $post->post_excerpt;
    }
    if ('' == $text) {
        if ($postId) {
            $text = $post->post_content;
        } else {
            $text = get_the_content('');
        }
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
    }
    $text = strip_shortcodes($text);
    $text = wp_strip_all_tags($text, true);
    if (empty($length)) {
        $length = 300;
    }
    $text = substr($text, 0, $length);
    $excerpt = nucleus_reverse_strrchr($text, '.', 1);
    if ($excerpt) {
        echo apply_filters('the_excerpt', $excerpt);
    } else {
        echo apply_filters('the_excerpt', $text . '…');
    }
}
开发者ID:rgfx,项目名称:Nucleus,代码行数:42,代码来源:extras.php


示例5: oxford_comment_form_defaults

 /**
  * Change the comment form defaults.
  *
  * @since  1.0.
  *
  * @param  array    $defaults    The default values.
  * @return array                 The modified defaults.
  */
 function oxford_comment_form_defaults($defaults)
 {
     $input_size = 22;
     // Comment form title
     $defaults['title_reply'] = __('Leave a comment', 'oxford');
     // Comment form notes
     $defaults['comment_notes_before'] = '';
     $defaults['comment_notes_after'] = '';
     // Comment Author
     $comment_author = isset($_POST['author']) ? wp_strip_all_tags($_POST['author'], true) : null;
     $author_field = sprintf('<p class="comment-form-author"><input class="text-input respond-type" type="text" name="%1$s" id="%1$s" value="%3$s" size="%4$d" aria-required="true" tabindex="%5$d" placeholder="%2$s" /></p>', 'author', esc_attr_x('Name', 'comment field placeholder', 'oxford'), esc_attr($comment_author), $input_size, 1);
     // Comment Author Email
     $comment_author_email = isset($_POST['email']) ? trim($_POST['email']) : null;
     $email_field = sprintf('<p class="comment-form-email"><input class="text-input respond-type" type="email" name="%1$s" id="%1$s" value="%3$s" size="%4$d" aria-required="true" tabindex="%5$d" placeholder="%2$s" /></p>', 'email', esc_attr_x('Email', 'comment field placeholder', 'oxford'), esc_attr($comment_author_email), $input_size, 2);
     // Comment Author URL
     $comment_author_url = isset($_POST['url']) ? trim($_POST['url']) : null;
     $url_field = sprintf('<p class="comment-form-url"><input class="text-input respond-type" type="url" name="%1$s" id="%1$s" value="%3$s" size="%4$d" tabindex="%5$d" placeholder="%2$s" /></p>', 'url', esc_attr_x('Website', 'comment field placeholder', 'oxford'), esc_attr($comment_author_url), $input_size, 3);
     // Set the fields in the $defaults array
     $defaults['fields'] = array('author' => $author_field, 'email' => $email_field, 'url' => $url_field);
     // Comment Form
     $defaults['comment_field'] = sprintf('<p class="comment-form-comment"><textarea id="comment" class="blog-textarea respond-type" name="comment" cols="58" rows="10" aria-required="true" tabindex="4" placeholder="%s"></textarea></p>', esc_attr_x('Type reply here&hellip;', 'comment field placeholder', 'oxford'));
     // Submit label
     $defaults['label_submit'] = __('Post comment', 'oxford');
     return $defaults;
 }
开发者ID:andrewkhunn,项目名称:lancero,代码行数:33,代码来源:non-wpcom.php


示例6: crop_str

 /**
  * Truncates a string to be shorter than or equal to the length specified
  * Attempts to truncate on word boundaries
  *
  * @param string $string
  * @param int $length
  * @return string
  */
 function crop_str($string, $length = 256)
 {
     $string = wp_strip_all_tags((string) $string, true);
     // true: collapse Linear Whitespace into " "
     $length = absint($length);
     if (mb_strlen($string, 'UTF-8') <= $length) {
         return $string;
     }
     // @see wp_trim_words()
     if ('characters' == _x('words', 'word count: words or characters?', 'jetpack')) {
         return trim(mb_substr($string, 0, $length - 1, 'UTF-8')) . "…";
         // ellipsis
     }
     $words = explode(' ', $string);
     $return = '';
     while (strlen($word = array_shift($words))) {
         $new_return = $return ? "{$return} {$word}" : $word;
         $new_return_length = mb_strlen($new_return, 'UTF-8');
         if ($new_return_length < $length - 1) {
             $return = $new_return;
             continue;
         } elseif ($new_return_length == $length - 1) {
             $return = $new_return;
             break;
         }
         if (!$return) {
             $return = mb_substr($new_return, 0, $length - 1, 'UTF-8');
         }
         break;
     }
     return "{$return}…";
     // ellipsis
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:41,代码来源:publicize.php


示例7: ty_save_post_data

function ty_save_post_data()
{
    if (empty($_POST) || !wp_verify_nonce($_POST['name_of_nonce_field'], 'name_of_my_action')) {
        print 'Sorry, your nonce did not verify.';
        exit;
    } else {
        // Do some minor form validation to make sure there is content
        if (isset($_POST['title'])) {
            $title = $_POST['title'];
        } else {
            echo 'Please enter a title';
            exit;
        }
        if (isset($_POST['description'])) {
            $description = $_POST['description'];
        } else {
            echo 'Please enter the content';
            exit;
        }
        if (isset($_POST['post_tags'])) {
            $tags = $_POST['post_tags'];
        } else {
            $tags = "";
        }
        // Add the content of the form to $post as an array
        $post = array('post_title' => wp_strip_all_tags($title), 'post_content' => $description, 'post_category' => $_POST['cat'], 'tags_input' => $tags, 'post_status' => 'publish', 'post_type' => $_POST['post-type']);
        wp_insert_post($post);
        // http://codex.wordpress.org/Function_Reference/wp_insert_post
        $location = home_url();
        // redirect location, should be login page
        echo "<meta http-equiv='refresh' content='0;url={$location}' />";
        exit;
    }
    // end IF
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:35,代码来源:front-end-posting.php


示例8: wl_serialize_entity

/**
 * Serialize an entity post.
 *
 * @param array $entity The entity post or the entity post id.
 *
 * @return array mixed The entity data array.
 */
function wl_serialize_entity($entity)
{
    $entity = is_numeric($entity) ? get_post($entity) : $entity;
    $type = wl_entity_type_taxonomy_get_type($entity->ID);
    $images = wl_get_image_urls($entity->ID);
    return array('id' => wl_get_entity_uri($entity->ID), 'label' => $entity->post_title, 'description' => wp_strip_all_tags($entity->post_content), 'sameAs' => wl_schema_get_value($entity->ID, 'sameAs'), 'mainType' => str_replace('wl-', '', $type['css_class']), 'types' => wl_get_entity_rdf_types($entity->ID), 'images' => $images);
}
开发者ID:efueger,项目名称:wordlift-plugin,代码行数:14,代码来源:wordlift_admin.php


示例9: update_collection

 function update_collection($collectionId, $collection)
 {
     global $wplr;
     $id = $wplr->get_meta("cosmothemes_gallery_id", $collectionId);
     $post = array('ID' => $id, 'post_title' => wp_strip_all_tags($collection['name']));
     wp_update_post($post);
 }
开发者ID:jordymeow,项目名称:wplr-cosmothemes,代码行数:7,代码来源:wp-cosmothemes.php


示例10: import

        /**
         * import function.
         *
         * @access public
         * @param array $array
         * @param array $columns
         * @return void
         */
        function import($array = array(), $columns = array('post_title'))
        {
            $this->imported = $this->skipped = 0;
            if (!is_array($array) || !sizeof($array)) {
                $this->footer();
                die;
            }
            $rows = array_chunk($array, sizeof($columns));
            foreach ($rows as $row) {
                $row = array_filter($row);
                if (empty($row)) {
                    continue;
                }
                $meta = array();
                foreach ($columns as $index => $key) {
                    $meta[$key] = sp_array_value($row, $index);
                }
                $name = sp_array_value($meta, 'post_title');
                if (!$name) {
                    $this->skipped++;
                    continue;
                }
                $args = array('post_type' => 'sp_sponsor', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags($name));
                $id = wp_insert_post($args);
                // Update URL
                update_post_meta($id, 'sp_url', sp_array_value($meta, 'sp_url'));
                $this->imported++;
            }
            // Show Result
            echo '<div class="updated settings-error below-h2"><p>
				' . sprintf(__('Import complete - imported <strong>%s</strong> sponsors and skipped <strong>%s</strong>.', 'sportspress'), $this->imported, $this->skipped) . '
			</p></div>';
            $this->import_end();
        }
开发者ID:mttcmrn,项目名称:Suffield-Bruins-WP,代码行数:42,代码来源:class-sp-sponsor-importer.php


示例11: trigger

 /**
  * Trigger the tickets email
  *
  * @param int $payment_id
  *
  * @return string
  */
 public function trigger($payment_id = 0)
 {
     global $edd_options;
     $payment_data = edd_get_payment_meta($payment_id);
     $user_id = edd_get_payment_user_id($payment_id);
     $user_info = maybe_unserialize($payment_data['user_info']);
     $email = edd_get_payment_user_email($payment_id);
     if (isset($user_id) && $user_id > 0) {
         $user_data = get_userdata($user_id);
         $name = $user_data->display_name;
     } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
         $name = $user_info['first_name'] . ' ' . $user_info['last_name'];
     } else {
         $name = $email;
     }
     $message = $this->get_content_html($payment_id);
     $from_name = isset($edd_options['from_name']) ? $edd_options['from_name'] : get_bloginfo('name');
     $from_email = isset($edd_options['from_email']) ? $edd_options['from_email'] : get_option('admin_email');
     $subject = !empty($edd_options['ticket_subject']) ? wp_strip_all_tags($edd_options['ticket_subject'], true) : $this->default_subject;
     $subject = apply_filters('edd_ticket_receipt_subject', $subject, $payment_id);
     $subject = edd_email_template_tags($subject, $payment_data, $payment_id);
     $headers = 'From: ' . stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8')) . " <{$from_email}>\r\n";
     $headers .= 'Reply-To: ' . $from_email . "\r\n";
     $headers .= "Content-Type: text/html; charset=utf-8\r\n";
     $headers = apply_filters('edd_ticket_receipt_headers', $headers, $payment_id, $payment_data);
     // Allow add-ons to add file attachments
     $attachments = apply_filters('edd_ticket_receipt_attachments', array(), $payment_id, $payment_data);
     if (apply_filters('edd_email_ticket_receipt', true)) {
         wp_mail($email, $subject, $message, $headers, $attachments);
     }
 }
开发者ID:TakenCdosG,项目名称:chefs,代码行数:38,代码来源:Email.php


示例12: display

 /**
  * Display or return a formatted output for WP_Error object. For each error in WP_Error object a formatted
  * output is done with code error and error data.
  *
  * @brief Display ot return output
  *
  * @param bool         $echo TRUE to display or FALSE to get output
  * @param WPDKWatchDog $log  A WPDKWatchDog object to log the display
  *
  * @return string|void Formatted output if $echo is FALSE
  */
 public function display($echo = true, $log = null)
 {
     $content = '<div class="wpdk-watchdog-wp-error">';
     foreach ($this->errors as $code => $single) {
         $content .= sprintf('<code>Code: 0x%x, Description: %s</code>', $code, $single[0]);
         $error_data = $this->get_error_data($code);
         if (!empty($error_data)) {
             if (is_array($error_data)) {
                 foreach ($error_data as $key => $data) {
                     $content .= sprintf('<code>Key: %s, Data: %s</code>', $key, urldecode($data));
                 }
             } else {
                 $content .= sprintf('<code>Data: %s</code>', urldecode($error_data));
             }
         }
     }
     // log to file if enabled
     if (!is_null($log)) {
         $log->log(esc_attr(wp_strip_all_tags($content)));
     }
     $content .= '</div>';
     if ($echo) {
         echo $content;
         return true;
     }
     return $content;
 }
开发者ID:wpxtreme,项目名称:wpdk,代码行数:38,代码来源:wpdk-result.php


示例13: buddyboss_global_search_reply_intro

/**
 * Returns a trimmed reply content string.
 * Works for replies as well as topics.
 * Must be used while inside the loop
 */
function buddyboss_global_search_reply_intro($character_limit = 50)
{
    $content = '';
    switch (get_post_type(get_the_ID())) {
        case 'topic':
            $reply_content = bbp_get_topic_content(get_the_ID());
            break;
        case 'reply':
            $reply_content = bbp_get_reply_content(get_the_ID());
            break;
        default:
            $reply_content = get_the_content();
            break;
    }
    if ($reply_content) {
        $content = wp_strip_all_tags($reply_content, true);
        $search_term = buddyboss_global_search()->search->get_search_term();
        $search_term_position = strpos($content, $search_term);
        if ($search_term_position !== false) {
            $shortened_content = '...' . substr($content, $search_term_position, $character_limit);
            //highlight search keyword
            $shortened_content = str_replace($search_term, "<strong>" . $search_term . "</strong>", $shortened_content);
        } else {
            $shortened_content = substr($content, 0, $character_limit);
        }
        if (strlen($content) > $character_limit) {
            $shortened_content .= '...';
        }
        $content = $shortened_content;
    }
    return apply_filters('buddyboss_global_search_reply_intro', $content);
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:37,代码来源:functions.php


示例14: get_shares

 function get_shares()
 {
     global $post;
     $perm = get_permalink($post->ID);
     $title = wp_strip_all_tags(get_the_title($post->ID));
     $thumb = has_post_thumbnail($post->ID) ? pl_the_thumbnail_url($post->ID) : '';
     $desc = wp_strip_all_tags(pl_short_excerpt($post->ID, 10, ''));
     $out = '';
     if (ploption('share_google')) {
         $out .= self::google(array('permalink' => $perm));
     }
     if (ploption('share_twitter')) {
         $out .= self::twitter(array('permalink' => $perm, 'title' => $title));
     }
     if (ploption('share_facebook')) {
         $out .= self::facebook(array('permalink' => $perm));
     }
     if (ploption('share_linkedin')) {
         $out .= self::linkedin(array('permalink' => $perm, 'title' => $title));
     }
     if (ploption('share_pinterest')) {
         $out .= self::pinterest(array('permalink' => $perm, 'image' => $thumb, 'desc' => $desc));
     }
     if (ploption('share_buffer')) {
         $out .= self::buffer(array('permalink' => $perm, 'title' => $title));
     }
     if (ploption('share_stumble')) {
         $out .= self::stumbleupon(array('permalink' => $perm, 'title' => $title));
     }
     return $out;
 }
开发者ID:climo,项目名称:PageLines-Framework,代码行数:31,代码来源:section.php


示例15: instant_articles_shortcode_handler_caption

/**
 * Caption/WP-Caption Shortcode. Based on the built in caption shortcode
 * @param  array     $attr      Array of attributes passed to shortcode.
 * @param  string    $content   The content passed to the shortcode.
 * @return string    $output    The generated content.
*/
function instant_articles_shortcode_handler_caption($attr, $content = null)
{
    // New-style shortcode with the caption inside the shortcode with the link and image tags.
    if (!isset($attr['caption'])) {
        if (preg_match('#((?:<a [^>]+>\\s*)?<img [^>]+>(?:\\s*</a>)?)(.*)#is', $content, $matches)) {
            $content = $matches[1];
            $attr['caption'] = trim($matches[2]);
        }
    }
    $atts = shortcode_atts(array('figcaptionclass' => '', 'caption' => '', 'cite' => '', 'subtitle' => ''), $attr, 'caption');
    if (!strlen(trim($atts['caption']))) {
        return '';
    }
    $output = '';
    $content = do_shortcode($content);
    $doc = new DOMDocument();
    $doc->loadHTML('<html><body>' . $content . '</body></html>');
    $imgs = $doc->getElementsByTagName('img');
    if ($imgs->length > 0) {
        $img_src = $imgs->item(0)->getAttribute('src');
        if ($img_src) {
            $alt = $imgs->item(0)->getAttribute('alt');
            $classes = array();
            $classes = trim($atts['figcaptionclass']);
            $class_attr = strlen($classes) ? ' class="' . esc_attr($classes) . '"' : '';
            $caption = wp_strip_all_tags($atts['caption'], true);
            $subtitle = strlen($atts['subtitle']) ? '<h2>' . esc_html($atts['subtitle']) . '</h2>' : '';
            $cite = strlen($atts['cite']) ? '<cite>' . esc_html($atts['cite']) . '</cite>' : '';
            $output = '<figure><img src="' . esc_url($img_src) . '" alt="' . esc_attr($alt) . '"><figcaption' . $class_attr . '><h1>' . esc_html($caption) . '</h1>' . $subtitle . $cite . '</figcaption></figure>';
        }
    }
    return $output;
}
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:39,代码来源:shortcodes.php


示例16: smamo_booking_form

function smamo_booking_form()
{
    $navn = isset($_POST['navn']) ? wp_strip_all_tags($_POST['navn']) : false;
    $email = isset($_POST['email']) ? wp_strip_all_tags($_POST['email']) : false;
    $firma = isset($_POST['firma']) ? wp_strip_all_tags($_POST['firma']) : false;
    $telefon = isset($_POST['telefon']) ? wp_strip_all_tags($_POST['telefon']) : false;
    $budget = isset($_POST['budget']) ? wp_strip_all_tags($_POST['budget']) : false;
    $about = isset($_POST['about']) ? $_POST['about'] : false;
    if (!$navn || !$email) {
        $response['error'] = 'Mangler vigtige oplysninger';
        wp_die(json_encode($response));
    }
    // Indstil about
    $about_string = '';
    $i = 0;
    if (is_array($about)) {
        foreach ($about as $a) {
            $i++;
            $about_string .= $i === 1 ? $a : ', ' . $a;
        }
    }
    if (function_exists('slack')) {
        $text = $navn . ' har lige sendt en anmodning om et møde!';
        $attachments = array(array('pretext' => '', 'color' => '#669999', 'fields' => array(array('title' => 'Navn', 'value' => $navn, 'short' => false), array('title' => 'Firma', 'value' => $firma, 'short' => false), array('title' => 'Email', 'value' => '<mailto:' . $email . '|' . $email . '>', 'short' => false), array('title' => 'Telefon', 'value' => '<tel:' . $telefon . '|' . $telefon . '>', 'short' => false), array('title' => 'Vil gerne holde møde om', 'value' => $about_string, 'short' => false), array('title' => 'Budget ca.', 'value' => $budget, 'short' => false))));
        // Send
        $response['slack_curl'] = slack($text, $attachments);
    }
    wp_die(json_encode($response));
}
开发者ID:JeppeSigaard,项目名称:smamo16,代码行数:29,代码来源:booking-form.php


示例17: post_acme_article

function post_acme_article($post)
{
    //if($post['post_title']) {
    $post_data = array('post_title' => wp_strip_all_tags($post['post_title']), 'post_content' => $post['post_desc'], 'tax_input' => array('article_country_cat' => $post['post_country'], 'article_cat' => $post['post_category']), 'post_status' => $post['save'] != '' ? 'draft' : 'publish', 'post_type' => $post['custom_post_type'], 'post_author' => get_current_user_id());
    $post_id = wp_insert_post($post_data);
    // add_post_meta( $post_id, '_custom_image_link', $post['paste_featured_img'], true );
    if (!empty($_FILES['post_featured_img']['name'])) {
        $uploaddir = wp_upload_dir();
        $file = $_FILES["post_featured_img"]["name"];
        $uploadfile = $uploaddir['path'] . '/' . basename($file);
        move_uploaded_file($file, $uploadfile);
        $filename = basename($uploadfile);
        $wp_filetype = wp_check_filetype(basename($filename), null);
        $attachment = array('post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\\.[^.]+$/', '', $filename), 'post_content' => '', 'post_status' => 'inherit');
        foreach ($_FILES as $file => $value) {
            require_once ABSPATH . "wp-admin" . '/includes/image.php';
            require_once ABSPATH . "wp-admin" . '/includes/file.php';
            require_once ABSPATH . "wp-admin" . '/includes/media.php';
            $attach_id = media_handle_upload($file, $post_id);
            set_post_thumbnail($post_id, $attach_id);
            update_post_meta($post_id, '_thumbnail_id', $attach_id);
        }
        $image_url = wp_get_attachment_url(get_post_thumbnail_id($post_id));
    } else {
        $image_url = '';
    }
    $result = array('status' => 'success', 'post_id' => $post_id, 'image_url' => $image_url, 'featured_img' => $image_url, 'msg' => 'Post Save.');
    // }
    // }  else {
    //   $result = array( 'status' => 'error', 'post_id' => $post_id, 'image_url' => $image_url, 'featured_img' => $image_url, 'msg' => 'Please fill-up the required fields.');
    // }
    return $result;
}
开发者ID:pwsclau,项目名称:kurastar,代码行数:33,代码来源:custom-function.php


示例18: smamo_filter_image

function smamo_filter_image()
{
    $response = array();
    // Masser af logik om filstier mv.
    // Hvis du kigger for længe på det, brænder dine øjne ud af hovedet, så pas på!
    // Vi skal dybest set bare bruge filens navn og dens placering og den slags.
    // Vi skal kunne skifte mellem basedir og baseurl, fordi det er vigtigt.
    // huskeregel: "baseurl" er en sti på internettet, "basedir" er en sti lokalt på serveren
    // Dvs. "baseurl til javascript", "basedir" til PHP
    /* SWEET HEAVENS, HERE GOES */
    $upload_dir = wp_upload_dir();
    $imgPath = wp_strip_all_tags($_POST['img']);
    $file = explode('?', basename($imgPath));
    $file = $file[0];
    $imgPath = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $imgPath);
    if (file_exists($upload_dir['basedir'] . '/filtered/' . $file)) {
        $response['img'] = $upload_dir['baseurl'] . '/filtered/' . $file;
        $response['exist'] = true;
    } else {
        require_once get_template_directory() . '/PHPImageWorkshop/ImageWorkshop.php';
        /* OPRET BILLEDE FRA FIL */
        $image = ImageWorkshop::initFromPath($imgPath);
        /* KLON, FILTRER, LÆG OVENPÅ */
        $gray = clone $image;
        $gray->applyFilter(IMG_FILTER_CONTRAST, -35, null, null, null, true);
        // Kontrast
        $gray->applyFilter(IMG_FILTER_GRAYSCALE);
        // Gråtone
        $gray->applyFilter(IMG_FILTER_COLORIZE, 0, 43, 127, 80);
        // Kolorisering, cirka blålig
        $gray->opacity(40);
        // Gennemsigtighed
        $image->addLayerOnTop($gray, 0, 0, "LT");
        // Læg ovenpå original
        /* TILFØJ RIDSER */
        // Først skal vi vælge en ridse, baseret på billedets størrelse
        $imageWidth = $image->getWidth();
        $gunk = 'noise-4.png';
        if ($imageWidth > 800) {
            $gunk = 'noise-1.png';
        }
        if ($imageWidth > 600) {
            $gunk = 'noise-3.png';
        }
        if ($imageWidth > 400) {
            $gunk = 'noise-2.png';
        }
        $noise = ImageWorkshop::initFromPath($upload_dir['basedir'] . '/filtered/colors/' . $gunk);
        // Så bestemmer vi tilfældigt hvor ridsen placeres
        $filterpos = array('LT', 'RT', 'LB', 'RB');
        $pos = $filterpos[array_rand($filterpos)];
        // Og lægger ovenpå
        $image->addLayerOnTop($noise, 0, 0, $pos);
        /* GEM BILLEDE, TILFØJ STI TIL RESPONSE */
        $image->save($upload_dir['basedir'] . '/filtered/', $file, true, null, 100);
        $response['img'] = $upload_dir['baseurl'] . '/filtered/' . $file;
        $response['exist'] = false;
    }
    wp_die(json_encode($response));
}
开发者ID:JeppeSigaard,项目名称:faaborggym,代码行数:60,代码来源:image-filter.php


示例19: validate

 /**
  * Removes potentially harmful tags from user input and makes sure the entered value is what it is supposed to be.
  *
  * @var array $items The items to be validated
  * @return array An updated array of items.
  **/
 public function validate($items)
 {
     if (is_array($items)) {
         foreach ($items as $key => $item) {
             if (!is_array($item)) {
                 $items[$key] = $item;
             } elseif ($item['val'] == '') {
                 $items[$key] = $item['val'];
             } else {
                 switch ($item['type']) {
                     case 'int':
                         $items[$key] = intval($item['val']);
                         break;
                     case 'bool':
                         $items[$key] = (bool) $item['val'];
                         break;
                     case 'text':
                         $items[$key] = stripslashes(wp_strip_all_tags($item['val']));
                         break;
                     case 'roles':
                     case 'multicheckbox':
                         unset($items[$key]);
                         foreach ($item['val'] as $subitem_key => $subitem) {
                             $items[$key][$subitem_key] = (bool) $subitem;
                         }
                         break;
                     default:
                         $items[$key] = stripslashes($item['val']);
                         break;
                 }
             }
         }
     }
     return $items;
 }
开发者ID:poweronio,项目名称:mbsite,代码行数:41,代码来源:class-wpfepp-field-validator.php


示例20: sm_alert_insert

function sm_alert_insert($atts, $content = null)
{
    $atts = shortcode_atts(array('title' => 'Title Goes Here', 'type' => 'round', 'color' => 'red', 'order' => '1', 'text' => 'Click Here', 'content' => !empty($content) ? $content : 'Content Goes Here'), $atts);
    extract($atts);
    $shape = '';
    $content = wp_strip_all_tags($content);
    /*
     * Alerts Check
     */
    if (strtolower($type) == 'alerts' && strtolower($color) == 'red') {
        $shape .= "<p class='sm_alerts sm_color1'> {$content} </p>";
        return $shape;
    }
    if (strtolower($type) == 'alerts' && strtolower($color) == 'green') {
        $shape .= "<p class='sm_alerts sm_color2'> {$content} </p>";
        return $shape;
    }
    if (strtolower($type) == 'alerts' && strtolower($color) == 'purple') {
        $shape .= "<p class='sm_alerts sm_color3'> {$content} </p>";
        return $shape;
    }
    if (strtolower($type) == 'alerts' && strtolower($color) == 'blue') {
        $shape .= "<p class='sm_alerts sm_color4'> {$content} </p>";
        return $shape;
    }
    if (strtolower($type) == 'alerts' && strtolower($color) == 'yellow') {
        $shape .= "<p class='sm_alerts sm_color5'> {$content} </p>";
        return $shape;
    }
}
开发者ID:oogloouet,项目名称:sm-shortcodes,代码行数:30,代码来源:sm-alerts.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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