From 3e0ff89df837dea6f5d139ece2a164e27d3f71d1 Mon Sep 17 00:00:00 2001 From: Edsel Date: Tue, 24 Apr 2018 18:45:04 +0530 Subject: [PATCH 1/4] GEP-101 Modified info.xml --- info.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.xml b/info.xml index c71f74e..5d3fefa 100644 --- a/info.xml +++ b/info.xml @@ -16,11 +16,11 @@ JMA Consulting joe.murray@jmaconsulting.biz - 2016-03-30 - 1.5 + 2018-04-25 + 1.6 stable - 4.7 + 5.0 From d99abe2f171d537888be302f9e6e2ec68780fdff Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 23 May 2018 18:25:37 +0530 Subject: [PATCH 2/4] GEP-101 Added plugin to render grant application page --- .../grant_application_shortcode.php | 44 +++++++ .../grant_application_shortcode.php~ | 57 ++++++++ .../grant_application_shortcode_modal.php~ | 122 ++++++++++++++++++ 3 files changed, 223 insertions(+) create mode 100644 plugins/grant_application_shortcode/grant_application_shortcode.php create mode 100644 plugins/grant_application_shortcode/grant_application_shortcode.php~ create mode 100644 plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ diff --git a/plugins/grant_application_shortcode/grant_application_shortcode.php b/plugins/grant_application_shortcode/grant_application_shortcode.php new file mode 100644 index 0000000..53481a9 --- /dev/null +++ b/plugins/grant_application_shortcode/grant_application_shortcode.php @@ -0,0 +1,44 @@ +fetch()) { + $data['title'] = $dao->title; + $data['text'] = $dao->intro_text; + } + return $data; + } + } + +} + +?> \ No newline at end of file diff --git a/plugins/grant_application_shortcode/grant_application_shortcode.php~ b/plugins/grant_application_shortcode/grant_application_shortcode.php~ new file mode 100644 index 0000000..c0da22f --- /dev/null +++ b/plugins/grant_application_shortcode/grant_application_shortcode.php~ @@ -0,0 +1,57 @@ +shortcodes[$post->ID][0]; + + // check to see if a shortcode component has been repeated? + $atts = get_atts( $shortcode ); + print_R($atts);exit; + //$civi->preprocess_atts(); +} + +?> \ No newline at end of file diff --git a/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ b/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ new file mode 100644 index 0000000..0e73aa2 --- /dev/null +++ b/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ @@ -0,0 +1,122 @@ + 'contribution', + 'action' => NULL, + 'mode' => NULL, + 'id' => NULL, + 'cid' => NULL, + 'gid' => NULL, + 'cs' => NULL, + 'force' => NULL, + ), + $atts, + 'civicrm' + ); + + extract( $shortcode_atts ); + + $args = array( + 'reset' => 1, + 'id' => $id, + 'force' => $force, + ); + + switch ( $component ) { + + case 'contribution': + + if ( $mode == 'preview' || $mode == 'test' ) { + $args['action'] = 'preview'; + } + $args['q'] = 'civicrm/contribute/transact'; + break; + + case 'event': + + switch ( $action ) { + case 'register': + $args['q'] = 'civicrm/event/register'; + if ( $mode == 'preview' || $mode == 'test' ) { + $args['action'] = 'preview'; + } + break; + + case 'info': + $args['q'] = 'civicrm/event/info'; + $_REQUEST['page'] = $_GET['page'] = 'CiviCRM'; + break; + + default: + echo '

' . __( 'Do not know how to handle this shortcode', 'civicrm' ) . '

'; + return; + } + break; + + case 'user-dashboard': + + $args['q'] = 'civicrm/user'; + unset( $args['id'] ); + break; + + case 'profile': + + if ($mode == 'edit') { + $args['q'] = 'civicrm/profile/edit'; + } + elseif ($mode == 'view') { + $args['q'] = 'civicrm/profile/view'; + } + elseif ($mode == 'search') { + $args['q'] = 'civicrm/profile'; + } + else { + $args['q'] = 'civicrm/profile/create'; + } + $args['gid'] = $gid; + break; + + + case 'petition': + + $args['q'] = 'civicrm/petition/sign'; + $args['sid'] = $args['id']; + unset($args['id']); + break; + + default: + + echo '

' . __( 'Do not know how to handle this shortcode', 'civicrm' ) . '

'; + return; + + } + + /** + * Filter the CiviCRM shortcode arguments. + * + * This filter allows plugins or CiviExtensions to modify the attributes + * that the 'civicrm' shortcode allows. Injected attributes and their values + * will also become available in the $_REQUEST and $_GET arrays. + * + * @param array $args Existing shortcode arguments + * @param array $shortcode_atts Shortcode attributes + * @return array $args Modified shortcode arguments + */ + return apply_filters( 'civicrm_shortcode_preprocess_atts', $args, $shortcode_atts ); + + } + +} + +?> \ No newline at end of file From 84a8a5aa24f9feaf1b7d18db4f5abb53b416f065 Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 23 May 2018 18:27:21 +0530 Subject: [PATCH 3/4] Deleted cruft --- .../grant_application_shortcode.php~ | 57 -------- .../grant_application_shortcode_modal.php~ | 122 ------------------ 2 files changed, 179 deletions(-) delete mode 100644 plugins/grant_application_shortcode/grant_application_shortcode.php~ delete mode 100644 plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ diff --git a/plugins/grant_application_shortcode/grant_application_shortcode.php~ b/plugins/grant_application_shortcode/grant_application_shortcode.php~ deleted file mode 100644 index c0da22f..0000000 --- a/plugins/grant_application_shortcode/grant_application_shortcode.php~ +++ /dev/null @@ -1,57 +0,0 @@ -shortcodes[$post->ID][0]; - - // check to see if a shortcode component has been repeated? - $atts = get_atts( $shortcode ); - print_R($atts);exit; - //$civi->preprocess_atts(); -} - -?> \ No newline at end of file diff --git a/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ b/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ deleted file mode 100644 index 0e73aa2..0000000 --- a/plugins/grant_application_shortcode/grant_application_shortcode_modal.php~ +++ /dev/null @@ -1,122 +0,0 @@ - 'contribution', - 'action' => NULL, - 'mode' => NULL, - 'id' => NULL, - 'cid' => NULL, - 'gid' => NULL, - 'cs' => NULL, - 'force' => NULL, - ), - $atts, - 'civicrm' - ); - - extract( $shortcode_atts ); - - $args = array( - 'reset' => 1, - 'id' => $id, - 'force' => $force, - ); - - switch ( $component ) { - - case 'contribution': - - if ( $mode == 'preview' || $mode == 'test' ) { - $args['action'] = 'preview'; - } - $args['q'] = 'civicrm/contribute/transact'; - break; - - case 'event': - - switch ( $action ) { - case 'register': - $args['q'] = 'civicrm/event/register'; - if ( $mode == 'preview' || $mode == 'test' ) { - $args['action'] = 'preview'; - } - break; - - case 'info': - $args['q'] = 'civicrm/event/info'; - $_REQUEST['page'] = $_GET['page'] = 'CiviCRM'; - break; - - default: - echo '

' . __( 'Do not know how to handle this shortcode', 'civicrm' ) . '

'; - return; - } - break; - - case 'user-dashboard': - - $args['q'] = 'civicrm/user'; - unset( $args['id'] ); - break; - - case 'profile': - - if ($mode == 'edit') { - $args['q'] = 'civicrm/profile/edit'; - } - elseif ($mode == 'view') { - $args['q'] = 'civicrm/profile/view'; - } - elseif ($mode == 'search') { - $args['q'] = 'civicrm/profile'; - } - else { - $args['q'] = 'civicrm/profile/create'; - } - $args['gid'] = $gid; - break; - - - case 'petition': - - $args['q'] = 'civicrm/petition/sign'; - $args['sid'] = $args['id']; - unset($args['id']); - break; - - default: - - echo '

' . __( 'Do not know how to handle this shortcode', 'civicrm' ) . '

'; - return; - - } - - /** - * Filter the CiviCRM shortcode arguments. - * - * This filter allows plugins or CiviExtensions to modify the attributes - * that the 'civicrm' shortcode allows. Injected attributes and their values - * will also become available in the $_REQUEST and $_GET arrays. - * - * @param array $args Existing shortcode arguments - * @param array $shortcode_atts Shortcode attributes - * @return array $args Modified shortcode arguments - */ - return apply_filters( 'civicrm_shortcode_preprocess_atts', $args, $shortcode_atts ); - - } - -} - -?> \ No newline at end of file From 2b9e9000c13088e5f9bc52df034b0a13b4f657e2 Mon Sep 17 00:00:00 2001 From: Edsel Date: Wed, 23 May 2018 18:48:13 +0530 Subject: [PATCH 4/4] Removed closing php tag --- .../grant_application_shortcode.php | 2 -- shortcode-wp/includes/civicrm.shortcodes.php | 20 ------------------- 2 files changed, 22 deletions(-) diff --git a/plugins/grant_application_shortcode/grant_application_shortcode.php b/plugins/grant_application_shortcode/grant_application_shortcode.php index 53481a9..26442d7 100644 --- a/plugins/grant_application_shortcode/grant_application_shortcode.php +++ b/plugins/grant_application_shortcode/grant_application_shortcode.php @@ -40,5 +40,3 @@ function civicrm_shortcode_get_data($data, $atts, $args) { } } - -?> \ No newline at end of file diff --git a/shortcode-wp/includes/civicrm.shortcodes.php b/shortcode-wp/includes/civicrm.shortcodes.php index 1211cd6..cf3068d 100644 --- a/shortcode-wp/includes/civicrm.shortcodes.php +++ b/shortcode-wp/includes/civicrm.shortcodes.php @@ -596,11 +596,6 @@ public function preprocess_atts( $atts ) { $args['q'] = 'civicrm/contribute/transact'; break; - case 'grant': - - $args['q'] = 'civicrm/grant/transact'; - break; - case 'event': switch ( $action ) { @@ -731,21 +726,6 @@ public function get_data( $atts, $args ) { } break; - - case 'grant': - - // add grant application page ID - $params['id'] = $args['id']; - - // get grant application page - $sql = "SELECT title, intro_text FROM civicrm_grant_app_page WHERE id = {$params['id']}"; - $dao = CRM_Core_DAO::executeQuery($sql); - while ($dao->fetch()) { - $data['title'] = $dao->title; - $data['text'] = $dao->intro_text; - } - - break; case 'event':