本文整理汇总了PHP中remove_all_actions函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_all_actions函数的具体用法?PHP remove_all_actions怎么用?PHP remove_all_actions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_all_actions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: custom_save_comment_wp
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;
}
示例2: avia_clear_import
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');
}
示例3: init
/**
* 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);
}
}
}
示例4: prepare
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'));
}
}
示例5: genesis_author_pro_remove_all_entry_actions
/**
* 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);
}
}
示例6: kleo_sensei_title
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;
}
示例7: register_post
/**
* 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);
}
示例8: setup
/**
* 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');
}
示例9: internalImport
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();
}
示例10: hooks
/**
* 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 );
}
示例11: single_lesson_handler
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');
}
}
示例12: remove_all_actions
/**
* 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]);
}
}
示例13: pootlepb_no_admin_notices
/**
* 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');
}
}
示例14: tearDown
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');
}
示例15: setUp
/**
* 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();
}