- +
- tragedy of the commons.', 'wordpressdotorg' ); ?> - + tragedy of the commons.', 'wporg-5ftf' ) + ); ?> +
diff --git a/plugins/wporg-5ftf/includes/contributor.php b/plugins/wporg-5ftf/includes/contributor.php
index 64ae51b..2bb5099 100644
--- a/plugins/wporg-5ftf/includes/contributor.php
+++ b/plugins/wporg-5ftf/includes/contributor.php
@@ -106,11 +106,11 @@ function populate_list_table_columns( $column, $post_id ) {
$pledge_name = sprintf(
'%2$s',
get_edit_post_link( $pledge ),
- $pledge_name
+ esc_html( $pledge_name )
);
}
- echo $pledge_name;
+ echo wp_kses_post( $pledge_name );
break;
}
}
diff --git a/plugins/wporg-5ftf/includes/directory.php b/plugins/wporg-5ftf/includes/directory.php
index e9dcf2b..d35ee70 100755
--- a/plugins/wporg-5ftf/includes/directory.php
+++ b/plugins/wporg-5ftf/includes/directory.php
@@ -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();
}
diff --git a/plugins/wporg-5ftf/includes/pledge-form.php b/plugins/wporg-5ftf/includes/pledge-form.php
index 6f7fe03..ef32532 100755
--- a/plugins/wporg-5ftf/includes/pledge-form.php
+++ b/plugins/wporg-5ftf/includes/pledge-form.php
@@ -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();
diff --git a/plugins/wporg-5ftf/includes/pledge-meta.php b/plugins/wporg-5ftf/includes/pledge-meta.php
index 3f4f371..902c738 100755
--- a/plugins/wporg-5ftf/includes/pledge-meta.php
+++ b/plugins/wporg-5ftf/includes/pledge-meta.php
@@ -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 );
diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php
index 72db577..52aa0f8 100755
--- a/plugins/wporg-5ftf/includes/pledge.php
+++ b/plugins/wporg-5ftf/includes/pledge.php
@@ -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 );
}
diff --git a/plugins/wporg-5ftf/index.php b/plugins/wporg-5ftf/index.php
index 49d6b5b..69a239e 100755
--- a/plugins/wporg-5ftf/index.php
+++ b/plugins/wporg-5ftf/index.php
@@ -20,7 +20,7 @@ const PREFIX = '5ftf';
add_action( 'plugins_loaded', __NAMESPACE__ . '\load' );
/**
- *
+ * Include the rest of the plugin.
*/
function load() {
require_once get_includes_path() . 'contributor.php';
diff --git a/plugins/wporg-5ftf/tests/bootstrap.php b/plugins/wporg-5ftf/tests/bootstrap.php
index 5d39918..1fb3a7f 100755
--- a/plugins/wporg-5ftf/tests/bootstrap.php
+++ b/plugins/wporg-5ftf/tests/bootstrap.php
@@ -19,11 +19,11 @@ if ( ! $core_tests_directory ) {
return;
}
-require_once( $core_tests_directory . '/includes/functions.php' );
-require_once( dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php' );
+require_once $core_tests_directory . '/includes/functions.php';
+require_once dirname( dirname( $core_tests_directory ) ) . '/build/wp-admin/includes/plugin.php';
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';
diff --git a/plugins/wporg-5ftf/views/form-pledge-new.php b/plugins/wporg-5ftf/views/form-pledge-new.php
index c23ec62..e5977d4 100755
--- a/plugins/wporg-5ftf/views/form-pledge-new.php
+++ b/plugins/wporg-5ftf/views/form-pledge-new.php
@@ -1,6 +1,6 @@
@@ -7,29 +7,34 @@
- tragedy of the commons.', 'wordpressdotorg' ); ?>
-
+ tragedy of the commons.', 'wporg-5ftf' )
+ ); ?>
+
-
+
-
+
-
+