<?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>PHP &#8211; Snippets</title>
	<atom:link href="http://wp.djtedfunke.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://wp.djtedfunke.com</link>
	<description></description>
	<lastBuildDate>Sat, 18 Apr 2020 12:59:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>

<image>
	<url>http://wp.djtedfunke.com/wp-content/uploads/2018/12/cropped-front-end_developer-2-512-32x32.png</url>
	<title>PHP &#8211; Snippets</title>
	<link>http://wp.djtedfunke.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Disable theme editor &#8211; backend</title>
		<link>http://wp.djtedfunke.com/disable-theme-editor-backend/</link>
		
		<dc:creator><![CDATA[tadej]]></dc:creator>
		<pubDate>Thu, 19 Mar 2020 14:22:40 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[backend]]></category>
		<category><![CDATA[disable]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[theme]]></category>
		<guid isPermaLink="false">http://wp.djtedfunke.com/?p=246</guid>

					<description><![CDATA[Insert in wp-config.php:]]></description>
										<content:encoded><![CDATA[
<p>Insert in wp-config.php:</p>



<pre class="wp-block-code"><code lang="php" class="language-php">define( 'DISALLOW_FILE_EDIT', true );</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Convert hex color to rgb or rgba using PHP</title>
		<link>http://wp.djtedfunke.com/convert-hex-color-to-rgb-or-rgba-using-php/</link>
		
		<dc:creator><![CDATA[tadej]]></dc:creator>
		<pubDate>Thu, 26 Sep 2019 14:19:00 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://wp.djtedfunke.com/?p=217</guid>

					<description><![CDATA[Usage example:]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code>/* Convert hexdec color string to rgb(a) string */
 
function hex2rgba($color, $opacity = false) {
 
	$default = 'rgb(0,0,0)';
 
	//Return default if no color provided
	if(empty($color))
          return $default; 
 
	//Sanitize $color if "#" is provided 
        if ($color[0] == '#' ) {
        	$color = substr( $color, 1 );
        }
 
        //Check if color has 6 or 3 characters and get values
        if (strlen($color) == 6) {
                $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
        } elseif ( strlen( $color ) == 3 ) {
                $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
        } else {
                return $default;
        }
 
        //Convert hexadec to rgb
        $rgb =  array_map('hexdec', $hex);
 
        //Check if opacity is set(rgba or rgb)
        if($opacity){
        	if(abs($opacity) > 1)
        		$opacity = 1.0;
        	$output = 'rgba('.implode(",",$rgb).','.$opacity.')';
        } else {
        	$output = 'rgb('.implode(",",$rgb).')';
        }
 
        //Return rgb(a) color string
        return $output;
}</code></pre>



<p>Usage example:</p>



<pre class="wp-block-code"><code>/* Here's a usage example how to use this function for dynamicaly created CSS */
 
$color = '#ffa226';
$rgb = hex2rgba($color);
$rgba = hex2rgba($color, 0.7);
 
/* CSS output */
 
echo '	
	div.example{
	 background: '.$rgb.';
	 color: '.$rgba.';
	}
';</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
