<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kadir Özdemir &#187; PHP</title>
	<atom:link href="http://www.skorp.eu/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skorp.eu</link>
	<description>Programlama, Güvenlik, Design ve hayatimdan kesintiler</description>
	<lastBuildDate>Fri, 02 Dec 2011 14:29:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Silverstripe yeni sayfa tipleri</title>
		<link>http://www.skorp.eu/2011/11/01/silverstripe-yeni-sayfa-tipleri/</link>
		<comments>http://www.skorp.eu/2011/11/01/silverstripe-yeni-sayfa-tipleri/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 19:11:24 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[Cms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverstripe]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=574</guid>
		<description><![CDATA[Silverstripe&#8217;i ilk kurdugumuzda bazi standard sayfa türleri ile gelir. Sistemimizin gereksinime göre degisik sayfa türleri üretmemiz gereklidir. Bugünki yazimizda SS&#8217;de baska bir sayfa türü nasil olusturulur ona bakacagiz. Önce SS ile default olarak gelen sayfa türlerini taniyalim: Page:en temel sayfa türüdür.Ilerki yazilarda üretecegimiz tüm sayfalar bu türden olacaktir ErrorPage:Hata oldugunda gösterilicek olan sayfa. Degisik hatalara [...]]]></description>
			<content:encoded><![CDATA[<p>Silverstripe&#8217;i ilk kurdugumuzda bazi standard sayfa türleri ile gelir.<br />
Sistemimizin gereksinime göre degisik sayfa türleri üretmemiz gereklidir.<br />
Bugünki yazimizda SS&#8217;de baska bir sayfa türü nasil olusturulur ona bakacagiz. </p>
<p>Önce SS ile default olarak gelen sayfa türlerini taniyalim:</p>
<ul>
<li><strong>Page:</strong>en temel sayfa türüdür.Ilerki yazilarda üretecegimiz tüm sayfalar bu türden olacaktir</li>
<li><strong>ErrorPage:</strong>Hata oldugunda gösterilicek olan sayfa. Degisik hatalara degisik sayfalar üretile bilinir. mesela 404 bulunamadi ile 403 erisim engellendi sayfalari degisik görüne bilinir</li>
<li><strong>RedirectorPage:</strong> Baska bir sayfaya veya Websitesine yönlendirmek icin kullanilir</li>
<li><strong>VirtualPage:</strong> baska bir sayfanin icerigini kullanir. Redirector sayfasindan bunu ayiran, sadece sitemiz icindeki sitelerde kullanilir ve icerigini kopyalar.</li>
</ul>
<p><strong>Kendi Sayfa türümüzü olusturalim</strong><br />
/mysite/code klasörü icinde Baslik, tarih, resim ve icerik eklene bilen bir sayfa türü üretelim, adinida ArticlePage koyalim.</p>
<p>/mysite/code/ArticlePage.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class ArticlePage extends Page { // Model
    static $db = array(
       'Date' =&gt; 'Date',
    );
    public static $has_one = array(
        'Picture' =&gt; 'Image',
    );
    function getCMSFields() {
       $fields = parent::getCMSFields();

       $fields-&gt;addFieldToTab('Root.Content.Main', new DateField('Date'), 'Content');
       $fields-&gt;addFieldToTab(&quot;Root.Content.Main&quot;, new ImageField('Picture'));

       return $fields;
    }
}
/* controller */
class ArticlePage_Controller extends Page_Controller {
}

?&gt;
</pre>
<p>Silverstripe MVC tasarim kalibini kullanmaktadir.<br />
Silverstripe de olusturdugumuz her sayfa Model ve Controller kismini barindirmaktadir.<br />
Her sayfa Page sayfasindan extend etmelidir.</p>
<pre class="brush: php; title: ; notranslate">
static $db = array('Date' =&gt; 'Date',);
</pre>
<p><em>db</em> degiskeninin özel bir islevi vardir, veritabani alanlari tanimlamak icin kullanilir.<br />
Örnegimizde tarihi kaydetmek icin Date tipinde bir alan adi tanimladik.</p>
<p><em>has_one</em> degiskeni her ArticlePage sayfamiza bir resim eklemesini söylüyor.<br />
Bu baglantilara daha sonraki bir yazimizda daha detayli bakacagiz.</p>
<p>Gerekli alanlari tanimladikdan sonra bunlari Admin e eklememiz gerekiyor.<br />
<em>GetCMSFields</em> ile bu isi yapa biliriz.</p>
<p>View kismina bakalim.<br />
theme dosyamizda ArticlePage.ss adinda bir dosya olusturalim.<br />
/themes/blackcandy/templates/Layout/ArticlePages.ss</p>
<pre class="brush: xml; title: ; notranslate">

    &lt;div&gt;
        &lt;h1&gt;$Title&lt;/h1&gt;
        &lt;div&gt;Date : $Date.nice&lt;/div&gt;
        &lt;div&gt;$Picture&lt;/div&gt;
        $Content
        $Form
    &lt;/div&gt;
</pre>
<p>Model, view ve Controlleri tamamladikdan sonra adres satirina /dev/build/?flush=all yazip degisiklikleri kaydedelim.<br />
Simdi Admin de yeni bir sayfa üretmek istedigimizde ArticlePage sayfamizi sece biliriz.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2011/11/01/silverstripe-yeni-sayfa-tipleri/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silverstripe snippetler</title>
		<link>http://www.skorp.eu/2011/09/04/silverstripe-snippetler/</link>
		<comments>http://www.skorp.eu/2011/09/04/silverstripe-snippetler/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 15:22:45 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[Cms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverstripe]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=542</guid>
		<description><![CDATA[Adres satirina eklenenler Template in olusturdugu kodu görmek icin önbellegi temizlememe kodu ve db yi senkronlamak icin önemli (http://localhost/dev/build seklinde olmali) Tüm sayfalari birden yayinlamak veritabanini olusturur ama kayitlari eklemez config dosyasindaki degere aldirilmadan, Test moduna gec tüm queryleri göstermek icin: tüm insert ve updateleri gösterir ama calistirmaz performance icin diger mysite/_config.php icine eklenenler development [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Adres satirina eklenenler</strong><br />
Template in olusturdugu kodu görmek icin</p>
<pre class="brush: php; title: ; notranslate">?isDev=1&amp;showtemplate=1</pre>
<p>önbellegi temizlememe</p>
<pre class="brush: php; title: ; notranslate">?flush=all</pre>
<p>kodu ve db yi senkronlamak icin önemli (http://localhost/dev/build seklinde olmali)</p>
<pre class="brush: php; title: ; notranslate">/dev/build</pre>
<p>Tüm sayfalari birden yayinlamak</p>
<pre class="brush: php; title: ; notranslate">/admin/publishall/</pre>
<p>veritabanini olusturur ama kayitlari eklemez</p>
<pre class="brush: php; title: ; notranslate">/dev/build?dont_populate=1</pre>
<p>config dosyasindaki degere aldirilmadan, Test moduna gec</p>
<pre class="brush: php; title: ; notranslate">?isTest=1</pre>
<p>tüm queryleri göstermek icin:</p>
<pre class="brush: php; title: ; notranslate">?showqueries=1</pre>
<p>tüm insert ve updateleri gösterir ama calistirmaz</p>
<pre class="brush: php; title: ; notranslate">
?previewwrite=1</pre>
<p>performance icin</p>
<pre class="brush: php; title: ; notranslate">
?debug_memory=1
?debug_profile=1
?debug_profile=1&amp;profile_trace=1
</pre>
<p>diger</p>
<pre class="brush: php; title: ; notranslate">
?debugmanifest=1
?debugmethods=1
?debugfailover=1
?debug_request=1
?debug=1</pre>
<p><strong>mysite/_config.php icine eklenenler</strong><br />
development moda gecmek icin (standard live mod)</p>
<pre class="brush: php; title: ; notranslate">Director::set_environment_type('dev'); </pre>
<p><span id="more-542"></span><br />
live moda gecmek icin</p>
<pre class="brush: php; title: ; notranslate">Director::set_environment_type('live');</pre>
<p>source code da hangi template in hangi kodu olusturdugunu görmek icin</p>
<pre class="brush: php; title: ; notranslate">SSViewer::set_source_file_comments(true);</pre>
<p>Dev modda sürekli siteyi ?/flush=1 yazmak yerine bu kullanila bilirni:</p>
<pre class="brush: php; title: ; notranslate">if(Director::isDev()){
SSViewer::flush_template_cache();
}</pre>
<p>Cms de ana menüden birsey cikarmak icin</p>
<pre class="brush: php; title: ; notranslate">CMSMenu::remove_menu_item('ReportAdmin');</pre>
<p>Logoyu degistirmek icin</p>
<pre class="brush: php; title: ; notranslate">
LeftAndMain::setLogo(
'themes/bar/images/CMSLogo.png',
'margin: 2px;'
);
</pre>
<p>Cms yüklenirken gösterilen logoyu degistirmek icin:</p>
<pre class="brush: php; title: ; notranslate">LeftAndMain::set_loading_image('themes/bar/images/CMSLoading.gif');</pre>
<p>tinymce de diyelim tablo kontrollerini göstermek istemiyorsunuz ozaman bunu kullaniniz</p>
<pre class="brush: php; title: ; notranslate">HtmlEditorConfig::get('cms')-&gt;removeButtons('tablecontrols');</pre>
<p>tinymce de setoptions</p>
<pre class="brush: php; title: ; notranslate">
HtmlEditorConfig::get('cms')-&gt;setOption(
'convert_fonts_to_spans', false
);</pre>
<p>www siz istekleri hep www.siteadi.com a yönlendirmek icin</p>
<pre class="brush: php; title: ; notranslate">Director::forceWWW();</pre>
<p> //sade live modda calisiyor</p>
<p>Googlesitemap modul kullaniyorsaniz her yeni sayfada google i haberdar etmek icin</p>
<pre class="brush: php; title: ; notranslate">GoogleSitemap::enable_google_notification();</pre>
<p>resim kalitesi icin </p>
<pre class="brush: php; title: ; notranslate">GD::set_default_quality(95);</pre>
<p>prototype js validasyonu kapatmak icin</p>
<pre class="brush: php; title: ; notranslate">
Validator::set_javascript_validation_handler('none');</pre>
<p>Dataobject lerin siralarmasini düzenlemek icin:</p>
<pre class="brush: php; title: ; notranslate">SortableDataObject::add_sortable_class('CustomImage');</pre>
<p>arama fonksiyonunu acalim:</p>
<pre class="brush: php; title: ; notranslate">FulltextSearchable::enable();</pre>
<p><strong>Controller icinde</strong><br />
Theme klasörü icindeki bir Css dosyasini eklemek icin</p>
<pre class="brush: php; title: ; notranslate">Requirements::themedCSS('form', 'screen,projection');</pre>
<p>Theme klasörü disinden bir Css dosyasi eklemek icin</p>
<pre class="brush: php; title: ; notranslate">Requirements::css('file', 'media');</pre>
<p>tüm css dosyalarini combine etmek icin:</p>
<pre class="brush: php; title: ; notranslate">
Requirements::themedCSS('print', 'print');
$theme = SSViewer::current_theme();
Requirements::combine_files('combined.css', array(
THEMES_DIR . '/' . $theme . '/css/layout.css',
THEMES_DIR . '/' . $theme . '/css/typography.css',
THEMES_DIR . '/' . $theme . '/css/form.css',
));
</pre>
<p>özel css eklemek icin</p>
<pre class="brush: php; title: ; notranslate">Requirements::customCss('.once { font-weight: bold; }', 'once');</pre>
<p>Head tagi icine mesela conditional statement eklemek icin</p>
<pre class="brush: php; title: ; notranslate">
Requirements::insertHeadTags('
&lt;!--[if lt IE 9]&gt;
&lt;style type=&quot;text/css&quot;&gt;
......
&lt;/style&gt;
&lt;![endif]--&gt;
', 'IE-styling');
</pre>
<p>Javascript eklemek icin: </p>
<pre class="brush: php; title: ; notranslate">Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery-packed.js');</pre>
<p>otomatik eklenen js dosyalarini engellemek icin</p>
<pre class="brush: php; title: ; notranslate">Requirements::block(THIRDPARTY_DIR . '/prototype/prototype.js');</pre>
<p>sadece Live modda calismasini istedigin kod icin</p>
<pre class="brush: php; title: ; notranslate">if(Director::isLive()){..}</pre>
<p>sade dev modda calismasini istedigin kod  icin </p>
<pre class="brush: php; title: ; notranslate">if(Director::isDev()){ ... } </pre>
<p>Google Analytics kodu eklemek icin</p>
<pre class="brush: php; title: ; notranslate">
if(Director::isLive()){
Requirements::customScript(&quot;
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function(){
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') +
'.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
&quot;, 'google-analytics');
}
</pre>
<p>Kod icinde Debug:</p>
<pre class="brush: php; title: ; notranslate">
Debug::show($variable);
Debug::message('My message');
SS_Backtrace::backtrace()
user_error('My message', E_USER_ERROR):
</pre>
<p><strong>Model e eklenen ayarlar:</strong><br />
adminde görünmesini istemediginiz Sayfalar icin:</p>
<pre class="brush: php; title: ; notranslate">public static $hide_ancestor = 'Page';</pre>
<p>Cms deki Sayfalar icon eklemek icin:</p>
<pre class="brush: php; title: ; notranslate">public static $icon = 'mysite/icons/intro';</pre>
<p>cikti: <em>mysite/icons/intro-file.gif</em><br />
dikkat edilmesi gereken -file.gif kendiliginden ekleniyor.</p>
<p>sade üst sayfa icin (true) alt sayfa olmasi icin(false)</p>
<pre class="brush: php; title: ; notranslate">public static $can_be_root = false;</pre>
<p>Sayfanin hangi alt sayfalari ola bilir diye belirlemek icin:</p>
<pre class="brush: php; title: ; notranslate">public static $allowed_children = array('ContentPage');</pre>
<p>CMS e tab eklemek veya silmek icin:</p>
<pre class="brush: php; title: ; notranslate">
$fields-&gt;removeFieldFromTab('Root.Content.Main', 'Content');
$fields-&gt;addFieldToTab().('Root.Content.Main', 'Content');
</pre>
<p>query gidecek olan icerikleri escape etmek icin:</p>
<pre class="brush: php; title: ; notranslate">$good = Convert::raw2sql($_GET['evil']);
DataObject::get_one('SiteTree', &quot;URLSegment = '$good'&quot;);</pre>
<p>tüm model deki metodlari veya degiskenler <strong>public</strong> olmalidir</p>
<p>Controllerde ise:<br />
url den erisilicek olan metodlar <strong>public</strong><br />
helper olarak calisacak olan metodlar <strong>protected</strong><br />
init ise <strong>public</strong> olmalidir</p>
<p>metodlari url den erisilmesi icin bunuda kullana bilirsiniz.</p>
<pre class="brush: php; title: ; notranslate">public static $allowed_actions = array('visible');</pre>
<p>devami zamanla gelecek.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2011/09/04/silverstripe-snippetler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverstripe</title>
		<link>http://www.skorp.eu/2011/07/12/silverstripe/</link>
		<comments>http://www.skorp.eu/2011/07/12/silverstripe/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 18:56:00 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[Cms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silverstripe]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=528</guid>
		<description><![CDATA[COktandir kullanmaya vakit bulamadigim, ama sonunda kullandigim acik kaynakli bir CMS/Framework den bahsetmek istiyorum. Simdiye kadar kullandigim CMS ler arasinda bir PHP cinin kullana bilecegi en iyi CMS diye bilirim. Silverstripe (SS) alt yapisinda yine SS in kurucularinin yazmis olduklari Sapphire Framework kullanilmakda. SS icin bircok eklenti mevcut bunlara silverstripe.org sitesinden baka bilirsiniz. SUana kadar [...]]]></description>
			<content:encoded><![CDATA[<p>COktandir kullanmaya vakit bulamadigim, ama sonunda kullandigim acik kaynakli bir CMS/Framework den bahsetmek istiyorum.<br />
Simdiye kadar kullandigim CMS ler arasinda bir PHP cinin kullana bilecegi en iyi CMS diye bilirim.</p>
<p>Silverstripe (SS) alt yapisinda yine SS in kurucularinin yazmis olduklari Sapphire Framework kullanilmakda.</p>
<p>SS icin bircok eklenti mevcut bunlara <a href="http://www.silverstripe.org" title="silverstripe.org" target="_blank">silverstripe.org</a> sitesinden baka bilirsiniz.</p>
<p>SUana kadar tespit ettiklerim:</p>
<ul>
<li>güclü nesne yönelimli yapisi</li>
<li>MVC-Pattern</li>
<li>Scaffolding</li>
<li>kolay genisletilebilirlik</li>
<li>kullanim kolayligi</li>
<li>eklentiler</li>
</ul>
<p>.. vs bu liste uzar gider php de yeni bir CMS ariyan varsa demo icin buraya baka bilir: <a href="http://demo.silverstripe.org/" target="_blank">Silverstripe Demo</a> </p>
<p>Bu arada bir günde Theming ile birlikde bir site olusturdum gecen hafta.<br />
<em>Silverstripe 2.4 Module Extension, Themes and Widgets</em> kitabini okumaya basladim bundan sonra silverstripe hakkinda daha cok seyler yazacagim insallah.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2011/07/12/silverstripe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Zend ViewHelper ve birden cok Metot barindirma</title>
		<link>http://www.skorp.eu/2011/03/29/zend-viewhelper-ve-birden-cok-metot-barindirma/</link>
		<comments>http://www.skorp.eu/2011/03/29/zend-viewhelper-ve-birden-cok-metot-barindirma/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 22:57:30 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=521</guid>
		<description><![CDATA[View Scriptlerde komplex fonksiyonlari bircok kez calistirmak gerekiyorsa, bildigimiz gibi bunu Zend Framework ün bize sunmus oldugu View Helperler ile gerceklestire biliriz. Bu yazimizda View Helperde birden cok Metodu nasil barindirirz ona bakalim. Helper dedigimiz aslinda basit bir Sinif. Diyelimki &#8220;String&#8221; adinda bir helper olusturmak istiyoruz. Bu string helperi bize string adinda bir string geri [...]]]></description>
			<content:encoded><![CDATA[<p>View Scriptlerde komplex fonksiyonlari bircok kez calistirmak gerekiyorsa, bildigimiz gibi bunu Zend Framework ün bize sunmus oldugu View Helperler ile gerceklestire biliriz.<br />
Bu yazimizda View Helperde birden cok Metodu nasil barindirirz ona bakalim.<br />
Helper dedigimiz aslinda basit bir Sinif.<br />
Diyelimki &#8220;<strong>String</strong>&#8221; adinda bir helper olusturmak istiyoruz.<br />
Bu string helperi bize string adinda bir string geri versin istiyoruz.<br />
Zend Studio nun varsayilan sablonunda helperler <em>/application/views/helpers</em> klasörü altinda kayit edile bilinir.<br />
Bu klasörün icinde <strong>String.php</strong> diye bir dosya olusturalim.<br />
Ve icine sunu kaydedelim<br />
<span id="more-521"></span></p>
<pre class="brush: php; title: ; notranslate">
class Zend_View_Helper_String extends Zend_View_Helper_Abstract
{

    public function string ()
    {
       return &quot;Bubir helperdir: string()&quot;;
    }

}
</pre>
<p>Sinif adimiz baska birsey belirtilmemisse <strong>Zend_View_Helper_String</strong> bunu <strong>Zend_View_Helper_Abstract</strong> dan <em>extend</em> ediyoruz.<br />
Extend etmedende yapa bilirsniz, ama siz ileride sorun yasamak istemiyorsaniz benim yaptigim gibi yapin.</p>
<p>simdi <strong>index.phtml</strong> dosyamiza su satiri ekliyelim.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php echo $this-&gt;string();?&gt;
</pre>
<p>kaydedip sayfayi calistirdigimizda </p>
<p><code>BU bir Helperdir: string()</code></p>
<p>yazisini görmemiz gerekiyor.</p>
<p>Basit bir View Helperi böyle yapiyoruz, simdi ise asil bu yaziyi yazmama sebeb olan <a href="http://www.faruktemur.com/" target="_blank">Faruk Temur </a>arkadasimin istedigi gibi, bir Helper sinifinda nasil birden cok Metotu barindiririz ona bakalim.</p>
<p>Sinifimizi su sekil degistiriyoruz.</p>
<pre class="brush: php; title: ; notranslate">
class Zend_View_Helper_String extends Zend_View_Helper_Abstract
{

    public function string ()
    {
       return $this;
    }

    public function substr() {
    	return &quot;Bu bir helperdir: substr()&lt;br&gt;&quot;;
    }
    public function strlen() {
    	return &quot;Bu Helperdeki ikinci metot: strlen()&lt;br&gt;&quot;;
    }

}
</pre>
<p>görüldügü gibi string metodu <strong>return $this</strong> yaparak kendi nesnesini geri döndürüyor ve böylelikle string sinifi icinden baska bir metot cagirmamiza olanak sagliyor.</p>
<p><strong>index.phtml </strong>dosyamiza sunlari ekliyelim</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php echo $this-&gt;string()-&gt;substr();?&gt;
&lt;?php echo $this-&gt;string()-&gt;strlen();?&gt;
</pre>
<p>asagidaki ciktiyi aliyorsaniz herseyi dogru yaptiniz demektir.<br />
<code>Bu bir helperdir: substr()<br />
Bu Helperdeki ikinci metot: strlen()</code></p>
<p>Bugünlük bukadar kolay gelsin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2011/03/29/zend-viewhelper-ve-birden-cok-metot-barindirma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developers Shame Day</title>
		<link>http://www.skorp.eu/2010/11/03/developers-shame-day/</link>
		<comments>http://www.skorp.eu/2010/11/03/developers-shame-day/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 22:06:28 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[diger Kodlar]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=447</guid>
		<description><![CDATA[Biraz gec kalsamda, gece bitmeden utanc gününün kodunu ekliyorum. Daha öncede yazdigim gibi Cem Derin bugunu kodcularin utanc günü ilan etti. Bizde payimiza düseni ekliyelim. 2006 da yapmis oldugum bir cms icinde bulunan bir kod parcacigi. Ayni is icin iki ayri fonksiyon iki kezde ayri ayri yazmisim. Bugun ikisinide kullanmazdim Aslinda 2005 de yazdigim bir [...]]]></description>
			<content:encoded><![CDATA[<p>Biraz gec kalsamda, gece bitmeden utanc gününün kodunu ekliyorum.<br />
Daha <a href="http://www.skorp.eu/2010/10/27/programcilarin-utanc-gunu/">öncede yazdigim</a> gibi Cem Derin bugunu kodcularin utanc günü ilan etti. Bizde payimiza düseni ekliyelim.<br />
2006 da yapmis oldugum bir cms icinde bulunan bir kod parcacigi.<br />
Ayni is icin iki ayri fonksiyon iki kezde ayri ayri yazmisim.<br />
Bugun ikisinide kullanmazdim <img src='http://www.skorp.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: php; title: ; notranslate">

function date2datetime($date) {
		$preg=&quot;([0-9]{1,2}).([0-9]{1,2}).([0-9]{4})&quot;;
		if(preg_match(&quot;/$preg/&quot;,$date,$tarih))
			return $tarih[&quot;3&quot;].&quot;-&quot;.$tarih[&quot;2&quot;].&quot;-&quot;.$tarih[&quot;1&quot;];
	}

function changeDatumtoMysqlDatum($datum) {
	$d = substr($datum,0,2);
	$m = substr($datum,3,2);
	$y = substr($datum,-4);
	$newdatum = &quot;$y-$m-$d&quot;;
	return $newdatum;
}
</pre>
<p>Aslinda 2005 de yazdigim bir c# Projesinin kodlarini ekliyecektim ama proje yi bulamadim.<br />
Onda daha utanc verici satirlar vardi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2010/11/03/developers-shame-day/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>php ile zip download</title>
		<link>http://www.skorp.eu/2010/09/24/php-ile-zip-download/</link>
		<comments>http://www.skorp.eu/2010/09/24/php-ile-zip-download/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 10:39:05 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=432</guid>
		<description><![CDATA[bugünki yazimizda php ile bircok dosyayi bir zip arsiv i ile nasil indiririz ona bakacagiz. ziparchive php 5.2 ye den sonra eklenmistir, bundan kücük sürüm kullananlar pecl extension u kurmalari gerekiyor.]]></description>
			<content:encoded><![CDATA[<p>bugünki yazimizda php ile bircok dosyayi bir zip arsiv i ile nasil indiririz ona bakacagiz.</p>
<pre class="brush: php; title: ; notranslate">

$file_names = array(&quot;dosya1.pdf&quot;,&quot;dosya2.pdf&quot;,&quot;dosya3.pdf&quot;);
$archive_file_name = &quot;download.zip&quot;;
//zip objesi olustur
$zip = new ZipArchive();
//  dosyayi olustur
  if ($zip-&gt;open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
    exit(&quot;cannot open &lt; $archive_file_name&gt;\n&quot;);
  }
  //zip e eklenecek olan dosyalari ekle
  foreach($file_names as $files)
  {
   //$file_path.$files filepath dosya yolu, files ise dosya adi,
	//ikinci $files parametresi zip deki dosya adi
    $zip-&gt;addFile($file_path.$files,$files);
  }
  $zip-&gt;close();
  //header ile download islemini baslattir
  header(&quot;Content-type: application/zip&quot;);
  header(&quot;Content-Disposition: attachment; filename=$archive_file_name&quot;);
  header(&quot;Pragma: no-cache&quot;);
  header(&quot;Expires: 0&quot;);
  readfile(&quot;$archive_file_name&quot;);
  exit;
</pre>
<p>ziparchive php 5.2 ye den sonra eklenmistir, bundan kücük sürüm kullananlar pecl extension u kurmalari gerekiyor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2010/09/24/php-ile-zip-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php 5.3 Namespace ler</title>
		<link>http://www.skorp.eu/2009/10/01/php-5-3-namespace-ler/</link>
		<comments>http://www.skorp.eu/2009/10/01/php-5-3-namespace-ler/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 15:58:22 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php 5.3]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=364</guid>
		<description><![CDATA[Bir uygulama nekadar büyür, nekadar cok yazar o uygulamada calisirsa, nekadar degisik tür kodlar, kütüphaneler kullanilirsa okadar cok isim cakismasi ola bilir. En büyük örnegi php 5.1.0 cikmasindan bir kac gün sonra php 5.1.1 cikmasiyle görüldü, bunun nedeni php 5.1.0 da yeni Date adinda bir sinif bulunmasiydi. Bircok Pear kullanicisi update den sonra Fatal Error [...]]]></description>
			<content:encoded><![CDATA[<p>Bir uygulama nekadar büyür, nekadar cok yazar o uygulamada calisirsa, nekadar degisik tür kodlar, kütüphaneler kullanilirsa okadar cok isim cakismasi ola bilir.<br />
En büyük örnegi php 5.1.0 cikmasindan bir kac gün sonra php 5.1.1 cikmasiyle görüldü, bunun nedeni php 5.1.0 da yeni <strong>Date</strong> adinda bir sinif bulunmasiydi.<br />
Bircok <strong>Pear</strong> kullanicisi update den sonra <em>Fatal Error</em> larla karsilasmisdi cünki Pear inde Date Sinifi vardi.<br />
Böyle bir cakismadan kacinmak icin simdiye kadar Zend Framework de oldugu gibi Uzun isimler kullanildi (<em>Zend_Controller_Action</em>).</p>
<p>Php 5.3 ile bu uzun isimlerdende kurtulmak mümkün.</p>
<p>php dünyasininen en uzun süre tartisilan seperator u kesinlikle namespace seperator oldu.<br />
Asil cif iki nokta üstüste (::) kullanilicakti ama  php dünyasinda cif anlamli olur diye sonunda <strong>(\) Backslah</strong> isaretinde karar kilindi.</p>
<p>Namespace kullana bilmek icin, php dosyasinda ilk ifade <strong>namespace <namespacename></namespacename></strong> olmasi gerekmektedir, aksi takdirde bir <em>fatal error</em> ile karsilasirsiniz.<br />
mesela:</p>
<pre class="brush: php; title: ; notranslate">
&lt; ?php
namespace Skorp;
echo &quot;skorp.eu&quot;;
</pre>
<p>Bir namespace bircok dosyayi kapsiya bilir. Dosyalarin her biri ayni namespace i beyan etmeleri gerekir. Asagidaki örnekde göründügü gibi, bir dosya icinde birden cok namespace bulunmasinada izin veriliyor.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
namespace Skorp
{

echo &quot;skorp.eu&quot;;
}

namespace Foo
{
echo &quot;foo.com&quot;;

}
</pre>
<p>Ama asagidaki örnege izin verilmiyor, en az bir namespace beyan edilmisse onun disinda herhangi bir kod olamaz.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
namespace Skorp
{

echo &quot;skorp.eu&quot;;
}

echo &quot;gohome&quot;;
</pre>
<p>alinan hata mesaji:<br />
Fatal error: No code may exist outside of namespace {} in </p>
<p>Bir örnek ile namespaceleri nasil kullanacagimizi bakalim.</p>
<pre class="brush: php; title: ; notranslate">
&lt; ?php
namespace Skorp
{
	class Test {}
}

namespace Foo
{
class Test{}
}

namespace Bar
{
	var_dump(new \Foo\Test());
}
</pre>
<p>Bar namespace i icinde Foo namespacindeki Test sinifini olusturuyoruz.</p>
<p>var_dump satirini su sekilde yazmis olsaydik:</p>
<pre class="brush: php; title: ; notranslate">
var_dump(new Foo\Test());
</pre>
<p>söyle bir hata ile karsilasicaktik.<br />
Fatal error: Class &#8216;Bar\Foo\Test&#8217; not found in</p>
<p>Bundan Adreslemeye dikkat etmemizi cikartiyoruz, normal bilgisyardaki Dosya Yapisi gibidir namespace de basta \ isareti yoksa kendi namespace icinde ara o sinifi.</p>
<p>Alias Mekanizmasi<br />
Herzaman \Foo\Test veya daha uzayan satirlar kullanmamak icin Alias mekanismasini kullana biliriz.</p>
<pre class="brush: php; title: ; notranslate">
namespace Bar
{
	use Foo\Test as anton;
	var_dump(new anton());
}
</pre>
<p>daha kisa yazmak icin</p>
<pre class="brush: php; title: ; notranslate">
namespace Bar
{
	use Foo\Test;
	var_dump(new Test());
}
</pre>
<p>Bu kisa yöntemde en son bilesen adi kullanilir alias olarak yani bizim örnegimizde Test</p>
<p>dikkat edilmesi gereken birsey daha var alias mekanizmasini kullanirken \ yazmamiza gerek yok, php burda sinif adinin tam yolunu bilmek istiyor.</p>
<p>Fonksiyonlarda bilinmesi gereken ise, onlara birer Alias veremiyoruz, ondan fonksiyonun tüm adini yazmak gerekiyor.<br />
yazilan fonksiyonlar ilk önce kullanilan Namespace icerisinde aranmaktadir, eger orada bulunmadiysa, global Namespace de aranir.</p>
<p>Mesela strlen adinda bir fonksiyonumuz varsa ama biz php nin bize sunmus oldugu strlen fonksiyonunu kullanmak istiyorsak ozaman basina bir \ koymamiz gerekiyor</p>
<pre class="brush: php; title: ; notranslate">
echo \strlen(&quot;blabla&quot;);
</pre>
<p>son olarakda hangi namespace de oldugumuzu görmek icin _NAMESPACE_ Konstansini cagara bilirsiniz.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2009/10/01/php-5-3-namespace-ler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CentOs de Php5.2.9&#8242;a  updateleme</title>
		<link>http://www.skorp.eu/2009/09/21/centos-de-php5-2-9-updateleme/</link>
		<comments>http://www.skorp.eu/2009/09/21/centos-de-php5-2-9-updateleme/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:51:09 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=368</guid>
		<description><![CDATA[Centos in kendi reploari php 5.1.6 ile geliyor. Bazi applikasyonlar mesela Oxid shop php 5.2 gerektiriyor bu yüzden Centos de nasil php yi güncelleriz bakalim: ile baka bilirz atomic repolara eklendimi diye. ardindan son olarak]]></description>
			<content:encoded><![CDATA[<p>Centos in kendi reploari php 5.1.6 ile geliyor.<br />
Bazi applikasyonlar mesela Oxid shop php 5.2 gerektiriyor bu yüzden Centos de nasil php yi güncelleriz bakalim:</p>
<pre class="brush: plain; title: ; notranslate">
wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
</pre>
<pre class="brush: plain; title: ; notranslate">yum repolist all</pre>
<p>ile baka bilirz atomic repolara eklendimi diye.</p>
<p>ardindan</p>
<pre class="brush: plain; title: ; notranslate">
yum update
</pre>
<p>son olarak</p>
<pre class="brush: plain; title: ; notranslate">
/etc/init.d/lighttpd  restart

apache kullananlar

/etc/init.d/httpd  restart
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2009/09/21/centos-de-php5-2-9-updateleme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php 5.3 Windows Destegi</title>
		<link>http://www.skorp.eu/2009/08/01/php-5-3-windows-destegi/</link>
		<comments>http://www.skorp.eu/2009/08/01/php-5-3-windows-destegi/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 12:05:15 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php 5.3]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=353</guid>
		<description><![CDATA[Bilindigi gibi Php dünyasinda Windows hep üvey kardes muamelesi görmüstür, bu Core gelistiricilerinin Unix sistemlerine odaklanmis olduklarindan kaynaklaniyordu. Performans olsun bazi fonksiyonlar olsun windows da unix de calistigi gibi calismiyordu. Son zamanlarda Microsoft &#8216;un da destegi ile cok emek sarf edilip, fonksiyonlarda, performansda ve stabilitede cok büyük adimlar atildi. Görüne bilinir en büyük adim ise [...]]]></description>
			<content:encoded><![CDATA[<p>Bilindigi gibi Php dünyasinda Windows hep üvey kardes muamelesi görmüstür, bu Core gelistiricilerinin Unix sistemlerine odaklanmis olduklarindan kaynaklaniyordu.<br />
Performans olsun bazi fonksiyonlar olsun windows da unix de calistigi gibi calismiyordu. Son zamanlarda Microsoft &#8216;un da destegi ile cok emek sarf edilip, fonksiyonlarda, performansda ve stabilitede cok büyük adimlar atildi.</p>
<p>Görüne bilinir en büyük adim ise Php 5.3 ile gelen ve eskiden Windows da calismayipda Programcilarin basini agartan birkac fonksiyon.<br />
Asagida fonksiyonlarin adlarini yaziyorum, daha genis bilgi icin lütfen <a href="http://php.net">php.net</a> sayfasini ziyaret ediniz:</p>
<p>Iste artik Windows dada calisan o fonksiyonlar:<br />
- checkdnsrr()<br />
- dns_get_record()<br />
- fnmatch()<br />
- getmxrr()<br />
- getopt()<br />
- imagecolorclosesthwb()<br />
- inet_pton()<br />
- inet_ntop()<br />
- link()<br />
- linkinfo()<br />
- mcrypt_create_iv()<br />
- readlink()<br />
- socket_create_pair()<br />
- stream_socket_pair()<br />
- symlink()<br />
- time_nanosleep()<br />
- time_sleep_until()</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2009/08/01/php-5-3-windows-destegi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Php 5.3 genisletilen fonksiyonlar</title>
		<link>http://www.skorp.eu/2009/07/28/php-5-3-genisletilen-fonksiyonlar/</link>
		<comments>http://www.skorp.eu/2009/07/28/php-5-3-genisletilen-fonksiyonlar/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 09:20:59 +0000</pubDate>
		<dc:creator>Skorp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php 5.3]]></category>

		<guid isPermaLink="false">http://www.skorp.eu/?p=348</guid>
		<description><![CDATA[Bugunki yazimizda sadece php 5.3 de hangi fonksiyonlarin genisletildigine bakacagiz. Php nin eski versiyonlarinda bulunan, php 5.3 ilede fonksiyon özellikleri genisletilen fonksiyonlar iste bunlar: - array_reduce() - clearstatcache() - copy() - fgetcsv() - getimagesize() - ini_get_all() - nl2br() - round() - stream_context_create() - strstr() fonksiyonlarin standart degerleri, calisan programlari etkilemiyecek sekilde hazirlanmistir. tam detayli bir [...]]]></description>
			<content:encoded><![CDATA[<p>Bugunki yazimizda sadece php 5.3 de hangi fonksiyonlarin genisletildigine bakacagiz.<br />
Php nin eski versiyonlarinda bulunan, php 5.3 ilede fonksiyon özellikleri genisletilen fonksiyonlar iste bunlar: </p>
<p>- array_reduce()<br />
- clearstatcache()<br />
- copy()<br />
- fgetcsv()<br />
- getimagesize()<br />
- ini_get_all()<br />
- nl2br()<br />
- round()<br />
- stream_context_create()<br />
- strstr()</p>
<p>fonksiyonlarin standart degerleri, calisan programlari etkilemiyecek sekilde hazirlanmistir.<br />
tam detayli bir bilgi icin php.net sayfasini ziyaret etmenizi tavsiye ediyorum.:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.skorp.eu/2009/07/28/php-5-3-genisletilen-fonksiyonlar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

