Skip to content

Commit

Permalink
Naming tidy up.
Browse files Browse the repository at this point in the history
  • Loading branch information
renintw committed Sep 15, 2023
1 parent 3e7e009 commit c4777f1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use CampTix_Plugin;

use function WordCamp\OrganizerSurvey\{get_feature_id};
use function WordCamp\OrganizerSurvey\DebriefSurvey\Email\{get_email_id};
use function WordCamp\OrganizerSurvey\DebriefSurvey\Page\{get_page_id};
use function WordCamp\OrganizerSurvey\DebriefSurvey\Email\get_email_id as get_debrief_survey_email_id;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Page\get_page_id as get_debrief_survey_page_id;

add_action( 'init', __NAMESPACE__ . '\init' );

Expand All @@ -38,7 +38,7 @@ function admin_menu() {
}

/**
* Get stats for each feedback for all sites.
* Debrief Survey: Get stats for each feedback for all sites.
*
* @return array[] An array of custom elements.
* Each element has the following structure:
Expand Down Expand Up @@ -78,18 +78,19 @@ function get_feedback_details() {

$query = new \WP_Query( array(
'post_type' => 'feedback',
'post_parent' => get_page_id(),
'post_parent' => get_debrief_survey_page_id(),
'posts_per_page' => -1,
) );

$sent = (int) $camptix->get_sent_email_count( get_email_id() ) ? 'Yes' : 'No';
$email_id = get_debrief_survey_email_id();
$sent = (int) $camptix->get_sent_email_count( $email_id ) ? 'Yes' : 'No';
$responses = (int) $query->found_posts;

$feedback_details[] = array(
'title' => $blog_details->blogname,
'admin_url' => admin_url(),
'email_url' => get_edit_post_link( get_email_id() ),
'responses_url' => admin_url( sprintf( 'edit.php?post_type=feedback&jetpack_form_parent_id=%s', get_page_id() ) ),
'email_url' => get_edit_post_link( $email_id ),
'responses_url' => admin_url( sprintf( 'edit.php?post_type=feedback&jetpack_form_parent_id=%s', get_debrief_survey_page_id() ) ),
'sent' => $sent,
'responses' => $responses,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Constants.
*/
const DAYS_AFTER_TO_SEND = 2;
const TEMP_ATTENDEE_ID = 'organizer_survey_temp_attendee';
const TEMP_ATTENDEE_ID = 'organizer_debrief_survey_temp_attendee';

/**
* Actions & hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Constants.
*/
const EMAIL_KEY_ID = 'organizer_survey_email';
const EMAIL_KEY_ID = 'organizer_debrief_survey_email';

/**
* Return the email ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/**
* Constants.
*/
const SURVEY_PAGE_ID = 'organizer_debrief_survey';
const SURVEY_PAGE_ID = 'organizer_debrief_survey_page';


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

namespace WordCamp\OrganizerSurvey;

use function WordCamp\OrganizerSurvey\DebriefSurvey\Page\{add_page, delete_page};
use function WordCamp\OrganizerSurvey\DebriefSurvey\Email\{add_email, delete_email};
use function WordCamp\OrganizerSurvey\DebriefSurvey\Cron\delete_temp_attendee;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Page\add_page as add_debrief_survey_page;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Page\delete_page as delete_debrief_survey_page;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Email\add_email as add_debrief_survey_email;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Email\delete_email as delete_debrief_survey_email;
use function WordCamp\OrganizerSurvey\DebriefSurvey\Cron\delete_temp_attendee as delete_debrief_survey_temp_attendee;

defined( 'WPINC' ) || die();

Expand Down Expand Up @@ -53,7 +55,9 @@ function load() {
}

if ( is_wordcamp_type( 'next-gen' ) ) {
require_once get_includes_path() . 'cron.php';
// Debrief Survey.
require_once get_includes_path() . 'debrief-survey/cron.php';

add_action( 'init', __NAMESPACE__ . '\activate_on_current_site' );
}
}
Expand All @@ -64,8 +68,9 @@ function load() {
* @return void
*/
function activate_on_current_site() {
add_page();
add_email();
// Debrief Survey.
add_debrief_survey_page();
add_debrief_survey_email();

// Flushing the rewrite rules is buggy in the context of `switch_to_blog`.
// The rules will automatically get recreated on the next request to the site.
Expand Down Expand Up @@ -108,9 +113,10 @@ function deactivate_on_network() {
* @return void
*/
function deactivate_on_current_site() {
delete_page();
delete_email();
delete_temp_attendee();
// Debrief Survey.
delete_debrief_survey_page();
delete_debrief_survey_email();
delete_debrief_survey_temp_attendee();
}

/**
Expand Down

0 comments on commit c4777f1

Please sign in to comment.