Hey guys, I need a little hand here. I am not very good with this stuff, and I’ve been banging my head against a wall all morning trying to figure this out.
Basically I am creating a website that uses the user module and cartthrob, and I would like to create a simple plugin to wrap around the modules template tags to force the forms to submit to an url with https:// rather than the standard http://.
I got this idea from Brandon Kelly’s post about Pixel & Tonic, which you can reference from this blog post.
Here is my plugin so far
<?php
$plugin_info = array(
'pi_name' => 'Use The Force',
'pi_version' => '1.0',
'pi_author' => 'Ryan Blaind',
'pi_author_url' => 'http://theyinspire.com',
'pi_description' => 'Convert all instances of http:// to https://',
'pi_usage' => Use_the_force::usage()
);
class Use_the_force
{
function Use_the_force()
{
global $TMPL;
$tagdata = $TMPL->tagdata;
return str_replace('http://', 'https://', $tagdata);
}
// ----------------------------------------
// Plugin Usage
// ----------------------------------------
function usage()
{
ob_start();
?>
example: {exp:use_the_force}http://site.com/{/exp:use_the_force}
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
}
/* End of file pi.use_the_force.php */
/* Location: ./system/plugins/pi.use_the_force.php */and inside a simple template, I am using this code to test it, but nothing gets output. Here is the simple template code:
{exp:use_the_force}http://site.com/{/exp:use_the_force}please help, I am stuck. Thanks in advance (:
cheers
-Ryan