<?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>oneTarek</title>
	<atom:link href="http://onetarek.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://onetarek.com</link>
	<description>Md Jahidul Islam&#039;s Blog</description>
	<lastBuildDate>Sun, 19 May 2013 20:41:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to Publish a WordPress Post with a Future Date but Display Now</title>
		<link>http://onetarek.com/wordpress/publish-a-wordpress-post-with-a-future-date/</link>
		<comments>http://onetarek.com/wordpress/publish-a-wordpress-post-with-a-future-date/#comments</comments>
		<pubDate>Sat, 20 Apr 2013 20:43:29 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[WordPress Future Posts]]></category>
		<category><![CDATA[WordPress Scheduled Posts]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=440</guid>
		<description><![CDATA[A very easy way to publish your WordPress post just right now but post date will be a future time. Display future scheduled post to visitors. Here I will show you a very simple trick to do this. Just copy my simple PHP code snippet into your theme functions.php]]></description>
				<content:encoded><![CDATA[<p>You may want to publish your WordPress post just right now but post date will be a future time. By default WordPress doesn&#8217;t have such option. Here I will show you a very simple trick to do this.<span id="more-440"></span><br />
<img class="aligncenter size-full wp-image-446" alt="WordPress Clock" src="http://onetarek.com/wp-content/uploads/2013/04/wp-clock.jpg" width="500" height="500" /><br />
<strong>WordPress</strong> has an option to publish any post in a <strong>future date/time</strong>. It is called future-post/Scheduled-post. You can set future date/time for a post from the post edit panel just above the publish button. After setting up the <strong>post date</strong> with a future time the publish button will be changed into Schedule button. You may finish your posting by clicking on Schedule button. Your post will be saved for future publishing, post_type field will be set by &#8216;<strong>future</strong>&#8216; instead of &#8216;<strong>publish</strong>&#8216; . And it will not be displayed to visitors on your site fornt-end. WordPress displays which posts those have post_type=&#8217;publish&#8217;. You may manage your scheduled posts from dashboard by using my plugin &#8220;<strong><a title="WordPress Scheduled Posts Management Plugin" href="http://onetarek.com/my-wordpress-plugins/wp-scheduled-posts/">WP Scheduled Posts</a></strong>&#8220;. When your given future date will come then post will be published automatically and appeared to all. <strong>But if you want you publish your post immediately right now and post date will set as a future date, what to do then? </strong> WordPress doesn&#8217;t have any default solution for this situation. But WordPress is very flexible and customizable CMS, It gives us a lot of filter and action hooks to fire our custom function on any point of the script. I made a very simple <strong>PHP codes</strong> to have this feature with an WordPress blog. Put my following codes in your theme<strong> functions.php</strong>. I have updated my plugin &#8220;<strong><a title="WordPress Scheduled Posts Management Plugin" href="http://onetarek.com/my-wordpress-plugins/wp-scheduled-posts/">WP Scheduled Posts</a></strong>&#8221; by including this feature. You can use that plugin instead of editing functions.php.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
function onetarek_prevent_future_type( $post_data ) {
if ( $post_data['post_status'] == 'future' &amp;&amp; $post_data['post_type'] == 'post' )#Here I am checking post_type='post' , you may use different post type and if you want it for all post type then remove &quot;&amp;&amp; $post_data['post_type'] == 'post'&quot;
{
$post_data['post_status'] = 'publish';
}
return $post_data;
}
add_filter('wp_insert_post_data', 'onetarek_prevent_future_type');
remove_action('future_post', '_future_post_hook');
?&gt;</pre>
<p>These codes prevents to create post_type=&#8217;future&#8217; and publish the post immediately though the post date set for a future time. WordPress will not to thing about post date on publishing. It force WordPress to publish the post with future timestamps.</p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/publish-a-wordpress-post-with-a-future-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add  Extra Meta Field to WordPress User Profile by Plugin</title>
		<link>http://onetarek.com/wordpress/how-to-add-extra-meta-field-for-user-profile-in-wordpress-plugin/</link>
		<comments>http://onetarek.com/wordpress/how-to-add-extra-meta-field-for-user-profile-in-wordpress-plugin/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 19:02:26 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WordPress Demo Plugin]]></category>
		<category><![CDATA[WordPress User Meta]]></category>
		<category><![CDATA[WordPress User Profile]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=370</guid>
		<description><![CDATA[A guide to add extra custom meta field with WordPress user profile. A complete code snippet  and a sample demo plugin for plugin developer to learn and  implement custom user meta in their own plugin.]]></description>
				<content:encoded><![CDATA[<p>When you are creating a <strong>WordPress plugin</strong> to play with users&#8217; <strong>profile meta data</strong>, you may need to use some different meta data those are not exists in user profile page. So you must want to have new <strong>custom meta field</strong> with user profile. Sometimes we call it user custom field. How to do add this custom field? Here I will show you the complete code snippet and a simple demo plugin.<span id="more-370"></span><br />
<img class="aligncenter size-full wp-image-374" alt="WordPress User" src="http://onetarek.com/wp-content/uploads/2013/03/wordpress-user.jpg" width="500" height="300" /></p>
<p>Suppose you want to add an <strong>extra custom field</strong> to store user&#8217;s twitter account username. By default this field is not exists in profile page ( As WordPress version 3.5.1). Add following code snippet in your plugin file or in theme functions.php. It will show an extra input field in user profile edit page. It will add a new meta key and value in the<strong> WordPress user meta</strong> table <strong>wp_usermeta</strong> in database. This new key will be loaded with user object.</p>
<pre class="brush: php; title: ; notranslate">

add_action( 'show_user_profile', 'oneTarek_extra_user_profile_fields' );
add_action( 'edit_user_profile', 'oneTarek_extra_user_profile_fields' );
add_action( 'personal_options_update', 'oneTarek_save_extra_user_profile_fields' );
add_action( 'edit_user_profile_update', 'oneTarek_save_extra_user_profile_fields' );

function oneTarek_save_extra_user_profile_fields( $user_id )
 {
 if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }
 update_user_meta( $user_id, 'oneTarek_twitter', $_POST['oneTarek_twitter'] );
 }
#Developed By oneTarek , http://oneTarek.com
function oneTarek_extra_user_profile_fields( $user )
 { ?&gt;
 &lt;h3&gt;Extra Custom Meta Fields&lt;/h3&gt;

 &lt;table class=&quot;form-table&quot;&gt;
 &lt;tr&gt;
 &lt;th&gt;&lt;label for=&quot;oneTarek_twitter&quot;&gt;Twitter User Name&lt;/label&gt;&lt;/th&gt;
 &lt;td&gt;
 &lt;input type=&quot;text&quot; id=&quot;oneTarek_twitter&quot; name=&quot;oneTarek_twitter&quot; size=&quot;20&quot; value=&quot;&lt;?php echo esc_attr( get_the_author_meta( 'oneTarek_twitter', $user-&gt;ID )); ?&gt;&quot;&gt;
 &lt;span class=&quot;description&quot;&gt;Please enter your Twitter Account User name, eg: oneTarek&lt;/span&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/table&gt;
&lt;?php }?&gt;

</pre>
<p>I made a demo plugin with above codes. User my demo plugin to be clear about above codes.<br />
<a style="font-size: 24px;" href="http://onetarek.com/wp-content/uploads/2013/03/oneTarek-add-custom-user-meta.zip">Download My Demo Plugin to Add User Custom Field</a></p>
<div style="font-size: 16; font-weight: bold; margin-top: 20px;">As a WordPress Plugin Developer You Should Know Following Topics:</div>
<ul>
<li><a title="WordPress TinyMCE Editor Guide" href="http://onetarek.com/wordpress/tutorial-how-to-use-tinymce-wyswig-editor-in-wordpress-plugin-theme-admin-page/">Using TinyMCE WYSIWYG Editor in WordPress Plugin</a></li>
<li><a title="WordPress Media Uploader" href="http://onetarek.com/wordpress/how-to-use-wordpress-media-uploader-in-plugin-or-theme-admin-page/">WordPress Media Uploader in Plugin</a></li>
</ul>
<div style="font-weight: bold;">This codes snippets may be the answer of your following questions</div>
<ul>
<li>Add Custom field with wordpress user profile</li>
<li>Add user custom field in pluign</li>
<li>WordPress plugin to add extra meta fields for users</li>
<li>How to user user custom fields</li>
<li>Custom meta data for wordpress user</li>
<li>How can I add new custom meta field for user profile</li>
<li>Plugin tutorial to add user meta fields</li>
<li>Create a new usermeta field for users</li>
<li>Add Custom User Meta Fields</li>
<li>How to Save Different Usermeta Fields</li>
<li>Customize backend user profile</li>
<li>Custom user registration by user meta</li>
<li>Adding Custom Fields to WordPress User Profil</li>
<li>Adding new meta key to wp_usermeta table in database</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/how-to-add-extra-meta-field-for-user-profile-in-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Point WordPress Default Media Upload Directory to New Location</title>
		<link>http://onetarek.com/wordpress/how-to-point-wordpress-default-media-upload-directory-to-new-location/</link>
		<comments>http://onetarek.com/wordpress/how-to-point-wordpress-default-media-upload-directory-to-new-location/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 06:55:52 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[WordPress Media Library]]></category>
		<category><![CDATA[WordPress Media Uploader]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=335</guid>
		<description><![CDATA[Change your WordPress default media upload directory to new location. Store your media files in new location instead of wp-content/uploads . WordPress Media Library will access media files form your new directory. Here I am showing your how to do that. ]]></description>
				<content:encoded><![CDATA[<p><strong>WordPress</strong> stores your media files like image, video, audio, flash etc in a default location in the wp-content/uploads directory. The default<strong> media upload directory</strong> is <strong>wp-content/uploads/</strong>  . But if you don&#8217;t want to use this directory, you want to store your media files in another location. WordPress has an option to change this default media uploads location. Its very easy way but if you are very new to WordPress you may think it difficult. So what to do for this?<span id="more-335"></span><br />
If you want to store your files in wp-content/my-media-files instead of wp-content/uploads then follow my instructions. </p>
<p>Go to your root directory where you installed your WordPress scripts.<br />
Open wp-config.php<br />
Add following line at end of the wp-config.php file. </p>
<pre class="brush: php; title: ; notranslate"> define( 'UPLOADS', 'wp-content/'.'my-media-files' );</pre>
<p>If you don&#8217;t want to use wp-content and you want to store yours files outside of wp-contnet like http://www.example.com/my-media-files/ then use following line instead. </p>
<pre class="brush: php; title: ; notranslate"> define( 'UPLOADS', ''.'my-media-files' );</pre>
<div style="margin-top:40px;">After reading this post probably you got answer of following questions:</div>
<ul>
<li>How I Changed My WordPress Image Upload Folder?</li>
<li>Changing The WordPress Upload Path?</li>
<li>Change file upload folders on WordPress?</li>
<li>How to change default image uploads folder in WordPress?</li>
<li>How to change WordPress file upload directory?</li>
<li>How to Change WordPress Media Directories?</li>
</ul>
<p>
Your may like: <a href="http://onetarek.com/wordpress/how-to-use-wordpress-media-uploader-in-plugin-or-theme-admin-page/" title="WordPress Media Uploader in Plugin Page"><strong>How to use WordPress Media Uploader in Plugin or Theme Admin page</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/how-to-point-wordpress-default-media-upload-directory-to-new-location/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Problem to Pass External Domain as URL Query String Parameter Value</title>
		<link>http://onetarek.com/wordpress/wordpress-and-url-query-parameter-with-external-domain-problem/</link>
		<comments>http://onetarek.com/wordpress/wordpress-and-url-query-parameter-with-external-domain-problem/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 19:57:10 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Cross Domain]]></category>
		<category><![CDATA[Query String]]></category>
		<category><![CDATA[WordPress Problem]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=300</guid>
		<description><![CDATA[Today I have discovered a strange problem of WordPress / Apache. WordPress / Apache is unable to handle an URL with a query string parameter containing a link of external domain (Cross Domain). It shows not found page. I am trying call a static story.html file from my upload directory. I have to pass some [...]]]></description>
				<content:encoded><![CDATA[<p>Today I have discovered a strange problem of WordPress / Apache.  <strong>WordPress / Apache is unable to handle an URL with a query string parameter containing a link of external domain (Cross Domain)</strong>. It shows not found page. I am trying call a static story.html file from my upload directory. I have to pass some <strong>query string</strong> with <strong>URL</strong> of my story.html file. But when I am trying to pass some query parameter in the URL then I am going to a not found page.<span id="more-300"></span> I tried to figure out the main issue point. I tired in many ways by changing the <strong>parameter values</strong>.  At last I discovered that the<strong> problem</strong> is occurred when one of my parameter value contains a url of cross domain. This problem is occurred though my external URL is url-encoded. But when I use same domain url as a parameter value then no problem. What is my need? My story.html file has some javaScript codes to handle a API request from an external domain. So I have to pass the external API URL as a query parameter. I tested my experiment with an image file also. Same result. Test following URLs one by one</p>
<ol>
<li><span style="line-height: 1.714285714; font-size: 1rem;">http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg</span></li>
<li><span style="line-height: 1.714285714; font-size: 1rem;">http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=sometext</span></li>
<li><span style="line-height: 1.714285714; font-size: 1rem;">http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=http%3A%2F%2Fonetarek.com</span></li>
<li><span style="line-height: 1.714285714; font-size: 1rem;">http://onetarek.com/wp-content/uploads/2012/11/wptinymce.jpg?myvar=http%3A%2F%2Fgoogle.com</span></li>
</ol>
<blockquote><p>My Problem has been solved, So you will not see any problem for above example urls. Test this URL style for your own website</p></blockquote>
<p>First 3 URLs are showing the image file but 4<sup>th</sup> URL is showing<strong> not found page</strong> by <strong>WordPress</strong>. I tested this process in another non WordPress site, but there is no problem. I think this problem is happening only in <strong>WordPress</strong> website. I am trying to find out the main technical cause of this issue. I will update this post when I will find any solution. Please a write a comment if you know any solution.</p>
<p><em><strong>WordPress and URL Query Parameter with External Domain Problem</strong></em><br />
<em><strong>Apache returns 404 for cross domain link in query string</strong></em></p>
<h3>Experiment and Discussions:</h3>
<p>I wrote this problem on WordPress Support Forum. <a title="Discussion on WordPress Support Forum" href="http://wordpress.org/support/topic/wordpress-shows-not-found-page-for-a-query-string-with-external-domain?replies=0#post-3921739">Read and join to my discussion thread</a>.</p>
<p>I have tested with 7 different domains those are hosted in HostGator server.  2 of theme are non wp site and 5 are wordpress site.<br />
1 wp and 1 non wp  sites work fine. Other 5 sites returns not found. Here I am trying to prove that <strong>HostGator</strong> is an issue here.</p>
<p>My more experimental links are <a href="http://wordpress.org/support/topic/wordpress-shows-not-found-page-for-a-query-string-with-external-domain?replies=2#post-3923233" title="Experimental Links" target="_blank">here</a></p>
<p><a href="http://serverfault.com/questions/484910/why-apache-return-404-if-query-string-contains-a-link-of-cross-domain" target="_blank">Discussions in ServerFault.com</a></p>
<h2>Solution</h2>
<p>I got the solution.<br />
I asked to HostGator support. They told me that They run <strong>mod_security</strong> which is the cause of the problem. They ran a command to whitelist a <strong>mod_sec</strong> rule my site was hitting. You have to know detail about <strong>mod_security</strong>. If you have root control on the server, you could change it in php.ini</p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/wordpress-and-url-query-parameter-with-external-domain-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript: How to Get Query String Parameter Value from Current Page URL</title>
		<link>http://onetarek.com/javascript-and-jquery/javascript-how-to-get-query-string-parameter-value-from-current-page-url/</link>
		<comments>http://onetarek.com/javascript-and-jquery/javascript-how-to-get-query-string-parameter-value-from-current-page-url/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 19:31:59 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[JavaScript and jQuery]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Query String]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=287</guid>
		<description><![CDATA[Using raw JavaScript retrieve query string value based on parameter name. A simple custom JavaScript function returns the value of given parameter name from current page location.  ]]></description>
				<content:encoded><![CDATA[<p>You can retrieve any <strong>query string value</strong> based on <strong>parameter</strong> name from the url of current page. Following JavaScript function returns the value for given parameter name. These are raw JavaScript codes, so you don&#8217;t need to use jQuery.<span id="more-287"></span><br />
<strong>Method 1 :</strong></p>
<pre class="brush: jscript; title: ; notranslate">
function getParameterByName(name)
{
  name = name.replace(/[\[]/, &quot;\\\[&quot;).replace(/[\]]/, &quot;\\\]&quot;);
  var regexString = &quot;[\\?&amp;]&quot; + name + &quot;=([^&amp;#]*)&quot;;
  var regex = new RegExp(regexString);
  var found = regex.exec(window.location.search);
  if(found == null)
    return &quot;&quot;;
  else
    return decodeURIComponent(found[1].replace(/\+/g, &quot; &quot;));
}
</pre>
<p>Your url parameters may be url-encoded and you want to get decoded value, this function return decoded value. There are an alternative way to write this function. Following function do the same work like above function. You may use following codes instead.</p>
<p><strong>Method 2 :</strong></p>
<pre class="brush: jscript; title: ; notranslate">

function getParameterByName(name) {
 return decodeURIComponent((new RegExp('[?|&amp;]' + name + '=' + '([^&amp;;]+?)(&amp;|#|;|$)').exec(location.search)||[,&quot;&quot;])[1].replace(/\+/g, '%20'))||null;
}

</pre>
<p>When your given parameter name is not exists in the url then this function returns <strong>null </strong>instead of <strong>&#8216;null&#8217;</strong>.</p>
<h3>Using jQuery</h3>
<p> I found two <strong>jQuery plugins</strong> to get url parameter value </p>
<ul>
<li><a href="http://plugins.jquery.com/project/query-object" target="_blank">query-object</a></li>
<li><a href="http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2/ target="_blank"">getURLParam</a></li>
</ul>
<p>To learn more critical points to play with URL query string parameters you may go to following discussion pages.<br />
<a title="JavaScript Reference" href="http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values" target="_blank">Reference 1</a> , <a title="JavaScript Reference" href="http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery" target="_blank">Reference 2</a></p>
<h3>This function returns the answer of following queries</h3>
<ul>
<li><strong> JavaScript to read a URL query string</strong></li>
<li><strong> Getting Query String Parameters with JavaScript</strong></li>
<li><strong> Javascript to get Query String from URL in raw JavaScript</strong></li>
<li><strong> Get URL and URL Parts in JavaScript</strong></li>
<li><strong> Get Current Page QueryString Using JavaScript</strong></li>
<li><strong> JavaScript Function to Get URL Query Values</strong></li>
<li><strong> Raw JavaScript and URL parameters</strong></li>
<li><strong>JavaScript to Read GET variables from URL </strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/javascript-and-jquery/javascript-how-to-get-query-string-parameter-value-from-current-page-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slim : a PHP micro framework</title>
		<link>http://onetarek.com/framework/slim-a-php-micro-framework/</link>
		<comments>http://onetarek.com/framework/slim-a-php-micro-framework/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 20:00:48 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[Framework]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=259</guid>
		<description><![CDATA[Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. Download Slim FEATURES Powerful router Standard and custom HTTP methods Route parameters with wildcards and conditions Route redirect, halt, and pass Route middleware Template rendering with custom views Flash messages Secure cookies with AES-256 encryption HTTP caching Logging with [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.slimframework.com/" target="_blank">Slim </a>is a <strong>PHP micro framework</strong> that helps you quickly write simple yet powerful web applications and APIs.</p>
<p><a title="Download" href="http://www.slimframework.com/install" target="_blank">Download Slim</a></p>
<h2><small>FEATURES</small></h2>
<ul>
<li>Powerful router
<ul>
<li>Standard and custom HTTP methods</li>
<li>Route parameters with wildcards and conditions</li>
<li>Route redirect, halt, and pass</li>
<li>Route middleware</li>
</ul>
</li>
<li>Template rendering with custom views</li>
<li>Flash messages</li>
<li>Secure cookies with AES-256 encryption</li>
<li>HTTP caching</li>
<li>Logging with custom log writers</li>
<li>Error handling and debugging</li>
<li>Middleware and hook architecture</li>
<li>Simple configuration</li>
</ul>
<h2><small>SYSTEM REQUIREMENTS</small></h2>
<p>PHP 5.3.0 or newer</p>
<p><a href="http://docs.slimframework.com/" target="_blank">SLIM DOCUMENTAION</a></p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/framework/slim-a-php-micro-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guide:PHP Simple Learning Record Store (LRS) With Tin Can API</title>
		<link>http://onetarek.com/tin-can-api/guidephp-simple-lrs-with-tin-can-api/</link>
		<comments>http://onetarek.com/tin-can-api/guidephp-simple-lrs-with-tin-can-api/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 19:48:51 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[Tin Can API]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=255</guid>
		<description><![CDATA[Script for Self hosted Learning Record Store Supporting Tin Can API This guide was originally posted at http://www.tincanapi.co.uk/wiki/Guide:PHP_Simple_LRS . Due to an error this site is not accessible now. I collected this guide form a google cached data. I post this content here just for my personal purpose. Now the main author posted his codes on gitHub Project [...]]]></description>
				<content:encoded><![CDATA[<h2>Script for Self hosted <span style="color: #ff6600;">Learning Record Store</span> Supporting Tin Can API</h2>
<blockquote><p>This guide was originally posted at <strong>http://www.tincanapi.co.uk/wiki/Guide:PHP_Simple_LRS</strong> . Due to an error this site is not accessible now. I collected this guide form a google cached data. I post this content here just for my personal purpose. Now the main author posted his codes on <a href="https://github.com/garemoko/PHPCan/blob/master/LRS/index.php" target="_blank">gitHub</a> Project <a href="https://github.com/garemoko/PHPCan" target="_blank">PHPCan </a></p></blockquote>
<p><span id="more-255"></span><br />
<a href="http://onetarek.com/wp-content/uploads/2013/02/tincanapi-logo.png"><img class="aligncenter size-full wp-image-274" alt="Tin Can API Logo" src="http://onetarek.com/wp-content/uploads/2013/02/tincanapi-logo.png" width="205" height="109" /></a></p>
<h2>current product status</h2>
<p>The LRS is receiving statements via POST (and PUT &#8211; untested), generating a statement ID and stored time-stamp and storing these with the raw statement in a 3 field database.</p>
<h3>Next Steps</h3>
<ul>
<li>json decode statement to add statement ID and stored fields if they are not present, then re-encode to store.</li>
<li>Ensure no duplicate statement IDs and return appropriate http headers in event of conflict</li>
<li>test PUT</li>
<li>Implement GET for statements (single and all)</li>
<li>State</li>
<li>Actor and Activity profiles</li>
<li>dot Ts and cross Is of compliance with spec</li>
</ul>
<h2>notes for guide and code</h2>
<h3>Notes</h3>
<p><a href="http://www.slimframework.com/" rel="nofollow">http://www.slimframework.com/</a></p>
<h3>SQL</h3>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE lrs_statements
(
statementID VARCHAR(255) NOT NULL COLLATE utf8_general_ci,
statement TEXT NOT NULL COLLATE utf8_general_ci,
stored TIMESTAMP NOT NULL,
PRIMARY KEY (statementID)
)
</pre>
<h3>PHP code</h3>
<pre class="brush: php; title: ; notranslate">
&lt;!--?php require 'Slim/Slim.php';   $app = new Slim(); //POST route $app---&gt;post('/public', 'lrsPost');

//PUT route
$app-&gt;put('/public/:id', 'lrsPut');

$app-&gt;run();

function lrsPost(){
$DBConnectionArray = returnDBConnectionArray();

    $inputStatement= file_get_contents(&quot;php://input&quot;);

//decode the JSON as an associative array.
$statementObj = json_decode($inputStatement, TRUE);

//Stored
$dateNow = new DateTime();
$stored = $dateNow-&gt;format('Y-m-d H:i:s');
$statementObj[0]['stored'] = $stored;

//Add a statement ID if it doesn't already exist or if it's NULL. If it does exist, use the existing one.
$statementID;
if (isset($statementObj[0]['id']))
{
$statementID = $statementObj[0]['id'];
}
else
{
$statementID = make_uuid();
$statementObj[0]['id'] = $statementID;
}

//re-encode the statement
$statement = json_encode($statementObj);

$query = &quot;INSERT INTO lrs_statements VALUES ('&quot;.$statementID.&quot;','&quot;.$statement.&quot;','&quot;.$stored.&quot;')&quot;;

mysql_connect($DBConnectionArray[&quot;DBserver&quot;],$DBConnectionArray[&quot;DBuser&quot;], $DBConnectionArray[&quot;DBpassword&quot;] );

mysql_select_db($DBConnectionArray[&quot;DBname&quot;]) or die( &quot;Unable to select database&quot;);

mysql_query($query);

mysql_close();
}

function lrsPut(){
$DBConnectionArray = returnDBConnectionArray();

    $statement= file_get_contents(&quot;php://input&quot;);
$date = new DateTime();

$query = &quot;INSERT INTO lrs_statements VALUES ('&quot;.make_uuid().&quot;','&quot;.$statement.&quot;','&quot;.$date-&gt;format('Y-m-d H:i:s').&quot;')&quot;;

mysql_connect($DBConnectionArray[&quot;DBserver&quot;],$DBConnectionArray[&quot;DBuser&quot;], $DBConnectionArray[&quot;DBpassword&quot;] );

mysql_select_db($DBConnectionArray[&quot;DBname&quot;]) or die( &quot;Unable to select database&quot;);

mysql_query($query);

mysql_close();
}

function make_uuid() {

    return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
        // 32 bits for &quot;time_low&quot;
        mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),

        // 16 bits for &quot;time_mid&quot;
        mt_rand( 0, 0xffff ),

        // 16 bits for &quot;time_hi_and_version&quot;,
        // four most significant bits holds version number 4
        mt_rand( 0, 0x0fff ) | 0x4000,

        // 16 bits, 8 bits for &quot;clk_seq_hi_res&quot;,
        // 8 bits for &quot;clk_seq_low&quot;,
        // two most significant bits holds zero and one for variant DCE1.1
        mt_rand( 0, 0x3fff ) | 0x8000,

        // 48 bits for &quot;node&quot;
        mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
    );
}

function returnDBConnectionArray()
{
$array = array(
    &quot;DBtype&quot; =&gt; &quot;mysql&quot;,
&quot;DBserver&quot; =&gt; &quot;cust-mysql-123-05&quot;,
&quot;DBname&quot; =&gt; &quot;tincanapicouk_715945_db1&quot;,
&quot;DBuser&quot; =&gt; &quot;utincan_715945_1&quot;,
&quot;DBpassword&quot; =&gt; &quot;Taztaz1&quot;,
);
return $array;
}

?&gt;
</pre>
<h3>.htaccess</h3>
<pre class="brush: plain; title: ; notranslate">
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/LRS/
RewriteRule ^/?LRS(/.*)?$ %{DOCUMENT_ROOT}/LRS/index.php [QSA,L]
</pre>
<h3>This Post May Be The Answer of Following Queries:</h3>
<ul>
<li><b>A Basic LRS for TinCanAPI</b></li>
<li><b>Self Hosted LRS example</b></li>
<li><b>Self hosted Learning Record Store Script</b></li>
<li><b>Simple LRS example with PHP</b></li>
<li><b>Build your own Learning Record Store (LRS)</b></li>
<li><b>PHP Mysql basic starter script for LRS</b></li>
<li><b>Tutorial to build TinCanAPI LRS</b></li>
<li><b>TinCanAPI Learning Record Store Script</b></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/tin-can-api/guidephp-simple-lrs-with-tin-can-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Track Who is Trying to Login into Your WordPress Admin Panel</title>
		<link>http://onetarek.com/wordpress/security/track-who-is-trying-to-login-into-your-wordpress-admin-panel/</link>
		<comments>http://onetarek.com/wordpress/security/track-who-is-trying-to-login-into-your-wordpress-admin-panel/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 16:32:18 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[Track]]></category>
		<category><![CDATA[WordPress Logs]]></category>
		<category><![CDATA[WP Logs Book]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=248</guid>
		<description><![CDATA[You may think your website is very new and not much popular. So none can try to hack your WordPress. If you think so then I will tell you are wrong. Form my real experience I know some bad guys are always trying to hack any website. It is a hobby of theme. And some [...]]]></description>
				<content:encoded><![CDATA[<p>You may think your website is very new and not much popular. So none can try to hack your <strong>WordPress</strong>. If you think so then I will tell you are wrong. Form my real experience I know some bad guys are always trying to hack any website. It is a hobby of theme. And some people may hack an website for his benefit. WordPress is an popular and open source CMS. Everybody know the internal codes of an WP site. And it is a nice playground to hacker. Your site is not risk free. Hackers are always trying to hack your site.<span id="more-248"></span> It is no matter that your site is popular or not. Your site is always getting attack on behalf you. So to keep your website secure you must have to know the stat of attack. So now your are thinking how do you know your site is getting hacking attempts. No worry. There is an very handy and useful <strong>WordPress plugin</strong> to help you. The plugin is <strong>WP Logs Book</strong>. I made this plugin and I am using this plugin. This plugin keep track of all failed login information. It keeps usernames and passwords those are used by hacker. It also keeps hackers IP, time and browser information. Use <strong>WP Logs Book</strong> and wait only one day. You will see an eye catching result. It will break your previous thought. You will discover new security experience about your wordpress website. <a title="WP Logs Book" href="http://onetarek.com/my-wordpress-plugins/wp-logs-book/"><strong>Download and read detail about WP Logs Book Plugin</strong></a>.<br />
<em>If you get result then don&#8217;t forget to share this message and must tell me your feelings by leaving a comments.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/security/track-who-is-trying-to-login-into-your-wordpress-admin-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Add or Remove a Class Using Raw JavaScript and jQuery</title>
		<link>http://onetarek.com/javascript-and-jquery/how-to-add-or-remove-a-class-using-raw-javascript-and-jquery/</link>
		<comments>http://onetarek.com/javascript-and-jquery/how-to-add-or-remove-a-class-using-raw-javascript-and-jquery/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 15:15:28 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[JavaScript and jQuery]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=240</guid>
		<description><![CDATA[If you want to dynamically set or remove a CSS class name for a HTML element, then you need to do some javaScript works. We can do this by using raw javaScript. jQuery is also a popular javaScript library. You can use jQuery also. Here I am showing you the both way to add/remove class. [...]]]></description>
				<content:encoded><![CDATA[<p>If you want to dynamically set or remove a <strong>CSS</strong> class name for a <strong>HTML</strong> element, then you need to do some <strong>javaScript</strong> works. We can do this by using raw javaScript. jQuery is also a popular <strong>javaScript</strong> library. You can use <strong>jQuery</strong> also. Here I am showing you the both way to add/remove class.<span id="more-240"></span></p>
<h2>Using Raw JavaScript:</h2>
<p><strong>Removing a class</strong></p>
<pre class="brush: jscript; title: ; notranslate">
 var id='myElementId';
 var myClassName=&quot; className&quot;; //must keep a space before class name
 var d;
 d=document.getElementById(id);
 d.className=d.className.replace(myClassName,&quot;&quot;);
</pre>
<p><strong>Adding a class</strong></p>
<pre class="brush: jscript; title: ; notranslate">

var id='myElementId';
var myClassName=&quot; className&quot;; //must keep a space before class name
var d;
d=document.getElementById(id);
d.className=d.className.replace(myClassName,&quot;&quot;); // first remove the class name if that already exists
d.className = d.className + myClassName; // adding new class name
</pre>
<h2>Using jQuery:</h2>
<p><strong>Adding a class</strong></p>
<pre class="brush: jscript; title: ; notranslate">
jQuery(&quot;#myElementId&quot;).addClass('className');
</pre>
<p><strong>Removing a class</strong></p>
<pre class="brush: jscript; title: ; notranslate">
jQuery(&quot;#myElementId&quot;).removeClass('className');
</pre>
<p><strong>Remove one class and add another new class at once</strong></p>
<pre class="brush: jscript; title: ; notranslate">
jQuery(&quot;#myElementId&quot;).removeClass('className').addClass('newClass');
</pre>
<p><strong>Remove one more class at once</strong></p>
<pre class="brush: jscript; title: ; notranslate">
jQuery(&quot;#myElementId&quot;).removeClass('className1 className2');
</pre>
<p><em><br />
If you think this codes are helpful to you then don&#8217;t forget to share this to others.</em></p>
<hr />
<strong>These codes may be the answer of following queries</strong></p>
<ul>
<li>Javascript function to Add a Class</li>
<li>Using Javascript to add CSS class</li>
<li>Javascript function to remove a class</li>
<li>Remove a CSs class by javaScript</li>
<li>JS code snippet to add/remove class</li>
<li>jQuery function to add/remove any CSS class</li>
<li>jQuery addClass function</li>
<li>JQuery removeClass function</li>
<li>Dinamically change style of an HTML element</li>
<li>Change HTML Class attributes</li>
<li>javascript add class to element</li>
<li>javascript remove class</li>
<li>Add/Remove Class with jquery function </li>
<li>Adding a class to a .click function</li>
<li>Add Remove CSS Class Using Fresh JavaScript Without jQuery</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/javascript-and-jquery/how-to-add-or-remove-a-class-using-raw-javascript-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Mistake is Harmful for Your WordPress and it Increases Multiple Times Server Usages</title>
		<link>http://onetarek.com/wordpress/css-mistake-is-harmful-for-your-wordpress/</link>
		<comments>http://onetarek.com/wordpress/css-mistake-is-harmful-for-your-wordpress/#comments</comments>
		<pubDate>Sun, 30 Dec 2012 07:15:00 +0000</pubDate>
		<dc:creator>oneTarek</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Error 404]]></category>
		<category><![CDATA[Mistake]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance Monitoring]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[WordPress Plugin]]></category>
		<category><![CDATA[WP Logs Book]]></category>

		<guid isPermaLink="false">http://onetarek.com/?p=176</guid>
		<description><![CDATA[A simple mistake of CSS style codes may increase your WordPress server usages and server may goes to slower down. In this article I will show you how a bad or old CSS code is harmful for your server.]]></description>
				<content:encoded><![CDATA[<blockquote>
<p style="text-align: justify;">Do you know your <strong>WordPress</strong> site is being loaded multiple times for a single page visit? I am sure you don&#8217;t know. It is happening behind your eyes. A simple mistake of CSS style codes may increase your WordPress server usages and server may goes to slower down. In this article I will show you how a bad or old <strong>CSS</strong> code is harmful for your server.</p>
</blockquote>
<p><span id="more-176"></span></p>
<p style="text-align: justify;"><img class="aligncenter size-full wp-image-188" alt="css-image-404" src="http://onetarek.com/wp-content/uploads/2012/12/css-image-404.jpg" width="480" height="314" /></p>
<p style="text-align: justify;">You must know how <strong>WordPress</strong> handle not found file request. WordPress .htaccess handle all requests. At first it check the requested URL is a file/folder and is that exists or not. If the requested file/folder exists then <strong>server</strong> return the file/folder otherwise the server pass the request through WordPress script. Then WordPress generates a error page and return 404 HTTP Status code. To generate a 404 page WordPress loads its whole script, plugins and theme files. It means your server uses full resource to handle this 404 request.</p>
<p style="text-align: justify;">Now I will explain the issue with <strong>mistake of CSS</strong>. You believe that a file size of a CSS is too smaller than your whole page size with HTML,JS and images. Your CSS file is few kilobytes in size. You also believe that CSS is used when HTML script calls it by class or ID and if any class or id are not called by HTML then this code is useless. Your browser read your full CSS file and try to load all resources called in CSS. We don&#8217;t delete unused CSS code form CSS file, we keep those for later usage. And a common mistake is we keep unused CSS codes in file but we delete unused images from images directory. It is the main problem. When you call web page , browser load the css file and load all images declared in this file. If any image is not exists server returns 404 error. Consider following mistake in my case. I was using some background images in my wordpress blog. For that backgrounds I had some style codes in style.css file. I decided to remove backgrounds. I deleted those images from images folder as I don&#8217;t want to using those but I did not remove the css codes from style.css</p>
<pre class="brush: css; title: ; notranslate">
body{background:url(images/bg.png) #99CC33; }
 .loop_item{background:url(images/item_border.png) no-repeat #CCCCCC;}
 .title{background:url(images/titlebg.gif) repeat-x #eeeeee};
 #footer{background:url(images/footer.jpg) repeat-x #cccccc};
</pre>
<p style="text-align: justify;">Above CSS codes load 4 images ( bg.png, item_border.png, titlebg.gif, footer.jpg).</p>
<p style="text-align: justify;">For this reason for single page visit my WordPress is generating 4 not found 404 page using full resource of my server. It means my mistake increase my unwanted server cost 4 times. I tested many WordPress themes those have this same issue. Theme developers may do this mistake but as an webmaster you have to find out it. You have to be sure that in your CSS file there is no not found image.</p>
<p style="text-align: justify;"><strong>I AM SURE YOU MUST HAVE THIS PROBLEM BEHIND YOUR EYES.</strong></p>
<p style="text-align: justify;"><strong>How can you check you are free or not free from this issue?</strong></p>
<p style="text-align: justify;">I made an <strong>WordPress Plugin</strong> <a title="WP Logs Book Plugin" href="http://onetarek.com/my-wordpress-plugins/wp-logs-book/"><strong>WP Logs Book</strong></a> to check this issue. My plugin stores all 404 request information. <a title="WP Logs Book Plugin Download" href="http://wordpress.org/extend/plugins/wp-logs-book/">Download and install my plugin from wordress.org</a> . Active this plugin and visit your website. Go to dashboard and open wp-logs-book&gt;Error 404 Log page . This log will show you the list of URLs those are not found in your website.</p>
]]></content:encoded>
			<wfw:commentRss>http://onetarek.com/wordpress/css-mistake-is-harmful-for-your-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
