<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
$plugin_info = array('pi_name' => 'Encode/Decode', 'pi_version' => '1.2', 'pi_author' => 'Nine Four', 'pi_author_url' => 'http://ninefour.co.uk/labs - http://ronny-andre.no', 'pi_description' => 'Encodes and decodes a text string using a number of encoding and decoding methods. EE2 version added in v1.2 by Ronny-André Bendiksen.', 'pi_usage' => encode_decode::usage());
class encode_decode
{
    var $return_data = '';
    function encode_decode()
    {
        $this->EE =& get_instance();
        $str = $this->EE->TMPL->tagdata;
        $style = $this->EE->TMPL->fetch_param('style');
        $direction = $this->EE->TMPL->fetch_param('direction');
        if ($str != '') {
            if ($direction == 'decode') {
                if ($style == 'base64') {
                    $string = base64_decode($str);
                } elseif ($style == 'htmlspecialchars') {
                    $string = htmlspecialchars($str);
                } elseif ($style == 'htmlentities') {
                    $string = htmlentities($str);
                } elseif ($style == 'uuencode') {
                    $string = convert_uuencode($str);
                } elseif ($style == 'rawurlencode') {
                    $string = rawurldecode($str);
                } else {
                    $string = urldecode($str);
                }
            } else {
<?php

$plugin_info = array('pi_name' => 'Encode/Decode', 'pi_version' => '1.1', 'pi_author' => 'Nine Four', 'pi_author_url' => 'http://ninefour.co.uk/labs', 'pi_description' => 'Encodes and decodes a text string using a number of encoding and decoding methods', 'pi_usage' => encode_decode::usage());
class encode_decode
{
    var $style = "";
    var $direction = "";
    function encode_decode()
    {
        global $TMPL;
        $str = $TMPL->tagdata;
        $style = $TMPL->fetch_param('style');
        $direction = $TMPL->fetch_param('direction');
        if ($str != "") {
            if ($direction == "decode") {
                if ($style == "base64") {
                    $string = base64_decode($str);
                } elseif ($style == "htmlspecialchars") {
                    $string = htmlspecialchars($str);
                } elseif ($style == "htmlentities") {
                    $string = htmlentities($str);
                } elseif ($style == "uuencode") {
                    $string = convert_uuencode($str);
                } elseif ($style == "rawurlencode") {
                    $string = rawurlencode($str);
                } else {
                    $string = urldecode($str);
                }
            } else {
                if ($style == "base64") {
                    $string = base64_encode($str);
<?php

$plugin_info = array(
	'pi_name'		=> 'Encode/Decode',
	'pi_version'		=> '1.3',
	'pi_author'		=> 'Nathan Pitman',
	'pi_author_url'		=> 'https://github.com/nathanpitman/encode_decode.pi.ee_addon',
	'pi_description'	=> 'Encodes and decodes a text string using a number of encoding and decoding methods',
	'pi_usage'		=> encode_decode::usage()
);

class encode_decode {

	var $style = "";
	var $direction = "";
	
	function encode_decode()
	{
		global $TMPL;
		$str = $TMPL->tagdata;
		$style = $TMPL->fetch_param('style');
		$direction = $TMPL->fetch_param('direction');
        
		if ($str != "") {

			if ($direction == "decode") {
				if ($style == "base64") {
					$string = base64_decode($str);
				} elseif ($style == "htmlspecialchars") {
					$string = htmlspecialchars_decode($str);
				} elseif ($style == "htmlentities") {