Skip to content

Commit

Permalink
Merge branch 'WPCIVIUX-176'
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-fj committed Nov 5, 2024
2 parents 3e49ee9 + 3694af8 commit a559e08
Show file tree
Hide file tree
Showing 10 changed files with 659 additions and 598 deletions.
2 changes: 1 addition & 1 deletion civicrm-ux.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin Name: WP CiviCRM UX
* Plugin URI: https://github.com/agileware/wp-civicrm-ux
* Description: A better user experience for integrating WordPress and CiviCRM
* Version: 1.19.0
* Version: 1.20.0
* Requires at least: 5.8
* Requires PHP: 7.4
* Requires Plugins: civicrm
Expand Down
1 change: 1 addition & 0 deletions includes/class-civicrm-ux.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ private function load_dependencies() {
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-civicrm-ux-helper.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-civicrm-ux-option-store.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/utils/class-civicrm-ux-validators.php';

// All module mangers and instances class
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/interface/interface-civicrm-ux-managed-instance.php';
Expand Down
57 changes: 57 additions & 0 deletions includes/utils/class-civicrm-ux-validators.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

class Civicrm_Ux_Validators
{
public static function validateCssColor($color): ?string
{
$color = preg_replace('{^ ([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8}) $}xi', '#$0', $color);

$valid = preg_match('{
^ \s* (
# Hexadecimal Colors: #RGB, #RRGGBB, #RRGGBBAA
\#([a-f0-9]{3,4}|[a-f0-9]{6}|[a-f0-9]{8})\b
|
# RGB and RGBA Colors: rgb(r, g, b) | rgb(r g b / a) or rgba(r, g, b, a)
rgb(a?)\(
\s*([0-9]{1,3}%?\s*,?\s+){2}[0-9]{1,3}%?
(?:\s*/\s*(0|1|0?\.\d+))?
\s*\)
|
# HSL and HSLA Colors: hsl(h, s, l) | hsl(h s l / a) or hsla(h, s, l, a)
hsl(a?)\(
\s*\d{1,3}(deg|grad|rad|turn)?\s*,?\s+[0-9]{1,3}%\s*,?\s+[0-9]{1,3}%
(?:\s*/\s*(0|1|0?\.\d+))?
\s*\)
|
# Simplified Named Colors: 3 to 20 alphabetic characters
[a-z]{3,20}
|
# CSS custom properties
-- (?: [a-z]+ - )* [a-z]+
)
\s*
$ }xi',
$color,
$matches);
return $valid ? $matches[1] : null;
}

public static function validateAPIFieldName($field, $key = null): ?string
{
$valid = preg_match('{ ^ (?! [.-] ) [[:alnum:]._-]+ (?<! [._-]) $ }xi', $field, $matches);

if (!$valid) {
throw new InvalidArgumentException($key ? __('Invalid field key given') : sprintf(__('Invalid key given for "%1$s"'), $key));
}

return $matches[0];
}
}
24 changes: 23 additions & 1 deletion includes/utils/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@
*
*/
function civicrm_ux_load_template_part( $slug, $name, $args = [] ) {
do_action( "get_template_part_{$slug}", $slug, $name, $args );

$templates = [
...array_merge(...array_map(function ($prefix) use ($slug, $name) {
return [
"{$prefix}/{$slug}/{$slug}-{$name}.php",
"{$prefix}/{$slug}/{$name}.php",
"{$prefix}/{$slug}-{$name}.php",
];
}, ['templates', 'template-parts'])),
"{$slug}-{$name}.php" ];

do_action( 'get_template_part', $slug, $name, $templates, $args );

// Allow themes to override the plugin's template part
$template = locate_template( $slug . '-' . $name . '.php' );
$template = locate_template( $templates );

// If not found in the theme, load from the plugin's template directory
if ( ! $template ) {
Expand All @@ -33,4 +47,12 @@ function civicrm_ux_load_template_part( $slug, $name, $args = [] ) {
if ( file_exists( $template ) ) {
load_template($template, false, $args);
}
}

function civicrm_ux_get_template_part( $slug, $name, $args = [] ) {
ob_start();

civicrm_ux_load_template_part( $slug, $name, $args );

return ob_get_clean();
}
113 changes: 37 additions & 76 deletions public/css/event-fullcalendar.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

.civicrm-ux-event-listing-image img {
display:block;
display: block;
margin-top: 30px;
margin-left:auto;
margin-right:auto;
margin-left: auto;
margin-right: auto;
max-width: 100%;
}

Expand Down Expand Up @@ -35,13 +34,13 @@
}

.civicrm-ux-event-listing-hr {
margin-bottom: 10px !important;
background-color: black !important;
margin-bottom: 10px;
background-color: black;
}

.civicrm-ux-event-listing-img {
display:block;
margin:auto;
display: block;
margin: auto;
margin-bottom: 30px;
}

Expand All @@ -52,15 +51,15 @@
}

.civicrm-ux-event-listing-register, #civicrm-ux-event-popup-register {
text-align: center !important;
text-align: center;
margin: 0;
padding: 0.5em 1em !important;
vertical-align: middle !important;
padding: 0.5em 1em ;
vertical-align: middle;
color: white;
cursor: pointer;
background-color: #333333;
border-radius: 3px!important;
width: auto !important;
border-radius: 3px;
width: auto;
}

.civicrm-ux-event-listing-desc {
Expand All @@ -85,21 +84,21 @@ div.civicrm-event-listing-item {
margin: 0 0 1.8em 0;
}

.civicrm-ux-event-popup{
.civicrm-ux-event-popup {
background-color: #eeeeee;
width: 100%;
padding: 30px 40px;
left: 50%;
top: 50%;
border-radius: 8px;
display: none;
font-family: "Poppins",sans-serif;
font-family: "Poppins", sans-serif;
z-index: 1;
}

.civicrm-ux-event-popup button {
display: block;
margin: 0;
margin: 0;
background-color: transparent;
color: #ffffff;
background: #000000;
Expand All @@ -116,7 +115,7 @@ div.civicrm-event-listing-item {
background: #444444;
}

.civicrm-ux-event-popup p{
.civicrm-ux-event-popup p {
font-size: 14px;
text-align: justify;
margin: 20px 0;
Expand All @@ -126,8 +125,8 @@ div.civicrm-event-listing-item {
.civicrm-ux-event-popup-img {
/* max-width: 90%;
height: auto;*/
display:block;
margin:auto;
display: block;
margin: auto;
margin-bottom: 30px;
}

Expand All @@ -154,22 +153,24 @@ div.civicrm-event-listing-item {


.fc-header-toolbar .fc-toolbar-chunk:first-child .fc-button-group button {
background-color: #4f4f4f !important;
background-color: #4f4f4f;
}

.fc-header-toolbar .fc-toolbar-chunk:first-child .fc-button-group button:focus{background-color:black !important;}
.fc-header-toolbar .fc-toolbar-chunk:first-child .fc-button-group button:focus {
background-color: black;
}

.fc-header-toolbar .fc-toolbar-chunk:first-child select {
background-color: #4f4f4f !important;
background-color: #4f4f4f;
}

.fc-header-toolbar .fc-toolbar-chunk:first-child select:focus{background-color:black !important;}
.fc-header-toolbar .fc-toolbar-chunk:first-child select:focus {
background-color: black;
}

.fc-header-toolbar .fc-toolbar-chunk:last-child {
margin-top: 50px;
display: flex;
justify-content: space-between;
background-color: black;
}


Expand All @@ -185,10 +186,10 @@ div.civicrm-event-listing-item {
.fc-col-header-cell-cushion {
color: black;
font-size: 14px;
padding: 8px 0px 8px 0px !important;
padding: 8px 0px 8px 0px;
}

.fc-col-header {
.fc-col-header {
margin: 0px 0px 0px 0px;
}

Expand All @@ -205,64 +206,19 @@ div.civicrm-event-listing-item {
}

.fc-header-toolbar, .fc-toolbar, .fc-toolbar-ltr {
display: inline-block !important;
}

.fc .fc-toolbar.fc-header-toolbar {
margin-bottom: 0em !important;
}

.fc-toolbar-title {
color: #fff !important;
font-size: 15px !important;
padding-top: 5px !important;
}

.fc-button-group {
width: 33% !important;
display: inline-block;
}

.fc-button {
background-color: black !important;
border: 1px solid white !important;
font-size: 13px !important;
background-color: black;
border: 1px solid white;
font-size: 13px;
}

.fc .fc-list-sticky .fc-list-day > * {
z-index: 1;
}



.tippy-box[data-theme~='fcvic'] {
background-color: #f0e8ce;
border-color: #f0e8ce;
color: black;
}

.tippy-box[data-theme~='fcvic'][data-placement^='top'] > .tippy-arrow::before {
border-top-color: #f0e8ce;
}
.tippy-box[data-theme~='fcvic'][data-placement^='bottom'] > .tippy-arrow::before {
border-bottom-color: #f0e8ce;
}
.tippy-box[data-theme~='fcvic'][data-placement^='left'] > .tippy-arrow::before {
border-left-color: #f0e8ce;
}
.tippy-box[data-theme~='fcvic'][data-placement^='right'] > .tippy-arrow::before {
border-right-color: #f0e8ce;
}


.tippy-box[data-theme~='fcvic'] img {
max-width: 90%;
max-height: 50px;
height: auto;
margin: 10px 10px 0px 10px;
display: block;
}


.event-holder {
overflow: hidden;
padding: 3px 3px 3px 3px;
Expand All @@ -289,6 +245,7 @@ div.civicrm-event-listing-item {
.event-time {
margin: 5px 0px 0px 10px;
display: inline-flex;
align-items: center;
}

.event-time-text {
Expand All @@ -297,6 +254,10 @@ div.civicrm-event-listing-item {
margin-left: 5px;
}

.tippy-box .event-time-text {
color: #ffffff;
}

.event-location {
margin: 0px 0px 5px 10px;
}
Expand Down
Loading

0 comments on commit a559e08

Please sign in to comment.