Example #1
0
function custom_save_comment_wp($postID, $userID, $author, $email, $comment, $ratingvalue)
{
    remove_all_actions('comment_post', 1);
    $_POST['crfp-rating'] = $ratingvalue;
    $commentdata = array('comment_post_ID' => $postID, 'comment_author' => $author, 'comment_author_email' => $email, 'comment_content' => $comment, 'comment_type' => '', 'comment_parent' => 0, 'user_id' => $userID);
    /*Graba el comentario y me da el ID*/
    $commentID = wp_new_comment($commentdata);
    /*AƱade el meta con el rating*/
    add_comment_meta($commentID, 'crfp-rating', $ratingvalue, true);
    //add_comment_meta($commentID, 'crfp-rating', 4, true);
    /*Actualiza el total y el promedio del rating*/
    $comments = get_comments(array('post_id' => $postID, 'status' => 'approve'));
    $totalRating = 0;
    $totalRatings = 0;
    $averageRating = 0;
    if (is_array($comments) and count($comments) > 0) {
        foreach ($comments as $comment) {
            $rating = get_comment_meta($comment->comment_ID, 'crfp-rating', true);
            if ($rating > 0) {
                $totalRatings++;
                $totalRating += $rating;
            }
        }
        $averageRating = ($totalRatings == 0 or $totalRating == 0) ? 0 : round($totalRating / $totalRatings, 0);
    }
    update_post_meta($postID, 'crfp-total-ratings', $totalRatings);
    update_post_meta($postID, 'crfp-average-rating', $averageRating);
    return true;
}
Example #2
0
function avia_clear_import()
{
    remove_all_actions('import_start', 10);
    remove_all_actions('import_end', 10);
    avia_temp_products();
    add_action('import_start', 'avia_woocommerce_import_start');
}
 /**
  * Ensure application areas show the correct content.
  */
 public function init()
 {
     global $job_manager;
     $user_resumes = $this->get_user_resumes();
     /**
      * What content is shown is based on settings and whether or not the user has resumes.
      */
     if (empty($user_resumes) && get_option('resume_manager_force_resume')) {
         remove_all_actions('job_manager_application_details_email');
         remove_all_actions('job_manager_application_details_url');
         add_action('job_manager_application_details_email', array($this, 'force_apply_with_resume'), 20);
         add_action('job_manager_application_details_url', array($this, 'force_apply_with_resume'), 20);
     } else {
         if (get_option('resume_manager_enable_application', 1)) {
             // If we're forcing application through resume manager, we should disable other forms and content.
             if (get_option('resume_manager_force_application')) {
                 remove_all_actions('job_manager_application_details_email');
             }
             add_action('job_manager_application_details_email', array($this, 'apply_with_resume'), 20);
         }
         if (class_exists('WP_Job_Manager_Applications') && get_option('resume_manager_enable_application_for_url_method', 1)) {
             // If we're forcing application through resume manager, we should disable other forms and content.
             if (get_option('resume_manager_force_application')) {
                 remove_all_actions('job_manager_application_details_url');
             }
             add_action('job_manager_application_details_url', array($this, 'apply_with_resume'), 20);
         }
     }
 }
Example #4
0
 public static function prepare()
 {
     add_shortcode(self::CODE . '-copyright', array(__CLASS__, 'copyright_owner'));
     add_shortcode(self::CODE . '-menu', array(__CLASS__, 'footer_menu'));
     add_shortcode(self::CODE, array(__CLASS__, 'footer'));
     add_filter('widget_text', 'do_shortcode', 11);
     add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_styles'));
     self::$is_landing = self::is_landing_page();
     //is this a landing page
     //insert custom footer at specified hook
     if ($footer_hook = self::get_option('footer_hook')) {
         if (self::get_option('footer_remove')) {
             remove_all_actions($footer_hook);
         }
         add_action($footer_hook, array(__CLASS__, 'custom_footer'));
     }
     //suppress footer output
     if ($ffs = self::get_option('footer_filter_hook')) {
         add_filter($ffs, array(__CLASS__, 'no_footer'), 100);
     }
     if (is_page('privacy') && self::get_term('privacy_contact')) {
         add_filter('the_content', array(__CLASS__, 'add_privacy_footer'), 9);
     }
     if (is_page('terms') && self::get_term('terms_contact')) {
         add_filter('the_content', array(__CLASS__, 'add_terms_footer'), 9);
     }
     if (is_page('terms') || is_page('privacy') || is_page('affiliates') || is_page('disclaimer')) {
         add_filter('the_content', array(__CLASS__, 'terms_filter'));
     }
 }
Example #5
0
/**
 * Removes all the actions on the entry hooks.
 *
 * @access public
 * @return void
 */
function genesis_author_pro_remove_all_entry_actions()
{
    $hooks = array('genesis_before_entry', 'genesis_entry_header', 'genesis_before_entry_content', 'genesis_entry_content', 'genesis_after_entry_content', 'genesis_entry_footer', 'genesis_after_entry');
    foreach ($hooks as $hook) {
        remove_all_actions($hook);
    }
}
Example #6
0
function kleo_sensei_title($args)
{
    $title = false;
    global $post, $wp_query;
    if (is_tax('course-category')) {
        $taxonomy_obj = $wp_query->get_queried_object();
        $taxonomy_short_name = $taxonomy_obj->taxonomy;
        $taxonomy_raw_obj = get_taxonomy($taxonomy_short_name);
        $title = sprintf(__('%1$s Archives: %2$s', 'woothemes-sensei'), $taxonomy_raw_obj->labels->name, $taxonomy_obj->name);
    }
    if (is_singular('sensei_message')) {
        $content_post_id = get_post_meta($post->ID, '_post', true);
        if ($content_post_id) {
            $title = sprintf(__('Re: %1$s', 'woothemes-sensei'), '<a href="' . get_permalink($content_post_id) . '">' . get_the_title($content_post_id) . '</a>');
        }
    }
    if (is_singular('course')) {
        remove_all_actions('sensei_course_image');
        remove_all_actions('sensei_course_single_title');
    }
    if (is_singular('lesson')) {
        remove_all_actions('sensei_lesson_image');
        remove_all_actions('sensei_lesson_single_title');
    }
    if ($title) {
        $breadcrumb_data = kleo_breadcrumb(array('show_title' => false, 'show_browse' => false, 'separator' => ' ', 'show_home' => __('Home', 'kleo_framework'), 'echo' => false));
        $breadcrumb_data = str_replace('</div>', '<span class="sep"> </span> <span class="active">' . $title . '</span> </div>', $breadcrumb_data);
        $args['output'] = str_replace('{breadcrumb_data}', $breadcrumb_data, $args['output']);
        $args['title'] = $title;
    }
    return $args;
}
 /**
  * Applies user moderation upon registration
  *
  * @since 6.0
  * @access public
  */
 function register_post()
 {
     // Remove all other filters
     remove_all_actions('tml_new_user_registered');
     // Moderate user upon registration
     add_action('tml_new_user_registered', array(&$this, 'moderate_user'), 100, 2);
 }
Example #8
0
 /**
  * setup function
  *
  * This function sets up the lessons, quizzes and their questions. This function runs before
  * every single test in this class
  */
 public function setup()
 {
     // load the factory class
     $this->factory = new Sensei_Factory();
     //remove this action so that no emails are sent during this test
     remove_all_actions('sensei_user_course_start');
 }
Example #9
0
 private function internalImport()
 {
     $app = Bootstrap::getApplication();
     $helpers = $app['helpers'];
     $baseUrl = get_option('siteurl');
     $helpers->fieldSearchReplace($this->posts, Bootstrap::NEUTRALURL, $baseUrl);
     remove_all_actions('transition_post_status');
     $done = false;
     while (!$done) {
         $deferred = 0;
         foreach ($this->posts as &$post) {
             $post->tries++;
             if (!$post->done) {
                 $parentId = $this->parentId($post->post['post_parent'], $this->posts);
                 if ($parentId || $post->post['post_parent'] == 0 || $post->tries > 9) {
                     $this->updatePost($post, $parentId);
                     $post->done = true;
                 } else {
                     $deferred++;
                 }
             }
         }
         if ($deferred == 0) {
             $done = true;
         }
     }
     $this->importMedia();
 }
 /**
  * Add the actions and filter hooks.
  *
  * @access public
  * @since  8.4
  *
  * @uses add_filter()
  * @uses add_action()
  * @uses remove_all_actions()
  */
 public function hooks()
 {
     //add_action( 'wp_head', array( $this', 'remove_head_actions'), -1 );
     add_filter('admin_url', array($this, 'admin_url'), 10, 3);
     add_filter('cn_permalink', array($this, 'permalink'), 10, 2);
     add_filter('cn_template_customizer_template', array($this, 'getTemplate'));
     //add_action( 'customize_controls_enqueue_scripts', $this->customizer, 'enqueue_scripts' );
     //add_action( 'customize_preview_init', $this->customizer, 'enqueue_template_scripts', 99 );
     add_action('customize_controls_enqueue_scripts', array($this, 'themeCompatibility'), 9999);
     //add_action( 'wp_print_styles', array( $this', 'remove_all_styles'), 9999 );
     //add_action( 'wp_print_scripts', array( $this, 'remove_all_scripts'), 9999 );
     //add_action( 'template_include', array( $this, 'customizerPage' ) );
     add_action('customize_register', array($this, 'registerSections'));
     add_action('customize_register', array($this, 'registerTemplateControls'));
     add_filter('customize_section_active', array($this, 'removeSections'), 10, 2);
     add_filter('customize_control_active', array($this, 'setActiveControls'), 10, 2);
     remove_all_actions('cn_list_actions');
     remove_all_actions('cn_entry_actions');
     add_action('cn_entry_actions', array($this, 'singleActions'), 10, 2);
     add_action('cn_template_customizer_register-card', array($this, 'search'), 10, 2);
     add_action('cn_template_customizer_register-card', array($this, 'pagination'), 10, 2);
     add_action('cn_template_customizer_register-card', array($this, 'categorySelect'), 10, 2);
     add_action('cn_action_list_before', array($this, 'instructions'));
     add_action('cn_action_list_before', array($this, 'singleView'));
     add_action('cn_action_list_before', array($this, 'categoryMessage'));
     //add_action( 'get_footer', array( $this, 'remove_footer_actions'), 9999 );
 }
Example #11
0
 public function single_lesson_handler()
 {
     global $post;
     // Preview Lessons shouldn't ignore this rule.
     if (WooThemes_Sensei_Utils::is_preview_lesson($post->ID)) {
         return;
     }
     $course_id = get_post_meta($post->ID, '_lesson_course', true);
     // User already started this course, so ideally, we shouldn't restrict access.
     if (WooThemes_Sensei_Utils::user_started_course($post->ID, wp_get_current_user()->ID)) {
         return;
     }
     // This happens if the lesson isn't locked itself.
     if (memberful_can_user_access_post(wp_get_current_user()->ID, $post->ID)) {
         if (!memberful_can_user_access_post(wp_get_current_user()->ID, $course_id)) {
             // The user doesn't have access to this post, so he shouldn't have actions on it.
             remove_all_actions('sensei_lesson_single_meta');
             // Now the funky filtering part.
             remove_action('the_content', 'memberful_wp_protect_content');
             add_action('the_content', array($this, 'single_lesson_special_content_filter'), -10);
         }
     } else {
         // The user doesn't have access to this post, so he shouldn't have actions on it.
         remove_all_actions('sensei_lesson_single_meta');
     }
 }
 /**
  * If we are in our template strip everything out and leave it clean
  * @since 1.0.0
  */
 public function remove_all_actions()
 {
     global $wp_scripts, $wp_styles;
     $exceptions = array('mailtpl-js', 'jquery', 'query-monitor', 'mailtpl-front-js', 'customize-preview', 'customize-controls');
     if (is_object($wp_scripts) && isset($wp_scripts->queue) && is_array($wp_scripts->queue)) {
         foreach ($wp_scripts->queue as $handle) {
             if (in_array($handle, $exceptions)) {
                 continue;
             }
             wp_dequeue_script($handle);
         }
     }
     if (is_object($wp_styles) && isset($wp_styles->queue) && is_array($wp_styles->queue)) {
         foreach ($wp_styles->queue as $handle) {
             if (in_array($handle, $exceptions)) {
                 continue;
             }
             wp_dequeue_style($handle);
         }
     }
     // Now remove actions
     $action_exceptions = array('wp_print_footer_scripts', 'wp_admin_bar_render');
     // No core action in header
     remove_all_actions('wp_header');
     global $wp_filter;
     foreach ($wp_filter['wp_footer'] as $priority => $handle) {
         if (in_array(key($handle), $action_exceptions)) {
             continue;
         }
         unset($wp_filter['wp_footer'][$priority]);
     }
 }
/**
 * No admin notices on our settings page
 *
 * @since 0.1.0
 */
function pootlepb_no_admin_notices()
{
    global $pagenow;
    if ('options-general.php' == $pagenow && 'page_builder' == filter_input(INPUT_GET, 'page')) {
        remove_all_actions('admin_notices');
    }
}
 public function tearDown()
 {
     wp_deregister_script(self::SERVICE_SCRIPT_HANDLE);
     remove_all_actions('wc_connect_shipping_zone_method_added');
     remove_all_actions('wc_connect_shipping_zone_method_deleted');
     remove_all_actions('wc_connect_shipping_zone_method_status_toggled');
     remove_all_actions('wc_connect_saved_service_settings');
 }
 /**
  * Provision tests
  */
 public function setUp()
 {
     parent::setUp();
     WPSEO_Frontend::get_instance()->reset();
     remove_all_actions('wpseo_opengraph');
     // start each test on the home page
     $this->go_to_home();
 }
Example #16
0
 /**
  * To improve compatibility with plugins and prevent interference.
  **/
 public static function remove_parsing_hooks()
 {
     if (!self::is_visual_editor() && !self::is_visual_editor_iframe()) {
         return;
     }
     remove_all_actions('parse_query');
     remove_all_actions('parse_request');
 }
Example #17
0
function ac_tagcat_support_query($query)
{
    if (($query->get('tag') || is_category()) && $query->is_main_query()) {
        $query->set('post_type', array('post', 'page'));
        //$query->set('posts_per_page', -1);
        remove_all_actions('__after_loop');
    }
}
 function setUp()
 {
     parent::setUp();
     WebPush_DB::add_subscription('http://localhost:55555/201', 'aKey', '89IdFKBhvi9H5LlvawK9Iw==');
     $_REQUEST['webpush_meta_box_nonce'] = wp_create_nonce('webpush_send_notification');
     $_REQUEST['webpush_send_notification'] = 1;
     remove_all_actions('transition_post_status');
 }
 /**
  * Remove all actions to wp_print_scripts since stupid themes (and plugins) want to use it as a
  * hook to enqueue scripts and plugins. Ideally we would live in a world where this wasn't necessary
  * but it is.
  * @return
  */
 public static function remove_scripts_and_styles_from_stupid_themes_and_plugins()
 {
     if (SI_Invoice::is_invoice_query() && is_single()) {
         if (apply_filters('si_remove_scripts_styles_on_doc_pages', '__return_true')) {
             remove_all_actions('wp_print_scripts');
         }
     }
 }
 function remove_other_notices()
 {
     global $parent_file;
     if (isset($parent_file) && 'wpclients' == $parent_file) {
         remove_all_actions('admin_notices');
         add_action('admin_notices', array(&$this, 'admin_notices_hook'));
     } else {
         add_action('admin_notices', array(&$this, 'admin_notices_hook_all_pages'));
     }
 }
Example #21
0
 protected function init_child_events()
 {
     add_action('genesis_header', array($this, 'render_page_header'));
     remove_action('genesis_before_content_sidebar_wrap', 'genesis_do_nav');
     remove_action('genesis_loop', 'genesis_do_loop');
     add_action('genesis_loop', array($this, 'render_sections'));
     remove_all_actions('genesis_entry_content');
     remove_all_actions('genesis_entry_footer');
     remove_all_actions('genesis_after_entry');
 }
 function etm_options($parent_id)
 {
     $this->plugin_id = $parent_id . '-opt';
     //add_submenu_page($parent_id,$this->screen_menu,$this->screen_menu,0,$this->plugin_id,array(&$this,'test'));
     add_filter("pop_admin_head_{$this->plugin_id}", array(&$this, 'create_header'), 10, 1);
     add_filter("pop-options_{$this->plugin_id}", array(&$this, 'options'), 10, 1);
     add_action('pop_handle_save', array(&$this, 'pop_handle_save11'));
     remove_all_actions('wp_ajax_pop_uploader-' . $this->plugin_id);
     add_action('wp_ajax_pop_uploader-' . $this->plugin_id, array(&$this, 'etm_pop_uploader'));
 }
Example #23
0
function startbox_child_init()
{
    //enqueue stylesheets and scripts
    wp_enqueue_style('bootstrap', get_stylesheet_directory_uri() . '/bootstrap/css/bootstrap.min.css', NULL, '3.0');
    wp_enqueue_script('bootstrap', get_stylesheet_directory_uri() . '/bootstrap/js/bootstrap.min.js', NULL, '3.0');
    wp_enqueue_style('fontawesome', get_stylesheet_directory_uri() . "/font-awesome/css/font-awesome.min.css", NULL, NULL, "all");
    //no startbox breadcrumbs
    remove_filter('bbp_no_breadcrumb', '__return_true;');
    //no prev/next from startbox. removing all actions cause we can't pinpoint the sb_post_nav method.
    remove_all_actions('sb_after_content');
}
Example #24
0
 public function admin_init()
 {
     global $gMemberNetwork;
     add_action('admin_print_styles', array($this, 'admin_print_styles'));
     add_action('personal_options', array($this, 'personal_options_late'), 99, 1);
     add_action('personal_options_update', array($this, 'edit_user_profile_update'), 10, 1);
     add_action('edit_user_profile_update', array($this, 'edit_user_profile_update'), 10, 1);
     if ($gMemberNetwork->settings->get('disable_colorschemes', TRUE)) {
         remove_all_actions('admin_color_scheme_picker');
     }
 }
Example #25
0
 public function testFiltersWithBase()
 {
     remove_all_actions('wp_redirect');
     remove_all_actions('network_site_url');
     remove_all_actions('site_url');
     update_option('ld_login_base', 'login');
     $this->object->application->renameLogin();
     $this->assertTrue(has_action('wp_redirect'));
     $this->assertTrue(has_action('network_site_url'));
     $this->assertTrue(has_action('site_url'));
 }
 function __construct(Freemius $fs)
 {
     $this->_fs = $fs;
     $this->_logger = FS_Logger::get_logger(WP_FS__SLUG . '_' . $fs->get_slug() . '_info', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK);
     // Remove default plugin information action.
     remove_all_actions('install_plugins_pre_plugin-information');
     // Override action with custom plugins function for add-ons.
     add_action('install_plugins_pre_plugin-information', array(&$this, 'install_plugin_information'));
     // Override request for plugin information for Add-ons.
     add_filter('fs_plugins_api', array(&$this, '_get_addon_info_filter'), WP_FS__DEFAULT_PRIORITY, 3);
 }
 /**
  * Constructor.
  * Setup action hooks for debugger.
  *
  * @since 2.0.0
  * @internal
  */
 public function __construct()
 {
     remove_all_actions('wdev_debug_log');
     remove_all_actions('wdev_debug_log_trace');
     remove_all_actions('wdev_debug_dump');
     remove_all_actions('wdev_debug_trace');
     add_action('wdev_debug_log', array($this, 'log'), 10, 99);
     add_action('wdev_debug_log_trace', array($this, 'log_trace'));
     add_action('wdev_debug_dump', array($this, 'dump'), 10, 99);
     add_action('wdev_debug_trace', array($this, 'trace'));
 }
/** Remove actions on before entry and setup the portfolio entry actions */
function genesis_portfolio_setup_loop()
{
    $hooks = array('genesis_before_entry', 'genesis_entry_header', 'genesis_before_entry_content', 'genesis_entry_content', 'genesis_after_entry_content', 'genesis_entry_footer', 'genesis_after_entry');
    foreach ($hooks as $hook) {
        remove_all_actions($hook);
    }
    add_action('genesis_entry_content', 'genesis_portfolio_grid');
    add_action('genesis_after_entry_content', 'genesis_entry_header_markup_open', 5);
    add_action('genesis_after_entry_content', 'genesis_entry_header_markup_close', 15);
    add_action('genesis_after_entry_content', 'genesis_do_post_title');
}
 public function check_remove_add_to_cart()
 {
     $current_role = $this->get_current_role();
     $resticted_role = WC_RBP()->get_option(rbp_key . 'hide_cart_button_role');
     if (!empty($resticted_role)) {
         if (in_array($current_role, $resticted_role)) {
             remove_all_actions('woocommerce_simple_add_to_cart');
             add_filter('woocommerce_loop_add_to_cart_link', array(&$this, 'remove_add_to_cart_link'), 99);
         }
     }
 }
Example #30
0
 public function test_customize_controls_enqueue_deps()
 {
     global $wp_scripts;
     remove_all_actions('customize_controls_enqueue_scripts');
     add_action('customize_controls_enqueue_scripts', array('Widget_Customizer', 'customize_controls_enqueue_deps'));
     do_action('customize_controls_enqueue_scripts');
     $this->assertTrue(wp_script_is('jquery-ui-sortable', 'enqueued'), 'jquery-ui-sortable script is not properly enqueued');
     $this->assertTrue(wp_script_is('jquery-ui-droppable', 'enqueued'), 'jquery-ui-droppable script is not properly enqueued');
     $this->assertTrue(wp_script_is('widget-customizer', 'enqueued'), 'widget-customizer script is not properly enqueued');
     $this->assertTrue(wp_style_is('widget-customizer', 'enqueued'), 'widget-customizer style is not properly enqueued');
     $this->assertNotEmpty($wp_scripts->get_data('widget-customizer', 'data'), 'widget-customizer data is empty');
 }