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


PHP strbegin函数代码示例

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


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


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