/** * Register scripts and styles */ public function register_resources($options) { // @TODO: output minified CSS wp_register_style('headline-envy', plugins_url('css/headline-envy.css', __FILE__), array(), headline_envy()->script_version); wp_register_script('headline-envy-admin', plugins_url('js/lib/headline-envy-admin.js', __FILE__), array(), headline_envy()->script_version, TRUE); wp_register_script('headline-envy', plugins_url('js/lib/headline-envy.js', __FILE__), array('jquery'), headline_envy()->script_version, TRUE); wp_register_script('headline-envy-tag', plugins_url('js/lib/headline-envy-tag.js', __FILE__), array(), headline_envy()->script_version, FALSE); }
/** * Tests that relevant hooks are attached */ public function test_hooks() { headline_envy()->admin(); $this->assertEquals(10, has_action('init', array(headline_envy(), 'init'))); $this->assertEquals(10, has_action(headline_envy()->cron, array(headline_envy(), 'winner_cron'))); $this->assertEquals(10, has_action('wp_kses_allowed_html', array(headline_envy(), 'wp_kses_allowed_html'))); $this->assertEquals(0, has_filter('the_title', array(headline_envy(), 'the_title'))); $this->assertEquals(10, has_action('admin_enqueue_scripts', array(headline_envy()->admin(), 'admin_enqueue_scripts'))); $this->assertEquals(10, has_action('admin_menu', array(headline_envy()->admin(), 'admin_menu'))); $this->assertEquals(10, has_action('save_post', array(headline_envy()->admin(), 'save_post'))); $this->assertEquals(10, has_action('edit_form_before_permalink', array(headline_envy()->admin(), 'edit_form_before_permalink'))); }
<?php /** * Plugin Name: HeadlineEnvy * Version: 1.0.2 * Plugin URI: http://www.funnelenvy.com/ * Description: Leverages Optimizely to A/B test post headlines. * Author: FunnelEnvy * Author URI: http://www.funnelenvy.com/ * Contributors: borkweb, zbtirrell, methnen * Tags: a/b testing * License: MIT * License URI: http://opensource.org/licenses/MIT */ require_once __DIR__ . '/components/class-headline-envy.php'; headline_envy();
<h3><?php esc_html_e('About Optimizely', 'headline-envy'); ?> </h3> <p><?php esc_html_e('Simple, fast, and powerful.', 'headline-envy'); ?> <a href="http://www.optimizely.com" target="_blank">Optimizely</a> <?php esc_html_e('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', 'headline-envy'); ?> <a href="http://www.optimizely.com" target="_blank">optimizely.com</a> <?php esc_html_e('and start A/B testing today!', 'headline-envy'); ?> </p> <form method="post" action="<?php echo esc_url('admin.php?page=' . headline_envy()->slug . '-settings'); ?> "> <table class="form-table"> <tbody> <tr class="<?php echo esc_attr($invalid_optimizely_api_key ? 'invalid-key' : ''); ?> "> <th scope="row"><?php esc_html_e('Optimizely API key', 'headline-envy'); ?> <br></th> <td> <?php $this->text_field('optimizely_api_key');