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


PHP Date::mysql2unix方法代码示例

本文整理汇总了PHP中Date::mysql2unix方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::mysql2unix方法的具体用法?PHP Date::mysql2unix怎么用?PHP Date::mysql2unix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date的用法示例。


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

示例1: verify

 /**
  * verifies a licese @todo
  * @param  string $license 
  * @param  string $domain name 
  * @return bool          
  */
 public static function verify($license_num, $domain)
 {
     //removing the www. so we accept both for same domain
     //$domain = preg_replace('#^www\.(.+\.)#i', '$1', $domain);
     //since 1.6 licenses are for an entire domain
     $domain = URL::get_domain($domain);
     $license = self::get_license($license_num);
     if ($license->loaded()) {
         //this means the license was at some point activated
         if ($license->active_date != NULL and $license->active_date != '') {
             //if license expired return false
             if ($license->valid_date != NULL and $license->valid_date != '' and Date::mysql2unix($license->valid_date) < time()) {
                 return FALSE;
             }
             //check domain for the license. if matched
             if (URL::get_domain($license->domain) != $domain) {
                 return FALSE;
             }
         } else {
             $license->active_date = Date::unix2mysql();
             $license->domain = $domain;
         }
         $license->license_check_date = Date::unix2mysql();
         $license->ip_address = ip2long(Request::$client_ip);
         $license->save();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:alirezadamash,项目名称:open-eshop,代码行数:35,代码来源:license.php

示例2: action_blog

 public function action_blog()
 {
     $this->auto_render = FALSE;
     $info = array('title' => 'RSS Blog ' . Core::config('general.site_name'), 'pubDate' => date("D, d M Y H:i:s T"), 'description' => __('Latest post published'), 'generator' => 'Open Classifieds');
     $items = array();
     $posts = new Model_Post();
     $posts = $posts->where('status', '=', 1)->order_by('created', 'desc')->limit(Core::config('general.feed_elements'))->cached()->find_all();
     foreach ($posts as $post) {
         $url = Route::url('blog', array('seotitle' => $post->seotitle));
         $items[] = array('title' => preg_replace('/&(?!\\w+;)/', '&amp;', $post->title), 'link' => $url, 'pubDate' => Date::mysql2unix($post->created), 'description' => Text::removebbcode(preg_replace('/&(?!\\w+;)/', '&amp;', $post->description)));
     }
     $xml = Feed::create($info, $items);
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:15,代码来源:feed.php

示例3: run

 /**
  * gets all the crons from crontab and executes them
  * @return string info
  */
 public static function run()
 {
     $time_start = microtime(true);
     //get active crons and due to execute now or next execute is NULL
     $crontab = new Cron();
     $crontab = $crontab->where('active', '=', 1)->where_open()->or_where('date_next', '<=', Date::unix2mysql())->or_where('date_next', 'IS', NULL)->where_close()->find_all();
     $crons_executed = 0;
     foreach ($crontab as $cron) {
         //check if cron is running, if running but passed treshold, lets launch it again...
         if ($cron->running == 0 or $cron->running == 1 and time() - Date::mysql2unix($cron->date_started) >= self::TRESHOLD) {
             $cron->execute();
             $crons_executed++;
         }
     }
     $seconds = microtime(true) - $time_start;
     return sprintf('Executed %d cronjobs in %d seconds', $crons_executed, $seconds);
 }
开发者ID:JeffPedro,项目名称:project-garage-sale,代码行数:21,代码来源:cron.php

示例4: action_forum

 public function action_forum()
 {
     $this->auto_render = FALSE;
     $info = array('title' => 'RSS Forum ' . Core::config('general.site_name'), 'pubDate' => date("r"), 'description' => __('Latest post published'), 'generator' => 'Open Classifieds');
     $items = array();
     $topics = new Model_Topic();
     if (Model_Forum::current()->loaded()) {
         $topics->where('id_forum', '=', Model_Forum::current()->id_forum);
     } else {
         $topics->where('id_forum', '!=', NULL);
     }
     //any forum
     $topics = $topics->where('status', '=', Model_Topic::STATUS_ACTIVE)->where('id_post_parent', 'IS', NULL)->order_by('created', 'desc')->limit(Core::config('advertisement.feed_elements'))->cached()->find_all();
     foreach ($topics as $topic) {
         $url = Route::url('forum-topic', array('seotitle' => $topic->seotitle, 'forum' => $topic->forum->seoname));
         $items[] = array('title' => htmlspecialchars($topic->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($topic->created), 'description' => htmlspecialchars(Text::removebbcode($topic->description), ENT_QUOTES), 'guid' => $url);
     }
     $xml = Feed::create($info, $items);
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:21,代码来源:feed.php

示例5: confirm

?>
" 
                                onclick="return confirm('<?php 
echo __('Make featured?');
?>
');"
                                rel="tooltip" title="<?php 
echo __('Featured');
?>
" data-id="tr1" data-text="<?php 
echo __('Are you sure you want to make it featured?');
?>
">
                                <i class="glyphicon   glyphicon-bookmark"></i>
                            </a>
                            <?elseif(Date::mysql2unix($ad->featured) > time()):?>
                            <a class="btn btn-primary " 
                                href="<?php 
echo Route::url('oc-panel', array('controller' => 'ad', 'action' => 'unfeature', 'id' => $ad->id_ad));
?>
" 
                                onclick="return confirm('<?php 
echo __('Remove featured?');
?>
');"
                                rel="tooltip" title="<?php 
echo __('Remove Featured');
?>
" data-id="tr1" data-text="<?php 
echo __('Are you sure you want to remove featured ad?');
?>
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:31,代码来源:ad.php

示例6: __

            ?>
" alt="<?php 
            echo __('Profile image');
            ?>
" height="140px"></a>
            </div>
            <div class="col-xs-12 col-sm-12 col-md-9 span6">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 span6">
                        <ul class="meta-search list-inline">
                            <li><i class="glyphicon glyphicon-calendar"></i> <span><?php 
            echo $review->created;
            ?>
</span></li>
                            <li><i class="glyphicon glyphicon-time"></i> <span><?php 
            echo Date::fuzzy_span(Date::mysql2unix($review->created));
            ?>
</span></li>
                            <li><i class="glyphicon glyphicon-user"></i> <span><?php 
            echo $review->user->name;
            ?>
</span></li>
                        <?php 
            if ($review->rate !== NULL) {
                ?>
                    
                        <div class="rating">
                            <h1 class="rating-num"><?php 
                echo round($review->rate, 2);
                ?>
.0</h1>
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:31,代码来源:reviews.php

示例7: get_images

 /**
  * Gets all images
  * @return [array] [array with image names]
  */
 public function get_images()
 {
     $image_path = array();
     if ($this->loaded() and $this->has_images > 0) {
         $base = Core::S3_domain();
         $route = $this->image_path();
         $folder = DOCROOT . $route;
         $seotitle = $this->seotitle;
         $version = $this->last_modified ? '?v=' . Date::mysql2unix($this->last_modified) : NULL;
         for ($i = 1; $i <= $this->has_images; $i++) {
             $filename_thumb = 'thumb_' . $seotitle . '_' . $i . '.jpg';
             $filename_original = $seotitle . '_' . $i . '.jpg';
             $image_path[$i]['image'] = $base . $route . $filename_original . $version;
             $image_path[$i]['thumb'] = $base . $route . $filename_thumb . $version;
         }
     }
     return $image_path;
 }
开发者ID:kleitz,项目名称:openclassifieds2,代码行数:22,代码来源:ad.php

示例8: verify_device

 /**
  * verifies a license in a certain device
  * @param  string $license 
  * @param  string $device_id name 
  * @return bool          
  */
 public static function verify_device($license_num, $device_id)
 {
     $license = self::get_license($license_num);
     if ($license->loaded()) {
         //this means the license was at some point activated
         if ($license->active_date != NULL and $license->active_date != '') {
             //if license expired return false
             if ($license->valid_date != NULL and $license->valid_date != '' and Date::mysql2unix($license->valid_date) < time()) {
                 return FALSE;
             }
             //check device_id for the license. if matched
             if ($license->device_id != $device_id) {
                 return FALSE;
             }
         } else {
             $license->active_date = Date::unix2mysql();
             $license->device_id = $device_id;
         }
         $license->license_check_date = Date::unix2mysql();
         $license->ip_address = ip2long(Request::$client_ip);
         $license->save();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:johnulist,项目名称:open-eshop,代码行数:31,代码来源:license.php

示例9: get_images

 /**
  * Gets all images
  * @return [array] [array with image names]
  */
 public function get_images()
 {
     $image_path = array();
     if ($this->loaded() and $this->has_images > 0) {
         if (core::config('image.aws_s3_active')) {
             $protocol = Core::is_HTTPS() ? 'https://' : 'http://';
             $base = $protocol . core::config('image.aws_s3_domain');
         } else {
             $base = URL::base();
         }
         $route = $this->gen_img_path($this->id_product, $this->created);
         $folder = DOCROOT . $route;
         $seotitle = $this->seotitle;
         $version = $this->updated ? '?v=' . Date::mysql2unix($this->updated) : NULL;
         for ($i = 1; $i <= $this->has_images; $i++) {
             $filename_thumb = 'thumb_' . $seotitle . '_' . $i . '.jpg';
             $filename_original = $seotitle . '_' . $i . '.jpg';
             $image_path[$i]['image'] = $route . $filename_original . $version;
             $image_path[$i]['thumb'] = $route . $filename_thumb . $version;
             $image_path[$i]['base'] = $base;
         }
     }
     return $image_path;
 }
开发者ID:johnulist,项目名称:open-eshop,代码行数:28,代码来源:product.php

示例10: check_pricing

 /**
  * verifies pricing in an existing order
  * @return void
  */
 public function check_pricing()
 {
     //original coupon so we dont lose it while we do operations
     $orig_coupon = $this->id_coupon;
     //remove the coupon forced by get/post
     if (core::request('coupon_delete') != NULL) {
         $this->id_coupon = NULL;
     } elseif ($this->product->valid_coupon() and $this->id_coupon != Model_Coupon::current()->id_coupon) {
         $this->id_coupon = Model_Coupon::current()->id_coupon;
     } elseif ($this->coupon->loaded() and (Date::mysql2unix($this->coupon->valid_date) < time() or $this->coupon->status == 0 or $this->coupon->number_coupons == 0)) {
         Alert::set(Alert::INFO, __('Coupon not valid, expired or already used.'));
         $this->coupon->clear();
         $this->id_coupon = NULL;
     }
     $user = $this->user;
     //recalculate price since it change the coupon or user info
     if ($orig_coupon != $this->id_coupon or $this->country != $user->country or $this->city != $user->city or $this->VAT_number != $user->VAT_number or $this->postal_code != $user->postal_code or $this->address != $user->address) {
         //set variables just in case...
         $this->amount = $this->product->final_price();
         $this->VAT = euvat::vat_percentage();
         $this->VAT_number = $user->VAT_number;
         $this->country = $user->country;
         $this->city = $user->city;
         $this->postal_code = $user->postal_code;
         $this->address = $user->address;
         try {
             $this->save();
         } catch (Exception $e) {
             throw HTTP_Exception::factory(500, $e->getMessage());
         }
     }
 }
开发者ID:alirezadamash,项目名称:open-eshop,代码行数:36,代码来源:order.php

示例11: get_icon

 /**
  * returns the url of the location icon
  * @return string url
  */
 public function get_icon()
 {
     if ($this->has_image) {
         if (core::config('image.aws_s3_active')) {
             $protocol = Core::is_HTTPS() ? 'https://' : 'http://';
             $version = $this->last_modified ? '?v=' . Date::mysql2unix($this->last_modified) : NULL;
             return $protocol . core::config('image.aws_s3_domain') . 'images/locations/' . $this->seoname . '.png' . $version;
         } else {
             return URL::base() . 'images/locations/' . $this->seoname . '.png' . ($this->last_modified ? '?v=' . Date::mysql2unix($this->last_modified) : NULL);
         }
     }
     return FALSE;
 }
开发者ID:EmmanuelSimond,项目名称:openclassifieds2,代码行数:17,代码来源:location.php

示例12: action_profile

 public function action_profile()
 {
     $this->auto_render = FALSE;
     $xml = 'FALSE';
     $seoname = $this->request->param('seoname', NULL);
     if ($seoname !== NULL) {
         $user = new Model_User();
         $user->where('seoname', '=', $seoname)->where('status', '=', Model_User::STATUS_ACTIVE)->limit(1)->cached()->find();
         if ($user->loaded()) {
             $info = array('title' => 'RSS ' . htmlspecialchars($user->name, ENT_QUOTES), 'pubDate' => date("r"), 'description' => htmlspecialchars($user->name . ' - ' . $user->description, ENT_QUOTES), 'generator' => 'Yclas', 'link' => Route::url('profile', array('seoname' => $seoname)));
             $items = array();
             //last ads, you can modify this value at: advertisement.feed_elements
             $ads = new Model_Ad();
             $ads->where('status', '=', Model_Ad::STATUS_PUBLISHED)->where('id_user', '=', $user->id_user)->order_by('published', 'desc')->limit(Core::config('advertisement.feed_elements'));
             $ads = $ads->cached()->find_all();
             foreach ($ads as $a) {
                 $url = Route::url('ad', array('category' => $a->category->seoname, 'seotitle' => $a->seotitle));
                 $item = array('title' => htmlspecialchars($a->title, ENT_QUOTES), 'link' => $url, 'pubDate' => Date::mysql2unix($a->published), 'description' => htmlspecialchars(Text::removebbcode($a->description), ENT_QUOTES), 'guid' => $url);
                 if ($a->get_first_image() !== NULL) {
                     $item['description'] = '<img src="' . $a->get_first_image() . '" />' . $item['description'];
                 }
                 $items[] = $item;
             }
             $xml = Feed::create($info, $items);
         }
     }
     $this->response->headers('Content-type', 'text/xml');
     $this->response->body($xml);
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:29,代码来源:feed.php

示例13: __

								<p>
									<strong><?php 
        echo __('Price');
        ?>
</strong>: <?php 
        echo i18n::money_format($message->price);
        ?>
								</p>
							<?php 
    }
    ?>
						</div>
						
					</div>
					<div class="text-right mess-date"><small><?php 
    echo Date::fuzzy_span(Date::mysql2unix($message->created));
    ?>
 - <?php 
    echo $message->created;
    ?>
</small></div>
					</div>
			</div>
		<?php 
}
?>
		
			<div>
				<form method="post" action="<?php 
echo Route::url('oc-panel', array('controller' => 'messages', 'action' => 'message', 'id' => Request::current()->param('id')));
?>
开发者ID:ThomWensink,项目名称:openclassifieds2,代码行数:31,代码来源:message.php

示例14: generate

 /**
  * 
  * generate sitemap
  */
 public static function generate($force = FALSE)
 {
     //start time
     $start_time = microtime(TRUE);
     $site_url = Core::config('general.base_url');
     // include class
     require Kohana::find_file('vendor/sitemap', 'SitemapGenerator');
     // create object
     $sitemap = new SitemapGenerator($site_url, DOCROOT);
     // will create also compressed (gzipped) sitemap
     $sitemap->createGZipFile = TRUE;
     // determine how many urls should be put into one file
     $sitemap->maxURLsPerSitemap = 10000;
     // sitemap file name
     $sitemap->sitemapFileName = 'sitemap.xml';
     // sitemap index file name
     $sitemap->sitemapIndexFileName = 'sitemap-index.xml';
     // robots file name
     //$sitemap->robotsFileName = 'robots.txt';
     //users
     $users = new Model_User();
     $users = $users->select('seoname')->select('created')->where('status', '=', Model_User::STATUS_ACTIVE)->find_all();
     foreach ($users as $user) {
         $url = Route::url('profile', array('seoname' => $user->seoname));
         $sitemap->addUrl($url, date('c', Date::mysql2unix($user->created)), 'monthly', '0.5');
     }
     //pages CMS
     $pages = new Model_Content();
     $pages = $pages->select('seotitle')->where('type', '=', 'page')->where('status', '=', '1')->find_all();
     foreach ($pages as $page) {
         $url = Route::url('page', array('seotitle' => $page->seotitle));
         $sitemap->addUrl($url, date('c', Date::mysql2unix($page->created)), 'monthly', '0.5');
     }
     //FAQ CMS
     if (core::config('general.faq') == 1) {
         $pages = new Model_Content();
         $pages = $pages->select('seotitle')->where('type', '=', 'help')->where('status', '=', '1')->find_all();
         $sitemap->addUrl(Route::url('faq'), date('c'), 'monthly', '0.5');
         foreach ($pages as $page) {
             $url = Route::url('faq', array('seotitle' => $page->seotitle));
             $sitemap->addUrl($url, date('c', Date::mysql2unix($page->created)), 'monthly', '0.5');
         }
     }
     //locations
     $locs = new Model_Location();
     $locs = $locs->select('seoname')->where('id_location', '!=', 1)->find_all();
     //categories
     $cats = new Model_Category();
     $cats = $cats->select('seoname')->where('id_category', '!=', 1)->find_all();
     foreach ($cats as $cat) {
         $url = Route::url('list', array('category' => $cat->seoname));
         $sitemap->addUrl($url, date('c'), 'daily', '0.7');
         //adding the categories->locations
         foreach ($locs as $loc) {
             $url = Route::url('list', array('category' => $cat->seoname, 'location' => $loc->seoname));
             $sitemap->addUrl($url, date('c'), 'weekly', '0.5');
         }
     }
     //all the ads
     $ads = DB::select('a.seotitle')->select(array('c.seoname', 'category'))->from(array('ads', 'a'))->join(array('categories', 'c'), 'INNER')->on('a.id_category', '=', 'c.id_category')->where('a.status', '=', Model_Ad::STATUS_PUBLISHED)->as_object()->execute();
     foreach ($ads as $a) {
         $url = Route::url('ad', array('category' => $a->category, 'seotitle' => $a->seotitle));
         $sitemap->addUrl($url, date('c'), 'monthly', '0.5');
     }
     //all the blog posts
     if (core::config('general.blog') == 1) {
         $sitemap->addUrl(Route::url('blog'), date('c'), 'daily', '0.7');
         $posts = new Model_Post();
         $posts = $posts->where('status', '=', 1)->where('id_forum', 'IS', NULL)->order_by('created', 'desc')->find_all();
         foreach ($posts as $post) {
             $url = Route::url('blog', array('seotitle' => $post->seotitle));
             $sitemap->addUrl($url, date('c'), 'monthly', '0.5');
         }
     }
     //all the forums and topics
     if (core::config('general.forums') == 1) {
         $sitemap->addUrl(Route::url('forum-home'), date('c'), 'monthly', '0.5');
         $forums = new Model_Forum();
         $forums = $forums->select('seoname')->find_all();
         foreach ($forums as $forum) {
             $url = Route::url('forum-list', array('forum' => $forum->seoname));
             $sitemap->addUrl($url, date('c'), 'daily', '0.7');
         }
         //all the topics
         $posts = new Model_Post();
         $posts = $posts->where('status', '=', Model_Post::STATUS_ACTIVE)->where('id_forum', 'IS NOT', NULL)->where('id_post_parent', 'IS', NULL)->order_by('created', 'desc')->find_all();
         foreach ($posts as $post) {
             $url = Route::url('forum-topic', array('seotitle' => $post->seotitle, 'forum' => $post->forum->seoname));
             $sitemap->addUrl($url, date('c'), 'daily', '0.7');
         }
     }
     try {
         // create sitemap
         $sitemap->createSitemap();
         // write sitemap as file
         $sitemap->writeSitemap();
//.........这里部分代码省略.........
开发者ID:Chinese1904,项目名称:openclassifieds2,代码行数:101,代码来源:sitemap.php

示例15: test_mysql2unix

 /**
  * @dataProvider provider_unix2mysql
  */
 public function test_mysql2unix($time, $mysql)
 {
     $this->assertEquals(Date::mysql2unix($mysql), $time);
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:7,代码来源:DateTest.php


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