Esempio n. 1
0
function optimizely_conf()
{
    global $optimizely_nonce;
    if (isset($_POST['submit'])) {
        if (function_exists('current_user_can') && !current_user_can('manage_options')) {
            die(__('Cheatin’ uh?'));
        }
        check_admin_referer($optimizely_nonce);
        $project_code = htmlentities(stripslashes($_POST['project_code']));
        if (empty($project_code)) {
            $ms = 'new_code_empty';
            delete_option('optimizely_project_code');
        } else {
            update_option('optimizely_project_code', $project_code);
            $ms = 'new_code_saved';
        }
    }
    $messages = array('new_code_empty' => 'Your project code has been cleared. Please enter a new project code to use Optimizely on this site.', 'new_code_saved' => 'Your project code has been saved. Enjoy using Optimizely!', 'code_empty' => 'Please enter your project code.');
    if (!empty($_POST['submit'])) {
        ?>
<div id="message" class="updated fade">
  <p>
    <?php 
        _e('<strong>Configuration saved.</strong><br \\>' . $messages[$ms]);
        ?>
  </p>
</div>
<?php 
    }
    ?>
<div class="wrap">
  <h2><?php 
    _e('Optimizely Configuration');
    ?>
</h2>
  <div class="narrow">
    <form action="" method="post" id="optimizely-conf">
      <h3>About Optimizely</h3>
      <p>Simple, fast, and powerful. <a href="http://www.optimizely.com" target="_blank">Optimizely</a> is a dramatically easier way for you to improve your website through A/B testing. Create an experiment in minutes with our easy-to-use visual interface with absolutely no coding or engineering required. Convert your website visitors into customers and earn more revenue today!</p>
      <h3>Register now</h3>
      <p>Create an account at <a href="http://www.optimizely.com" target="_blank">optimizely.com</a> and start A/B testing today! After creating an account you can come back to this configuration page and set up your WordPress website to use Optimizely.</p>
      <h3>Optimizely project code</h3>
      <p>You can find your project code on your project's experiments page. Go to <a href="https://www.optimizely.com/experiments">optimizely.com/experiments</a>, make sure you've selected the right project and click on &lt;Project Code&gt;, then click on 'Copy to Clipboard'. You can then paste the code in the box below. Your project code should start with "&lt;script" and end with "&lt;/script&gt;".</p>
      <label for="project_code" style="font-weight:bold;">Paste your project code</label>
      <input id="project_code" name="project_code" type="text" size="60" maxlength="80" value="<?php 
    echo get_option('optimizely_project_code');
    ?>
" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" />
      <?php 
    optimizely_nonce_field($optimizely_nonce);
    ?>
      <p class="submit"><input type="submit" name="submit" value="<?php 
    _e('Update configuration &raquo;');
    ?>
" /></p>
    </form>
  </div>
</div>
<?php 
}
Esempio n. 2
0
<div class="wrap">
  <h2><?php 
_e('Optimizely Configuration');
?>
</h2>
  <div class="narrow">
    <form action="" method="post" id="optimizely-conf">
      <?php 
optimizely_nonce_field($optimizely_nonce);
?>
      <h3>About Optimizely</h3>
      <p>Simple, fast, and powerful. <a href="http://www.optimizely.com" target="_blank">Optimizely</a> is a dramatically easier way for you to improve your website through A/B testing. Create an experiment in minutes with absolutely no coding or engineering required. Convert your website visitors into customers and earn more revenue: create an account at <a href="http://www.optimizely.com" target="_blank">optimizely.com</a> and start A/B testing today!</p>
      <h3>Optimizely API tokens</h3>
      <p>Once you create an account, you can find your API Token on your account page at <a href="https://www.optimizely.com/account">optimizely.com/account</a>.
      <p>
        <label for="token"><strong>API Token</strong></label>
        <br />
        <input id="token" name="token" type="text" maxlength="80" value="<?php 
echo get_option('optimizely_token');
?>
" class="code" />
      </p>
      
      <button id="connect_optimizely" class="button">Connect Optimizely</button>
      
      <h3>Choose a Project</h3>
      <input type="hidden" id="project_name" name="project_name" value="<?php 
echo get_option('optimizely_project_name');
?>
" />
      <select id="project_id" name="project_id">