diff --git a/admin/partials/civicrm-ux-admin-display.php b/admin/partials/civicrm-ux-admin-display.php index eb475ef..73ee838 100755 --- a/admin/partials/civicrm-ux-admin-display.php +++ b/admin/partials/civicrm-ux-admin-display.php @@ -18,10 +18,14 @@ function civicrm_ux_settings_page() { ]; $url = add_query_arg( $url_param, - get_rest_url( null, + get_rest_url( NULL, '/' . Civicrm_Ux_Shortcode_Event_ICal_Feed::API_NAMESPACE . '/' . Civicrm_Ux_Shortcode_Event_ICal_Feed::INTERNAL_ENDPOINT ) ); - $opt = Civicrm_Ux::getInstance()->get_store()->get_option( 'civicrm_summary_options' ); - $opt_c = Civicrm_Ux::getInstance()->get_store()->get_option( 'civicrm_contribution_ux' ); + $opt = Civicrm_Ux::getInstance() + ->get_store() + ->get_option( 'civicrm_summary_options' ); + $opt_c = Civicrm_Ux::getInstance() + ->get_store() + ->get_option( 'civicrm_contribution_ux' ); ?>

CiviCRM UX

@@ -31,57 +35,83 @@ function civicrm_ux_settings_page() {

iCal Feed

- + - - + +
size="40" value=""/> - +
The internal feed url is: The internal feed url is: + +

Membership Summary

- - + value=""/> + - - + value=""/> + - - + value=""/> +

Contribution Page Tweaks

- + - +
- - CiviCRM UX guide - /**/ ?> + + * CiviCRM UX guide + * /**/ ?> options = []; // For membership - $this->register_option( 'civicrm_summary_options', null, [ + $this->register_option( 'civicrm_summary_options', NULL, [ 'civicrm_summary_show_renewal_date' => '30', 'civicrm_summary_membership_join_URL' => '/join/', - 'civicrm_summary_membership_renew_URL' => '/renew/' + 'civicrm_summary_membership_renew_URL' => '/renew/', ] ); // For contributions - $this->register_option( 'civicrm_contribution_ux', null, [ - 'is_recur_default' => FALSE, - 'is_autorenew_default' => FALSE + $this->register_option( 'civicrm_contribution_ux', NULL, [ + 'is_recur_default' => FALSE, + 'is_autorenew_default' => FALSE, ] ); } @@ -39,7 +41,7 @@ public function register_option( $name, $instance, $default = '' ) { $this->options[ $name ] = [ 'instance' => $instance, - 'default' => $default + 'default' => $default, ]; } @@ -58,4 +60,5 @@ public function delete_option( $name ) { public function get_options() { return $this->options; } + } \ No newline at end of file diff --git a/public/class-civicrm-ux-public.php b/public/class-civicrm-ux-public.php index 743f004..e5398a2 100755 --- a/public/class-civicrm-ux-public.php +++ b/public/class-civicrm-ux-public.php @@ -97,55 +97,60 @@ public function enqueue_scripts() { * class. */ - wp_enqueue_script( $this->civicrm_ux, plugin_dir_url( __FILE__ ) . 'js/civicrm-ux-public.js', [ 'jquery' ], $this->version, false ); + wp_enqueue_script( $this->civicrm_ux, plugin_dir_url( __FILE__ ) . 'js/civicrm-ux-public.js', [ 'jquery' ], $this->version, FALSE ); - $opt = Civicrm_Ux::getInstance()->get_store()->get_option( 'civicrm_contribution_ux' ); + $opt = Civicrm_Ux::getInstance() + ->get_store() + ->get_option( 'civicrm_contribution_ux' ); $options_map = [ - 'is_recur_default' => !! $opt['is_recur_default'], - 'is_autorenew_default' => !! $opt['is_autorenew_default'], + 'is_recur_default' => ! ! $opt['is_recur_default'], + 'is_autorenew_default' => ! ! $opt['is_autorenew_default'], ]; - wp_add_inline_script($this->civicrm_ux, 'window.wp = window.wp || ({}); window.wp.CiviCRM_UX = (' . json_encode($options_map) . ')', 'before'); + wp_add_inline_script( $this->civicrm_ux, 'window.wp = window.wp || ({}); window.wp.CiviCRM_UX = (' . json_encode( $options_map ) . ')', 'before' ); } - /** - * Use the title as set for WordPress in the Avada page titlebar. - * - * @since 1.1.6 - */ - public function avada_page_title_bar_contents($parts) { + /** + * Use the title as set for WordPress in the Avada page titlebar. + * + * @since 1.1.6 + */ + public function avada_page_title_bar_contents( $parts ) { [ $title, $subtitle, $secondary_content ] = $parts; return [ get_the_title(), $subtitle, $secondary_content ]; } /** - * Override the timezone of Event Organiser event date/times to that of the linked event. + * Override the timezone of Event Organiser event date/times to that of the + * linked event. * * @since 1.2.0 */ - function event_organiser_timezone_filter ( $formatted, \DateTime $date, $format, $post_id, $occurrence_id ) { - $civi_id = reset(civicrm_eo()->db->get_civi_event_ids_by_eo_event_id($post_id)); + function event_organiser_timezone_filter( $formatted, \DateTime $date, $format, $post_id, $occurrence_id ) { + $civi_id = reset( civicrm_eo()->db->get_civi_event_ids_by_eo_event_id( $post_id ) ); try { - $civi_event = $civi_id ? (\Civi\Api4\Event::get(FALSE) - ->addSelect('id', 'event_tz') - ->addWhere('id', '=', $civi_id) - ->execute())[0] : NULL; + $civi_event = $civi_id ? ( \Civi\Api4\Event::get( FALSE ) + ->addSelect( 'id', 'event_tz' ) + ->addWhere( 'id', '=', $civi_id ) + ->execute() )[0] : NULL; - if(!empty($civi_event['event_tz'])) { + if ( ! empty( $civi_event['event_tz'] ) ) { $timezone = new \DateTimeZone( $civi_event['event_tz'] ); $date->setTimeZone( $timezone ); - return eo_format_datetime($date, $format); + return eo_format_datetime( $date, $format ); } - } catch( \API_Exception $e ) { - \Civi::log()->error("Could not set timezone for event {$post_id}: {$e->getMessage()}"); + } catch ( \API_Exception $e ) { + \Civi::log() + ->error( "Could not set timezone for event {$post_id}: {$e->getMessage()}" ); } return $formatted; } + }