<?php
/*
Plugin Name: URL Params
Plugin URI: http://asandia.com/wordpress-plugins/urlparams/
Description: Short Code to grab any URL Parameter ... modified to handle ThriveCart, see tc_urlparam function https://integratepro.net/codeshare/64T1Sg4Hc1CBc
Version: 2.1
Author: Jeremy B. Shapiro
Author URI: http://www.asandia.com/
*/
/*
URL Params (Wordpress Plugin)
Copyright (C) 2011-2016 Jeremy Shapiro
*/
//tell wordpress to register the shortcodes
add_shortcode("tc_urlparam", "tc_urlparam");
add_shortcode("urlparam", "urlparam");
add_shortcode("ifurlparam", "ifurlparam");
function tc_urlparam($atts, $content) {
$defaults = array(
'param' => '',
'default' => '',
'dateformat' => '',
'attr' => '',
'htmltag' => false,
);
# we used to use shortcode_atts(), but that would nuke an extra attributes that we don't know about but want. array_merge() keeps them all.
$atts = array_merge($defaults, $atts);
$params = preg_split('/\,\s*/',$atts['param']);
$return = false;
foreach($params as $param)
{
switch ($param)
{
case "email":
$return = trim(strip_tags($_REQUEST['thrivecart']['customer']['email']));
break;
case "firstname":
$return = trim(strip_tags($_REQUEST['thrivecart']['customer']['firstname']));
break;
case "lastname":
$return = trim(strip_tags($_REQUEST['thrivecart']['customer']['lastname']));
break;
}
}
return $return;
}
function urlparam($atts, $content) {
$defaults = array(
'param' => '',
'default' => '',
'dateformat' => '',
'attr' => '',
'htmltag' => false,
);
# we used to use shortcode_atts(), but that would nuke an extra attributes that we don't know about but want. array_merge() keeps them all.
$atts = array_merge($defaults, $atts);
$params = preg_split('/\,\s*/',$atts['param']);
$return = false;
foreach($params as $param)
{
if(!$return and ($rawtext = $_REQUEST[$param]))
{
if(($atts['dateformat'] != '') && strtotime($rawtext))
{
$return = date($atts['dateformat'], strtotime($rawtext));
} else {
$return = esc_html($rawtext);
}
}
}
if(!$return) {
$return = $atts['default'];
}
if($atts['attr']) {
$return = ' ' . $atts['attr'] . '="' . $return . '" ';
if($atts['htmltag']) {
$tagname = $atts['htmltag'];
foreach(array_keys($defaults) as $key) {
unset($atts[$key]);
}
$otheratts = "";
foreach($atts as $key => $val) {
$otheratts .= " $key=\"$val\"";
}
$return = "<$tagname $otheratts $return".($content ? ">$content</$tagname>" : "/>");
}
}
return $return;
}
/*
* If 'param' is found and 'is' is set, compare the two and display the contact if they match
* If 'param' is found and 'is' isn't set, display the content between the tags
* If 'param' is not found and 'empty' is set, display the content between the tags
*
*/
function ifurlparam($atts, $content) {
$atts = shortcode_atts(array(
'param' => '',
'empty' => false,
'is' => false,
), $atts);
$params = preg_split('/\,\s*/',$atts['param']);
foreach($params as $param)
{
if($_REQUEST[$param])
{
if($atts['empty'])
{
return '';
} elseif(!$atts['is'] or ($_REQUEST[$param] == $atts['is'])) {
return do_shortcode($content);
}
}
}
if ($atts['empty'])
{
return do_shortcode($content);
}
return '';
}
?>
You may be referred to as Licensee. The terms ‘You’ or ‘Licensee’ includes you and any of your owners, employees, partners, independent contractors, subsidiaries, affiliates, attorneys, agents, heirs, and assigns.
We may be referred to as Licensor. The terms ‘Us,’ ‘We,’ or ‘Licensor’ includes our owners, employees, subsidiaries, independent contractors, agents, attorneys, and assigns.
You must be at least 18 years old to access this website or to purchase products or services from us.
We do not direct this website to minors, nor do we knowingly collect any personal information from children under the age of thirteen.
ALL CONTENT IS PROVIDED “AS IS” AND ANY AND ALL WARRANTIES ARE DISCLAIMED, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Our cumulative liability to you or anyone else for any loss or damages resulting from any claims, demands, or actions arising out of or relating to this Agreement or use of the content or website shall not exceed the amount you have paid to us for the product or service. In no event shall we be liable for any indirect, incidental, consequential, special, or exemplary damages or lost profits, even if we have been advised of the possibility of such damages. You agree that the foregoing constitutes your sole and exclusive remedy for any breach of this Agreement. SOME STATES DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY TO YOU.
There is no promise or representation that you will make a certain amount of money, or any money, or not lose money, as a result of using our products and services.
Any earnings, revenue, or income statements are strictly estimates. There is no guarantee that you will make these levels for yourself.
As with any business, your results will vary and will be based on your personal abilities, experience, knowledge, capabilities, level of desire, and an infinite number of variables beyond our control, including variables we or you have not anticipated. There are no guarantees concerning the level of success you may experience. Each person’s results will vary.
There are unknown risks in any business, particularly with the Internet where advances and changes can happen quickly.
The use of our information, products and services should be based on your own due diligence and you agree that we are not liable for your success or failure.
You will not assign, sublicense, transfer, pledge, sell, lease, rent, lend, or otherwise dispose of the content, or any part of it, or share your rights under this Agreement, to others.
You will not give others access to your username and password.
You will not violate any laws, third party rights, or this Agreement. This includes, but is not limited to, not posting any material or content that is defamatory, harassing, belongs to someone else, is obscene or pornographic
You will not provide false or misleading information to us.
When you communicate with us, send us information, or provide content to us or our website, you grant us a non-exclusive, worldwide, perpetual, irrevocable, royalty-free, sublicensable right to exercise all copyright and publicity rights you have in the content, in any manner whatsoever, in any media now known or which may be created in the future, including in other works and forms not associated with this website.
Our failure to enforce any rights granted in this Agreement or to take action against any other party in the event of any breach shall not be deemed a waiver by us as to subsequent enforcement of rights or subsequent actions in the event of future breaches.
This Agreement in all respects shall be governed by and construed according to the laws of the State of Idaho, to the exclusion of any other applicable body of governing law, without regard to conflicts of laws principles.
This Agreement is entered into in Ada County, Idaho. You consent to the exclusive jurisdiction of the state of Idaho and county of Ada for any dispute arising from or related to this Agreement.
You consent to and agree that the exclusive forum and venue for any dispute arising from or related to this Agreement will be a court located in the state of Idaho and county of Ada.
Should any term of this Agreement be declared void or unenforceable, that term shall be severed from the Agreement such declaration shall have no effect on the enforceability of the remaining terms.
This Agreement contains the complete and entire understanding and agreement between you and us and supersedes any previous communications, representations, or agreements, verbal or written, related to the subject matter of this Agreement.
This Agreement may not be modified or amended orally, impliedly, or in any manner not set forth in writing or permitted by this Agreement.
This Agreement may be amended by us at any time and without notice, but only by amending this Agreement as posted on this website, unless otherwise agreed to in a writing signed by both of us.
Any amendments will become effective 30 days after being posted on the website, unless circumstances require that a change be immediately implemented. As a condition for this Agreement you agree to periodically check this Agreement posted at this page.
You agree that your continued use of our product or service after that date will constitute your consent and acceptance of the amendment.
Date of this Agreement: 18 October 2014
Modifications: NA
You may be referred to as Licensee. The terms ‘You’ or ‘Licensee’ includes you and any of your owners, employees, partners, independent contractors, subsidiaries, affiliates, attorneys, agents, heirs, and assigns.
We may be referred to as Licensor. The terms ‘Us,’ ‘We,’ or ‘Licensor’ includes our owners, employees, subsidiaries, independent contractors, agents, attorneys, and assigns.
You must be at least 18 years old to access this website or to purchase products or services from us.
We do not direct this website to minors, nor do we knowingly collect any personal information from children under the age of thirteen.
ALL CONTENT IS PROVIDED “AS IS” AND ANY AND ALL WARRANTIES ARE DISCLAIMED, WHETHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Our cumulative liability to you or anyone else for any loss or damages resulting from any claims, demands, or actions arising out of or relating to this Agreement or use of the content or website shall not exceed the amount you have paid to us for the product or service. In no event shall we be liable for any indirect, incidental, consequential, special, or exemplary damages or lost profits, even if we have been advised of the possibility of such damages. You agree that the foregoing constitutes your sole and exclusive remedy for any breach of this Agreement. SOME STATES DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION OR EXCLUSION MAY NOT APPLY TO YOU.
There is no promise or representation that you will make a certain amount of money, or any money, or not lose money, as a result of using our products and services.
Any earnings, revenue, or income statements are strictly estimates. There is no guarantee that you will make these levels for yourself.
As with any business, your results will vary and will be based on your personal abilities, experience, knowledge, capabilities, level of desire, and an infinite number of variables beyond our control, including variables we or you have not anticipated. There are no guarantees concerning the level of success you may experience. Each person’s results will vary.
There are unknown risks in any business, particularly with the Internet where advances and changes can happen quickly.
The use of our information, products and services should be based on your own due diligence and you agree that we are not liable for your success or failure.
You will not assign, sublicense, transfer, pledge, sell, lease, rent, lend, or otherwise dispose of the content, or any part of it, or share your rights under this Agreement, to others.
You will not give others access to your username and password.
You will not violate any laws, third party rights, or this Agreement. This includes, but is not limited to, not posting any material or content that is defamatory, harassing, belongs to someone else, is obscene or pornographic
You will not provide false or misleading information to us.
When you communicate with us, send us information, or provide content to us or our website, you grant us a non-exclusive, worldwide, perpetual, irrevocable, royalty-free, sublicensable right to exercise all copyright and publicity rights you have in the content, in any manner whatsoever, in any media now known or which may be created in the future, including in other works and forms not associated with this website.
Our failure to enforce any rights granted in this Agreement or to take action against any other party in the event of any breach shall not be deemed a waiver by us as to subsequent enforcement of rights or subsequent actions in the event of future breaches.
This Agreement in all respects shall be governed by and construed according to the laws of the State of Idaho, to the exclusion of any other applicable body of governing law, without regard to conflicts of laws principles.
This Agreement is entered into in Ada County, Idaho. You consent to the exclusive jurisdiction of the state of Idaho and county of Ada for any dispute arising from or related to this Agreement.
You consent to and agree that the exclusive forum and venue for any dispute arising from or related to this Agreement will be a court located in the state of Idaho and county of Ada.
Should any term of this Agreement be declared void or unenforceable, that term shall be severed from the Agreement such declaration shall have no effect on the enforceability of the remaining terms.
This Agreement contains the complete and entire understanding and agreement between you and us and supersedes any previous communications, representations, or agreements, verbal or written, related to the subject matter of this Agreement.
This Agreement may not be modified or amended orally, impliedly, or in any manner not set forth in writing or permitted by this Agreement.
This Agreement may be amended by us at any time and without notice, but only by amending this Agreement as posted on this website, unless otherwise agreed to in a writing signed by both of us.
Any amendments will become effective 30 days after being posted on the website, unless circumstances require that a change be immediately implemented. As a condition for this Agreement you agree to periodically check this Agreement posted at this page.
You agree that your continued use of our product or service after that date will constitute your consent and acceptance of the amendment.
Date of this Agreement: 18 October 2014
Modifications: NA