version 3.2.4 released
|
@ -219,4 +219,57 @@ ul.mep_rt_settings_list li {
|
|||
margin: 20px 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 5px 0 10px;
|
||||
}
|
||||
.mage_settings_panel_wrap .metabox-holder {
|
||||
padding-top: 10px;
|
||||
background: #fff;
|
||||
padding: 20px;
|
||||
border: 5px solid #0071a1;
|
||||
/* border-top: 0px; */
|
||||
}
|
||||
|
||||
.mage_settings_panel_wrap .nav-tab {
|
||||
float: left;
|
||||
border: 2px solid #0e678c;
|
||||
border-bottom: none;
|
||||
margin-left: .5em;
|
||||
padding: 5px 10px;
|
||||
font-size: 14px;
|
||||
line-height: 1.71428571;
|
||||
font-weight: 600;
|
||||
background: #0071a1;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.mage_settings_panel_wrap .nav-tab.nav-tab-active {
|
||||
background: #5ea8c8;
|
||||
}
|
||||
.mage_settings_panel_wrap table th {
|
||||
width: 330px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 10px 10px 0 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.mage_settings_panel_wrap table td {
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding: 10px 0;
|
||||
}
|
||||
.mage_settings_panel_wrap p.submit {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.mage_settings_panel_wrap p.submit input {
|
||||
font-size: 16px;
|
||||
padding: 5px 30px;
|
||||
border-radius: 0;
|
||||
}
|
||||
.mage_settings_panel_wrap .metabox-holder h2 {
|
||||
border-bottom: 2px solid #0071a1;
|
||||
font-size: 20px;
|
||||
padding: 15px;
|
||||
background: #ddd;
|
||||
margin-bottom: 30px;
|
||||
margin-top: 10px;
|
||||
}
|
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 6.2 KiB |
|
@ -1,4 +1,4 @@
|
|||
/*! jQuery UI - v1.11.0 - 2014-06-26
|
||||
/*! jQuery UI - v1.11.2 - 2014-10-16
|
||||
* http://jqueryui.com
|
||||
* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
||||
|
@ -48,7 +48,7 @@
|
|||
left: 0;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
filter:Alpha(Opacity=0);
|
||||
filter:Alpha(Opacity=0); /* support: IE8 */
|
||||
}
|
||||
|
||||
.ui-front {
|
||||
|
@ -274,7 +274,7 @@ button.ui-button::-moz-focus-inner {
|
|||
}
|
||||
.ui-datepicker select.ui-datepicker-month,
|
||||
.ui-datepicker select.ui-datepicker-year {
|
||||
width: 49%;
|
||||
width: 45%;
|
||||
}
|
||||
.ui-datepicker table {
|
||||
width: 100%;
|
||||
|
@ -514,9 +514,9 @@ button.ui-button::-moz-focus-inner {
|
|||
height: 100%;
|
||||
}
|
||||
.ui-progressbar .ui-progressbar-overlay {
|
||||
background: url("images/animated-overlay.gif");
|
||||
background: url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");
|
||||
height: 100%;
|
||||
filter: alpha(opacity=25);
|
||||
filter: alpha(opacity=25); /* support: IE8 */
|
||||
opacity: 0.25;
|
||||
}
|
||||
.ui-progressbar-indeterminate .ui-progressbar-value {
|
||||
|
@ -672,7 +672,7 @@ button.ui-button::-moz-focus-inner {
|
|||
background-position: 0 0;
|
||||
}
|
||||
|
||||
/* For IE8 - See #6727 */
|
||||
/* support: IE8 - See #6727 */
|
||||
.ui-slider.ui-state-disabled .ui-slider-handle,
|
||||
.ui-slider.ui-state-disabled .ui-slider-range {
|
||||
filter: inherit;
|
||||
|
@ -954,18 +954,18 @@ body .ui-tooltip {
|
|||
.ui-widget-content .ui-priority-secondary,
|
||||
.ui-widget-header .ui-priority-secondary {
|
||||
opacity: .7;
|
||||
filter:Alpha(Opacity=70);
|
||||
filter:Alpha(Opacity=70); /* support: IE8 */
|
||||
font-weight: normal;
|
||||
}
|
||||
.ui-state-disabled,
|
||||
.ui-widget-content .ui-state-disabled,
|
||||
.ui-widget-header .ui-state-disabled {
|
||||
opacity: .35;
|
||||
filter:Alpha(Opacity=35);
|
||||
filter:Alpha(Opacity=35); /* support: IE8 */
|
||||
background-image: none;
|
||||
}
|
||||
.ui-state-disabled .ui-icon {
|
||||
filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
|
||||
filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
|
||||
}
|
||||
|
||||
/* Icons
|
||||
|
@ -1213,13 +1213,13 @@ body .ui-tooltip {
|
|||
.ui-widget-overlay {
|
||||
background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
|
||||
opacity: .3;
|
||||
filter: Alpha(Opacity=30);
|
||||
filter: Alpha(Opacity=30); /* support: IE8 */
|
||||
}
|
||||
.ui-widget-shadow {
|
||||
margin: -8px 0 0 -8px;
|
||||
padding: 8px;
|
||||
background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
|
||||
opacity: .3;
|
||||
filter: Alpha(Opacity=30);
|
||||
filter: Alpha(Opacity=30); /* support: IE8 */
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
|
122
css/style.css
|
@ -573,12 +573,13 @@ ul.event-custom-price li ul {
|
|||
padding: 10px 5px;
|
||||
text-align: left;
|
||||
}
|
||||
div.mep-default-feature-content p {
|
||||
div.mep-default-feature-content p, div.mep-default-feature-content ul, div.mep-default-feature-content ul li {
|
||||
color: #3a3a3a;
|
||||
font-size: 16px;
|
||||
padding: inherit;
|
||||
margin: 15px 0;
|
||||
line-height: 20px;
|
||||
line-height: 22px;
|
||||
list-style: inherit;
|
||||
}
|
||||
.mep-events-wrapper p:not(.mep-events-wrapper .mep-default-feature-content p){
|
||||
line-height: 1.2;
|
||||
|
@ -656,6 +657,123 @@ button.mep-cat-control.mixitup-control-active {
|
|||
background: #ddd;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/* Speaker Lists */
|
||||
.mep-default-sidebar-speaker-list {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list h3 {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 5px;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list h3 i {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list ul li {
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
text-align: center;
|
||||
font-size: 23px;
|
||||
font-weight: bold;
|
||||
padding: 0 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list ul li a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list ul li img {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
border-radius: 100%;
|
||||
margin: 0 auto!important;
|
||||
}
|
||||
|
||||
.mep-default-sidebar-speaker-list ul li h6 {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.mep_speaker_thumbnail {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mep-eventtype-ribbon{
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
padding: 2px 21px;
|
||||
color: #fff;
|
||||
left: auto;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.mep_speaker_thumbnail img {
|
||||
display: inline-block;
|
||||
border-radius: 100%;
|
||||
height: 280px;
|
||||
border: 5px solid #ddd;
|
||||
padding: 3px;
|
||||
width: 280px;
|
||||
}
|
||||
|
||||
.mep_speaker_name {
|
||||
text-align: center;
|
||||
}
|
||||
.mep-events-shortcode-cart-section .mep-events-wrapper {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mep_single_hide_all_date{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mep_event_date_sch {
|
||||
height: 270px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.mep_view_all_date{
|
||||
height: auto!important;
|
||||
}
|
||||
|
||||
span.mep_single_date_btn {
|
||||
display: block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
.mep-tem3-title-sec.mep_single_date_btn {
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/******Responsive*******/
|
||||
@media only screen and (max-width: 1199px) {
|
||||
/********Default Theme***********/
|
||||
|
|
After Width: | Height: | Size: 4.3 KiB |
|
@ -1,10 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 2AM Settings API wrapper class
|
||||
*
|
||||
* @version 1.0
|
||||
*
|
||||
* MagePeople Settings API wrapper class
|
||||
*/
|
||||
if ( !class_exists( 'MAGE_Setting_API' ) ):
|
||||
class MAGE_Setting_API {
|
||||
|
@ -14,21 +11,14 @@ class MAGE_Setting_API {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
private $settings_sections = array();
|
||||
protected $settings_sections = array();
|
||||
|
||||
/**
|
||||
* Settings fields array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $settings_fields = array();
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
private static $_instance;
|
||||
protected $settings_fields = array();
|
||||
|
||||
public function __construct() {
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
||||
|
@ -39,12 +29,10 @@ class MAGE_Setting_API {
|
|||
*/
|
||||
function admin_enqueue_scripts() {
|
||||
wp_enqueue_style( 'wp-color-picker' );
|
||||
wp_enqueue_style( 'thickbox' );
|
||||
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script( 'wp-color-picker' );
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'media-upload' );
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,10 +70,10 @@ class MAGE_Setting_API {
|
|||
|
||||
function add_field( $section, $field ) {
|
||||
$defaults = array(
|
||||
'name' => '',
|
||||
'name' => '',
|
||||
'label' => '',
|
||||
'desc' => '',
|
||||
'type' => 'text'
|
||||
'desc' => '',
|
||||
'type' => 'text'
|
||||
);
|
||||
|
||||
$arg = wp_parse_args( $field, $defaults );
|
||||
|
@ -110,10 +98,14 @@ class MAGE_Setting_API {
|
|||
}
|
||||
|
||||
if ( isset($section['desc']) && !empty($section['desc']) ) {
|
||||
$section['desc'] = '<div class="inside">'.$section['desc'].'</div>';
|
||||
$callback = create_function('', 'echo "'.str_replace('"', '\"', $section['desc']).'";');
|
||||
$section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
|
||||
$callback = function() use ( $section ) {
|
||||
echo str_replace( '"', '\"', $section['desc'] );
|
||||
};
|
||||
} else if ( isset( $section['callback'] ) ) {
|
||||
$callback = $section['callback'];
|
||||
} else {
|
||||
$callback = '__return_false';
|
||||
$callback = null;
|
||||
}
|
||||
|
||||
add_settings_section( $section['id'], $section['title'], $callback, $section['id'] );
|
||||
|
@ -123,19 +115,30 @@ class MAGE_Setting_API {
|
|||
foreach ( $this->settings_fields as $section => $field ) {
|
||||
foreach ( $field as $option ) {
|
||||
|
||||
$name = $option['name'];
|
||||
$type = isset( $option['type'] ) ? $option['type'] : 'text';
|
||||
$label = isset( $option['label'] ) ? $option['label'] : '';
|
||||
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
|
||||
|
||||
$args = array(
|
||||
'id' => $option['name'],
|
||||
'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
|
||||
'name' => $option['label'],
|
||||
'section' => $section,
|
||||
'size' => isset( $option['size'] ) ? $option['size'] : null,
|
||||
'options' => isset( $option['options'] ) ? $option['options'] : '',
|
||||
'std' => isset( $option['default'] ) ? $option['default'] : '',
|
||||
'id' => $name,
|
||||
'class' => isset( $option['class'] ) ? $option['class'] : $name,
|
||||
'label_for' => "{$section}[{$name}]",
|
||||
'desc' => isset( $option['desc'] ) ? $option['desc'] : '',
|
||||
'name' => $label,
|
||||
'section' => $section,
|
||||
'size' => isset( $option['size'] ) ? $option['size'] : null,
|
||||
'options' => isset( $option['options'] ) ? $option['options'] : '',
|
||||
'std' => isset( $option['default'] ) ? $option['default'] : '',
|
||||
'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] : '',
|
||||
'type' => $type,
|
||||
'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] : '',
|
||||
'min' => isset( $option['min'] ) ? $option['min'] : '',
|
||||
'max' => isset( $option['max'] ) ? $option['max'] : '',
|
||||
'step' => isset( $option['step'] ) ? $option['step'] : '',
|
||||
);
|
||||
add_settings_field( $section . '[' . $option['name'] . ']', $option['label'], array( $this, 'callback_' . $type ), $section, $section, $args );
|
||||
|
||||
add_settings_field( "{$section}[{$name}]", $label, $callback, $section, $section, $args );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +148,21 @@ class MAGE_Setting_API {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field description for display
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
public function get_field_description( $args ) {
|
||||
if ( ! empty( $args['desc'] ) ) {
|
||||
$desc = sprintf( '<p class="description">%s</p>', $args['desc'] );
|
||||
} else {
|
||||
$desc = '';
|
||||
}
|
||||
|
||||
return $desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a text field for a settings field
|
||||
*
|
||||
|
@ -152,11 +170,42 @@ class MAGE_Setting_API {
|
|||
*/
|
||||
function callback_text( $args ) {
|
||||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$type = isset( $args['type'] ) ? $args['type'] : 'text';
|
||||
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
|
||||
|
||||
$html = sprintf( '<input type="text" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= sprintf( '<span class="description"> %s</span>', $args['desc'] );
|
||||
$html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a url field for a settings field
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
function callback_url( $args ) {
|
||||
$this->callback_text( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a number field for a settings field
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
function callback_number( $args ) {
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$type = isset( $args['type'] ) ? $args['type'] : 'number';
|
||||
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="' . $args['placeholder'] . '"';
|
||||
$min = ( $args['min'] == '' ) ? '' : ' min="' . $args['min'] . '"';
|
||||
$max = ( $args['max'] == '' ) ? '' : ' max="' . $args['max'] . '"';
|
||||
$step = ( $args['step'] == '' ) ? '' : ' step="' . $args['step'] . '"';
|
||||
|
||||
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
@ -170,48 +219,57 @@ class MAGE_Setting_API {
|
|||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
|
||||
$html = sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
|
||||
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on"%4$s />', $args['section'], $args['id'], $value, checked( $value, 'on', false ) );
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s]"> %3$s</label>', $args['section'], $args['id'], $args['desc'] );
|
||||
$html = '<fieldset>';
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s]">', $args['section'], $args['id'] );
|
||||
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="off" />', $args['section'], $args['id'] );
|
||||
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s]" name="%1$s[%2$s]" value="on" %3$s />', $args['section'], $args['id'], checked( $value, 'on', false ) );
|
||||
$html .= sprintf( '%1$s</label>', $args['desc'] );
|
||||
$html .= '</fieldset>';
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a multicheckbox a settings field
|
||||
* Displays a multicheckbox for a settings field
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
function callback_multicheck( $args ) {
|
||||
|
||||
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
||||
|
||||
$html = '';
|
||||
$html = '<fieldset>';
|
||||
$html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
|
||||
foreach ( $args['options'] as $key => $label ) {
|
||||
$checked = isset( $value[$key] ) ? $value[$key] : '0';
|
||||
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s"%4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%4$s]"> %3$s</label><br>', $args['section'], $args['id'], $label, $key );
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
|
||||
$html .= sprintf( '<input type="checkbox" class="checkbox" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s][%3$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $checked, $key, false ) );
|
||||
$html .= sprintf( '%1$s</label><br>', $label );
|
||||
}
|
||||
$html .= sprintf( '<span class="description"> %s</label>', $args['desc'] );
|
||||
|
||||
$html .= $this->get_field_description( $args );
|
||||
$html .= '</fieldset>';
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a multicheckbox a settings field
|
||||
* Displays a radio button for a settings field
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
function callback_radio( $args ) {
|
||||
|
||||
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
||||
$html = '<fieldset>';
|
||||
|
||||
$html = '';
|
||||
foreach ( $args['options'] as $key => $label ) {
|
||||
$html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s"%4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%4$s]"> %3$s</label><br>', $args['section'], $args['id'], $label, $key );
|
||||
$html .= sprintf( '<label for="wpuf-%1$s[%2$s][%3$s]">', $args['section'], $args['id'], $key );
|
||||
$html .= sprintf( '<input type="radio" class="radio" id="wpuf-%1$s[%2$s][%3$s]" name="%1$s[%2$s]" value="%3$s" %4$s />', $args['section'], $args['id'], $key, checked( $value, $key, false ) );
|
||||
$html .= sprintf( '%1$s</label><br>', $label );
|
||||
}
|
||||
$html .= sprintf( '<span class="description"> %s</label>', $args['desc'] );
|
||||
|
||||
$html .= $this->get_field_description( $args );
|
||||
$html .= '</fieldset>';
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
@ -224,14 +282,15 @@ class MAGE_Setting_API {
|
|||
function callback_select( $args ) {
|
||||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
|
||||
|
||||
$html = sprintf( '<select class="%1$s" name="%2$s[%3$s]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
|
||||
foreach ( $args['options'] as $key => $label ) {
|
||||
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $value, $key, false ), $label );
|
||||
}
|
||||
|
||||
$html .= sprintf( '</select>' );
|
||||
$html .= sprintf( '<span class="description"> %s</span>', $args['desc'] );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
@ -243,22 +302,24 @@ class MAGE_Setting_API {
|
|||
*/
|
||||
function callback_textarea( $args ) {
|
||||
|
||||
$value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$value = esc_textarea( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$placeholder = empty( $args['placeholder'] ) ? '' : ' placeholder="'.$args['placeholder'].'"';
|
||||
|
||||
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]">%4$s</textarea>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= sprintf( '<br><span class="description"> %s</span>', $args['desc'] );
|
||||
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a textarea for a settings field
|
||||
* Displays the html for a settings field
|
||||
*
|
||||
* @param array $args settings field args
|
||||
* @return string
|
||||
*/
|
||||
function callback_html( $args ) {
|
||||
echo $args['desc'];
|
||||
echo $this->get_field_description( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -269,15 +330,25 @@ class MAGE_Setting_API {
|
|||
function callback_wysiwyg( $args ) {
|
||||
|
||||
$value = $this->get_option( $args['id'], $args['section'], $args['std'] );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : '500px';
|
||||
|
||||
echo '<div style="width: ' . $size . ';">';
|
||||
echo '<div style="max-width: ' . $size . ';">';
|
||||
|
||||
wp_editor( $value, $args['section'] . '-' . $args['id'] . '', array( 'teeny' => true, 'textarea_name' => $args['section'] . '[' . $args['id'] . ']', 'textarea_rows' => 10 ) );
|
||||
$editor_settings = array(
|
||||
'teeny' => true,
|
||||
'textarea_name' => $args['section'] . '[' . $args['id'] . ']',
|
||||
'textarea_rows' => 10
|
||||
);
|
||||
|
||||
if ( isset( $args['options'] ) && is_array( $args['options'] ) ) {
|
||||
$editor_settings = array_merge( $editor_settings, $args['options'] );
|
||||
}
|
||||
|
||||
wp_editor( $value, $args['section'] . '-' . $args['id'], $editor_settings );
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo sprintf( '<br><span class="description"> %s</span>', $args['desc'] );
|
||||
echo $this->get_field_description( $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -288,30 +359,13 @@ class MAGE_Setting_API {
|
|||
function callback_file( $args ) {
|
||||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$id = $args['section'] . '[' . $args['id'] . ']';
|
||||
$js_id = $args['section'] . '\\\\[' . $args['id'] . '\\\\]';
|
||||
$html = sprintf( '<input type="text" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= '<input type="button" class="button wpsf-browse" id="'. $id .'_button" value="Browse" />
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$("#'. $js_id .'_button").click(function() {
|
||||
tb_show("", "media-upload.php?post_id=0&type=image&TB_iframe=true");
|
||||
window.original_send_to_editor = window.send_to_editor;
|
||||
window.send_to_editor = function(html) {
|
||||
var url = $(html).attr(\'href\');
|
||||
if ( !url ) {
|
||||
url = $(html).attr(\'src\');
|
||||
};
|
||||
$("#'. $js_id .'").val(url);
|
||||
tb_remove();
|
||||
window.send_to_editor = window.original_send_to_editor;
|
||||
};
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$html .= sprintf( '<span class="description"> %s</span>', $args['desc'] );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$id = $args['section'] . '[' . $args['id'] . ']';
|
||||
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
|
||||
|
||||
$html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
@ -324,10 +378,10 @@ class MAGE_Setting_API {
|
|||
function callback_password( $args ) {
|
||||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
|
||||
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= sprintf( '<span class="description"> %s</span>', $args['desc'] );
|
||||
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
@ -340,18 +394,43 @@ class MAGE_Setting_API {
|
|||
function callback_color( $args ) {
|
||||
|
||||
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
||||
|
||||
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
|
||||
$html .= sprintf( '<span class="description" style="display:block;"> %s</span>', $args['desc'] );
|
||||
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
|
||||
$html .= $this->get_field_description( $args );
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a select box for creating the pages select box
|
||||
*
|
||||
* @param array $args settings field args
|
||||
*/
|
||||
function callback_pages( $args ) {
|
||||
|
||||
$dropdown_args = array(
|
||||
'selected' => esc_attr($this->get_option($args['id'], $args['section'], $args['std'] ) ),
|
||||
'name' => $args['section'] . '[' . $args['id'] . ']',
|
||||
'id' => $args['section'] . '[' . $args['id'] . ']',
|
||||
'echo' => 0
|
||||
);
|
||||
$html = wp_dropdown_pages( $dropdown_args );
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize callback for Settings API
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function sanitize_options( $options ) {
|
||||
|
||||
if ( !$options ) {
|
||||
return $options;
|
||||
}
|
||||
|
||||
foreach( $options as $option_slug => $option_value ) {
|
||||
$sanitize_callback = $this->get_sanitize_callback( $option_slug );
|
||||
|
||||
|
@ -419,6 +498,13 @@ class MAGE_Setting_API {
|
|||
function show_navigation() {
|
||||
$html = '<h2 class="nav-tab-wrapper">';
|
||||
|
||||
$count = count( $this->settings_sections );
|
||||
|
||||
// don't show the navigation if only one section exists
|
||||
if ( $count === 1 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $this->settings_sections as $tab ) {
|
||||
$html .= sprintf( '<a href="#%1$s" class="nav-tab" id="%1$s-tab">%2$s</a>', $tab['id'], $tab['title'] );
|
||||
}
|
||||
|
@ -436,23 +522,23 @@ class MAGE_Setting_API {
|
|||
function show_forms() {
|
||||
?>
|
||||
<div class="metabox-holder">
|
||||
<div class="postbox">
|
||||
<?php foreach ( $this->settings_sections as $form ) { ?>
|
||||
<div id="<?php echo $form['id']; ?>" class="group">
|
||||
<form method="post" action="options.php">
|
||||
|
||||
<?php do_action( 'wsa_form_top_' . $form['id'], $form ); ?>
|
||||
<?php settings_fields( $form['id'] ); ?>
|
||||
<?php do_settings_sections( $form['id'] ); ?>
|
||||
<?php do_action( 'wsa_form_bottom_' . $form['id'], $form ); ?>
|
||||
|
||||
<div style="padding-left: 10px">
|
||||
<?php submit_button(); ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php foreach ( $this->settings_sections as $form ) { ?>
|
||||
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
do_action( 'wsa_form_top_' . $form['id'], $form );
|
||||
settings_fields( $form['id'] );
|
||||
do_settings_sections( $form['id'] );
|
||||
do_action( 'wsa_form_bottom_' . $form['id'], $form );
|
||||
if ( isset( $this->settings_fields[ $form['id'] ] ) ):
|
||||
?>
|
||||
<div style="padding-left: 10px">
|
||||
<?php submit_button(); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
$this->script();
|
||||
|
@ -469,12 +555,22 @@ class MAGE_Setting_API {
|
|||
jQuery(document).ready(function($) {
|
||||
//Initiate Color Picker
|
||||
$('.wp-color-picker-field').wpColorPicker();
|
||||
|
||||
// Switches option sections
|
||||
$('.group').hide();
|
||||
var activetab = '';
|
||||
if (typeof(localStorage) != 'undefined' ) {
|
||||
activetab = localStorage.getItem("activetab");
|
||||
}
|
||||
|
||||
//if url has section id as hash then set it as active or override the current local storage value
|
||||
if(window.location.hash){
|
||||
activetab = window.location.hash;
|
||||
if (typeof(localStorage) != 'undefined' ) {
|
||||
localStorage.setItem("activetab", activetab);
|
||||
}
|
||||
}
|
||||
|
||||
if (activetab != '' && $(activetab).length ) {
|
||||
$(activetab).fadeIn();
|
||||
} else {
|
||||
|
@ -508,24 +604,49 @@ class MAGE_Setting_API {
|
|||
$(clicked_group).fadeIn();
|
||||
evt.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
$('.wpsa-browse').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var self = $(this);
|
||||
|
||||
// Create the media frame.
|
||||
var file_frame = wp.media.frames.file_frame = wp.media({
|
||||
title: self.data('uploader_title'),
|
||||
button: {
|
||||
text: self.data('uploader_button_text'),
|
||||
},
|
||||
multiple: false
|
||||
});
|
||||
|
||||
file_frame.on('select', function () {
|
||||
attachment = file_frame.state().get('selection').first().toJSON();
|
||||
self.prev('.wpsa-url').val(attachment.url).change();
|
||||
});
|
||||
|
||||
// Finally, open the modal
|
||||
file_frame.open();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$this->_style_fix();
|
||||
}
|
||||
|
||||
function _style_fix() {
|
||||
global $wp_version;
|
||||
|
||||
if (version_compare($wp_version, '3.8', '<=')):
|
||||
?>
|
||||
<style type="text/css">
|
||||
/** WordPress 3.8 Fix **/
|
||||
.form-table th { padding: 20px 10px; }
|
||||
#wpbody-content .metabox-holder { padding-top: 5px; }
|
||||
.form-wrap p, p.description, p.help, span.description {
|
||||
font-size: 13px;
|
||||
font-style: italic;
|
||||
display: block;
|
||||
}
|
||||
.wp-picker-container input[type=text].wp-color-picker {
|
||||
text-align: left!important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
123
inc/mep_cpt.php
|
@ -1,54 +1,97 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
||||
|
||||
// Create MKB CPT
|
||||
function mep_cpt() {
|
||||
// mep_event_slug
|
||||
|
||||
// $event_slug = mep_get_option( 'mep_event_slug', 'general_setting_sec', 'events' );
|
||||
if (!defined('ABSPATH')) {
|
||||
die;
|
||||
} // Cannot access pages directly.
|
||||
|
||||
/**
|
||||
* The Magical Event Post Type Going to registred here to make your WordPress and WooCommerce a Event Manager :)
|
||||
*/
|
||||
function mep_cpt()
|
||||
{
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
|
||||
$labels = array(
|
||||
'name' => __( 'Events','mage-eventpress' ),
|
||||
'singular_name' => __( 'Events','mage-eventpress' ),
|
||||
'menu_name' => __( 'Events','mage-eventpress' ),
|
||||
'name_admin_bar' => __( 'Events','mage-eventpress' ),
|
||||
'archives' => __( 'Events List','mage-eventpress' ),
|
||||
'attributes' => __( 'Events List','mage-eventpress' ),
|
||||
'parent_item_colon' => __( 'Event Item:','mage-eventpress' ),
|
||||
'all_items' => __( 'All Events','mage-eventpress' ),
|
||||
'add_new_item' => __( 'Add New Event','mage-eventpress' ),
|
||||
'add_new' => __( 'Add New Event','mage-eventpress' ),
|
||||
'new_item' => __( 'New Event','mage-eventpress' ),
|
||||
'edit_item' => __( 'Edit Event','mage-eventpress' ),
|
||||
'update_item' => __( 'Update Event','mage-eventpress' ),
|
||||
'view_item' => __( 'View Event','mage-eventpress' ),
|
||||
'view_items' => __( 'View Event', 'mage-eventpress' ),
|
||||
'search_items' => __( 'Search Event', 'mage-eventpress' ),
|
||||
'not_found' => __( 'Event Not found', 'mage-eventpress' ),
|
||||
'not_found_in_trash' => __( 'Event Not found in Trash', 'mage-eventpress' ),
|
||||
'featured_image' => __( 'Event Feature Image', 'mage-eventpress' ),
|
||||
'set_featured_image' => __( 'Set Event featured image', 'mage-eventpress' ),
|
||||
'remove_featured_image' => __( 'Remove Event featured image', 'mage-eventpress' ),
|
||||
'use_featured_image' => __( 'Use as Event featured image', 'mage-eventpress' ),
|
||||
'insert_into_item' => __( 'Insert into Event', 'mage-eventpress' ),
|
||||
'uploaded_to_this_item' => __( 'Uploaded to this Event', 'mage-eventpress' ),
|
||||
'items_list' => __( 'Event list', 'mage-eventpress' ),
|
||||
'items_list_navigation' => __( 'Event list navigation', 'mage-eventpress' ),
|
||||
'filter_items_list' => __( 'Filter Event list', 'mage-eventpress' ),
|
||||
'name' => __('Events', 'mage-eventpress'),
|
||||
'singular_name' => __('Events', 'mage-eventpress'),
|
||||
'menu_name' => __('Events', 'mage-eventpress'),
|
||||
'name_admin_bar' => __('Events', 'mage-eventpress'),
|
||||
'archives' => __('Events List', 'mage-eventpress'),
|
||||
'attributes' => __('Events List', 'mage-eventpress'),
|
||||
'parent_item_colon' => __('Event Item:', 'mage-eventpress'),
|
||||
'all_items' => __('All Events', 'mage-eventpress'),
|
||||
'add_new_item' => __('Add New Event', 'mage-eventpress'),
|
||||
'add_new' => __('Add New Event', 'mage-eventpress'),
|
||||
'new_item' => __('New Event', 'mage-eventpress'),
|
||||
'edit_item' => __('Edit Event', 'mage-eventpress'),
|
||||
'update_item' => __('Update Event', 'mage-eventpress'),
|
||||
'view_item' => __('View Event', 'mage-eventpress'),
|
||||
'view_items' => __('View Event', 'mage-eventpress'),
|
||||
'search_items' => __('Search Event', 'mage-eventpress'),
|
||||
'not_found' => __('Event Not found', 'mage-eventpress'),
|
||||
'not_found_in_trash' => __('Event Not found in Trash', 'mage-eventpress'),
|
||||
'featured_image' => __('Event Feature Image', 'mage-eventpress'),
|
||||
'set_featured_image' => __('Set Event featured image', 'mage-eventpress'),
|
||||
'remove_featured_image' => __('Remove Event featured image', 'mage-eventpress'),
|
||||
'use_featured_image' => __('Use as Event featured image', 'mage-eventpress'),
|
||||
'insert_into_item' => __('Insert into Event', 'mage-eventpress'),
|
||||
'uploaded_to_this_item' => __('Uploaded to this Event', 'mage-eventpress'),
|
||||
'items_list' => __('Event list', 'mage-eventpress'),
|
||||
'items_list_navigation' => __('Event list navigation', 'mage-eventpress'),
|
||||
'filter_items_list' => __('Filter Event list', 'mage-eventpress'),
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$args = array(
|
||||
'public' => true,
|
||||
'labels' => $labels,
|
||||
'menu_icon' => 'dashicons-calendar-alt',
|
||||
'supports' => array('title','editor','thumbnail','excerpt'),
|
||||
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
|
||||
'rewrite' => array('slug' => 'events')
|
||||
|
||||
);
|
||||
register_post_type( 'mep_events', $args );
|
||||
register_post_type('mep_events', $args);
|
||||
|
||||
$labels = array(
|
||||
'name' => __('Speakers', 'mage-eventpress'),
|
||||
'singular_name' => __('Speaker', 'mage-eventpress'),
|
||||
'menu_name' => __('Speakers', 'mage-eventpress'),
|
||||
'name_admin_bar' => __('Speakers', 'mage-eventpress'),
|
||||
'archives' => __('Speakers List', 'mage-eventpress'),
|
||||
'attributes' => __('Speakers List', 'mage-eventpress'),
|
||||
'parent_item_colon' => __('Speakers Item:', 'mage-eventpress'),
|
||||
'all_items' => __('Speakers', 'mage-eventpress'),
|
||||
'add_new_item' => __('Add New Speaker', 'mage-eventpress'),
|
||||
'add_new' => __('Add New Speaker', 'mage-eventpress'),
|
||||
'new_item' => __('New Speaker', 'mage-eventpress'),
|
||||
'edit_item' => __('Edit Speaker', 'mage-eventpress'),
|
||||
'update_item' => __('Update Speaker', 'mage-eventpress'),
|
||||
'view_item' => __('View Speaker', 'mage-eventpress'),
|
||||
'view_items' => __('View Speaker', 'mage-eventpress'),
|
||||
'search_items' => __('Search Speaker', 'mage-eventpress'),
|
||||
'not_found' => __('Speaker Not found', 'mage-eventpress'),
|
||||
'not_found_in_trash' => __('Speaker Not found in Trash', 'mage-eventpress'),
|
||||
'featured_image' => __('Speaker Image', 'mage-eventpress'),
|
||||
'set_featured_image' => __('Set Speaker image', 'mage-eventpress'),
|
||||
'remove_featured_image' => __('Remove Speaker image', 'mage-eventpress'),
|
||||
'use_featured_image' => __('Use as Speaker image', 'mage-eventpress'),
|
||||
'insert_into_item' => __('Insert into Speaker', 'mage-eventpress'),
|
||||
'uploaded_to_this_item' => __('Uploaded to this Speaker', 'mage-eventpress'),
|
||||
'items_list' => __('Speaker list', 'mage-eventpress'),
|
||||
'items_list_navigation' => __('Speaker list navigation', 'mage-eventpress'),
|
||||
'filter_items_list' => __('Filter Speaker list', 'mage-eventpress'),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
'public' => true,
|
||||
'labels' => $labels,
|
||||
'menu_icon' => 'dashicons-calendar-alt',
|
||||
'supports' => array('title', 'editor', 'thumbnail', 'excerpt'),
|
||||
'rewrite' => array('slug' => 'event-speaker'),
|
||||
'show_in_menu' => 'edit.php?post_type=mep_events',
|
||||
|
||||
);
|
||||
|
||||
if($speaker_status == 'yes'){
|
||||
register_post_type('mep_event_speaker', $args);
|
||||
}
|
||||
}
|
||||
add_action( 'init', 'mep_cpt' );
|
||||
add_action('init', 'mep_cpt');
|
|
@ -1,305 +1,2 @@
|
|||
<?php
|
||||
add_action( 'admin_notices', 'export_btn' );
|
||||
function export_btn() {
|
||||
global $typenow;
|
||||
if ($typenow == 'mep_events_attendees') {
|
||||
?>
|
||||
<div class="wrap alignright">
|
||||
<form method='get' action="edit.php">
|
||||
<input type="hidden" name='post_type' value="mep_events_attendees"/>
|
||||
<input type="hidden" name='noheader' value="1"/>
|
||||
<?php
|
||||
if ( isset( $_GET['meta_value'] )) {
|
||||
?>
|
||||
<input type="hidden" name='meta_value' value="<?php echo $_GET['meta_value']; ?>"/>
|
||||
<?php } ?>
|
||||
<input type="hidden" name='action' value="download_csv"/>
|
||||
<input type="submit" name='export' id="csvExport" value="<?php _e('Export to CSV','mage-eventpress'); ?>"/>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function mep_get_event_user_fields($post_id){
|
||||
global $woocommerce, $post;
|
||||
|
||||
$tee = get_post_meta($post_id,'mep_reg_tshirtsize',true);
|
||||
$adrs = get_post_meta($post_id,'mep_reg_address',true);
|
||||
if($tee){ $teee = 'Tee Size'; }else{ $teee = ''; }
|
||||
if($adrs){ $address = 'Addresss'; }else{ $address = ''; }
|
||||
|
||||
$row = array(
|
||||
'Ticket No',
|
||||
'Order ID',
|
||||
'Event',
|
||||
'Ticket',
|
||||
'Full Name',
|
||||
'Email',
|
||||
'Phone',
|
||||
$address,
|
||||
$teee,
|
||||
'Check in'
|
||||
);
|
||||
|
||||
|
||||
$crow = array();
|
||||
$mep_form_builder_data = get_post_meta($post_id, 'mep_form_builder_data', true);
|
||||
if ( $mep_form_builder_data ) {
|
||||
foreach ( $mep_form_builder_data as $_field ) {
|
||||
$crow[] = $_field['mep_fbc_label'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$order = get_post_meta($post_id, 'mep_events_extra_prices', true);
|
||||
$exs = array();
|
||||
if($order){
|
||||
foreach ($order as $_exs) {
|
||||
$exs[] = $_exs['option_name'];
|
||||
}
|
||||
}
|
||||
return array_merge(array_filter($row), $crow, $exs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function mep_get_event_user_fields_data($post_id,$event){
|
||||
$values = get_post_custom( $post_id );
|
||||
|
||||
$checkin_status = get_post_meta($post_id,'mep_checkin',true);
|
||||
|
||||
if($checkin_status){
|
||||
$status = $checkin_status;
|
||||
}else{
|
||||
$status = 'no';
|
||||
}
|
||||
$tee = get_post_meta($event,'mep_reg_tshirtsize',true);
|
||||
$adrs = get_post_meta($event,'mep_reg_address',true);
|
||||
if($tee){ $teee = get_post_meta( $post_id, 'ea_tshirtsize', true ); }else{ $teee = ''; }
|
||||
if($adrs){ $address = get_post_meta( $post_id, 'ea_address_1', true ); }else{ $address = ''; }
|
||||
|
||||
$ticket = get_post_meta( $post_id, 'ea_user_id', true ).get_post_meta( $post_id, 'ea_order_id', true ).$event.$post_id;
|
||||
|
||||
|
||||
$row = array(
|
||||
$ticket,
|
||||
get_post_meta( $post_id, 'ea_order_id', true ),
|
||||
get_post_meta( $post_id, 'ea_event_name', true ),
|
||||
get_post_meta( $post_id, 'ea_ticket_type', true ),
|
||||
get_post_meta( $post_id, 'ea_name', true ),
|
||||
get_post_meta( $post_id, 'ea_email', true ),
|
||||
get_post_meta( $post_id, 'ea_phone', true ),
|
||||
$address,
|
||||
$teee,
|
||||
$status
|
||||
);
|
||||
$crow = array();
|
||||
$mep_form_builder_data = get_post_meta($event, 'mep_form_builder_data', true);
|
||||
if ( $mep_form_builder_data ) {
|
||||
foreach ( $mep_form_builder_data as $_field ) {
|
||||
$vname = "ea_".$_field['mep_fbc_id'];
|
||||
if(array_key_exists($vname, $values)){
|
||||
$crow[] = get_post_meta( $post_id, $vname , true );
|
||||
}else{
|
||||
$crow[] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order = get_post_meta($event, 'mep_events_extra_prices', true);
|
||||
$exs = array();
|
||||
$order_extra_service_arr = mep_get_event_extra_service_items($post_id);
|
||||
if($order_extra_service_arr){
|
||||
if($order){
|
||||
foreach ($order as $_exs) {
|
||||
// $exs[] = $_exs['option_name'];
|
||||
$exs[] = mep_get_extra_service_order_qty($_exs['option_name'], $order_extra_service_arr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge(array_filter($row), $crow, $exs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function mep_get_event_extra_service_items($post_id){
|
||||
global $wpdb;
|
||||
$order_id = get_post_meta($post_id, 'ea_order_id', true);
|
||||
$item_table_name = $wpdb->prefix."woocommerce_order_items";
|
||||
if($order_id){
|
||||
$sql = "SELECT order_item_id FROM $item_table_name WHERE order_item_type = 'line_item' AND order_id=$order_id";
|
||||
$results = $wpdb->get_results($sql); //or die(mysql_error());
|
||||
|
||||
if(!empty($results)){
|
||||
$order_item_id = $results[0]->order_item_id;
|
||||
|
||||
$table_name = $wpdb->prefix."woocommerce_order_itemmeta";
|
||||
|
||||
$sql2 = "SELECT meta_value FROM $table_name WHERE order_item_id =$order_item_id AND meta_key='_event_service_info'";
|
||||
$results2 = $wpdb->get_results($sql2);
|
||||
|
||||
if($results2){
|
||||
return unserialize($results2[0]->meta_value);
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
}else{
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function mep_get_extra_service_order_qty($name, $array) {
|
||||
if(!empty($array)){
|
||||
foreach ($array as $key => $val) {
|
||||
if ($val['option_name'] === $name ) {
|
||||
return $val['option_qty'];
|
||||
// return $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Add action hook only if action=download_csv
|
||||
if ( isset($_GET['action'] ) && $_GET['action'] == 'download_csv' ) {
|
||||
// Handle CSV Export
|
||||
add_action( 'admin_init', 'csv_export') ;
|
||||
}
|
||||
function csv_export() {
|
||||
// Check for current user privileges
|
||||
if( !current_user_can( 'manage_options' ) ){ return false; }
|
||||
// Check if we are in WP-Admin
|
||||
if( !is_admin() ){ return false; }
|
||||
// Nonce Check
|
||||
// $nonce = isset( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : '';
|
||||
// if ( ! wp_verify_nonce( $nonce, 'download_csv' ) ) {
|
||||
// die( 'Security check error' );
|
||||
// }
|
||||
ob_start();
|
||||
$domain = $_SERVER['SERVER_NAME'];
|
||||
$filename = 'Event_Manager_Export_' . $domain . '_' . time() . '.csv';
|
||||
|
||||
|
||||
if(isset($_GET['meta_value'])){
|
||||
$post_id = strip_tags($_GET['meta_value']);
|
||||
$header_row = mep_get_event_user_fields($post_id);
|
||||
}else{
|
||||
$header_row = array(
|
||||
'Ticket No',
|
||||
'Order ID',
|
||||
'Event',
|
||||
'Ticket',
|
||||
'Full Name',
|
||||
'Email',
|
||||
'Phone',
|
||||
'Addresss',
|
||||
'Tee Size',
|
||||
'Check in'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$data_rows = array();
|
||||
global $wpdb;
|
||||
|
||||
if(isset($_GET['meta_value'])){
|
||||
$meta = $_GET['meta_value'];
|
||||
$query = "SELECT post_id
|
||||
FROM {$wpdb->prefix}postmeta
|
||||
WHERE meta_value = $meta
|
||||
ORDER BY meta_id ASC";
|
||||
}else{
|
||||
$query = "SELECT ID
|
||||
FROM {$wpdb->prefix}posts
|
||||
WHERE post_type ='mep_events_attendees'
|
||||
ORDER BY ID ASC";
|
||||
}
|
||||
|
||||
$posts = $wpdb->get_results($query);
|
||||
foreach ( $posts as $i=>$post ) {
|
||||
|
||||
if(isset($_GET['meta_value'])){
|
||||
$post_id = $post->post_id;
|
||||
}else{
|
||||
$post_id = $post->ID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$status = get_post_status($post_id);
|
||||
|
||||
if($status=='publish'){
|
||||
if(isset($_GET['meta_value'])){
|
||||
|
||||
$event = strip_tags($_GET['meta_value']);
|
||||
$row = mep_get_event_user_fields_data($post_id,$event);
|
||||
}else{
|
||||
$post_id = $post->ID;
|
||||
|
||||
|
||||
$checkin_status = get_post_meta($post_id,'mep_checkin',true);
|
||||
|
||||
if($checkin_status){
|
||||
$status = $checkin_status;
|
||||
}else{
|
||||
$status = 'no';
|
||||
}
|
||||
|
||||
|
||||
$ticket = get_post_meta( $post_id, 'ea_user_id', true ).get_post_meta( $post_id, 'ea_order_id', true ).get_post_meta( $post_id, 'ea_event_id', true ).$post_id;
|
||||
|
||||
|
||||
$row = array(
|
||||
$ticket,
|
||||
get_post_meta( $post_id, 'ea_order_id', true ),
|
||||
get_post_meta( $post_id, 'ea_event_name', true ),
|
||||
get_post_meta( $post_id, 'ea_ticket_type', true ),
|
||||
get_post_meta( $post_id, 'ea_name', true ),
|
||||
get_post_meta( $post_id, 'ea_email', true ),
|
||||
get_post_meta( $post_id, 'ea_phone', true ),
|
||||
get_post_meta( $post_id, 'ea_address_1', true ),
|
||||
get_post_meta( $post_id, 'ea_tshirtsize', true ),
|
||||
$status
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$data_rows[] = $row;
|
||||
}
|
||||
}
|
||||
$fh = @fopen( 'php://output', 'w' );
|
||||
fprintf( $fh, chr(0xEF) . chr(0xBB) . chr(0xBF) );
|
||||
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-type: text/csv' );
|
||||
header( "Content-Disposition: attachment; filename={$filename}" );
|
||||
header( 'Expires: 0' );
|
||||
header( 'Pragma: public' );
|
||||
fputcsv( $fh, $header_row );
|
||||
foreach ( $data_rows as $data_row ) {
|
||||
fputcsv( $fh, $data_row );
|
||||
}
|
||||
fclose( $fh );
|
||||
|
||||
ob_end_flush();
|
||||
|
||||
die();
|
||||
}
|
||||
<?php
|
||||
// Noting is Here....
|
|
@ -1,64 +1,83 @@
|
|||
<?php
|
||||
// Enqueue Scripts for admin dashboard
|
||||
add_action('admin_enqueue_scripts', 'mep_event_admin_scripts');
|
||||
function mep_event_admin_scripts() {
|
||||
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
|
||||
wp_enqueue_script('jquery-ui-datepicker');
|
||||
wp_enqueue_script('jquery-ui-core');
|
||||
wp_enqueue_style('mep-admin-style',plugin_dir_url( __DIR__ ).'css/admin_style.css',array());
|
||||
|
||||
if($user_api){
|
||||
wp_enqueue_script('gmap-libs','https://maps.googleapis.com/maps/api/js?key='.$user_api.'&libraries=places&callback=initMap',array('jquery','gmap-scripts'),1,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Admin Enqueue Scripts & Style Files are Hooked up below for WooOCmmerce Event Manager Plugin
|
||||
*/
|
||||
add_action('admin_enqueue_scripts', 'mep_add_admin_scripts', 10, 1);
|
||||
function mep_add_admin_scripts($hook)
|
||||
{
|
||||
global $post;
|
||||
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
|
||||
|
||||
/**
|
||||
* Load Only when the New Event Add Page Open.
|
||||
*/
|
||||
if ($hook == 'post-new.php' || $hook == 'post.php') {
|
||||
if ('mep_events' === $post->post_type) {
|
||||
wp_enqueue_script('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core'), 1, true);
|
||||
wp_enqueue_script('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'js/jquery-ui-sliderAccess.js', array('jquery', 'jquery-ui-core', 'jquery-ui-timepicker-addon'), 1, true);
|
||||
wp_enqueue_script('mep_datepicker', plugin_dir_url(__DIR__) . 'js/mep_datepicker.js', array('jquery', 'jquery-ui-core', 'jquery-ui-timepicker-addon'), 1, true);
|
||||
wp_enqueue_style('jquery-ui-timepicker-addon', plugin_dir_url(__DIR__) . 'css/jquery-ui-timepicker-addon.css', array());
|
||||
wp_enqueue_style('mep-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
|
||||
wp_enqueue_script('gmap-scripts', plugin_dir_url(__DIR__) . 'js/mkb-admin.js', array('jquery', 'jquery-ui-core'), 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If Your Save Google API Then Load the Google Map API
|
||||
*/
|
||||
if ($user_api) {
|
||||
wp_enqueue_script('gmap-libs', 'https://maps.googleapis.com/maps/api/js?key=' . $user_api . '&libraries=places&callback=initMap', array('jquery', 'gmap-scripts'), 1, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enquue Admin Styles
|
||||
*/
|
||||
|
||||
wp_enqueue_style('mage-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
|
||||
wp_enqueue_style('mage-options-framework', plugin_dir_url(__DIR__) . 'css/mage-options-framework.css');
|
||||
wp_enqueue_style('jquery-ui', plugin_dir_url(__DIR__) . 'css/jquery-ui.css');
|
||||
wp_enqueue_style('select2.min', plugin_dir_url(__DIR__) . 'css/select2.min.css');
|
||||
wp_enqueue_style('codemirror', plugin_dir_url(__DIR__) . 'css/codemirror.css');
|
||||
wp_enqueue_style('font-awesome-css-cdn', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.2.0/css/all.min.css", null, 1);
|
||||
wp_enqueue_style('mep-admin-style', plugin_dir_url(__DIR__) . 'css/admin_style.css', array());
|
||||
|
||||
|
||||
function mep_add_admin_scripts( $hook ) {
|
||||
|
||||
global $post;
|
||||
|
||||
if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
|
||||
if ( 'mep_events' === $post->post_type ) {
|
||||
wp_enqueue_script('jquery-ui-timepicker-addon',plugin_dir_url( __DIR__ ).'js/jquery-ui-timepicker-addon.js',array('jquery','jquery-ui-core'),1,true);
|
||||
wp_enqueue_script('jquery-ui-timepicker-addon',plugin_dir_url( __DIR__ ).'js/jquery-ui-sliderAccess.js',array('jquery','jquery-ui-core','jquery-ui-timepicker-addon'),1,true);
|
||||
wp_enqueue_script('mep_datepicker',plugin_dir_url( __DIR__ ).'js/mep_datepicker.js',array('jquery','jquery-ui-core','jquery-ui-timepicker-addon'),1,true);
|
||||
|
||||
wp_enqueue_style('jquery-ui-timepicker-addon',plugin_dir_url( __DIR__ ).'css/jquery-ui-timepicker-addon.css',array());
|
||||
wp_enqueue_style('mep-jquery-ui-style',plugin_dir_url( __DIR__ ).'css/jquery-ui.css',array());
|
||||
wp_enqueue_script('gmap-scripts',plugin_dir_url( __DIR__ ).'js/mkb-admin.js',array('jquery','jquery-ui-core'),1,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action( 'admin_enqueue_scripts', 'mep_add_admin_scripts', 10, 1 );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Enqueue Scripts for frontend
|
||||
add_action('wp_enqueue_scripts', 'mep_event_enqueue_scripts',90);
|
||||
function mep_event_enqueue_scripts() {
|
||||
wp_enqueue_script('jquery');
|
||||
wp_enqueue_script('jquery-ui-accordion');
|
||||
wp_enqueue_style('mep-jquery-ui-style',plugin_dir_url( __DIR__ ).'css/jquery-ui.css',array());
|
||||
wp_enqueue_style('mep-event-style',plugin_dir_url( __DIR__ ).'css/style.css',array());
|
||||
wp_enqueue_style('mep-event-owl-carousal-main-style',plugin_dir_url( __DIR__ ).'css/owl.carousel.min.css',array('mep-event-style'));
|
||||
wp_enqueue_style('mep-event-owl-carousal-default-style',plugin_dir_url( __DIR__ ).'css/owl.theme.default.min.css',array('mep-event-style'));
|
||||
wp_enqueue_style('mep-event-timeline-min-style',plugin_dir_url( __DIR__ ).'css/timeline.min.css',array('mep-event-style'));
|
||||
wp_enqueue_style ('font-awesome-css-cdn',"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css",null,1);
|
||||
wp_enqueue_style('mep-calendar-min-style',plugin_dir_url( __DIR__ ).'css/calendar.min.css',array());
|
||||
wp_enqueue_script('mep-moment-js',plugin_dir_url( __DIR__ ).'js/moment.js',array(),1,true);
|
||||
wp_enqueue_script('mep-calendar-scripts',plugin_dir_url( __DIR__ ).'js/calendar.min.js',array('jquery','mep-moment-js'),1,false);
|
||||
wp_enqueue_script('mep-mixitup-min-js',plugin_dir_url( __DIR__ ).'js/mixitup.min.js',array(),1,true);
|
||||
wp_enqueue_script('mep-owl-carousel-min',plugin_dir_url( __DIR__ ).'js/owl.carousel.min.js',array('jquery'),1,true);
|
||||
wp_enqueue_script('mep-timeline-min',plugin_dir_url( __DIR__ ).'js/timeline.min.js',array('jquery'),1,true);
|
||||
wp_enqueue_script('mep-event-custom-scripts',plugin_dir_url( __DIR__ ).'js/mkb-scripts.js',array(),1,true);
|
||||
/**
|
||||
* Enquue Admin Scripts
|
||||
*/
|
||||
wp_enqueue_script('jquery-ui-core');
|
||||
wp_enqueue_script('jquery-ui-datepicker');
|
||||
wp_enqueue_script('jquery-ui-sortable');
|
||||
wp_enqueue_style('wp-color-picker');
|
||||
wp_enqueue_script('wp-color-picker');
|
||||
wp_enqueue_script('magepeople-options-framework', plugins_url('js/mage-options-framework.js', __DIR__), array('jquery'));
|
||||
wp_localize_script('PickpluginsOptionsFramework', 'PickpluginsOptionsFramework_ajax', array('PickpluginsOptionsFramework_ajaxurl' => admin_url('admin-ajax.php')));
|
||||
wp_enqueue_script('select2.min', plugins_url('js/select2.min.js', __DIR__), array('jquery'));
|
||||
wp_enqueue_script('codemirror', plugin_dir_url(__DIR__) . 'js/codemirror.min.js', array('jquery'), null, false);
|
||||
wp_enqueue_script('form-field-dependency', plugins_url('js/form-field-dependency.js', __DIR__), array('jquery'), null, false);
|
||||
}
|
||||
|
||||
// Enqueue Scripts for frontend
|
||||
add_action('at_footer', 'mep_event_custom_enqueue_scripts');
|
||||
function mep_event_custom_enqueue_scripts() {
|
||||
wp_enqueue_script('jquery-barcode',plugin_dir_url( __DIR__ ).'js/jquery-barcode.min.js',array('jquery'),1,true);
|
||||
}
|
||||
/**
|
||||
* Woocommerce Event Manager Style & Scripts Hooked up below for the Frontend
|
||||
*/
|
||||
add_action('wp_enqueue_scripts', 'mep_event_enqueue_scripts', 90);
|
||||
function mep_event_enqueue_scripts()
|
||||
{
|
||||
wp_enqueue_script('jquery');
|
||||
wp_enqueue_script('jquery-ui-accordion');
|
||||
wp_enqueue_style('mep-jquery-ui-style', plugin_dir_url(__DIR__) . 'css/jquery-ui.css', array());
|
||||
wp_enqueue_style('mep-event-style', plugin_dir_url(__DIR__) . 'css/style.css', array());
|
||||
wp_enqueue_style('mep-event-owl-carousal-main-style', plugin_dir_url(__DIR__) . 'css/owl.carousel.min.css', array('mep-event-style'));
|
||||
wp_enqueue_style('mep-event-owl-carousal-default-style', plugin_dir_url(__DIR__) . 'css/owl.theme.default.min.css', array('mep-event-style'));
|
||||
wp_enqueue_style('mep-event-timeline-min-style', plugin_dir_url(__DIR__) . 'css/timeline.min.css', array('mep-event-style'));
|
||||
wp_enqueue_style('font-awesome-css-cdn-5.2.0', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.2.0/css/all.min.css", null, 1);
|
||||
wp_enqueue_style('font-awesome-css-cdn', "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css", null, 1);
|
||||
wp_enqueue_style('mep-calendar-min-style', plugin_dir_url(__DIR__) . 'css/calendar.min.css', array());
|
||||
wp_enqueue_script('mep-moment-js', plugin_dir_url(__DIR__) . 'js/moment.js', array(), 1, true);
|
||||
wp_enqueue_script('mep-calendar-scripts', plugin_dir_url(__DIR__) . 'js/calendar.min.js', array('jquery', 'mep-moment-js'), 1, false);
|
||||
wp_enqueue_script('mep-mixitup-min-js', plugin_dir_url(__DIR__) . 'js/mixitup.min.js', array(), 1, true);
|
||||
wp_enqueue_script('mep-owl-carousel-min', plugin_dir_url(__DIR__) . 'js/owl.carousel.min.js', array('jquery'), 1, true);
|
||||
wp_enqueue_script('mep-timeline-min', plugin_dir_url(__DIR__) . 'js/timeline.min.js', array('jquery'), 1, true);
|
||||
wp_enqueue_script('mep-event-custom-scripts', plugin_dir_url(__DIR__) . 'js/mkb-scripts.js', array(), 1, true);
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
die;
|
||||
} // Cannot access pages directly.
|
||||
|
||||
/**
|
||||
* In the Version 3.5 we will introducing Mage Freamwork, All of our Plugin will use this same Freamwork, This is the Beta test in the Event Plugin.
|
||||
*/
|
||||
|
||||
add_action('admin_init', 'mep_fw_meta_boxs');
|
||||
function mep_fw_meta_boxs()
|
||||
{
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
/**
|
||||
* This Will create Meta Boxes For Speakers Custom Post Type.
|
||||
*/
|
||||
$speakers_meta_boxs = array(
|
||||
'page_nav' => __('Speakers Meta Box', 'mage-eventpress'),
|
||||
'priority' => 10,
|
||||
'sections' => array(
|
||||
'section_2' => array(
|
||||
'title' => __('', 'mage-eventpress'),
|
||||
'description' => __('', 'mage-eventpress'),
|
||||
'options' => array(
|
||||
// Meta Boxes Will Here as Array
|
||||
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
$speaker_meta_args = array(
|
||||
'meta_box_id' => 'mep_event_speakers_meta_boxes',
|
||||
'meta_box_title' => __('Speakers Additional Information', 'mage-eventpress'),
|
||||
//'callback' => '_meta_box_callback',
|
||||
'screen' => array('mep_event_speaker'),
|
||||
'context' => 'normal', // 'normal', 'side', and 'advanced'
|
||||
'priority' => 'high', // 'high', 'low'
|
||||
'callback_args' => array(),
|
||||
'nav_position' => 'none', // right, top, left, none
|
||||
'item_name' => "MagePeople",
|
||||
'item_version' => "2.0",
|
||||
'panels' => array(
|
||||
'speakers_meta_boxs' => $speakers_meta_boxs
|
||||
|
||||
),
|
||||
);
|
||||
//new AddMetaBox( $speaker_meta_args );
|
||||
|
||||
|
||||
/**
|
||||
* This Will create Meta Boxes For Events Custom Post Type.
|
||||
*/
|
||||
$events_speaker_list_meta_boxs = array(
|
||||
'page_nav' => __('Event Additional Meta Boxes', 'mage-eventpress'),
|
||||
'priority' => 10,
|
||||
'sections' => array(
|
||||
'section_2' => array(
|
||||
'title' => __('', 'mage-eventpress'),
|
||||
'description' => __('', 'mage-eventpress'),
|
||||
'options' => array(
|
||||
// Meta Boxes Will Here as Array
|
||||
array(
|
||||
'id' => 'mep_event_speaker_icon',
|
||||
'title' => __('Speaker Icon','mage-eventpress'),
|
||||
'details' => __('Please Select the Icon which will show as Speaker Icon','mage-eventpress'),
|
||||
'default' => 'fas fa-microphone',
|
||||
'type' => 'icon',
|
||||
'args' => 'FONTAWESOME_ARRAY',
|
||||
),
|
||||
array(
|
||||
'id' => 'mep_speaker_title',
|
||||
'title' => __('Section Label','mage-eventpress'),
|
||||
'details' => __('This Text will be the heading of the Speaker List in the frontend. by default: Speakers ','mage-eventpress'),
|
||||
'type' => 'text',
|
||||
'default' => "Speaker's",
|
||||
'placeholder' => __("Speaker's",'mage-eventpress'),
|
||||
),
|
||||
array(
|
||||
'id' => 'mep_event_speakers_list',
|
||||
'title' => __('Speakers', 'mage-eventpress'),
|
||||
'details' => __('Please select Speakers, You can <a href="' . get_admin_url() . 'post-new.php?post_type=mep_event_speaker' . '">Add New Speakers From Here</a>', 'mage-eventpress'),
|
||||
'multiple' => true,
|
||||
'limit' => '3',
|
||||
'type' => 'select2',
|
||||
'args' => 'CPT_%mep_event_speaker%',
|
||||
),
|
||||
|
||||
array(
|
||||
'id' => 'mep_event_type',
|
||||
'title' => __('Event Type', 'mage-eventpress'),
|
||||
'details' => __('Please Select Event Type, This will add a Rebon in the event list', 'mage-eventpress'),
|
||||
'type' => 'select',
|
||||
'args' => array(
|
||||
'offline' => __('Offline Event', 'mage-eventpress'),
|
||||
'online' => __('Online/Virtual Event', 'mage-eventpress')
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
$events_speaker_list_meta_args = array(
|
||||
'meta_box_id' => 'mep_event_speakers_list_meta_boxes',
|
||||
'meta_box_title' => __('Event Speaker Information', 'mage-eventpress'),
|
||||
'screen' => array('mep_events'),
|
||||
'context' => 'normal',
|
||||
'priority' => 'high',
|
||||
'callback_args' => array(),
|
||||
'nav_position' => 'none',
|
||||
'item_name' => "MagePeople",
|
||||
'item_version' => "2.0",
|
||||
'panels' => array(
|
||||
'events_speaker_list_meta_boxs' => $events_speaker_list_meta_boxs
|
||||
)
|
||||
);
|
||||
|
||||
if($speaker_status == 'yes'){
|
||||
new AddMetaBox($events_speaker_list_meta_args);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,409 +1,236 @@
|
|||
<?php
|
||||
function mep_add_custom_fields_text_to_cart_item( $cart_item_data, $product_id, $variation_id ){
|
||||
/**
|
||||
* This File is a very important file, Because Its gettings Data from user selection on event details page, and prepare the data send to cart item and lastly save into order table after checkout
|
||||
*/
|
||||
|
||||
$product_id = get_post_meta($product_id,'link_mep_event',true) ? get_post_meta($product_id,'link_mep_event',true) : $product_id;
|
||||
$recurring = get_post_meta($product_id, 'mep_enable_recurring', true) ? get_post_meta($product_id, 'mep_enable_recurring', true) : 'no';
|
||||
if (get_post_type($product_id) == 'mep_events') {
|
||||
$tp = get_post_meta($product_id,'_price',true);
|
||||
$new = array();
|
||||
|
||||
/**
|
||||
* This Function Recieve the date from user selection and add them into the cart session data
|
||||
*/
|
||||
function mep_add_custom_fields_text_to_cart_item($cart_item_data, $product_id, $variation_id)
|
||||
{
|
||||
|
||||
$product_id = get_post_meta($product_id, 'link_mep_event', true) ? get_post_meta($product_id, 'link_mep_event', true) : $product_id;
|
||||
$recurring = get_post_meta($product_id, 'mep_enable_recurring', true) ? get_post_meta($product_id, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
if (get_post_type($product_id) == 'mep_events') {
|
||||
/**
|
||||
* Getting and Preparing Data From User Selection
|
||||
*/
|
||||
$total_price = get_post_meta($product_id, '_price', true);
|
||||
$form_position = mep_get_option('mep_user_form_position', 'general_attendee_sec', 'details_page');
|
||||
$mep_event_start_date = isset($_POST['mep_event_start_date']) ? $_POST['mep_event_start_date'] : array();
|
||||
$event_cart_location = isset($_POST['mep_event_location_cart']) ? $_POST['mep_event_location_cart'] : array();
|
||||
$event_cart_date = isset($_POST['mep_event_date_cart']) ? $_POST['mep_event_date_cart'] : array();
|
||||
$mep_event_start_date = isset($_POST['mep_event_start_date']) ? $_POST['mep_event_start_date'] : array();
|
||||
$checked = isset($_POST['event_addt_price']) ? $_POST['event_addt_price'] : array();
|
||||
$names = isset($_POST['option_name']) ? $_POST['option_name'] : array();
|
||||
$qty = isset($_POST['option_qty']) ? $_POST['option_qty'] : array();
|
||||
$max_qty = isset($_POST['max_qty']) ? $_POST['max_qty'] : array();
|
||||
$price = isset($_POST['option_price']) ? $_POST['option_price'] : array();
|
||||
$recurring_event_date = $recurring == 'yes' ? isset($_POST['recurring_event_date']) ? $_POST['recurring_event_date'] : array() : array();
|
||||
$count = count( $names );
|
||||
$recurring_event_date = $recurring == 'yes' && isset($_POST['recurring_event_date']) ? $_POST['recurring_event_date'] : array();
|
||||
$ticket_type_arr = mep_cart_ticket_type('ticket_type', $total_price,$product_id);
|
||||
$total_price = mep_cart_ticket_type('ticket_price', $total_price,$product_id);
|
||||
$event_extra = mep_cart_event_extra_service('event_extra_service', $total_price);
|
||||
$total_price = mep_cart_event_extra_service('ticket_price', $total_price);
|
||||
$user = $form_position == 'details_page' ? mep_save_attendee_info_into_cart($product_id) : array();
|
||||
$validate = mep_cart_ticket_type('validation_data', $total_price,$product_id);
|
||||
|
||||
if(isset($_POST['option_name'])){
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
if($qty[$i] > 0){
|
||||
if ( $names[$i] != '' ) :
|
||||
$ticket_type_arr[$i]['ticket_name'] = stripslashes( strip_tags( $names[$i] ) );
|
||||
endif;
|
||||
if ( $price[$i] != '' ) :
|
||||
$ticket_type_arr[$i]['ticket_price'] = stripslashes( strip_tags( $price[$i] ) );
|
||||
endif;
|
||||
if ( $qty[$i] != '' ) :
|
||||
$ticket_type_arr[$i]['ticket_qty'] = stripslashes( strip_tags( $qty[$i] ) );
|
||||
endif;
|
||||
if ( $max_qty[$i] != '' ) :
|
||||
$ticket_type_arr[$i]['max_qty'] = stripslashes( strip_tags( $max_qty[$i] ) );
|
||||
endif;
|
||||
if ( $mep_event_start_date[$i] != '' ) :
|
||||
$ticket_type_arr[$i]['event_date'] = stripslashes( strip_tags( $mep_event_start_date[$i] ) );
|
||||
endif;
|
||||
$opttprice = ($price[$i]*$qty[$i]);
|
||||
$tp = ($tp+$opttprice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$extra_service_name = isset($_POST['event_extra_service_name']) ? mage_array_strip($_POST['event_extra_service_name']) : array();
|
||||
$extra_service_qty = isset($_POST['event_extra_service_qty'])? mage_array_strip($_POST['event_extra_service_qty']):array();
|
||||
$extra_service_price = isset($_POST['event_extra_service_price'])? mage_array_strip($_POST['event_extra_service_price']):array();
|
||||
|
||||
if($extra_service_name){
|
||||
for ( $i = 0; $i < count($extra_service_name); $i++ ) {
|
||||
if($extra_service_qty[$i] > 0){
|
||||
if ( $extra_service_name[$i] != '' ) :
|
||||
$event_extra[$i]['service_name'] = stripslashes( strip_tags( $extra_service_name[$i] ) );
|
||||
endif;
|
||||
if ( $extra_service_price[$i] != '' ) :
|
||||
$event_extra[$i]['service_price'] = stripslashes( strip_tags( $extra_service_price[$i] ) );
|
||||
endif;
|
||||
if ( $extra_service_qty[$i] != '' ) :
|
||||
$event_extra[$i]['service_qty'] = stripslashes( strip_tags( $extra_service_qty[$i] ) );
|
||||
endif;
|
||||
}
|
||||
$extprice = ($extra_service_price[$i]*$extra_service_qty[$i]);
|
||||
$tp = ($tp+$extprice);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['mep_event_ticket_type'])){
|
||||
$ttp = $_POST['mep_event_ticket_type'];
|
||||
$ttpqt = $_POST['tcp_qty'];
|
||||
$ticket_type = mep_get_order_info($ttp,1);
|
||||
$ticket_type_price = (mep_get_order_info($ttp,0)*$ttpqt);
|
||||
$cart_item_data['event_ticket_type'] = $ticket_type;
|
||||
$cart_item_data['event_ticket_price'] = $ticket_type_price;
|
||||
$cart_item_data['event_ticket_qty'] = $ttpqt;
|
||||
$tp = $tp+$ticket_type_price;
|
||||
}
|
||||
|
||||
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
|
||||
if($form_position=='details_page'){
|
||||
$user = mep_save_attendee_info_into_cart($product_id);
|
||||
}else{
|
||||
$user = '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$mep_event_ticket_type = get_post_meta($product_id, 'mep_event_ticket_type', true) ? get_post_meta($product_id, 'mep_event_ticket_type', true) : array();
|
||||
$cnt = 0;
|
||||
$vald = 0;
|
||||
// $ticket_type_arr = array();
|
||||
if(is_array($mep_event_ticket_type) && sizeof($mep_event_ticket_type) > 0){
|
||||
// foreach($mep_event_ticket_type as $_type){
|
||||
|
||||
// $cart_arr = $new[$cnt];
|
||||
// $name_key = array_search($_type['option_name_t'],$cart_arr);
|
||||
// $qty_key = array_search($_type['option_qty_t'],$cart_arr);
|
||||
|
||||
// if(is_array($name_key)){
|
||||
// $total_found = count($name_key);
|
||||
// }else{
|
||||
// $total_found = 0;
|
||||
// }
|
||||
// if($cart_arr['option_qty'] > 0){
|
||||
|
||||
// $ticket_type_arr[$cnt]['ticket_name'] = stripslashes( strip_tags( $cart_arr[$name_key] ) );
|
||||
// $ticket_type_arr[$cnt]['ticket_qty'] = stripslashes( strip_tags( $cart_arr['option_qty'] ) );
|
||||
// $ticket_type_arr[$cnt]['ticket_price'] = stripslashes( strip_tags( $cart_arr['option_price'] ) );
|
||||
// $ticket_type_arr[$cnt]['event_date'] = stripslashes( strip_tags( $cart_arr['event_data'] ) );
|
||||
// $validate[$cnt]['ticket_qty'] = $vald + stripslashes( strip_tags( $cart_arr['option_qty'] ) );
|
||||
// $validate[$cnt]['event_id'] = stripslashes( strip_tags( $product_id ) );
|
||||
// }
|
||||
|
||||
// $cnt++;
|
||||
// }
|
||||
}
|
||||
|
||||
// print_r($ticket_type_arr);
|
||||
// die();
|
||||
|
||||
|
||||
$cart_item_data['event_ticket_info'] = $ticket_type_arr;
|
||||
$cart_item_data['event_validate_info'] = $validate;
|
||||
$cart_item_data['event_extra_option'] = $new;
|
||||
$cart_item_data['event_user_info'] = $user;
|
||||
$cart_item_data['event_tp'] = $tp;
|
||||
$cart_item_data['line_total'] = $tp;
|
||||
$cart_item_data['line_subtotal'] = $tp;
|
||||
$cart_item_data['event_extra_service'] = $event_extra;
|
||||
$cart_item_data['event_cart_location'] = $event_cart_location;
|
||||
$cart_item_data['event_cart_date'] = $mep_event_start_date;
|
||||
$cart_item_data['event_recurring_date'] = array_unique($recurring_event_date);
|
||||
$cart_item_data['event_recurring_date_arr'] = $recurring_event_date;
|
||||
// $cart_item_data['event_cart_date'] = $event_cart_date;
|
||||
}
|
||||
/**
|
||||
* Now Store the datas into Cart Session
|
||||
*/
|
||||
$cart_item_data['event_ticket_info'] = $ticket_type_arr;
|
||||
$cart_item_data['event_validate_info'] = $validate;
|
||||
$cart_item_data['event_user_info'] = $user;
|
||||
$cart_item_data['event_tp'] = $total_price;
|
||||
$cart_item_data['line_total'] = $total_price;
|
||||
$cart_item_data['line_subtotal'] = $total_price;
|
||||
$cart_item_data['event_extra_service'] = $event_extra;
|
||||
$cart_item_data['event_cart_location'] = $event_cart_location;
|
||||
$cart_item_data['event_cart_date'] = $mep_event_start_date[0];
|
||||
$cart_item_data['event_recurring_date'] = array_unique($recurring_event_date);
|
||||
$cart_item_data['event_recurring_date_arr'] = $recurring_event_date;
|
||||
$cart_item_data['event_cart_display_date'] = $mep_event_start_date[0];
|
||||
}
|
||||
$cart_item_data['event_id'] = $product_id;
|
||||
|
||||
return $cart_item_data;
|
||||
}
|
||||
add_filter( 'woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_cart_item', 90, 3);
|
||||
add_filter('woocommerce_add_cart_item_data', 'mep_add_custom_fields_text_to_cart_item', 90, 3);
|
||||
|
||||
|
||||
|
||||
add_action( 'woocommerce_before_calculate_totals', 'mep_add_custom_price',90,1 );
|
||||
function mep_add_custom_price( $cart_object ) {
|
||||
|
||||
foreach ( $cart_object->cart_contents as $key => $value ) {
|
||||
$eid = array_key_exists('event_id', $value) ? $value['event_id'] : 0; //$value['event_id'];
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$cp = $value['event_tp'];
|
||||
$value['data']->set_price($cp);
|
||||
$value['data']->set_regular_price($cp);
|
||||
$value['data']->set_sale_price($cp);
|
||||
$value['data']->set_sold_individually('yes');
|
||||
$new_price = $value['data']->get_price();
|
||||
}
|
||||
/**
|
||||
* Now need to update the cart price according to user selection, the below function is doing this part, Its getting the new parice and update the cart price to new
|
||||
*/
|
||||
add_action('woocommerce_before_calculate_totals', 'mep_add_custom_price', 90, 1);
|
||||
function mep_add_custom_price($cart_object)
|
||||
{
|
||||
foreach ($cart_object->cart_contents as $key => $value) {
|
||||
$event_id = array_key_exists('event_id', $value) ? $value['event_id'] : 0;
|
||||
if (get_post_type($event_id) == 'mep_events') {
|
||||
$event_total_price = $value['event_tp'];
|
||||
$value['data']->set_price($event_total_price);
|
||||
$value['data']->set_regular_price($event_total_price);
|
||||
$value['data']->set_sale_price($event_total_price);
|
||||
$value['data']->set_sold_individually('yes');
|
||||
$value['data']->get_price();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* After update the price now need to show user what they selected and the Price details, the below fuunction is for that, Its showing the details into the cart below the event name.
|
||||
*/
|
||||
function mep_display_custom_fields_text_cart($item_data, $cart_item)
|
||||
{
|
||||
$mep_events_extra_prices = array_key_exists('event_extra_option', $cart_item) ? $cart_item['event_extra_option'] : array(); //$cart_item['event_extra_option'];
|
||||
|
||||
function mep_display_custom_fields_text_cart( $item_data, $cart_item ) {
|
||||
$mep_events_extra_prices = array_key_exists('event_extra_option', $cart_item) ? $cart_item['event_extra_option'] : array(); //$cart_item['event_extra_option'];
|
||||
$eid = array_key_exists('event_id', $cart_item) ? $cart_item['event_id'] : 0; //$cart_item['event_id'];
|
||||
|
||||
$eid = array_key_exists('event_id', $cart_item) ? $cart_item['event_id'] : 0; //$cart_item['event_id'];
|
||||
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$user_info = $cart_item['event_user_info'];
|
||||
$ticket_type_arr = $cart_item['event_ticket_info'];
|
||||
$event_extra_service = $cart_item['event_extra_service'];
|
||||
$event_recurring_date = $cart_item['event_recurring_date'];
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($ticket_type_arr);
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$user_info = $cart_item['event_user_info'];
|
||||
$ticket_type_arr = $cart_item['event_ticket_info'];
|
||||
$event_extra_service = $cart_item['event_extra_service'];
|
||||
$event_recurring_date = $cart_item['event_recurring_date'];
|
||||
|
||||
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
echo "<ul class='event-custom-price'>";
|
||||
|
||||
echo "<ul class='event-custom-price'>";
|
||||
if ($recurring == 'yes') {
|
||||
if (is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0 && sizeof($user_info) == 0) {
|
||||
foreach ($ticket_type_arr as $_event_recurring_date) {
|
||||
?>
|
||||
<li><?php _e('Event Date', 'mage-eventpress'); ?>: <?php echo $cart_item['event_cart_date']; ?></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
if($recurring == 'yes'){
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0 && sizeof($user_info) == 0){
|
||||
foreach($ticket_type_arr as $_event_recurring_date){
|
||||
?>
|
||||
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo get_mep_datetime($_event_recurring_date['event_date'], 'date-time-text'); //date('D, d M Y H:i:s',strtotime($_event_recurring_date)); ?></li>
|
||||
<?php
|
||||
if (is_array($user_info) && sizeof($user_info) > 0) {
|
||||
echo '<li>';
|
||||
echo mep_cart_display_user_list($user_info);
|
||||
echo '</li>';
|
||||
}
|
||||
} else {
|
||||
|
||||
if (is_array($user_info) && sizeof($user_info) > 0) {
|
||||
echo '<li>';
|
||||
echo mep_cart_display_user_list($user_info);
|
||||
?>
|
||||
|
||||
<?php
|
||||
echo '</li>';
|
||||
} else {
|
||||
?>
|
||||
<li><?php _e('Event Date', 'mage-eventpress'); ?>: <?php echo get_mep_datetime($cart_item['event_cart_display_date'],'date-time-text'); ?></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($user_info) && sizeof($user_info) > 0){
|
||||
echo '<li>';
|
||||
foreach($user_info as $userinf){
|
||||
?>
|
||||
<ul>
|
||||
<?php if($userinf['user_name']){ ?> <li><?php _e('Name: ','mage-eventpress'); echo $userinf['user_name']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_email']){ ?> <li><?php _e('Email: ','mage-eventpress'); echo $userinf['user_email']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_phone']){ ?> <li><?php _e('Phone: ','mage-eventpress'); echo $userinf['user_phone']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_address']){ ?> <li><?php _e('Address: ','mage-eventpress'); echo $userinf['user_address']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_gender']){ ?> <li><?php _e('Gender: ','mage-eventpress'); echo $userinf['user_gender']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_tshirtsize']){ ?> <li><?php _e('T-Shirt Size: ','mage-eventpress'); echo $userinf['user_tshirtsize']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_company']){ ?> <li><?php _e('Company: ','mage-eventpress'); echo $userinf['user_company']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_designation']){ ?> <li><?php _e('Designation: ','mage-eventpress'); echo $userinf['user_designation']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_website']){ ?> <li><?php _e('Website: ','mage-eventpress'); echo $userinf['user_website']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_vegetarian']){ ?> <li><?php _e('Vegetarian: ','mage-eventpress'); echo $userinf['user_vegetarian']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_ticket_type']){ ?> <li><?php _e('Ticket Type: ','mage-eventpress'); echo $userinf['user_ticket_type']; ?></li> <?php } ?>
|
||||
<li><?php _e('Event Date:','mage-eventpress'); ?> <?php echo get_mep_datetime($userinf['user_event_date'], 'date-time-text'); ?></li>
|
||||
</ul>
|
||||
?>
|
||||
|
||||
<li><?php _e('Event Location', 'mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; ?></li>
|
||||
<?php
|
||||
}
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
if(is_array($user_info) && sizeof($user_info) > 0){
|
||||
echo '<li>';
|
||||
foreach($user_info as $userinf){
|
||||
?>
|
||||
<ul>
|
||||
<?php if($userinf['user_name']){ ?> <li><?php _e('Name: ','mage-eventpress'); echo $userinf['user_name']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_email']){ ?> <li><?php _e('Email: ','mage-eventpress'); echo $userinf['user_email']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_phone']){ ?> <li><?php _e('Phone: ','mage-eventpress'); echo $userinf['user_phone']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_address']){ ?> <li><?php _e('Address: ','mage-eventpress'); echo $userinf['user_address']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_gender']){ ?> <li><?php _e('Gender: ','mage-eventpress'); echo $userinf['user_gender']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_tshirtsize']){ ?> <li><?php _e('T-Shirt Size: ','mage-eventpress'); echo $userinf['user_tshirtsize']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_company']){ ?> <li><?php _e('Company: ','mage-eventpress'); echo $userinf['user_company']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_designation']){ ?> <li><?php _e('Designation: ','mage-eventpress'); echo $userinf['user_designation']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_website']){ ?> <li><?php _e('Website: ','mage-eventpress'); echo $userinf['user_website']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_vegetarian']){ ?> <li><?php _e('Vegetarian: ','mage-eventpress'); echo $userinf['user_vegetarian']; ?></li> <?php } ?>
|
||||
<?php if($userinf['user_ticket_type']){ ?> <li><?php _e('Ticket Type: ','mage-eventpress'); echo $userinf['user_ticket_type']; ?></li> <?php } ?>
|
||||
<li><?php _e('Event Date:','mage-eventpress'); ?> <?php echo get_mep_datetime($userinf['user_event_date'], 'date-time-text'); ?></li>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
}
|
||||
echo '</li>';
|
||||
}else{
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $_event_recurring_date){
|
||||
?>
|
||||
<li><?php _e('Event Date','mage-eventpress'); ?>: <?php echo get_mep_datetime($_event_recurring_date['event_date'], 'date-time-text'); //date('D, d M Y H:i:s',strtotime($_event_recurring_date)); ?></li>
|
||||
<?php
|
||||
if (is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0) {
|
||||
foreach ($ticket_type_arr as $ticket) {
|
||||
echo '<li>' . $ticket['ticket_name'] . " - " . wc_price($ticket['ticket_price']) . ' x ' . $ticket['ticket_qty'] . ' = ' . wc_price($ticket['ticket_price'] * $ticket['ticket_qty']) . '</li>';
|
||||
}
|
||||
}
|
||||
if (is_array($event_extra_service) && sizeof($event_extra_service) > 0) {
|
||||
foreach ($event_extra_service as $extra_service) {
|
||||
echo '<li>' . $extra_service['service_name'] . " - " . wc_price($extra_service['service_price']) . ' x ' . $extra_service['service_qty'] . ' = ' . wc_price($extra_service['service_price'] * $extra_service['service_qty']) . '</li>';
|
||||
}
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
<li><?php _e('Event Location','mage-eventpress'); ?>: <?php echo $cart_item['event_cart_location']; //echo $cart_item['event_ticket_type']; ?></li>
|
||||
<?php
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $ticket){
|
||||
echo '<li>'.$ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = '.wc_price($ticket['ticket_price'] * $ticket['ticket_qty']).'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($event_extra_service) && sizeof($event_extra_service) > 0){
|
||||
foreach($event_extra_service as $extra_service){
|
||||
echo '<li>'.$extra_service['service_name']." - ".wc_price($extra_service['service_price']).' x '.$extra_service['service_qty'].' = '.wc_price($extra_service['service_price'] * $extra_service['service_qty']).'</li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo "</ul>";
|
||||
}
|
||||
return $item_data;
|
||||
}
|
||||
add_filter( 'woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', 90, 2 );
|
||||
add_filter('woocommerce_get_item_data', 'mep_display_custom_fields_text_cart', 90, 2);
|
||||
|
||||
|
||||
|
||||
add_action( 'woocommerce_after_checkout_validation', 'mep_checkout_validation');
|
||||
function mep_checkout_validation( $posted ) {
|
||||
/**
|
||||
* Now before placing the order we need to check seats are available or not, the below function doing this task its validate the user selected seat numbers are available or not.
|
||||
*/
|
||||
add_action('woocommerce_after_checkout_validation', 'mep_checkout_validation');
|
||||
function mep_checkout_validation($posted)
|
||||
{
|
||||
global $woocommerce;
|
||||
$items = $woocommerce->cart->get_cart();
|
||||
foreach($items as $item => $values) {
|
||||
foreach ($items as $item => $values) {
|
||||
$event_id = array_key_exists('event_id', $values) ? $values['event_id'] : 0; // $values['event_id'];
|
||||
if (get_post_type($event_id) == 'mep_events') {
|
||||
$total_seat = mep_event_total_seat($event_id,'total');
|
||||
$total_resv = mep_event_total_seat($event_id,'resv');
|
||||
$total_sold = mep_ticket_sold($event_id);
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
;
|
||||
$event_validate_info = $values['event_validate_info'] ? $values['event_validate_info'] : array();
|
||||
|
||||
$ee = 0;
|
||||
|
||||
if(is_array($event_validate_info) && sizeof($event_validate_info) > 0){
|
||||
foreach($event_validate_info as $inf){
|
||||
$ee = $ee + $inf['ticket_qty'];
|
||||
$total_seat = mep_event_total_seat($event_id, 'total');
|
||||
$total_resv = mep_event_total_seat($event_id, 'resv');
|
||||
$total_sold = mep_ticket_sold($event_id);
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
|
||||
$event_validate_info = $values['event_validate_info'] ? $values['event_validate_info'] : array();
|
||||
|
||||
$ee = 0;
|
||||
|
||||
if (is_array($event_validate_info) && sizeof($event_validate_info) > 0) {
|
||||
foreach ($event_validate_info as $inf) {
|
||||
$ee = $ee + $inf['validation_ticket_qty'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($ee > $total_left) {
|
||||
$event = get_the_title($event_id);
|
||||
wc_add_notice(__("Sorry, Seats are not available in <b>$event</b>, Available Seats <b>$total_left</b> but you selected <b>$ee</b>", 'mage-eventpress'), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
if($ee > $total_left) {
|
||||
$event = get_the_title($event_id);
|
||||
wc_add_notice( __( "Sorry, Seats are not available in <b>$event</b>, Available Seats <b>$total_left</b> but you selected <b>$ee</b>", 'mage-eventpress' ), 'error' );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Final function for cart handleing, If everything is fine after user hit the place order button then the below function will send the order data into the next hook for order processing and save to order meta data.
|
||||
*/
|
||||
function mep_add_custom_fields_text_to_order_items($item, $cart_item_key, $values, $order)
|
||||
{
|
||||
|
||||
$eid = array_key_exists('event_id', $values) ? $values['event_id'] : 0; //$values['event_id'];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function mep_add_custom_fields_text_to_order_items( $item, $cart_item_key, $values, $order ) {
|
||||
|
||||
$eid = array_key_exists('event_id', $values) ? $values['event_id'] : 0; //$values['event_id'];
|
||||
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$mep_events_extra_prices = $values['event_extra_option'];
|
||||
if(isset($values['event_ticket_type'])){
|
||||
$event_ticket_type = $values['event_ticket_type'];
|
||||
}else{
|
||||
$event_ticket_type = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_price'])){
|
||||
$event_ticket_price = $values['event_ticket_price'];
|
||||
}else{
|
||||
$event_ticket_price = " ";
|
||||
}
|
||||
if(isset($values['event_ticket_qty'])){
|
||||
$event_ticket_qty = $values['event_ticket_qty'];
|
||||
}else{
|
||||
$event_ticket_qty = " ";
|
||||
}
|
||||
|
||||
|
||||
$product_id = $values['product_id'];
|
||||
if (get_post_type($eid) == 'mep_events') {
|
||||
$mep_events_extra_prices = $values['event_extra_option'];
|
||||
$cart_location = $values['event_cart_location'];
|
||||
$event_extra_service = $values['event_extra_service'];
|
||||
$ticket_type_arr = $values['event_ticket_info'];
|
||||
$cart_date = $values['event_cart_date'];
|
||||
|
||||
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
|
||||
$form_position = mep_get_option('mep_user_form_position', 'general_attendee_sec', 'details_page');
|
||||
$event_user_info = $form_position == 'details_page' ? $values['event_user_info'] : mep_save_attendee_info_into_cart($eid);
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
if($form_position=='details_page'){
|
||||
$event_user_info = $values['event_user_info'];
|
||||
}else{
|
||||
$event_user_info = mep_save_attendee_info_into_cart($eid);
|
||||
}
|
||||
|
||||
$recurring = get_post_meta($eid, 'mep_enable_recurring', true) ? get_post_meta($eid, 'mep_enable_recurring', true) : 'no';
|
||||
if($recurring == 'yes'){
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $_event_recurring_date){
|
||||
$item->add_meta_data('Date',get_mep_datetime($_event_recurring_date['event_date'], 'date-time-text'));
|
||||
if ($recurring == 'yes') {
|
||||
if (is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0) {
|
||||
foreach ($ticket_type_arr as $_event_recurring_date) {
|
||||
$item->add_meta_data('Date', get_mep_datetime($_event_recurring_date['event_date'], 'date-time-text'));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$item->add_meta_data('Date',get_mep_datetime($cart_date, 'date-time-text'));
|
||||
}
|
||||
|
||||
$item->add_meta_data('Location',$cart_location);
|
||||
$item->add_meta_data('_event_ticket_info',$values['event_ticket_info']);
|
||||
|
||||
if(is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0){
|
||||
foreach($ticket_type_arr as $ticket){
|
||||
$ticket_type_name = $ticket['ticket_name']." - ".wc_price($ticket['ticket_price']).' x '.$ticket['ticket_qty'].' = ';
|
||||
$ticket_type_val= wc_price($ticket['ticket_price'] * $ticket['ticket_qty']);
|
||||
$item->add_meta_data($ticket_type_name, $ticket_type_val );
|
||||
|
||||
}
|
||||
} else {
|
||||
$item->add_meta_data('Date',$cart_date);
|
||||
}
|
||||
|
||||
if(is_array($event_extra_service) && sizeof($event_extra_service) > 0){
|
||||
foreach($event_extra_service as $extra_service){
|
||||
|
||||
$service_type_name = $extra_service['service_name']." - ".wc_price($extra_service['service_price']).' x '.$extra_service['service_qty'].' = ';
|
||||
$service_type_val= wc_price($extra_service['service_price'] * $extra_service['service_qty']);
|
||||
$item->add_meta_data($service_type_name, $service_type_val );
|
||||
|
||||
}
|
||||
}
|
||||
if (is_array($ticket_type_arr) && sizeof($ticket_type_arr) > 0) {
|
||||
foreach ($ticket_type_arr as $ticket) {
|
||||
$ticket_type_name = $ticket['ticket_name'] . " - " . wc_price($ticket['ticket_price']) . ' x ' . $ticket['ticket_qty'] . ' = ';
|
||||
$ticket_type_val = wc_price($ticket['ticket_price'] * $ticket['ticket_qty']);
|
||||
$item->add_meta_data($ticket_type_name, $ticket_type_val);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($event_extra_service) && sizeof($event_extra_service) > 0) {
|
||||
foreach ($event_extra_service as $extra_service) {
|
||||
$service_type_name = $extra_service['service_name'] . " - " . wc_price($extra_service['service_price']) . ' x ' . $extra_service['service_qty'] . ' = ';
|
||||
$service_type_val = wc_price($extra_service['service_price'] * $extra_service['service_qty']);
|
||||
$item->add_meta_data($service_type_name, $service_type_val);
|
||||
}
|
||||
}
|
||||
|
||||
if($event_ticket_type){
|
||||
|
||||
}else{
|
||||
$item->add_meta_data('_event_ticket_type','normal');
|
||||
$item->add_meta_data('Location', $cart_location);
|
||||
$item->add_meta_data('_event_ticket_info', $ticket_type_arr);
|
||||
$item->add_meta_data('_event_user_info', $event_user_info);
|
||||
$item->add_meta_data('_event_service_info', $mep_events_extra_prices);
|
||||
$item->add_meta_data('event_id', $eid);
|
||||
$item->add_meta_data('_product_id', $eid);
|
||||
$item->add_meta_data('_event_extra_service', $event_extra_service);
|
||||
}
|
||||
}
|
||||
$item->add_meta_data('_event_user_info',$event_user_info);
|
||||
// $item->add_meta_data('_no_of_ticket',count($event_user_info));
|
||||
$item->add_meta_data('_event_service_info',$mep_events_extra_prices);
|
||||
$item->add_meta_data('event_id',$eid);
|
||||
$item->add_meta_data('_product_id',$eid);
|
||||
$item->add_meta_data('_event_extra_service',$event_extra_service);
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'woocommerce_checkout_create_order_line_item', 'mep_add_custom_fields_text_to_order_items', 90, 4 );
|
||||
add_action('woocommerce_checkout_create_order_line_item', 'mep_add_custom_fields_text_to_order_items', 90, 4);
|
|
@ -1,10 +1,17 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
||||
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-wc-product-data.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-form-fields-generator.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-form-fields-wrapper.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-meta-box.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-taxonomy-edit.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-theme-page.php');
|
||||
require_once(dirname(__DIR__) . '/lib/classes/class-menu-page.php');
|
||||
require_once(dirname(__DIR__) . "/inc/class/mep_settings_api.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_cpt.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_tax.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_event_meta.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_event_fw_meta.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_extra_price.php");
|
||||
require_once(dirname(__DIR__) . "/inc/mep_shortcode.php");
|
||||
require_once(dirname(__DIR__) . "/inc/admin_setting_panel.php");
|
||||
|
|
|
@ -8,6 +8,14 @@ function mep_language_load(){
|
|||
load_plugin_textdomain( 'mage-eventpress', false, $plugin_dir );
|
||||
}
|
||||
|
||||
function mep_get_builder_version(){
|
||||
if(is_plugin_active( 'woocommerce-event-manager-addon-form-builder/addon-builder.php' )){
|
||||
$data = get_plugin_data( ABSPATH . "wp-content/plugins/woocommerce-event-manager-addon-form-builder/addon-builder.php", false, false );
|
||||
return $data['Version'];
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function mep_check_builder_status(){
|
||||
$version = '3.2';
|
||||
|
@ -272,27 +280,16 @@ add_filter( 'query_vars', 'mep_city_filter_query_var' );
|
|||
|
||||
|
||||
|
||||
function template_chooser($template){
|
||||
global $wp_query;
|
||||
|
||||
$plugin_path = plugin_dir_path( __DIR__ );
|
||||
$template_name = $plugin_path.'templates/page-city-filter.php';
|
||||
|
||||
if ( get_query_var( 'cityname' ) ) {
|
||||
$template = $template_name;
|
||||
}
|
||||
return $template;
|
||||
function mep_city_template_chooser($template){
|
||||
if ( get_query_var( 'cityname' ) ) {
|
||||
$template = mep_template_file_path('page-city-filter.php');
|
||||
}
|
||||
return $template;
|
||||
}
|
||||
add_filter('template_include', 'template_chooser');
|
||||
add_filter('template_include', 'mep_city_template_chooser');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function mep_attendee_create($type,$order_id,$event_id,$_user_info = array()){
|
||||
|
||||
// Getting an instance of the order object
|
||||
|
@ -402,23 +399,13 @@ add_filter('template_include', 'template_chooser');
|
|||
|
||||
|
||||
|
||||
function mep_attendee_extra_service_create($order_id,$event_id){
|
||||
function mep_attendee_extra_service_create($order_id,$event_id, $_event_extra_service){
|
||||
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_meta = get_post_meta($order_id);
|
||||
$order_status = $order->get_status();
|
||||
foreach ( $order->get_items() as $item_id => $item_values ) {
|
||||
$item_id = $item_id;
|
||||
}
|
||||
$_event_extra_service = wc_get_order_item_meta($item_id,'_event_extra_service',true);
|
||||
$date = date('Y-m-d H:i:s',strtotime(wc_get_order_item_meta($item_id,'Date',true)));
|
||||
|
||||
|
||||
if(is_array($_event_extra_service) && sizeof($_event_extra_service) > 0){
|
||||
|
||||
foreach($_event_extra_service as $extra_serive){
|
||||
$uname = 'Extra Service for '.get_the_title($event_id).' Order #'.$order_id;
|
||||
// echo $extra_serive['service_price'];
|
||||
// die();
|
||||
$new_post = array(
|
||||
'post_title' => $uname,
|
||||
'post_content' => '',
|
||||
|
@ -430,7 +417,6 @@ add_filter('template_include', 'template_chooser');
|
|||
|
||||
$pid = wp_insert_post($new_post);
|
||||
|
||||
|
||||
update_post_meta( $pid, 'ea_extra_service_name', $extra_serive['service_name'] );
|
||||
update_post_meta( $pid, 'ea_extra_service_qty', $extra_serive['service_qty'] );
|
||||
update_post_meta( $pid, 'ea_extra_service_unit_price', $extra_serive['service_price'] );
|
||||
|
@ -438,11 +424,11 @@ add_filter('template_include', 'template_chooser');
|
|||
update_post_meta( $pid, 'ea_extra_service_event', $event_id );
|
||||
update_post_meta( $pid, 'ea_extra_service_order', $order_id );
|
||||
update_post_meta( $pid, 'ea_extra_service_order_status', $order_status );
|
||||
update_post_meta( $pid, 'ea_extra_service_event_date', $date );
|
||||
update_post_meta( $pid, 'ea_extra_service_event_date', $extra_serive['event_date'] );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -502,8 +488,9 @@ add_filter('template_include', 'template_chooser');
|
|||
$user_info_arr = wc_get_order_item_meta($item_id,'_event_user_info',true);
|
||||
$service_info_arr = wc_get_order_item_meta($item_id,'_event_service_info',true);
|
||||
$event_ticket_info_arr = wc_get_order_item_meta($item_id,'_event_ticket_info',true);
|
||||
$_event_extra_service = wc_get_order_item_meta($item_id,'_event_extra_service',true);
|
||||
$item_quantity = 0;
|
||||
mep_attendee_extra_service_create($order_id,$event_id);
|
||||
mep_attendee_extra_service_create($order_id,$event_id,$_event_extra_service);
|
||||
foreach ( $event_ticket_info_arr as $field ) {
|
||||
if($field['ticket_qty']>0){
|
||||
$item_quantity = $item_quantity + $field['ticket_qty'];
|
||||
|
@ -530,33 +517,6 @@ add_filter('template_include', 'template_chooser');
|
|||
|
||||
|
||||
|
||||
add_action('woocommerce_checkout_order_processed', 'mep_event_order_status_make_pending', 10, 1);
|
||||
|
||||
function mep_event_order_status_make_pending($order_id)
|
||||
{
|
||||
// Getting an instance of the order object
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_meta = get_post_meta($order_id);
|
||||
|
||||
# Iterating through each order items (WC_Order_Item_Product objects in WC 3+)
|
||||
foreach ( $order->get_items() as $item_id => $item_values ) {
|
||||
$item_quantity = $item_values->get_quantity();
|
||||
$item_id = $item_id;
|
||||
}
|
||||
$ordr_total = $order->get_total();
|
||||
$product_id = mep_event_get_order_meta($item_id,'_product_id');
|
||||
if($product_id==0){
|
||||
$event_id = mep_event_get_order_meta($item_id,'event_id');
|
||||
if (get_post_type($event_id) == 'mep_events') {
|
||||
$mep_atnd = "_mep_atnd_".$order_id;
|
||||
update_post_meta( $event_id, $mep_atnd, "a1");
|
||||
$order_meta_text = "_stock_msg_".$order_id;
|
||||
$order_processing = "pending_".$order_id;
|
||||
update_post_meta( $event_id, $order_meta_text, $order_processing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function change_attandee_order_status($order_id,$set_status,$post_status,$qr_status=null){
|
||||
|
||||
|
@ -887,8 +847,8 @@ add_filter('template_include', 'template_chooser');
|
|||
// Getting event exprie date & time
|
||||
function mep_get_event_status($startdatetime){
|
||||
|
||||
$default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
|
||||
date_default_timezone_set($default_timezone_val);
|
||||
// $default_timezone_val = wp_timezone_string();
|
||||
// date_default_timezone_set($default_timezone_val);
|
||||
|
||||
$current = current_time('Y-m-d H:i:s');
|
||||
$newformat = date('Y-m-d H:i:s',strtotime($startdatetime));
|
||||
|
@ -936,65 +896,56 @@ add_filter('template_include', 'template_chooser');
|
|||
require_once(dirname(__DIR__) . "/inc/template-prts/templating.php");
|
||||
}
|
||||
|
||||
|
||||
function mep_template_file_path($file_name){
|
||||
// $template_path = ;
|
||||
$template_path = get_stylesheet_directory().'/mage-events/';
|
||||
$default_path = plugin_dir_path( __DIR__ ) . 'templates/';
|
||||
$thedir = is_dir($template_path) ? $template_path : $default_path;
|
||||
$themedir = $thedir.$file_name;
|
||||
$the_file_path = locate_template( array('mage-events/' . $file_name) ) ? $themedir : $default_path.$file_name;
|
||||
return $the_file_path;
|
||||
}
|
||||
|
||||
|
||||
function mep_template_part_file_path($file_name){
|
||||
$the_file_path = plugin_dir_path( __DIR__ ) . 'inc/template-prts/'.$file_name;
|
||||
return $the_file_path;
|
||||
}
|
||||
|
||||
|
||||
function mep_load_events_templates($template) {
|
||||
global $post;
|
||||
|
||||
if ($post->post_type == "mep_events"){
|
||||
$template_name = 'single-events.php';
|
||||
$template_path = 'mage-events/';
|
||||
$default_path = plugin_dir_path( __DIR__ ) . 'templates/';
|
||||
$template = locate_template( array($template_path . $template_name) );
|
||||
|
||||
|
||||
if ( ! $template ) :
|
||||
$template = $default_path . $template_name;
|
||||
endif;
|
||||
$template = mep_template_part_file_path('single-events.php');
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ($post->post_type == "mep_event_speaker"){
|
||||
$template = mep_template_file_path('single-speaker.php');
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ($post->post_type == "mep_events_attendees"){
|
||||
$template = mep_template_part_file_path('single-mep_events_attendees.php');
|
||||
return $template;
|
||||
}
|
||||
|
||||
if ($post->post_type == "mep_events_attendees"){
|
||||
$plugin_path = plugin_dir_path( __DIR__ );
|
||||
$template_name = 'templates/single-mep_events_attendees.php';
|
||||
if($template === get_stylesheet_directory() . '/' . $template_name
|
||||
|| !file_exists($plugin_path . $template_name)) {
|
||||
return $template;
|
||||
}
|
||||
return $plugin_path . $template_name;
|
||||
}
|
||||
|
||||
return $template;
|
||||
return $template;
|
||||
}
|
||||
add_filter('single_template', 'mep_load_events_templates');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_filter('template_include', 'mep_organizer_set_template');
|
||||
function mep_organizer_set_template( $template ){
|
||||
|
||||
$cat_template_name = 'taxonomy-category.php';
|
||||
$org_template_name = 'taxonomy-organozer.php';
|
||||
$template_path = get_stylesheet_directory().'/mage-events/';
|
||||
|
||||
function mep_organizer_set_template( $template ){
|
||||
if( is_tax('mep_org')){
|
||||
|
||||
if(file_exists($template_path . $org_template_name)) {
|
||||
$template = get_stylesheet_directory().'/mage-events/taxonomy-organozer.php';
|
||||
}else{
|
||||
$template = plugin_dir_path( __DIR__ ).'templates/taxonomy-organozer.php';;
|
||||
}
|
||||
$template = mep_template_file_path('taxonomy-organozer.php');
|
||||
}
|
||||
|
||||
if( is_tax('mep_cat')){
|
||||
|
||||
if(file_exists($template_path . $cat_template_name)) {
|
||||
$template = get_stylesheet_directory().'/mage-events/taxonomy-category.php';
|
||||
}else{
|
||||
$template = plugin_dir_path( __DIR__ ).'templates/taxonomy-category.php';
|
||||
}
|
||||
$template = mep_template_file_path('taxonomy-category.php');
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
|
@ -1004,9 +955,6 @@ add_filter('template_include', 'template_chooser');
|
|||
?>
|
||||
<ul class='mep-social-share'>
|
||||
<li> <a data-toggle="tooltip" title="" class="facebook" onclick="window.open('https://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>','Facebook','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" data-original-title="Share on Facebook"><i class="fa fa-facebook"></i></a></li>
|
||||
|
||||
<!-- <li><a data-toggle="tooltip" title="" class="gpuls" onclick="window.open('https://plus.google.com/share?url=<?php the_permalink(); ?>','Google plus','width=585,height=666,left='+(screen.availWidth/2-292)+',top='+(screen.availHeight/2-333)+''); return false;" href="https://plus.google.com/share?url=<?php the_permalink(); ?>" data-original-title="Share on Google Plus"><i class="fa fa-google-plus"></i></a> </li> -->
|
||||
|
||||
<li><a data-toggle="tooltip" title="" class="twitter" onclick="window.open('https://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>','Twitter share','width=600,height=300,left='+(screen.availWidth/2-300)+',top='+(screen.availHeight/2-150)+''); return false;" href="http://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php the_title(); ?>" data-original-title="Twittet it"><i class="fa fa-twitter"></i></a></li>
|
||||
</ul>
|
||||
<?php
|
||||
|
@ -1031,30 +979,14 @@ add_filter('template_include', 'template_chooser');
|
|||
$location = $event_meta['mep_location_venue'][0]." ".$event_meta['mep_street'][0]." ".$event_meta['mep_city'][0]." ".$event_meta['mep_state'][0]." ".$event_meta['mep_postcode'][0]." ".$event_meta['mep_country'][0];
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<div id="mep_add_calender_button" class='mep-add-calender'><i class="fa fa-calendar"></i><?php _e(mep_get_label($pid,'mep_calender_btn_text','Add Calendar'),'mage-eventpress'); ?></div>
|
||||
|
||||
<div id="mep_add_calender_button" class='mep-add-calender'><i class="fa fa-calendar"></i><?php _e(mep_get_label($pid,'mep_calender_btn_text','Add Calendar'),'mage-eventpress'); ?></div>
|
||||
<ul id="mep_add_calender_links">
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href="https://calendar.google.com/calendar/r/eventedit?text=<?php echo $event->post_title; ?>&dates=<?php echo mep_calender_date($event_start); ?>/<?php echo mep_calender_date($event_end); ?>&details=<?php echo substr(strip_tags($event->post_content),0,1000); ?>&location=<?php echo $location; ?>&sf=true" rel="noopener noreferrer" target='_blank' class='mep-add-calender' rel="nofollow">Google</a></li>
|
||||
|
||||
<li><a href="https://calendar.yahoo.com/?v=60&view=d&type=20&title=<?php echo $event->post_title; ?>&st=<?php echo mep_calender_date($event_start); ?>&et=<?php echo mep_calender_date($event_end); ?>&desc=<?php echo substr(strip_tags($event->post_content),0,1000); ?>&in_loc=<?php echo $location; ?>&uid=" rel="noopener noreferrer" target='_blank' class='mep-add-calender' rel="nofollow">Yahoo</a></li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li><a href ="https://outlook.live.com/owa/?path=/calendar/view/Month&rru=addevent&startdt=<?php echo mep_calender_date($event_start); ?>&enddt=<?php echo mep_calender_date($event_end); ?>&subject=<?php echo $event->post_title; ?>" rel="noopener noreferrer" target='_blank' class='mep-add-calender' rel="nofollow">Outlook</a></li>
|
||||
|
||||
<li><a href="https://webapps.genprod.com/wa/cal/download-ics.php?date_end=<?php echo mep_calender_date($event_end); ?>&date_start=<?php echo mep_calender_date($event_start); ?>&summary=<?php echo $event->post_title; ?>&location=<?php echo $location; ?>&description=<?php echo substr(strip_tags($event->post_content),0,1000); ?>" rel="noopener noreferrer" target='_blank' class='mep-add-calender'>Apple</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#mep_add_calender_button").click(function () {
|
||||
jQuery("#mep_add_calender_links").toggle()
|
||||
|
@ -1144,7 +1076,7 @@ add_filter('template_include', 'template_chooser');
|
|||
<th><?php _e('Name','mage-eventpress'); ?></th>
|
||||
<th><?php _e('Ticket','mage-eventpress'); ?></th>
|
||||
<th><?php _e('Event','mage-eventpress'); ?></th>
|
||||
<th><?php _e('Download','mage-eventpress'); ?></th>
|
||||
<?php do_action('mep_user_order_list_table_head'); ?>
|
||||
</tr>
|
||||
<?php
|
||||
$args_search_qqq = array (
|
||||
|
@ -1165,22 +1097,13 @@ add_filter('template_include', 'template_chooser');
|
|||
|
||||
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
$order_array = array('processing', 'completed');
|
||||
$order_status = get_post_meta(get_the_ID(), 'ea_order_status', true);
|
||||
|
||||
|
||||
if ( time() < strtotime( $newformat ) ) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo get_post_meta( get_the_id(), 'ea_name', true ); ?></td>
|
||||
<td><?php echo get_post_meta( get_the_id(), 'ea_ticket_type', true ); ?></td>
|
||||
<td><?php echo get_post_meta( get_the_id(), 'ea_event_name', true ); ?></td>
|
||||
<?php if (in_array($order_status, $order_array)){ ?>
|
||||
<td><a href="<?php the_permalink(); ?>"><?php _e( 'Download', 'mage-eventpress' ); ?></a>
|
||||
</td>
|
||||
<?php }else{ ?>
|
||||
<td></td>
|
||||
<?php } ?>
|
||||
<?php do_action('mep_user_order_list_table_row',get_the_id()); ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
@ -2123,7 +2046,7 @@ function get_mep_datetime($date,$type){
|
|||
$wpdatesettings = $date_format.' '.$time_format;
|
||||
$timezone = wp_timezone_string();
|
||||
$timestamp = strtotime( $date . ' '. $timezone);
|
||||
|
||||
|
||||
if($type == 'date'){
|
||||
return wp_date( $date_format, $timestamp );
|
||||
}
|
||||
|
@ -2136,10 +2059,10 @@ function get_mep_datetime($date,$type){
|
|||
}
|
||||
|
||||
if($type == 'date-time-text'){
|
||||
return wp_date( $wpdatesettings, $timestamp );
|
||||
return wp_date( $wpdatesettings, $timestamp, wp_timezone() );
|
||||
}
|
||||
if($type == 'time'){
|
||||
return date( $time_format, strtotime( $date ) );
|
||||
return wp_date( $time_format, $timestamp, wp_timezone());
|
||||
}
|
||||
|
||||
if($type == 'day'){
|
||||
|
@ -2287,12 +2210,6 @@ function get_mep_datetime($date,$type){
|
|||
}
|
||||
|
||||
|
||||
// add_action('admin_init','mytest');
|
||||
// function mytest(){
|
||||
// echo $product_type = mep_get_option('mep_event_product_type', 'general_setting_sec','yes');
|
||||
// die();
|
||||
// }
|
||||
|
||||
|
||||
add_action('parse_query', 'mep_product_tags_sorting_query');
|
||||
function mep_product_tags_sorting_query($query) {
|
||||
|
@ -2463,29 +2380,16 @@ function mage_array_strip($string, $allowed_tags = NULL){
|
|||
return strip_tags($string, $allowed_tags);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Giant SEO Plugin Yoast PRO doing some weird thing and that is its auto create a 301 redirect url when delete a post its causing our event some issue Thats why i disable those part for our event post type with the below filter hoook which is provide by Yoast.
|
||||
*/
|
||||
add_filter('wpseo_premium_post_redirect_slug_change', '__return_true' );
|
||||
add_filter('wpseo_premium_term_redirect_slug_change', '__return_true' );
|
||||
add_filter('wpseo_enable_notification_term_slug_change','__return_false');
|
||||
|
||||
|
||||
|
||||
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_data_from_thankyou_and_email', 10, 1 );
|
||||
function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){
|
||||
$temp_metas = [];
|
||||
foreach($formatted_meta as $key => $meta) {
|
||||
if ( isset( $meta->key ) && ! in_array( $meta->key, [
|
||||
'event_id'
|
||||
// 'Location',
|
||||
// 'Date'
|
||||
] ) ) {
|
||||
$temp_metas[ $key ] = $meta;
|
||||
}
|
||||
}
|
||||
return $temp_metas;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The below function will add the event more date list into the event list shortcode, Bu default it will be hide with a Show Date button, after click on that button it will the full list.
|
||||
*/
|
||||
add_action('mep_event_list_loop_footer','mep_event_recurring_date_list_in_event_list_loop');
|
||||
function mep_event_recurring_date_list_in_event_list_loop($event_id){
|
||||
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
|
||||
|
@ -2494,12 +2398,8 @@ function mep_event_recurring_date_list_in_event_list_loop($event_id){
|
|||
$start_date = get_post_meta($event_id,'event_start_date',true);
|
||||
$end_date = get_post_meta($event_id,'event_end_date',true);
|
||||
$end_datetime = get_post_meta($event_id,'event_end_datetime',true);
|
||||
|
||||
$show_multidate = mep_get_option('mep_date_list_in_event_listing', 'general_setting_sec', 'no');
|
||||
|
||||
|
||||
|
||||
|
||||
$show_multidate = mep_get_option('mep_date_list_in_event_listing', 'general_setting_sec', 'no');
|
||||
|
||||
if(is_array($more_date) && sizeof($more_date) > 0){
|
||||
|
||||
?>
|
||||
|
@ -2522,15 +2422,13 @@ function mep_event_recurring_date_list_in_event_list_loop($event_id){
|
|||
echo get_mep_datetime($_more_date['event_more_end_date'] . ' ' . $_more_date['event_more_end_time'], 'date-text') . ' - ';
|
||||
}
|
||||
echo get_mep_datetime($_more_date['event_more_end_date'] . ' ' . $_more_date['event_more_end_time'], 'time'); ?></span></li>
|
||||
<?php
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
?>
|
||||
<?php if($show_multidate == 'yes'){ ?><span id="show_event_schdule<?php echo $event_id; ?>" class='mep_more_date_btn'><?php _e('View More Date','mage-eventpress'); ?></span><?php } ?>
|
||||
<span id="hide_event_schdule<?php echo $event_id; ?>" class='mep_more_date_btn'><?php _e('Hide Date Lists','mage-eventpress'); ?></span>
|
||||
<?php if($show_multidate == 'yes'){ ?><span id="show_event_schdule<?php echo $event_id; ?>" class='mep_more_date_btn mep-tem3-title-sec'><?php _e('View More Date','mage-eventpress'); ?></span><?php } ?>
|
||||
<span id="hide_event_schdule<?php echo $event_id; ?>" class='mep_more_date_btn mep-tem3-title-sec'><?php _e('Hide Date Lists','mage-eventpress'); ?></span>
|
||||
<script>
|
||||
jQuery('.mep-more-date-lists<?php echo $event_id; ?>, #hide_event_schdule<?php echo $event_id; ?>').hide();
|
||||
|
||||
|
@ -2555,7 +2453,9 @@ function mep_event_get_the_content( $post = 0 ){
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This the function which will create the Rich Text Schema For each event into the <head></head> section.
|
||||
*/
|
||||
add_action('wp_head','mep_event_rich_text_data');
|
||||
function mep_event_rich_text_data(){
|
||||
global $post;
|
||||
|
@ -2612,6 +2512,9 @@ function mep_event_rich_text_data(){
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* We added event id with every order for using in the attendee & seat inventory calculation, but this info was showing in the thank you page, so i decided to hide this, and here is the fucntion which will hide the event id from the thank you page.
|
||||
*/
|
||||
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_meta_in_emails' );
|
||||
function mep_hide_event_order_meta_in_emails( $meta ) {
|
||||
if( ! is_admin() ) {
|
||||
|
@ -2620,3 +2523,343 @@ function mep_hide_event_order_meta_in_emails( $meta ) {
|
|||
}
|
||||
return $meta;
|
||||
}
|
||||
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mep_hide_event_order_data_from_thankyou_and_email', 10, 1 );
|
||||
function mep_hide_event_order_data_from_thankyou_and_email($formatted_meta){
|
||||
$hide_location_status = mep_get_option('mep_hide_location_from_order_page', 'general_setting_sec', 'no');
|
||||
$hide_date_status = mep_get_option('mep_hide_date_from_order_page', 'general_setting_sec', 'no');
|
||||
$hide_location = $hide_location_status == 'yes' ? array('Location') : array();
|
||||
$hide_date = $hide_date_status == 'yes' ? array('Date') : array();
|
||||
$default = array('event_id');
|
||||
$default = array_merge($default,$hide_date);
|
||||
|
||||
$hide_them = array_merge($default,$hide_location);
|
||||
|
||||
$temp_metas = [];
|
||||
foreach($formatted_meta as $key => $meta) {
|
||||
if ( isset( $meta->key ) && ! in_array( $meta->key, $hide_them ) ) {
|
||||
$temp_metas[ $key ] = $meta;
|
||||
}
|
||||
}
|
||||
return $temp_metas;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This will create a new section Custom CSS into the Event Settings Page, I write this code here instead of the Admin Settings Class because of YOU! Yes who is reading this comment!! to get the clear idea how you can craete your own settings section and settings fields by using the filter hook from any where or your own plugin. Thanks For reading this comment. Cheers!!
|
||||
*/
|
||||
add_filter('mep_settings_sec_reg','mep_custom_css_settings_reg',90);
|
||||
function mep_custom_css_settings_reg($default_sec){
|
||||
$sections = array(
|
||||
array(
|
||||
'id' => 'mep_settings_custom_css',
|
||||
'title' => __( 'Custom CSS', 'mage-eventpress' )
|
||||
)
|
||||
);
|
||||
return array_merge($default_sec,$sections);
|
||||
}
|
||||
add_filter('mep_settings_sec_fields','mep_custom_css_sectings_fields',90);
|
||||
function mep_custom_css_sectings_fields($default_fields){
|
||||
$settings_fields = array(
|
||||
'mep_settings_custom_css' => array(
|
||||
array(
|
||||
'name' => 'mep_custom_css',
|
||||
'label' => __( 'Custom CSS', 'mage-eventpress' ),
|
||||
'desc' => __( 'Write Your Custom CSS Code Here', 'mage-eventpress' ),
|
||||
'type' => 'textarea',
|
||||
|
||||
)
|
||||
)
|
||||
);
|
||||
return array_merge($default_fields,$settings_fields);
|
||||
}
|
||||
add_action('wp_head','mep_apply_custom_css',90);
|
||||
function mep_apply_custom_css(){
|
||||
$custom_css = mep_get_option( 'mep_custom_css', 'mep_settings_custom_css', '');
|
||||
ob_start();
|
||||
?>
|
||||
<style>
|
||||
/* Custom CSS Code From WooCommerce Event Manager Plugin */
|
||||
<?php echo $custom_css; ?>
|
||||
</style>
|
||||
<?php
|
||||
echo ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function mep_cart_ticket_type($type,$total_price,$product_id){
|
||||
|
||||
$mep_event_start_date = isset($_POST['mep_event_start_date']) ? $_POST['mep_event_start_date'] : array();
|
||||
$names = isset($_POST['option_name']) ? $_POST['option_name'] : array();
|
||||
$qty = isset($_POST['option_qty']) ? $_POST['option_qty'] : array();
|
||||
$max_qty = isset($_POST['max_qty']) ? $_POST['max_qty'] : array();
|
||||
$price = isset($_POST['option_price']) ? $_POST['option_price'] : array();
|
||||
$count = count( $names );
|
||||
$ticket_type_arr = [];
|
||||
$vald = 0;
|
||||
if(sizeof($names) > 0){
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
if($qty[$i] > 0){
|
||||
$ticket_type_arr[$i]['ticket_name'] = !empty($names[$i]) ? stripslashes( strip_tags( $names[$i] ) ) : '';
|
||||
$ticket_type_arr[$i]['ticket_price'] = !empty($price[$i]) ? stripslashes( strip_tags( $price[$i] ) ) : '';
|
||||
$ticket_type_arr[$i]['ticket_qty'] = !empty($qty[$i]) ? stripslashes( strip_tags( $qty[$i] ) ) : '';
|
||||
$ticket_type_arr[$i]['max_qty'] = !empty($max_qty[$i]) ? stripslashes( strip_tags( $max_qty[$i] ) ) : '';
|
||||
$ticket_type_arr[$i]['event_date'] = !empty($mep_event_start_date[$i]) ? stripslashes( strip_tags( $mep_event_start_date[$i] ) ) : '';
|
||||
$opttprice = ($price[$i]*$qty[$i]);
|
||||
$total_price = ($total_price+$opttprice);
|
||||
$validate[$i]['validation_ticket_qty'] = $vald + stripslashes( strip_tags( $qty[$i] ) );
|
||||
$validate[$i]['event_id'] = stripslashes( strip_tags( $product_id ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if($type == 'ticket_price'){
|
||||
return $total_price;
|
||||
}elseif($type == 'validation_data'){
|
||||
return $validate;
|
||||
}else{
|
||||
return $ticket_type_arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function mep_cart_event_extra_service($type,$total_price){
|
||||
$mep_event_start_date_es = isset($_POST['mep_event_start_date_es']) ? $_POST['mep_event_start_date_es'] : array();
|
||||
$extra_service_name = isset($_POST['event_extra_service_name']) ? mage_array_strip($_POST['event_extra_service_name']) : array();
|
||||
$extra_service_qty = isset($_POST['event_extra_service_qty']) ? mage_array_strip($_POST['event_extra_service_qty']):array();
|
||||
$extra_service_price = isset($_POST['event_extra_service_price']) ? mage_array_strip($_POST['event_extra_service_price']):array();
|
||||
$event_extra = [];
|
||||
|
||||
if($extra_service_name){
|
||||
for ( $i = 0; $i < count($extra_service_name); $i++ ) {
|
||||
if($extra_service_qty[$i] > 0){
|
||||
$event_extra[$i]['service_name'] = !empty($extra_service_name[$i]) ? stripslashes( strip_tags( $extra_service_name[$i] ) ) : '';
|
||||
$event_extra[$i]['service_price'] = !empty($extra_service_price[$i]) ? stripslashes( strip_tags( $extra_service_price[$i] ) ) : '';
|
||||
$event_extra[$i]['service_qty'] = !empty($extra_service_qty[$i]) ? stripslashes( strip_tags( $extra_service_qty[$i] ) ) : '';
|
||||
$event_extra[$i]['event_date'] = !empty($mep_event_start_date_es[$i]) ? stripslashes( strip_tags( $mep_event_start_date_es[$i] ) ) : '';
|
||||
$extprice = ($extra_service_price[$i]*$extra_service_qty[$i]);
|
||||
$total_price = ($total_price+$extprice);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($type == 'ticket_price'){
|
||||
return $total_price;
|
||||
}else{
|
||||
return $event_extra;
|
||||
}
|
||||
}
|
||||
|
||||
function mep_cart_display_user_list($user_info){
|
||||
ob_start();
|
||||
foreach ($user_info as $userinf) {
|
||||
?>
|
||||
<ul>
|
||||
<?php if ($userinf['user_name']) { ?> <li><?php _e('Name: ', 'mage-eventpress');
|
||||
echo $userinf['user_name']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_email']) { ?> <li><?php _e('Email: ', 'mage-eventpress');
|
||||
echo $userinf['user_email']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_phone']) { ?> <li><?php _e('Phone: ', 'mage-eventpress');
|
||||
echo $userinf['user_phone']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_address']) { ?> <li><?php _e('Address: ', 'mage-eventpress');
|
||||
echo $userinf['user_address']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_gender']) { ?> <li><?php _e('Gender: ', 'mage-eventpress');
|
||||
echo $userinf['user_gender']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_tshirtsize']) { ?> <li><?php _e('T-Shirt Size: ', 'mage-eventpress');
|
||||
echo $userinf['user_tshirtsize']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_company']) { ?> <li><?php _e('Company: ', 'mage-eventpress');
|
||||
echo $userinf['user_company']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_designation']) { ?> <li><?php _e('Designation: ', 'mage-eventpress');
|
||||
echo $userinf['user_designation']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_website']) { ?> <li><?php _e('Website: ', 'mage-eventpress');
|
||||
echo $userinf['user_website']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_vegetarian']) { ?> <li><?php _e('Vegetarian: ', 'mage-eventpress');
|
||||
echo $userinf['user_vegetarian']; ?></li> <?php } ?>
|
||||
<?php if ($userinf['user_ticket_type']) { ?> <li><?php _e('Ticket Type: ', 'mage-eventpress');
|
||||
echo $userinf['user_ticket_type']; ?></li> <?php } ?>
|
||||
<li><?php _e('Event Date:', 'mage-eventpress'); ?> <?php echo get_mep_datetime($userinf['user_event_date'], 'date-time-text'); ?></li>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
}
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function mep_get_event_expire_date($event_id){
|
||||
$event_expire_on_old = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old;
|
||||
$event_start_datetime = get_post_meta($event_id, 'event_start_datetime', true);
|
||||
$event_expire_datetime = get_post_meta($event_id, 'event_expire_datetime', true);
|
||||
$expire_date = $event_expire_on == 'event_expire_datetime' ? $event_expire_datetime : $event_start_datetime;
|
||||
return $expire_date;
|
||||
}
|
||||
|
||||
|
||||
add_action('mep_event_single_template_end','mep_single_page_js_script');
|
||||
add_action('mep_add_to_cart_shortcode_js','mep_single_page_js_script');
|
||||
function mep_single_page_js_script($event_id){
|
||||
$currency_pos = get_option('woocommerce_currency_pos');
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#mep-event-accordion").accordion({
|
||||
collapsible: true,
|
||||
active: false
|
||||
});
|
||||
jQuery(document).on("change", ".etp", function() {
|
||||
var sum = 0;
|
||||
jQuery(".etp").each(function() {
|
||||
sum += +jQuery(this).val();
|
||||
});
|
||||
jQuery("#ttyttl").html(sum);
|
||||
});
|
||||
|
||||
jQuery("#ttypelist").change(function() {
|
||||
vallllp = jQuery(this).val() + "_";
|
||||
var n = vallllp.split('_');
|
||||
var price = n[0];
|
||||
var ctt = 99;
|
||||
if (vallllp != "_") {
|
||||
|
||||
var currentValue = parseInt(ctt);
|
||||
jQuery('#rowtotal').val(currentValue += parseFloat(price));
|
||||
}
|
||||
if (vallllp == "_") {
|
||||
jQuery('#eventtp').attr('value', 0);
|
||||
jQuery('#eventtp').attr('max', 0);
|
||||
jQuery("#ttypeprice_show").html("")
|
||||
}
|
||||
});
|
||||
function updateTotal() {
|
||||
var total = 0;
|
||||
vallllp = jQuery(this).val() + "_";
|
||||
var n = vallllp.split('_');
|
||||
var price = n[0];
|
||||
total += parseFloat(price);
|
||||
jQuery('#rowtotal').val(total);
|
||||
}
|
||||
//Bind the change event
|
||||
jQuery(".extra-qty-box").on('change', function() {
|
||||
var sum = 0;
|
||||
var total = <?php if ($event_meta['_price'][0]) {
|
||||
echo $event_meta['_price'][0];
|
||||
} else {
|
||||
echo 0;
|
||||
} ?>;
|
||||
jQuery('.price_jq').each(function() {
|
||||
var price = jQuery(this);
|
||||
var count = price.closest('tr').find('.extra-qty-box');
|
||||
sum = (price.html() * count.val());
|
||||
total = total + sum;
|
||||
// price.closest('tr').find('.cart_total_price').html(sum + "â‚´");
|
||||
|
||||
});
|
||||
jQuery('#usertotal').html("<?php if ($currency_pos == "left") {
|
||||
echo get_woocommerce_currency_symbol();
|
||||
} ?>" + total + "<?php if ($currency_pos == "right") {
|
||||
get_woocommerce_currency_symbol();
|
||||
} ?>");
|
||||
jQuery('#rowtotal').val(total);
|
||||
}).change(); //trigger change event on page load
|
||||
<?php
|
||||
$mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true) ? get_post_meta($event_id, 'mep_event_ticket_type', true) : array();
|
||||
//This is if no ticket type
|
||||
if (sizeof($mep_event_ticket_type) > 0 ) {
|
||||
//This is if get ticket type
|
||||
$count = 1;
|
||||
$event_more_date[0]['event_more_start_date'] = date('Y-m-d', strtotime(get_post_meta($event_id, 'event_start_date', true)));
|
||||
$event_more_date[0]['event_more_start_time'] = date('H:i', strtotime(get_post_meta($event_id, 'event_start_time', true)));
|
||||
$event_more_date[0]['event_more_end_date'] = date('Y-m-d', strtotime(get_post_meta($event_id, 'event_end_date', true)));
|
||||
$event_more_date[0]['event_more_end_time'] = date('H:i', strtotime(get_post_meta($event_id, 'event_end_time', true)));
|
||||
$event_more_dates = get_post_meta($event_id, 'mep_event_more_date', true) ? get_post_meta($event_id, 'mep_event_more_date', true) : array();
|
||||
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
|
||||
if ($recurring == 'yes') {
|
||||
$event_multi_date = array_merge($event_more_date, $event_more_dates);
|
||||
} else {
|
||||
$event_multi_date = $event_more_date;
|
||||
}
|
||||
foreach ($event_multi_date as $event_date) {
|
||||
|
||||
$start_date = $recurring == 'yes' ? date('Y-m-d H:i:s', strtotime($event_date['event_more_start_date'] . ' ' . $event_date['event_more_start_time'])) : date('Y-m-d H:i:s', strtotime(mep_get_event_expire_date($event_id)));
|
||||
|
||||
if (strtotime(current_time('Y-m-d H:i:s')) < strtotime($start_date)) {
|
||||
foreach ($mep_event_ticket_type as $field) {
|
||||
$ticket_type = $field['option_name_t'];
|
||||
?>
|
||||
var inputs = jQuery("#ttyttl").html() || 0;
|
||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||
var input = parseInt(inputs);
|
||||
var children = jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
|
||||
|
||||
var selected_ticket = jQuery('#ttyttl').html();
|
||||
|
||||
if (input < children) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').empty();
|
||||
children = 0;
|
||||
}
|
||||
for (var i = children + 1; i <= input; i++) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').append(
|
||||
jQuery('<div/>')
|
||||
.attr("id", "newDiv" + i)
|
||||
.html("<?php do_action('mep_reg_fields', $start_date, $event_id, $ticket_type); ?>")
|
||||
);
|
||||
}
|
||||
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function() {
|
||||
var inputs = jQuery("#ttyttl").html() || 0;
|
||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||
var input = parseInt(inputs);
|
||||
var children = jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
|
||||
jQuery(document).on("change", ".etp", function() {
|
||||
var TotalQty = 0;
|
||||
jQuery(".etp").each(function() {
|
||||
TotalQty += +jQuery(this).val();
|
||||
});
|
||||
});
|
||||
if (input < children) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').empty();
|
||||
children = 0;
|
||||
}
|
||||
for (var i = children + 1; i <= input; i++) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').append(
|
||||
jQuery('<div/>')
|
||||
.attr("id", "newDiv" + i)
|
||||
.html("<?php do_action('mep_reg_fields', $start_date, $event_id, $ticket_type); ?>")
|
||||
);
|
||||
}
|
||||
});
|
||||
<?php
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
echo ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action('after-single-events','mep_single_page_script');
|
||||
function mep_single_page_script(){
|
||||
ob_start();
|
||||
?>
|
||||
<script>
|
||||
// jQuery('.mep-more-date-lists<?php echo $event_id; ?>, #hide_event_schdule<?php echo $event_id; ?>').hide();
|
||||
|
||||
jQuery('#mep_single_view_all_date').click(function(){
|
||||
jQuery(this).hide()
|
||||
jQuery('#mep_event_date_sch').addClass('mep_view_all_date');
|
||||
jQuery('#mep_single_hide_all_date').show();
|
||||
});
|
||||
jQuery('#mep_single_hide_all_date').click(function(){
|
||||
jQuery(this).hide()
|
||||
jQuery('#mep_event_date_sch').removeClass('mep_view_all_date');
|
||||
jQuery('#mep_single_view_all_date').show()
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
echo ob_get_clean();
|
||||
}
|
|
@ -1,96 +1,86 @@
|
|||
<?php
|
||||
function mep_event_query($show,$sort='',$cat='',$org='',$city='',$country='',$evnt_type = 'upcoming'){
|
||||
$event_expire_on_old = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
/**
|
||||
* This is the Main Query Function For Query the Event List, Just Pass the Required values It will return the Query As Object.
|
||||
*/
|
||||
function mep_event_query($show, $sort = '', $cat = '', $org = '', $city = '', $country = '', $evnt_type = 'upcoming')
|
||||
{
|
||||
$event_expire_on_old = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old;
|
||||
$now = current_time('Y-m-d H:i:s');
|
||||
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
|
||||
$etype = $evnt_type == 'expired' ? '<' : '>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$cat_filter = !empty($cat) ? array(
|
||||
'taxonomy' => 'mep_cat',
|
||||
'field' => 'term_id',
|
||||
'terms' => $cat
|
||||
) : '';
|
||||
|
||||
|
||||
$org_filter = !empty($org) ? array(
|
||||
'taxonomy' => 'mep_org',
|
||||
'field' => 'term_id',
|
||||
'terms' => $org
|
||||
) : '';
|
||||
|
||||
$city_filter = !empty($city) ? array(
|
||||
'key' => 'mep_city',
|
||||
'value' => $city,
|
||||
'compare' => 'LIKE'
|
||||
) : '';
|
||||
$country_filter = !empty($country) ? array(
|
||||
'key' => 'mep_country',
|
||||
'value' => $country,
|
||||
'compare' => 'LIKE'
|
||||
) : '';
|
||||
|
||||
$expire_filter = !empty($event_expire_on) ? array(
|
||||
'key' => $event_expire_on,
|
||||
'value' => $now,
|
||||
'compare' => $etype
|
||||
) : '';
|
||||
|
||||
|
||||
$cat_filter = !empty($cat) ? array(
|
||||
'taxonomy' => 'mep_cat',
|
||||
'field' => 'term_id',
|
||||
'terms' => $cat
|
||||
) : '';
|
||||
|
||||
|
||||
$org_filter = !empty($org) ? array(
|
||||
'taxonomy' => 'mep_org',
|
||||
'field' => 'term_id',
|
||||
'terms' => $org
|
||||
) : '';
|
||||
|
||||
$city_filter = !empty($city) ? array(
|
||||
'key' => 'mep_city',
|
||||
'value' => $city,
|
||||
'compare' => 'LIKE'
|
||||
) : '';
|
||||
$country_filter = !empty($country) ? array(
|
||||
'key' => 'mep_country',
|
||||
'value' => $country,
|
||||
'compare' => 'LIKE'
|
||||
) : '';
|
||||
|
||||
$expire_filter = !empty($event_expire_on) ? array(
|
||||
'key' => $event_expire_on,
|
||||
'value' => $now,
|
||||
'compare' => $etype
|
||||
) : '';
|
||||
|
||||
|
||||
$args = array(
|
||||
'post_type' => array('mep_events'),
|
||||
'paged' => $paged,
|
||||
'posts_per_page' => $show,
|
||||
'order' => $sort,
|
||||
'orderby' => 'meta_value',
|
||||
'meta_key' => 'event_start_datetime',
|
||||
'meta_query' => array(
|
||||
$expire_filter,
|
||||
$city_filter,
|
||||
$country_filter
|
||||
),
|
||||
'tax_query' => array(
|
||||
$cat_filter,
|
||||
$org_filter
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$loop = new WP_Query($args);
|
||||
|
||||
|
||||
return $loop;
|
||||
|
||||
'post_type' => array('mep_events'),
|
||||
'paged' => $paged,
|
||||
'posts_per_page' => $show,
|
||||
'order' => $sort,
|
||||
'orderby' => 'meta_value',
|
||||
'meta_key' => 'event_start_datetime',
|
||||
'meta_query' => array(
|
||||
$expire_filter,
|
||||
$city_filter,
|
||||
$country_filter
|
||||
),
|
||||
'tax_query' => array(
|
||||
$cat_filter,
|
||||
$org_filter
|
||||
)
|
||||
);
|
||||
|
||||
$loop = new WP_Query($args);
|
||||
|
||||
|
||||
return $loop;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function mep_event_pagination($total_page){
|
||||
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12"><?php
|
||||
$pargs = array(
|
||||
"current" => $paged,
|
||||
"total" => $total_page
|
||||
);
|
||||
echo "<div class='pagination-sec'>" . paginate_links($pargs) . "</div>";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
/**
|
||||
* This is the Main Function For Pagination the Event List, Just Pass the Required values It will return the Pagination with HTML
|
||||
*/
|
||||
function mep_event_pagination($total_page)
|
||||
{
|
||||
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<?php
|
||||
$pargs = array(
|
||||
"current" => $paged,
|
||||
"total" => $total_page
|
||||
);
|
||||
echo "<div class='pagination-sec'>" . paginate_links($pargs) . "</div>";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -3,96 +3,249 @@ if (!defined('ABSPATH')) {
|
|||
die;
|
||||
} // Cannot access pages directly.
|
||||
|
||||
|
||||
/**
|
||||
* This is the Shortcode For Display The City List of The Event
|
||||
*/
|
||||
add_shortcode('event-city-list', 'mep_event_city_list_shortcode_func');
|
||||
function mep_event_city_list_shortcode_func($atts, $content = null){
|
||||
function mep_event_city_list_shortcode_func($atts, $content = null)
|
||||
{
|
||||
ob_start();
|
||||
echo mep_event_get_event_city_list();
|
||||
echo mep_event_get_event_city_list();
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is the Shortcode For Display Event Calendar
|
||||
*/
|
||||
add_shortcode('event-calendar', 'mep_cal_func');
|
||||
function mep_cal_func($atts, $content = null){
|
||||
function mep_cal_func($atts, $content = null)
|
||||
{
|
||||
ob_start();
|
||||
echo mep_event_calender();
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
function mep_event_calender(){
|
||||
function mep_event_calender()
|
||||
{
|
||||
?>
|
||||
<div class="event-calendar"></div>
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).ready(function() {
|
||||
const myEvents = [
|
||||
<?php
|
||||
// $loop = mep_event_query('all',-1);
|
||||
$args = array(
|
||||
$args = array(
|
||||
'post_type' => array('mep_events'),
|
||||
'posts_per_page' => -1,
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'meta_value',
|
||||
'meta_key' => 'event_start_datetime'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$loop = new WP_Query($args);
|
||||
);
|
||||
$loop = new WP_Query($args);
|
||||
$i = 1;
|
||||
$count = $loop->post_count - 1;
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$author_terms = get_the_terms(get_the_id(), 'mep_org');
|
||||
$time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]);
|
||||
$newformat = date_i18n('Y-m-d H:i:s', $time);
|
||||
?>
|
||||
{
|
||||
start: '<?php echo date_i18n('Y-m-d H:i', strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0])); ?>',
|
||||
end: '<?php echo date_i18n('Y-m-d H:i', strtotime($event_meta['event_end_date'][0] . ' ' . $event_meta['event_end_time'][0])); ?>',
|
||||
title: '<?php the_title(); ?>',
|
||||
url: '<?php the_permalink(); ?>',
|
||||
class: '',
|
||||
color: '#000',
|
||||
data: {}
|
||||
},
|
||||
<?php
|
||||
$event_multidate = maybe_unserialize($event_meta['mep_event_more_date'][0]);
|
||||
if(is_array($event_multidate) && sizeof($event_multidate) >0){
|
||||
foreach($event_multidate as $_event_multidate){
|
||||
?>
|
||||
|
||||
{
|
||||
start: '<?php echo date_i18n('Y-m-d H:i', strtotime($_event_multidate['event_more_start_date'] . ' ' . $_event_multidate['event_more_start_time'])); ?>',
|
||||
end: '<?php echo date_i18n('Y-m-d H:i', strtotime($_event_multidate['event_more_end_date'] . ' ' . $_event_multidate['event_more_end_time'])); ?>',
|
||||
title: '<?php the_title(); ?>',
|
||||
url: '<?php the_permalink(); ?>',
|
||||
class: '',
|
||||
color: '#000',
|
||||
data: {}
|
||||
},
|
||||
|
||||
|
||||
<?php } } $i++; } wp_reset_postdata(); ?>]
|
||||
$loop->the_post();
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$author_terms = get_the_terms(get_the_id(), 'mep_org');
|
||||
$time = strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0]);
|
||||
$newformat = date_i18n('Y-m-d H:i:s', $time);
|
||||
?> {
|
||||
start: '<?php echo date_i18n('Y-m-d H:i', strtotime($event_meta['event_start_date'][0] . ' ' . $event_meta['event_start_time'][0])); ?>',
|
||||
end: '<?php echo date_i18n('Y-m-d H:i', strtotime($event_meta['event_end_date'][0] . ' ' . $event_meta['event_end_time'][0])); ?>',
|
||||
title: '<?php the_title(); ?>',
|
||||
url: '<?php the_permalink(); ?>',
|
||||
class: '',
|
||||
color: '#000',
|
||||
data: {}
|
||||
},
|
||||
<?php
|
||||
$event_multidate = maybe_unserialize($event_meta['mep_event_more_date'][0]);
|
||||
if (is_array($event_multidate) && sizeof($event_multidate) > 0) {
|
||||
foreach ($event_multidate as $_event_multidate) {
|
||||
?>
|
||||
|
||||
{
|
||||
start: '<?php echo date_i18n('Y-m-d H:i', strtotime($_event_multidate['event_more_start_date'] . ' ' . $_event_multidate['event_more_start_time'])); ?>',
|
||||
end: '<?php echo date_i18n('Y-m-d H:i', strtotime($_event_multidate['event_more_end_date'] . ' ' . $_event_multidate['event_more_end_time'])); ?>',
|
||||
title: '<?php the_title(); ?>',
|
||||
url: '<?php the_permalink(); ?>',
|
||||
class: '',
|
||||
color: '#000',
|
||||
data: {}
|
||||
},
|
||||
|
||||
|
||||
<?php }
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
wp_reset_postdata(); ?>
|
||||
]
|
||||
|
||||
jQuery('.event-calendar').equinox({
|
||||
events: myEvents
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* The Magical & The Main Event Listing Shortcode is Here, You can check the details with demo here https://wordpress.org/plugins/mage-eventpress/
|
||||
*/
|
||||
add_shortcode('event-list', 'mep_event_list');
|
||||
function mep_event_list($atts, $content = null)
|
||||
{
|
||||
$defaults = array(
|
||||
"cat" => "0",
|
||||
"org" => "0",
|
||||
"style" => "grid",
|
||||
"column" => 3,
|
||||
"cat-filter" => "no",
|
||||
"org-filter" => "no",
|
||||
"show" => "-1",
|
||||
"pagination" => "no",
|
||||
"city" => "",
|
||||
"country" => "",
|
||||
"carousal-nav" => "no",
|
||||
"carousal-dots" => "yes",
|
||||
"carousal-id" => "102448",
|
||||
"timeline-mode" => "vertical",
|
||||
'sort' => 'ASC',
|
||||
'status' => 'upcoming'
|
||||
);
|
||||
$params = shortcode_atts($defaults, $atts);
|
||||
$cat = $params['cat'];
|
||||
$org = $params['org'];
|
||||
$style = $params['style'];
|
||||
$cat_f = $params['cat-filter'];
|
||||
$org_f = $params['org-filter'];
|
||||
$show = $params['show'];
|
||||
$pagination = $params['pagination'];
|
||||
$sort = $params['sort'];
|
||||
$column = $style != 'grid' ? 1 : $params['column'];
|
||||
$nav = $params['carousal-nav'] == 'yes' ? 1 : 0;
|
||||
$dot = $params['carousal-dots'] == 'yes' ? 1 : 0;
|
||||
$city = $params['city'];
|
||||
$country = $params['country'];
|
||||
$cid = $params['carousal-id'];
|
||||
$status = $params['status'];
|
||||
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
|
||||
|
||||
$time_line_div_start = $style == 'timeline' ? '<div class="timeline"><div class="timeline__wrap"><div class="timeline__items">' : '';
|
||||
$time_line_div_end = $style == 'timeline' ? '</div></div></div>' : '';
|
||||
|
||||
$flex_column = $column;
|
||||
$mage_div_count = 0;
|
||||
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
ob_start();
|
||||
?>
|
||||
<div class='mep_event_list'>
|
||||
<?php if ($cat_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_cat_names');
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
$loop = mep_event_query($show, $sort, $cat, $org, $city, $country, $status);
|
||||
$total_post = $loop->post_count;
|
||||
echo $main_div;
|
||||
echo $time_line_div_start;
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
if ($style == 'grid') {
|
||||
if ($column == 2) {
|
||||
$columnNumber = 'two_column';
|
||||
} elseif ($column == 3) {
|
||||
$columnNumber = 'three_column';
|
||||
} elseif ($column == 4) {
|
||||
$columnNumber = 'four_column';
|
||||
} else {
|
||||
$columnNumber = 'two_column';
|
||||
}
|
||||
} else {
|
||||
$columnNumber = 'one_column';
|
||||
}
|
||||
/**
|
||||
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
echo $time_line_div_end;
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
} ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var containerEl = document.querySelector('.mep_event_list_sec');
|
||||
var mixer = mixitup(containerEl);
|
||||
<?php if ($pagination == 'carousal') { ?>
|
||||
jQuery('#mep-carousel<?php echo $cid; ?>').owlCarousel({
|
||||
autoplay: true,
|
||||
autoplayHoverPause: true,
|
||||
loop: true,
|
||||
margin: 20,
|
||||
nav: <?php echo $nav; ?>,
|
||||
dots: <?php echo $dot; ?>,
|
||||
responsiveClass: true,
|
||||
responsive: {
|
||||
0: {
|
||||
items: 1,
|
||||
|
||||
},
|
||||
600: {
|
||||
items: 2,
|
||||
|
||||
},
|
||||
1000: {
|
||||
items: <?php echo $column; ?>,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action('mep_event_shortcode_js_script', $params); ?>
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
add_shortcode('event-list', 'mep_event_list');
|
||||
function mep_event_list($atts, $content = null){
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This Is a Shortcode for display Expired Events, This will be depriciated in the version 4.0, because we added this feature into the main shortcode [event-list]. Just use [event-list status="expired"]
|
||||
*/
|
||||
add_shortcode('expire-event-list', 'mep_expire_event_list');
|
||||
function mep_expire_event_list($atts, $content = null)
|
||||
{
|
||||
$defaults = array(
|
||||
"cat" => "0",
|
||||
"org" => "0",
|
||||
|
@ -125,170 +278,39 @@ function mep_event_list($atts, $content = null){
|
|||
$city = $params['city'];
|
||||
$country = $params['country'];
|
||||
$cid = $params['carousal-id'];
|
||||
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel'.$cid.'">' : '<div class="mage_grid_box">';
|
||||
|
||||
$main_div = $pagination == 'carousal' ? '<div class="mage_grid_box owl-theme owl-carousel" id="mep-carousel' . $cid . '">' : '<div class="mage_grid_box">';
|
||||
|
||||
$time_line_div_start = $style == 'timeline' ? '<div class="timeline"><div class="timeline__wrap"><div class="timeline__items">' : '';
|
||||
$time_line_div_end = $style == 'timeline' ? '</div></div></div>' : '';
|
||||
|
||||
|
||||
$flex_column = $column;
|
||||
$mage_div_count = 0;
|
||||
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
ob_start();
|
||||
?>
|
||||
?>
|
||||
<div class='mep_event_list'>
|
||||
<?php if ($cat_f == 'yes') {
|
||||
<?php if ($cat_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_cat_names');
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
$loop = mep_event_query($show,$sort,$cat,$org,$city,$country,'upcoming');
|
||||
$total_post=$loop->post_count;
|
||||
echo $main_div;
|
||||
echo $time_line_div_start;
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
if ($style == 'grid') {
|
||||
if ($column == 2) {
|
||||
$columnNumber = 'two_column';
|
||||
} elseif ($column == 3) {
|
||||
$columnNumber = 'three_column';
|
||||
} elseif ($column == 4) {
|
||||
$columnNumber = 'four_column';
|
||||
} else {
|
||||
$columnNumber = 'two_column';
|
||||
}
|
||||
} else {
|
||||
$columnNumber = 'one_column';
|
||||
}
|
||||
/**
|
||||
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_shortcode',get_the_id(),$columnNumber,$style);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
echo $time_line_div_end;
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
} ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
var containerEl = document.querySelector('.mep_event_list_sec');
|
||||
var mixer = mixitup(containerEl);
|
||||
<?php if($pagination == 'carousal'){ ?>
|
||||
jQuery('#mep-carousel<?php echo $cid; ?>').owlCarousel({
|
||||
autoplay:true,
|
||||
autoplayHoverPause:true,
|
||||
loop:true,
|
||||
margin:20,
|
||||
nav:<?php echo $nav; ?>,
|
||||
dots:<?php echo $dot; ?>,
|
||||
responsiveClass:true,
|
||||
responsive:{
|
||||
0:{
|
||||
items:1,
|
||||
|
||||
},
|
||||
600:{
|
||||
items:2,
|
||||
|
||||
},
|
||||
1000:{
|
||||
items:<?php echo $column; ?>,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php do_action('mep_event_shortcode_js_script',$params); ?>
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_shortcode('expire-event-list', 'mep_expire_event_list');
|
||||
function mep_expire_event_list($atts, $content = null)
|
||||
{
|
||||
$defaults = array(
|
||||
"cat" => "0",
|
||||
"org" => "0",
|
||||
"style" => "grid",
|
||||
"cat-filter" => "no",
|
||||
"org-filter" => "no",
|
||||
"show" => "-1",
|
||||
"pagination" => "no",
|
||||
'sort' => 'DESC'
|
||||
);
|
||||
|
||||
$params = shortcode_atts($defaults, $atts);
|
||||
$cat = $params['cat'];
|
||||
$org = $params['org'];
|
||||
$style = $params['style'];
|
||||
$cat_f = $params['cat-filter'];
|
||||
$org_f = $params['org-filter'];
|
||||
$show = $params['show'];
|
||||
$pagination = $params['pagination'];
|
||||
$sort = $params['sort'];
|
||||
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
ob_start();
|
||||
?>
|
||||
<div class='mep_event_list'>
|
||||
<?php if ($cat_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_cat_names');
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
if ($cat > 0) {
|
||||
$loop = mep_event_query('cat',$show,$sort,$cat,0,'expired');
|
||||
} elseif ($org > 0) {
|
||||
$loop = mep_event_query('org',$show,$sort,0,$org,'expired');
|
||||
} else {
|
||||
$loop = mep_event_query('all',$show,$sort,0,0,'expired');
|
||||
}
|
||||
$total_post=$loop->post_count;
|
||||
$loop = mep_event_query($show, $sort, $cat, $org, $city, $country, 'expired');
|
||||
$total_post = $loop->post_count;
|
||||
echo '<div class="mage_grid_box">';
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
$loop->the_post();
|
||||
if ($style == 'grid') {
|
||||
if ($column == 2) {
|
||||
$columnNumber = 'two_column';
|
||||
|
@ -305,30 +327,75 @@ function mep_expire_event_list($atts, $content = null)
|
|||
/**
|
||||
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_shortcode',get_the_id(),$columnNumber,$style);
|
||||
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
echo '</div>';
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).ready(function() {
|
||||
var containerEl = document.querySelector('.mep_event_list_sec');
|
||||
var mixer = mixitup(containerEl);
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shortcode('event-add-cart-section', 'mep_event_add_to_cart_section');
|
||||
function mep_event_add_to_cart_section($atts, $content = null)
|
||||
{
|
||||
$defaults = array(
|
||||
"event" => "0"
|
||||
);
|
||||
$params = shortcode_atts($defaults, $atts);
|
||||
$event = $params['event'];
|
||||
ob_start();
|
||||
if($event > 0){
|
||||
echo mep_shortcode_add_cart_section_html($event);
|
||||
}
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_shortcode('event-speaker-list', 'mep_event_speaker_list_shortcode_section');
|
||||
function mep_event_speaker_list_shortcode_section($atts, $content = null)
|
||||
{
|
||||
$defaults = array(
|
||||
"event" => "0"
|
||||
);
|
||||
$params = shortcode_atts($defaults, $atts);
|
||||
$event = $params['event'];
|
||||
ob_start();
|
||||
if($event > 0){
|
||||
echo mep_shortcode_speaker_list_html($event);
|
||||
}
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_shortcode('event-list-onepage', 'mep_event_onepage_list');
|
||||
function mep_event_onepage_list($atts, $content = null)
|
||||
{
|
||||
|
@ -352,23 +419,23 @@ function mep_event_onepage_list($atts, $content = null)
|
|||
$show = $params['show'];
|
||||
$pagination = $params['pagination'];
|
||||
$sort = $params['sort'];
|
||||
$event_expire_on = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
$event_expire_on = mep_get_option('mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
ob_start();
|
||||
do_action('woocommerce_before_single_product');
|
||||
?>
|
||||
?>
|
||||
<div class='mep_event_list'>
|
||||
<?php if ($cat_f == 'yes') {
|
||||
<?php if ($cat_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where category filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_cat_names');
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
}
|
||||
if ($org_f == 'yes') {
|
||||
/**
|
||||
* This is the hook where Organization filter lists are fired from inc/template-parts/event_list_tax_name_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
do_action('mep_event_list_org_names');
|
||||
} ?>
|
||||
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
|
@ -376,30 +443,30 @@ function mep_event_onepage_list($atts, $content = null)
|
|||
$show_price = mep_get_option('mep_event_price_show', 'general_setting_sec', 'yes');
|
||||
$show_price_label = mep_get_option('event-price-label', 'general_setting_sec', 'Price Starts from:');
|
||||
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
|
||||
|
||||
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
if ($cat > 0) {
|
||||
$loop = mep_event_query('cat',$show,$sort,$cat,0,'upcoming');
|
||||
} elseif ($org > 0) {
|
||||
$loop = mep_event_query('org',$show,$sort,0,$org,'upcoming');
|
||||
} else {
|
||||
$loop = mep_event_query('all',$show,$sort,0,0,'upcoming');
|
||||
}
|
||||
?>
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
*/
|
||||
if ($cat > 0) {
|
||||
$loop = mep_event_query('cat',$show,$sort,$cat,0,'upcoming');
|
||||
$loop = mep_event_query('cat', $show, $sort, $cat, 0, 'upcoming');
|
||||
} elseif ($org > 0) {
|
||||
$loop = mep_event_query('org',$show,$sort,0,$org,'upcoming');
|
||||
$loop = mep_event_query('org', $show, $sort, 0, $org, 'upcoming');
|
||||
} else {
|
||||
$loop = mep_event_query('all',$show,$sort,0,0,'upcoming');
|
||||
$loop = mep_event_query('all', $show, $sort, 0, 0, 'upcoming');
|
||||
}
|
||||
?>
|
||||
<div class="mep_event_list_sec">
|
||||
<?php
|
||||
/**
|
||||
* The Main Query function mep_event_query is locet in inc/mep_query.php File
|
||||
*/
|
||||
if ($cat > 0) {
|
||||
$loop = mep_event_query('cat', $show, $sort, $cat, 0, 'upcoming');
|
||||
} elseif ($org > 0) {
|
||||
$loop = mep_event_query('org', $show, $sort, 0, $org, 'upcoming');
|
||||
} else {
|
||||
$loop = mep_event_query('all', $show, $sort, 0, 0, 'upcoming');
|
||||
}
|
||||
$loop->the_post();
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$author_terms = get_the_terms(get_the_id(), 'mep_org');
|
||||
|
@ -410,57 +477,56 @@ function mep_event_onepage_list($atts, $content = null)
|
|||
$torg = get_the_terms(get_the_id(), 'mep_org');
|
||||
$org_class = mep_get_term_as_class(get_the_id(), 'mep_org');
|
||||
$cat_class = mep_get_term_as_class(get_the_id(), 'mep_cat');
|
||||
$available_seat = mep_get_total_available_seat(get_the_id(), $event_meta);
|
||||
echo '<div class="mage_grid_box">';
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
if ($style == 'grid') {
|
||||
if ($column == 2) {
|
||||
$columnNumber = 'two_column';
|
||||
} elseif ($column == 3) {
|
||||
$columnNumber = 'three_column';
|
||||
} elseif ($column == 4) {
|
||||
$columnNumber = 'four_column';
|
||||
$available_seat = mep_get_total_available_seat(get_the_id(), $event_meta);
|
||||
echo '<div class="mage_grid_box">';
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
if ($style == 'grid') {
|
||||
if ($column == 2) {
|
||||
$columnNumber = 'two_column';
|
||||
} elseif ($column == 3) {
|
||||
$columnNumber = 'three_column';
|
||||
} elseif ($column == 4) {
|
||||
$columnNumber = 'four_column';
|
||||
} else {
|
||||
$columnNumber = 'two_column';
|
||||
}
|
||||
} else {
|
||||
$columnNumber = 'two_column';
|
||||
$columnNumber = 'one_column';
|
||||
}
|
||||
} else {
|
||||
$columnNumber = 'one_column';
|
||||
/**
|
||||
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_shortcode', get_the_id(), $columnNumber, $style);
|
||||
|
||||
$currency_pos = get_option('woocommerce_currency_pos');
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
echo '<div class=event-cart-section-list>';
|
||||
do_action('mep_add_to_cart_list');
|
||||
echo '</div>';
|
||||
get_event_list_js(get_the_id(), $event_meta, $currency_pos);
|
||||
}
|
||||
/**
|
||||
* This is the hook where Event Loop List fired from inc/template-parts/event_loop_list.php File
|
||||
*/
|
||||
do_action('mep_event_list_shortcode',get_the_id(),$columnNumber,$style);
|
||||
|
||||
$currency_pos = get_option('woocommerce_currency_pos');
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
echo '<div class=event-cart-section-list>';
|
||||
do_action('mep_add_to_cart_list');
|
||||
echo '</div>';
|
||||
get_event_list_js(get_the_id(), $event_meta, $currency_pos);
|
||||
}
|
||||
wp_reset_postdata();
|
||||
echo '</div>';
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
} ?>
|
||||
</div>
|
||||
wp_reset_postdata();
|
||||
echo '</div>';
|
||||
if ($pagination == 'yes') {
|
||||
/**
|
||||
* The Pagination function mep_event_pagination is locet in inc/mep_query.php File
|
||||
*/
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
return $content;
|
||||
}
|
|
@ -74,8 +74,6 @@ register_taxonomy('mep_cat', 'mep_events', $args);
|
|||
);
|
||||
register_taxonomy('mep_org', 'mep_events', $argso);
|
||||
|
||||
|
||||
|
||||
}
|
||||
add_action("init","mep_cpt_tax",10);
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* This will be used for Taxonomy Meta Box with the Brand New Mage Freamwork
|
||||
*/
|
|
@ -1,405 +1,420 @@
|
|||
<?php
|
||||
|
||||
add_action( 'mep_org_add_form_fields', 'mep_org_tax_location_fileds', 10, 2 );
|
||||
function mep_org_tax_location_fileds($taxonomy) {
|
||||
?>
|
||||
<div class="form-field term-group">
|
||||
<label for="org_location"><?php _e('Location/Venue', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_location" id='org_location' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_street"><?php _e('Street:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_street" id='org_street' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_city"><?php _e('City:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_city" id='org_city' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_state"><?php _e('State:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_state" id='org_state' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_postcode"><?php _e('Postcode:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_postcode" id='org_postcode' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_country"><?php _e('Country:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_country" id='org_country' class="postform">
|
||||
</div>
|
||||
|
||||
|
||||
<div class='sec'>
|
||||
<?php
|
||||
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
|
||||
if($user_api){
|
||||
?>
|
||||
<input id="pac-input" name='location_name' value='<?php //echo $values['location_name'][0]; ?>'/>
|
||||
|
||||
|
||||
<input type="text" class="form-control" style="display: none;" name="latitude" value="">
|
||||
<input type="text" class="form-control" style="display: none;" name="longitude" value="">
|
||||
<!-- <div id="map"></div> -->
|
||||
<?php
|
||||
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
|
||||
if($user_api){
|
||||
//wp_enqueue_script('gmap-libs','https://maps.googleapis.com/maps/api/js?key='.$user_api.'&libraries=places&callback=initMap',array('jquery','gmap-scripts'),1,true);
|
||||
?>
|
||||
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&libraries=places&callback=initMap&ver=1'></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function initMap() {
|
||||
var map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: {
|
||||
lat: 37.0902,
|
||||
lng: 95.7129
|
||||
},
|
||||
zoom: 17
|
||||
});
|
||||
|
||||
|
||||
|
||||
var input = /** @type {!HTMLInputElement} */ (
|
||||
document.getElementById('pac-input'));
|
||||
|
||||
var types = document.getElementById('type-selector');
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
|
||||
|
||||
var autocomplete = new google.maps.places.Autocomplete(input);
|
||||
autocomplete.bindTo('bounds', map);
|
||||
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
anchorPoint: new google.maps.Point(0, -29),
|
||||
draggable: true,
|
||||
position: {lat: 37.0902, lng: 95.7129}
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
document.getElementsByName('latitude')[0].value = marker.getPosition().lat();
|
||||
document.getElementsByName('longitude')[0].value = marker.getPosition().lng();
|
||||
})
|
||||
|
||||
|
||||
|
||||
autocomplete.addListener('place_changed', function() {
|
||||
infowindow.close();
|
||||
marker.setVisible(false);
|
||||
var place = autocomplete.getPlace();
|
||||
if (!place.geometry) {
|
||||
window.alert("Autocomplete's returned place contains no geometry");
|
||||
return;
|
||||
}
|
||||
|
||||
// If the place has a geometry, then present it on a map.
|
||||
if (place.geometry.viewport) {
|
||||
map.fitBounds(place.geometry.viewport);
|
||||
} else {
|
||||
map.setCenter(place.geometry.location);
|
||||
map.setZoom(17); // Why 17? Because it looks good.
|
||||
}
|
||||
marker.setIcon( /** @type {google.maps.Icon} */ ({
|
||||
url: 'http://maps.google.com/mapfiles/ms/icons/red.png',
|
||||
size: new google.maps.Size(71, 71),
|
||||
origin: new google.maps.Point(0, 0),
|
||||
anchor: new google.maps.Point(17, 34),
|
||||
scaledSize: new google.maps.Size(35, 35)
|
||||
}));
|
||||
marker.setPosition(place.geometry.location);
|
||||
marker.setVisible(true);
|
||||
|
||||
var address = '';
|
||||
if (place.address_components) {
|
||||
address = [
|
||||
(place.address_components[0] && place.address_components[0].short_name || ''),
|
||||
(place.address_components[1] && place.address_components[1].short_name || ''),
|
||||
(place.address_components[2] && place.address_components[2].short_name || '')
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
var latitude = place.geometry.location.lat();
|
||||
var longitude = place.geometry.location.lng();
|
||||
|
||||
$("input[name=coordinate]").val(address);
|
||||
$("input[name=latitude]").val(latitude);
|
||||
$("input[name=longitude]").val(longitude);
|
||||
|
||||
//infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
|
||||
//infowindow.open(map, marker);
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, "load", initMap);
|
||||
</script>
|
||||
<?php
|
||||
}else{
|
||||
// echo "<span class=mep_status><span class=err>No Google MAP API Key Found. Please enter API KEY <a href=".get_site_url()."/wp-admin/options-general.php?page=mep_event_settings_page>Here</a></span></span>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'created_mep_org', 'save_feature_meta', 10, 2 );
|
||||
|
||||
function save_feature_meta( $term_id, $tt_id ){
|
||||
|
||||
if( isset( $_POST['org_location'] )){
|
||||
$org_location = strip_tags( $_POST['org_location'] );
|
||||
add_term_meta( $term_id, 'org_location', $org_location);
|
||||
}
|
||||
if( isset( $_POST['org_street'] )){
|
||||
$org_street = strip_tags( $_POST['org_street'] );
|
||||
add_term_meta( $term_id, 'org_street', $org_street);
|
||||
}
|
||||
if( isset( $_POST['org_city'] )){
|
||||
$org_city = strip_tags( $_POST['org_city'] );
|
||||
add_term_meta( $term_id, 'org_city', $org_city);
|
||||
}
|
||||
if( isset( $_POST['org_state'] )){
|
||||
$org_state = strip_tags( $_POST['org_state'] );
|
||||
add_term_meta( $term_id, 'org_state', $org_state);
|
||||
}
|
||||
if( isset( $_POST['org_postcode'] )){
|
||||
$org_postcode = strip_tags( $_POST['org_postcode'] );
|
||||
add_term_meta( $term_id, 'org_postcode', $org_postcode);
|
||||
}
|
||||
|
||||
if( isset( $_POST['org_country'] )){
|
||||
$org_country = strip_tags( $_POST['org_country'] );
|
||||
add_term_meta( $term_id, 'org_country', $org_country);
|
||||
}
|
||||
|
||||
if( isset( $_POST['latitude'] )){
|
||||
$latitude = strip_tags( $_POST['latitude'] );
|
||||
add_term_meta( $term_id, 'latitude', $latitude);
|
||||
}
|
||||
|
||||
if( isset( $_POST['longitude'] )){
|
||||
$longitude = strip_tags( $_POST['longitude'] );
|
||||
add_term_meta( $term_id, 'longitude', $longitude);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
add_action( 'mep_org_edit_form_fields', 'edit_feature_group_field', 10, 2 );
|
||||
|
||||
function edit_feature_group_field( $term, $taxonomy ){
|
||||
?>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_location"><?php _e('Location/Venue', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_location" id='org_location' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_location', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_street"><?php _e('Street:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_street" id='org_street' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_street', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_city"><?php _e('City:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_city" id='org_city' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_city', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_state"><?php _e('State:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_state" id='org_state' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_state', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_postcode"><?php _e('Postcode:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_postcode" id='org_postcode' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_postcode', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_country"><?php _e('Country:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_country" id='org_country' class="postform" value='<?php echo get_term_meta( $term->term_id, 'org_country', true ); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_country"><?php _e('Map:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
|
||||
if($user_api){
|
||||
?>
|
||||
<div class='sec'>
|
||||
<input id="pac-input" name='location_name' value='<?php //echo $values['location_name'][0]; ?>'/>
|
||||
</div>
|
||||
|
||||
<input type="text" class="form-control" style="display: none;" name="latitude" value="<?php echo get_term_meta( $term->term_id, 'latitude', true ); ?>">
|
||||
<input type="text" class="form-control" style="display: none;" name="longitude" value="<?php echo get_term_meta( $term->term_id, 'longitude', true ); ?>">
|
||||
<!-- <div id="map"></div> -->
|
||||
<?php
|
||||
|
||||
if($user_api){
|
||||
?>
|
||||
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&libraries=places&callback=initMap&ver=1'></script>
|
||||
<?php
|
||||
}
|
||||
if(get_term_meta( $term->term_id, 'latitude', true )){
|
||||
$lat = get_term_meta( $term->term_id, 'latitude', true );
|
||||
}else{ $lat = '37.0902'; }
|
||||
|
||||
|
||||
if(get_term_meta( $term->term_id, 'longitude', true )){
|
||||
$lon = get_term_meta( $term->term_id, 'longitude', true );
|
||||
}else{ $lon = '95.7129'; }
|
||||
|
||||
add_action('mep_org_add_form_fields', 'mep_org_tax_location_fileds', 10, 2);
|
||||
function mep_org_tax_location_fileds($taxonomy)
|
||||
{
|
||||
?>
|
||||
<script>
|
||||
function initMap() {
|
||||
var map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: {
|
||||
lat: <?php echo $lat; ?>,
|
||||
lng: <?php echo $lon; ?>
|
||||
},
|
||||
zoom: 17
|
||||
});
|
||||
<div class="form-field term-group">
|
||||
<label for="org_location"><?php _e('Location/Venue', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_location" id='org_location' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_street"><?php _e('Street:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_street" id='org_street' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_city"><?php _e('City:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_city" id='org_city' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_state"><?php _e('State:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_state" id='org_state' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_postcode"><?php _e('Postcode:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_postcode" id='org_postcode' class="postform">
|
||||
</div>
|
||||
|
||||
<div class="form-field term-group">
|
||||
<label for="org_country"><?php _e('Country:', 'mage-eventpress'); ?></label>
|
||||
<input type="text" name="org_country" id='org_country' class="postform">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
var input = /** @type {!HTMLInputElement} */ (
|
||||
document.getElementById('pac-input'));
|
||||
|
||||
var types = document.getElementById('type-selector');
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
|
||||
|
||||
var autocomplete = new google.maps.places.Autocomplete(input);
|
||||
autocomplete.bindTo('bounds', map);
|
||||
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
anchorPoint: new google.maps.Point(0, -29),
|
||||
draggable: true,
|
||||
position: {lat: <?php echo $lat; ?>, lng: <?php echo $lon; ?>}
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
document.getElementsByName('latitude')[0].value = marker.getPosition().lat();
|
||||
document.getElementsByName('longitude')[0].value = marker.getPosition().lng();
|
||||
})
|
||||
|
||||
autocomplete.addListener('place_changed', function() {
|
||||
infowindow.close();
|
||||
marker.setVisible(false);
|
||||
var place = autocomplete.getPlace();
|
||||
if (!place.geometry) {
|
||||
window.alert("Autocomplete's returned place contains no geometry");
|
||||
return;
|
||||
}
|
||||
|
||||
// If the place has a geometry, then present it on a map.
|
||||
if (place.geometry.viewport) {
|
||||
map.fitBounds(place.geometry.viewport);
|
||||
} else {
|
||||
map.setCenter(place.geometry.location);
|
||||
map.setZoom(17); // Why 17? Because it looks good.
|
||||
}
|
||||
marker.setIcon( /** @type {google.maps.Icon} */ ({
|
||||
url: 'http://maps.google.com/mapfiles/ms/icons/red.png',
|
||||
size: new google.maps.Size(71, 71),
|
||||
origin: new google.maps.Point(0, 0),
|
||||
anchor: new google.maps.Point(17, 34),
|
||||
scaledSize: new google.maps.Size(35, 35)
|
||||
}));
|
||||
marker.setPosition(place.geometry.location);
|
||||
marker.setVisible(true);
|
||||
|
||||
var address = '';
|
||||
if (place.address_components) {
|
||||
address = [
|
||||
(place.address_components[0] && place.address_components[0].short_name || ''),
|
||||
(place.address_components[1] && place.address_components[1].short_name || ''),
|
||||
(place.address_components[2] && place.address_components[2].short_name || '')
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
var latitude = place.geometry.location.lat();
|
||||
var longitude = place.geometry.location.lng();
|
||||
|
||||
$("input[name=coordinate]").val(address);
|
||||
$("input[name=latitude]").val(latitude);
|
||||
$("input[name=longitude]").val(longitude);
|
||||
|
||||
//infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
|
||||
//infowindow.open(map, marker);
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, "load", initMap);
|
||||
</script>
|
||||
<?php
|
||||
}else{
|
||||
// echo "<span class=mep_status><span class=err>No Google MAP API Key Found. Please enter API KEY <a href=".get_site_url()."/wp-admin/options-general.php?page=mep_event_settings_page>Here</a></span></span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<div class='sec'>
|
||||
<?php
|
||||
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
|
||||
if ($user_api) {
|
||||
?>
|
||||
<input id="pac-input" name='location_name' value='<?php //echo $values['location_name'][0];
|
||||
?>' />
|
||||
|
||||
|
||||
<input type="text" class="form-control" style="display: none;" name="latitude" value="">
|
||||
<input type="text" class="form-control" style="display: none;" name="longitude" value="">
|
||||
<!-- <div id="map"></div> -->
|
||||
<?php
|
||||
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
|
||||
if ($user_api) {
|
||||
//wp_enqueue_script('gmap-libs','https://maps.googleapis.com/maps/api/js?key='.$user_api.'&libraries=places&callback=initMap',array('jquery','gmap-scripts'),1,true);
|
||||
?>
|
||||
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&libraries=places&callback=initMap&ver=1'></script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function initMap() {
|
||||
var map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: {
|
||||
lat: 37.0902,
|
||||
lng: 95.7129
|
||||
},
|
||||
zoom: 17
|
||||
});
|
||||
|
||||
|
||||
|
||||
var input = /** @type {!HTMLInputElement} */ (
|
||||
document.getElementById('pac-input'));
|
||||
|
||||
var types = document.getElementById('type-selector');
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
|
||||
|
||||
var autocomplete = new google.maps.places.Autocomplete(input);
|
||||
autocomplete.bindTo('bounds', map);
|
||||
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
anchorPoint: new google.maps.Point(0, -29),
|
||||
draggable: true,
|
||||
position: {
|
||||
lat: 37.0902,
|
||||
lng: 95.7129
|
||||
}
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
document.getElementsByName('latitude')[0].value = marker.getPosition().lat();
|
||||
document.getElementsByName('longitude')[0].value = marker.getPosition().lng();
|
||||
})
|
||||
|
||||
|
||||
|
||||
autocomplete.addListener('place_changed', function() {
|
||||
infowindow.close();
|
||||
marker.setVisible(false);
|
||||
var place = autocomplete.getPlace();
|
||||
if (!place.geometry) {
|
||||
window.alert("Autocomplete's returned place contains no geometry");
|
||||
return;
|
||||
}
|
||||
|
||||
// If the place has a geometry, then present it on a map.
|
||||
if (place.geometry.viewport) {
|
||||
map.fitBounds(place.geometry.viewport);
|
||||
} else {
|
||||
map.setCenter(place.geometry.location);
|
||||
map.setZoom(17); // Why 17? Because it looks good.
|
||||
}
|
||||
marker.setIcon( /** @type {google.maps.Icon} */ ({
|
||||
url: 'http://maps.google.com/mapfiles/ms/icons/red.png',
|
||||
size: new google.maps.Size(71, 71),
|
||||
origin: new google.maps.Point(0, 0),
|
||||
anchor: new google.maps.Point(17, 34),
|
||||
scaledSize: new google.maps.Size(35, 35)
|
||||
}));
|
||||
marker.setPosition(place.geometry.location);
|
||||
marker.setVisible(true);
|
||||
|
||||
var address = '';
|
||||
if (place.address_components) {
|
||||
address = [
|
||||
(place.address_components[0] && place.address_components[0].short_name || ''),
|
||||
(place.address_components[1] && place.address_components[1].short_name || ''),
|
||||
(place.address_components[2] && place.address_components[2].short_name || '')
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
var latitude = place.geometry.location.lat();
|
||||
var longitude = place.geometry.location.lng();
|
||||
|
||||
$("input[name=coordinate]").val(address);
|
||||
$("input[name=latitude]").val(latitude);
|
||||
$("input[name=longitude]").val(longitude);
|
||||
|
||||
//infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
|
||||
//infowindow.open(map, marker);
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, "load", initMap);
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
// echo "<span class=mep_status><span class=err>No Google MAP API Key Found. Please enter API KEY <a href=".get_site_url()."/wp-admin/options-general.php?page=mep_event_settings_page>Here</a></span></span>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action('created_mep_org', 'save_feature_meta', 10, 2);
|
||||
|
||||
function save_feature_meta($term_id, $tt_id)
|
||||
{
|
||||
|
||||
if (isset($_POST['org_location'])) {
|
||||
$org_location = strip_tags($_POST['org_location']);
|
||||
add_term_meta($term_id, 'org_location', $org_location);
|
||||
}
|
||||
if (isset($_POST['org_street'])) {
|
||||
$org_street = strip_tags($_POST['org_street']);
|
||||
add_term_meta($term_id, 'org_street', $org_street);
|
||||
}
|
||||
if (isset($_POST['org_city'])) {
|
||||
$org_city = strip_tags($_POST['org_city']);
|
||||
add_term_meta($term_id, 'org_city', $org_city);
|
||||
}
|
||||
if (isset($_POST['org_state'])) {
|
||||
$org_state = strip_tags($_POST['org_state']);
|
||||
add_term_meta($term_id, 'org_state', $org_state);
|
||||
}
|
||||
if (isset($_POST['org_postcode'])) {
|
||||
$org_postcode = strip_tags($_POST['org_postcode']);
|
||||
add_term_meta($term_id, 'org_postcode', $org_postcode);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_country'])) {
|
||||
$org_country = strip_tags($_POST['org_country']);
|
||||
add_term_meta($term_id, 'org_country', $org_country);
|
||||
}
|
||||
|
||||
if (isset($_POST['latitude'])) {
|
||||
$latitude = strip_tags($_POST['latitude']);
|
||||
add_term_meta($term_id, 'latitude', $latitude);
|
||||
}
|
||||
|
||||
if (isset($_POST['longitude'])) {
|
||||
$longitude = strip_tags($_POST['longitude']);
|
||||
add_term_meta($term_id, 'longitude', $longitude);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_action( 'edited_mep_org', 'update_feature_meta', 10, 2 );
|
||||
|
||||
function update_feature_meta( $term_id, $tt_id ){
|
||||
|
||||
if( isset( $_POST['org_location'] )){
|
||||
$org_location = strip_tags( $_POST['org_location'] );
|
||||
update_term_meta( $term_id, 'org_location', $org_location );
|
||||
}
|
||||
add_action('mep_org_edit_form_fields', 'edit_feature_group_field', 10, 2);
|
||||
|
||||
if( isset( $_POST['org_street'] )){
|
||||
$org_street = strip_tags( $_POST['org_street'] );
|
||||
update_term_meta( $term_id, 'org_street', $org_street );
|
||||
}
|
||||
function edit_feature_group_field($term, $taxonomy)
|
||||
{
|
||||
?>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_location"><?php _e('Location/Venue', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_location" id='org_location' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_location', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_street"><?php _e('Street:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_street" id='org_street' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_street', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_city"><?php _e('City:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_city" id='org_city' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_city', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_state"><?php _e('State:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_state" id='org_state' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_state', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_postcode"><?php _e('Postcode:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_postcode" id='org_postcode' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_postcode', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_country"><?php _e('Country:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
<input type="text" name="org_country" id='org_country' class="postform" value='<?php echo get_term_meta($term->term_id, 'org_country', true); ?>'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="form-field term-group-wrap">
|
||||
<th scope="row"><label for="org_country"><?php _e('Map:', 'mage-eventpress'); ?></label></th>
|
||||
<td>
|
||||
|
||||
if( isset( $_POST['org_city'] )){
|
||||
$org_city = strip_tags( $_POST['org_city'] );
|
||||
update_term_meta( $term_id, 'org_city', $org_city );
|
||||
}
|
||||
<?php
|
||||
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
|
||||
if ($user_api) {
|
||||
?>
|
||||
<div class='sec'>
|
||||
<input id="pac-input" name='location_name' value='<?php //echo $values['location_name'][0];
|
||||
?>' />
|
||||
</div>
|
||||
|
||||
if( isset( $_POST['org_state'] )){
|
||||
$org_state = strip_tags( $_POST['org_state'] );
|
||||
update_term_meta( $term_id, 'org_state', $org_state );
|
||||
}
|
||||
<input type="text" class="form-control" style="display: none;" name="latitude" value="<?php echo get_term_meta($term->term_id, 'latitude', true); ?>">
|
||||
<input type="text" class="form-control" style="display: none;" name="longitude" value="<?php echo get_term_meta($term->term_id, 'longitude', true); ?>">
|
||||
<!-- <div id="map"></div> -->
|
||||
<?php
|
||||
|
||||
if( isset( $_POST['org_postcode'] )){
|
||||
$org_postcode = strip_tags( $_POST['org_postcode'] );
|
||||
update_term_meta( $term_id, 'org_postcode', $org_postcode );
|
||||
}
|
||||
if ($user_api) {
|
||||
?>
|
||||
<script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&libraries=places&callback=initMap&ver=1'></script>
|
||||
<?php
|
||||
}
|
||||
if (get_term_meta($term->term_id, 'latitude', true)) {
|
||||
$lat = get_term_meta($term->term_id, 'latitude', true);
|
||||
} else {
|
||||
$lat = '37.0902';
|
||||
}
|
||||
|
||||
if( isset( $_POST['org_country'] )){
|
||||
$org_country = strip_tags( $_POST['org_country'] );
|
||||
update_term_meta( $term_id, 'org_country', $org_country );
|
||||
}
|
||||
|
||||
if( isset( $_POST['latitude'] )){
|
||||
$latitude = strip_tags( $_POST['latitude'] );
|
||||
update_term_meta( $term_id, 'latitude', $latitude );
|
||||
}
|
||||
if (get_term_meta($term->term_id, 'longitude', true)) {
|
||||
$lon = get_term_meta($term->term_id, 'longitude', true);
|
||||
} else {
|
||||
$lon = '95.7129';
|
||||
}
|
||||
|
||||
if( isset( $_POST['longitude'] )){
|
||||
$longitude = strip_tags( $_POST['longitude'] );
|
||||
update_term_meta( $term_id, 'longitude', $longitude );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
function initMap() {
|
||||
var map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: {
|
||||
lat: <?php echo $lat; ?>,
|
||||
lng: <?php echo $lon; ?>
|
||||
},
|
||||
zoom: 17
|
||||
});
|
||||
|
||||
|
||||
|
||||
var input = /** @type {!HTMLInputElement} */ (
|
||||
document.getElementById('pac-input'));
|
||||
|
||||
var types = document.getElementById('type-selector');
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
|
||||
map.controls[google.maps.ControlPosition.TOP_LEFT].push(types);
|
||||
|
||||
var autocomplete = new google.maps.places.Autocomplete(input);
|
||||
autocomplete.bindTo('bounds', map);
|
||||
|
||||
var infowindow = new google.maps.InfoWindow();
|
||||
var marker = new google.maps.Marker({
|
||||
map: map,
|
||||
anchorPoint: new google.maps.Point(0, -29),
|
||||
draggable: true,
|
||||
position: {
|
||||
lat: <?php echo $lat; ?>,
|
||||
lng: <?php echo $lon; ?>
|
||||
}
|
||||
});
|
||||
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
document.getElementsByName('latitude')[0].value = marker.getPosition().lat();
|
||||
document.getElementsByName('longitude')[0].value = marker.getPosition().lng();
|
||||
})
|
||||
|
||||
autocomplete.addListener('place_changed', function() {
|
||||
infowindow.close();
|
||||
marker.setVisible(false);
|
||||
var place = autocomplete.getPlace();
|
||||
if (!place.geometry) {
|
||||
window.alert("Autocomplete's returned place contains no geometry");
|
||||
return;
|
||||
}
|
||||
|
||||
// If the place has a geometry, then present it on a map.
|
||||
if (place.geometry.viewport) {
|
||||
map.fitBounds(place.geometry.viewport);
|
||||
} else {
|
||||
map.setCenter(place.geometry.location);
|
||||
map.setZoom(17); // Why 17? Because it looks good.
|
||||
}
|
||||
marker.setIcon( /** @type {google.maps.Icon} */ ({
|
||||
url: 'http://maps.google.com/mapfiles/ms/icons/red.png',
|
||||
size: new google.maps.Size(71, 71),
|
||||
origin: new google.maps.Point(0, 0),
|
||||
anchor: new google.maps.Point(17, 34),
|
||||
scaledSize: new google.maps.Size(35, 35)
|
||||
}));
|
||||
marker.setPosition(place.geometry.location);
|
||||
marker.setVisible(true);
|
||||
|
||||
var address = '';
|
||||
if (place.address_components) {
|
||||
address = [
|
||||
(place.address_components[0] && place.address_components[0].short_name || ''),
|
||||
(place.address_components[1] && place.address_components[1].short_name || ''),
|
||||
(place.address_components[2] && place.address_components[2].short_name || '')
|
||||
].join(' ');
|
||||
}
|
||||
|
||||
var latitude = place.geometry.location.lat();
|
||||
var longitude = place.geometry.location.lng();
|
||||
|
||||
$("input[name=coordinate]").val(address);
|
||||
$("input[name=latitude]").val(latitude);
|
||||
$("input[name=longitude]").val(longitude);
|
||||
|
||||
//infowindow.setContent('<div><strong>' + place.name + '</strong><br>' + address);
|
||||
//infowindow.open(map, marker);
|
||||
});
|
||||
}
|
||||
google.maps.event.addDomListener(window, "load", initMap);
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
// echo "<span class=mep_status><span class=err>No Google MAP API Key Found. Please enter API KEY <a href=".get_site_url()."/wp-admin/options-general.php?page=mep_event_settings_page>Here</a></span></span>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
add_action('edited_mep_org', 'update_feature_meta', 10, 2);
|
||||
|
||||
function update_feature_meta($term_id, $tt_id)
|
||||
{
|
||||
|
||||
if (isset($_POST['org_location'])) {
|
||||
$org_location = strip_tags($_POST['org_location']);
|
||||
update_term_meta($term_id, 'org_location', $org_location);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_street'])) {
|
||||
$org_street = strip_tags($_POST['org_street']);
|
||||
update_term_meta($term_id, 'org_street', $org_street);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_city'])) {
|
||||
$org_city = strip_tags($_POST['org_city']);
|
||||
update_term_meta($term_id, 'org_city', $org_city);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_state'])) {
|
||||
$org_state = strip_tags($_POST['org_state']);
|
||||
update_term_meta($term_id, 'org_state', $org_state);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_postcode'])) {
|
||||
$org_postcode = strip_tags($_POST['org_postcode']);
|
||||
update_term_meta($term_id, 'org_postcode', $org_postcode);
|
||||
}
|
||||
|
||||
if (isset($_POST['org_country'])) {
|
||||
$org_country = strip_tags($_POST['org_country']);
|
||||
update_term_meta($term_id, 'org_country', $org_country);
|
||||
}
|
||||
|
||||
if (isset($_POST['latitude'])) {
|
||||
$latitude = strip_tags($_POST['latitude']);
|
||||
update_term_meta($term_id, 'latitude', $latitude);
|
||||
}
|
||||
|
||||
if (isset($_POST['longitude'])) {
|
||||
$longitude = strip_tags($_POST['longitude']);
|
||||
update_term_meta($term_id, 'longitude', $longitude);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,362 +1,359 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
die;
|
||||
} // Cannot access pages directly.
|
||||
|
||||
function mep_check_attendee_exists($event_id, $order_id, $name = null, $email = null, $phone = null, $address = null, $gender = null, $company = null, $desg = null, $website = null, $veg = null, $tshirt = null, $type)
|
||||
{
|
||||
|
||||
function mep_check_attendee_exists($event_id,$order_id,$name=null,$email=null,$phone=null,$address=null,$gender=null,$company=null,$desg=null,$website=null,$veg=null,$tshirt=null,$type){
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events_attendees',
|
||||
'posts_per_page' => -1,
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'ea_event_id',
|
||||
'value' => $event_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_order_id',
|
||||
'value' => $order_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_ticket_type',
|
||||
'value' => $type,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_name',
|
||||
'value' => $name,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_email',
|
||||
'value' => $email,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_phone',
|
||||
'value' => $phone,
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
);
|
||||
$loop = new WP_Query($args);
|
||||
'post_type' => 'mep_events_attendees',
|
||||
'posts_per_page' => -1,
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'ea_event_id',
|
||||
'value' => $event_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_order_id',
|
||||
'value' => $order_id,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_ticket_type',
|
||||
'value' => $type,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_name',
|
||||
'value' => $name,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_email',
|
||||
'value' => $email,
|
||||
'compare' => '='
|
||||
),
|
||||
array(
|
||||
'key' => 'ea_phone',
|
||||
'value' => $phone,
|
||||
'compare' => '='
|
||||
)
|
||||
)
|
||||
);
|
||||
$loop = new WP_Query($args);
|
||||
return $loop->post_count;
|
||||
}
|
||||
|
||||
// Flash Permalink only Once
|
||||
function mep_flash_permalink_once() {
|
||||
if ( get_option( 'mep_flash_event_permalink' ) != 'completed' ) {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->flush_rules();
|
||||
update_option( 'mep_flash_event_permalink', 'completed' );
|
||||
function mep_flash_permalink_once()
|
||||
{
|
||||
if (get_option('mep_flash_event_permalink') != 'completed') {
|
||||
global $wp_rewrite;
|
||||
$wp_rewrite->flush_rules();
|
||||
update_option('mep_flash_event_permalink', 'completed');
|
||||
}
|
||||
}
|
||||
add_action( 'admin_init', 'mep_flash_permalink_once' );
|
||||
add_action('admin_init', 'mep_flash_permalink_once');
|
||||
|
||||
|
||||
add_action('admin_init','mep_get_all_order_data_and_create_attendee');
|
||||
add_action('admin_init', 'mep_get_all_order_data_and_create_attendee');
|
||||
|
||||
function mep_get_all_order_data_and_create_attendee(){
|
||||
|
||||
|
||||
if ( get_option( 'mep_hidden_product_thumbnail_update_02' ) != 'completed' ) {
|
||||
function mep_get_all_order_data_and_create_attendee()
|
||||
{
|
||||
|
||||
|
||||
if (get_option('mep_hidden_product_thumbnail_update_02') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$product_id = get_post_meta($post_id,'link_wc_product',true) ? get_post_meta($post_id,'link_wc_product',true) : $post_id;
|
||||
set_post_thumbnail( $product_id, get_post_thumbnail_id($post_id) );
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$product_id = get_post_meta($post_id, 'link_wc_product', true) ? get_post_meta($post_id, 'link_wc_product', true) : $post_id;
|
||||
set_post_thumbnail($product_id, get_post_thumbnail_id($post_id));
|
||||
}
|
||||
update_option( 'mep_hidden_product_thumbnail_update_02', 'completed' );
|
||||
}
|
||||
|
||||
|
||||
if ( get_option( 'mep_event_default_date_update_2020' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$mep_start_date = get_post_meta($post_id, 'event_start_date', true);
|
||||
$mep_start_time = get_post_meta($post_id, 'event_start_time', true);
|
||||
$mep_end_date = get_post_meta($post_id, 'event_end_date', true);
|
||||
$mep_end_time = get_post_meta($post_id, 'event_end_time', true);
|
||||
|
||||
$event_start_datetime = date('Y-m-d H:i:s',strtotime($mep_start_date.' '.$mep_start_time));
|
||||
$event_end_datetime = date('Y-m-d H:i:s',strtotime($mep_end_date.' '.$mep_end_time));
|
||||
|
||||
update_post_meta( $post_id, 'event_start_datetime', $event_start_datetime );
|
||||
update_post_meta( $post_id, 'event_end_datetime', $event_end_datetime );
|
||||
}
|
||||
update_option( 'mep_event_default_date_update_2020', 'completed' );
|
||||
//die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Expire Date Upgrade
|
||||
*/
|
||||
if ( get_option( 'mep_event_expire_date_upgration' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$event_more_dates = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array();
|
||||
$md = sizeof($event_more_dates)>0 ? end($event_more_dates) : array();
|
||||
$event_expire_datetime = sizeof($md) > 0 ? date('Y-m-d H:i:s',strtotime($md['event_more_end_date'].' '.$md['event_more_end_time'])) : date('Y-m-d H:i:s',strtotime(get_post_meta($post_id,'event_end_datetime',true)));
|
||||
update_post_meta( $post_id, 'event_expire_datetime', $event_expire_datetime );
|
||||
}
|
||||
update_option( 'mep_event_expire_date_upgration', 'completed' );
|
||||
// die();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( get_option( 'mep_event_default_date_update_20' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$mep_start_date = get_post_meta($post_id, 'mep_event_start_date', true);
|
||||
$mep_end_date = get_post_meta($post_id, 'mep_event_end_date', true);
|
||||
|
||||
$event_start_date = date('Y-m-d',strtotime($mep_start_date));
|
||||
$event_start_time = date('H:i',strtotime($mep_start_date));
|
||||
$event_end_date = date('Y-m-d',strtotime($mep_end_date));
|
||||
$event_end_time = date('H:i',strtotime($mep_end_date));
|
||||
|
||||
update_post_meta( $post_id, 'event_start_date', $event_start_date );
|
||||
update_post_meta( $post_id, 'event_start_time', $event_start_time );
|
||||
update_post_meta( $post_id, 'event_end_date', $event_end_date );
|
||||
update_post_meta( $post_id, 'event_end_time', $event_end_time );
|
||||
}
|
||||
update_option( 'mep_event_default_date_update_20', 'completed' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ( get_option( 'mep_attendee_event_date_update_20' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events_attendees',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$ea_event_date = get_post_meta($post_id, 'ea_event_date', true);
|
||||
if(empty($ea_event_date)){
|
||||
$event_id = get_post_meta($post_id, 'ea_event_id', true);
|
||||
$event_old_date = get_post_meta($event_id, 'event_start_date', true).' '.get_post_meta($event_id, 'event_start_time', true);
|
||||
update_post_meta( $post_id, 'ea_event_date', $event_old_date );
|
||||
}
|
||||
}
|
||||
update_option( 'mep_attendee_event_date_update_20', 'completed' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( get_option( 'mep_event_multidate_update_2' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
$more_date = get_post_meta($post_id, 'mep_event_more_date', true);
|
||||
if(is_array($more_date) && sizeof($more_date) > 0){
|
||||
$count = 0;
|
||||
foreach($more_date as $_multi_date){
|
||||
$start_date = date('Y-m-d',strtotime($_multi_date['event_more_date']));
|
||||
$start_time = date('H:i A',strtotime($_multi_date['event_more_date']));
|
||||
$multi_dates[$count]['event_more_start_date'] = stripslashes( strip_tags( $start_date ) );
|
||||
$multi_dates[$count]['event_more_start_time'] = stripslashes( strip_tags( $start_time ) );
|
||||
$multi_dates[$count]['event_more_end_date'] = stripslashes( strip_tags( '' ) );
|
||||
$multi_dates[$count]['event_more_end_time'] = stripslashes( strip_tags( '' ) );
|
||||
$count++;
|
||||
}
|
||||
update_post_meta( $post_id, 'mep_event_more_date', $multi_dates );
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'mep_event_multidate_update_2', 'completed' );
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( get_option( 'mep_event_magor_update_3' ) != 'completed' ) {
|
||||
|
||||
global $wpdb;
|
||||
$args = array(
|
||||
'limit' => -1,
|
||||
'return' => 'ids',
|
||||
);
|
||||
$query = new WC_Order_Query( $args );
|
||||
$orders = $query->get_orders();
|
||||
$c = 1;
|
||||
|
||||
foreach($orders as $order_id){
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_meta = get_post_meta($order_id);
|
||||
|
||||
foreach ( $order->get_items() as $item_id => $item_values ) {
|
||||
$item_id = $item_id;
|
||||
}
|
||||
|
||||
$event_info = maybe_unserialize(mep_event_get_order_meta($item_id,'_event_user_info'));
|
||||
|
||||
$event_id = mep_event_get_order_meta($item_id,'event_id') ? mep_event_get_order_meta($item_id,'event_id') : 0;
|
||||
|
||||
if(is_array($event_info) && sizeof($event_info) > 0 && $event_id > 0){
|
||||
|
||||
|
||||
foreach($event_info as $_event_info){
|
||||
|
||||
$user_name = isset($_event_info['user_name']) ? $_event_info['user_name'] : '';
|
||||
$user_email = isset($_event_info['user_email']) ? $_event_info['user_email'] : '';
|
||||
$user_phone = isset($_event_info['user_phone']) ? $_event_info['user_phone'] : '';
|
||||
$user_address = isset($_event_info['user_address']) ? $_event_info['user_address'] : '';
|
||||
$user_gender = isset($_event_info['user_gender']) ? $_event_info['user_gender'] : '';
|
||||
$user_tshirtsize = isset($_event_info['user_tshirtsize']) ? $_event_info['user_tshirtsize'] : '';
|
||||
$user_company = isset($_event_info['user_company']) ? $_event_info['user_company'] : '';
|
||||
|
||||
$user_designation = isset($_event_info['user_designation']) ? $_event_info['user_designation'] : '';
|
||||
|
||||
$user_website = isset($_event_info['user_website']) ? $_event_info['user_website'] : '';
|
||||
$user_vegetarian = isset($_event_info['user_vegetarian']) ? $_event_info['user_vegetarian'] : '';
|
||||
$user_ticket_type = isset($_event_info['user_ticket_type']) ? $_event_info['user_ticket_type'] : '';
|
||||
|
||||
|
||||
$check = mep_check_attendee_exists($event_id,$order_id,$user_name,$user_email,$user_phone,$user_address,$user_gender,$user_company,$user_designation,$user_website,$user_vegetarian,$user_tshirtsize,$user_ticket_type);
|
||||
|
||||
if($check == 0){
|
||||
|
||||
$first_name = isset($order_meta['_billing_first_name'][0]) ? $order_meta['_billing_first_name'][0] : '';
|
||||
$last_name = isset($order_meta['_billing_last_name'][0]) ? $order_meta['_billing_last_name'][0] : '';
|
||||
$uname = $first_name.' '.$last_name;
|
||||
$payment_method = isset($order_meta['_payment_method_title'][0]) ? $order_meta['_payment_method_title'][0] : array();
|
||||
$user_id = isset($order_meta['_customer_user'][0]) ? $order_meta['_customer_user'][0] : array();
|
||||
$event_name = get_the_title($event_id);
|
||||
$order_status = $order->get_status();
|
||||
|
||||
$new_post = array(
|
||||
'post_title' => $uname,
|
||||
'post_content' => '',
|
||||
'post_category' => array(), // Usable for custom taxonomies too
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
|
||||
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
|
||||
);
|
||||
|
||||
//SAVE THE POST
|
||||
$pid = wp_insert_post($new_post);
|
||||
$pin = $user_id.$order_id.$event_id.$pid;
|
||||
update_post_meta( $pid, 'ea_name', $user_name);
|
||||
update_post_meta( $pid, 'ea_address_1', $user_address);
|
||||
update_post_meta( $pid, 'ea_email', $user_email);
|
||||
update_post_meta( $pid, 'ea_phone', $user_phone);
|
||||
update_post_meta( $pid, 'ea_gender', $user_gender);
|
||||
update_post_meta( $pid, 'ea_company', $user_company);
|
||||
update_post_meta( $pid, 'ea_desg', $user_designation);
|
||||
update_post_meta( $pid, 'ea_website', $user_website);
|
||||
update_post_meta( $pid, 'ea_vegetarian', $user_vegetarian);
|
||||
update_post_meta( $pid, 'ea_tshirtsize', $user_tshirtsize);
|
||||
update_post_meta( $pid, 'ea_ticket_type', $user_ticket_type);
|
||||
update_post_meta( $pid, 'ea_payment_method', $payment_method);
|
||||
update_post_meta( $pid, 'ea_event_name', $event_name);
|
||||
update_post_meta( $pid, 'ea_event_id', $event_id);
|
||||
update_post_meta( $pid, 'ea_order_id', $order_id);
|
||||
update_post_meta( $pid, 'ea_user_id', $user_id);
|
||||
update_post_meta( $pid, 'ea_ticket_no', $pin);
|
||||
update_post_meta( $pid, 'ea_order_status', $order_status);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
update_option('mep_hidden_product_thumbnail_update_02', 'completed');
|
||||
}
|
||||
|
||||
}
|
||||
update_option( 'mep_event_magor_update_3', 'completed' );
|
||||
}
|
||||
|
||||
|
||||
if (get_option('mep_event_default_date_update_2020') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$mep_start_date = get_post_meta($post_id, 'event_start_date', true);
|
||||
$mep_start_time = get_post_meta($post_id, 'event_start_time', true);
|
||||
$mep_end_date = get_post_meta($post_id, 'event_end_date', true);
|
||||
$mep_end_time = get_post_meta($post_id, 'event_end_time', true);
|
||||
|
||||
$event_start_datetime = date('Y-m-d H:i:s', strtotime($mep_start_date . ' ' . $mep_start_time));
|
||||
$event_end_datetime = date('Y-m-d H:i:s', strtotime($mep_end_date . ' ' . $mep_end_time));
|
||||
|
||||
update_post_meta($post_id, 'event_start_datetime', $event_start_datetime);
|
||||
update_post_meta($post_id, 'event_end_datetime', $event_end_datetime);
|
||||
}
|
||||
update_option('mep_event_default_date_update_2020', 'completed');
|
||||
//die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Expire Date Upgrade
|
||||
*/
|
||||
if (get_option('mep_event_expire_date_upgration') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$event_more_dates = get_post_meta($post_id, 'mep_event_more_date', true) ? get_post_meta($post_id, 'mep_event_more_date', true) : array();
|
||||
$md = sizeof($event_more_dates) > 0 ? end($event_more_dates) : array();
|
||||
$event_expire_datetime = sizeof($md) > 0 ? date('Y-m-d H:i:s', strtotime($md['event_more_end_date'] . ' ' . $md['event_more_end_time'])) : date('Y-m-d H:i:s', strtotime(get_post_meta($post_id, 'event_end_datetime', true)));
|
||||
update_post_meta($post_id, 'event_expire_datetime', $event_expire_datetime);
|
||||
}
|
||||
update_option('mep_event_expire_date_upgration', 'completed');
|
||||
// die();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (get_option('mep_event_default_date_update_20') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$mep_start_date = get_post_meta($post_id, 'mep_event_start_date', true);
|
||||
$mep_end_date = get_post_meta($post_id, 'mep_event_end_date', true);
|
||||
|
||||
$event_start_date = date('Y-m-d', strtotime($mep_start_date));
|
||||
$event_start_time = date('H:i', strtotime($mep_start_date));
|
||||
$event_end_date = date('Y-m-d', strtotime($mep_end_date));
|
||||
$event_end_time = date('H:i', strtotime($mep_end_date));
|
||||
|
||||
update_post_meta($post_id, 'event_start_date', $event_start_date);
|
||||
update_post_meta($post_id, 'event_start_time', $event_start_time);
|
||||
update_post_meta($post_id, 'event_end_date', $event_end_date);
|
||||
update_post_meta($post_id, 'event_end_time', $event_end_time);
|
||||
}
|
||||
update_option('mep_event_default_date_update_20', 'completed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (get_option('mep_attendee_event_date_update_20') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events_attendees',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$ea_event_date = get_post_meta($post_id, 'ea_event_date', true);
|
||||
if (empty($ea_event_date)) {
|
||||
$event_id = get_post_meta($post_id, 'ea_event_id', true);
|
||||
$event_old_date = get_post_meta($event_id, 'event_start_date', true) . ' ' . get_post_meta($event_id, 'event_start_time', true);
|
||||
update_post_meta($post_id, 'ea_event_date', $event_old_date);
|
||||
}
|
||||
}
|
||||
update_option('mep_attendee_event_date_update_20', 'completed');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (get_option('mep_event_multidate_update_2') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
$more_date = get_post_meta($post_id, 'mep_event_more_date', true);
|
||||
if (is_array($more_date) && sizeof($more_date) > 0) {
|
||||
$count = 0;
|
||||
foreach ($more_date as $_multi_date) {
|
||||
$start_date = date('Y-m-d', strtotime($_multi_date['event_more_date']));
|
||||
$start_time = date('H:i A', strtotime($_multi_date['event_more_date']));
|
||||
$multi_dates[$count]['event_more_start_date'] = stripslashes(strip_tags($start_date));
|
||||
$multi_dates[$count]['event_more_start_time'] = stripslashes(strip_tags($start_time));
|
||||
$multi_dates[$count]['event_more_end_date'] = stripslashes(strip_tags(''));
|
||||
$multi_dates[$count]['event_more_end_time'] = stripslashes(strip_tags(''));
|
||||
$count++;
|
||||
}
|
||||
update_post_meta($post_id, 'mep_event_more_date', $multi_dates);
|
||||
}
|
||||
}
|
||||
|
||||
update_option('mep_event_multidate_update_2', 'completed');
|
||||
}
|
||||
|
||||
|
||||
if (get_option('mep_event_magor_update_3') != 'completed') {
|
||||
|
||||
global $wpdb;
|
||||
$args = array(
|
||||
'limit' => -1,
|
||||
'return' => 'ids',
|
||||
);
|
||||
$query = new WC_Order_Query($args);
|
||||
$orders = $query->get_orders();
|
||||
$c = 1;
|
||||
|
||||
foreach ($orders as $order_id) {
|
||||
$order = wc_get_order($order_id);
|
||||
$order_meta = get_post_meta($order_id);
|
||||
|
||||
foreach ($order->get_items() as $item_id => $item_values) {
|
||||
$item_id = $item_id;
|
||||
}
|
||||
|
||||
$event_info = maybe_unserialize(mep_event_get_order_meta($item_id, '_event_user_info'));
|
||||
|
||||
$event_id = mep_event_get_order_meta($item_id, 'event_id') ? mep_event_get_order_meta($item_id, 'event_id') : 0;
|
||||
|
||||
if (is_array($event_info) && sizeof($event_info) > 0 && $event_id > 0) {
|
||||
|
||||
|
||||
foreach ($event_info as $_event_info) {
|
||||
|
||||
$user_name = isset($_event_info['user_name']) ? $_event_info['user_name'] : '';
|
||||
$user_email = isset($_event_info['user_email']) ? $_event_info['user_email'] : '';
|
||||
$user_phone = isset($_event_info['user_phone']) ? $_event_info['user_phone'] : '';
|
||||
$user_address = isset($_event_info['user_address']) ? $_event_info['user_address'] : '';
|
||||
$user_gender = isset($_event_info['user_gender']) ? $_event_info['user_gender'] : '';
|
||||
$user_tshirtsize = isset($_event_info['user_tshirtsize']) ? $_event_info['user_tshirtsize'] : '';
|
||||
$user_company = isset($_event_info['user_company']) ? $_event_info['user_company'] : '';
|
||||
|
||||
$user_designation = isset($_event_info['user_designation']) ? $_event_info['user_designation'] : '';
|
||||
|
||||
$user_website = isset($_event_info['user_website']) ? $_event_info['user_website'] : '';
|
||||
$user_vegetarian = isset($_event_info['user_vegetarian']) ? $_event_info['user_vegetarian'] : '';
|
||||
$user_ticket_type = isset($_event_info['user_ticket_type']) ? $_event_info['user_ticket_type'] : '';
|
||||
|
||||
|
||||
$check = mep_check_attendee_exists($event_id, $order_id, $user_name, $user_email, $user_phone, $user_address, $user_gender, $user_company, $user_designation, $user_website, $user_vegetarian, $user_tshirtsize, $user_ticket_type);
|
||||
|
||||
if ($check == 0) {
|
||||
|
||||
$first_name = isset($order_meta['_billing_first_name'][0]) ? $order_meta['_billing_first_name'][0] : '';
|
||||
$last_name = isset($order_meta['_billing_last_name'][0]) ? $order_meta['_billing_last_name'][0] : '';
|
||||
$uname = $first_name . ' ' . $last_name;
|
||||
$payment_method = isset($order_meta['_payment_method_title'][0]) ? $order_meta['_payment_method_title'][0] : array();
|
||||
$user_id = isset($order_meta['_customer_user'][0]) ? $order_meta['_customer_user'][0] : array();
|
||||
$event_name = get_the_title($event_id);
|
||||
$order_status = $order->get_status();
|
||||
|
||||
$new_post = array(
|
||||
'post_title' => $uname,
|
||||
'post_content' => '',
|
||||
'post_category' => array(), // Usable for custom taxonomies too
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish', // Choose: publish, preview, future, draft, etc.
|
||||
'post_type' => 'mep_events_attendees' //'post',page' or use a custom post type if you want to
|
||||
);
|
||||
|
||||
//SAVE THE POST
|
||||
$pid = wp_insert_post($new_post);
|
||||
$pin = $user_id . $order_id . $event_id . $pid;
|
||||
update_post_meta($pid, 'ea_name', $user_name);
|
||||
update_post_meta($pid, 'ea_address_1', $user_address);
|
||||
update_post_meta($pid, 'ea_email', $user_email);
|
||||
update_post_meta($pid, 'ea_phone', $user_phone);
|
||||
update_post_meta($pid, 'ea_gender', $user_gender);
|
||||
update_post_meta($pid, 'ea_company', $user_company);
|
||||
update_post_meta($pid, 'ea_desg', $user_designation);
|
||||
update_post_meta($pid, 'ea_website', $user_website);
|
||||
update_post_meta($pid, 'ea_vegetarian', $user_vegetarian);
|
||||
update_post_meta($pid, 'ea_tshirtsize', $user_tshirtsize);
|
||||
update_post_meta($pid, 'ea_ticket_type', $user_ticket_type);
|
||||
update_post_meta($pid, 'ea_payment_method', $payment_method);
|
||||
update_post_meta($pid, 'ea_event_name', $event_name);
|
||||
update_post_meta($pid, 'ea_event_id', $event_id);
|
||||
update_post_meta($pid, 'ea_order_id', $order_id);
|
||||
update_post_meta($pid, 'ea_user_id', $user_id);
|
||||
update_post_meta($pid, 'ea_ticket_no', $pin);
|
||||
update_post_meta($pid, 'ea_order_status', $order_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
update_option('mep_event_magor_update_3', 'completed');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Function for create hidden product for bus
|
||||
function mep_create_hidden_event_product($post_id,$title){
|
||||
function mep_create_hidden_event_product($post_id, $title)
|
||||
{
|
||||
$new_post = array(
|
||||
'post_title' => $title,
|
||||
'post_content' => '',
|
||||
'post_name' => uniqid(),
|
||||
'post_category' => array(),
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'product'
|
||||
);
|
||||
'post_title' => $title,
|
||||
'post_content' => '',
|
||||
'post_name' => uniqid(),
|
||||
'post_category' => array(),
|
||||
'tags_input' => array(),
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'product'
|
||||
);
|
||||
|
||||
|
||||
$pid = wp_insert_post($new_post);
|
||||
|
||||
update_post_meta( $post_id, 'link_wc_product', $pid );
|
||||
update_post_meta( $pid, 'link_mep_event', $post_id );
|
||||
update_post_meta( $pid, '_price', 0.01 );
|
||||
|
||||
update_post_meta( $pid, '_sold_individually', 'yes' );
|
||||
update_post_meta( $pid, '_virtual', 'yes' );
|
||||
$terms = array( 'exclude-from-catalog', 'exclude-from-search' );
|
||||
wp_set_object_terms( $pid, $terms, 'product_visibility' );
|
||||
update_post_meta( $post_id, 'check_if_run_once', true );
|
||||
$pid = wp_insert_post($new_post);
|
||||
|
||||
update_post_meta($post_id, 'link_wc_product', $pid);
|
||||
update_post_meta($pid, 'link_mep_event', $post_id);
|
||||
update_post_meta($pid, '_price', 0.01);
|
||||
|
||||
update_post_meta($pid, '_sold_individually', 'yes');
|
||||
update_post_meta($pid, '_virtual', 'yes');
|
||||
$terms = array('exclude-from-catalog', 'exclude-from-search');
|
||||
wp_set_object_terms($pid, $terms, 'product_visibility');
|
||||
update_post_meta($post_id, 'check_if_run_once', true);
|
||||
}
|
||||
|
||||
add_action('admin_init','mep_create_old_event_product',10);
|
||||
function mep_create_old_event_product(){
|
||||
|
||||
if ( get_option( 'wbtm_create_old_bus_products_101' ) != 'completed' ) {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach($qr->posts as $result){
|
||||
$post_id = $result->ID;
|
||||
mep_create_hidden_event_product($post_id,get_the_title($post_id));
|
||||
}
|
||||
|
||||
update_option( 'wbtm_create_old_bus_products_101', 'completed' );
|
||||
add_action('admin_init', 'mep_create_old_event_product', 10);
|
||||
function mep_create_old_event_product()
|
||||
{
|
||||
|
||||
if (get_option('wbtm_create_old_bus_products_101') != 'completed') {
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'mep_events',
|
||||
'posts_per_page' => -1
|
||||
);
|
||||
|
||||
$qr = new WP_Query($args);
|
||||
foreach ($qr->posts as $result) {
|
||||
$post_id = $result->ID;
|
||||
mep_create_hidden_event_product($post_id, get_the_title($post_id));
|
||||
}
|
||||
|
||||
update_option('wbtm_create_old_bus_products_101', 'completed');
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
add_action('mep_event_add_calender','mep_ev_calender');
|
||||
|
||||
function mep_ev_calender(){
|
||||
function mep_ev_calender($event_id){
|
||||
?>
|
||||
<div class="calender-url">
|
||||
<?php
|
||||
|
@ -9,7 +9,7 @@ function mep_ev_calender(){
|
|||
* Action Hook mep_before_add_calendar_button & mep_after_add_calendar_button
|
||||
*/
|
||||
do_action('mep_before_add_calendar_button');
|
||||
mep_add_to_google_calender_link(get_the_id());
|
||||
mep_add_to_google_calender_link($event_id);
|
||||
do_action('mep_after_add_calendar_button');
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -2,9 +2,150 @@
|
|||
add_action('mep_add_to_cart','mep_get_event_reg_btn');
|
||||
|
||||
// Get Event Registration Button
|
||||
function mep_get_event_reg_btn(){
|
||||
function mep_get_event_reg_btn($event_id=''){
|
||||
global $post,$event_meta;
|
||||
$total_book = 0;
|
||||
$post_id = $event_id ? $event_id : get_the_id();
|
||||
$event_meta = get_post_custom($post_id);
|
||||
$event_expire_on_old = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old;
|
||||
$event_expire_date = $event_meta[$event_expire_on][0];
|
||||
$event_sqi = $event_meta['mep_sqi'][0];
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
$simple_rsv = array_key_exists('mep_rsv_seat', $event_meta) ? $event_meta['mep_rsv_seat'][0] : 0;
|
||||
$total_book = ($total_book + $simple_rsv);
|
||||
$seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book);
|
||||
$time = strtotime($event_expire_date);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
$datetime1 = new DateTime();
|
||||
$datetime2 = new DateTime($newformat);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array();
|
||||
$total_seat = mep_event_total_seat($post_id,'total');
|
||||
$total_resv = mep_event_total_seat($post_id,'resv');
|
||||
$total_sold = mep_ticket_sold($post_id);
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
$reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : '';
|
||||
$seat_left = apply_filters( 'mep_event_total_seat_count', $total_left, $post_id );
|
||||
$current = current_time('Y-m-d H:i:s');
|
||||
$time = strtotime($event_expire_date);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
if($recurring == 'yes'){
|
||||
$event_more_dates = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array();
|
||||
$md = end($event_more_dates);
|
||||
$more_date = $md['event_more_start_date'].' '.$md['event_more_start_time'];
|
||||
$newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s',strtotime($more_date));
|
||||
}
|
||||
|
||||
// $default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
|
||||
// date_default_timezone_set($default_timezone_val);
|
||||
|
||||
$datetime1 = new DateTime($newformat);
|
||||
$datetime2 = new DateTime($current);
|
||||
$interval = date_diff($datetime2, $datetime1);
|
||||
$mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on';
|
||||
|
||||
$leftt = apply_filters( 'mep_event_total_seat_count', $total_left, $post_id );
|
||||
$days = $interval->d;
|
||||
$hours = $interval->h;
|
||||
$minutes = $interval->i;
|
||||
$dd = $days > 0 ? $days." days " : '';
|
||||
$hh = $hours>0 ? $hours." hours " : '';
|
||||
$mm = $minutes>0 ? $minutes." minutes " : '';
|
||||
$qty_typec = $event_meta['qty_box_type'][0];
|
||||
$cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id);
|
||||
|
||||
|
||||
/**
|
||||
* First Checking If the registration status enable or disable
|
||||
*/
|
||||
if($reg_status!='off'){
|
||||
/**
|
||||
* Then Checking If the event date already gone or not
|
||||
*/
|
||||
if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){
|
||||
/**
|
||||
* If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file
|
||||
*/
|
||||
do_action('mep_event_expire_text');
|
||||
|
||||
/**
|
||||
* If the event is not expired then Its checking the available seat status
|
||||
*/
|
||||
}elseif($seat_left<=0){
|
||||
/**
|
||||
* If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file
|
||||
*/
|
||||
do_action('mep_event_no_seat_text');
|
||||
do_action('mep_after_no_seat_notice');
|
||||
}else{
|
||||
/**
|
||||
* If everything is fine then its go on ....
|
||||
*/
|
||||
?>
|
||||
<!-- Register Now Title -->
|
||||
<h4 class="mep-cart-table-title">
|
||||
<?php echo mep_get_option('mep_register_now_text', 'label_setting_sec') ? mep_get_option('mep_register_now_text', 'label_setting_sec') : _e('Register Now:','mage-eventpress'); ?>
|
||||
</h4>
|
||||
<!--The event add to cart main form start here-->
|
||||
<form action="" method='post' id="mage_event_submit">
|
||||
<?php
|
||||
/**
|
||||
* Here is a magic hook which fire just before of the Add to Cart Button, And the Ticket type & Extra service list are hooked up into this, You can find them into inc/template-parts/event_ticket_type_extra_service.php
|
||||
*/
|
||||
do_action('mep_event_ticket_type_extra_service',$post_id);
|
||||
?>
|
||||
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
|
||||
|
||||
<!--The Add to cart button table start Here-->
|
||||
<table class='table table-bordered mep_event_add_cart_table'>
|
||||
<tr>
|
||||
<td align="left" class='total-col'><?php echo mep_get_option('mep_quantity_text', 'label_setting_sec') ? mep_get_option('mep_quantity_text', 'label_setting_sec') : _e('Quantity:','mage-eventpress');
|
||||
if($mep_event_ticket_type){ ?>
|
||||
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
|
||||
<span id="ttyttl"></span>
|
||||
<?php } ?>
|
||||
<span class='the-total'> <?php echo mep_get_option('mep_total_text', 'label_setting_sec') ? mep_get_option('mep_total_text', 'label_setting_sec') : _e('Total','mage-eventpress'); ?>
|
||||
<span id="usertotal"></span>
|
||||
</span>
|
||||
</td>
|
||||
<td align="right">
|
||||
<input type="hidden" name="mep_event_location_cart" value="<?php trim(mep_ev_location_ticket($post_id,$event_meta)); ?>">
|
||||
<input type="hidden" name="mep_event_date_cart" value="<?php do_action('mep_event_date'); ?>">
|
||||
<button type="submit" name="add-to-cart" value="<?php echo $cart_product_id; ?>" class="single_add_to_cart_button button alt btn-mep-event-cart"><?php _e(mep_get_label($post_id,'mep_cart_btn_text','Register This Event'),'mage-eventpress'); ?> </button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--The Add to cart button table start Here-->
|
||||
</form>
|
||||
<!--The event add to cart main form end here-->
|
||||
<?php
|
||||
}
|
||||
} // End Of checking Registration status
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_action('mep_add_to_cart_list','mep_get_event_reg_btn_list');
|
||||
|
||||
|
||||
// Get Event Registration Button
|
||||
function mep_get_event_reg_btn_list(){
|
||||
global $post,$event_meta;
|
||||
$total_book = 0;
|
||||
$post_id = $post->ID;
|
||||
$event_meta = get_post_custom($post_id);
|
||||
$event_expire_on_old = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
|
@ -67,147 +208,6 @@ function mep_get_event_reg_btn(){
|
|||
$cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id);
|
||||
|
||||
|
||||
/**
|
||||
* First Checking If the registration status enable or disable
|
||||
*/
|
||||
if($reg_status!='off'){
|
||||
/**
|
||||
* Then Checking If the event date already gone or not
|
||||
*/
|
||||
if(strtotime(current_time('Y-m-d H:i:s')) > strtotime($newformat)){
|
||||
/**
|
||||
* If The event expired then it fire below Hook, The event expire texts arein the inc/template-parts/event_labels.php file
|
||||
*/
|
||||
do_action('mep_event_expire_text');
|
||||
|
||||
/**
|
||||
* If the event is not expired then Its checking the available seat status
|
||||
*/
|
||||
}elseif($seat_left<=0){
|
||||
/**
|
||||
* If All the seats are booked then it fire the below hooks, The event no seat texts are in the inc/template-parts/event_labels.php file
|
||||
*/
|
||||
do_action('mep_event_no_seat_text');
|
||||
do_action('mep_after_no_seat_notice');
|
||||
}else{
|
||||
/**
|
||||
* If everything is fine then its go on ....
|
||||
*/
|
||||
?>
|
||||
<!-- Register Now Title -->
|
||||
<h4 class="mep-cart-table-title">
|
||||
<?php echo mep_get_option('mep_register_now_text', 'label_setting_sec') ? mep_get_option('mep_register_now_text', 'label_setting_sec') : _e('Register Now:','mage-eventpress'); ?>
|
||||
</h4>
|
||||
<!--The event add to cart main form start here-->
|
||||
<form action="" method='post' id="mage_event_submit">
|
||||
<?php
|
||||
/**
|
||||
* Here is a magic hook which fire just before of the Add to Cart Button, And the Ticket type & Extra service list are hooked up into this, You can find them into inc/template-parts/event_ticket_type_extra_service.php
|
||||
*/
|
||||
do_action('mep_event_ticket_type_extra_service');
|
||||
?>
|
||||
<input type='hidden' id='rowtotal' value="<?php echo get_post_meta($post_id,"_price",true); ?>"/>
|
||||
|
||||
<!--The Add to cart button table start Here-->
|
||||
<table class='table table-bordered mep_event_add_cart_table'>
|
||||
<tr>
|
||||
<td align="left" class='total-col'><?php echo mep_get_option('mep_quantity_text', 'label_setting_sec') ? mep_get_option('mep_quantity_text', 'label_setting_sec') : _e('Quantity:','mage-eventpress');
|
||||
if($mep_event_ticket_type){ ?>
|
||||
<input id="quantity_5a7abbd1bff73" class="input-text qty text extra-qty-box" step="1" min="1" max="<?php echo $leftt; ?>" name="quantity" value="1" title="Qty" size="4" pattern="[0-9]*" inputmode="numeric" type="hidden">
|
||||
<span id="ttyttl"></span>
|
||||
<?php } ?>
|
||||
<span class='the-total'> <?php echo mep_get_option('mep_total_text', 'label_setting_sec') ? mep_get_option('mep_total_text', 'label_setting_sec') : _e('Total','mage-eventpress'); ?>
|
||||
<span id="usertotal"></span>
|
||||
</span>
|
||||
</td>
|
||||
<td align="right">
|
||||
<input type="hidden" name="mep_event_location_cart" value="<?php trim(mep_ev_location_ticket($post_id,$event_meta)); ?>">
|
||||
<input type="hidden" name="mep_event_date_cart" value="<?php do_action('mep_event_date'); ?>">
|
||||
<button type="submit" name="add-to-cart" value="<?php echo $cart_product_id; ?>" class="single_add_to_cart_button button alt btn-mep-event-cart"><?php _e(mep_get_label($post_id,'mep_cart_btn_text','Register This Event'),'mage-eventpress'); ?> </button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--The Add to cart button table start Here-->
|
||||
</form>
|
||||
<!--The event add to cart main form end here-->
|
||||
<?php
|
||||
}
|
||||
} // End Of checking Registration status
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
add_action('mep_add_to_cart_list','mep_get_event_reg_btn_list');
|
||||
|
||||
|
||||
// Get Event Registration Button
|
||||
function mep_get_event_reg_btn_list(){
|
||||
global $post,$event_meta;
|
||||
$total_book = 0;
|
||||
$post_id = $post->ID;
|
||||
$event_meta = get_post_custom($post_id);
|
||||
$event_expire_on_old = mep_get_option( 'mep_event_expire_on_datetimes', 'general_setting_sec', 'event_start_datetime');
|
||||
$event_expire_on = $event_expire_on_old == 'event_end_datetime' ? 'event_expire_datetime' : $event_expire_on_old;
|
||||
$event_expire_date = $event_meta[$event_expire_on][0];
|
||||
$event_sqi = $event_meta['mep_sqi'][0];
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
$simple_rsv = array_key_exists('mep_rsv_seat', $event_meta) ? $event_meta['mep_rsv_seat'][0] : 0;
|
||||
$total_book = ($total_book + $simple_rsv);
|
||||
$seat_left = ((int)$event_meta['mep_total_seat'][0]- (int)$total_book);
|
||||
$time = strtotime($event_expire_date);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
$datetime1 = new DateTime();
|
||||
$datetime2 = new DateTime($newformat);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array();
|
||||
$total_seat = mep_event_total_seat(get_the_id(),'total');
|
||||
$total_resv = mep_event_total_seat(get_the_id(),'resv');
|
||||
$total_sold = mep_ticket_sold(get_the_id());
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
$reg_status = array_key_exists('mep_reg_status', $event_meta) ? $event_meta['mep_reg_status'][0] : '';
|
||||
$seat_left = apply_filters( 'mep_event_total_seat_count', $total_left, get_the_id() );
|
||||
$current = current_time('Y-m-d H:i:s');
|
||||
$time = strtotime($event_expire_date);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
$recurring = get_post_meta($post_id, 'mep_enable_recurring', true) ? get_post_meta($post_id, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
if($recurring == 'yes'){
|
||||
$event_more_dates = get_post_meta($post_id,'mep_event_more_date',true) ? get_post_meta($post_id,'mep_event_more_date',true) : array();
|
||||
$md = end($event_more_dates);
|
||||
$more_date = $md['event_more_start_date'].' '.$md['event_more_start_time'];
|
||||
$newformat = empty($event_more_dates) ? $newformat : date('Y-m-d H:i:s',strtotime($more_date));
|
||||
}
|
||||
|
||||
$default_timezone_val = get_option('timezone_string') ? get_option('timezone_string') : 'UTC';
|
||||
date_default_timezone_set($default_timezone_val);
|
||||
|
||||
$datetime1 = new DateTime($newformat);
|
||||
$datetime2 = new DateTime($current);
|
||||
$interval = date_diff($datetime2, $datetime1);
|
||||
$mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on';
|
||||
|
||||
$leftt = apply_filters( 'mep_event_total_seat_count', $total_left, get_the_id() );
|
||||
$days = $interval->d;
|
||||
$hours = $interval->h;
|
||||
$minutes = $interval->i;
|
||||
$dd = $days > 0 ? $days." days " : '';
|
||||
$hh = $hours>0 ? $hours." hours " : '';
|
||||
$mm = $minutes>0 ? $minutes." minutes " : '';
|
||||
$qty_typec = $event_meta['qty_box_type'][0];
|
||||
$cart_product_id = get_post_meta($post_id,'link_wc_product',true) ? esc_attr(get_post_meta($post_id,'link_wc_product',true)) : esc_attr($post_id);
|
||||
|
||||
|
||||
/**
|
||||
* First Checking If the registration status enable or disable
|
||||
*/
|
||||
|
|
|
@ -72,23 +72,22 @@ function mep_ev_datetime(){
|
|||
|
||||
|
||||
add_action('mep_event_date_default_theme', 'mep_date_in_default_theme');
|
||||
function mep_date_in_default_theme(){
|
||||
global $event_meta;
|
||||
|
||||
function mep_date_in_default_theme($event_id){
|
||||
$event_meta = get_post_custom($event_id);
|
||||
$start_datetime = $event_meta['event_start_datetime'][0];
|
||||
$start_date = $event_meta['event_start_date'][0];
|
||||
$start_time = $event_meta['event_start_time'][0];
|
||||
$end_datetime = $event_meta['event_end_datetime'][0];
|
||||
$end_date = $event_meta['event_end_date'][0];
|
||||
$end_time = $event_meta['event_end_time'][0];
|
||||
$recurring = get_post_meta(get_the_id(), 'mep_enable_recurring', true) ? get_post_meta(get_the_id(), 'mep_enable_recurring', true) : 'no';
|
||||
$mep_show_upcoming_event = get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) ? get_post_meta(get_the_id(), 'mep_show_upcoming_event', true) : 'no';
|
||||
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
|
||||
$mep_show_upcoming_event = get_post_meta($event_id, 'mep_show_upcoming_event', true) ? get_post_meta($event_id, 'mep_show_upcoming_event', true) : 'no';
|
||||
$cn = 1;
|
||||
$more_date = array_key_exists('mep_event_more_date', $event_meta) ? unserialize($event_meta['mep_event_more_date'][0]) : array();
|
||||
?>
|
||||
<h3><i class="fa fa-calendar"></i> <?php _e('Event Schedule Details', 'mage-eventpress'); ?></h3>
|
||||
<?php
|
||||
echo '<ul>';
|
||||
if(sizeof($more_date) > 2){ echo '<ul id="mep_event_date_sch">'; }else{ echo '<ul>'; }
|
||||
|
||||
if ($recurring == 'yes') {
|
||||
if (strtotime(current_time('Y-m-d H:i')) < strtotime($start_datetime)) {
|
||||
|
@ -148,6 +147,12 @@ function mep_date_in_default_theme(){
|
|||
}
|
||||
}
|
||||
echo '</ul>';
|
||||
if(sizeof($more_date) > 2){
|
||||
?>
|
||||
<p id="mep_single_view_all_date" class="mep-tem3-title-sec mep_single_date_btn"><?php _e('View All Date','mage-eventpress'); ?></p>
|
||||
<p id="mep_single_hide_all_date" class="mep-tem3-title-sec mep_single_date_btn"><?php _e('Hide All Date','mage-eventpress'); ?></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
add_action('mep_event_extra_service', 'mep_ev_extra_serv');
|
||||
function mep_ev_extra_serv(){
|
||||
function mep_ev_extra_serv($post_id){
|
||||
global $post, $product;
|
||||
$pid = $post->ID;
|
||||
$post_id = $post_id;
|
||||
$count = 1;
|
||||
$mep_events_extra_prices = get_post_meta($post->ID, 'mep_events_extra_prices', true) ? get_post_meta($post->ID, 'mep_events_extra_prices', true) : array();
|
||||
$mep_events_extra_prices = get_post_meta($post_id, 'mep_events_extra_prices', true) ? get_post_meta($post_id, 'mep_events_extra_prices', true) : array();
|
||||
ob_start();
|
||||
if (sizeof($mep_events_extra_prices) > 0) {
|
||||
echo "<h3 class='ex-sec-title'>" . mep_get_label($pid, 'mep_event_extra_service_text', 'Extra Service:') . "</h3>";
|
||||
echo "<h3 class='ex-sec-title'>" . mep_get_label($post_id, 'mep_event_extra_service_text', 'Extra Service:') . "</h3>";
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -18,10 +18,10 @@ function mep_ev_extra_serv(){
|
|||
</tr>
|
||||
<?php
|
||||
foreach ($mep_events_extra_prices as $field) {
|
||||
$event_date = get_post_meta($post->ID, 'event_start_date', true).' '.get_post_meta($post->ID, 'event_start_time', true);
|
||||
$event_date = get_post_meta($post_id, 'event_start_date', true).' '.get_post_meta($post_id, 'event_start_time', true);
|
||||
$total_extra_service = (int)$field['option_qty'];
|
||||
$qty_type = $field['option_qty_type'];
|
||||
$total_sold = (int) mep_extra_service_sold(get_the_id(),$field['option_name'],$event_date);
|
||||
$total_sold = (int) mep_extra_service_sold($post_id,$field['option_name'],$event_date);
|
||||
$ext_left = ($total_extra_service - $total_sold);
|
||||
?>
|
||||
<tr>
|
||||
|
@ -29,6 +29,7 @@ function mep_ev_extra_serv(){
|
|||
<div class="xtra-item-left"><?php echo $ext_left; ?>
|
||||
<?php echo mep_get_option('mep_left_text', 'label_setting_sec') ? mep_get_option('mep_left_text', 'label_setting_sec') : _e('Left:','mage-eventpress'); ?>
|
||||
</div>
|
||||
<input type="hidden" name='mep_event_start_date_es[]' value='<?php echo $event_date; ?>'>
|
||||
</td>
|
||||
<td class="mage_text_center">
|
||||
<?php
|
||||
|
@ -68,7 +69,6 @@ function mep_ev_extra_serv(){
|
|||
<?php
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
$event_meta = get_post_custom($pid);
|
||||
echo apply_filters('mage_event_extra_service_list', $content,$pid,$event_meta);
|
||||
|
||||
}
|
||||
$event_meta = get_post_custom($post_id);
|
||||
echo apply_filters('mage_event_extra_service_list', $content,$post_id,$event_meta);
|
||||
}
|
|
@ -20,7 +20,8 @@ function mep_display_event_loop_list($event_id,$columnNumber,$style){
|
|||
$hide_time_list = mep_get_option('mep_event_hide_time_list', 'general_setting_sec', 'no');
|
||||
$hide_only_end_time_list = mep_get_option('mep_event_hide_end_time_list', 'general_setting_sec', 'no');
|
||||
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
|
||||
|
||||
$event_type = get_post_meta(get_the_id(),'mep_event_type',true) ? get_post_meta(get_the_id(),'mep_event_type',true) : 'offline';
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
|
@ -37,6 +38,10 @@ ob_start();
|
|||
<div class='mep-multidate-ribbon mep-tem3-title-sec'>
|
||||
<span><?php _e('Multi Date Event','mage-eventpress'); ?></span>
|
||||
</div>
|
||||
<?php } if($event_type == 'online'){ ?>
|
||||
<div class='mep-eventtype-ribbon mep-tem3-title-sec'>
|
||||
<span><?php echo mep_get_option('mep_event_virtual_label', 'label_setting_sec') ? mep_get_option('mep_event_virtual_label', 'label_setting_sec') : _e('Virtual Event','mage-eventpress'); ?></span>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="mep_list_event_details">
|
||||
|
@ -74,6 +79,7 @@ ob_start();
|
|||
</div>
|
||||
</li>
|
||||
<?php }
|
||||
if($event_type != 'online'){
|
||||
if ($hide_location_list == 'no') { ?>
|
||||
|
||||
<li>
|
||||
|
@ -86,7 +92,7 @@ ob_start();
|
|||
<h6><?php mep_get_event_city($event_id); ?></h6>
|
||||
</div>
|
||||
</li>
|
||||
<?php }
|
||||
<?php } }
|
||||
if ($hide_time_list == 'no') { ?>
|
||||
<li>
|
||||
<div class="evl-ico"><i class="fa fa-calendar"></i></div>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This Function will hooked up with the speaker action hook mep_event_speakers_list to display the Event Speaker List
|
||||
*/
|
||||
|
||||
add_action('mep_event_speakers_list','mep_display_speaker_list');
|
||||
function mep_display_speaker_list($event_id){
|
||||
$speakers_id = get_post_meta($event_id,'mep_event_speakers_list',true) ? maybe_unserialize(get_post_meta($event_id,'mep_event_speakers_list',true)) : array();
|
||||
$speaker_icon = get_post_meta($event_id,'mep_event_speaker_icon',true) ? get_post_meta($event_id,'mep_event_speaker_icon',true) : 'fa fa-microphone';
|
||||
$speaker_label = get_post_meta($event_id,'mep_speaker_title',true) ? get_post_meta($event_id,'mep_speaker_title',true) : __("Speaker's","mage-eventpress");
|
||||
|
||||
if(is_array($speakers_id) && sizeof($speakers_id) > 0){
|
||||
?>
|
||||
<h3><?php ?><i class="<?php echo $speaker_icon; ?>"></i> <?php echo $speaker_label; ?></h3>
|
||||
<?php
|
||||
echo '<ul>';
|
||||
foreach($speakers_id as $speakers){
|
||||
?>
|
||||
<li>
|
||||
<a href='<?php echo get_the_permalink($speakers); ?>'><?php if(has_post_thumbnail($speakers)){ echo get_the_post_thumbnail($speakers,'medium'); }else{ echo '<img src="'.plugins_url( '../images/no-photo.jpg' , __DIR__ ).'"/>'; } ?>
|
||||
<h6><?php echo get_the_title($speakers); ?></h6></a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
}
|
|
@ -1,47 +1,36 @@
|
|||
<?php
|
||||
|
||||
add_action('mep_event_ticket_types','mep_ev_ticket_type');
|
||||
|
||||
function mep_ev_ticket_type(){
|
||||
function mep_ev_ticket_type($post_id){
|
||||
global $post, $product,$event_meta;
|
||||
$pid = $post->ID;
|
||||
$count=1;
|
||||
ob_start();
|
||||
|
||||
if(array_key_exists('mep_available_seat', $event_meta)){
|
||||
$mep_available_seat = $event_meta['mep_available_seat'][0];
|
||||
}else{
|
||||
$mep_available_seat = 'on';
|
||||
}
|
||||
|
||||
$mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true);
|
||||
$mep_available_seat = array_key_exists('mep_available_seat', $event_meta) ? $event_meta['mep_available_seat'][0] : 'on';
|
||||
$mep_event_ticket_type = get_post_meta($post_id, 'mep_event_ticket_type', true) ? get_post_meta($post_id, 'mep_event_ticket_type', true) : array();
|
||||
|
||||
if($mep_event_ticket_type){
|
||||
?>
|
||||
<?php echo "<h3 class='ex-sec-title'>".mep_get_label($pid,'mep_event_ticket_type_text','Ticket Type:
|
||||
')."</h3>"; ?>
|
||||
|
||||
<?php echo "<h3 class='ex-sec-title'>".mep_get_label($post_id,'mep_event_ticket_type_text','Ticket Type:')."</h3>"; ?>
|
||||
|
||||
<table>
|
||||
<?php
|
||||
$count =1;
|
||||
foreach ( $mep_event_ticket_type as $field ) {
|
||||
$qty_t_type = $field['option_qty_t_type'];
|
||||
$total_quantity = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
|
||||
$default_qty = isset($field['option_default_qty_t']) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0;
|
||||
$total_resv_quantity = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
|
||||
$event_date = get_post_meta($post->ID, 'event_start_date', true).' '.get_post_meta($post->ID, 'event_start_time', true);
|
||||
$total_sold = (int) mep_ticket_type_sold(get_the_id(),$field['option_name_t'],$event_date);
|
||||
$total_tickets = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity);
|
||||
$total_seats = apply_filters('mep_total_ticket_of_type',$total_tickets,get_the_id(),$field);
|
||||
$total_min_seat = apply_filters('mep_ticket_min_qty',0,get_the_id(),$field);
|
||||
$default_quantity = apply_filters('mep_ticket_default_qty',$default_qty,get_the_id(),$field);
|
||||
$total_left = apply_filters('mep_total_ticket_of_type',$total_tickets,get_the_id(),$field);
|
||||
// $total_left = $total_tickets;
|
||||
$passed = apply_filters('mep_ticket_type_validation',true);
|
||||
$qty_t_type = $field['option_qty_t_type'];
|
||||
$total_quantity = isset($field['option_qty_t']) ? $field['option_qty_t'] : 0;
|
||||
$default_qty = isset($field['option_default_qty_t']) && $field['option_default_qty_t'] > 0 ? $field['option_default_qty_t'] : 0;
|
||||
$total_resv_quantity = isset($field['option_rsv_t']) ? $field['option_rsv_t'] : 0;
|
||||
$event_date = get_post_meta($post_id, 'event_start_date', true).' '.get_post_meta($post_id, 'event_start_time', true);
|
||||
$total_sold = (int) mep_ticket_type_sold($post_id,$field['option_name_t'],$event_date);
|
||||
$total_tickets = (int) $total_quantity - ((int) $total_sold + (int) $total_resv_quantity);
|
||||
$total_seats = apply_filters('mep_total_ticket_of_type',$total_tickets,$post_id,$field);
|
||||
$total_min_seat = apply_filters('mep_ticket_min_qty',0,$post_id,$field);
|
||||
$default_quantity = apply_filters('mep_ticket_default_qty',$default_qty,$post_id,$field);
|
||||
$total_left = apply_filters('mep_total_ticket_of_type',$total_tickets,$post_id,$field);
|
||||
$passed = apply_filters('mep_ticket_type_validation',true);
|
||||
?>
|
||||
<tr>
|
||||
<td align="Left"><?php echo $field['option_name_t']; ?>
|
||||
<input type="hidden" name='mep_event_start_date[]' value="<?php echo get_post_meta($post->ID, 'event_start_datetime', true); ?>">
|
||||
<input type="hidden" name='mep_event_start_date[]' value="<?php echo get_post_meta($post_id, 'event_start_datetime', true); ?>">
|
||||
<?php if($mep_available_seat=='on'){ ?><div class="xtra-item-left"><?php echo max($total_left,0); ?>
|
||||
|
||||
<?php echo mep_get_option('mep_left_text', 'label_setting_sec') ? mep_get_option('mep_left_text', 'label_setting_sec') : _e('Left:','mage-eventpress'); ?>
|
||||
|
@ -49,10 +38,9 @@ function mep_ev_ticket_type(){
|
|||
</div> <?php } ?>
|
||||
</td>
|
||||
<td class="ticket-qty">
|
||||
<span class="tkt-qty">
|
||||
<?php echo mep_get_option('mep_ticket_qty_text', 'label_setting_sec') ? mep_get_option('mep_ticket_qty_text', 'label_setting_sec') : _e('Ticket Qty:','mage-eventpress'); ?>
|
||||
</span>
|
||||
|
||||
<span class="tkt-qty">
|
||||
<?php echo mep_get_option('mep_ticket_qty_text', 'label_setting_sec') ? mep_get_option('mep_ticket_qty_text', 'label_setting_sec') : _e('Ticket Qty:','mage-eventpress'); ?>
|
||||
</span>
|
||||
<?php
|
||||
if($total_left>0){
|
||||
if($qty_t_type=='dropdown'){ ?>
|
||||
|
@ -74,7 +62,7 @@ function mep_ev_ticket_type(){
|
|||
</div>
|
||||
<?php } }else{ _e('No Seat Available','mage-eventpress'); }
|
||||
$ticket_name = $field['option_name_t'];
|
||||
do_action('mep_after_ticket_type_qty',get_the_id(),$ticket_name,$field,$default_quantity);
|
||||
do_action('mep_after_ticket_type_qty',$post_id,$ticket_name,$field,$default_quantity);
|
||||
?>
|
||||
|
||||
|
||||
|
@ -103,7 +91,7 @@ function mep_ev_ticket_type(){
|
|||
}
|
||||
|
||||
$content = ob_get_clean();
|
||||
echo apply_filters('mage_event_ticket_type_list', $content,$pid,$event_meta);
|
||||
echo apply_filters('mage_event_ticket_type_list', $content,$post_id,$event_meta);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function ($) {
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
function mep_output_add_to_cart_custom_fields() {
|
||||
global $post,$event_meta,$total_book;
|
||||
<?php
|
||||
function mep_output_add_to_cart_custom_fields($post_id)
|
||||
{
|
||||
global $post, $event_meta, $total_book;
|
||||
|
||||
$total_seat = mep_event_total_seat(get_the_id(),'total');
|
||||
$total_resv = mep_event_total_seat(get_the_id(),'resv');
|
||||
$total_sold = mep_ticket_sold(get_the_id());
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
$total_left = apply_filters( 'mep_event_total_seat_count', $total_left, get_the_id() );
|
||||
if($total_left>0){
|
||||
do_action('mep_event_ticket_types');
|
||||
do_action('mep_event_extra_service');
|
||||
}else{
|
||||
?>
|
||||
<span class=event-expire-btn>
|
||||
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available','mage-eventpress'); ?>
|
||||
</span>
|
||||
<?php
|
||||
$total_seat = mep_event_total_seat($post_id, 'total');
|
||||
$total_resv = mep_event_total_seat($post_id, 'resv');
|
||||
$total_sold = mep_ticket_sold($post_id);
|
||||
$total_left = $total_seat - ($total_sold + $total_resv);
|
||||
$total_left = apply_filters('mep_event_total_seat_count', $total_left, $post_id);
|
||||
if ($total_left > 0) {
|
||||
do_action('mep_event_ticket_types',$post_id);
|
||||
do_action('mep_event_extra_service',$post_id);
|
||||
} else {
|
||||
?>
|
||||
<span class=event-expire-btn>
|
||||
<?php echo mep_get_option('mep_no_seat_available_text', 'label_setting_sec') ? mep_get_option('mep_no_seat_available_text', 'label_setting_sec') : _e('No Seat Available', 'mage-eventpress'); ?>
|
||||
</span>
|
||||
<?php
|
||||
do_action('mep_after_no_seat_notice');
|
||||
}
|
||||
}
|
||||
add_action( 'mep_event_ticket_type_extra_service', 'mep_output_add_to_cart_custom_fields', 10 );
|
||||
add_action('mep_event_ticket_type_extra_service', 'mep_output_add_to_cart_custom_fields', 10);
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
add_action('mep_event_faq', 'mep_faq_part');
|
||||
function mep_faq_part(){
|
||||
global $post;
|
||||
function mep_faq_part($event_id){
|
||||
ob_start();
|
||||
$mep_event_faq = get_post_meta($post->ID, 'mep_event_faq', true) ? get_post_meta($post->ID, 'mep_event_faq', true) : '';
|
||||
$mep_event_faq = get_post_meta($event_id, 'mep_event_faq', true) ? get_post_meta($event_id, 'mep_event_faq', true) : '';
|
||||
if ($mep_event_faq) {
|
||||
?>
|
||||
<div class="mep-event-faq-part">
|
||||
|
@ -20,8 +19,7 @@ function mep_faq_part(){
|
|||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
echo apply_filters('mage_event_faq_list', $content,$post->ID);
|
||||
echo apply_filters('mage_event_faq_list', $content,$event_id);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
add_action('mep_event_map','mep_event_google_map');
|
||||
function mep_event_google_map(){
|
||||
function mep_event_google_map($event_id){
|
||||
global $post,$event_meta,$user_api;
|
||||
|
||||
$map_type = mep_get_option( 'mep_google_map_type', 'general_setting_sec', 'iframe');
|
||||
$location_sts = get_post_meta($post->ID,'mep_org_address',true) ? get_post_meta($post->ID,'mep_org_address',true) : '';
|
||||
$location_sts = get_post_meta($event_id,'mep_org_address',true) ? get_post_meta($event_id,'mep_org_address',true) : '';
|
||||
ob_start();
|
||||
do_action('mep_event_before_google_map');
|
||||
if($location_sts){
|
||||
$org_arr = get_the_terms( $post->ID, 'mep_org' );
|
||||
$org_arr = get_the_terms( $event_id, 'mep_org' );
|
||||
$org_id = $org_arr[0]->term_id;
|
||||
$lat = get_term_meta( $org_id, 'latitude', true );
|
||||
$lon = get_term_meta( $org_id, 'longitude', true );
|
||||
|
@ -17,25 +17,17 @@ if($location_sts){
|
|||
$lon = $event_meta['longitude'][0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($event_meta['mep_sgm'][0]){
|
||||
if($event_meta['mep_sgm'][0]){
|
||||
|
||||
if($map_type=='iframe'){
|
||||
?>
|
||||
<div class="mep-gmap-sec">
|
||||
<iframe id="gmap_canvas" src="https://maps.google.com/maps?q=<?php echo mep_get_event_locaion_item($post->ID,'mep_location_venue'); ?>&t=&z=19&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style='width: 100%;min-height: 250px;'></iframe>
|
||||
<iframe id="gmap_canvas" src="https://maps.google.com/maps?q=<?php echo mep_get_event_locaion_item($event_id,'mep_location_venue'); ?>&t=&z=19&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" style='width: 100%;min-height: 250px;'></iframe>
|
||||
</div>
|
||||
<?php
|
||||
}else{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if($user_api){
|
||||
// echo $user_api;
|
||||
?>
|
||||
<div class="mep-gmap-sec">
|
||||
<div id="map" class='mep_google_map'></div>
|
||||
|
@ -66,10 +58,7 @@ if($map_type=='iframe'){
|
|||
<script src="https://maps.googleapis.com/maps/api/js?key=<?php echo $user_api; ?>&callback=initMap"
|
||||
async defer></script>
|
||||
<?php } } }
|
||||
|
||||
do_action('mep_event_after_google_map');
|
||||
$content = ob_get_clean();
|
||||
echo apply_filters('mage_event_google_map', $content,$post->ID);
|
||||
|
||||
|
||||
echo apply_filters('mage_event_google_map', $content,$event_id);
|
||||
}?>
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
// mep_shortcode_add_cart_section
|
||||
|
||||
add_action('mep_shortcode_add_cart_section','mep_shortcode_add_cart_section_html');
|
||||
function mep_shortcode_add_cart_section_html($event){
|
||||
?>
|
||||
<div class='mep-events-shortcode-cart-section'>
|
||||
<div class='mep-events-wrapper'>
|
||||
<div class='mep-default-feature-cart-sec'>
|
||||
<?php mep_get_event_reg_btn($event); ?>
|
||||
<?php mep_single_page_js_script($event); //do_action('mep_add_to_cart_shortcode_js',$event); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
add_action('mep_event_speakers_list_shortcode_template','mep_shortcode_speaker_list_html');
|
||||
function mep_shortcode_speaker_list_html($event_id){
|
||||
?>
|
||||
<div class="mep-default-sidebar-speaker-list">
|
||||
<?php echo mep_display_speaker_list($event_id); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
|
@ -1,87 +1,63 @@
|
|||
<?php
|
||||
get_header();
|
||||
the_post();
|
||||
global $post;
|
||||
global $woocommerce;
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$author_terms = get_the_terms(get_the_id(), 'mep_org');
|
||||
$book_count = get_post_meta(get_the_id(),'total_booking', true);
|
||||
$user_api = mep_get_option( 'google-map-api', 'general_setting_sec', '');
|
||||
if($book_count){ $total_book = $book_count; }else{ $total_book = 0; }
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
|
||||
$global_template = mep_get_option( 'mep_global_single_template', 'general_setting_sec', 'theme-2');
|
||||
$current_template = $event_meta['mep_event_template'][0];
|
||||
if($current_template){
|
||||
$_current_template = $current_template;
|
||||
}else{
|
||||
$_current_template = $global_template;
|
||||
}
|
||||
$currency_pos = get_option( 'woocommerce_currency_pos' );
|
||||
global $post, $woocommerce;
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$author_terms = get_the_terms(get_the_id(), 'mep_org');
|
||||
$book_count = get_post_meta(get_the_id(), 'total_booking', true);
|
||||
$user_api = mep_get_option('google-map-api', 'general_setting_sec', '');
|
||||
$mep_full_name = strip_tags($event_meta['mep_full_name'][0]);
|
||||
$mep_reg_email = strip_tags($event_meta['mep_reg_email'][0]);
|
||||
$mep_reg_phone = strip_tags($event_meta['mep_reg_phone'][0]);
|
||||
$mep_reg_address = strip_tags($event_meta['mep_reg_address'][0]);
|
||||
$mep_reg_designation = strip_tags($event_meta['mep_reg_designation'][0]);
|
||||
$mep_reg_website = strip_tags($event_meta['mep_reg_website'][0]);
|
||||
$mep_reg_veg = strip_tags($event_meta['mep_reg_veg'][0]);
|
||||
$mep_reg_company = strip_tags($event_meta['mep_reg_company'][0]);
|
||||
$mep_reg_gender = strip_tags($event_meta['mep_reg_gender'][0]);
|
||||
$mep_reg_tshirtsize = strip_tags($event_meta['mep_reg_tshirtsize'][0]);
|
||||
$global_template = mep_get_option('mep_global_single_template', 'general_setting_sec', 'default-theme.php');
|
||||
$current_template = $event_meta['mep_event_template'][0];
|
||||
$_current_template = $current_template ? $current_template : $global_template;
|
||||
$currency_pos = get_option('woocommerce_currency_pos');
|
||||
?>
|
||||
|
||||
<div class="mep-events-wrapper">
|
||||
<?php do_action( 'woocommerce_before_single_product' ); ?>
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . "/themes/$_current_template");
|
||||
|
||||
|
||||
// If comments are open or we have at least one comment, load up the comment template.
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
do_action('woocommerce_before_single_product');
|
||||
$theme_name = "/themes/$_current_template";
|
||||
require_once(mep_template_file_path($theme_name));
|
||||
if (comments_open() || get_comments_number()) {
|
||||
comments_template();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="mep-related-events-sec">
|
||||
<?php do_action('after-single-events'); ?>
|
||||
</div>
|
||||
<?php
|
||||
$builder_version = mep_get_builder_version();
|
||||
if($builder_version < 3.5){
|
||||
?>
|
||||
<script>
|
||||
jQuery('#quantity_5a7abbd1bff73').click(function() {
|
||||
var $form = jQuery('form'); //on a real app it would be better to have a class or ID
|
||||
var $totalQuant = jQuery('#quantity_5a7abbd1bff73', $form);
|
||||
jQuery('#quantity_5a7abbd1bff73', $form).change(calculateTotal);
|
||||
|
||||
|
||||
function calculateTotal() {
|
||||
var sum = jQuery('#rowtotal').val();
|
||||
jQuery('#usertotal').html('<?php if($currency_pos=="left"){ echo get_woocommerce_currency_symbol(); } ?>' + sum * parseInt( $totalQuant.val() || 0, 10) + "<?php if($currency_pos=="right"){ echo get_woocommerce_currency_symbol(); } ?>");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
|
||||
|
||||
jQuery( "#mep-event-accordion" ).accordion({
|
||||
collapsible: true,
|
||||
active: false
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).on("change", ".etp", function() {
|
||||
var sum = 0;
|
||||
jQuery(".etp").each(function(){
|
||||
|
@ -111,7 +87,6 @@ if(vallllp=="_"){
|
|||
|
||||
});
|
||||
|
||||
|
||||
function updateTotal() {
|
||||
var total = 0;
|
||||
vallllp = jQuery(this).val()+"_";
|
||||
|
@ -121,9 +96,6 @@ function updateTotal() {
|
|||
jQuery('#rowtotal').val(total);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Bind the change event
|
||||
jQuery(".extra-qty-box").on('change', function() {
|
||||
var sum = 0;
|
||||
|
@ -148,14 +120,11 @@ $mep_event_ticket_type = get_post_meta($post->ID, 'mep_event_ticket_type', true)
|
|||
if($mep_event_ticket_type){
|
||||
$count =1;
|
||||
$event_id = $post->ID;
|
||||
|
||||
|
||||
$event_more_date[0]['event_more_start_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_start_date',true)));
|
||||
$event_more_date[0]['event_more_start_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_start_time',true)));
|
||||
$event_more_date[0]['event_more_end_date'] = date('Y-m-d',strtotime(get_post_meta($event_id,'event_end_date',true)));
|
||||
$event_more_date[0]['event_more_end_time'] = date('H:i',strtotime(get_post_meta($event_id,'event_end_time',true)));
|
||||
$event_more_dates = get_post_meta($event_id,'mep_event_more_date',true) ? get_post_meta($event_id,'mep_event_more_date',true) : array();
|
||||
|
||||
$recurring = get_post_meta($event_id, 'mep_enable_recurring', true) ? get_post_meta($event_id, 'mep_enable_recurring', true) : 'no';
|
||||
if($recurring == 'yes'){
|
||||
$event_multi_date = array_merge($event_more_date,$event_more_dates);
|
||||
|
@ -163,27 +132,14 @@ if($recurring == 'yes'){
|
|||
$event_multi_date = $event_more_date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach($event_multi_date as $event_date){
|
||||
|
||||
$start_date = date('Y-m-d H:i',strtotime($event_date['event_more_start_date'].' '.$event_date['event_more_start_time']));
|
||||
|
||||
|
||||
|
||||
|
||||
$start_date = $recurring == 'yes' ? date('Y-m-d H:i:s', strtotime($event_date['event_more_start_date'] . ' ' . $event_date['event_more_start_time'])) : date('Y-m-d H:i:s', strtotime(mep_get_event_expire_date($event_id)));
|
||||
if(strtotime(current_time('Y-m-d H:i:s')) < strtotime($start_date)){
|
||||
|
||||
|
||||
foreach ( $mep_event_ticket_type as $field ) {
|
||||
$qm = $field['option_name_t'];
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
var inputs = jQuery("#ttyttl").html() || 0;
|
||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||
var inputs = jQuery("#ttyttl").html() || 0;
|
||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||
var input = parseInt(inputs);
|
||||
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
|
||||
|
||||
|
@ -193,7 +149,6 @@ $qm = $field['option_name_t'];
|
|||
jQuery('#dadainfo_<?php echo $count; ?>').empty();
|
||||
children=0;
|
||||
}
|
||||
|
||||
for (var i = children+1; i <= input; i++) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').append(
|
||||
jQuery('<div/>')
|
||||
|
@ -202,35 +157,21 @@ $qm = $field['option_name_t'];
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
|
||||
|
||||
var inputs = jQuery("#ttyttl").html() || 0;
|
||||
var inputs = jQuery('#eventpxtp_<?php echo $count; ?>').val() || 0;
|
||||
var input = parseInt(inputs);
|
||||
var children=jQuery('#dadainfo_<?php echo $count; ?> > div').length || 0;
|
||||
|
||||
jQuery(document).on("change", ".etp", function() {
|
||||
var TotalQty = 0;
|
||||
jQuery(".etp").each(function(){
|
||||
TotalQty += +jQuery(this).val();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(input < children){
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').empty();
|
||||
children=0;
|
||||
}
|
||||
|
||||
for (var i = children+1; i <= input; i++) {
|
||||
jQuery('#dadainfo_<?php echo $count; ?>').append(
|
||||
jQuery('<div/>')
|
||||
|
@ -238,9 +179,7 @@ jQuery('#eventpxtp_<?php echo $count; ?>').on('change', function () {
|
|||
.html("<?php do_action('mep_reg_fields',$start_date); ?>")
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
<?php
|
||||
$count++;
|
||||
}
|
||||
|
@ -261,11 +200,15 @@ jQuery('#quantity_5a7abbd1bff73').on('change', function () {
|
|||
for (var i = children+1; i <= input; i++) {
|
||||
jQuery('#divParent').append(
|
||||
jQuery('<div/>')
|
||||
.attr("id", "newDiv" + i)event_start_date
|
||||
.attr("id", "newDiv" + i)
|
||||
});
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
});
|
||||
</script>
|
||||
<?php get_footer(); ?>
|
||||
<?php
|
||||
}else{
|
||||
do_action('mep_event_single_template_end',get_the_id());
|
||||
}?>
|
||||
<?php get_footer(); ?>
|
|
@ -21,4 +21,7 @@ require_once(dirname(__FILE__) . "/event_loop_list.php");
|
|||
require_once(dirname(__FILE__) . "/event_loop_minimal.php");
|
||||
require_once(dirname(__FILE__) . "/event_loop_native.php");
|
||||
require_once(dirname(__FILE__) . "/event_loop_timeline.php");
|
||||
require_once(dirname(__FILE__) . "/event_loop_title.php");
|
||||
require_once(dirname(__FILE__) . "/event_loop_title.php");
|
||||
require_once(dirname(__FILE__) . "/event_speakers_list.php");
|
||||
require_once(dirname(__FILE__) . "/shortcode_add_cart_section.php");
|
||||
require_once(dirname(__FILE__) . "/shortcode_speaker_list.php");
|
|
@ -0,0 +1,912 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(function ($) {
|
||||
|
||||
|
||||
|
||||
|
||||
$.fn.formFieldDependency = function (options) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plugin Settings
|
||||
* @type {void|*}
|
||||
*/
|
||||
var settings = $.extend({
|
||||
'attribute' : 'data-depends',
|
||||
'rules' : {}
|
||||
}, options);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check array exists on array
|
||||
* @param needleArray
|
||||
* @param haystackArray
|
||||
* @param strict
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var arrayInArraysHelper = function (needleArray, haystackArray, strict) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (typeof strict == 'undefined') {
|
||||
strict = false;
|
||||
}
|
||||
|
||||
if (needleArray == null) {
|
||||
needleArray = [];
|
||||
}
|
||||
|
||||
if (strict == true) {
|
||||
if ((needleArray.sort().join(',').toLowerCase()) == (haystackArray.sort().join(',').toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < needleArray.length; i++) {
|
||||
if (haystackArray.indexOf(needleArray[i]) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check string exist on array value
|
||||
* @param needleString
|
||||
* @param haystackArray
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var stringInArraysHelper = function (needleString, haystackArray) {
|
||||
|
||||
if (($.inArray(needleString, haystackArray) >= 0) && $.isArray(haystackArray)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Check value is empty or not
|
||||
* @param value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
var isEmpty = function (value) {
|
||||
|
||||
if (typeof value == 'null' || typeof value == 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof value == 'string') {
|
||||
return ($.trim(value) == '') ? true : false;
|
||||
}
|
||||
|
||||
if (typeof value == 'string') {
|
||||
return ($.trim(value) == '') ? true : false;
|
||||
}
|
||||
|
||||
if (typeof value == 'object') {
|
||||
if ($.isArray(value)) {
|
||||
var _tmp = $.map(value, function (val, i) {
|
||||
return ($.trim(val) == '') ? null : val;
|
||||
});
|
||||
return $.isEmptyObject(_tmp);
|
||||
}
|
||||
else {
|
||||
return $.isEmptyObject(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For Regular Expression Dependency
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeRegExpDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $.trim($(parent).val());
|
||||
|
||||
switch (name) {
|
||||
case "input:text":
|
||||
case "input:password":
|
||||
case "input:number":
|
||||
case "input:date":
|
||||
case "input:email":
|
||||
case "input:url":
|
||||
case "input:tel":
|
||||
case "textarea:textarea":
|
||||
|
||||
var modifier = ( typeof depObject.modifier == 'undefined' ) ? '' : depObject.modifier;
|
||||
var pattern = new RegExp(depObject.pattern, modifier);
|
||||
|
||||
if (pattern.test(value)) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup', $(parent), function (e) {
|
||||
e.stopPropagation();
|
||||
typeRegExpDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For Empty TextBox
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeEmptyDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $(parent).val();
|
||||
|
||||
switch (name) {
|
||||
case "input:text":
|
||||
case "input:password":
|
||||
case "input:number":
|
||||
case "input:date":
|
||||
case "input:email":
|
||||
case "input:url":
|
||||
case "input:tel":
|
||||
case "textarea:textarea":
|
||||
case "select:select-one":
|
||||
|
||||
if ($.trim(value) == '') {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case "input:checkbox":
|
||||
if ($(parent).is(':checked') && $.trim(value) != '') {
|
||||
$(element).hide();
|
||||
}
|
||||
else {
|
||||
$(element).show();
|
||||
}
|
||||
break;
|
||||
|
||||
case "select:select-multiple":
|
||||
|
||||
if (isEmpty(value)) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
e.stopPropagation();
|
||||
typeEmptyDependency(element, depObject, parent, false);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* For non empty TextBox
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeNotEmptyDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $(parent).val();
|
||||
|
||||
switch (name) {
|
||||
case "input:text":
|
||||
case "input:password":
|
||||
case "input:number":
|
||||
case "input:date":
|
||||
case "input:email":
|
||||
case "input:url":
|
||||
case "input:tel":
|
||||
case "textarea:textarea":
|
||||
case "select:select-one":
|
||||
|
||||
if ($.trim(value) != '') {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case "input:checkbox":
|
||||
if ($(parent).is(':checked') && $.trim(value) != '') {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case "select:select-multiple":
|
||||
|
||||
if (isEmpty(value)) {
|
||||
$(element).hide();
|
||||
}
|
||||
else {
|
||||
$(element).show();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
|
||||
typeNotEmptyDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TextBox value matched with value or with array values
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeEqualDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
|
||||
console.log(useEvent);
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $(parent).val();
|
||||
|
||||
var equalLike = (typeof depObject.like == 'undefined') ? false : true;
|
||||
|
||||
// show if empty?. default false
|
||||
depObject.empty = (typeof depObject.empty == 'undefined') ? false : depObject.empty;
|
||||
|
||||
depObject.strict = (typeof depObject.strict == 'undefined') ? false : depObject.strict;
|
||||
|
||||
if (equalLike) {
|
||||
|
||||
var eqtag = $(depObject.like).prop("tagName").toLowerCase();
|
||||
var eqtype = $(depObject.like).prop("type").toLowerCase();
|
||||
var eqname = eqtag + ':' + eqtype;
|
||||
|
||||
if (eqname == 'input:checkbox' || eqname == 'input:radio') {
|
||||
|
||||
|
||||
|
||||
depObject.value = $(depObject.like + ':checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
}
|
||||
else {
|
||||
|
||||
depObject.value = $(depObject.like).val();
|
||||
|
||||
if (!showOnEmptyValue) {
|
||||
depObject.value = ($.trim($(depObject.like).val()) == '') ? null : $(depObject.like).val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (name) {
|
||||
case "input:text":
|
||||
case "input:password":
|
||||
case "input:number":
|
||||
case "input:date":
|
||||
case "input:email":
|
||||
case "input:url":
|
||||
case "input:tel":
|
||||
case "textarea:textarea":
|
||||
case "select:select-one":
|
||||
|
||||
if ($.trim(value) == depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else if (stringInArraysHelper(value, depObject.value)) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
if( $.trim(value)=='' && depObject.empty ){
|
||||
$(element).show();
|
||||
}else{
|
||||
$(element).hide();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "input:checkbox":
|
||||
case "input:radio":
|
||||
|
||||
var value = $(parent + ':checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
|
||||
|
||||
if (value == depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else if (stringInArraysHelper(value, depObject.value)) {
|
||||
$(element).show();
|
||||
}
|
||||
else if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
if( isEmpty(value) && depObject.empty){
|
||||
$(element).show();
|
||||
} else {
|
||||
$(element).hide();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "select:select-multiple":
|
||||
|
||||
if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
|
||||
if( value==null && depObject.empty ){
|
||||
$(element).show();
|
||||
} else{
|
||||
$(element).hide();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
typeEqualDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* TextBox value not equal with value or with array values
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeNotEqualDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $(parent).val();
|
||||
|
||||
var equalLike = (typeof depObject.like == 'undefined') ? false : true;
|
||||
depObject.strict = (typeof depObject.strict == 'undefined') ? false : depObject.strict;
|
||||
|
||||
// show if empty? default is true
|
||||
depObject.empty = (typeof depObject.empty == 'undefined') ? true : depObject.empty;
|
||||
|
||||
if (equalLike) {
|
||||
|
||||
var eqtag = $(depObject.like).prop("tagName").toLowerCase();
|
||||
var eqtype = $(depObject.like).prop("type").toLowerCase();
|
||||
var eqname = eqtag + ':' + eqtype;
|
||||
|
||||
if (eqname == 'input:checkbox' || eqname == 'input:radio') {
|
||||
depObject.value = $(depObject.like + ':checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
}
|
||||
else {
|
||||
|
||||
depObject.value = $(depObject.like).val();
|
||||
|
||||
if (!showOnEmptyValue) {
|
||||
depObject.value = ($.trim($(depObject.like).val()) == '') ? null : $(depObject.like).val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (name) {
|
||||
case "input:text":
|
||||
case "input:password":
|
||||
case "input:number":
|
||||
case "input:date":
|
||||
case "input:email":
|
||||
case "input:url":
|
||||
case "input:tel":
|
||||
case "textarea:textarea":
|
||||
case "select:select-one":
|
||||
|
||||
if (value == depObject.value) {
|
||||
$(element).hide();
|
||||
}
|
||||
else if (stringInArraysHelper(value, depObject.value)) {
|
||||
$(element).hide();
|
||||
}
|
||||
else {
|
||||
if ($.trim(value) == '' && !depObject.empty) {
|
||||
$(element).hide();
|
||||
} else {
|
||||
$(element).show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "input:checkbox":
|
||||
case "input:radio":
|
||||
|
||||
value = $(parent + ':checked').map(function () {
|
||||
return this.value;
|
||||
}).get();
|
||||
|
||||
|
||||
if (typeof depObject.strict == 'undefined') {
|
||||
depObject.strict = false;
|
||||
}
|
||||
|
||||
if (value == depObject.value) {
|
||||
|
||||
$(element).hide();
|
||||
}
|
||||
else if (stringInArraysHelper(value, depObject.value)) {
|
||||
|
||||
$(element).hide();
|
||||
}
|
||||
else if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
||||
|
||||
$(element).hide();
|
||||
}
|
||||
else {
|
||||
if (isEmpty(value) && !depObject.empty) {
|
||||
$(element).hide();
|
||||
}else{
|
||||
$(element).show();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "select:select-multiple":
|
||||
|
||||
if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
||||
$(element).hide();
|
||||
} else {
|
||||
if( value==null && !depObject.empty ) {
|
||||
$(element).hide();
|
||||
}else{
|
||||
$(element).show();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
typeNotEqualDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* TextBox value compare
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeCompareDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = parseInt($(parent).val());
|
||||
depObject.value = parseInt(depObject.value);
|
||||
|
||||
switch (depObject.sign) {
|
||||
case "<":
|
||||
case "lt":
|
||||
case "lessthen":
|
||||
case "less-then":
|
||||
case "LessThen":
|
||||
if (value < depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case "<=":
|
||||
case "lteq":
|
||||
case "lessthenequal":
|
||||
case "less-then-equal":
|
||||
case "LessThenEqual":
|
||||
case "eqlt":
|
||||
if (value <= depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case ">=":
|
||||
case "gteq":
|
||||
case "greaterthenequal":
|
||||
case "greater-then-equal":
|
||||
case "GreaterThenEqual":
|
||||
case "eqgt":
|
||||
if (value >= depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case ">":
|
||||
case "gt":
|
||||
case "greaterthen":
|
||||
case "greater-then":
|
||||
case "GreaterThen":
|
||||
if (value > depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
typeCompareDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* TextBox value range
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeRangeDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = parseInt($(parent).val());
|
||||
var min, max;
|
||||
|
||||
|
||||
// value = [50, 100]
|
||||
|
||||
if ($.isArray(depObject.value)) {
|
||||
min = parseInt(depObject.value[0]);
|
||||
max = parseInt(depObject.value[1]);
|
||||
}
|
||||
|
||||
if (typeof depObject.value == 'undefined') {
|
||||
min = parseInt(depObject.min);
|
||||
max = parseInt(depObject.max);
|
||||
}
|
||||
|
||||
if (min < value && value < max) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
typeRangeDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* TextBox value length
|
||||
* @param element
|
||||
* @param depObject
|
||||
* @param parent
|
||||
* @param useEvent
|
||||
*/
|
||||
var typeLengthDependency = function (element, depObject, parent, useEvent) {
|
||||
|
||||
if (typeof useEvent == 'undefined') {
|
||||
useEvent = false;
|
||||
}
|
||||
|
||||
if( typeof $(parent).prop("tagName")=='undefined' ){
|
||||
return false;
|
||||
}
|
||||
|
||||
var tag = $(parent).prop("tagName").toLowerCase();
|
||||
var type = $(parent).prop("type").toLowerCase();
|
||||
var name = tag + ':' + type;
|
||||
var value = $(parent).val().length;
|
||||
depObject.value = parseInt(depObject.value);
|
||||
|
||||
switch ( depObject.sign ){
|
||||
case "<":
|
||||
case "lt":
|
||||
case "lessthen":
|
||||
case "less-then":
|
||||
case "LessThen":
|
||||
if (value < depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case "<=":
|
||||
case "lteq":
|
||||
case "lessthenequal":
|
||||
case "less-then-equal":
|
||||
case "LessThenEqual":
|
||||
case "eqlt":
|
||||
if (value <= depObject.value){
|
||||
$(element).show();
|
||||
}
|
||||
else{
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case ">=":
|
||||
case "gteq":
|
||||
case "greaterthenequal":
|
||||
case "greater-then-equal":
|
||||
case "GreaterThenEqual":
|
||||
case "eqgt":
|
||||
if (value >= depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
|
||||
case ">":
|
||||
case "gt":
|
||||
case "greaterthen":
|
||||
case "greater-then":
|
||||
case "GreaterThen":
|
||||
if (value > depObject.value) {
|
||||
$(element).show();
|
||||
}
|
||||
else {
|
||||
$(element).hide();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (useEvent) {
|
||||
$(document.body).on('keyup change', $(parent), function (e) {
|
||||
|
||||
|
||||
|
||||
|
||||
e.stopPropagation();
|
||||
typeLengthDependency(element, depObject, parent, false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Using Types
|
||||
* @param $el
|
||||
* @param $data
|
||||
*/
|
||||
var useTypes = function ($el, $data) {
|
||||
$.each($data, function (selector, depObject) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
switch (depObject.type) {
|
||||
case "empty":
|
||||
typeEmptyDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "notempty":
|
||||
case "not-empty":
|
||||
case "notEmpty":
|
||||
case "!empty":
|
||||
typeNotEmptyDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "equal":
|
||||
case "==":
|
||||
case "=":
|
||||
typeEqualDependency($el, depObject, selector, true);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case "!equal":
|
||||
case "notequal":
|
||||
case "!=":
|
||||
case "not-equal":
|
||||
case "notEqual":
|
||||
typeNotEqualDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "regexp":
|
||||
case "expression":
|
||||
case "reg":
|
||||
case "exp":
|
||||
typeRegExpDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "compare":
|
||||
case "comp":
|
||||
typeCompareDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "length":
|
||||
case "lng":
|
||||
typeLengthDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
case "range":
|
||||
typeRangeDependency($el, depObject, selector, true);
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
(function ($data) {
|
||||
$.each($data, function ($el, depObject) {
|
||||
useTypes($($el), depObject);
|
||||
});
|
||||
})(settings.rules);
|
||||
|
||||
return this.each(function () {
|
||||
var $data = JSON.parse($(this).attr(settings.attribute).replace(/'/g, '"'));
|
||||
var that = $(this);
|
||||
$.each($data, function(el, obj){
|
||||
useTypes(that, obj);
|
||||
});
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
|
@ -0,0 +1,353 @@
|
|||
jQuery(document).ready(function($) {
|
||||
|
||||
|
||||
$(".dependency-field").formFieldDependency({});
|
||||
$(".sortable" ).sortable({ handle: ".sort" });
|
||||
$('.colorpicker').wpColorPicker();
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-switcher-wrapper .switcher .layer', function() {
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
jQuery(document).on('click', '.field-img-select-wrapper .sw-button img', function() {
|
||||
var dataId = jQuery(this).attr('data-id');
|
||||
var src = jQuery(this).attr('src');
|
||||
jQuery('.field-img-select-wrapper-'+dataId+' .img-val input').val(src);
|
||||
jQuery('.field-img-select-wrapper-'+dataId+' label').removeClass('checked');
|
||||
if(jQuery(this).parent().parent().hasClass('checked')){
|
||||
jQuery(this).parent().parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
jQuery(document).on('change', '.field-range-input-wrapper .range-hndle', function() {
|
||||
val = $(this).val();
|
||||
$(this).parent().children('.range-val').val(val);
|
||||
})
|
||||
jQuery(document).on('keyup', '.field-range-input-wrapper .range-val', function() {
|
||||
val = $(this).val();
|
||||
$(this).parent().children('.range-hndle').val(val);
|
||||
})
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-switch-wrapper .sw-button', function() {
|
||||
|
||||
jQuery(this).parent().parent().children('label').removeClass('checked');
|
||||
//jQuery('.field-switch-wrapper label').removeClass('checked');
|
||||
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-switch-multi-wrapper .sw-button', function() {
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
jQuery(document).on('click', '.field-switch-img-wrapper .sw-button img', function() {
|
||||
|
||||
jQuery(this).parent().parent().children('label').removeClass('checked');
|
||||
//jQuery('.field-switch-img-wrapper label').removeClass('checked');
|
||||
|
||||
|
||||
if(jQuery(this).parent().parent().hasClass('checked')){
|
||||
jQuery(this).parent().parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-time-format-wrapper .format-list input[type="radio"]',function () {
|
||||
value = $(this).val();
|
||||
$(this).parent().parent().parent().children('.format-value').children('.format').children('input').val(value);
|
||||
//$(this).parent().parent().parent().children('.format-value').children('input').val(value);
|
||||
|
||||
})
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-date-format-wrapper .format-list input[type="radio"]', function () {
|
||||
value = $(this).val();
|
||||
$(this).parent().parent().parent().children('.format-value').children('.format').children('input').val(value);
|
||||
//$('.field-date-format-wrapper .format-value input').val(value);
|
||||
})
|
||||
|
||||
|
||||
/*field-icon-wrapper*/
|
||||
|
||||
jQuery(document).on('click', '.field-icon-wrapper .select-icon', function(){
|
||||
if(jQuery(this).parent().hasClass('active')){
|
||||
jQuery(this).parent().removeClass('active');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('active');
|
||||
}
|
||||
})
|
||||
jQuery(document).on('keyup', '.field-icon-wrapper .search-icon input', function(){
|
||||
|
||||
text = jQuery(this).val();
|
||||
|
||||
$(this).parent().parent().children('ul').children('li').each(function( index ) {
|
||||
console.log( index + ": " + $( this ).attr('title') );
|
||||
title = $( this ).attr('title');
|
||||
n = title.indexOf(text);
|
||||
if(n<0){
|
||||
$( this ).hide();
|
||||
}else{
|
||||
$( this ).show();
|
||||
}
|
||||
});
|
||||
})
|
||||
jQuery(document).on('click', '.field-icon-wrapper .icon-list li', function(){
|
||||
iconData = jQuery(this).attr('iconData');
|
||||
html = '<i class="'+iconData+'"></i>';
|
||||
|
||||
jQuery(this).parent().parent().parent().children('.icon-wrapper').children('span').html(html);
|
||||
jQuery(this).parent().parent().parent().children('.icon-wrapper').children('input').val(iconData);
|
||||
|
||||
//jQuery('.field-icon-wrapper .icon-wrapper input').val(iconData);
|
||||
})
|
||||
|
||||
|
||||
$('.field-select2-wrapper select').select2({
|
||||
width: '320px',
|
||||
allowClear: true
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-option-group-tabs-wrapper .tab-navs li', function() {
|
||||
|
||||
index = $(this).attr('index');
|
||||
|
||||
jQuery(".field-option-group-tabs-wrapper .tab-navs li").removeClass('active');
|
||||
jQuery(".field-option-group-tabs-wrapper .tab-content").removeClass('active');
|
||||
if(jQuery(this).hasClass('active')){
|
||||
|
||||
}else{
|
||||
jQuery(this).addClass('active');
|
||||
jQuery(".field-option-group-tabs-wrapper .tab-content-"+index).addClass('active');
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-color-sets-wrapper .color-srick', function() {
|
||||
|
||||
jQuery('.field-color-sets-wrapper label').removeClass('checked');
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
jQuery(document).on('click', '.field-color-palette-wrapper .sw-button', function() {
|
||||
jQuery('.field-color-palette-wrapper label').removeClass('checked');
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
jQuery(document).on('click', '.field-color-palette-multi-wrapper .sw-button',function() {
|
||||
if(jQuery(this).parent().hasClass('checked')){
|
||||
jQuery(this).parent().removeClass('checked');
|
||||
}else{
|
||||
jQuery(this).parent().addClass('checked');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).on('keyup', '.field-password-wrapper input',function(){
|
||||
pass = $(this).val();
|
||||
var score = 0;
|
||||
if (!pass)
|
||||
return score;
|
||||
// award every unique letter until 5 repetitions
|
||||
var letters = new Object();
|
||||
for (var i=0; i<pass.length; i++) {
|
||||
letters[pass[i]] = (letters[pass[i]] || 0) + 1;
|
||||
score += 5.0 / letters[pass[i]];
|
||||
}
|
||||
// bonus points for mixing it up
|
||||
var variations = {
|
||||
digits: /\d/.test(pass),
|
||||
lower: /[a-z]/.test(pass),
|
||||
upper: /[A-Z]/.test(pass),
|
||||
nonWords: /\W/.test(pass),
|
||||
}
|
||||
variationCount = 0;
|
||||
for (var check in variations) {
|
||||
variationCount += (variations[check] == true) ? 1 : 0;
|
||||
}
|
||||
score += (variationCount - 1) * 10;
|
||||
if(score > 80){
|
||||
score_style = '#4CAF50;';
|
||||
score_text = 'Strong';
|
||||
}else if(score > 60){
|
||||
score_style = '#cddc39;';
|
||||
score_text = 'Good';
|
||||
}else if(score > 30){
|
||||
score_style = '#FF9800;';
|
||||
score_text = 'Normal';
|
||||
}else{
|
||||
score_style = '#F44336;';
|
||||
score_text = 'Week';
|
||||
}
|
||||
html = '<span style="width:'+parseInt(score)+'%;background-color: '+score_style+'"></span>';
|
||||
$(".field-password-wrapper-<?php echo $id; ?> .scorePassword").html(html)
|
||||
$(".field-password-wrapper-<?php echo $id; ?> .scoreText").html(score_text)
|
||||
})
|
||||
|
||||
|
||||
jQuery(document).on('keyup', 'input.search-options', function(){
|
||||
keyword = jQuery(this).val();
|
||||
|
||||
if(keyword != '' ){
|
||||
$('.form-table tr th').each(function( index ) {
|
||||
title = $( this ).text();
|
||||
// console.log( index + ": " + title );
|
||||
|
||||
title = title.toLowerCase();
|
||||
|
||||
n = title.indexOf(keyword);
|
||||
if(n<0){
|
||||
$( this ).parent().hide();
|
||||
}else{
|
||||
$( this ).parent().show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.form-section .tab-content').each(function( index ) {
|
||||
|
||||
$( this ).show();
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('.form-section .tab-content h2').each(function( index ) {
|
||||
|
||||
$( this ).hide();
|
||||
|
||||
});
|
||||
|
||||
}else{
|
||||
|
||||
$('.form-table tr th').each(function( index ) {
|
||||
$( this ).parent().show();
|
||||
});
|
||||
|
||||
|
||||
$('.form-section .tab-content').each(function( index ) {
|
||||
|
||||
if(index == 0){
|
||||
$( this ).addClass('active');
|
||||
$( this ).show();
|
||||
}else{
|
||||
$( this ).removeClass('active');
|
||||
$( this ).removeAttr('style');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('.form-section .tab-content h2').each(function( index ) {
|
||||
|
||||
$( this ).show();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// $(document).on('click','.ppof-settings .nav-items .child-nav-icon',function(event){
|
||||
// event.preventDefault()
|
||||
// //dataid = $(this).attr('dataid');
|
||||
//
|
||||
// if($(this).parent().parent().hasClass('active')){
|
||||
// $( this ).parent().parent().removeClass('active');
|
||||
//
|
||||
// }else{
|
||||
// $( this ).parent().parent().addClass('active');
|
||||
// }
|
||||
//
|
||||
// //$('.nav-items .nav-item').removeClass('active');
|
||||
// // $(this).addClass('active');
|
||||
// //$('.tab-content').removeClass('active');
|
||||
// //$('.tab-content-'+dataid).addClass('active');
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on('click','.ppof-settings .nav-items .nav-item',function(event){
|
||||
event.preventDefault()
|
||||
dataid = $(this).attr('dataid');
|
||||
sectionId = $(this).attr('sectionId');
|
||||
//$('.nav-item-wrap').removeClass('active');
|
||||
|
||||
if($(this).parent().hasClass('active')){
|
||||
$( this ).parent().removeClass('active');
|
||||
|
||||
}else{
|
||||
$( this ).parent().addClass('active');
|
||||
}
|
||||
|
||||
|
||||
$('.nav-items .nav-item').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.tab-content').removeClass('active');
|
||||
$('.tab-content-'+dataid).addClass('active');
|
||||
|
||||
if(sectionId != null){
|
||||
$('html, body, .edit-post-layout__content').animate({
|
||||
scrollTop: ($("#"+sectionId).offset().top - 80)
|
||||
}, 500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
jQuery(document).ready(function(a){jQuery(document).on("keyup","input.search-options",function(){keyword=jQuery(this).val();if(keyword!=""){a(".form-table tr th").each(function(b){title=a(this).text();title=title.toLowerCase();n=title.indexOf(keyword);if(n<0){a(this).parent().hide()}else{a(this).parent().show()}});a(".form-section .tab-content").each(function(b){a(this).show()});a(".form-section .tab-content h2").each(function(b){a(this).hide()})}else{a(".form-table tr th").each(function(b){a(this).parent().show()});a(".form-section .tab-content").each(function(b){if(b==0){a(this).addClass("active");a(this).show()}else{a(this).removeClass("active");a(this).removeAttr("style")}});a(".form-section .tab-content h2").each(function(b){a(this).show()})}});a(document).on("click",".ppof-settings .nav-items .nav-item",function(b){b.preventDefault();dataid=a(this).attr("dataid");a(".nav-items .nav-item").removeClass("active");a(this).addClass("active");a(".tab-content").removeClass("active");a(".tab-content-"+dataid).addClass("active")})});
|
|
@ -0,0 +1,610 @@
|
|||
<?php
|
||||
/*
|
||||
* @Author : PickPlugins
|
||||
* Copyright : 2015 PickPlugins.com
|
||||
*
|
||||
* Version : 1.0.3
|
||||
*/
|
||||
|
||||
if ( ! defined('ABSPATH')) exit; // if direct access
|
||||
|
||||
|
||||
if( ! class_exists( 'AddMenuPage' ) ) {
|
||||
class AddMenuPage {
|
||||
|
||||
public $data = array();
|
||||
|
||||
public function __construct( $args ){
|
||||
|
||||
$this->data = &$args;
|
||||
|
||||
if( $this->add_in_menu() ) {
|
||||
add_action( 'admin_menu', array( $this, 'add_menu_in_admin_menu' ), 12 );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', array( $this, 'display_fields' ), 12 );
|
||||
add_filter( 'whitelist_options', array( $this, 'whitelist_options' ), 99, 1 );
|
||||
}
|
||||
|
||||
public function add_menu_in_admin_menu(){
|
||||
|
||||
if( "main" == $this->get_menu_type() ) {
|
||||
add_menu_page( $this->get_menu_name(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ), $this->get_menu_icon() );
|
||||
}
|
||||
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
add_submenu_page( $this->get_menu_slug(), $panels['page_nav'], $panels['page_nav'], $this->get_capability(),
|
||||
$panelsIndex,
|
||||
array( $this, 'display_function' ) );
|
||||
endforeach;
|
||||
|
||||
}
|
||||
|
||||
public function section_callback( $section ) {
|
||||
|
||||
$section_id = $section['id'];
|
||||
|
||||
$data = isset( $section['callback'][0]->data ) ? $section['callback'][0]->data : array();
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
//$description = $section['description'];
|
||||
|
||||
$description = $section['id'] ;
|
||||
echo '<div id="'.$section['id'].'"></div>';
|
||||
}
|
||||
|
||||
public function display_fields() {
|
||||
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
foreach ($panels['page_settings'] as $sectionIndex=>$sections):
|
||||
|
||||
add_settings_section(
|
||||
$sectionIndex,
|
||||
isset( $sections['title'] ) ? $sections['title'] : "",
|
||||
array( $this, 'section_callback'),
|
||||
$panelsIndex
|
||||
);
|
||||
|
||||
foreach( $sections['options'] as $option ) :
|
||||
|
||||
add_settings_field( $option['id'], $option['title'], array($this,'field_generator'), $panelsIndex, $sectionIndex, $option );
|
||||
|
||||
endforeach;
|
||||
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function field_generator( $option ) {
|
||||
|
||||
$id = isset( $option['id'] ) ? $option['id'] : "";
|
||||
$type = isset( $option['type'] ) ? $option['type'] : "";
|
||||
$details = isset( $option['details'] ) ? $option['details'] : "";
|
||||
|
||||
if( empty( $id ) ) return;
|
||||
|
||||
$prent_option_name = $this->get_option_name();
|
||||
$FormFieldsGenerator = new FormFieldsGenerator();
|
||||
|
||||
if(!empty($prent_option_name)):
|
||||
$field_name = $prent_option_name.'['.$id.']';
|
||||
$option['field_name'] = $field_name;
|
||||
|
||||
$prent_option_value = get_option( $prent_option_name );
|
||||
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
|
||||
else:
|
||||
$option['field_name'] = $id;
|
||||
$option['value'] = get_option( $id );
|
||||
endif;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if( isset($option['type']) && $option['type'] === 'text' ){
|
||||
echo $FormFieldsGenerator->field_text($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
|
||||
echo $FormFieldsGenerator->field_text_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
|
||||
echo $FormFieldsGenerator->field_textarea($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
|
||||
echo $FormFieldsGenerator->field_checkbox($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox_multi' ){
|
||||
echo $FormFieldsGenerator->field_checkbox_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'radio' ){
|
||||
echo $FormFieldsGenerator->field_radio($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select' ){
|
||||
echo $FormFieldsGenerator->field_select($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range' ){
|
||||
echo $FormFieldsGenerator->field_range($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
|
||||
echo $FormFieldsGenerator->field_range_input($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch' ){
|
||||
echo $FormFieldsGenerator->field_switch($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
|
||||
echo $FormFieldsGenerator->field_switch_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
|
||||
echo $FormFieldsGenerator->field_switch_img($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
|
||||
echo $FormFieldsGenerator->field_time_format($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
|
||||
echo $FormFieldsGenerator->field_date_format($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
|
||||
echo $FormFieldsGenerator->field_datepicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
|
||||
echo $FormFieldsGenerator->field_link_color($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon' ){
|
||||
echo $FormFieldsGenerator->field_icon($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
|
||||
echo $FormFieldsGenerator->field_icon_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
|
||||
echo $FormFieldsGenerator->field_dimensions($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
|
||||
echo $FormFieldsGenerator->field_wp_editor($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select2' ){
|
||||
echo $FormFieldsGenerator->field_select2($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'faq' ){
|
||||
echo $FormFieldsGenerator->field_faq($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'grid' ){
|
||||
echo $FormFieldsGenerator->field_grid($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_sets' ){
|
||||
echo $FormFieldsGenerator->field_color_sets($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
|
||||
echo $FormFieldsGenerator->field_color_palette($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
|
||||
echo $FormFieldsGenerator->field_color_palette_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media' ){
|
||||
echo $FormFieldsGenerator->field_media($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
|
||||
echo $FormFieldsGenerator->field_media_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
|
||||
echo $FormFieldsGenerator->field_repeatable($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'user' ){
|
||||
echo $FormFieldsGenerator->field_user($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'margin' ){
|
||||
echo $FormFieldsGenerator->field_margin($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'padding' ){
|
||||
echo $FormFieldsGenerator->field_padding($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'border' ){
|
||||
echo $FormFieldsGenerator->field_border($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switcher' ){
|
||||
echo $FormFieldsGenerator->field_switcher($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'password' ){
|
||||
echo $FormFieldsGenerator->field_password($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'post_objects' ){
|
||||
echo $FormFieldsGenerator->field_post_objects($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'google_map' ){
|
||||
echo $FormFieldsGenerator->field_google_map($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'image_link' ){
|
||||
echo $FormFieldsGenerator->field_image_link($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'option_group_accordion' ){
|
||||
echo $FormFieldsGenerator->field_option_group_accordion($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'option_group_tabs' ){
|
||||
echo $FormFieldsGenerator->field_option_group_tabs($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'option_group' ){
|
||||
echo $FormFieldsGenerator->field_option_group($option);
|
||||
}
|
||||
|
||||
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === $type ){
|
||||
do_action( "wp_theme_settings_field_$type", $option );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function generate_field_text( $option ){
|
||||
|
||||
$prent_option_name = $this->get_option_name();
|
||||
|
||||
$id = isset( $option['id'] ) ? $option['id'] : "";
|
||||
$placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
|
||||
$default = isset( $option['default'] ) ? $option['default'] : "";
|
||||
|
||||
|
||||
|
||||
|
||||
if($prent_option_name):
|
||||
$field_name = $prent_option_name.'['.$id.']';
|
||||
|
||||
$prent_option_value = get_option( $prent_option_name );
|
||||
$value = $prent_option_value[$id];
|
||||
else:
|
||||
$field_name = $id;
|
||||
$value = get_option( $id );
|
||||
endif;
|
||||
|
||||
$value = !empty($value) ? $value : $default;
|
||||
|
||||
|
||||
|
||||
echo "<input type='text' name='$field_name' id='$id' placeholder='$placeholder' value='$value' />";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function whitelist_options( $whitelist_options ){
|
||||
$prent_option_name = $this->get_option_name();
|
||||
|
||||
if($prent_option_name):
|
||||
$whitelist_options[$this->get_menu_slug()][] = $prent_option_name;
|
||||
else:
|
||||
foreach( $this->get_pages() as $page_id => $page ): foreach( $page['page_settings'] as $section ):
|
||||
foreach( $section['options'] as $option ):
|
||||
$whitelist_options[$this->get_menu_slug()][] = $option['id'];
|
||||
endforeach; endforeach;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
update_option('whitelist_options',$whitelist_options );
|
||||
|
||||
return $whitelist_options;
|
||||
}
|
||||
|
||||
public function display_function(){
|
||||
|
||||
?>
|
||||
<div class='wrap ppof-settings'>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
parse_str( $_SERVER['QUERY_STRING'], $nav_menu_url_args );
|
||||
global $pagenow;
|
||||
|
||||
|
||||
settings_errors();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class='navigation'>
|
||||
|
||||
<div class="nav-header">
|
||||
<?php
|
||||
do_action('nav_header_top');
|
||||
?>
|
||||
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
|
||||
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
|
||||
<?php
|
||||
do_action('nav_header_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<ul class="nav-items">
|
||||
<?php
|
||||
|
||||
//$current_page = isset($_GET['page'])? $_GET['page'] : '';
|
||||
$current_page = $this->get_current_page();
|
||||
|
||||
foreach( $this->get_pages() as $page_id => $page ):
|
||||
|
||||
$page_settings = !empty($page['page_settings']) ? $page['page_settings'] : array();
|
||||
|
||||
|
||||
$page_settings_count = count($page_settings);
|
||||
//var_dump($page_settings);
|
||||
?>
|
||||
<li class="nav-item-wrap <?php if(($page_settings_count > 1)) echo 'has-child'; ?> <?php if($current_page==$page_id) echo 'active'; ?>">
|
||||
<a dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
|
||||
$page_id; ?>' class='nav-item'><?php echo $page['page_nav']; ?>
|
||||
|
||||
<?php if(($page_settings_count > 1)) echo '<i class="child-nav-icon fas fa-angle-down"></i>'; ?>
|
||||
</a>
|
||||
<?php
|
||||
if(($page_settings_count > 1)):
|
||||
?>
|
||||
<ul class="child-navs">
|
||||
<?php
|
||||
foreach ($page_settings as $section_id=>$nav_sections):
|
||||
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
|
||||
|
||||
//var_dump($nav_sections_title);
|
||||
?>
|
||||
<li>
|
||||
|
||||
<a sectionId="<?php echo $section_id; ?>" dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
|
||||
$page_id; ?>' class='nav-item <?php if($current_page==$page_id) echo 'active'; ?>'><?php echo $nav_sections_title; ?>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</li>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="nav-footer">
|
||||
<?php
|
||||
do_action('nav_footer_top');
|
||||
?>
|
||||
|
||||
<?php
|
||||
do_action('nav_footer_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-wrapper">
|
||||
|
||||
<script>jQuery(document).ready(function($){
|
||||
|
||||
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<form class="" action='options.php' method='post'>
|
||||
<div class="form-header">
|
||||
<div class="pp-row">
|
||||
<div class="pp-col pp-col-50">
|
||||
<div class="pagename"> # <?php echo $this->get_menu_page_title(); ?></div>
|
||||
</div>
|
||||
<div class="pp-col pp-col-50 text-align-right">
|
||||
<!-- <input type="search" class="search-options" placeholder="Search Option..." value="">-->
|
||||
|
||||
<!-- <input type="submit" value="Reset" class="button button-secondary reset-options">-->
|
||||
<?php submit_button(null,'primary', null, false); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<?php
|
||||
|
||||
$current_page = $this->get_current_page();
|
||||
|
||||
|
||||
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
?>
|
||||
<div id="<?php echo $panelsIndex; ?>" class="tab-content <?php if($current_page==$panelsIndex) echo 'active'; ?> tab-content-<?php echo
|
||||
$panelsIndex;
|
||||
?>">
|
||||
<?php
|
||||
do_settings_sections( $panelsIndex);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
settings_fields( $this->get_menu_slug() );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-footer">
|
||||
|
||||
<div class="pp-row">
|
||||
<div class="pp-col pp-col-50">
|
||||
<div class=""></div>
|
||||
<span>Developed by : <a class="" href="http://mage-people.com">MagePeople Inc.</a> | Version: 1.0.0</span>
|
||||
</div>
|
||||
<div class="pp-col pp-col-50 text-align-right">
|
||||
<?php submit_button(null,'primary', null, false); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Default Functions
|
||||
|
||||
|
||||
|
||||
public function get_current_page(){
|
||||
|
||||
$current_page = isset($_GET['page'])? $_GET['page'] : '';
|
||||
|
||||
$pages = array();
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
|
||||
$pages[] = $panelsIndex;
|
||||
|
||||
endforeach;
|
||||
|
||||
|
||||
// var_dump($pages);
|
||||
|
||||
foreach ($pages as $page):
|
||||
if($current_page == $page){
|
||||
$_current_page = $page;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
$_current_page = $pages[0];
|
||||
}
|
||||
endforeach;
|
||||
|
||||
return $_current_page;
|
||||
|
||||
}
|
||||
|
||||
private function get_item_name(){
|
||||
if( isset( $this->data['item_name'] ) ) return $this->data['item_name'];
|
||||
else return "PickPlugins";
|
||||
}
|
||||
|
||||
private function get_item_version(){
|
||||
if( isset( $this->data['item_version'] ) ) return $this->data['item_version'];
|
||||
else return "1.0.0";
|
||||
}
|
||||
|
||||
|
||||
private function get_menu_type(){
|
||||
if( isset( $this->data['menu_type'] ) ) return $this->data['menu_type'];
|
||||
else return "main";
|
||||
}
|
||||
private function get_pages(){
|
||||
if( isset( $this->data['panels'] ) ) return $this->data['panels'];
|
||||
else return array();
|
||||
}
|
||||
|
||||
private function get_settings_name(){
|
||||
if( isset( $this->data['settings_name'] ) ) return $this->data['settings_name'];
|
||||
else return "my_custom_settings";
|
||||
}
|
||||
private function get_menu_icon(){
|
||||
if( isset( $this->data['menu_icon'] ) ) return $this->data['menu_icon'];
|
||||
else return "";
|
||||
}
|
||||
private function get_menu_slug(){
|
||||
if( isset( $this->data['menu_slug'] ) ) return $this->data['menu_slug'];
|
||||
else return "my-custom-settings";
|
||||
}
|
||||
private function get_capability(){
|
||||
if( isset( $this->data['capability'] ) ) return $this->data['capability'];
|
||||
else return "manage_options";
|
||||
}
|
||||
private function get_menu_page_title(){
|
||||
if( isset( $this->data['menu_page_title'] ) ) return $this->data['menu_page_title'];
|
||||
else return "My Custom Menu";
|
||||
}
|
||||
private function get_menu_name(){
|
||||
if( isset( $this->data['menu_name'] ) ) return $this->data['menu_name'];
|
||||
else return "Menu Name";
|
||||
}
|
||||
private function get_menu_title(){
|
||||
if( isset( $this->data['menu_title'] ) ) return $this->data['menu_title'];
|
||||
else return "Menu Title";
|
||||
}
|
||||
private function get_page_title(){
|
||||
if( isset( $this->data['page_title'] ) ) return $this->data['page_title'];
|
||||
else return "Page Title";
|
||||
}
|
||||
private function add_in_menu(){
|
||||
if( isset( $this->data['add_in_menu'] ) && $this->data['add_in_menu'] ) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
private function get_option_name(){
|
||||
if( isset( $this->data['option_name'] )) return $this->data['option_name'];
|
||||
else return false;
|
||||
}
|
||||
|
||||
private function get_option_id(){
|
||||
if( isset( $this->data['option_id'] ) && $this->data['option_id'] ) return $this->data['option_id'];
|
||||
else return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,527 @@
|
|||
<?php
|
||||
if ( ! defined('ABSPATH')) exit; // if direct access
|
||||
|
||||
|
||||
if( ! class_exists( 'AddMetaBox' ) ) {
|
||||
|
||||
class AddMetaBox {
|
||||
|
||||
public $data = array();
|
||||
|
||||
public function __construct( $args ){
|
||||
|
||||
$this->data = &$args;
|
||||
|
||||
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 12 );
|
||||
add_action( 'save_post', array( $this, 'save_post' ), 12 );
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function add_meta_boxes(){
|
||||
|
||||
|
||||
add_meta_box($this->get_meta_box_id(),$this->get_meta_box_title(),array( $this, 'meta_box_callback' ),
|
||||
$this->get_meta_box_screen(), $this->get_meta_box_context(), $this->get_meta_box_priority(),$this->get_callback_args());
|
||||
}
|
||||
|
||||
|
||||
public function save_post($post_id){
|
||||
|
||||
$get_option_name = $this->get_option_name();
|
||||
$post_id = $this->get_post_id();
|
||||
|
||||
if(!empty($get_option_name)):
|
||||
$option_value = serialize($_POST[$get_option_name]);
|
||||
|
||||
update_post_meta($post_id, $get_option_name, $option_value);
|
||||
|
||||
|
||||
else:
|
||||
|
||||
foreach ($this->get_panels() as $panelsIndex=>$panel):
|
||||
foreach ($panel['sections'] as $sectionIndex=>$section):
|
||||
foreach ($section['options'] as $option):
|
||||
|
||||
$option_value = isset($_POST[$option['id']]) ? $_POST[$option['id']] : '';
|
||||
|
||||
if(is_array($option_value)){
|
||||
$option_value = serialize($option_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
update_post_meta($post_id, $option['id'], $option_value);
|
||||
|
||||
endforeach;
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function meta_box_callback(){
|
||||
|
||||
$get_nav_position = $this->get_nav_position();
|
||||
|
||||
//var_dump($get_nav_position);
|
||||
?>
|
||||
|
||||
<div class='wrap ppof-settings ppof-metabox'>
|
||||
<div class='navigation <?php echo $get_nav_position; ?>'>
|
||||
|
||||
<div class="nav-header">
|
||||
<?php
|
||||
do_action('nav_header_top');
|
||||
?>
|
||||
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
|
||||
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
|
||||
<?php
|
||||
do_action('nav_header_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="nav-items">
|
||||
<?php
|
||||
do_action('nav_nav_items_top');
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
$current_page = 1;
|
||||
foreach( $this->get_panels() as $page_id => $page ):
|
||||
|
||||
|
||||
$page_settings = !empty($page['sections']) ? $page['sections'] : array();
|
||||
|
||||
|
||||
$page_settings_count = count($page_settings);
|
||||
//var_dump($page_settings);
|
||||
?>
|
||||
<li class="nav-item-wrap <?php if(($page_settings_count > 1)) echo 'has-child'; ?> <?php if($current_page==$page_id) echo 'active'; ?>">
|
||||
<a dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$section_id; ?><?php echo
|
||||
$page_id; ?>' class='nav-item'><?php echo $page['page_nav']; ?>
|
||||
|
||||
<?php if(($page_settings_count > 1)) echo '<i class="child-nav-icon fas fa-angle-down"></i>'; ?>
|
||||
</a>
|
||||
<?php
|
||||
if(($page_settings_count > 1)):
|
||||
?>
|
||||
<ul class="child-navs">
|
||||
<?php
|
||||
foreach ($page_settings as $section_id=>$nav_sections):
|
||||
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
|
||||
|
||||
//var_dump($nav_sections_title);
|
||||
?>
|
||||
<li>
|
||||
|
||||
<a sectionId="<?php echo $section_id; ?>" dataid="<?php echo $page_id; ?>" href='#<?php echo $section_id; ?>' class='nav-item <?php if($current_page==$page_id) echo 'active'; ?>'><?php echo $nav_sections_title; ?>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</li>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
$current_page++;
|
||||
endforeach;
|
||||
?>
|
||||
<?php
|
||||
do_action('nav_nav_items_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="nav-footer">
|
||||
<?php
|
||||
do_action('nav_footer_top');
|
||||
?>
|
||||
|
||||
<?php
|
||||
do_action('nav_footer_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if($get_nav_position == 'right'){
|
||||
$form_wrapper_position = 'left';
|
||||
}
|
||||
elseif($get_nav_position == 'left'){
|
||||
$form_wrapper_position = 'right';
|
||||
}
|
||||
elseif($get_nav_position == 'top'){
|
||||
$form_wrapper_position = 'full-width-top';
|
||||
}
|
||||
else{
|
||||
$form_wrapper_position = 'full-width';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="form-wrapper <?php echo $form_wrapper_position; ?>">
|
||||
|
||||
<div class="form-section">
|
||||
<?php
|
||||
|
||||
$current_page = 1;
|
||||
|
||||
foreach ($this->get_panels() as $panelsIndex=>$panel):
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<div class="tab-content <?php if($current_page==1) echo 'active'; ?> tab-content-<?php
|
||||
echo $panelsIndex; ?>">
|
||||
<?php
|
||||
foreach ($panel['sections'] as $sectionIndex=>$section):
|
||||
?>
|
||||
<div class="section">
|
||||
<h1 id="<?php echo $sectionIndex; ?>" class="section-title"><?php echo $section['title']; ?></h1>
|
||||
<p class="description"><?php echo $section['description']; ?></p>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
foreach ($section['options'] as $option):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $option['title']; ?></th>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$option_value = get_post_meta($this->get_post_id(), $option['id'], true);
|
||||
|
||||
if(is_serialized($option_value)){
|
||||
$option_value = unserialize($option_value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
$option['value'] = $option_value;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$this->field_generator($option)
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$current_page++;
|
||||
endforeach;
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function field_generator( $option ) {
|
||||
|
||||
$id = isset( $option['id'] ) ? $option['id'] : "";
|
||||
$type = isset( $option['type'] ) ? $option['type'] : "";
|
||||
$details = isset( $option['details'] ) ? $option['details'] : "";
|
||||
|
||||
$post_id = $this->get_post_id();
|
||||
|
||||
if( empty( $id ) ) return;
|
||||
|
||||
$prent_option_name = $this->get_option_name();
|
||||
$FormFieldsGenerator = new FormFieldsGenerator();
|
||||
|
||||
if(!empty($prent_option_name)):
|
||||
$field_name = $prent_option_name.'['.$id.']';
|
||||
$option['field_name'] = $field_name;
|
||||
|
||||
$prent_option_value = get_post_meta($post_id, $prent_option_name, true );
|
||||
|
||||
$prent_option_value = is_serialized($prent_option_value) ? unserialize($prent_option_value): array();
|
||||
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
|
||||
else:
|
||||
$option['field_name'] = $id;
|
||||
$option_value = get_post_meta($post_id, $id, true );
|
||||
$option['value'] = is_serialized($option_value) ? unserialize($option_value): $option_value;
|
||||
|
||||
endif;
|
||||
|
||||
|
||||
//var_dump($prent_option_value);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if( isset($option['type']) && $option['type'] === 'text' ){
|
||||
echo $FormFieldsGenerator->field_text($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
|
||||
echo $FormFieldsGenerator->field_text_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
|
||||
echo $FormFieldsGenerator->field_textarea($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
|
||||
echo $FormFieldsGenerator->field_checkbox($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox_multi' ){
|
||||
echo $FormFieldsGenerator->field_checkbox_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'radio' ){
|
||||
echo $FormFieldsGenerator->field_radio($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select' ){
|
||||
echo $FormFieldsGenerator->field_select($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range' ){
|
||||
echo $FormFieldsGenerator->field_range($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
|
||||
echo $FormFieldsGenerator->field_range_input($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch' ){
|
||||
echo $FormFieldsGenerator->field_switch($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
|
||||
echo $FormFieldsGenerator->field_switch_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
|
||||
echo $FormFieldsGenerator->field_switch_img($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
|
||||
echo $FormFieldsGenerator->field_time_format($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
|
||||
echo $FormFieldsGenerator->field_date_format($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
|
||||
echo $FormFieldsGenerator->field_datepicker($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_sets' ){
|
||||
echo $FormFieldsGenerator->field_color_sets($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
|
||||
echo $FormFieldsGenerator->field_link_color($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon' ){
|
||||
echo $FormFieldsGenerator->field_icon($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
|
||||
echo $FormFieldsGenerator->field_icon_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
|
||||
echo $FormFieldsGenerator->field_dimensions($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
|
||||
echo $FormFieldsGenerator->field_wp_editor($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select2' ){
|
||||
echo $FormFieldsGenerator->field_select2($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'faq' ){
|
||||
echo $FormFieldsGenerator->field_faq($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'grid' ){
|
||||
echo $FormFieldsGenerator->field_grid($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
|
||||
echo $FormFieldsGenerator->field_color_palette($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
|
||||
echo $FormFieldsGenerator->field_color_palette_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media' ){
|
||||
echo $FormFieldsGenerator->field_media($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
|
||||
echo $FormFieldsGenerator->field_media_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
|
||||
echo $FormFieldsGenerator->field_repeatable($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'user' ){
|
||||
echo $FormFieldsGenerator->field_user($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'margin' ){
|
||||
echo $FormFieldsGenerator->field_margin($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'padding' ){
|
||||
echo $FormFieldsGenerator->field_padding($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'border' ){
|
||||
echo $FormFieldsGenerator->field_border($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switcher' ){
|
||||
echo $FormFieldsGenerator->field_switcher($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'password' ){
|
||||
echo $FormFieldsGenerator->field_password($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'post_objects' ){
|
||||
echo $FormFieldsGenerator->field_post_objects($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'google_map' ){
|
||||
echo $FormFieldsGenerator->field_google_map($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === $type ){
|
||||
do_action( "wp_theme_settings_field_$type", $option );
|
||||
}
|
||||
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function get_meta_box_id(){
|
||||
if( isset( $this->data['meta_box_id'] ) ) return $this->data['meta_box_id'];
|
||||
else return "";
|
||||
}
|
||||
|
||||
private function get_meta_box_title(){
|
||||
if( isset( $this->data['meta_box_title'] ) ) return $this->data['meta_box_title'];
|
||||
else return "";
|
||||
}
|
||||
|
||||
private function get_meta_box_screen(){
|
||||
if( isset( $this->data['screen'] ) ) return $this->data['screen'];
|
||||
else return array('post');
|
||||
}
|
||||
|
||||
private function get_meta_box_context(){
|
||||
if( isset( $this->data['context'] ) ) return $this->data['context'];
|
||||
else return 'normal';
|
||||
}
|
||||
|
||||
private function get_meta_box_priority(){
|
||||
if( isset( $this->data['priority'] ) ) return $this->data['priority'];
|
||||
else return "high";
|
||||
}
|
||||
|
||||
private function get_callback_args(){
|
||||
if( isset( $this->data['callback_args'] ) ) return $this->data['callback_args'];
|
||||
else return array();
|
||||
}
|
||||
|
||||
private function get_panels(){
|
||||
if( isset( $this->data['panels'] ) ) return $this->data['panels'];
|
||||
else return array();
|
||||
}
|
||||
|
||||
|
||||
private function get_item_name(){
|
||||
if( isset( $this->data['item_name'] ) ) return $this->data['item_name'];
|
||||
else return "PickPlugins";
|
||||
}
|
||||
|
||||
private function get_item_version(){
|
||||
if( isset( $this->data['item_version'] ) ) return $this->data['item_version'];
|
||||
else return "1.0.0";
|
||||
}
|
||||
|
||||
private function get_option_name(){
|
||||
if( isset( $this->data['option_name'] )) return $this->data['option_name'];
|
||||
else return false;
|
||||
}
|
||||
|
||||
private function get_nav_position(){
|
||||
if( isset( $this->data['nav_position'] )) return $this->data['nav_position'];
|
||||
else return 'left';
|
||||
}
|
||||
|
||||
|
||||
private function get_post_id(){
|
||||
|
||||
$post_id = get_the_ID();
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,284 @@
|
|||
<?php
|
||||
if ( ! defined('ABSPATH')) exit; // if direct access
|
||||
|
||||
|
||||
if( ! class_exists( 'TaxonomyEdit' ) ) {
|
||||
|
||||
class TaxonomyEdit {
|
||||
|
||||
public $data = array();
|
||||
|
||||
public function __construct( $args ){
|
||||
|
||||
$this->data = &$args;
|
||||
|
||||
add_action( $this->get_taxonomy().'_add_form_fields', array( $this, 'add_form_fields' ), 12 );
|
||||
add_action( $this->get_taxonomy().'_edit_form_fields', array( $this, 'edit_form_fields' ), 12 );
|
||||
|
||||
add_action( 'edited_'.$this->get_taxonomy(), array( $this, 'save_update_taxonomy' ), 12 );
|
||||
add_action( 'create_'.$this->get_taxonomy(), array( $this, 'save_update_taxonomy' ), 12 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function save_update_taxonomy($term_id){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($this->get_panels() as $optionIndex=>$option):
|
||||
|
||||
|
||||
|
||||
$option_value = isset($_POST[$option['id']]) ? $_POST[$option['id']] : '';
|
||||
|
||||
if(is_array($option_value)){
|
||||
$option_value = serialize($option_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
update_term_meta($term_id, $option['id'], $option_value);
|
||||
|
||||
endforeach;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function edit_form_fields($term){
|
||||
|
||||
$term_id = $term->term_id;
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
foreach ($this->get_panels() as $optionIndex=>$option):
|
||||
|
||||
//var_dump($option);
|
||||
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top"><label for="<?php echo $option['id']; ?>"><?php echo $option['title']; ?></label></th>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$this->field_generator($option, $term_id)
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function add_form_fields($term){
|
||||
|
||||
$term_id = '';
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
foreach ($this->get_panels() as $optionIndex=>$option):
|
||||
|
||||
?>
|
||||
<tr class="form-field">
|
||||
<th scope="row" valign="top"><label for="<?php echo $option['id']; ?>"><?php echo $option['title']; ?></label></th>
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$this->field_generator($option, $term_id)
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function field_generator( $option, $term_id ) {
|
||||
|
||||
$id = isset( $option['id'] ) ? $option['id'] : "";
|
||||
$type = isset( $option['type'] ) ? $option['type'] : "";
|
||||
$details = isset( $option['details'] ) ? $option['details'] : "";
|
||||
|
||||
if( empty( $id ) ) return;
|
||||
|
||||
$FormFieldsGenerator = new FormFieldsGenerator();
|
||||
|
||||
$option['field_name'] = $id;
|
||||
$option_value = get_term_meta($term_id, $id, true );
|
||||
$option['value'] = is_serialized($option_value) ? unserialize($option_value): $option_value;
|
||||
|
||||
|
||||
if( isset($option['type']) && $option['type'] === 'text' ){
|
||||
echo $FormFieldsGenerator->field_text($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
|
||||
echo $FormFieldsGenerator->field_text_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
|
||||
echo $FormFieldsGenerator->field_textarea($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
|
||||
echo $FormFieldsGenerator->field_checkbox($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'radio' ){
|
||||
echo $FormFieldsGenerator->field_radio($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select' ){
|
||||
echo $FormFieldsGenerator->field_select($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range' ){
|
||||
echo $FormFieldsGenerator->field_range($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
|
||||
echo $FormFieldsGenerator->field_range_input($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch' ){
|
||||
echo $FormFieldsGenerator->field_switch($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
|
||||
echo $FormFieldsGenerator->field_switch_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
|
||||
echo $FormFieldsGenerator->field_switch_img($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
|
||||
echo $FormFieldsGenerator->field_time_format($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
|
||||
echo $FormFieldsGenerator->field_date_format($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
|
||||
echo $FormFieldsGenerator->field_datepicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
|
||||
echo $FormFieldsGenerator->field_link_color($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon' ){
|
||||
echo $FormFieldsGenerator->field_icon($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
|
||||
echo $FormFieldsGenerator->field_icon_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
|
||||
echo $FormFieldsGenerator->field_dimensions($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
|
||||
echo $FormFieldsGenerator->field_wp_editor($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select2' ){
|
||||
echo $FormFieldsGenerator->field_select2($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'faq' ){
|
||||
echo $FormFieldsGenerator->field_faq($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'grid' ){
|
||||
echo $FormFieldsGenerator->field_grid($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
|
||||
echo $FormFieldsGenerator->field_color_palette($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
|
||||
echo $FormFieldsGenerator->field_color_palette_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media' ){
|
||||
echo $FormFieldsGenerator->field_media($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
|
||||
echo $FormFieldsGenerator->field_media_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
|
||||
echo $FormFieldsGenerator->field_repeatable($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'user' ){
|
||||
echo $FormFieldsGenerator->field_user($option);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === $type ){
|
||||
do_action( "wp_theme_settings_field_$type", $option );
|
||||
}
|
||||
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function get_taxonomy(){
|
||||
if( isset( $this->data['taxonomy'] ) ) return $this->data['taxonomy'];
|
||||
else return "category";
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function get_panels(){
|
||||
if( isset( $this->data['options'] ) ) return $this->data['options'];
|
||||
else return array();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function get_tax_id(){
|
||||
|
||||
//$post_id = get_the_ID();
|
||||
//return $post_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,560 @@
|
|||
<?php
|
||||
/*
|
||||
* @Author : PickPlugins
|
||||
* Copyright : 2015 PickPlugins.com
|
||||
*
|
||||
* Version : 1.0.3
|
||||
*/
|
||||
|
||||
if ( ! defined('ABSPATH')) exit; // if direct access
|
||||
|
||||
|
||||
if( ! class_exists( 'AddThemePage' ) ) {
|
||||
class AddThemePage {
|
||||
|
||||
public $data = array();
|
||||
|
||||
public function __construct( $args ){
|
||||
|
||||
$this->data = &$args;
|
||||
|
||||
if( $this->add_in_menu() ) {
|
||||
add_action( 'admin_menu', array( $this, 'add_menu_in_admin_menu' ), 12 );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', array( $this, 'display_fields' ), 12 );
|
||||
add_filter( 'whitelist_options', array( $this, 'whitelist_options' ), 99, 1 );
|
||||
}
|
||||
|
||||
public function add_menu_in_admin_menu(){
|
||||
|
||||
if( "main" == $this->get_menu_type() ) {
|
||||
add_theme_page( $this->get_menu_name(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ), $this->get_menu_icon() );
|
||||
}
|
||||
|
||||
if( "sub" == $this->get_menu_type() ) {
|
||||
add_submenu_page($this->data['cpt_menu'], $this->get_menu_title(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function section_callback( $section ) {
|
||||
|
||||
$section_id = $section['id'];
|
||||
//var_dump($section_id);
|
||||
|
||||
|
||||
$data = isset( $section['callback'][0]->data ) ? $section['callback'][0]->data : array();
|
||||
|
||||
|
||||
|
||||
//$description = $section['description'];
|
||||
|
||||
$description = $section['id'] ;
|
||||
echo '<div id="'.$section['id'].'"></div>';
|
||||
}
|
||||
|
||||
public function display_fields() {
|
||||
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
|
||||
//var_dump($panelsIndex);
|
||||
|
||||
foreach ($panels['page_settings'] as $sectionIndex=>$sections):
|
||||
|
||||
add_settings_section(
|
||||
$sectionIndex,
|
||||
isset( $sections['title'] ) ? $sections['title'] : "",
|
||||
array( $this, 'section_callback'),
|
||||
$panelsIndex
|
||||
);
|
||||
|
||||
foreach( $sections['options'] as $option ) :
|
||||
|
||||
add_settings_field( $option['id'], $option['title'], array($this,'field_generator'), $panelsIndex, $sectionIndex, $option );
|
||||
|
||||
endforeach;
|
||||
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function field_generator( $option ) {
|
||||
|
||||
$id = isset( $option['id'] ) ? $option['id'] : "";
|
||||
$type = isset( $option['type'] ) ? $option['type'] : "";
|
||||
$details = isset( $option['details'] ) ? $option['details'] : "";
|
||||
|
||||
if( empty( $id ) ) return;
|
||||
|
||||
$FormFieldsGenerator = array();
|
||||
$prent_option_name = $this->get_option_name();
|
||||
$FormFieldsGenerator = new FormFieldsGenerator();
|
||||
|
||||
if(!empty($prent_option_name)):
|
||||
$field_name = $prent_option_name.'['.$id.']';
|
||||
$option['field_name'] = $field_name;
|
||||
|
||||
$prent_option_value = get_option( $prent_option_name );
|
||||
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
|
||||
else:
|
||||
$option['field_name'] = $id;
|
||||
$option['value'] = get_option( $id );
|
||||
endif;
|
||||
|
||||
|
||||
?>
|
||||
<?php
|
||||
|
||||
|
||||
if( isset($option['type']) && $option['type'] === 'text' ){
|
||||
echo $FormFieldsGenerator->field_text($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
|
||||
echo $FormFieldsGenerator->field_text_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
|
||||
echo $FormFieldsGenerator->field_textarea($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
|
||||
echo $FormFieldsGenerator->field_checkbox($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'checkbox_multi' ){
|
||||
echo $FormFieldsGenerator->field_checkbox_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'radio' ){
|
||||
echo $FormFieldsGenerator->field_radio($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select' ){
|
||||
echo $FormFieldsGenerator->field_select($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range' ){
|
||||
echo $FormFieldsGenerator->field_range($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
|
||||
echo $FormFieldsGenerator->field_range_input($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch' ){
|
||||
echo $FormFieldsGenerator->field_switch($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
|
||||
echo $FormFieldsGenerator->field_switch_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
|
||||
echo $FormFieldsGenerator->field_switch_img($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
|
||||
echo $FormFieldsGenerator->field_time_format($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
|
||||
echo $FormFieldsGenerator->field_date_format($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
|
||||
echo $FormFieldsGenerator->field_datepicker($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_sets' ){
|
||||
echo $FormFieldsGenerator->field_color_sets($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker($option);
|
||||
}
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
|
||||
echo $FormFieldsGenerator->field_colorpicker_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
|
||||
echo $FormFieldsGenerator->field_link_color($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon' ){
|
||||
echo $FormFieldsGenerator->field_icon($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
|
||||
echo $FormFieldsGenerator->field_icon_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
|
||||
echo $FormFieldsGenerator->field_dimensions($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
|
||||
echo $FormFieldsGenerator->field_wp_editor($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'select2' ){
|
||||
echo $FormFieldsGenerator->field_select2($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'faq' ){
|
||||
echo $FormFieldsGenerator->field_faq($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'grid' ){
|
||||
echo $FormFieldsGenerator->field_grid($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
|
||||
echo $FormFieldsGenerator->field_color_palette($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
|
||||
echo $FormFieldsGenerator->field_color_palette_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media' ){
|
||||
echo $FormFieldsGenerator->field_media($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
|
||||
echo $FormFieldsGenerator->field_media_multi($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
|
||||
echo $FormFieldsGenerator->field_repeatable($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'user' ){
|
||||
echo $FormFieldsGenerator->field_user($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'margin' ){
|
||||
echo $FormFieldsGenerator->field_margin($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'padding' ){
|
||||
echo $FormFieldsGenerator->field_padding($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'border' ){
|
||||
echo $FormFieldsGenerator->field_border($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'switcher' ){
|
||||
echo $FormFieldsGenerator->field_switcher($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'password' ){
|
||||
echo $FormFieldsGenerator->field_password($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'post_objects' ){
|
||||
echo $FormFieldsGenerator->field_post_objects($option);
|
||||
}
|
||||
elseif( isset($option['type']) && $option['type'] === 'google_map' ){
|
||||
echo $FormFieldsGenerator->field_google_map($option);
|
||||
}
|
||||
|
||||
|
||||
elseif( isset($option['type']) && $option['type'] === $type ){
|
||||
do_action( "wp_theme_settings_field_$type", $option );
|
||||
}
|
||||
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function whitelist_options( $whitelist_options ){
|
||||
$prent_option_name = $this->get_option_name();
|
||||
|
||||
if($prent_option_name):
|
||||
$whitelist_options[$this->get_menu_slug()][] = $prent_option_name;
|
||||
else:
|
||||
foreach( $this->get_pages() as $page_id => $page ): foreach( $page['page_settings'] as $section ):
|
||||
foreach( $section['options'] as $option ):
|
||||
$whitelist_options[$this->get_menu_slug()][] = $option['id'];
|
||||
endforeach; endforeach;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
|
||||
update_option('whitelist_options',$whitelist_options );
|
||||
|
||||
return $whitelist_options;
|
||||
}
|
||||
|
||||
public function display_function(){
|
||||
|
||||
?>
|
||||
<div class='wrap ppof-settings'>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
parse_str( $_SERVER['QUERY_STRING'], $nav_menu_url_args );
|
||||
global $pagenow;
|
||||
|
||||
|
||||
settings_errors();
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class='navigation'>
|
||||
|
||||
<div class="nav-header">
|
||||
<?php
|
||||
do_action('nav_header_top');
|
||||
?>
|
||||
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
|
||||
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
|
||||
<?php
|
||||
do_action('nav_header_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
<ul class="nav-items">
|
||||
<?php
|
||||
|
||||
//$current_page = isset($_GET['page'])? $_GET['page'] : '';
|
||||
$current_page = $this->get_current_page();
|
||||
|
||||
foreach( $this->get_pages() as $page_id => $page ):
|
||||
|
||||
$page_settings = !empty($page['page_settings']) ? $page['page_settings'] : array();
|
||||
|
||||
|
||||
$page_settings_count = count($page_settings);
|
||||
//var_dump($page_settings);
|
||||
?>
|
||||
<li class="nav-item-wrap <?php if(($page_settings_count > 1)) echo 'has-child'; ?> <?php if($current_page==$page_id) echo 'active'; ?>">
|
||||
<a dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
|
||||
$page_id; ?>' class='nav-item'><?php echo $page['page_nav']; ?>
|
||||
|
||||
<?php if(($page_settings_count > 1)) echo '<i class="child-nav-icon fas fa-angle-down"></i>'; ?>
|
||||
</a>
|
||||
<?php
|
||||
if(($page_settings_count > 1)):
|
||||
?>
|
||||
<ul class="child-navs">
|
||||
<?php
|
||||
foreach ($page_settings as $section_id=>$nav_sections):
|
||||
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
|
||||
|
||||
//var_dump($nav_sections_title);
|
||||
?>
|
||||
<li>
|
||||
|
||||
<a sectionId="<?php echo $section_id; ?>" dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
|
||||
$page_id; ?>' class='nav-item <?php if($current_page==$page_id) echo 'active'; ?>'><?php echo $nav_sections_title; ?>
|
||||
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
</li>
|
||||
<?php
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
</ul>
|
||||
|
||||
<div class="nav-footer">
|
||||
<?php
|
||||
do_action('nav_footer_top');
|
||||
?>
|
||||
|
||||
<?php
|
||||
do_action('nav_footer_bottom');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-wrapper">
|
||||
|
||||
|
||||
|
||||
|
||||
<form class="" action='options.php' method='post'>
|
||||
<div class="form-header">
|
||||
<div class="pp-row">
|
||||
<div class="pp-col pp-col-50">
|
||||
<div class="pagename"> # <?php echo $this->get_menu_page_title(); ?></div>
|
||||
</div>
|
||||
<div class="pp-col pp-col-50 text-align-right">
|
||||
<?php submit_button(null,'primary', null, false); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<?php
|
||||
|
||||
$current_page = $this->get_current_page();
|
||||
|
||||
|
||||
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
?>
|
||||
<div class="tab-content <?php if($current_page==$panelsIndex) echo 'active'; ?> tab-content-<?php echo
|
||||
$panelsIndex;
|
||||
?>">
|
||||
<?php
|
||||
do_settings_sections( $panelsIndex);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
|
||||
endforeach;
|
||||
|
||||
settings_fields( $this->get_menu_slug() );
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-footer">
|
||||
|
||||
<div class="pp-row">
|
||||
<div class="pp-col pp-col-50">
|
||||
<div class=""></div>
|
||||
<span>Developed by : <a class="" href="http://mage-people.com">MagePeople Inc.</a> | Version: 1.0.0</span>
|
||||
</div>
|
||||
<div class="pp-col pp-col-50 text-align-right">
|
||||
<?php submit_button(null,'primary', null, false); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
// Default Functions
|
||||
|
||||
|
||||
|
||||
public function get_current_page(){
|
||||
|
||||
$current_page = isset($_GET['page'])? $_GET['page'] : '';
|
||||
|
||||
$pages = array();
|
||||
foreach ($this->get_pages() as $panelsIndex=>$panels):
|
||||
|
||||
$pages[] = $panelsIndex;
|
||||
|
||||
endforeach;
|
||||
|
||||
|
||||
// var_dump($pages);
|
||||
|
||||
foreach ($pages as $page):
|
||||
if($current_page == $page){
|
||||
$_current_page = $page;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
$_current_page = $pages[0];
|
||||
}
|
||||
endforeach;
|
||||
|
||||
return $_current_page;
|
||||
|
||||
}
|
||||
|
||||
private function get_item_name(){
|
||||
if( isset( $this->data['item_name'] ) ) return $this->data['item_name'];
|
||||
else return "PickPlugins";
|
||||
}
|
||||
|
||||
private function get_item_version(){
|
||||
if( isset( $this->data['item_version'] ) ) return $this->data['item_version'];
|
||||
else return "1.0.0";
|
||||
}
|
||||
|
||||
|
||||
private function get_menu_type(){
|
||||
if( isset( $this->data['menu_type'] ) ) return $this->data['menu_type'];
|
||||
else return "main";
|
||||
}
|
||||
private function get_pages(){
|
||||
if( isset( $this->data['panels'] ) ) return $this->data['panels'];
|
||||
else return array();
|
||||
}
|
||||
|
||||
private function get_settings_name(){
|
||||
if( isset( $this->data['settings_name'] ) ) return $this->data['settings_name'];
|
||||
else return "my_custom_settings";
|
||||
}
|
||||
private function get_menu_icon(){
|
||||
if( isset( $this->data['menu_icon'] ) ) return $this->data['menu_icon'];
|
||||
else return "";
|
||||
}
|
||||
private function get_menu_slug(){
|
||||
if( isset( $this->data['menu_slug'] ) ) return $this->data['menu_slug'];
|
||||
else return "my-custom-settings";
|
||||
}
|
||||
private function get_capability(){
|
||||
if( isset( $this->data['capability'] ) ) return $this->data['capability'];
|
||||
else return "manage_options";
|
||||
}
|
||||
private function get_menu_page_title(){
|
||||
if( isset( $this->data['menu_page_title'] ) ) return $this->data['menu_page_title'];
|
||||
else return "My Custom Menu";
|
||||
}
|
||||
private function get_menu_name(){
|
||||
if( isset( $this->data['menu_name'] ) ) return $this->data['menu_name'];
|
||||
else return "Menu Name";
|
||||
}
|
||||
private function get_menu_title(){
|
||||
if( isset( $this->data['menu_title'] ) ) return $this->data['menu_title'];
|
||||
else return "Menu Title";
|
||||
}
|
||||
private function get_page_title(){
|
||||
if( isset( $this->data['page_title'] ) ) return $this->data['page_title'];
|
||||
else return "Page Title";
|
||||
}
|
||||
private function add_in_menu(){
|
||||
if( isset( $this->data['add_in_menu'] ) && $this->data['add_in_menu'] ) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
private function get_option_name(){
|
||||
if( isset( $this->data['option_name'] )) return $this->data['option_name'];
|
||||
else return false;
|
||||
}
|
||||
|
||||
private function get_option_id(){
|
||||
if( isset( $this->data['option_id'] ) && $this->data['option_id'] ) return $this->data['option_id'];
|
||||
else return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
|
||||
|
||||
add_action('plugins_loaded', 'mqtc_load_wc_class');
|
||||
function mqtc_load_wc_class() {
|
||||
|
||||
if ( class_exists('WC_Product_Data_Store_CPT') && !class_exists('MAGE_Product_Data_Store_CPT')) {
|
||||
|
||||
class MAGE_Product_Data_Store_CPT extends WC_Product_Data_Store_CPT {
|
||||
|
||||
public function cpt_product(){
|
||||
$wc_product = array('product');
|
||||
return apply_filters('mage_wc_products', $wc_product);
|
||||
}
|
||||
|
||||
public function read( &$product ) {
|
||||
|
||||
$product->set_defaults();
|
||||
|
||||
if ( ! $product->get_id() || ! ( $post_object = get_post( $product->get_id() ) ) || ! in_array( $post_object->post_type, $this->cpt_product() ) ) { // change birds with your post type
|
||||
throw new Exception( __( 'Invalid product.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$id = $product->get_id();
|
||||
|
||||
$product->set_props( array(
|
||||
'name' => $post_object->post_title,
|
||||
'slug' => $post_object->post_name,
|
||||
'date_created' => 0 < $post_object->post_date_gmt ? wc_string_to_timestamp( $post_object->post_date_gmt ) : null,
|
||||
'date_modified' => 0 < $post_object->post_modified_gmt ? wc_string_to_timestamp( $post_object->post_modified_gmt ) : null,
|
||||
'status' => $post_object->post_status,
|
||||
'description' => $post_object->post_content,
|
||||
'product_id' => $post_object->ID,
|
||||
'sku' => $post_object->ID,
|
||||
'short_description' => $post_object->post_excerpt,
|
||||
'parent_id' => $post_object->post_parent,
|
||||
'menu_order' => $post_object->menu_order,
|
||||
'reviews_allowed' => 'open' === $post_object->comment_status,
|
||||
) );
|
||||
|
||||
$this->read_attributes( $product );
|
||||
$this->read_downloads( $product );
|
||||
$this->read_visibility( $product );
|
||||
$this->read_product_data( $product );
|
||||
$this->read_extra_data( $product );
|
||||
$product->set_object_read( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product type based on product ID.
|
||||
*
|
||||
* @since 3.0.0
|
||||
* @param int $product_id
|
||||
* @return bool|string
|
||||
*/
|
||||
public function get_product_type( $product_id ) {
|
||||
$post_type = get_post_type( $product_id );
|
||||
if ( 'product_variation' === $post_type ) {
|
||||
return 'variation';
|
||||
} elseif ( in_array( $post_type, $this->cpt_product() ) ) { // change birds with your post type
|
||||
$terms = get_the_terms( $product_id, 'product_type' );
|
||||
return ! empty( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add_filter( 'woocommerce_data_stores', 'wbtm_woocommerce_data_stores' );
|
||||
function wbtm_woocommerce_data_stores ( $stores ) {
|
||||
$stores['product'] = 'MAGE_Product_Data_Store_CPT';
|
||||
return $stores;
|
||||
}
|
||||
}
|
||||
}
|
41
readme.txt
|
@ -4,7 +4,7 @@ Tags: event, woocomerce events manager, events manager, Wordpress Events plugin,
|
|||
Requires at least: 5.3
|
||||
Stable tag: trunk
|
||||
Version: 2.1.3
|
||||
Tested up to: 5.3
|
||||
Tested up to: 5.4
|
||||
Requires PHP: 7.0
|
||||
WC requires at least: 3.0
|
||||
WC tested up to: 4.0
|
||||
|
@ -141,7 +141,7 @@ To Show the Event Only Title Style. example 👉[Title Style Demo](https://demo.
|
|||
`
|
||||
|
||||
**Event Carousal:**
|
||||
To Show the Event Carousal. example 👉[Title Style Demo](https://demo.vaincode.com/mage-event/event-carousal/)👈:
|
||||
To Show the Event Carousal. example 👉[Event Carousal Demo](https://demo.vaincode.com/mage-event/event-carousal/)👈:
|
||||
|
||||
`
|
||||
[event-list style='grid' pagination='carousal' carousal-dots='yes' carousal-nav='yes' column=3]
|
||||
|
@ -177,7 +177,7 @@ By default there is no pagination with the event list but if you want to show pa
|
|||
`
|
||||
|
||||
**Filter By City:**
|
||||
Filter Event by City. example 👉[Title Style Demo](https://demo.vaincode.com/mage-event/event-list-filter-by-city/)👈:
|
||||
Filter Event by City. example 👉[Filter By City Demo](https://demo.vaincode.com/mage-event/event-list-filter-by-city/)👈:
|
||||
|
||||
`
|
||||
[event-list style='grid' city='Dhaka' column=3 show=8]
|
||||
|
@ -185,7 +185,7 @@ Filter Event by City. example 👉[Title Style Demo](https://demo.vaincode.com/m
|
|||
`
|
||||
|
||||
**Filter By Country:**
|
||||
Filter Event by Country.example 👉[Title Style Demo](https://demo.vaincode.com/mage-event/event-list-filter-by-country/)👈:
|
||||
Filter Event by Country.example 👉[Filter By Country Demo](https://demo.vaincode.com/mage-event/event-list-filter-by-country/)👈:
|
||||
|
||||
`
|
||||
[event-list style='grid' country='India' column=3 show=8]
|
||||
|
@ -208,13 +208,27 @@ You can sort event list by event start datetime. By default it showing as Assend
|
|||
|
||||
`
|
||||
|
||||
### Event City List ShortCode:
|
||||
### Event Add To Cart Section ShortCode:
|
||||
You can show Event Cart Section with Ticket type & extra servive list anywhere in your website by using the below shortcode. example 👉[See Demo](https://demo.vaincode.com/mage-event/event-add-to-cart-section/)👈:
|
||||
`
|
||||
[event-add-cart-section event=EventID]
|
||||
|
||||
`
|
||||
|
||||
### Event City List ShortCode:
|
||||
Display the City List which is used in the event anywhere in your website by using below shortcode. example 👉[City List Demo](https://demo.vaincode.com/mage-event/event-city-list/)👈:
|
||||
`
|
||||
[event-city-list]
|
||||
|
||||
`
|
||||
|
||||
### Event Speaker List ShortCode:
|
||||
Display Event Speaker List Any Post or Page by using the below Shortcode.. example 👉[View Demo](https://demo.vaincode.com/mage-event/speaker-list/)👈:
|
||||
`
|
||||
[event-speaker-list event=EventID]
|
||||
|
||||
`
|
||||
|
||||
|
||||
= Some Others Very Nice Addon Support Available =
|
||||
|
||||
|
@ -505,3 +519,20 @@ Fixed Grid style broken issue
|
|||
Date Timezone Wrong name Display issue fixed
|
||||
Calendar No Event Display Issue Fixed
|
||||
11 April 2020*
|
||||
|
||||
|
||||
= 3.2.4 =
|
||||
* Update Release:
|
||||
Code Optimized & Improved
|
||||
Expire Event List Not showing issue fixed
|
||||
Wrong Download Button Removed from order list
|
||||
Wrong Timezone name show into Date issue fixed
|
||||
Virtual Event Theme Added
|
||||
Speaker List Added with Speaker Template
|
||||
Speaker List Shortcode Added
|
||||
Event Cart Section Shortcode Added
|
||||
Custom CSS Code section added into Event Settings
|
||||
Event Settings Page Design Improved
|
||||
Event Location & Date Show/Hide from Order Details and Email Body option added into the event settings
|
||||
Multi Date Expand/Collapse option added into Event Details Page.
|
||||
28 April 2020*
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
get_header();
|
||||
the_post();
|
||||
?>
|
||||
<div class="mep_events_speaker_wraper">
|
||||
<div class="mep_speaker_thumbnail">
|
||||
<?php the_post_thumbnail('full'); ?>
|
||||
</div>
|
||||
<div class="mep_speaker_name">
|
||||
<h2><?php the_title(); ?></h2>
|
||||
</div>
|
||||
<div class="mep_speaker_details">
|
||||
<?php the_content(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
get_footer();
|
|
@ -2,54 +2,25 @@
|
|||
get_header();
|
||||
the_post();
|
||||
$term_id = get_queried_object()->term_id;
|
||||
// print_r(get_queried_object());
|
||||
?>
|
||||
<div class="mep-events-wrapper">
|
||||
<div class='mep_event_list'>
|
||||
<div class="mep_cat-details">
|
||||
<h1><?php echo get_queried_object()->name; ?></h1>
|
||||
<p><?php echo get_queried_object()->description; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
$args_search_qqq = array (
|
||||
'post_type' => array( 'mep_events' ),
|
||||
'posts_per_page' => -1,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'mep_cat',
|
||||
'field' => 'term_id',
|
||||
'terms' => $term_id
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
$loop = new WP_Query( $args_search_qqq );
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
|
||||
|
||||
if(time() < strtotime($newformat)){
|
||||
|
||||
?>
|
||||
<div class='mep_event_list_item'>
|
||||
<div class="mep_list_thumb"><?php the_post_thumbnail('medium'); ?></div>
|
||||
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
|
||||
<h2 class='mep_list_title'><?php the_title(); ?></h2>
|
||||
<h3 class='mep_list_date'>on <?php echo $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]; ?> - <?php echo $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0]; ?></h3>
|
||||
|
||||
<p><?php echo $event_meta['mep_location_venue'][0]; ?>,<?php echo $event_meta['mep_street'][0]; ?>, <?php echo $event_meta['mep_city'][0]; ?>,<?php echo $event_meta['mep_state'][0]; ?>,<?php echo $event_meta['mep_postcode'][0]; ?>,<?php echo $event_meta['mep_country'][0]; ?></p>
|
||||
</a>
|
||||
<div class='mep_event_list'>
|
||||
<div class="mep_cat-details">
|
||||
<h1><?php echo get_queried_object()->name; ?></h1>
|
||||
<p><?php echo get_queried_object()->description; ?></p>
|
||||
</div>
|
||||
<div class='mage_grid_box'>
|
||||
<?php
|
||||
$loop = mep_event_query(20, 'ASC', $term_id, '', '', '', 'upcoming');
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
do_action('mep_event_list_shortcode', get_the_id(), 'three_column', 'grid');
|
||||
}
|
||||
wp_reset_postdata();
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
get_footer();
|
||||
?>
|
||||
get_footer();
|
|
@ -1,71 +1,26 @@
|
|||
<?php
|
||||
get_header();
|
||||
the_post();
|
||||
|
||||
$term_id = get_queried_object()->term_id;
|
||||
// print_r(get_queried_object());
|
||||
?>
|
||||
<div class="mep-events-wrapper">
|
||||
<div class='mep_event_list'>
|
||||
|
||||
<div class="mep_cat-details">
|
||||
<h1><?php echo get_queried_object()->name; ?></h1>
|
||||
<p><?php echo get_queried_object()->description; ?></p>
|
||||
</div>
|
||||
<?php
|
||||
$args_search_qqq = array (
|
||||
'post_type' => array( 'mep_events' ),
|
||||
'posts_per_page' => -1,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'mep_org',
|
||||
'field' => 'term_id',
|
||||
'terms' => $term_id
|
||||
)
|
||||
)
|
||||
|
||||
);
|
||||
$loop = new WP_Query( $args_search_qqq );
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
$event_meta = get_post_custom(get_the_id());
|
||||
$time = strtotime($event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0]);
|
||||
$newformat = date('Y-m-d H:i:s',$time);
|
||||
|
||||
|
||||
if(time() < strtotime($newformat)){
|
||||
|
||||
|
||||
$start_datetime = $event_meta['event_start_date'][0].' '.$event_meta['event_start_time'][0];
|
||||
$start_date = $event_meta['event_start_date'][0];
|
||||
$start_time = $event_meta['event_start_time'][0];
|
||||
|
||||
$end_datetime = $event_meta['event_end_date'][0].' '.$event_meta['event_end_time'][0];
|
||||
|
||||
$end_date = $event_meta['event_end_date'][0];
|
||||
$end_time = $event_meta['event_end_time'][0];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<div class='mep_event_list_item'>
|
||||
<div class="mep_list_thumb"><?php the_post_thumbnail('medium'); ?></div>
|
||||
<div class="mep_list_event_details"><a href="<?php the_permalink(); ?>">
|
||||
<h2 class='mep_list_title'><?php the_title(); ?></h2>
|
||||
<h3 class='mep_list_date'>on <?php echo get_mep_datetime($start_datetime,'date-text').' '.get_mep_datetime($start_datetime,'time'); ?> - <?php if($start_date != $end_date){ echo get_mep_datetime($end_datetime,'date-text') .' - '; } echo get_mep_datetime($end_datetime,'time'); ?></h3>
|
||||
|
||||
<p><?php echo $event_meta['mep_location_venue'][0]; ?>,<?php echo $event_meta['mep_street'][0]; ?>, <?php echo $event_meta['mep_city'][0]; ?>,<?php echo $event_meta['mep_state'][0]; ?>,<?php echo $event_meta['mep_postcode'][0]; ?>,<?php echo $event_meta['mep_country'][0]; ?></p>
|
||||
</a>
|
||||
<div class='mep_event_list'>
|
||||
<div class="mep_cat-details">
|
||||
<h1><?php echo get_queried_object()->name; ?></h1>
|
||||
<p><?php echo get_queried_object()->description; ?></p>
|
||||
</div>
|
||||
<div class='mage_grid_box'>
|
||||
<?php
|
||||
$loop = mep_event_query(20, 'ASC', '', $term_id, '', '', 'upcoming');
|
||||
while ($loop->have_posts()) {
|
||||
$loop->the_post();
|
||||
do_action('mep_event_list_shortcode', get_the_id(), 'three_column', 'grid');
|
||||
}
|
||||
wp_reset_postdata();
|
||||
mep_event_pagination($loop->max_num_pages);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
get_footer();
|
||||
?>
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
// Template Name: Default Theme
|
||||
|
||||
// Settings Value :::::::::::::::::::::::::::::::::::::::;
|
||||
$hide_date_details = mep_get_option('mep_event_hide_date_from_details', 'general_setting_sec', 'no');
|
||||
$hide_time_details = mep_get_option('mep_event_hide_time_from_details', 'general_setting_sec', 'no');
|
||||
$hide_location_details = mep_get_option('mep_event_hide_location_from_details', 'general_setting_sec', 'no');
|
||||
$hide_total_seat_details = mep_get_option('mep_event_hide_total_seat_from_details', 'general_setting_sec', 'no');
|
||||
$hide_org_by_details = mep_get_option('mep_event_hide_org_from_details', 'general_setting_sec', 'no');
|
||||
$hide_address_details = mep_get_option('mep_event_hide_address_from_details', 'general_setting_sec', 'no');
|
||||
$hide_schedule_details = mep_get_option('mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option('mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
|
||||
$hide_date_details = mep_get_option('mep_event_hide_date_from_details', 'general_setting_sec', 'no');
|
||||
$hide_time_details = mep_get_option('mep_event_hide_time_from_details', 'general_setting_sec', 'no');
|
||||
$hide_location_details = mep_get_option('mep_event_hide_location_from_details', 'general_setting_sec', 'no');
|
||||
$hide_total_seat_details = mep_get_option('mep_event_hide_total_seat_from_details', 'general_setting_sec', 'no');
|
||||
$hide_org_by_details = mep_get_option('mep_event_hide_org_from_details', 'general_setting_sec', 'no');
|
||||
$hide_address_details = mep_get_option('mep_event_hide_address_from_details', 'general_setting_sec', 'no');
|
||||
$hide_schedule_details = mep_get_option('mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option('mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
?>
|
||||
|
||||
<div class="mep-default-theme mep_flex default_theme">
|
||||
|
@ -62,11 +62,11 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php do_action('mep_event_details'); ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-cart-sec">
|
||||
<?php do_action('mep_add_to_cart') ?>
|
||||
<?php do_action('mep_add_to_cart', get_the_id()) ?>
|
||||
</div>
|
||||
|
||||
<div class="mep-default-feature-faq-sec">
|
||||
<?php do_action('mep_event_faq'); ?>
|
||||
<?php do_action('mep_event_faq',get_the_id()); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -75,7 +75,7 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<h3>
|
||||
<?php echo mep_get_option('mep_event_location_text', 'label_setting_sec') ? mep_get_option('mep_event_location_text', 'label_setting_sec') : _e('Event Location:', 'mage-eventpress'); ?>
|
||||
</h3>
|
||||
<?php do_action('mep_event_map'); ?>
|
||||
<?php do_action('mep_event_map',get_the_id()); ?>
|
||||
</div>
|
||||
<div class="df-sidebar-part">
|
||||
<?php if ($hide_total_seat_details == 'no') { ?>
|
||||
|
@ -88,6 +88,7 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<i class="fa fa-link"></i> <?php do_action('mep_event_organizer'); ?>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
if ($hide_address_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-address">
|
||||
<ul>
|
||||
|
@ -102,7 +103,7 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php }
|
||||
if ($hide_schedule_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-events-schedule">
|
||||
<?php do_action('mep_event_date_default_theme'); ?>
|
||||
<?php do_action('mep_event_date_default_theme',get_the_id()); ?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($hide_share_details == 'no') { ?>
|
||||
|
@ -110,9 +111,20 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php do_action('mep_event_social_share'); ?>
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
|
||||
if($speaker_status == 'yes'){ ?>
|
||||
<div class="mep-default-sidebar-speaker-list">
|
||||
|
||||
<?php do_action('mep_event_speakers_list',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if ($hide_calendar_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-calender-btn">
|
||||
<?php do_action('mep_event_add_calender'); ?>
|
||||
<?php do_action('mep_event_add_calender',get_the_id()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@ $hide_address_details = mep_get_option('mep_event_hide_address_from_details', 'g
|
|||
$hide_schedule_details = mep_get_option('mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option('mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
?>
|
||||
<div class="mep-default-theme spring_field">
|
||||
<div class="mep_flex">
|
||||
|
@ -36,13 +36,13 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php } ?>
|
||||
<?php if ($hide_calendar_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-calender-btn">
|
||||
<?php do_action('mep_event_add_calender'); ?>
|
||||
<?php do_action('mep_event_add_calender',get_the_id()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mep-default-sidrbar-map">
|
||||
<?php do_action('mep_event_map'); ?>
|
||||
<?php do_action('mep_event_map',get_the_id()); ?>
|
||||
</div>
|
||||
<div class="mep_spring_date">
|
||||
<?php if ($hide_schedule_details == 'no') { ?>
|
||||
|
@ -72,14 +72,22 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
if($speaker_status == 'yes'){ ?>
|
||||
<div class="mep-theme_springfield-sidebar-speaker-list mep-default-sidebar-speaker-list">
|
||||
<?php do_action('mep_event_speakers_list',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="mep-default-feature-content">
|
||||
<h4 class="mep-cart-table-title"><?php _e('Description', 'mage-eventpress'); ?></h4>
|
||||
<?php do_action('mep_event_details'); ?>
|
||||
<div class="mep-theme1-faq-sec">
|
||||
<?php do_action('mep_event_faq'); ?>
|
||||
<?php do_action('mep_event_faq',get_the_id()); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mep-default-feature-cart-sec">
|
||||
<?php do_action('mep_add_to_cart') ?>
|
||||
<?php do_action('mep_add_to_cart',get_the_id()) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ $hide_address_details = mep_get_option('mep_event_hide_address_from_details', 'g
|
|||
$hide_schedule_details = mep_get_option('mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option('mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
|
||||
?>
|
||||
<div class="mep-default-theme franklin">
|
||||
|
@ -25,16 +26,24 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<h4 class="mep-cart-table-title"><?php _e('Description', 'mage-eventpress'); ?></h4>
|
||||
<?php do_action('mep_event_details'); ?>
|
||||
<div class="mep-theme1-faq-sec">
|
||||
<?php do_action('mep_event_faq'); ?>
|
||||
<?php do_action('mep_event_faq',get_the_id()); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="franklin_divided">
|
||||
<div class="franklin_divided_left">
|
||||
<div class="mep-default-sidrbar-map">
|
||||
<?php do_action('mep_event_map'); ?>
|
||||
<?php do_action('mep_event_map',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
if($speaker_status == 'yes'){ ?>
|
||||
<div class="mep-default-feature-content mep_theme_franklin_sidebar_speaker_list mep-default-sidebar-speaker-list">
|
||||
<?php do_action('mep_event_speakers_list',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="mep-default-feature-cart-sec">
|
||||
<?php do_action('mep_add_to_cart') ?>
|
||||
<?php do_action('mep_add_to_cart',get_the_id()) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="franklin_divided_sidebar">
|
||||
|
@ -63,7 +72,7 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php }
|
||||
if ($hide_schedule_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-events-schedule">
|
||||
<?php do_action('mep_event_date_default_theme'); ?>
|
||||
<?php do_action('mep_event_date_default_theme',get_the_id()); ?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($hide_share_details == 'no') { ?>
|
||||
|
@ -73,7 +82,7 @@ $hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'gene
|
|||
<?php }
|
||||
if ($hide_calendar_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-calender-btn">
|
||||
<?php do_action('mep_event_add_calender'); ?>
|
||||
<?php do_action('mep_event_add_calender',get_the_id()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@ $hide_address_details = mep_get_option( 'mep_event_hide_address_from_details',
|
|||
$hide_schedule_details = mep_get_option( 'mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option( 'mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option( 'mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
?>
|
||||
<div class="mep-default-theme bristol">
|
||||
<div class="mep-default-feature-image">
|
||||
|
@ -60,12 +60,20 @@ $hide_calendar_details = mep_get_option( 'mep_event_hide_calendar_details', 'g
|
|||
<?php } ?>
|
||||
<?php if ($hide_calendar_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-calender-btn">
|
||||
<?php do_action('mep_event_add_calender'); ?>
|
||||
<?php do_action('mep_event_add_calender',get_the_id()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
if($speaker_status == 'yes'){ ?>
|
||||
<div class="mep-default-feature-content mep_theme_franklin_sidebar_speaker_list mep-default-sidebar-speaker-list">
|
||||
<?php do_action('mep_event_speakers_list',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="mep-default-feature-cart-sec">
|
||||
<?php do_action('mep_add_to_cart') ?>
|
||||
<?php do_action('mep_add_to_cart',get_the_id()) ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-content">
|
||||
<h4 class="mep-cart-table-title"><?php _e('About The Event', 'mage-eventpress'); ?></h4>
|
||||
|
@ -75,6 +83,6 @@ $hide_calendar_details = mep_get_option( 'mep_event_hide_calendar_details', 'g
|
|||
<h4 class="mep-cart-table-title">
|
||||
<?php echo mep_get_option('mep_event_location_text', 'label_setting_sec') ? mep_get_option('mep_event_location_text', 'label_setting_sec') : _e('Event Location:', 'mage-eventpress'); ?>
|
||||
</h4>
|
||||
<?php do_action('mep_event_map'); ?>
|
||||
<?php do_action('mep_event_map',get_the_id()); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
// Template Name: Virtual Event Theme
|
||||
|
||||
// Settings Value :::::::::::::::::::::::::::::::::::::::;
|
||||
$hide_date_details = mep_get_option('mep_event_hide_date_from_details', 'general_setting_sec', 'no');
|
||||
$hide_time_details = mep_get_option('mep_event_hide_time_from_details', 'general_setting_sec', 'no');
|
||||
$hide_location_details = mep_get_option('mep_event_hide_location_from_details', 'general_setting_sec', 'no');
|
||||
$hide_total_seat_details = mep_get_option('mep_event_hide_total_seat_from_details', 'general_setting_sec', 'no');
|
||||
$hide_org_by_details = mep_get_option('mep_event_hide_org_from_details', 'general_setting_sec', 'no');
|
||||
$hide_address_details = mep_get_option('mep_event_hide_address_from_details', 'general_setting_sec', 'no');
|
||||
$hide_schedule_details = mep_get_option('mep_event_hide_event_schedule_details', 'general_setting_sec', 'no');
|
||||
$hide_share_details = mep_get_option('mep_event_hide_share_this_details', 'general_setting_sec', 'no');
|
||||
$hide_calendar_details = mep_get_option('mep_event_hide_calendar_details', 'general_setting_sec', 'no');
|
||||
$speaker_status = mep_get_option('mep_enable_speaker_list', 'general_setting_sec', 'no');
|
||||
?>
|
||||
|
||||
<div class="mep-default-theme mep_flex default_theme">
|
||||
<div class="mep-default-content">
|
||||
<div class="mep-default-title">
|
||||
<?php do_action('mep_event_title'); ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-image">
|
||||
<?php do_action('mep_event_thumbnail'); ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-content">
|
||||
<?php do_action('mep_event_details'); ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-cart-sec">
|
||||
<?php do_action('mep_add_to_cart',get_the_id()) ?>
|
||||
</div>
|
||||
<div class="mep-default-feature-faq-sec">
|
||||
<?php do_action('mep_event_faq',get_the_id()); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mep-default-sidebar">
|
||||
<div class="df-sidebar-part">
|
||||
<?php if ($hide_total_seat_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-price-seat">
|
||||
<div class="df-seat"><?php do_action('mep_event_seat'); ?></div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($hide_org_by_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-meta">
|
||||
<i class="fa fa-link"></i> <?php do_action('mep_event_organizer'); ?>
|
||||
</div>
|
||||
<?php } if($speaker_status == 'yes'){ ?>
|
||||
<div class="mep-default-sidebar-speaker-list">
|
||||
<?php do_action('mep_event_speakers_list',get_the_id()); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
if ($hide_schedule_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-events-schedule">
|
||||
<?php do_action('mep_event_date_default_theme',get_the_id()); ?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($hide_share_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-social">
|
||||
<?php do_action('mep_event_social_share'); ?>
|
||||
</div>
|
||||
<?php }
|
||||
if ($hide_calendar_details == 'no') { ?>
|
||||
<div class="mep-default-sidrbar-calender-btn">
|
||||
<?php do_action('mep_event_add_calender',get_the_id()); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -3,7 +3,7 @@
|
|||
* Plugin Name: Woocommerce Events Manager
|
||||
* Plugin URI: http://mage-people.com
|
||||
* Description: A Complete Event Solution for WordPress by MagePeople..
|
||||
* Version: 3.2.3
|
||||
* Version: 3.2.4
|
||||
* Author: MagePeople Team
|
||||
* Author URI: http://www.mage-people.com/
|
||||
* Text Domain: mage-eventpress
|
||||
|
@ -25,4 +25,4 @@ function mep_admin_notice_wc_not_active() {
|
|||
);
|
||||
}
|
||||
add_action( 'admin_notices', 'mep_admin_notice_wc_not_active' );
|
||||
}
|
||||
}
|