function test_hooks() { $this->assertEquals(10, has_action('after_setup_theme', array(Charitable_Public::get_instance(), 'load_template_files'))); $this->assertEquals(10, has_action('wp_enqueue_scripts', array(Charitable_Public::get_instance(), 'wp_enqueue_scripts'))); $this->assertEquals(10, has_filter('post_class', array(Charitable_Public::get_instance(), 'campaign_post_class'))); $this->assertEquals(10, has_filter('comments_open', array(Charitable_Public::get_instance(), 'disable_comments_on_application_pages'))); }
/** * Returns and/or create the single instance of this class. * * @return Charitable_Public * @access public * @since 1.2.0 */ public static function get_instance() { if (is_null(self::$instance)) { self::$instance = new Charitable_Public(); } return self::$instance; }
/** * Render the donation form. * * @return void * @access public * @since 1.0.0 */ public function render() { /* Load the script if it hasn't been loaded yet. */ if (!wp_script_is('charitable-script', 'enqueued')) { Charitable_Public::get_instance()->enqueue_donation_form_scripts(); } charitable_template('donation-form/form-donation.php', array('campaign' => $this->get_campaign(), 'form' => $this, 'form_id' => 'charitable-donation-amount-form')); }
/** * @covers Charitable_Public::disable_comments_on_application_pages() */ function test_comments_disabled_on_donation_processing_page() { $this->set_charitable_option('donation_form_display', 'separate_page'); $page = charitable_get_donation_processing_page_permalink(false, array('donation_id' => self::$donation_id)); $this->go_to($page); $comments_enabled = Charitable_Public::get_instance()->disable_comments_on_application_pages(true, self::$donation_id); $this->assertFalse($comments_enabled); }
/** * Checks whether we're on the public-facing side and if so, loads the public-facing functionality. * * @return void * @access private * @since 1.0.0 */ private function maybe_start_public() { if (is_admin()) { return; } require_once $this->get_path('public') . 'class-charitable-public.php'; /** * We are registering this object only for backwards compatibility. It * will be removed in or after Charitable 1.3. * * @deprecated */ $this->register_object(Charitable_Public::get_instance()); }