mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-10 04:25:44 +03:00
Apply coding standards.
This commit is contained in:
parent
33d8ed54b1
commit
f888fd85c8
11 changed files with 57 additions and 42 deletions
|
@ -106,11 +106,11 @@ function populate_list_table_columns( $column, $post_id ) {
|
|||
$pledge_name = sprintf(
|
||||
'<a href="%1$s">%2$s</a>',
|
||||
get_edit_post_link( $pledge ),
|
||||
$pledge_name
|
||||
esc_html( $pledge_name )
|
||||
);
|
||||
}
|
||||
|
||||
echo $pledge_name;
|
||||
echo wp_kses_post( $pledge_name );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@ use WordPressDotOrg\FiveForTheFuture\Pledge;
|
|||
|
||||
defined( 'WPINC' ) || die();
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*/
|
||||
function enqueue_scripts() {
|
||||
global $post;
|
||||
|
||||
|
@ -36,8 +39,12 @@ function enqueue_scripts() {
|
|||
}
|
||||
|
||||
$params = array(
|
||||
// explain 100 is just sanity limit to keep page size performant. might need to lazy-load more in the future
|
||||
// maybe order by donated_employees, or rand, to ensure the top companies are always displayed first, or to make sure treta everyone equal
|
||||
/*
|
||||
* todo explain 100 is just sanity limit to keep page size performant. might need to lazy-load more in the
|
||||
* future.
|
||||
* maybe order by donated_employees, or rand, to ensure the top companies are always displayed first, or
|
||||
* to make sure treat everyone equal.
|
||||
*/
|
||||
'post_type' => Pledge\CPT_ID,
|
||||
'post_status' => 'publish',
|
||||
'posts_per_page' => 100,
|
||||
|
@ -72,7 +79,7 @@ function enqueue_scripts() {
|
|||
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts' );
|
||||
|
||||
/**
|
||||
* todo
|
||||
* Todo.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@ -87,9 +94,12 @@ function render_shortcode() {
|
|||
|
||||
add_shortcode( 'five_for_the_future_companies', __NAMESPACE__ . '\render_shortcode' );
|
||||
|
||||
// shortcode for pledge form
|
||||
// form handler for pledge form
|
||||
// todo shortcode for pledge form.
|
||||
// todo form handler for pledge form.
|
||||
|
||||
/**
|
||||
* Todo.
|
||||
*/
|
||||
function register() {
|
||||
//register_block_type();
|
||||
}
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
namespace WordPressDotOrg\FiveForTheFuture\PledgeForm;
|
||||
|
||||
use WordPressDotOrg\FiveForTheFuture;
|
||||
use WordPressDotOrg\FiveForTheFuture\Pledge;
|
||||
use WordPressDotOrg\FiveForTheFuture\PledgeMeta;
|
||||
use WordPressDotOrg\FiveForTheFuture\Contributor;
|
||||
use WP_Error, WP_Post, WP_User;
|
||||
use WordPressDotOrg\FiveForTheFuture\{ Pledge, PledgeMeta, Contributor };
|
||||
use WP_Error, WP_User;
|
||||
|
||||
defined( 'WPINC' ) || die();
|
||||
|
||||
|
@ -23,11 +21,11 @@ add_shortcode( '5ftf_pledge_form_manage', __NAMESPACE__ . '\render_form_manage'
|
|||
* @return false|string
|
||||
*/
|
||||
function render_form_new() {
|
||||
$action = filter_input( INPUT_POST, 'action' );
|
||||
$data = get_form_submission();
|
||||
$messages = [];
|
||||
$complete = false;
|
||||
$directory_url = get_permalink( get_page_by_path( 'pledges') );
|
||||
$action = filter_input( INPUT_POST, 'action' );
|
||||
$data = get_form_submission();
|
||||
$messages = [];
|
||||
$complete = false;
|
||||
$directory_url = get_permalink( get_page_by_path( 'pledges' ) );
|
||||
|
||||
if ( 'Submit Pledge' === $action ) {
|
||||
$processed = process_form_new();
|
||||
|
|
|
@ -196,7 +196,7 @@ function save_pledge( $pledge_id, $pledge ) {
|
|||
}
|
||||
|
||||
if ( ! current_user_can( 'edit_pledge', $pledge_id ) ) {
|
||||
// todo re-enable once setup cap mapping or whatever
|
||||
// todo re-enable once setup cap mapping or whatever.
|
||||
//return;
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,7 @@ function save_pledge_meta( $pledge_id, $new_values ) {
|
|||
foreach ( $new_values as $key => $value ) {
|
||||
if ( array_key_exists( $key, $config ) ) {
|
||||
$meta_key = META_PREFIX . $key;
|
||||
|
||||
// Since the sanitize callback is called during this function, it could still end up
|
||||
// saving an empty value to the database.
|
||||
update_post_meta( $pledge_id, $meta_key, $value );
|
||||
|
|
|
@ -34,6 +34,7 @@ function register() {
|
|||
* @return void
|
||||
*/
|
||||
function admin_menu() {
|
||||
// New pledges should only be created through the front end form.
|
||||
remove_submenu_page( 'edit.php?post_type=' . CPT_ID, 'post-new.php?post_type=' . CPT_ID );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue