Changeset 2272
- Timestamp:
- 01/11/2016 10:15:37 PM (9 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
- Files:
-
- 1 deleted
- 4 edited
- 1 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/bootstrap.php
r1947 r2272 1 1 <?php 2 2 /* 3 Plugin Name: WordCamp Payments3 Plugin Name: WordCamp Budgets 4 4 Plugin URI: http://wordcamp.org/ 5 Description: Provides tools for collecting and processing payment requests from WordCamp organizers. 6 Author: tellyworth, iandunn 5 Description: Provides tools for managing WordCamp budgets, sponsor invoices, and payment requests. 6 Author: WordCamp.org 7 Author URI: https://wordcamp.org 7 8 Version: 0.1 8 9 */ … … 13 14 14 15 if ( is_admin() ) { 15 require_once( __DIR__ . '/ classes/wordcamp-payments.php' );16 require_once( __DIR__ . '/ classes/payment-request.php' );17 require_once( __DIR__ . '/ classes/encryption.php' );16 require_once( __DIR__ . '/includes/wordcamp-budgets.php' ); 17 require_once( __DIR__ . '/includes/payment-request.php' ); 18 require_once( __DIR__ . '/includes/encryption.php' ); 18 19 19 $GLOBALS['wordcamp_ payments'] = new WordCamp_Payments();20 $GLOBALS['wordcamp_budgets'] = new WordCamp_Budgets(); 20 21 $GLOBALS['wcp_payment_request'] = new WCP_Payment_Request(); 21 22 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css
r2255 r2272 28 28 } 29 29 30 31 /* 32 * Log 33 */ 30 34 #wcp_log .inside { 31 35 margin: 0; -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php
r2201 r2272 941 941 $incomplete_text = get_post_meta( $post->ID, '_wcp_incomplete_notes', true ); 942 942 $incomplete_text = preg_replace( '#\.$#', '', $incomplete_text ); // trailing-undot-it. 943 WordCamp_ Payments::log( $post->ID, sprintf( 'Marked as incomplete by %s: %s.', $user->display_name, $incomplete_text ), array(943 WordCamp_Budgets::log( $post->ID, sprintf( 'Marked as incomplete by %s: %s.', $user->display_name, $incomplete_text ), array( 944 944 'user_id' => $user->ID, 945 945 'action' => 'marked-incomplete', … … 947 947 ) ); 948 948 } elseif ( $new == 'paid' && $old != 'paid' ) { 949 WordCamp_ Payments::log( $post->ID, sprintf( 'Marked as paid by %s.', $user->display_name ), array(949 WordCamp_Budgets::log( $post->ID, sprintf( 'Marked as paid by %s.', $user->display_name ), array( 950 950 'user_id' => $user->ID, 951 951 'action' => 'marked-paid', 952 952 ) ); 953 953 } elseif ( $old == 'auto-draft' && $new != 'auto-draft' ) { 954 WordCamp_ Payments::log( $post->ID, sprintf( 'Request created by %s.', $user->display_name ), array(954 WordCamp_Budgets::log( $post->ID, sprintf( 'Request created by %s.', $user->display_name ), array( 955 955 'user_id' => $user->ID, 956 956 'action' => 'updated', 957 957 ) ); 958 958 } else { 959 WordCamp_ Payments::log( $post->ID, sprintf( 'Request updated by %s.', $user->display_name ), array(959 WordCamp_Budgets::log( $post->ID, sprintf( 'Request updated by %s.', $user->display_name ), array( 960 960 'user_id' => $user->ID, 961 961 'action' => 'updated', … … 982 982 } 983 983 984 remove_action( 'save_post', array( $this, 'save_payment' ), 10 , 2); // avoid infinite recursion984 remove_action( 'save_post', array( $this, 'save_payment' ), 10 ); // avoid infinite recursion 985 985 986 986 foreach( $files as $file_id ) { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r2270 r2272 4 4 * Main class to provide functionality common to all other classes 5 5 */ 6 class WordCamp_ Payments {6 class WordCamp_Budgets { 7 7 const VERSION = '0.1.1'; 8 8 … … 24 24 // Register our assets 25 25 wp_register_script( 26 'wordcamp- payments',27 plugins_url( 'javascript/wordcamp- payments.js', __DIR__ ),26 'wordcamp-budgets', 27 plugins_url( 'javascript/wordcamp-budgets.js', __DIR__ ), 28 28 array( 'jquery', 'jquery-ui-datepicker', 'media-upload', 'media-views' ), 29 29 self::VERSION, … … 34 34 'wcp-attached-files', 35 35 plugins_url( 'javascript/attached-files.js', __DIR__ ), 36 array( 'wordcamp- payments', 'backbone', 'wp-util' ),36 array( 'wordcamp-budgets', 'backbone', 'wp-util' ), 37 37 self::VERSION, 38 38 true … … 46 46 47 47 wp_register_style( 48 'wordcamp- payments',49 plugins_url( 'css/wordcamp- payments.css', __DIR__ ),48 'wordcamp-budgets', 49 plugins_url( 'css/wordcamp-budgets.css', __DIR__ ), 50 50 $soft_deps, 51 51 self::VERSION … … 56 56 57 57 if ( in_array( $current_screen->id, array( 'edit-wcp_payment_request', 'wcp_payment_request' ) ) ) { 58 wp_enqueue_script( 'wordcamp- payments' );59 wp_enqueue_style( 'wordcamp- payments' );58 wp_enqueue_script( 'wordcamp-budgets' ); 59 wp_enqueue_style( 'wordcamp-budgets' ); 60 60 61 61 if ( in_array( $current_screen->id, array( 'wcp_payment_request' ) ) && isset( $post->ID ) ) { … … 65 65 66 66 wp_localize_script( 67 'wordcamp- payments',68 'wcpLocalizedStrings', // todo merge into wordcamp Payments var67 'wordcamp-budgets', 68 'wcpLocalizedStrings', // todo merge into wordcampBudgets var 69 69 array( 70 70 'uploadModalTitle' => __( 'Attach Supporting Documentation', 'wordcamporg' ), … … 76 76 77 77 /** 78 * Log something with a payment request.78 * Insert an entry into a log for one of the custom post types 79 79 * 80 * @param int $post_id The payment requset ID.80 * @param int $post_id The post ID. 81 81 * @param string $message A log message. 82 * @param array $dataOptional data.82 * @param array $data Optional data. 83 83 */ 84 84 public static function log( $post_id, $message, $data = array() ) { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/attached-files.js
r1940 r2272 4 4 * Model for an attached file 5 5 */ 6 $.wordcamp Payments.AttachedFile = Backbone.Model.extend( {6 $.wordcampBudgets.AttachedFile = Backbone.Model.extend( { 7 7 defaults: { 8 8 'ID': 0, … … 16 16 * Collection of attached files 17 17 */ 18 $.wordcamp Payments.AttachedFiles = Backbone.Collection.extend( {19 model: $.wordcamp Payments.AttachedFile18 $.wordcampBudgets.AttachedFiles = Backbone.Collection.extend( { 19 model: $.wordcampBudgets.AttachedFile 20 20 } ); 21 21 … … 23 23 * View for a single attached file 24 24 */ 25 $.wordcamp Payments.AttachedFileView = Backbone.View.extend( {25 $.wordcampBudgets.AttachedFileView = Backbone.View.extend( { 26 26 tagName: 'li', 27 27 template: wp.template( 'wcp-attached-file' ), … … 40 40 * View for a collection of attached files 41 41 */ 42 $.wordcamp Payments.AttachedFilesView = Backbone.View.extend( {42 $.wordcampBudgets.AttachedFilesView = Backbone.View.extend( { 43 43 el: $( '#wcp_files' ), 44 44 … … 46 46 _.bindAll( this, 'render', 'appendFile' ); 47 47 48 this.collection = new $.wordcamp Payments.AttachedFiles( wcpAttachedFiles );48 this.collection = new $.wordcampBudgets.AttachedFiles( wcpAttachedFiles ); 49 49 this.collection.bind( 'add', this.appendFile ); 50 50 … … 62 62 appendFile: function( file ) { 63 63 var noFilesUploaded = $( '.wcp_no_files_uploaded' ); 64 var attachedFileView = new $.wordcamp Payments.AttachedFileView( { model: file } );64 var attachedFileView = new $.wordcampBudgets.AttachedFileView( { model: file } ); 65 65 66 66 $( '.wcp_files_list' ).append( attachedFileView.render().el ); … … 79 79 * Files that are already attached to other posts are ignored. 80 80 * 81 * @param {wordcamp Payments.AttachedFile} file81 * @param {wordcampBudgets.AttachedFile} file 82 82 */ 83 83 attachExistingFile: function( file ) { … … 98 98 } ); 99 99 100 $.wordcamp Payments.attachedFilesView = new $.wordcampPayments.AttachedFilesView();100 $.wordcampBudgets.attachedFilesView = new $.wordcampBudgets.AttachedFilesView(); 101 101 102 102 } ); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/wordcamp-budgets.js
r2255 r2272 1 1 jQuery( document ).ready( function( $ ) { 2 2 3 $.wordcamp Payments = {3 $.wordcampBudgets = { 4 4 5 5 /** … … 7 7 */ 8 8 init: function () { 9 $.wordcamp Payments.registerEventHandlers();10 $.wordcamp Payments.setupDatePicker();9 $.wordcampBudgets.registerEventHandlers(); 10 $.wordcampBudgets.setupDatePicker(); 11 11 }, 12 12 … … 15 15 */ 16 16 registerEventHandlers : function() { 17 $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcamp Payments.togglePaymentMethodFields );18 $( '#payment_category' ).change( $.wordcamp Payments.toggleOtherCategoryDescription );19 $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcamp Payments.showUploadModal );20 $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcamp Payments.requireNotes );17 $( '#wcp_payment_details' ).find( 'input[name=payment_method]' ).change( $.wordcampBudgets.togglePaymentMethodFields ); 18 $( '#payment_category' ).change( $.wordcampBudgets.toggleOtherCategoryDescription ); 19 $( '#wcp_files' ).find( 'a.wcp-insert-media' ).click( $.wordcampBudgets.showUploadModal ); 20 $( '#wcp_mark_incomplete_checkbox' ).click( $.wordcampBudgets.requireNotes ); 21 21 }, 22 22 … … 61 61 */ 62 62 showUploadModal : function( event ) { 63 if ( 'undefined' == typeof $.wordcamp Payments.fileUploadFrame ) {63 if ( 'undefined' == typeof $.wordcampBudgets.fileUploadFrame ) { 64 64 // Create the frame 65 $.wordcamp Payments.fileUploadFrame = wp.media( {65 $.wordcampBudgets.fileUploadFrame = wp.media( { 66 66 title: wcpLocalizedStrings.uploadModalTitle, 67 67 multiple: true, … … 72 72 73 73 // Add models to the collection for each selected attachment 74 $.wordcamp Payments.fileUploadFrame.on( 'select', $.wordcampPayments.addSelectedFilesToCollection );74 $.wordcampBudgets.fileUploadFrame.on( 'select', $.wordcampBudgets.addSelectedFilesToCollection ); 75 75 } 76 76 77 $.wordcamp Payments.fileUploadFrame.open();77 $.wordcampBudgets.fileUploadFrame.open(); 78 78 return false; 79 79 }, … … 83 83 */ 84 84 addSelectedFilesToCollection : function() { 85 var attachments = $.wordcamp Payments.fileUploadFrame.state().get( 'selection' ).toJSON();85 var attachments = $.wordcampBudgets.fileUploadFrame.state().get( 'selection' ).toJSON(); 86 86 87 87 $.each( attachments, function( index, attachment ) { 88 var newFile = new $.wordcamp Payments.AttachedFile( {88 var newFile = new $.wordcampBudgets.AttachedFile( { 89 89 'ID': attachment.id, 90 90 'post_parent': attachment.uploadedTo, … … 93 93 } ); 94 94 95 $.wordcamp Payments.attachedFilesView.collection.add( newFile );95 $.wordcampBudgets.attachedFilesView.collection.add( newFile ); 96 96 } ); 97 97 }, … … 127 127 }; 128 128 129 $.wordcamp Payments.init();129 $.wordcampBudgets.init(); 130 130 } ); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-files.php
r995 r2272 27 27 </script> 28 28 29 <?php wp_localize_script( 'wcp-attached-files', 'wcpAttachedFiles', $files ); // todo merge into wordcamp Payments var ?>29 <?php wp_localize_script( 'wcp-attached-files', 'wcpAttachedFiles', $files ); // todo merge into wordcampBudgets var ?> 30 30 </td> 31 31 </tr>
Note: See TracChangeset
for help on using the changeset viewer.