';
$plugins = array();
$fname = $splittestpx_filepath;
$p = strpos ($fname, '/wp-content/plugins/');
if (! $p) $p = strpos ($fname, '\\wp-content\\plugins\\');
if ($p) $fname = substr ($fname, $p + 20);
$plugins[0] = $fname;
deactivate_plugins ($plugins);
echo 'The ' . $pname . ' plugin has been deactivated';
die ('
Once the problem has been resolved, go to the Plugins menu and re-activate the plugin
Click "Refresh" on your browser to continue');
}
function SplitTestPxPluginDeactivate ()
{
delete_option ('splittestpx1717_status');
}
function SplitTestPxPluginEditSettings ()
{
global $splittestpx_levels, $splittestpx_maxitems, $splittestpx_linkfolder, $splittestpx_codethanks, $splittestpx_autolock,
$splittestpx_code1, $splittestpx_code2, $splittestpx_code3;
echo '
";
echo 'Send people to the following URL instead of the thank you page. This URL will record the sale and then redirect the person to your thank you page: ' . $salecodelink . '
';
}
}
$active = get_option('splittestpx1717_active');
if ($active)
{
$numitems = get_option ('splittestpx1717_numitems');
if (! $numitems || $numitems > $splittestpx_maxitems) $numitems = $splittestpx_maxitems;
$cycles = intval (get_option ('splittestpx1717_cycles'));
$hnum = intval (get_option ('splittestpx1717_hnum'));
$maxsales = 0;
for ($c = 1; $c <= $numitems; $c ++)
{
$salev = get_option ("splittestpx1717_sale$c");
if ($salev > $maxsales) $maxsales = $salev;
}
$plock = get_option ('splittestpx1717_locked');
if ($plock)
{
$autostr = '';
if ($splittestpx_autolock && $maxsales >= $splittestpx_autolock) $autostr = " (due to reaching $splittestpx_autolock sales)";
echo "System Is Locked To Option $plock$autostr
';
}
}
echo " \n";
if (function_exists ('home_url')) $prepend = home_url ($splittestpx_linkfolder);
else $prepend = get_bloginfo ('url') . $splittestpx_linkfolder;
$testpageurl = get_option('splittestpx1717_testpageurl');
echo 'Current Stats';
if ($testpageurl) echo ' (use the links to view the test page with the different headlines)';
echo '
';
echo ' ';
echo '';
if (! $plock)
{
echo ' ';
}
echo ' ';
if (! $testpageurl) echo 'Note: This URL should get set automatically the first time you visit the page that contains ' . $splittestpx_code1 . ' ';
echo "
\n";
}
echo 'Enter the headlines to be tested in the boxes below. In your blog page, put the text ' . $splittestpx_code1 . ' where the Headline should appear. ';
if ($splittestpx_levels >= 2) echo ' Put the text ' . $splittestpx_code2 . ' where the SubHeadline should appear. ';
if ($splittestpx_levels >= 3) echo 'Put the text ' . $splittestpx_code3 . ' where the SubSubHeadline should appear.';
echo "
\n";
echo '\n";
echo '
';
echo 'The plugin needs to keep track every time someone visits your thank you page
';
echo 'If your thank you page is on this blog, just include the text ' . $splittestpx_codethanks . ' somewhere in the page (it doesn\'t matter where)
';
echo 'If your thank you page is not on this blog, enter the URL of the thank you page in the box below';
if (! $salecodelink) echo ' and the plugin will give you a new URL to send people to instead. The new URL will record the sale and then redirect the person to your thank you page.';
echo "
\n";
$saleurl = get_option ('splittestpx1717_saleurl');
echo ' ';
if ($salecodelink) echo 'Send people to the following URL instead of the thank you page. This URL will record the sale and then redirect the person to your thank you page: ' . $salecodelink;
}
function SplitTestPxPluginMenu ()
{
global $splittestpx_filepath;
add_options_page ('Headline Tester', 'Headline Tester', 'activate_plugins', $splittestpx_filepath, 'SplitTestPxPluginEditSettings');
}
function SplitTestPxPluginContent ($content)
{
if (is_feed()) return $content;
global $splittestpx_codebase;
if (strpos ($content, $splittestpx_codebase) === false) return $content;
global $splittestpx_levels, $splittestpx_maxitems, $splittestpx_hnum, $splittestpx_linkfolder, $splittestpx_cookie,
$splittestpx_code1, $splittestpx_code2, $splittestpx_code3, $splittestpx_codethanks;
if (strpos ($content, $splittestpx_codethanks) !== false)
{
if (function_exists ('home_url')) $prepend = home_url ($splittestpx_linkfolder);
else $prepend = get_bloginfo ('url') . $splittestpx_linkfolder;
$salelink = $prepend . 'sale';
$inscode = '';
$content = str_replace ($splittestpx_codethanks, $inscode, $content);
return $content;
}
$pageurl = get_option('splittestpx1717_testpageurl');
if (! $pageurl) update_option ('splittestpx1717_testpageurl', get_permalink());
if (! get_option ('splittestpx1717_active'))
{
$content = str_replace ($splittestpx_code1, 'ERROR - no headlines have been set up. Enter your Headlines using the "Headline Tester" option in the admin "Settings" menu', $content);
$content = str_replace ($splittestpx_code2, '', $content);
$content = str_replace ($splittestpx_code3, '', $content);
return $content;
}
$scriptcode = '';
$hnum = $splittestpx_hnum;
if (! $hnum) $hnum = get_option ('splittestpx1717_locked');
if (! $hnum)
{
if (isset ($_COOKIE[$splittestpx_cookie])) $hnum = intval($_COOKIE[$splittestpx_cookie]);
if ($hnum < 0 || $hnum > $splittestpx_maxitems) $hnum = 0;
if (! $hnum)
{
$hnum = get_option ('splittestpx1717_hnum') + 1;
$numitems = get_option ('splittestpx1717_numitems');
if (! $numitems || $numitems >= $splittestpx_maxitems) $numitems = $splittestpx_maxitem;
if ($hnum < 0 || $hnum > $numitems)
{
$hnum = 1;
$cycles = get_option ('splittestpx1717_cycles') + 1;
update_option ('splittestpx1717_cycles', $cycles);
}
update_option ('splittestpx1717_hnum', $hnum);
$scriptcode = '';
}
}
{
$headline = explode ('|', get_option ('splittestpx1717_headline'));
$str = '';
if (isset ($headline[$hnum - 1])) $str = $headline[$hnum - 1];
$content = str_replace ($splittestpx_code1, $scriptcode . $str, $content);
$scriptcode = '';
}
if ($splittestpx_levels >= 2)
{
$headline = explode ('|', get_option ('splittestpx1717_subheadline'));
$str = '';
if (isset ($headline[$hnum - 1])) $str = $headline[$hnum - 1];
$content = str_replace ($splittestpx_code2, $scriptcode . $str, $content);
$scriptcode = '';
}
if ($splittestpx_levels >= 3)
{
$headline = explode ('|', get_option ('splittestpx1717_subsubheadline'));
$str = '';
if (isset ($headline[$hnum - 1])) $str = $headline[$hnum - 1];
$content = str_replace ($splittestpx_code3, $scriptcode . $str, $content);
$scriptcode = '';
}
return $content;
}
function SplitTestPxPluginLinkHandler ()
{
global $splittestpx_linkfolder;
if (strpos ($_SERVER['REQUEST_URI'], '/' . $splittestpx_linkfolder) === false) return;
if (function_exists ('home_url')) $prepend = home_url ($splittestpx_linkfolder);
else $prepend = get_bloginfo ('url') . $splittestpx_linkfolder;
$p = strpos ($prepend, '/', 9);
$prepend = substr ($prepend, $p);
if (strncmp ($_SERVER['REQUEST_URI'], $prepend, strlen($prepend)) != 0) return;
global $splittestpx_cookie, $splittestpx_hnum, $splittestpx_maxitems, $splittestpx_autolock;
$option = substr ($_SERVER['REQUEST_URI'], strlen($prepend));
if (substr ($option, 0, 4) == 'sale')
{
if (! get_option ('splittestpx1717_locked') && isset ($_COOKIE[$splittestpx_cookie]))
{
$hnum = intval($_COOKIE[$splittestpx_cookie]);
if ($_COOKIE[$splittestpx_cookie] != $hnum . 'S')
{
setcookie ($splittestpx_cookie, $hnum . 'S', time()+365*86400, '/');
if ($hnum < 0 || $hnum > $splittestpx_maxitems) $hnum = 0;
if ($hnum)
{
$optname = 'splittestpx1717_sale' . $hnum;
$numsales = get_option ($optname) + 1;
update_option ($optname, $numsales);
if ($splittestpx_autolock && $numsales >= $splittestpx_autolock)
{
update_option ('splittestpx1717_locked', $hnum);
}
}
}
}
$saleurl = get_option ('splittestpx1717_saleurl');
if ($saleurl)
{
$hnum = intval (substr ($option, 4));
if ($hnum == get_option ('splittestpx1717_salecode')) header ("Location: $saleurl");
}
exit ();
}
elseif (substr ($option, 0, 6) == 'option')
{
$hnum = intval (substr ($option, 6));
if ($hnum < 0 || $hnum > $splittestpx_maxitems) $hnum = 0;
$pageurl = get_option('splittestpx1717_testpageurl');
if (! $hnum)
{
die ('Invalid option number in URL');
}
elseif ($pageurl)
{
$p = strpos ($pageurl, '/', 9);
$_SERVER['REQUEST_URI'] = substr ($pageurl, $p);
$splittestpx_hnum = $hnum;
return;
}
else
{
die ('Please set the sales page URL in the blog admin Settings menu');
}
}
}
add_action ('init', 'SplitTestPxPluginLinkHandler');
add_action ('admin_head', 'SplitTestPxPluginAdmin');
if (function_exists ('register_deactivation_hook')) register_deactivation_hook ($splittestpx_filepath, 'SplitTestPxPluginDeactivate');
add_filter ('the_content', 'SplitTestPxPluginContent');
add_action ('admin_menu', 'SplitTestPxPluginMenu');
?>
The Morning Letter
Extraordinary solutions to everyday situations delivered every morning to over 12,700 subscribers!
Wouldn’t it be great if you could throw away your eyeglasses and improve your vision naturally? Think about it… You would no longer need expensive eye...
Every morning we make it our business to deliver actionable, "out of the box" solutions & ideas to your inbox - how to do everything in life... only MUCH smarter!
Join over 12,700 subscribers today!
* Spam free zone! Your email is 100% safe and secure and of course will never be sold, shared or rented.