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


PHP fix_mce_lf函数代码示例

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


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

示例1: message_post

function message_post(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $replyto = x($_REQUEST, 'replyto') ? notags(trim($_REQUEST['replyto'])) : '';
    $subject = x($_REQUEST, 'subject') ? notags(trim($_REQUEST['subject'])) : '';
    $body = x($_REQUEST, 'body') ? escape_tags(trim($_REQUEST['body'])) : '';
    $recipient = x($_REQUEST, 'messageto') ? intval($_REQUEST['messageto']) : 0;
    // Work around doubled linefeeds in Tinymce 3.5b2
    /*	$plaintext = intval(get_pconfig(local_user(),'system','plaintext') && !feature_enabled(local_user(),'richtext'));
    	if(! $plaintext) {
    		$body = fix_mce_lf($body);
    	}*/
    $plaintext = intval(!feature_enabled(local_user(), 'richtext'));
    if (!$plaintext) {
        $body = fix_mce_lf($body);
    }
    $ret = send_message($recipient, $body, $subject, $replyto);
    $norecip = false;
    switch ($ret) {
        case -1:
            notice(t('No recipient selected.') . EOL);
            $norecip = true;
            break;
        case -2:
            notice(t('Unable to locate contact information.') . EOL);
            break;
        case -3:
            notice(t('Message could not be sent.') . EOL);
            break;
        case -4:
            notice(t('Message collection failure.') . EOL);
            break;
        default:
            info(t('Message sent.') . EOL);
    }
    // fake it to go back to the input form if no recipient listed
    if ($norecip) {
        $a->argc = 2;
        $a->argv[1] = 'new';
    } else {
        goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
    }
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:46,代码来源:message.php

示例2: contacts_post

function contacts_post(&$a)
{
    if (!local_user()) {
        return;
    }
    $contact_id = intval($a->argv[1]);
    if (!$contact_id) {
        return;
    }
    $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval(local_user()));
    if (!count($orig_record)) {
        notice(t('Could not access contact record.') . EOL);
        goaway($a->get_baseurl(true) . '/contacts');
        return;
        // NOTREACHED
    }
    call_hooks('contact_edit_post', $_POST);
    $profile_id = intval($_POST['profile-assign']);
    if ($profile_id) {
        $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), intval(local_user()));
        if (!count($r)) {
            notice(t('Could not locate selected profile.') . EOL);
            return;
        }
    }
    $hidden = intval($_POST['hidden']);
    $priority = intval($_POST['poll']);
    if ($priority > 5 || $priority < 0) {
        $priority = 0;
    }
    $info = fix_mce_lf(escape_tags(trim($_POST['info'])));
    $r = q("UPDATE `contact` SET `profile-id` = %d, `priority` = %d , `info` = '%s',\n\t\t`hidden` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($profile_id), intval($priority), dbesc($info), intval($hidden), intval($contact_id), intval(local_user()));
    if ($r) {
        info(t('Contact updated.') . EOL);
    } else {
        notice(t('Failed to update contact record.') . EOL);
    }
    $r = q("select * from contact where id = %d and uid = %d limit 1", intval($contact_id), intval(local_user()));
    if ($r && count($r)) {
        $a->data['contact'] = $r[0];
    }
    return;
}
开发者ID:ridcully,项目名称:friendica,代码行数:43,代码来源:contacts.php

示例3: deindent

/**
 * remove intentation from a text
 */
function deindent($text, $chr = "[\t ]", $count = NULL)
{
    $text = fix_mce_lf($text);
    $lines = explode("\n", $text);
    if (is_null($count)) {
        $m = array();
        $k = 0;
        while ($k < count($lines) && strlen($lines[$k]) == 0) {
            $k++;
        }
        preg_match("|^" . $chr . "*|", $lines[$k], $m);
        $count = strlen($m[0]);
    }
    for ($k = 0; $k < count($lines); $k++) {
        $lines[$k] = preg_replace("|^" . $chr . "{" . $count . "}|", "", $lines[$k]);
    }
    return implode("\n", $lines);
}
开发者ID:jzacman,项目名称:friendica,代码行数:21,代码来源:text.php

示例4: item_post


//.........这里部分代码省略.........
                if (count($r) && intval($r[0]['pubmail'])) {
                    $pubmail_enabled = true;
                }
            }
        }
        if (!strlen($body)) {
            if ($preview) {
                killme();
            }
            info(t('Empty post discarded.') . EOL);
            if (x($_REQUEST, 'return')) {
                goaway($a->get_baseurl() . "/" . $return_path);
            }
            killme();
        }
    }
    if (strlen($categories)) {
        // get the "fileas" tags for this post
        $filedas = file_tag_file_to_list($categories, 'file');
    }
    // save old and new categories, so we can determine what needs to be deleted from pconfig
    $categories_old = $categories;
    $categories = file_tag_list_to_file(trim($_REQUEST['category']), 'category');
    $categories_new = $categories;
    if (strlen($filedas)) {
        // append the fileas stuff to the new categories list
        $categories .= file_tag_list_to_file($filedas, 'file');
    }
    // Work around doubled linefeeds in Tinymce 3.5b2
    // First figure out if it's a status post that would've been
    // created using tinymce. Otherwise leave it alone.
    /*	$plaintext = (local_user() ? intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled($profile_uid,'richtext') : 0);
    	if((! $parent) && (! $api_source) && (! $plaintext)) {
    		$body = fix_mce_lf($body);
    	}*/
    $plaintext = local_user() ? !feature_enabled($profile_uid, 'richtext') : 0;
    if (!$parent && !$api_source && !$plaintext) {
        $body = fix_mce_lf($body);
    }
    // get contact info for poster
    $author = null;
    $self = false;
    $contact_id = 0;
    if (local_user() && local_user() == $profile_uid) {
        $self = true;
        $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1", intval($_SESSION['uid']));
    } elseif (remote_user()) {
        if (is_array($_SESSION['remote'])) {
            foreach ($_SESSION['remote'] as $v) {
                if ($v['uid'] == $profile_uid) {
                    $contact_id = $v['cid'];
                    break;
                }
            }
        }
        if ($contact_id) {
            $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($contact_id));
        }
    }
    if (count($r)) {
        $author = $r[0];
        $contact_id = $author['id'];
    }
    // get contact info for owner
    if ($profile_uid == local_user()) {
        $contact_record = $author;
开发者ID:strk,项目名称:friendica,代码行数:67,代码来源:item.php

示例5: post

 function post()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     require_once 'include/activities.php';
     $namechanged = false;
     // import from json export file.
     // Only import fields that are allowed on this hub
     if (x($_FILES, 'userfile')) {
         $src = $_FILES['userfile']['tmp_name'];
         $filesize = intval($_FILES['userfile']['size']);
         if ($filesize) {
             $j = @json_decode(@file_get_contents($src), true);
             @unlink($src);
             if ($j) {
                 $fields = get_profile_fields_advanced();
                 if ($fields) {
                     foreach ($j as $jj => $v) {
                         foreach ($fields as $f => $n) {
                             if ($jj == $f) {
                                 $_POST[$f] = $v;
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     call_hooks('profile_post', $_POST);
     if (argc() > 1 && argv(1) !== "new" && intval(argv(1))) {
         $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval(\App::$argv[1]), intval(local_channel()));
         if (!count($orig)) {
             notice(t('Profile not found.') . EOL);
             return;
         }
         check_form_security_token_redirectOnErr('/profiles', 'profile_edit');
         $is_default = $orig[0]['is_default'] ? 1 : 0;
         $profile_name = notags(trim($_POST['profile_name']));
         if (!strlen($profile_name)) {
             notice(t('Profile Name is required.') . EOL);
             return;
         }
         $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00';
         // FIXME: Needs to be validated?
         $y = substr($dob, 0, 4);
         if (!ctype_digit($y) || $y < 1900) {
             $ignore_year = true;
         } else {
             $ignore_year = false;
         }
         if ($dob != '0000-00-00') {
             if (strpos($dob, '0000-') === 0) {
                 $ignore_year = true;
                 $dob = substr($dob, 5);
             }
             $dob = datetime_convert('UTC', 'UTC', $ignore_year ? '1900-' . $dob : $dob, $ignore_year ? 'm-d' : 'Y-m-d');
             if ($ignore_year) {
                 $dob = '0000-' . $dob;
             }
         }
         $name = escape_tags(trim($_POST['name']));
         if ($orig[0]['fullname'] != $name) {
             $namechanged = true;
             $v = validate_channelname($name);
             if ($v) {
                 notice($v);
                 $namechanged = false;
                 $name = $orig[0]['fullname'];
             }
         }
         $pdesc = escape_tags(trim($_POST['pdesc']));
         $gender = escape_tags(trim($_POST['gender']));
         $address = escape_tags(trim($_POST['address']));
         $locality = escape_tags(trim($_POST['locality']));
         $region = escape_tags(trim($_POST['region']));
         $postal_code = escape_tags(trim($_POST['postal_code']));
         $country_name = escape_tags(trim($_POST['country_name']));
         $keywords = escape_tags(trim($_POST['keywords']));
         $marital = escape_tags(trim($_POST['marital']));
         $howlong = escape_tags(trim($_POST['howlong']));
         $sexual = escape_tags(trim($_POST['sexual']));
         $homepage = escape_tags(trim($_POST['homepage']));
         $hometown = escape_tags(trim($_POST['hometown']));
         $politic = escape_tags(trim($_POST['politic']));
         $religion = escape_tags(trim($_POST['religion']));
         $likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
         $dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
         $about = fix_mce_lf(escape_tags(trim($_POST['about'])));
         $interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
         $contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
         $channels = fix_mce_lf(escape_tags(trim($_POST['channels'])));
         $music = fix_mce_lf(escape_tags(trim($_POST['music'])));
         $book = fix_mce_lf(escape_tags(trim($_POST['book'])));
         $tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
         $film = fix_mce_lf(escape_tags(trim($_POST['film'])));
         $romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
         $work = fix_mce_lf(escape_tags(trim($_POST['work'])));
//.........这里部分代码省略.........
开发者ID:einervonvielen,项目名称:hubzilla,代码行数:101,代码来源:Profiles.php

示例6: profiles_post


//.........这里部分代码省略.........
                    						$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
                    							dbesc($lookup),
                    							intval(local_user())
                    						);
                    					}*/
                    $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", dbesc($newname), intval(local_user()));
                    if (!$r) {
                        $r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1", dbesc($lookup), intval(local_user()));
                    }
                    if (count($r)) {
                        $prf = $r[0]['url'];
                        $newname = $r[0]['name'];
                    }
                }
                if ($prf) {
                    $with = str_replace($lookup, '<a href="' . $prf . '">' . $newname . '</a>', $with);
                    if (strpos($with, '@') === 0) {
                        $with = substr($with, 1);
                    }
                }
            } else {
                $with = $orig[0]['with'];
            }
        }
        $sexual = notags(trim($_POST['sexual']));
        $homepage = notags(trim($_POST['homepage']));
        if (strpos($homepage, 'http') !== 0 && strlen($homepage)) {
            // neither http nor https in URL, add them
            $homepage = 'http://' . $homepage;
        }
        $hometown = notags(trim($_POST['hometown']));
        $politic = notags(trim($_POST['politic']));
        $religion = notags(trim($_POST['religion']));
        $likes = fix_mce_lf(escape_tags(trim($_POST['likes'])));
        $dislikes = fix_mce_lf(escape_tags(trim($_POST['dislikes'])));
        $about = fix_mce_lf(escape_tags(trim($_POST['about'])));
        $interest = fix_mce_lf(escape_tags(trim($_POST['interest'])));
        $contact = fix_mce_lf(escape_tags(trim($_POST['contact'])));
        $music = fix_mce_lf(escape_tags(trim($_POST['music'])));
        $book = fix_mce_lf(escape_tags(trim($_POST['book'])));
        $tv = fix_mce_lf(escape_tags(trim($_POST['tv'])));
        $film = fix_mce_lf(escape_tags(trim($_POST['film'])));
        $romance = fix_mce_lf(escape_tags(trim($_POST['romance'])));
        $work = fix_mce_lf(escape_tags(trim($_POST['work'])));
        $education = fix_mce_lf(escape_tags(trim($_POST['education'])));
        $hide_friends = $_POST['hide-friends'] == 1 ? 1 : 0;
        $changes = array();
        $value = '';
        if ($is_default) {
            if ($marital != $orig[0]['marital']) {
                $changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Marital Status');
                $value = $marital;
            }
            if ($withchanged) {
                $changes[] = '[color=#ff0000]&hearts;[/color] ' . t('Romantic Partner');
                $value = strip_tags($with);
            }
            if ($likes != $orig[0]['likes']) {
                $changes[] = t('Likes');
                $value = $likes;
            }
            if ($dislikes != $orig[0]['dislikes']) {
                $changes[] = t('Dislikes');
                $value = $dislikes;
            }
            if ($work != $orig[0]['work']) {
开发者ID:ZerGabriel,项目名称:friendica,代码行数:67,代码来源:profiles.php


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