function setUp() { parent::setUp(); // Test data $this->post_count = 10; $this->post_ids = $this->factory->post->create_many($this->post_count); of_reset_options(); }
function setUp() { parent::setUp(); // Make sure options are zeroed out after each test of_reset_options(); // Test data $this->author_user_ids = $this->factory->user->create_many(10, array('role' => 'author')); $this->contributor_user_ids = $this->factory->user->create_many(5, array('role' => 'contributor')); }
function test_largo_social_links() { // this function only creates output if there are >0 social links $fields = array('rss_link', 'facebook_link', 'twitter_link', 'youtube_link', 'flickr_link', 'tumblr_link', 'gplus_link', 'linkedin_link', 'github_link'); foreach ($fields as $field) { of_set_option($field, 'http://foo.bar\\/' . $field); $this->expectOutputRegex('/http:\\/\\/foo.bar\\/' . $field . '/'); // This is excessively greedy, it expects any output at all largo_social_links(); of_reset_options(); } }
function siteoptions_add_admin() { global $query_string; if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'siteoptions') { if (isset($_REQUEST['of_save']) && 'reset' == $_REQUEST['of_save']) { $options = get_option('of_template'); of_reset_options($options, 'siteoptions'); header("Location: admin.php?page=siteoptions&reset=true"); die; } } $tt_page = add_theme_page(__('Theme Options', 'framework'), __('Theme Options', 'framework'), 'edit_theme_options', 'siteoptions', 'siteoptions_options_page'); add_action("admin_print_scripts-{$tt_page}", 'of_load_only'); add_action("admin_print_styles-{$tt_page}", 'of_style_only'); }
function cebo_add_admin() { global $themename, $shortname, $query_string; if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'cebo') { if (isset($_REQUEST['of_save']) && 'reset' == $_REQUEST['of_save']) { $options = get_option('of_template'); of_reset_options($options, 'cebo'); header("Location: options_panel.php?page=cebo&reset=true"); die; } } $tt_page = add_object_page($themename, $themename, 'administrator', 'cebo', 'cebo_options_page', '../wp-content/themes/ic/options/images/icon_options.png'); add_action("admin_print_scripts-{$tt_page}", 'of_load_only'); add_action("admin_print_styles-{$tt_page}", 'of_style_only'); }
function siteoptions_add_admin() { global $query_string; if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'siteoptions') { if (isset($_REQUEST['of_save']) && 'reset' == $_REQUEST['of_save']) { $options = get_option('of_template'); of_reset_options($options, 'siteoptions'); header("Location: admin.php?page=siteoptions&reset=true"); die; } } $tt_page = add_menu_page('Launcher', 'Launcher', 'edit_theme_options', 'siteoptions', 'siteoptions_options_page', $icon_url = get_template_directory_uri() . '/admin/images/msetting2.png', 62); add_action("admin_print_scripts-{$tt_page}", 'of_load_only'); add_action("admin_print_styles-{$tt_page}", 'of_style_only'); }
function optionsframework_add_admin() { global $query_string; $themename = get_option('of_themename'); $shortname = get_option('of_shortname'); if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework') { if (isset($_REQUEST['of_save']) && 'reset' == $_REQUEST['of_save']) { $options = get_option('of_template'); of_reset_options($options, 'optionsframework'); header("Location: admin.php?page=optionsframework&reset=true"); die; } } $of_page = add_menu_page($themename, $themename . '<br/>Admin Panel', 'edit_theme_options', 'optionsframework', 'optionsframework_options_page'); // Add framework functionaily to the head individually add_action("admin_print_scripts-{$of_page}", 'of_load_only'); }
function themeoptions_add_admin() { global $query_string; $themename = get_option('of_themename'); $shortname = get_option('of_shortname'); if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'themeoptions') { if (isset($_REQUEST['of_save']) && 'reset' == $_REQUEST['of_save']) { $options = get_option('of_template'); of_reset_options($options, 'themeoptions'); header("Location: admin.php?page=themeoptions&reset=true"); die; } } $of_page = add_theme_page('Theme Options', 'Theme Options', 'edit_theme_options', 'themeoptions', 'themeoptions_options_page'); // Add framework functionaily to the head individually add_action("admin_print_scripts-{$of_page}", 'of_load_only'); add_action("admin_print_styles-{$of_page}", 'of_style_only'); }
function test_largo_force_settings_update() { of_reset_options(); largo_force_settings_update(); $this->assertEquals('1', of_get_option('show_sticky_nav')); $this->assertEquals('normal', of_get_option('single_template')); }
function test_largo_post_social_links() { // Create a post, go to it. $id = $this->factory->post->create(); $this->go_to('/?p=' . $id); // Test the output of this when no options are set of_set_option('article_utilities', array('facebook' => false, 'twitter' => false, 'print' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/post-social/', $ret, "The .post-social class was not in the output"); unset($ret); // Test that this outputs the expected data for each of the button types // Twitter of_set_option('article_utilities', array('twitter' => '1', 'facebook' => false, 'print' => false, 'email' => false)); of_set_option('twitter_link', 'foo'); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/class="twitter"/', $ret, "The 'twitter' class did not appear in the output"); // @TODO: insert a test for the get_the_author_meta test here $this->assertRegExp('/' . __('Tweet', 'largo') . '/', $ret, "The translation of 'Tweet' was not in the Twitter output"); unset($ret); of_reset_options(); // Facebook of_set_option('article_utilities', array('facebook' => '1', 'twitter' => false, 'print' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/' . preg_quote(esc_attr(of_get_option('fb_verb')), '/') . '/i', $ret, "The Facebook Verb was not in the Facebook output"); $this->assertRegExp('/' . preg_quote(get_permalink(), '/') . '/', $ret, "The permalink was not in the Facebook output"); unset($ret); of_reset_options(); // Print of_set_option('article_utilities', array('print' => '1', 'twitter' => '1', 'facebook' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/print/', $ret, "The Print output did not include a print class"); unset($ret); of_reset_options(); // Email of_set_option('article_utilities', array('email' => '1', 'twitter' => false, 'facebook' => false, 'print' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/email/', $ret, "The Email output did not include an email class"); unset($ret); of_reset_options(); }
function setUp() { parent::setUp(); of_reset_options(); }