mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-01 08:41:18 +03:00
Apply coding standards.
This commit is contained in:
parent
33d8ed54b1
commit
f888fd85c8
|
@ -106,11 +106,11 @@ function populate_list_table_columns( $column, $post_id ) {
|
||||||
$pledge_name = sprintf(
|
$pledge_name = sprintf(
|
||||||
'<a href="%1$s">%2$s</a>',
|
'<a href="%1$s">%2$s</a>',
|
||||||
get_edit_post_link( $pledge ),
|
get_edit_post_link( $pledge ),
|
||||||
$pledge_name
|
esc_html( $pledge_name )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $pledge_name;
|
echo wp_kses_post( $pledge_name );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ use WordPressDotOrg\FiveForTheFuture\Pledge;
|
||||||
|
|
||||||
defined( 'WPINC' ) || die();
|
defined( 'WPINC' ) || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue scripts and styles.
|
||||||
|
*/
|
||||||
function enqueue_scripts() {
|
function enqueue_scripts() {
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
|
@ -36,8 +39,12 @@ function enqueue_scripts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array(
|
$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_type' => Pledge\CPT_ID,
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'posts_per_page' => 100,
|
'posts_per_page' => 100,
|
||||||
|
@ -72,7 +79,7 @@ function enqueue_scripts() {
|
||||||
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts' );
|
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* todo
|
* Todo.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -87,9 +94,12 @@ function render_shortcode() {
|
||||||
|
|
||||||
add_shortcode( 'five_for_the_future_companies', __NAMESPACE__ . '\render_shortcode' );
|
add_shortcode( 'five_for_the_future_companies', __NAMESPACE__ . '\render_shortcode' );
|
||||||
|
|
||||||
// shortcode for pledge form
|
// todo shortcode for pledge form.
|
||||||
// form handler for pledge form
|
// todo form handler for pledge form.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Todo.
|
||||||
|
*/
|
||||||
function register() {
|
function register() {
|
||||||
//register_block_type();
|
//register_block_type();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\PledgeForm;
|
namespace WordPressDotOrg\FiveForTheFuture\PledgeForm;
|
||||||
|
|
||||||
use WordPressDotOrg\FiveForTheFuture;
|
use WordPressDotOrg\FiveForTheFuture;
|
||||||
use WordPressDotOrg\FiveForTheFuture\Pledge;
|
use WordPressDotOrg\FiveForTheFuture\{ Pledge, PledgeMeta, Contributor };
|
||||||
use WordPressDotOrg\FiveForTheFuture\PledgeMeta;
|
use WP_Error, WP_User;
|
||||||
use WordPressDotOrg\FiveForTheFuture\Contributor;
|
|
||||||
use WP_Error, WP_Post, WP_User;
|
|
||||||
|
|
||||||
defined( 'WPINC' ) || die();
|
defined( 'WPINC' ) || die();
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ function save_pledge( $pledge_id, $pledge ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! current_user_can( 'edit_pledge', $pledge_id ) ) {
|
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;
|
//return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ function save_pledge_meta( $pledge_id, $new_values ) {
|
||||||
foreach ( $new_values as $key => $value ) {
|
foreach ( $new_values as $key => $value ) {
|
||||||
if ( array_key_exists( $key, $config ) ) {
|
if ( array_key_exists( $key, $config ) ) {
|
||||||
$meta_key = META_PREFIX . $key;
|
$meta_key = META_PREFIX . $key;
|
||||||
|
|
||||||
// Since the sanitize callback is called during this function, it could still end up
|
// Since the sanitize callback is called during this function, it could still end up
|
||||||
// saving an empty value to the database.
|
// saving an empty value to the database.
|
||||||
update_post_meta( $pledge_id, $meta_key, $value );
|
update_post_meta( $pledge_id, $meta_key, $value );
|
||||||
|
|
|
@ -34,6 +34,7 @@ function register() {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function admin_menu() {
|
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 );
|
remove_submenu_page( 'edit.php?post_type=' . CPT_ID, 'post-new.php?post_type=' . CPT_ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const PREFIX = '5ftf';
|
||||||
add_action( 'plugins_loaded', __NAMESPACE__ . '\load' );
|
add_action( 'plugins_loaded', __NAMESPACE__ . '\load' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Include the rest of the plugin.
|
||||||
*/
|
*/
|
||||||
function load() {
|
function load() {
|
||||||
require_once get_includes_path() . 'contributor.php';
|
require_once get_includes_path() . 'contributor.php';
|
||||||
|
|
|
@ -19,11 +19,11 @@ if ( ! $core_tests_directory ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once( $core_tests_directory . '/includes/functions.php' );
|
require_once $core_tests_directory . '/includes/functions.php';
|
||||||
require_once( dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php' );
|
require_once dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php';
|
||||||
|
|
||||||
tests_add_filter( 'muplugins_loaded', function() {
|
tests_add_filter( 'muplugins_loaded', function() {
|
||||||
require_once( dirname( __DIR__ ) . '/index.php' );
|
require_once dirname( __DIR__ ) . '/index.php';
|
||||||
} );
|
} );
|
||||||
|
|
||||||
require_once( $core_tests_directory . '/includes/bootstrap.php' );
|
require_once $core_tests_directory . '/includes/bootstrap.php';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
|
||||||
|
|
||||||
|
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
use function WordPressDotOrg\FiveForTheFuture\get_views_path;
|
use function WordPressDotOrg\FiveForTheFuture\get_views_path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php // todo i18n
|
<?php // todo i18n
|
||||||
//// change all id/class prefixes to fftf (or something better) b/c not valid to start w/ number
|
//// change all id/class prefixes to fftf (or something better) b/c not valid to start w/ number.
|
||||||
|
|
||||||
// TODO are we using this, or is all the front end stuff happening in the 5ftF theme now?
|
// TODO are we using this, or is all the front end stuff happening in the 5ftF theme now?
|
||||||
?>
|
?>
|
||||||
|
@ -7,29 +7,34 @@
|
||||||
<article class="5ftf">
|
<article class="5ftf">
|
||||||
<section class="about">
|
<section class="about">
|
||||||
<h3>
|
<h3>
|
||||||
<?php _e( 'Five for the Future', 'wordpressdotorg' ); ?>
|
<?php esc_html_e( 'Five for the Future', 'wporg-5ftf' ); ?>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php _e( 'Many companies in the WordPress ecosystem choose to contribute 5% of their time back towards sustaining and improving the WordPress project. This helps to ensure that WordPress remains a vibrant platform to build a business on, and prevents a <a href="">tragedy of the commons</a>.', 'wordpressdotorg' ); ?>
|
<?php wp_kses_post(
|
||||||
<?php // link to CTA page ?>
|
__( 'Many companies in the WordPress ecosystem choose to contribute 5% of their time back towards sustaining and improving the WordPress project. This helps to ensure that WordPress remains a vibrant platform to build a business on, and prevents a <a href="todo">tragedy of the commons</a>.', 'wporg-5ftf' )
|
||||||
|
); ?>
|
||||||
|
<?php // todo link to CTA page. ?>
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="people">
|
<section class="people">
|
||||||
<h3>
|
<h3>
|
||||||
<?php _e( 'Thank you to all of the companies that participate in Five for the Future.', 'wordpressdotorg' ); ?>
|
<?php esc_html_e( 'Thank you to all of the companies that participate in Five for the Future.', 'wporg-5ftf' ); ?>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<?php /*
|
<?php
|
||||||
// sort filter options
|
/*
|
||||||
// this should be js - backbone or react? react
|
* todo.
|
||||||
// in page or api? start in page, can iterate later to add infinite scroll or something
|
* sort filter options.
|
||||||
*/ ?>
|
* this should be js - backbone or react? react.
|
||||||
|
* in page or api? start in page, can iterate later to add infinite scroll or something.
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
<label for="5ftf-search">
|
<label for="5ftf-search">
|
||||||
<?php _e( 'Search:' ); ?>
|
<?php esc_html_e( 'Search:', 'wporg-5ftf' ); ?>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" id="5ftf-search" name="5ftf-search" />
|
<input type="text" id="5ftf-search" name="5ftf-search" />
|
||||||
|
@ -56,7 +61,7 @@
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Teams Contributing To
|
Teams Contributing To
|
||||||
<?php // This can't really be sorted in a meaningful way, since multiple teams are listed here ?>
|
<?php // This can't really be sorted in a meaningful way, since multiple teams are listed here. ?>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -64,7 +69,7 @@
|
||||||
<tbody id="5ftf-companies-body">
|
<tbody id="5ftf-companies-body">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
<?php _e( 'Loading…' ); ?>
|
<?php esc_html_e( 'Loading…', 'wporg-5ftf' ); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -96,6 +101,6 @@
|
||||||
|
|
||||||
<p>Have a question? Ready to get started? Get in touch and we'll help you find where you're needed the most.</p>
|
<p>Have a question? Ready to get started? Get in touch and we'll help you find where you're needed the most.</p>
|
||||||
|
|
||||||
<?php // link to pledge form ?>
|
<?php // todo link to pledge form. ?>
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
|
|
@ -28,11 +28,11 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
|
||||||
<div class="5ftf-contributors">
|
<div class="5ftf-contributors">
|
||||||
<?php foreach ( $contributors as $status => $group ) : ?>
|
<?php foreach ( $contributors as $contributor_status => $group ) : ?>
|
||||||
<?php if ( ! empty( $group ) ) : ?>
|
<?php if ( ! empty( $group ) ) : ?>
|
||||||
<h3 class="contributor-list-heading">
|
<h3 class="contributor-list-heading">
|
||||||
<?php
|
<?php
|
||||||
switch ( $status ) {
|
switch ( $contributor_status ) {
|
||||||
case 'pending':
|
case 'pending':
|
||||||
esc_html_e( 'Unconfirmed', 'wporg' );
|
esc_html_e( 'Unconfirmed', 'wporg' );
|
||||||
break;
|
break;
|
||||||
|
@ -43,13 +43,13 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
?>
|
?>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<ul class="contributor-list <?php echo esc_attr( $status ); ?>">
|
<ul class="contributor-list <?php echo esc_attr( $contributor_status ); ?>">
|
||||||
<?php foreach ( $group as $contributor_post ) :
|
<?php foreach ( $group as $contributor_post ) :
|
||||||
$contributor = get_user_by( 'login', $contributor_post->post_title );
|
$contributor = get_user_by( 'login', $contributor_post->post_title );
|
||||||
?>
|
?>
|
||||||
<li>
|
<li>
|
||||||
<?php echo get_avatar( $contributor->user_email, 32 ); ?>
|
<?php echo get_avatar( $contributor->user_email, 32 ); ?>
|
||||||
<?php echo $contributor_post->post_title; ?>
|
<?php echo esc_html( $contributor_post->post_title ); ?>
|
||||||
<!-- TODO These buttons don't do anything yet.
|
<!-- TODO These buttons don't do anything yet.
|
||||||
<button class="button-primary" data-action="remove" data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>">
|
<button class="button-primary" data-action="remove" data-contributor-post="<?php echo esc_attr( $contributor_post->ID ); ?>">
|
||||||
<?php esc_html_e( 'Remove', 'wporg' ); ?>
|
<?php esc_html_e( 'Remove', 'wporg' ); ?>
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||||
I understand and agree to the <a href="%s">expectations</a> for
|
I understand and agree to the <a href="%s">expectations</a> for
|
||||||
inclusion in the Five for the Future acknowledgement program.
|
inclusion in the Five for the Future acknowledgement program.
|
||||||
' ),
|
' ),
|
||||||
get_permalink( get_page_by_path( 'expectations' ) ) // TODO Change this URL?
|
esc_url( get_permalink( get_page_by_path( 'expectations' ) ) ) // TODO Change this URL?
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue