{"id":232529,"date":"2014-08-07T12:21:03","date_gmt":"2014-08-07T08:21:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=232529"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=232529","title":{"rendered":"<span class=\"post_title\">\u00ab\u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u043e\u0433\u043e\u0434\u0430\u00bb \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/136149\/\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0422\u0432\u043e\u044f\u041f\u043e\u0433\u043e\u0434\u0430<\/a> \u0441 \u0442\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u043b\u0438\u0442 \u0441\u0432\u0435\u0442 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u043e\u0433\u043e\u0434\u0430, \u0438, \u0431\u0443\u0434\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 <s>\u043a\u043e\u0434\u0430<\/s>. <\/p>\n<p>  <a name=\"habracut\"><\/a>\u0421\u043f\u0438\u0441\u043e\u043a \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0438 \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e <a href=\"http:\/\/weather.yandex.ru\/static\/cities.xml\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a>. <br \/>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u043f\u043e\u0433\u043e\u0434\u044b \u0441 \u0430\u0432\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0433\u043e\u0440\u043e\u0434\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438\u0437 xml \u0444\u0430\u0439\u043b\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0435 \u0432 \u0432\u0438\u0434\u0435 json \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f\u043c\u0438. <\/p>\n<p>  \u041a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 <a href=\"http:\/\/paranoia.today\/habr\/weather\/YandexCities.txt\">\u0441\u043f\u0438\u0441\u043e\u043a<\/a>. <\/p>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0433\u043e\u0440\u043e\u0434\u0430 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f ipGeoBase<\/p>\n<pre><code class=\"php\">\tfunction getGeo($ip) \t{ \t\tif(!filter_var($ip, FILTER_VALIDATE_IP, array('flags' =&gt; FILTER_FLAG_IPV4))) \t\treturn FALSE; \t\t$get = file_get_contents(&quot;http:\/\/ipgeobase.ru:7020\/geo?ip={$ip}&quot;); \t\t$xml = simplexml_load_string($get); \t\t$city = isset($xml-&gt;ip-&gt;city) ? strtolower($xml-&gt;ip-&gt;city) : ''; \t\treturn $city; \t} <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043c\u0435\u043d\u044f \u0432\u044b\u0448\u043b\u0430 \u043d\u0435\u0441\u0442\u044b\u043a\u043e\u0432\u043a\u0430. \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0421\u041d\u0413, \u043d\u043e \u043d\u0438 \u0437\u0430 \u0447\u0442\u043e \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u0438\u0437 \u041b\u043e\u043d\u0434\u043e\u043d\u0430. <br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0436\u0430\u0442\u044c, \u043d\u043e \u0440\u0443\u043a\u0438 \u043f\u043e\u043a\u0430\u043c\u0435\u0441\u0442 \u043d\u0435 \u0434\u043e\u0448\u043b\u0438. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u0430\u043c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0433\u043e\u0434\u043e\u0439. \u0412\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u00ab\u0437\u0430\u0447\u0435\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u00bb? \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043f\u043e\u0434 \u0434\u0432\u0438\u0436\u043e\u043a InstantCMS \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u041e\u0433\u043e\u0432\u043e\u0440\u044e\u0441\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043b\u0438\u0448\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b($noon, $night)  <\/p>\n<pre><code class=\"php\">class cms_model_weather{  private\t\t$cache_dir;  private\t\t$city_id; private\t\t$noon; \/\/\u0412\u0440\u0435\u043c\u044f \u0434\u043d\u044f. \u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 4 - \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0434\u043d\u044f 11:00-20:00 private\t\t$night; \/\/\u0412\u0440\u0435\u043c\u044f \u043d\u043e\u0447\u0438. \u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e 5   \t\/\/\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441  \tpublic function __construct(){ \t \t$this-&gt;cache_dir=$_SERVER['DOCUMENT_ROOT'].'\/habr\/cache\/weather'; \t$this-&gt;noon=4; \t$this-&gt;night=5; \t \tif(isset($_SESSION['weather_city'])){$cityname=$_SESSION['wether_city'];} \/\/\u0411\u0435\u0440\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u0438\u0437 \u0441\u0435\u0441\u0441\u0438\u0438 \telse{$cityname=getGeo($_SERVER['REMOTE_ADDR']); }\/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u043f\u043e \u0430\u0432\u0442\u043e\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \t \t$cities=json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'].'\/habr\/YandexCities.txt')); \t\t \t\tif(isset($cities-&gt;$cityname)){ \t\t\t$this-&gt;city_id=$cities-&gt;$cityname; \t\t} else { \t\t\t$this-&gt;city_id=$cities-&gt;{'\u041c\u043e\u0441\u043a\u0432\u0430'}; \t\t} \t} <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0440\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u044f\u043d\u0434\u0435\u043a\u0441\u0430, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. <\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c xml \u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u0438 \u043f\u0430\u0440\u0441\u0438\u043c \u0435\u0433\u043e. <br \/>  \u0417\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u00ab\u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\u00bb \u0434\u0430\u0442\u044b \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043d\u043e \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b \u043c\u043d\u0435 \u0433\u0443\u0433\u043b, \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0438. \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e, \u043d\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u043e\u044f\u043b\u0430 <u>\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f<\/u>.  <\/p>\n<pre><code class=\"php\">  \/\/\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0433\u043e\u0434\u0443 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u043e\u0440\u043e\u0434\u0430 \tpublic function getCityWeather(){ \t\t $_LANG['MONTHS']\t=\tarray( \t\t\t\t\t'Jan'=&gt;'\u044f\u043d\u0432\u0430\u0440\u044c', 'Feb'=&gt;'\u0444\u0435\u0432\u0440\u0430\u043b\u044c', 'Mar'=&gt;'\u043c\u0430\u0440\u0442', \t\t\t\t\t'Apr'=&gt;'\u0430\u043f\u0440\u0435\u043b\u044c', 'May'=&gt;'\u043c\u0430\u0439','Jun'=&gt;'\u0438\u044e\u043d\u044c', \t\t\t\t\t'Jul'=&gt;'\u0438\u044e\u043b\u044c','Aug'=&gt;'\u0430\u0432\u0433\u0443\u0441\u0442', 'Sep'=&gt;'\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c', \t\t\t\t\t'Oct'=&gt;'\u043e\u043a\u0442\u044f\u0431\u0440\u044c','Nov'=&gt;'\u043d\u043e\u044f\u0431\u0440\u044c','Dec'=&gt;'\u0434\u0435\u043a\u0430\u0431\u0440\u044c'); \t\t\t\t\t $_LANG['WEEKDAYS']\t=\tarray( \t\t\t\t\t'Sunday'=&gt;'\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435', 'Monday'=&gt;'\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a',  \t\t\t\t\t'Tuesday'=&gt;'\u0432\u0442\u043e\u0440\u043d\u0438\u043a', 'Wednesday'=&gt;'\u0441\u0440\u0435\u0434\u0430', \t\t\t\t\t'Thursday'=&gt;'\u0447\u0435\u0442\u0432\u0435\u0440\u0433', 'Friday'=&gt;'\u043f\u044f\u0442\u043d\u0438\u0446\u0430', \t\t\t\t\t'Saturday'=&gt;'\u0441\u0443\u0431\u0431\u043e\u0442\u0430'); \t\t \t\t \t\t$city_cache=$this-&gt;{cache_dir}.$this-&gt;{city_id}; \t\t\/\/\u0415\u0441\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u044d\u0448 \u0444\u0430\u0439\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 \u0448\u0435\u0441\u0442\u0438 \u043c\u0438\u043d\u0443\u0442, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043a\u044d\u0448\u0430 \t\tif(file_exists($city_cache) && filemtime($city_cache)&gt;time()-360){ \t\t\t$jsoned_weather=json_decode(file_get_contents($city_cache),TRUE); \t\t\t \t\t} else { \/\/\u0415\u0441\u043b\u0438 \u043a\u044d\u0448 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u044f\u043d\u0434\u0435\u043a\u0441\u0430 \t\t\t\t$weather=simplexml_load_file('http:\/\/export.yandex.ru\/weather-ng\/forecasts\/'.$this-&gt;city_id.'.xml'); \t\t\t \t\t\t\tif($weather!=null){ \t\t\t\t \t\t\t\t\t\t\/\/\u041f\u043e\u0433\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u043c\u044c \u0434\u043d\u0435\u0439 \t\t\t\t\t\tfor($i=1; $i&lt;=7; $i++) \t\t\t\t\t\t{ \t\t\t\t\t\t\tif($weather-&gt;day[$i]!=null){ \t\t\t\t\t\t\t\t$days['sevendays'][]=array( \t\t\t\t\t\t\t\t'weekday' =&gt; strtr(date('l', strtotime($weather-&gt;day[$i]-&gt;attributes()-&gt;date)), $_LANG['WEEKDAYS']), \t\t\t\t\t\t\t\t'data'=&gt;strtr(date(&quot;j M&quot;,strtotime($weather-&gt;day[$i]-&gt;attributes()-&gt;date)), $_LANG['MONTHS']), \t\t\t\t\t\t\t\t'temp_day' =&gt; $this-&gt;checkZeroMark($weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;temperature), \t\t\t\t\t\t\t\t'temp_night' =&gt; $this-&gt;checkZeroMark($weather-&gt;day[$i]-&gt;day_part[$this-&gt;night]-&gt;temperature), \t\t\t\t\t\t\t\t'weather_type' =&gt; $weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;weather_type, \t\t\t\t\t\t\t\t'wind_speed' =&gt; $weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;wind_speed,  \t\t\t\t\t\t\t\t'humidity' =&gt; $weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;humidity,  \t\t\t\t\t\t\t\t'pressure' =&gt; $weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;pressure,  \t\t\t\t\t\t\t\t'image' =&gt; $weather-&gt;day[$i]-&gt;day_part[$this-&gt;noon]-&gt;{'image-v3'} \t\t\t\t\t\t\t\t); \t\t\t\t\t\t\t} \t\t\t\t\t\t} \t\t\t\t\t \t\t\t\t\t\/\/\u041f\u043e\u0433\u043e\u0434\u0430 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \t\t\t\t\t$days['today']=array( \t\t\t\t\t'weekday' =&gt; strtr(date('l'), $_LANG['WEEKDAYS']), \t\t\t\t\t'data'=&gt;strtr(date('j M Y, G:i'), $_LANG['MONTHS']), \t\t\t\t\t'temperature' =&gt; $this-&gt;checkZeroMark($weather-&gt;fact-&gt;temperature), \t\t\t\t\t'weather_type' =&gt; $weather-&gt;fact-&gt;weather_type, \t\t\t\t\t'wind_speed' =&gt; $weather-&gt;fact-&gt;wind_speed,  \t\t\t\t\t'humidity' =&gt; $weather-&gt;fact-&gt;humidity,  \t\t\t\t\t'pressure' =&gt; $weather-&gt;fact-&gt;pressure,  \t\t\t\t\t'water_temp' =&gt; $this-&gt;checkZeroMark($weather-&gt;fact-&gt;water_temperature),  \t\t\t\t\t'sunrise' =&gt; $weather-&gt;day-&gt;sunrise,  \t\t\t\t\t'sunset' =&gt; $weather-&gt;day-&gt;sunset,  \t\t\t\t\t'image' =&gt; $weather-&gt;fact-&gt;{'image-v3'}, \t\t\t\t\t'city'=&gt;$weather-&gt;attributes()-&gt;city, \t\t\t\t\t'country' =&gt; $weather-&gt;attributes()-&gt;country \t\t\t\t\t); \t\t\t\t\t\t\t\t \t\t\t\t\tfile_put_contents($city_cache, json_encode($days)); \t\t\t\t\t$jsoned_weather=json_decode(file_get_contents($city_cache), TRUE); \t\t\t\t} else{ \t\t\t\t\t\treturn null; \t\t\t\t} \t\t} \t\treturn $jsoned_weather; \t\t \t} \/\/\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0437\u043d\u0430\u043a\u0430 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \t\/\/\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043b\u044e\u0441, \u043c\u0438\u043d\u0443\u0441 \u0438\u043b\u0438 \u043d\u043e\u043b\u044c \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \tpublic function checkZeroMark($temperature){ \t\tif($temperature&gt;0){ \t\t\treturn '+'.$temperature; \t\t} elseif ($temperature&lt;0){ \t\t\treturn '-'.$temperature; \t\t} \treturn $temperature; \t} } <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 $weather \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0432 var_dump. \u0422\u0430\u043a \u043a\u0430\u043a \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433 \u043f\u043e\u0433\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c, \u043d\u0435 \u043a\u0438\u0434\u0430\u0439\u0442\u0435 \u043f\u043e\u043c\u0438\u0434\u043e\u0440\u0430\u043c\u0438-\u0432\u043e\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u044c\u0441\u0442\u0432\u0430 =), \u043d\u0430 \u043c\u0430\u0439\u043b\u0440\u0443, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0443\u0434\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. <br \/>  \u041b\u0435\u0433\u043a\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e <b>$weather-&gt;fact<\/b> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c. \u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 <b>$weather-&gt;fact-&gt;water_temperature <\/b>\u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u0433\u043e\u0440\u043e\u0434\u043e\u0432, \u0440\u044f\u0434\u043e\u043c \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0435\u0441\u0442\u044c \u043c\u043e\u0440\u0435. \u0414\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043b\u0438\u0431\u043e 0(\u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0441\u044e\u0440\u043f\u0440\u0438\u0437), \u043b\u0438\u0431\u043e null. <br \/>  <b>$weather-&gt;attributes()<\/b> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0431\u044b\u043b\u0430 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0438\u0437 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u0435\u0439. \u0415\u0441\u0442\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u0433\u0435\u043e\u043b\u043e\u043a\u0430\u0446\u0438\u0438. <br \/>  <b>$weather-&gt;fact-&gt;{&#8216;image-v3&#8217;}<\/b> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u044b \u043f\u043e\u0433\u043e\u0434\u044b. \u0421\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u044f \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u043b \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u044f \u0441\u043b\u043e\u0442-\u043c\u0430\u0448\u0438\u043d\u0443 \u043f\u043e\u0433\u043e\u0434\u044b \u044f\u043d\u0434\u0435\u043a\u0441\u0430 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u043e\u0440\u043e\u0434\u0430\u0445. \u0418\u043c\u0435\u0439\u0442\u0435 \u0432\u0432\u0438\u0434\u0443, \u043d\u0430 \u043d\u043e\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043a\u043e\u043d\u043a\u0438. \u0422\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0435\u043b(\u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435)<\/p>\n<p>  Skc_d \u2014 \u0441\u043e\u043b\u043d\u0435\u0447\u043d\u043e(\u044f\u0441\u043d\u043e)<br \/>  skc_n \u2014 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0434\u043b\u044f \u043d\u043e\u0447\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<br \/>  bkn_d \u2014 \u043e\u0431\u043b\u0430\u0447\u043d\u043e, \u0441 \u043f\u0440\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438<br \/>  bkn_-ra_d \u2014 \u043e\u0431\u043b\u0430\u0447\u043d\u043e \u0441 \u043f\u0440\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0434\u043e\u0436\u0434\u044c<br \/>  bkn_-ra_n \u2014 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u043d\u043e\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u0443\u0442\u043e\u043a<br \/>  ovc \u2014 \u043e\u0431\u043b\u0430\u0447\u043d\u043e<br \/>  ovc_ra \u2014 \u0434\u043e\u0436\u0434\u044c<br \/>  ovc_-ra \u2014 \u0441\u043b\u0430\u0431\u044b\u0439 \u0434\u043e\u0436\u0434\u044c(\u043d\u0435 \u043f\u043e\u043c\u043d\u044e, \u043a\u0430\u043a \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u0435)<br \/>  jg_d \u2014 \u0442\u0443\u043c\u0430\u043d<br \/>  bl \u2014 \u043c\u0435\u0442\u0435\u043b\u044c<br \/>  ovc_sn \u2014 \u0441\u043d\u0435\u0433<br \/>  ovc_ts_ra \u2014 \u0433\u0440\u043e\u0437\u0430<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e <b>$weather-&gt;day[]<\/b>. \u0417\u0434\u0435\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u0433\u043e\u0434\u0435 \u043d\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0432\u043f\u0435\u0440\u0435\u0434 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0433\u043e \u0434\u043d\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0430 \u043d\u0430 6 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u0432 \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0433\u043e. \u041f\u0443\u0442\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0432\u043e\u0434\u043a\u0438 \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u043d\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0434 \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c. \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438, 24 \u0447\u0430\u0441\u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u043e \u043d\u0430 6 \u0447\u0430\u0441\u0442\u0435\u0439, \u043d\u043e \u0441\u0432\u043e\u0434\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432 \u0447\u0430\u0441\u043e\u0432\u043e\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0442\u0441\u044f \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438. \u041f\u043e\u043f\u0440\u0430\u0432\u044c\u0442\u0435, \u0435\u0441\u043b\u0438 \u044f \u043e\u0448\u0438\u0431\u0430\u044e\u0441\u044c.<\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u044f\u043d\u0434\u0435\u043a\u0441 \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b \u043e\u0431\u0438\u043b\u0438\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f moonrise\/moonset. \u0427\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/paranoia.today\/habr\/weather\/weather.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0420\u0430\u0431\u043e\u0447\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"http:\/\/paranoia.today\/habr\/weather\">\u043f\u0440\u0435\u0432\u044c\u044e<\/a>. <\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"http:\/\/pastebin.com\/N0jek62n\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 \u0436\u0434\u0443 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/232529\/\"> http:\/\/habrahabr.ru\/post\/232529\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043e\u0431\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u0443\u0442\u043e\u043a. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/136149\/\">\u042f\u043d\u0434\u0435\u043a\u0441.\u0422\u0432\u043e\u044f\u041f\u043e\u0433\u043e\u0434\u0430<\/a> \u0441 \u0442\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u043b\u0438\u0442 \u0441\u0432\u0435\u0442 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u042f\u043d\u0434\u0435\u043a\u0441.\u041f\u043e\u0433\u043e\u0434\u0430, \u0438, \u0431\u0443\u0434\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 <s>\u043a\u043e\u0434\u0430<\/s>. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-232529","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/232529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=232529"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/232529\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=232529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=232529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=232529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}