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

PHP strbegin函数代码示例

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

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



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

示例1: parse

 public static function parse($url)
 {
     if ($s = http::get($url)) {
         $backuper = tbackuper::i();
         $archtype = $backuper->getarchtype($url);
         if ($files = $backuper->unpack($s, $archtype)) {
             list($filename, $content) = each($files);
             if ($about = self::getabout($files)) {
                 $item = new tdownloaditem();
                 $item->type = strbegin($filename, 'plugins/') ? 'plugin' : 'theme';
                 $item->title = $about['name'];
                 $item->downloadurl = $url;
                 $item->authorurl = $about['url'];
                 $item->authorname = $about['author'];
                 $item->rawcontent = $about['description'];
                 $item->version = $about['version'];
                 $item->tagnames = empty($about['tags']) ? '' : trim($about['tags']);
                 if ($screenshot = self::getfile($files, 'screenshot.png')) {
                     $media = tmediaparser::i();
                     $idscreenshot = $media->uploadthumbnail($about['name'] . '.png', $screenshot);
                     $item->files = array($idscreenshot);
                 }
                 return $item;
             }
         }
     }
     return false;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:28,代码来源:about.parser.class.php


示例2: processform

 public function processform()
 {
     $theme = tview::i(tviews::i()->defaults['admin'])->theme;
     $plugin = ttagreplacer::i();
     $plugin->lock();
     $plugin->items = array();
     foreach ($_POST as $name => $value) {
         if (!strbegin($name, 'where-')) {
             continue;
         }
         $id = substr($name, strlen('where-'));
         $where = trim($value);
         if (!isset($theme->templates[$where]) || !is_string($theme->templates[$where])) {
             continue;
         }
         $search = $_POST["search-{$id}"];
         if ($search == '') {
             continue;
         }
         $plugin->items[] = array('where' => $where, 'search' => $search, 'replace' => $_POST["replace-{$id}"]);
     }
     $plugin->unlock();
     ttheme::clearcache();
     return '';
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:25,代码来源:admin.tagreplacer.class.php


示例3: getcontent

 public function getcontent($id, $sidebar)
 {
     if (litepublisher::$urlmap->is404 || litepublisher::$urlmap->adminpanel || strbegin(litepublisher::$urlmap->url, '/croncron.php') || strend(litepublisher::$urlmap->url, '.xml')) {
         return '';
     }
     $id = litepublisher::$urlmap->itemrequested['id'];
     $filename = litepublisher::$paths->data . 'keywords' . DIRECTORY_SEPARATOR . $id . '.' . litepublisher::$urlmap->page . '.php';
     if (@file_exists($filename)) {
         $links = file_get_contents($filename);
     } else {
         if (count($this->links) < $this->count) {
             return '';
         }
         $arlinks = array_splice($this->links, 0, $this->count);
         $this->save();
         //$links = "\n<li>" . implode("</li>\n<li>", $arlinks)  . "</li>";
         $links = '';
         $text = '';
         foreach ($arlinks as $link) {
             $links .= sprintf('<li><a href="%s">%s</a></li>', $link['url'], $link['text']);
             $text .= $link['text'] . "\n";
         }
         file_put_contents($filename, $links);
         if ($this->notify) {
             $plugin = tkeywordsplugin::i();
             $plugin->added($filename, $text);
         }
     }
     $theme = ttheme::i();
     return $theme->getwidgetcontent($links, $this->template, $sidebar);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:31,代码来源:keywords.widget.php


示例4: fileadded

 public function fileadded($id)
 {
     $files = tfiles::i();
     $item = $files->getitem($id);
     if ('image' != $item['media']) {
         return;
     }
     $fileurl = $files->geturl($id);
     if ($s = http::get('http://www.smushit.com/ysmush.it/ws.php?img=' . urlencode($fileurl))) {
         $json = json_decode($s);
         if (isset($json->error) || -1 === (int) $json->dest_size || !$json->dest) {
             return;
         }
         $div = $item['size'] - (int) $json->dest_size;
         if ($div / ($item['size'] / 100) < 3) {
             return;
         }
         $dest = urldecode($json->dest);
         if (!strbegin($dest, 'http')) {
             $dest = 'http://www.smushit.com/' . $dest;
         }
         if ($content = http::get($dest)) {
             return $files->setcontent($id, $content);
         }
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:26,代码来源:smushit.plugin.php


示例5: processform

 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $url = trim($_POST['site']);
     if (empty($url) || strbegin($url, litepublisher::$site->url)) {
         return $this->errmesg;
     }
     if ($s = http::get($url)) {
         if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
             return $this->errmesg;
         }
     } else {
         return $this->errmesg;
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 15) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:32,代码来源:contactsite.class.php


示例6: getcontent

 public function getcontent($id, $sidebar)
 {
     $foaf = tfoaf::i();
     $items = $foaf->getapproved($this->maxcount);
     if (count($items) == 0) {
         return '';
     }
     $result = '';
     $url = litepublisher::$site->url;
     $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id=';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('friends', $sidebar);
     $args = targs::i();
     $args->subcount = '';
     $args->subitems = '';
     $args->{$icon} = '';
     $args->rel = 'friend';
     foreach ($items as $id) {
         $item = $foaf->getitem($id);
         $args->add($item);
         $args->anchor = $item['title'];
         if ($this->redir && !strbegin($item['url'], $url)) {
             $args->url = $redirlink . $id;
         }
         $result .= $theme->parsearg($tml, $args);
     }
     return $theme->getwidgetcontent($result, 'friends', $sidebar);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:28,代码来源:widget.friends.class.php


示例7: getcontent

 public function getcontent($id, $sidebar)
 {
     if (count($this->items) == 0) {
         return '';
     }
     $result = '';
     $theme = ttheme::i();
     $tml = $theme->getwidgetitem('links', $sidebar);
     $redirlink = litepublisher::$site->url . $this->redirlink . litepublisher::$site->q . 'id=';
     $url = litepublisher::$site->url;
     $args = targs::i();
     $args->subcount = '';
     $args->subitems = '';
     $args->icon = '';
     $args->rel = 'link';
     foreach ($this->items as $id => $item) {
         $args->add($item);
         $args->id = $id;
         if ($this->redir && !strbegin($item['url'], $url)) {
             $args->link = $redirlink . $id;
         } else {
             $args->link = $item['url'];
         }
         $result .= $theme->parsearg($tml, $args);
     }
     return $theme->getwidgetcontent($result, 'links', $sidebar);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:27,代码来源:widget.links.class.php


示例8: get

 public function get($url)
 {
     if (isset($this->items[$url])) {
         return $this->items[$url];
     }
     if (strbegin($url, litepublisher::$site->url)) {
         return substr($url, strlen(litepublisher::$site->url));
     }
     //redir jquery scripts
     if (strbegin($url, '/js/jquery/ui-')) {
         return '/js/jquery/ui-' . litepublisher::$site->jqueryui_version . substr($url, strpos($url, '/', 15));
     }
     if (strbegin($url, '/js/jquery/jquery')) {
         return '/js/jquery/jquery-' . litepublisher::$site->jquery_version . '.min.js';
     }
     //fix for 2.xx versions
     if (preg_match('/^\\/comments\\/(\\d*?)\\/?$/', $url, $m)) {
         return sprintf('/comments/%d.xml', $m[1]);
     }
     if (preg_match('/^\\/authors\\/(\\d*?)\\/?$/', $url, $m)) {
         return '/comusers.htm?id=' . $m[1];
     }
     if (strpos($url, '%')) {
         $url = rawurldecode($url);
         if (strbegin($url, litepublisher::$site->url)) {
             return substr($url, strlen(litepublisher::$site->url));
         }
         if (litepublisher::$urlmap->urlexists($url)) {
             return $url;
         }
     }
     //fix php warnings e.g. function.preg-split
     if (($i = strrpos($url, '/')) && strbegin(substr($url, $i), '/function.')) {
         return substr($url, 0, $i + 1);
     }
     //redir version js files
     if (preg_match('/^\\/files\\/js\\/(\\w*+)\\.(\\d*+)\\.js$/', $url, $m)) {
         $name = $m[1] == 'moderator' ? 'comments' : $m[1];
         $prop = 'jsmerger_' . $name;
         $template = ttemplate::i();
         if (isset($template->{$prop})) {
             return $template->{$prop};
         }
     }
     if (preg_match('/^\\/files\\/js\\/(\\w*+)\\.(\\d*+)\\.css$/', $url, $m)) {
         $name = 'cssmerger_' . $m[1];
         $template = ttemplate::i();
         if (isset($template->{$name})) {
             return $template->{$name};
         }
     }
     if ($url = $this->onget($url)) {
         return $url;
     }
     return false;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:56,代码来源:redirect.class.php


示例9: getimg

 public function getimg()
 {
     if ($url = $this->image) {
         if (!strbegin($url, 'http://')) {
             $url = litepublisher::$site->files . $url;
         }
         return sprintf('<img src="%s" alt="Home image" />', $url);
     }
     return '';
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:10,代码来源:homepage.class.php


示例10: __get

 public function __get($name)
 {
     if (strbegin($name, 'word_')) {
         $id = (int) substr($name, strlen('word_'));
         if ($id > 0 && $this->itemexists($id)) {
             return $this->getlink($id);
         }
         return '';
     }
     return parent::__get($name);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:11,代码来源:wikiwords.class.php


示例11: prepareurl

 protected function prepareurl($host, $url)
 {
     parent::prepareurl($host, $url);
     if (strbegin($this->url, litepublisher::$mobile . '/') || $this->url == litepublisher::$mobile) {
         if ($this->url == litepublisher::$mobile) {
             $this->url = '/';
         } else {
             $this->url = substr($this->url, strlen(litepublisher::$mobile));
         }
     }
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:11,代码来源:mobile.classes.php


示例12: checkspam

 private function checkspam($s)
 {
     if (!($s = @base64_decode($s))) {
         return false;
     }
     $sign = 'megaspamer';
     if (!strbegin($s, $sign)) {
         return false;
     }
     $timekey = (int) substr($s, strlen($sign));
     return time() < $timekey;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:12,代码来源:passwordpage.class.php


示例13: normfilename

 public function normfilename($filename)
 {
     $filename = trim($filename);
     if (strbegin($filename, litepublisher::$paths->home)) {
         $filename = substr($filename, strlen(litepublisher::$paths->home));
     }
     if (empty($filename)) {
         return false;
     }
     $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename);
     $filename = '/' . ltrim($filename, '/');
     return $filename;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:13,代码来源:jsmerger.class.php


示例14: wp_deletePage

 public function wp_deletePage($blogid, $username, $password, $id)
 {
     $this->auth($username, $password, 'editor');
     if (strbegin($id, 'menu_')) {
         $id = substr($id, strlen('menu_'));
     }
     $id = (int) $id;
     $menus = tmenus::i();
     if (!$menus->itemexists($id)) {
         return xerror(404, "Sorry, no such page.");
     }
     $menus->delete($id);
     return true;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:14,代码来源:xmlrpc.wordpress.class.php


示例15: request

 public function request($arg)
 {
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 1;
     if (!$this->itemexists($id)) {
         return turlmap::redir301('/');
     }
     $item = $this->getitem($id);
     $url = $item['url'];
     if (!strpos($url, '.')) {
         $url = litepublisher::$options->url . litepublisher::$options->home;
     }
     if (!strbegin($url, 'http://')) {
         $url = 'http://' . $url;
     }
     turlmap::redir($url);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:16,代码来源:comments.users.class.db.php


示例16: getitem

 private function getitem($tml, $url, $title)
 {
     $args = targs::i();
     $args->subcount = '';
     $args->icon = '';
     $args->subitems = '';
     $args->rel = 'admin';
     if (strbegin($url, 'http://')) {
         $args->link = $url;
     } else {
         $args->url = $url;
     }
     $args->title = $title;
     $args->text = $title;
     $theme = ttheme::i();
     return $theme->parsearg($tml, $args);
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:17,代码来源:adminlinks.php


示例17: getcontent

 public function getcontent()
 {
     $result = '';
     $html = $this->html;
     $lang = tlocal::admin('users');
     if ($this->logged) {
         return $html->h4red($lang->logged . ' ' . $html->getlink('/admin/', $lang->adminpanel));
     }
     $args = new targs();
     if ($this->regstatus) {
         switch ($this->regstatus) {
             case 'ok':
                 $backurl = $this->backurl;
                 if (!$backurl) {
                     $backurl = tusergroups::i()->gethome(litepublisher::$options->group);
                 }
                 if (!strbegin($backurl, 'http://')) {
                     $backurl = litepublisher::$site->url . $backurl;
                 }
                 return $html->h4($lang->successreg . ' ' . $html->getlink($backurl, $lang->continue));
             case 'mail':
                 return $html->h4->waitconfirm;
             case 'error':
                 $result .= $html->h4->invalidregdata;
         }
     }
     $form = '';
     foreach (array('email', 'name') as $name) {
         $args->{$name} = isset($_POST[$name]) ? $_POST[$name] : '';
         $form .= "[text={$name}]";
     }
     $lang = tlocal::i('users');
     $args->formtitle = $lang->regform;
     $args->data['$lang.email'] = 'email';
     $result .= $this->widget;
     if (isset($_GET['backurl'])) {
         //normalize
         $result = str_replace('&amp;backurl=', '&backurl=', $result);
         $result = str_replace('backurl=', 'backurl=' . urlencode($_GET['backurl']), $result);
         $result = str_replace('backurl%3D', 'backurl%3D' . urlencode(urlencode($_GET['backurl'])), $result);
     }
     $result .= $html->adminform($form, $args);
     $result = str_replace(' action=""', ' action="' . litepublisher::$site->url . '/admin/reguser/"', $result);
     $this->callevent('oncontent', array(&$result));
     return $result;
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:46,代码来源:admin.reguser.class.php


示例18: processform

 public function processform()
 {
     $redir = tredirector::i();
     switch ($_POST['action']) {
         case 'edit':
             $redir->items[$_POST['from']] = $_POST['to'];
             break;
         case 'delete':
             foreach ($_POST as $id => $value) {
                 if (strbegin($id, 'checkbox_')) {
                     if (isset($redir->items[$value])) {
                         unset($redir->items[$value]);
                     }
                 }
             }
             break;
     }
     $redir->save();
     return '';
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:20,代码来源:admin.redirect.class.php


示例19: replaceurl

 public function replaceurl($m)
 {
     $url = $m[1];
     if (strbegin($url, 'data:')) {
         return " url(\"{$url}\")";
     }
     $args = '';
     if ($i = strpos($url, '?')) {
         $args = substr($url, $i);
         $url = substr($url, 0, $i);
     }
     if ($realfile = realpath($url)) {
         $url = substr($realfile, strlen(litepublisher::$paths->home));
     }
     // else must be absolute url
     $url = str_replace(DIRECTORY_SEPARATOR, '/', $url);
     $url = litepublisher::$site->files . '/' . ltrim($url, '/');
     $url = substr($url, strpos($url, '/', 9));
     return " url('{$url}{$args}')";
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:20,代码来源:cssmerger.class.php


示例20: ping

 public function ping($from, $to)
 {
     if (!strbegin($to, litepublisher::$site->url)) {
         return new IXR_Error(0, 'Is there no link to us?');
     }
     $url = substr($to, strlen(litepublisher::$site->url));
     $urlmap = turlmap::i();
     if (!($item = $urlmap->finditem($url))) {
         return $this->xerror(0, 'Is there no link to us?');
     }
     if ($item['class'] != litepublisher::$classes->classes['post']) {
         return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');
     }
     $post = tpost::i($item['arg']);
     if (!$post->pingenabled || $post->status != 'published') {
         return $this->xerror(33, 'The specified target URL cannot be used as a target. It either doesn\'t exist, or it is not a pingback-enabled resource.');
     }
     $pingbacks = $post->pingbacks;
     if ($pingbacks->exists($from)) {
         return new IXR_Error(48, 'The pingback has already been registered.');
     }
     if (!($s = http::get($from))) {
         return new IXR_Error(16, 'The source URL does not exist.');
     }
     $s = str_replace('<!DOC', '<DOC', $s);
     $s = preg_replace('/[\\s\\r\\n\\t]+/', ' ', $s);
     // normalize spaces
     if (!preg_match('|<title>([^<]*?)</title>|is', $s, $matchtitle) || empty($matchtitle[1])) {
         return new IXR_Error(32, 'We cannot find a title on that page.');
     }
     $s = strip_tags($s, '<a>');
     if (!preg_match("|<a([^>]+?" . preg_quote($to) . "[^>]*)>[^>]+?</a>|", $s, $match)) {
         return new IXR_Error(17, 'The source URL does not contain a link to the target URL, and so cannot be used as a source.');
     }
     if (preg_match('/nofollow|noindex/is', $match[1])) {
         return new IXR_Error(32, 'The source URL contain nofollow or noindex atribute');
     }
     $pingbacks->add($from, $matchtitle[1]);
     return "Pingback from {$from} to {$to} registered. Keep the web talking! :-)";
 }
开发者ID:laiello,项目名称:litepublisher,代码行数:40,代码来源:xmlrpc.pingback.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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