Version Description
Download this release
Release Info
| Developer | cbaldelomar |
| Plugin | |
| Version | 3.36 |
| Comparing to | |
| See all releases | |
Code changes from version 3.35 to 3.36
- README.md +6 -0
- admin/assets/css/wcvisualmanager.css +4 -0
- admin/assets/js/shortcodes-tinymce-4.js +14 -1
- admin/class-ajax.php +4 -0
- admin/class-options.php +9 -0
- admin/class-tinymce-buttons.php +11 -0
- public/assets/css/style.css +161 -1
- public/assets/js/collage.js +41 -0
- public/class-public.php +3 -2
- public/class-register.php +100 -0
- public/class-sanitize.php +324 -174
- public/class-vars.php +35 -1
- public/class-widget-options.php +19 -6
- public/class-widgets.php +4 -0
- public/functions.php +16 -0
- public/post-types/class-collage-post-type.php +290 -0
- public/{class-post-types.php → post-types/class-slide-post-type.php} +7 -1
- public/templates/collage1/content.php +80 -0
- public/templates/collage1/index.php +150 -0
- public/templates/collage1/loop-image.php +7 -0
- public/templates/collage1/loop-slider.php +11 -0
- public/widgets/widget-collage.php +193 -0
- public/widgets/widget-image-links.php +1 -1
- readme.txt +6 -0
- wc-shortcodes.php +11 -3
README.md
CHANGED
|
@@ -106,6 +106,12 @@ See our help article on [how to manually upload a plugin](http://knowledgebase.a
|
|
| 106 |
|
| 107 |
## Changelog ##
|
| 108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
### Version 3.35 ###
|
| 110 |
|
| 111 |
* updated box slider to version 4.2.12
|
| 106 |
|
| 107 |
## Changelog ##
|
| 108 |
|
| 109 |
+
### Version 3.36 ###
|
| 110 |
+
|
| 111 |
+
* Added collage widget
|
| 112 |
+
* Added break to one of the case statements
|
| 113 |
+
* updated sanitation function for posts, post_slider, and featured post
|
| 114 |
+
|
| 115 |
### Version 3.35 ###
|
| 116 |
|
| 117 |
* updated box slider to version 4.2.12
|
admin/assets/css/wcvisualmanager.css
CHANGED
|
@@ -37,6 +37,10 @@
|
|
| 37 |
border: 2px solid #46b450;
|
| 38 |
background-color: white;
|
| 39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
/**/
|
| 41 |
html .wc-shortcodes-visual-manager,
|
| 42 |
html .wc-shortcodes-visual-manager .ui-accordion,
|
| 37 |
border: 2px solid #46b450;
|
| 38 |
background-color: white;
|
| 39 |
}
|
| 40 |
+
.wc-shortcodes-visual-manager .wcs-instruction.wcs-plain-instructions {
|
| 41 |
+
border-width: 0;
|
| 42 |
+
padding: 0;
|
| 43 |
+
}
|
| 44 |
/**/
|
| 45 |
html .wc-shortcodes-visual-manager,
|
| 46 |
html .wc-shortcodes-visual-manager .ui-accordion,
|
admin/assets/js/shortcodes-tinymce-4.js
CHANGED
|
@@ -398,6 +398,20 @@
|
|
| 398 |
}
|
| 399 |
}
|
| 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
dropdown.menu.push(
|
| 402 |
{
|
| 403 |
text: "[edit_selection]",
|
|
@@ -407,7 +421,6 @@
|
|
| 407 |
}
|
| 408 |
);
|
| 409 |
|
| 410 |
-
|
| 411 |
return dropdown;
|
| 412 |
});
|
| 413 |
};
|
| 398 |
}
|
| 399 |
}
|
| 400 |
|
| 401 |
+
if ( typeof wpc_shortcodes_collage_enabled == "boolean") {
|
| 402 |
+
if ( true == wpc_shortcodes_collage_enabled ) {
|
| 403 |
+
dropdown.menu[3].menu.push(
|
| 404 |
+
{
|
| 405 |
+
text: "Collage",
|
| 406 |
+
onclick: function(){
|
| 407 |
+
var shortcode = '[wc_collage][/wc_collage]';
|
| 408 |
+
wcShortcodes( shortcode, editor );
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
);
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
dropdown.menu.push(
|
| 416 |
{
|
| 417 |
text: "[edit_selection]",
|
| 421 |
}
|
| 422 |
);
|
| 423 |
|
|
|
|
| 424 |
return dropdown;
|
| 425 |
});
|
| 426 |
};
|
admin/class-ajax.php
CHANGED
|
@@ -297,6 +297,10 @@ class WPC_Shortcodes_Ajax {
|
|
| 297 |
$widget = new WPC_Shortcodes_Widget_Post_Slider();
|
| 298 |
$widget->form( $attr );
|
| 299 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 300 |
case 'wc_posts' :
|
| 301 |
$widget = new WPC_Shortcodes_Widget_Posts();
|
| 302 |
$widget->form( $attr );
|
| 297 |
$widget = new WPC_Shortcodes_Widget_Post_Slider();
|
| 298 |
$widget->form( $attr );
|
| 299 |
break;
|
| 300 |
+
case 'wc_collage' :
|
| 301 |
+
$widget = new WPC_Shortcodes_Widget_Collage();
|
| 302 |
+
$widget->form( $attr );
|
| 303 |
+
break;
|
| 304 |
case 'wc_posts' :
|
| 305 |
$widget = new WPC_Shortcodes_Widget_Posts();
|
| 306 |
$widget->form( $attr );
|
admin/class-options.php
CHANGED
|
@@ -327,6 +327,15 @@ class WPC_Shortcodes_Options extends WPC_Shortcodes_Vars {
|
|
| 327 |
'type' => 'checkbox',
|
| 328 |
'theme_reset' => true,
|
| 329 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
),
|
| 331 |
),
|
| 332 |
),
|
| 327 |
'type' => 'checkbox',
|
| 328 |
'theme_reset' => true,
|
| 329 |
),
|
| 330 |
+
array(
|
| 331 |
+
'option_name' => 'enable_collage_post_type',
|
| 332 |
+
'title' => 'Collage Post Type',
|
| 333 |
+
'default' => '1',
|
| 334 |
+
'description' => '',
|
| 335 |
+
'label' => 'Create custom collages to use with our <code>[wc_collage]</code> shortcode.',
|
| 336 |
+
'type' => 'checkbox',
|
| 337 |
+
'theme_reset' => true,
|
| 338 |
+
),
|
| 339 |
),
|
| 340 |
),
|
| 341 |
),
|
admin/class-tinymce-buttons.php
CHANGED
|
@@ -15,6 +15,7 @@ class WPC_Shortcodes_TinyMCE_Buttons {
|
|
| 15 |
private function __construct() {
|
| 16 |
add_action( 'admin_head', array( &$this,'init' ) );
|
| 17 |
add_action( 'admin_head', array( &$this, 'localize_script' ) );
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
public function init() {
|
|
@@ -107,6 +108,16 @@ class WPC_Shortcodes_TinyMCE_Buttons {
|
|
| 107 |
die();
|
| 108 |
}
|
| 109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
public function localize_script() {
|
| 111 |
$template_path = apply_filters( 'wpc_shortcodes_template_path', null );
|
| 112 |
|
| 15 |
private function __construct() {
|
| 16 |
add_action( 'admin_head', array( &$this,'init' ) );
|
| 17 |
add_action( 'admin_head', array( &$this, 'localize_script' ) );
|
| 18 |
+
add_action( 'admin_head', array( &$this, 'localize_script_for_collage' ) );
|
| 19 |
}
|
| 20 |
|
| 21 |
public function init() {
|
| 108 |
die();
|
| 109 |
}
|
| 110 |
|
| 111 |
+
public function localize_script_for_collage() {
|
| 112 |
+
?>
|
| 113 |
+
<?php if ( WC_SHORTCODES_COLLAGE_POST_TYPE_ENABLED ) : ?>
|
| 114 |
+
<script type="text/javascript">
|
| 115 |
+
var wpc_shortcodes_collage_enabled = true;
|
| 116 |
+
</script>
|
| 117 |
+
<?php endif; ?>
|
| 118 |
+
<?php
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
public function localize_script() {
|
| 122 |
$template_path = apply_filters( 'wpc_shortcodes_template_path', null );
|
| 123 |
|
public/assets/css/style.css
CHANGED
|
@@ -1937,7 +1937,7 @@ pre.pre-wrap {
|
|
| 1937 |
margin-top: -30px;
|
| 1938 |
outline: 0;
|
| 1939 |
line-height: 1;
|
| 1940 |
-
padding: 10px;
|
| 1941 |
font-size: 50px;
|
| 1942 |
z-index: 9999;
|
| 1943 |
border: 0px solid #ffffff;
|
|
@@ -2000,6 +2000,166 @@ pre.pre-wrap {
|
|
| 2000 |
margin-bottom: 0;
|
| 2001 |
}
|
| 2002 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2003 |
/**
|
| 2004 |
*
|
| 2005 |
* ----------------------------------------------------------------------------
|
| 1937 |
margin-top: -30px;
|
| 1938 |
outline: 0;
|
| 1939 |
line-height: 1;
|
| 1940 |
+
padding: 0 10px;
|
| 1941 |
font-size: 50px;
|
| 1942 |
z-index: 9999;
|
| 1943 |
border: 0px solid #ffffff;
|
| 2000 |
margin-bottom: 0;
|
| 2001 |
}
|
| 2002 |
}
|
| 2003 |
+
/**
|
| 2004 |
+
* [wc_collage]
|
| 2005 |
+
* ----------------------------------------------------------------------------
|
| 2006 |
+
*/
|
| 2007 |
+
.wc-shortcodes-collage-wrapper {
|
| 2008 |
+
}
|
| 2009 |
+
.wc-shortcodes-collage.wc-shortcodes-collage-template-collage1 {
|
| 2010 |
+
}
|
| 2011 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column {
|
| 2012 |
+
width: 50%;
|
| 2013 |
+
float: left;
|
| 2014 |
+
height: 100%;
|
| 2015 |
+
}
|
| 2016 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-inner {
|
| 2017 |
+
height: 100%;
|
| 2018 |
+
}
|
| 2019 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-inner,
|
| 2020 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel {
|
| 2021 |
+
}
|
| 2022 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel,
|
| 2023 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-background {
|
| 2024 |
+
margin: 0;
|
| 2025 |
+
}
|
| 2026 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-has-link {
|
| 2027 |
+
cursor: pointer;
|
| 2028 |
+
}
|
| 2029 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-background {
|
| 2030 |
+
height: 100%;
|
| 2031 |
+
display: block;
|
| 2032 |
+
position: relative;
|
| 2033 |
+
background-size: cover;
|
| 2034 |
+
background-position: center center;
|
| 2035 |
+
}
|
| 2036 |
+
.wc-shortcodes-collage-template-collage1 .post-edit-link {
|
| 2037 |
+
position: absolute;
|
| 2038 |
+
bottom: 10px;
|
| 2039 |
+
right: 10px;
|
| 2040 |
+
}
|
| 2041 |
+
/* clear margins */
|
| 2042 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content > *:first-child {
|
| 2043 |
+
margin-top: 0;
|
| 2044 |
+
}
|
| 2045 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content > *:last-child {
|
| 2046 |
+
margin-bottom: 0;
|
| 2047 |
+
}
|
| 2048 |
+
/* columns 1 */
|
| 2049 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-1 .wc-shortcodes-collage-panel-5 {
|
| 2050 |
+
height: 60%;
|
| 2051 |
+
}
|
| 2052 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-1 .wc-shortcodes-collage-panel-4 {
|
| 2053 |
+
height: 40%;
|
| 2054 |
+
}
|
| 2055 |
+
/* columns 2 */
|
| 2056 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-3 {
|
| 2057 |
+
height: 40%;
|
| 2058 |
+
}
|
| 2059 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-wrapper {
|
| 2060 |
+
height: 60%;
|
| 2061 |
+
}
|
| 2062 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-inner {
|
| 2063 |
+
height: 100%;
|
| 2064 |
+
}
|
| 2065 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-1 {
|
| 2066 |
+
width: 50%;
|
| 2067 |
+
height: 100%;
|
| 2068 |
+
float: left;
|
| 2069 |
+
}
|
| 2070 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-2 {
|
| 2071 |
+
width: 50%;
|
| 2072 |
+
height: 100%;
|
| 2073 |
+
float: left;
|
| 2074 |
+
}
|
| 2075 |
+
/* content */
|
| 2076 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-content {
|
| 2077 |
+
position: relative;
|
| 2078 |
+
text-align: center;
|
| 2079 |
+
top: 50%;
|
| 2080 |
+
bottom: auto;
|
| 2081 |
+
-webkit-transform: translateY(-50%);
|
| 2082 |
+
-ms-transform: translateY(-50%);
|
| 2083 |
+
transform: translateY(-50%);
|
| 2084 |
+
padding-left: 20px;
|
| 2085 |
+
padding-right: 20px;
|
| 2086 |
+
padding-top: 20px;
|
| 2087 |
+
padding-bottom: 20px;
|
| 2088 |
+
}
|
| 2089 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-content-inner {
|
| 2090 |
+
margin-left: auto;
|
| 2091 |
+
margin-right: auto;
|
| 2092 |
+
}
|
| 2093 |
+
@media (max-width: 567px) {
|
| 2094 |
+
body #wc-shortcodes-collage.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column {
|
| 2095 |
+
height: auto;
|
| 2096 |
+
}
|
| 2097 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel {
|
| 2098 |
+
width: 100%;
|
| 2099 |
+
}
|
| 2100 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel,
|
| 2101 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-wrapper {
|
| 2102 |
+
height: auto;
|
| 2103 |
+
float: left;
|
| 2104 |
+
width: 100%;
|
| 2105 |
+
}
|
| 2106 |
+
body #wc-shortcodes-collage.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-inner,
|
| 2107 |
+
body #wc-shortcodes-collage.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-inner {
|
| 2108 |
+
padding-right: 0;
|
| 2109 |
+
}
|
| 2110 |
+
body .wc-shortcodes-collage.wc-shortcodes-collage-template-collage1,
|
| 2111 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-wrapper {
|
| 2112 |
+
margin-right: 0;
|
| 2113 |
+
}
|
| 2114 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2,
|
| 2115 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-wrapper,
|
| 2116 |
+
body .wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-1 {
|
| 2117 |
+
padding-top: 0;
|
| 2118 |
+
}
|
| 2119 |
+
}
|
| 2120 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-slider-wrapper {
|
| 2121 |
+
height: 0;
|
| 2122 |
+
overflow: hidden;
|
| 2123 |
+
position: relative;
|
| 2124 |
+
}
|
| 2125 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-slider-wrapper .bx-wrapper {
|
| 2126 |
+
-moz-box-shadow: none;
|
| 2127 |
+
-webkit-box-shadow: none;
|
| 2128 |
+
box-shadow: none;
|
| 2129 |
+
background: transparent;
|
| 2130 |
+
}
|
| 2131 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-slider-wrapper .wc-shortcodes-collage-slider,
|
| 2132 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-slider-wrapper .bx-wrapper {
|
| 2133 |
+
height: 100%;
|
| 2134 |
+
}
|
| 2135 |
+
.wc-shortcodes-collage-slider-enabled .wc-shortcodes-collage-panel-5 {
|
| 2136 |
+
position: relative;
|
| 2137 |
+
}
|
| 2138 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h1,
|
| 2139 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h2,
|
| 2140 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h3,
|
| 2141 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h4,
|
| 2142 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h5,
|
| 2143 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style h6,
|
| 2144 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style p {
|
| 2145 |
+
color: inherit;
|
| 2146 |
+
}
|
| 2147 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style .wc-shortcodes-collage-button:hover,
|
| 2148 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-content-style .wc-shortcodes-collage-button {
|
| 2149 |
+
border-color: inherit;
|
| 2150 |
+
color: inherit;
|
| 2151 |
+
}
|
| 2152 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-button {
|
| 2153 |
+
padding: 0.625em 1.25em;
|
| 2154 |
+
border-width: 2px;
|
| 2155 |
+
border-style: solid;
|
| 2156 |
+
border-color: inherit;
|
| 2157 |
+
text-decoration: none;
|
| 2158 |
+
display: inline-block;
|
| 2159 |
+
}
|
| 2160 |
+
.wc-shortcodes-collage-button:hover {
|
| 2161 |
+
text-decoration: none;
|
| 2162 |
+
}
|
| 2163 |
/**
|
| 2164 |
*
|
| 2165 |
* ----------------------------------------------------------------------------
|
public/assets/js/collage.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
( function( $ ) {
|
| 2 |
+
"use strict";
|
| 3 |
+
|
| 4 |
+
$(document).ready(function(){
|
| 5 |
+
var $panel5 = $('.wc-shortcodes-collage-slider-enabled .wc-shortcodes-collage-panel-5');
|
| 6 |
+
|
| 7 |
+
$('.wc-shortcodes-collage-slider').each( function( index, el ) {
|
| 8 |
+
var $this = $(this);
|
| 9 |
+
var mode = $this.data('mode');
|
| 10 |
+
var pause = $this.data('pause');
|
| 11 |
+
var auto = $this.data('auto');
|
| 12 |
+
var slider = $this.bxSlider({
|
| 13 |
+
'pager' : false,
|
| 14 |
+
'mode' : mode,
|
| 15 |
+
'auto' : auto,
|
| 16 |
+
'autoHover' : true,
|
| 17 |
+
'autoStart' : auto,
|
| 18 |
+
'pause' : pause,
|
| 19 |
+
'nextText' : "<i class='fa fa-angle-right'></i>",
|
| 20 |
+
'prevText' : "<i class='fa fa-angle-left'></i>",
|
| 21 |
+
'onSliderLoad' : function() {
|
| 22 |
+
var $el = $(this);
|
| 23 |
+
var $parent = $this.parent();
|
| 24 |
+
$parent.css('height', '100%');
|
| 25 |
+
$parent.parent().parent('.wc-shortcodes-collage-slider-wrapper').css('height', '100%');
|
| 26 |
+
$panel5.removeClass('wc-shortcodes-loading');
|
| 27 |
+
},
|
| 28 |
+
'onSliderResize' : function() {
|
| 29 |
+
$(this).parent().css('height','100%');
|
| 30 |
+
}
|
| 31 |
+
});
|
| 32 |
+
});
|
| 33 |
+
$('.wc-shortcodes-collage-has-link').each( function( index, el ) {
|
| 34 |
+
var $this = $(this);
|
| 35 |
+
var href = $this.data('href');
|
| 36 |
+
$this.click( function() {
|
| 37 |
+
window.location.href = href;
|
| 38 |
+
});
|
| 39 |
+
});
|
| 40 |
+
});
|
| 41 |
+
} )( jQuery );
|
public/class-public.php
CHANGED
|
@@ -114,9 +114,10 @@ class WPC_Shortcodes_Public extends WPC_Shortcodes_Vars {
|
|
| 114 |
|
| 115 |
// slider
|
| 116 |
wp_register_script( 'wordpresscanvas-rslides', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/responsiveslides.min.js', array ( 'jquery' ), '1.54', true );
|
| 117 |
-
wp_register_style( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.css', array( ), '4.2.
|
| 118 |
-
wp_register_script( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.js', array ( 'jquery' ), '4.2.
|
| 119 |
wp_register_script( 'wc-shortcodes-post-slider', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/post-slider.js', array ( 'jquery' ), $ver, true );
|
|
|
|
| 120 |
|
| 121 |
// posts
|
| 122 |
wp_register_script( 'wc-shortcodes-posts', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/posts.js', array ( 'jquery', 'wordpresscanvas-rslides', 'jquery-masonry', 'wordpresscanvas-imagesloaded' ), $ver, true );
|
| 114 |
|
| 115 |
// slider
|
| 116 |
wp_register_script( 'wordpresscanvas-rslides', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/responsiveslides.min.js', array ( 'jquery' ), '1.54', true );
|
| 117 |
+
wp_register_style( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.css', array( ), '4.2.12' );
|
| 118 |
+
wp_register_script( 'wc-shortcodes-bxslider', WC_SHORTCODES_PLUGIN_URL . 'includes/vendors/bxslider/jquery.bxslider.min.js', array ( 'jquery' ), '4.2.12', true );
|
| 119 |
wp_register_script( 'wc-shortcodes-post-slider', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/post-slider.js', array ( 'jquery' ), $ver, true );
|
| 120 |
+
wp_register_script( 'wc-shortcodes-collage', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/collage.js', array ( 'jquery' ), $ver, true );
|
| 121 |
|
| 122 |
// posts
|
| 123 |
wp_register_script( 'wc-shortcodes-posts', WC_SHORTCODES_PLUGIN_URL . 'public/assets/js/posts.js', array ( 'jquery', 'wordpresscanvas-rslides', 'jquery-masonry', 'wordpresscanvas-imagesloaded' ), $ver, true );
|
public/class-register.php
CHANGED
|
@@ -32,6 +32,7 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
| 32 |
add_shortcode( 'wc_rsvp', array( &$this, 'rsvp' ) );
|
| 33 |
add_shortcode( 'wc_posts', array( &$this, 'posts' ) );
|
| 34 |
add_shortcode( 'wc_post_slider', array( &$this, 'post_slider' ) );
|
|
|
|
| 35 |
add_shortcode( 'wc_featured_posts', array( &$this, 'featured_posts' ) );
|
| 36 |
add_shortcode( 'wc_image', array( &$this, 'image' ) );
|
| 37 |
add_shortcode( 'wc_image_links', array( &$this, 'image_links' ) );
|
|
@@ -1072,6 +1073,10 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
| 1072 |
$atts = shortcode_atts( parent::$attr->posts, $atts );
|
| 1073 |
$atts = WPC_Shortcodes_Sanitize::posts_attr( $atts );
|
| 1074 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1075 |
// Set paged variable.
|
| 1076 |
if ( (is_front_page() || is_home() ) ) {
|
| 1077 |
$atts['paged'] = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 );
|
|
@@ -1220,6 +1225,97 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
| 1220 |
return $html;
|
| 1221 |
}
|
| 1222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1223 |
public function post_slider( $atts ) {
|
| 1224 |
global $post;
|
| 1225 |
global $wc_shortcodes_posts_query;
|
|
@@ -1230,6 +1326,10 @@ class WPC_Shortcodes_Register extends WPC_Shortcodes_Vars {
|
|
| 1230 |
$atts = shortcode_atts( parent::$attr->post_slider, $atts );
|
| 1231 |
$atts = WPC_Shortcodes_Sanitize::post_slider_attr( $atts );
|
| 1232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1233 |
// Convert comma delimeted string to array
|
| 1234 |
$p = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['pids'] );
|
| 1235 |
|
| 32 |
add_shortcode( 'wc_rsvp', array( &$this, 'rsvp' ) );
|
| 33 |
add_shortcode( 'wc_posts', array( &$this, 'posts' ) );
|
| 34 |
add_shortcode( 'wc_post_slider', array( &$this, 'post_slider' ) );
|
| 35 |
+
add_shortcode( 'wc_collage', array( &$this, 'collage' ) );
|
| 36 |
add_shortcode( 'wc_featured_posts', array( &$this, 'featured_posts' ) );
|
| 37 |
add_shortcode( 'wc_image', array( &$this, 'image' ) );
|
| 38 |
add_shortcode( 'wc_image_links', array( &$this, 'image_links' ) );
|
| 1073 |
$atts = shortcode_atts( parent::$attr->posts, $atts );
|
| 1074 |
$atts = WPC_Shortcodes_Sanitize::posts_attr( $atts );
|
| 1075 |
|
| 1076 |
+
if ( empty( $atts['button_class'] ) ) {
|
| 1077 |
+
$atts['button_class'] = 'wc-shortcodes-post-button';
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
// Set paged variable.
|
| 1081 |
if ( (is_front_page() || is_home() ) ) {
|
| 1082 |
$atts['paged'] = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 );
|
| 1225 |
return $html;
|
| 1226 |
}
|
| 1227 |
|
| 1228 |
+
public function collage( $atts ) {
|
| 1229 |
+
global $post;
|
| 1230 |
+
global $wc_shortcodes_posts_query;
|
| 1231 |
+
|
| 1232 |
+
static $instance = 0;
|
| 1233 |
+
$instance++;
|
| 1234 |
+
|
| 1235 |
+
$atts = shortcode_atts( parent::$attr->collage, $atts );
|
| 1236 |
+
$atts = WPC_Shortcodes_Sanitize::collage_attr( $atts );
|
| 1237 |
+
|
| 1238 |
+
// Convert comma delimeted string to array
|
| 1239 |
+
$p = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['pids'] );
|
| 1240 |
+
|
| 1241 |
+
if ( empty( $atts['button_class'] ) ) {
|
| 1242 |
+
$atts['button_class'] = 'wc-shortcodes-collage-button';
|
| 1243 |
+
}
|
| 1244 |
+
|
| 1245 |
+
$atts['p'] = '';
|
| 1246 |
+
$atts['post__in'] = '';
|
| 1247 |
+
|
| 1248 |
+
if ( is_array( $p ) && ! empty( $p ) ) {
|
| 1249 |
+
$size = sizeof( $p );
|
| 1250 |
+
if ( 1 < $size ) {
|
| 1251 |
+
$atts['post__in'] = $p;
|
| 1252 |
+
}
|
| 1253 |
+
else if ( 1 == $size ) {
|
| 1254 |
+
$atts['p'] = $p[0];
|
| 1255 |
+
}
|
| 1256 |
+
}
|
| 1257 |
+
|
| 1258 |
+
$atts['terms'] = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['terms'] );
|
| 1259 |
+
|
| 1260 |
+
// Return if posts_per_page is set to 0.
|
| 1261 |
+
if ( 0 == $atts['posts_per_page'] ) {
|
| 1262 |
+
return;
|
| 1263 |
+
}
|
| 1264 |
+
|
| 1265 |
+
// fix bug with title argument being added to WP_Query() in 4.4
|
| 1266 |
+
$display_keys = array(
|
| 1267 |
+
'button_class', 'size', 'gutter_space', 'heading_size', 'mobile_heading_size', 'layout', 'template', 'desktop_height', 'laptop_height', 'mobile_height', 'slider_mode', 'slider_pause', 'slider_auto',
|
| 1268 |
+
);
|
| 1269 |
+
$display = array();
|
| 1270 |
+
foreach ( $display_keys as $key ) {
|
| 1271 |
+
$display[ $key ] = $atts[ $key ];
|
| 1272 |
+
unset( $atts[ $key ] );
|
| 1273 |
+
}
|
| 1274 |
+
|
| 1275 |
+
// remove not query keys
|
| 1276 |
+
unset( $atts[ 'pids' ] );
|
| 1277 |
+
|
| 1278 |
+
// check for get variable
|
| 1279 |
+
$wpc_term = null;
|
| 1280 |
+
if ( isset( $_GET['wpc_term'] ) && ! empty( $_GET['wpc_term'] ) ) {
|
| 1281 |
+
$wpc_term = $_GET['wpc_term'];
|
| 1282 |
+
}
|
| 1283 |
+
|
| 1284 |
+
// add tax query if user specified
|
| 1285 |
+
if ( ! empty( $wpc_term ) ) {
|
| 1286 |
+
$atts['tax_query'] = array(
|
| 1287 |
+
array(
|
| 1288 |
+
'taxonomy' => $atts['taxonomy'],
|
| 1289 |
+
'field' => $atts['field'],
|
| 1290 |
+
'terms' => $wpc_term,
|
| 1291 |
+
),
|
| 1292 |
+
);
|
| 1293 |
+
}
|
| 1294 |
+
else if ( ! empty( $atts['terms'] ) ) {
|
| 1295 |
+
$atts['tax_query'] = array(
|
| 1296 |
+
array(
|
| 1297 |
+
'taxonomy' => $atts['taxonomy'],
|
| 1298 |
+
'field' => $atts['field'],
|
| 1299 |
+
'terms' => $atts['terms'],
|
| 1300 |
+
),
|
| 1301 |
+
);
|
| 1302 |
+
}
|
| 1303 |
+
|
| 1304 |
+
// run query
|
| 1305 |
+
$wc_shortcodes_posts_query = new WP_Query($atts);
|
| 1306 |
+
|
| 1307 |
+
$html = '';
|
| 1308 |
+
|
| 1309 |
+
ob_start();
|
| 1310 |
+
include('templates/'.$display['template'].'/index.php');
|
| 1311 |
+
$html = ob_get_clean();
|
| 1312 |
+
|
| 1313 |
+
// reset query
|
| 1314 |
+
wp_reset_query();
|
| 1315 |
+
|
| 1316 |
+
return $html;
|
| 1317 |
+
}
|
| 1318 |
+
|
| 1319 |
public function post_slider( $atts ) {
|
| 1320 |
global $post;
|
| 1321 |
global $wc_shortcodes_posts_query;
|
| 1326 |
$atts = shortcode_atts( parent::$attr->post_slider, $atts );
|
| 1327 |
$atts = WPC_Shortcodes_Sanitize::post_slider_attr( $atts );
|
| 1328 |
|
| 1329 |
+
if ( empty( $atts['button_class'] ) ) {
|
| 1330 |
+
$atts['button_class'] = 'wc-shortcodes-post-slide-button';
|
| 1331 |
+
}
|
| 1332 |
+
|
| 1333 |
// Convert comma delimeted string to array
|
| 1334 |
$p = WPC_Shortcodes_Sanitize::comma_delim_to_array( $atts['pids'] );
|
| 1335 |
|
public/class-sanitize.php
CHANGED
|
@@ -32,6 +32,21 @@ class WPC_Shortcodes_Sanitize {
|
|
| 32 |
return $value;
|
| 33 |
}
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
public static function text_field( $value ) {
|
| 36 |
return trim( sanitize_text_field( $value ) );
|
| 37 |
}
|
|
@@ -60,6 +75,24 @@ class WPC_Shortcodes_Sanitize {
|
|
| 60 |
|
| 61 |
$value = implode( ' ', $a );
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
return $value;
|
| 64 |
}
|
| 65 |
|
|
@@ -82,6 +115,21 @@ class WPC_Shortcodes_Sanitize {
|
|
| 82 |
return $value;
|
| 83 |
}
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
public static function positive_number( $value ) {
|
| 86 |
if ( '' == $value )
|
| 87 |
return $value;
|
|
@@ -284,6 +332,7 @@ class WPC_Shortcodes_Sanitize {
|
|
| 284 |
|
| 285 |
public static function heading_type( $value, $default = 'h2' ) {
|
| 286 |
$whitelist = WPC_Shortcodes_Widget_Options::heading_tags();
|
|
|
|
| 287 |
|
| 288 |
if ( array_key_exists( $value, $whitelist ) )
|
| 289 |
return $value;
|
|
@@ -415,6 +464,79 @@ class WPC_Shortcodes_Sanitize {
|
|
| 415 |
return $default;
|
| 416 |
}
|
| 417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
public static function text_align( $value, $default = '' ) {
|
| 419 |
$whitelist = WPC_Shortcodes_Widget_Options::text_align_values();
|
| 420 |
|
|
@@ -837,6 +959,72 @@ class WPC_Shortcodes_Sanitize {
|
|
| 837 |
return $atts;
|
| 838 |
}
|
| 839 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 840 |
public static function image_links_attr( $atts ) {
|
| 841 |
foreach ( $atts as $key => $value ) {
|
| 842 |
switch( $key ) {
|
|
@@ -1177,86 +1365,76 @@ class WPC_Shortcodes_Sanitize {
|
|
| 1177 |
}
|
| 1178 |
|
| 1179 |
public static function posts_attr( $atts ) {
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
|
| 1185 |
-
|
| 1186 |
-
|
| 1187 |
-
|
| 1188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1189 |
$atts[ $key ] = (bool) $atts[ $key ];
|
| 1190 |
-
|
| 1191 |
-
|
| 1192 |
-
|
| 1193 |
-
|
| 1194 |
-
|
| 1195 |
-
|
| 1196 |
-
|
| 1197 |
-
|
| 1198 |
-
|
| 1199 |
-
|
| 1200 |
-
|
| 1201 |
-
|
| 1202 |
-
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1214 |
}
|
| 1215 |
}
|
| 1216 |
|
| 1217 |
-
$valid_columns = array( 1, 2, 3, 4, 5, 6, 7, 8, 9 );
|
| 1218 |
-
$atts['columns'] = in_array( $atts['columns'], $valid_columns ) ? $atts['columns'] : 2;
|
| 1219 |
if ( $atts['columns'] == 1 ) {
|
| 1220 |
$atts['layout'] = 'single-column';
|
| 1221 |
}
|
| 1222 |
|
| 1223 |
-
|
| 1224 |
// sanitize limit
|
| 1225 |
if ( $atts['posts_per_page'] < 0 ) {
|
| 1226 |
$atts['posts_per_page'] = -1;
|
| 1227 |
$atts['nopaging'] = true;
|
| 1228 |
}
|
| 1229 |
|
| 1230 |
-
// sanitize dropdown
|
| 1231 |
-
$valid_layouts = array( 'masonry', 'grid', 'single-column' );
|
| 1232 |
-
if ( ! in_array( $atts['layout'], $valid_layouts ) ) {
|
| 1233 |
-
$atts['layout'] = 'masonry';
|
| 1234 |
-
}
|
| 1235 |
-
|
| 1236 |
-
$valid_templates = array( 'box', 'borderless' );
|
| 1237 |
-
if ( ! in_array( $atts['template'], $valid_templates ) ) {
|
| 1238 |
-
$atts['template'] = 'box';
|
| 1239 |
-
}
|
| 1240 |
-
|
| 1241 |
-
$valid_orders = array( 'ASC', 'DESC' );
|
| 1242 |
-
$atts['order'] = strtoupper( $atts['order'] );
|
| 1243 |
-
if ( ! in_array( $atts['order'], $valid_orders ) ) {
|
| 1244 |
-
$atts['order'] = 'DESC';
|
| 1245 |
-
}
|
| 1246 |
-
|
| 1247 |
-
$atts['heading_type'] = strtolower( $atts['heading_type'] );
|
| 1248 |
-
$valid_headings = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' );
|
| 1249 |
-
$atts['heading_type'] = in_array( $atts['heading_type'], $valid_headings ) ? $atts['heading_type'] : 'h2';
|
| 1250 |
-
|
| 1251 |
-
// sanitize inputs
|
| 1252 |
-
$atts['button_class'] = self::html_classes( $atts['button_class'] );
|
| 1253 |
-
$atts['button_class'] = empty( $atts['button_class'] ) ? 'wc-shortcodes-post-button' : $atts['button_class'];
|
| 1254 |
-
$atts['readmore'] = sanitize_text_field( $atts['readmore'] );
|
| 1255 |
-
$atts['terms'] = sanitize_text_field( $atts['terms'] );
|
| 1256 |
-
$atts['pids'] = sanitize_text_field( $atts['pids'] );
|
| 1257 |
-
$atts['post__in'] = sanitize_text_field( $atts['post__in'] );
|
| 1258 |
-
$atts['date_format'] = sanitize_text_field( $atts['date_format'] );
|
| 1259 |
-
|
| 1260 |
return $atts;
|
| 1261 |
}
|
| 1262 |
|
|
@@ -1274,31 +1452,60 @@ class WPC_Shortcodes_Sanitize {
|
|
| 1274 |
}
|
| 1275 |
|
| 1276 |
public static function post_slider_attr( $atts ) {
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
|
|
|
|
|
|
|
|
|
| 1286 |
$atts[ $key ] = (bool) $atts[ $key ];
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1299 |
}
|
| 1300 |
}
|
| 1301 |
-
$atts['slider_pause'] = abs( $atts['slider_pause'] );
|
| 1302 |
|
| 1303 |
// sanitize limit
|
| 1304 |
if ( $atts['posts_per_page'] < 0 ) {
|
|
@@ -1306,40 +1513,6 @@ class WPC_Shortcodes_Sanitize {
|
|
| 1306 |
$atts['nopaging'] = true;
|
| 1307 |
}
|
| 1308 |
|
| 1309 |
-
// sanitize dropdown
|
| 1310 |
-
$valid_layouts = array( 'bxslider' );
|
| 1311 |
-
if ( ! in_array( $atts['layout'], $valid_layouts ) ) {
|
| 1312 |
-
$atts['layout'] = 'bxslider';
|
| 1313 |
-
}
|
| 1314 |
-
|
| 1315 |
-
$valid_templates = array( 'slider1', 'slider2' );
|
| 1316 |
-
if ( ! in_array( $atts['template'], $valid_templates ) ) {
|
| 1317 |
-
$atts['template'] = 'slider1';
|
| 1318 |
-
}
|
| 1319 |
-
|
| 1320 |
-
$valid_slider_modes = array( 'fade', 'vertical', 'horizontal' );
|
| 1321 |
-
if ( ! in_array( $atts['slider_mode'], $valid_slider_modes ) ) {
|
| 1322 |
-
$atts['slider_mode'] = 'fade';
|
| 1323 |
-
}
|
| 1324 |
-
|
| 1325 |
-
$valid_orders = array( 'ASC', 'DESC' );
|
| 1326 |
-
$atts['order'] = strtoupper( $atts['order'] );
|
| 1327 |
-
if ( ! in_array( $atts['order'], $valid_orders ) ) {
|
| 1328 |
-
$atts['order'] = 'DESC';
|
| 1329 |
-
}
|
| 1330 |
-
|
| 1331 |
-
$atts['heading_type'] = strtolower( $atts['heading_type'] );
|
| 1332 |
-
$valid_headings = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' );
|
| 1333 |
-
$atts['heading_type'] = in_array( $atts['heading_type'], $valid_headings ) ? $atts['heading_type'] : 'h2';
|
| 1334 |
-
|
| 1335 |
-
// sanitize inputs
|
| 1336 |
-
$atts['button_class'] = self::html_classes( $atts['button_class'] );
|
| 1337 |
-
$atts['button_class'] = empty( $atts['button_class'] ) ? 'wc-shortcodes-post-slide-button' : $atts['button_class'];
|
| 1338 |
-
$atts['readmore'] = sanitize_text_field( $atts['readmore'] );
|
| 1339 |
-
$atts['terms'] = sanitize_text_field( $atts['terms'] );
|
| 1340 |
-
$atts['pids'] = sanitize_text_field( $atts['pids'] );
|
| 1341 |
-
$atts['post__in'] = sanitize_text_field( $atts['post__in'] );
|
| 1342 |
-
|
| 1343 |
return $atts;
|
| 1344 |
}
|
| 1345 |
|
|
@@ -1357,33 +1530,38 @@ class WPC_Shortcodes_Sanitize {
|
|
| 1357 |
}
|
| 1358 |
|
| 1359 |
public static function featured_posts_attr( $atts ) {
|
| 1360 |
-
|
| 1361 |
-
|
| 1362 |
-
|
| 1363 |
-
|
| 1364 |
-
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
| 1368 |
-
|
| 1369 |
-
|
| 1370 |
-
|
| 1371 |
-
|
| 1372 |
-
|
| 1373 |
-
|
| 1374 |
-
|
| 1375 |
-
|
| 1376 |
-
|
| 1377 |
-
|
| 1378 |
-
|
| 1379 |
-
|
| 1380 |
-
|
| 1381 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1382 |
}
|
| 1383 |
}
|
| 1384 |
|
| 1385 |
-
// sanitize limit
|
| 1386 |
-
$atts['nopaging'] = false;
|
| 1387 |
if ( $atts['posts_per_page'] <= 0 ) {
|
| 1388 |
$atts['posts_per_page'] = 1;
|
| 1389 |
}
|
|
@@ -1391,34 +1569,6 @@ class WPC_Shortcodes_Sanitize {
|
|
| 1391 |
$atts['posts_per_page'] = 10;
|
| 1392 |
}
|
| 1393 |
|
| 1394 |
-
// sanitize dropdown
|
| 1395 |
-
$valid_layouts = WPC_Shortcodes_Widget_Options::featured_post_layouts();
|
| 1396 |
-
if ( ! array_key_exists( $atts['layout'], $valid_layouts ) ) {
|
| 1397 |
-
$atts['layout'] = 'thumbnail';
|
| 1398 |
-
}
|
| 1399 |
-
|
| 1400 |
-
$valid_orders = WPC_Shortcodes_Widget_Options::order_fields();
|
| 1401 |
-
$atts['order'] = strtoupper( $atts['order'] );
|
| 1402 |
-
if ( ! in_array( $atts['order'], $valid_orders ) ) {
|
| 1403 |
-
$atts['order'] = 'DESC';
|
| 1404 |
-
}
|
| 1405 |
-
|
| 1406 |
-
$atts['heading_type'] = strtolower( $atts['heading_type'] );
|
| 1407 |
-
$valid_headings = WPC_Shortcodes_Widget_Options::heading_tags();
|
| 1408 |
-
$atts['heading_type'] = in_array( $atts['heading_type'], $valid_headings ) ? $atts['heading_type'] : 'h2';
|
| 1409 |
-
$valid_orders = WPC_Shortcodes_Widget_Options::order_fields();
|
| 1410 |
-
$atts['order'] = strtoupper( $atts['order'] );
|
| 1411 |
-
if ( ! in_array( $atts['order'], $valid_orders ) ) {
|
| 1412 |
-
$atts['order'] = 'DESC';
|
| 1413 |
-
}
|
| 1414 |
-
|
| 1415 |
-
|
| 1416 |
-
// sanitize inputs
|
| 1417 |
-
$atts['title'] = sanitize_text_field( $atts['title'] );
|
| 1418 |
-
$atts['terms'] = sanitize_text_field( $atts['terms'] );
|
| 1419 |
-
$atts['pids'] = sanitize_text_field( $atts['pids'] );
|
| 1420 |
-
$atts['post__in'] = sanitize_text_field( $atts['post__in'] );
|
| 1421 |
-
|
| 1422 |
return $atts;
|
| 1423 |
}
|
| 1424 |
}
|
| 32 |
return $value;
|
| 33 |
}
|
| 34 |
|
| 35 |
+
public static function gutter_space( $value, $default = 20 ) {
|
| 36 |
+
if ( ! is_numeric( $value ) ) {
|
| 37 |
+
$value = 20;
|
| 38 |
+
}
|
| 39 |
+
if ( $value > 0 && $value < 1 ) {
|
| 40 |
+
$value = (int) ( $value * 1000 );
|
| 41 |
+
}
|
| 42 |
+
$value = (int) $value;
|
| 43 |
+
if ( $value > 50 || $value < 0 ) {
|
| 44 |
+
$value = $default;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
return $value;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
public static function text_field( $value ) {
|
| 51 |
return trim( sanitize_text_field( $value ) );
|
| 52 |
}
|
| 75 |
|
| 76 |
$value = implode( ' ', $a );
|
| 77 |
|
| 78 |
+
return trim( $value );
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
public static function opacity( $value ) {
|
| 82 |
+
if ( '' == $value )
|
| 83 |
+
return $value;
|
| 84 |
+
|
| 85 |
+
$value = number_format( $value, 2, '.', '' );
|
| 86 |
+
$value = floatval( $value );
|
| 87 |
+
|
| 88 |
+
if ( empty( $value ) )
|
| 89 |
+
$value = 0;
|
| 90 |
+
|
| 91 |
+
if ( 0 > $value )
|
| 92 |
+
$value = 0;
|
| 93 |
+
else if ( 1 < $value )
|
| 94 |
+
$value = 1;
|
| 95 |
+
|
| 96 |
return $value;
|
| 97 |
}
|
| 98 |
|
| 115 |
return $value;
|
| 116 |
}
|
| 117 |
|
| 118 |
+
public static function column( $value, $default = 2 ) {
|
| 119 |
+
$value = intval( $value );
|
| 120 |
+
|
| 121 |
+
if ( 1 > $value )
|
| 122 |
+
return $default;
|
| 123 |
+
|
| 124 |
+
if ( 9 < $value )
|
| 125 |
+
return $default;
|
| 126 |
+
|
| 127 |
+
if ( empty( $value ) )
|
| 128 |
+
return $default;
|
| 129 |
+
|
| 130 |
+
return $value;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
public static function positive_number( $value ) {
|
| 134 |
if ( '' == $value )
|
| 135 |
return $value;
|
| 332 |
|
| 333 |
public static function heading_type( $value, $default = 'h2' ) {
|
| 334 |
$whitelist = WPC_Shortcodes_Widget_Options::heading_tags();
|
| 335 |
+
$value = strtolower( $value );
|
| 336 |
|
| 337 |
if ( array_key_exists( $value, $whitelist ) )
|
| 338 |
return $value;
|
| 464 |
return $default;
|
| 465 |
}
|
| 466 |
|
| 467 |
+
public static function posts_layout( $value, $default = 'bxslider' ) {
|
| 468 |
+
$whitelist = WPC_Shortcodes_Widget_Options::posts_layouts();
|
| 469 |
+
|
| 470 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 471 |
+
return $value;
|
| 472 |
+
|
| 473 |
+
return $default;
|
| 474 |
+
}
|
| 475 |
+
|
| 476 |
+
public static function featured_post_layout( $value, $default = 'thumbnail' ) {
|
| 477 |
+
$whitelist = WPC_Shortcodes_Widget_Options::featured_post_layouts();
|
| 478 |
+
|
| 479 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 480 |
+
return $value;
|
| 481 |
+
|
| 482 |
+
return $default;
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
public static function posts_template( $value, $default = 'slider1' ) {
|
| 486 |
+
$whitelist = WPC_Shortcodes_Widget_Options::posts_templates();
|
| 487 |
+
|
| 488 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 489 |
+
return $value;
|
| 490 |
+
|
| 491 |
+
return $default;
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
public static function collage_template( $value, $default = 'collage1' ) {
|
| 495 |
+
$whitelist = WPC_Shortcodes_Widget_Options::collage_templates();
|
| 496 |
+
|
| 497 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 498 |
+
return $value;
|
| 499 |
+
|
| 500 |
+
return $default;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
public static function post_slider_layout( $value, $default = 'bxslider' ) {
|
| 504 |
+
$whitelist = WPC_Shortcodes_Widget_Options::post_slider_layouts();
|
| 505 |
+
|
| 506 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 507 |
+
return $value;
|
| 508 |
+
|
| 509 |
+
return $default;
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
public static function post_slider_template( $value, $default = 'slider1' ) {
|
| 513 |
+
$whitelist = WPC_Shortcodes_Widget_Options::post_slider_templates();
|
| 514 |
+
|
| 515 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 516 |
+
return $value;
|
| 517 |
+
|
| 518 |
+
return $default;
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
public static function post_slider_mode( $value, $default = 'fade' ) {
|
| 522 |
+
$whitelist = WPC_Shortcodes_Widget_Options::post_slider_modes();
|
| 523 |
+
|
| 524 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 525 |
+
return $value;
|
| 526 |
+
|
| 527 |
+
return $default;
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
public static function order_field( $value, $default = '' ) {
|
| 531 |
+
$whitelist = WPC_Shortcodes_Widget_Options::order_fields();
|
| 532 |
+
|
| 533 |
+
$value = strtoupper( $value );
|
| 534 |
+
if ( array_key_exists( $value, $whitelist ) )
|
| 535 |
+
return $value;
|
| 536 |
+
|
| 537 |
+
return $default;
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
public static function text_align( $value, $default = '' ) {
|
| 541 |
$whitelist = WPC_Shortcodes_Widget_Options::text_align_values();
|
| 542 |
|
| 959 |
return $atts;
|
| 960 |
}
|
| 961 |
|
| 962 |
+
// Fixes bools on widget update when checkbox is empty, and thus blank. We don't want to revert to the default value, but false.
|
| 963 |
+
public static function collage_attr_fix_bools( $atts ) {
|
| 964 |
+
$bools = array( 'ignore_sticky_posts', 'slider_auto', 'nopaging' );
|
| 965 |
+
|
| 966 |
+
foreach ( $bools as $key ) {
|
| 967 |
+
if ( ! isset( $atts[ $key ] ) ) {
|
| 968 |
+
$atts[ $key ] = 0;
|
| 969 |
+
}
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
return $atts;
|
| 973 |
+
}
|
| 974 |
+
|
| 975 |
+
public static function collage_attr( $atts ) {
|
| 976 |
+
foreach ( $atts as $key => $value ) {
|
| 977 |
+
switch( $key ) {
|
| 978 |
+
case 'ignore_sticky_posts' :
|
| 979 |
+
case 'slider_auto' :
|
| 980 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 981 |
+
break;
|
| 982 |
+
case 'nopaging' :
|
| 983 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 984 |
+
$atts[ $key ] = (bool) $atts[ $key ];
|
| 985 |
+
break;
|
| 986 |
+
case 'p' :
|
| 987 |
+
case 'posts_per_page' :
|
| 988 |
+
case 'heading_size' :
|
| 989 |
+
case 'mobile_heading_size' :
|
| 990 |
+
case 'desktop_height' :
|
| 991 |
+
case 'laptop_height' :
|
| 992 |
+
case 'mobile_height' :
|
| 993 |
+
$atts[ $key ] = self::number( $value );
|
| 994 |
+
break;
|
| 995 |
+
case 'gutter_space' :
|
| 996 |
+
$atts[ $key ] = self::gutter_space( $value, 7 );
|
| 997 |
+
break;
|
| 998 |
+
case 'slider_pause' :
|
| 999 |
+
$atts[ $key ] = self::number( $value );
|
| 1000 |
+
$atts[ $key ] = abs( $atts[ $key ] );
|
| 1001 |
+
break;
|
| 1002 |
+
case 'layout' :
|
| 1003 |
+
$atts[ $key ] = self::post_slider_layout( $value );
|
| 1004 |
+
break;
|
| 1005 |
+
case 'template' :
|
| 1006 |
+
$atts[ $key ] = self::collage_template( $value );
|
| 1007 |
+
break;
|
| 1008 |
+
case 'slider_mode' :
|
| 1009 |
+
$atts[ $key ] = self::post_slider_mode( $value );
|
| 1010 |
+
break;
|
| 1011 |
+
case 'order' :
|
| 1012 |
+
$atts[ $key ] = self::order_field( $value );
|
| 1013 |
+
break;
|
| 1014 |
+
case 'button_class' :
|
| 1015 |
+
$atts[ $key ] = self::html_classes( $atts[ $key ] );
|
| 1016 |
+
break;
|
| 1017 |
+
case 'terms' :
|
| 1018 |
+
case 'pids' :
|
| 1019 |
+
case 'post__in' :
|
| 1020 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
| 1021 |
+
break;
|
| 1022 |
+
}
|
| 1023 |
+
}
|
| 1024 |
+
|
| 1025 |
+
return $atts;
|
| 1026 |
+
}
|
| 1027 |
+
|
| 1028 |
public static function image_links_attr( $atts ) {
|
| 1029 |
foreach ( $atts as $key => $value ) {
|
| 1030 |
switch( $key ) {
|
| 1365 |
}
|
| 1366 |
|
| 1367 |
public static function posts_attr( $atts ) {
|
| 1368 |
+
foreach ( $atts as $key => $value ) {
|
| 1369 |
+
switch( $key ) {
|
| 1370 |
+
case 'ignore_sticky_posts' :
|
| 1371 |
+
case 'show_meta_category' :
|
| 1372 |
+
case 'nopaging' :
|
| 1373 |
+
case 'show_title' :
|
| 1374 |
+
case 'show_meta_all' :
|
| 1375 |
+
case 'show_meta_author' :
|
| 1376 |
+
case 'show_meta_date' :
|
| 1377 |
+
case 'show_meta_comments' :
|
| 1378 |
+
case 'show_thumbnail' :
|
| 1379 |
+
case 'show_content' :
|
| 1380 |
+
case 'show_paging' :
|
| 1381 |
+
case 'filtering' :
|
| 1382 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 1383 |
+
break;
|
| 1384 |
+
case 'nopaging' :
|
| 1385 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 1386 |
$atts[ $key ] = (bool) $atts[ $key ];
|
| 1387 |
+
break;
|
| 1388 |
+
case 'gutter_space' :
|
| 1389 |
+
$atts[ $key ] = self::gutter_space( $value );
|
| 1390 |
+
break;
|
| 1391 |
+
case 'p' :
|
| 1392 |
+
case 'posts_per_page' :
|
| 1393 |
+
case 'excerpt_length' :
|
| 1394 |
+
$atts[ $key ] = self::number( $value );
|
| 1395 |
+
break;
|
| 1396 |
+
case 'columns' :
|
| 1397 |
+
$atts[ $key ] = self::column( $value );
|
| 1398 |
+
break;
|
| 1399 |
+
case 'slider_pause' :
|
| 1400 |
+
$atts[ $key ] = self::number( $value );
|
| 1401 |
+
$atts[ $key ] = abs( $atts[ $key ] );
|
| 1402 |
+
break;
|
| 1403 |
+
case 'layout' :
|
| 1404 |
+
$atts[ $key ] = self::posts_layout( $value );
|
| 1405 |
+
break;
|
| 1406 |
+
case 'template' :
|
| 1407 |
+
$atts[ $key ] = self::posts_template( $value );
|
| 1408 |
+
break;
|
| 1409 |
+
case 'order' :
|
| 1410 |
+
$atts[ $key ] = self::order_field( $value );
|
| 1411 |
+
break;
|
| 1412 |
+
case 'heading_type' :
|
| 1413 |
+
$atts[ $key ] = self::heading_type( $value );
|
| 1414 |
+
break;
|
| 1415 |
+
case 'button_class' :
|
| 1416 |
+
$atts[ $key ] = self::html_classes( $atts[ $key ] );
|
| 1417 |
+
$atts[ $key ] = empty( $atts[ $key ] ) ? 'wc-shortcodes-post-button' : $atts[ $key ];
|
| 1418 |
+
break;
|
| 1419 |
+
case 'readmore' :
|
| 1420 |
+
case 'terms' :
|
| 1421 |
+
case 'pids' :
|
| 1422 |
+
case 'post__in' :
|
| 1423 |
+
case 'date_format' :
|
| 1424 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
| 1425 |
}
|
| 1426 |
}
|
| 1427 |
|
|
|
|
|
|
|
| 1428 |
if ( $atts['columns'] == 1 ) {
|
| 1429 |
$atts['layout'] = 'single-column';
|
| 1430 |
}
|
| 1431 |
|
|
|
|
| 1432 |
// sanitize limit
|
| 1433 |
if ( $atts['posts_per_page'] < 0 ) {
|
| 1434 |
$atts['posts_per_page'] = -1;
|
| 1435 |
$atts['nopaging'] = true;
|
| 1436 |
}
|
| 1437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1438 |
return $atts;
|
| 1439 |
}
|
| 1440 |
|
| 1452 |
}
|
| 1453 |
|
| 1454 |
public static function post_slider_attr( $atts ) {
|
| 1455 |
+
foreach ( $atts as $key => $value ) {
|
| 1456 |
+
switch( $key ) {
|
| 1457 |
+
case 'ignore_sticky_posts' :
|
| 1458 |
+
case 'show_meta_category' :
|
| 1459 |
+
case 'show_title' :
|
| 1460 |
+
case 'show_content' :
|
| 1461 |
+
case 'show_button' :
|
| 1462 |
+
case 'slider_auto' :
|
| 1463 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 1464 |
+
break;
|
| 1465 |
+
case 'nopaging' :
|
| 1466 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 1467 |
$atts[ $key ] = (bool) $atts[ $key ];
|
| 1468 |
+
break;
|
| 1469 |
+
case 'p' :
|
| 1470 |
+
case 'posts_per_page' :
|
| 1471 |
+
case 'heading_size' :
|
| 1472 |
+
case 'mobile_heading_size' :
|
| 1473 |
+
case 'excerpt_length' :
|
| 1474 |
+
case 'desktop_height' :
|
| 1475 |
+
case 'laptop_height' :
|
| 1476 |
+
case 'mobile_height' :
|
| 1477 |
+
$atts[ $key ] = self::number( $value );
|
| 1478 |
+
break;
|
| 1479 |
+
case 'slider_pause' :
|
| 1480 |
+
$atts[ $key ] = self::number( $value );
|
| 1481 |
+
$atts[ $key ] = abs( $atts[ $key ] );
|
| 1482 |
+
break;
|
| 1483 |
+
case 'layout' :
|
| 1484 |
+
$atts[ $key ] = self::post_slider_layout( $value );
|
| 1485 |
+
break;
|
| 1486 |
+
case 'template' :
|
| 1487 |
+
$atts[ $key ] = self::post_slider_template( $value );
|
| 1488 |
+
break;
|
| 1489 |
+
case 'slider_mode' :
|
| 1490 |
+
$atts[ $key ] = self::post_slider_mode( $value );
|
| 1491 |
+
break;
|
| 1492 |
+
case 'order' :
|
| 1493 |
+
$atts[ $key ] = self::order_field( $value );
|
| 1494 |
+
break;
|
| 1495 |
+
case 'heading_type' :
|
| 1496 |
+
$atts[ $key ] = self::heading_type( $value );
|
| 1497 |
+
break;
|
| 1498 |
+
case 'button_class' :
|
| 1499 |
+
$atts[ $key ] = self::html_classes( $atts[ $key ] );
|
| 1500 |
+
break;
|
| 1501 |
+
case 'readmore' :
|
| 1502 |
+
case 'terms' :
|
| 1503 |
+
case 'pids' :
|
| 1504 |
+
case 'post__in' :
|
| 1505 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
| 1506 |
+
break;
|
| 1507 |
}
|
| 1508 |
}
|
|
|
|
| 1509 |
|
| 1510 |
// sanitize limit
|
| 1511 |
if ( $atts['posts_per_page'] < 0 ) {
|
| 1513 |
$atts['nopaging'] = true;
|
| 1514 |
}
|
| 1515 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1516 |
return $atts;
|
| 1517 |
}
|
| 1518 |
|
| 1530 |
}
|
| 1531 |
|
| 1532 |
public static function featured_posts_attr( $atts ) {
|
| 1533 |
+
foreach ( $atts as $key => $value ) {
|
| 1534 |
+
switch( $key ) {
|
| 1535 |
+
case 'ignore_sticky_posts' :
|
| 1536 |
+
case 'show_meta_category' :
|
| 1537 |
+
$atts[ $key ] = self::int_bool( $value );
|
| 1538 |
+
break;
|
| 1539 |
+
case 'nopaging' :
|
| 1540 |
+
$atts[ $key ] = false;
|
| 1541 |
+
break;
|
| 1542 |
+
case 'p' :
|
| 1543 |
+
case 'posts_per_page' :
|
| 1544 |
+
case 'heading_size' :
|
| 1545 |
+
$atts[ $key ] = self::number( $value );
|
| 1546 |
+
break;
|
| 1547 |
+
case 'layout' :
|
| 1548 |
+
$atts[ $key ] = self::featured_post_layout( $value );
|
| 1549 |
+
break;
|
| 1550 |
+
case 'order' :
|
| 1551 |
+
$atts[ $key ] = self::order_field( $value );
|
| 1552 |
+
break;
|
| 1553 |
+
case 'heading_type' :
|
| 1554 |
+
$atts[ $key ] = self::heading_type( $value );
|
| 1555 |
+
break;
|
| 1556 |
+
case 'title' :
|
| 1557 |
+
case 'terms' :
|
| 1558 |
+
case 'pids' :
|
| 1559 |
+
case 'post__in' :
|
| 1560 |
+
$atts[ $key ] = sanitize_text_field( $value );
|
| 1561 |
+
break;
|
| 1562 |
}
|
| 1563 |
}
|
| 1564 |
|
|
|
|
|
|
|
| 1565 |
if ( $atts['posts_per_page'] <= 0 ) {
|
| 1566 |
$atts['posts_per_page'] = 1;
|
| 1567 |
}
|
| 1569 |
$atts['posts_per_page'] = 10;
|
| 1570 |
}
|
| 1571 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1572 |
return $atts;
|
| 1573 |
}
|
| 1574 |
}
|
public/class-vars.php
CHANGED
|
@@ -8,7 +8,7 @@ class WPC_Shortcodes_Vars {
|
|
| 8 |
*
|
| 9 |
* @var string
|
| 10 |
*/
|
| 11 |
-
const VERSION = '3.
|
| 12 |
const DB_VERSION = '1.0';
|
| 13 |
|
| 14 |
/**
|
|
@@ -46,6 +46,7 @@ class WPC_Shortcodes_Vars {
|
|
| 46 |
define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
|
| 47 |
define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
|
| 48 |
define( 'WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_slide_post_type', true ) );
|
|
|
|
| 49 |
|
| 50 |
self::$plugin_settings_url = admin_url( 'themes.php?page=' . self::$plugin_slug );
|
| 51 |
self::$google_maps_api_key = get_option( WC_SHORTCODES_PREFIX . 'google_maps_api_key' );
|
|
@@ -325,6 +326,39 @@ class WPC_Shortcodes_Vars {
|
|
| 325 |
// misc options
|
| 326 |
'class' => '',
|
| 327 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
self::$attr->image_links = array(
|
| 329 |
// image 1
|
| 330 |
'image_1' => '',
|
| 8 |
*
|
| 9 |
* @var string
|
| 10 |
*/
|
| 11 |
+
const VERSION = '3.36';
|
| 12 |
const DB_VERSION = '1.0';
|
| 13 |
|
| 14 |
/**
|
| 46 |
define( 'WC_SHORTCODES_CURRENT_VERSION', get_option( WC_SHORTCODES_PREFIX . 'current_version' ) );
|
| 47 |
define( 'WC_SHORTCODES_FONT_AWESOME_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_font_awesome', true ) );
|
| 48 |
define( 'WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_slide_post_type', true ) );
|
| 49 |
+
define( 'WC_SHORTCODES_COLLAGE_POST_TYPE_ENABLED', get_option( WC_SHORTCODES_PREFIX . 'enable_collage_post_type', true ) );
|
| 50 |
|
| 51 |
self::$plugin_settings_url = admin_url( 'themes.php?page=' . self::$plugin_slug );
|
| 52 |
self::$google_maps_api_key = get_option( WC_SHORTCODES_PREFIX . 'google_maps_api_key' );
|
| 326 |
// misc options
|
| 327 |
'class' => '',
|
| 328 |
);
|
| 329 |
+
self::$attr->collage = array(
|
| 330 |
+
'pids' => '', //use post id.
|
| 331 |
+
'p' => '', //use post id.
|
| 332 |
+
'post__in' => '', //use post ids
|
| 333 |
+
'order' => 'DESC', // DESC, ASC
|
| 334 |
+
'orderby' => 'date',
|
| 335 |
+
'post_status' => 'publish',
|
| 336 |
+
'post_type' => 'wcs_collage', // post, page, wc_portfolio_item, etc
|
| 337 |
+
'posts_per_page' => 10, //number of post to show per page
|
| 338 |
+
'nopaging' => false, //show all posts or use pagination. Default value is 'false', use paging.
|
| 339 |
+
'ignore_sticky_posts' => 1,
|
| 340 |
+
|
| 341 |
+
'taxonomy' => '', // category, post_tag, wc_portfolio_tag, etc
|
| 342 |
+
'field' => 'slug', // slug or id
|
| 343 |
+
'terms' => '', // taxonomy terms.
|
| 344 |
+
|
| 345 |
+
'button_class' => '', // show main content?
|
| 346 |
+
|
| 347 |
+
'size' => 'full', // default thumbnail size
|
| 348 |
+
|
| 349 |
+
'heading_size' => 26,
|
| 350 |
+
'mobile_heading_size' => 18,
|
| 351 |
+
'layout' => 'bxslider', // blog layout
|
| 352 |
+
'template' => 'collage1',
|
| 353 |
+
'gutter_space' => 7,
|
| 354 |
+
'desktop_height' => 600,
|
| 355 |
+
'laptop_height' => 500,
|
| 356 |
+
'mobile_height' => 250,
|
| 357 |
+
|
| 358 |
+
'slider_mode' => 'fade',
|
| 359 |
+
'slider_pause' => 4000,
|
| 360 |
+
'slider_auto' => 0,
|
| 361 |
+
);
|
| 362 |
self::$attr->image_links = array(
|
| 363 |
// image 1
|
| 364 |
'image_1' => '',
|
public/class-widget-options.php
CHANGED
|
@@ -41,10 +41,25 @@ class WPC_Shortcodes_Widget_Options {
|
|
| 41 |
);
|
| 42 |
}
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
public static function posts_layouts() {
|
| 45 |
return array(
|
| 46 |
'masonry' => 'Masonry',
|
| 47 |
'grid' => 'Grid',
|
|
|
|
| 48 |
);
|
| 49 |
}
|
| 50 |
|
|
@@ -55,17 +70,15 @@ class WPC_Shortcodes_Widget_Options {
|
|
| 55 |
);
|
| 56 |
}
|
| 57 |
|
| 58 |
-
public static function
|
| 59 |
return array(
|
| 60 |
-
'
|
| 61 |
-
'column' => 'Column',
|
| 62 |
);
|
| 63 |
}
|
| 64 |
|
| 65 |
-
public static function
|
| 66 |
return array(
|
| 67 |
-
'
|
| 68 |
-
'showcase' => 'Showcase',
|
| 69 |
);
|
| 70 |
}
|
| 71 |
|
| 41 |
);
|
| 42 |
}
|
| 43 |
|
| 44 |
+
public static function image_links_style_format_values() {
|
| 45 |
+
return array(
|
| 46 |
+
'row' => 'Row',
|
| 47 |
+
'column' => 'Column',
|
| 48 |
+
);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
public static function featured_post_layouts() {
|
| 52 |
+
return array(
|
| 53 |
+
'thumbnail' => 'Thumbnail',
|
| 54 |
+
'showcase' => 'Showcase',
|
| 55 |
+
);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
public static function posts_layouts() {
|
| 59 |
return array(
|
| 60 |
'masonry' => 'Masonry',
|
| 61 |
'grid' => 'Grid',
|
| 62 |
+
'single-column' => 'Single Column',
|
| 63 |
);
|
| 64 |
}
|
| 65 |
|
| 70 |
);
|
| 71 |
}
|
| 72 |
|
| 73 |
+
public static function collage_templates() {
|
| 74 |
return array(
|
| 75 |
+
'collage1' => 'Style 1',
|
|
|
|
| 76 |
);
|
| 77 |
}
|
| 78 |
|
| 79 |
+
public static function post_slider_layouts() {
|
| 80 |
return array(
|
| 81 |
+
'bxslider' => 'Box Slider',
|
|
|
|
| 82 |
);
|
| 83 |
}
|
| 84 |
|
public/class-widgets.php
CHANGED
|
@@ -36,5 +36,9 @@ class WPC_Shortcodes_Widgets extends WPC_Shortcodes_Vars {
|
|
| 36 |
register_widget( 'WPC_Shortcodes_Widget_Post_Slider' );
|
| 37 |
register_widget( 'WPC_Shortcodes_Widget_Image_Links' );
|
| 38 |
register_widget( 'WPC_Shortcodes_Widget_Featured_Posts' );
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
}
|
| 40 |
}
|
| 36 |
register_widget( 'WPC_Shortcodes_Widget_Post_Slider' );
|
| 37 |
register_widget( 'WPC_Shortcodes_Widget_Image_Links' );
|
| 38 |
register_widget( 'WPC_Shortcodes_Widget_Featured_Posts' );
|
| 39 |
+
|
| 40 |
+
if ( WC_SHORTCODES_COLLAGE_POST_TYPE_ENABLED ) {
|
| 41 |
+
register_widget( 'WPC_Shortcodes_Widget_Collage' );
|
| 42 |
+
}
|
| 43 |
}
|
| 44 |
}
|
public/functions.php
CHANGED
|
@@ -53,6 +53,22 @@ function wc_shortcodes_the_media_content( $more_link_text = null, $strip_teaser
|
|
| 53 |
echo $content;
|
| 54 |
}
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
function wc_shortcodes_the_content( $more_link_text = null, $strip_teaser = false ) {
|
| 57 |
$content = get_the_content( $more_link_text, $strip_teaser );
|
| 58 |
|
| 53 |
echo $content;
|
| 54 |
}
|
| 55 |
|
| 56 |
+
function wc_shortcodes_get_the_content( $more_link_text = null, $strip_teaser = false ) {
|
| 57 |
+
$content = get_the_content( $more_link_text, $strip_teaser );
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Filter the post content.
|
| 61 |
+
*
|
| 62 |
+
* @since 0.71
|
| 63 |
+
*
|
| 64 |
+
* @param string $content Content of the current post.
|
| 65 |
+
*/
|
| 66 |
+
$content = apply_filters( 'wc_shortcodes_the_content', $content );
|
| 67 |
+
$content = str_replace( ']]>', ']]>', $content );
|
| 68 |
+
|
| 69 |
+
return $content;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
function wc_shortcodes_the_content( $more_link_text = null, $strip_teaser = false ) {
|
| 73 |
$content = get_the_content( $more_link_text, $strip_teaser );
|
| 74 |
|
public/post-types/class-collage-post-type.php
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class WPC_Shortcodes_Collage_Post_Type {
|
| 3 |
+
|
| 4 |
+
protected static $instance = null;
|
| 5 |
+
|
| 6 |
+
public static function get_instance() {
|
| 7 |
+
|
| 8 |
+
// If the single instance hasn't been set, set it now.
|
| 9 |
+
if ( null == self::$instance ) {
|
| 10 |
+
self::$instance = new self;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
return self::$instance;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
private function __construct() {
|
| 17 |
+
/* Register custom post types on the 'init' hook. */
|
| 18 |
+
add_action( 'init', array( &$this, 'register_post_types' ) );
|
| 19 |
+
|
| 20 |
+
/* Register taxonomies on the 'init' hook. */
|
| 21 |
+
add_action( 'init', array( &$this, 'register_taxonomies' ) );
|
| 22 |
+
|
| 23 |
+
add_action( 'save_post', array( &$this, 'save_meta' ), 1, 2 ); // save the custom fields
|
| 24 |
+
|
| 25 |
+
add_action( 'add_meta_boxes', array( &$this, 'collage_metabox' ) );
|
| 26 |
+
// add_action('do_meta_boxes', array( &$this, 'replace_featured_image_box' ) );
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function replace_featured_image_box() {
|
| 30 |
+
remove_meta_box( 'postimagediv', 'wcs_collage', 'side' );
|
| 31 |
+
add_meta_box('postimagediv', __('Background Image'), 'post_thumbnail_meta_box', 'wcs_collage', 'side', 'low');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Registers post types needed by the plugin.
|
| 36 |
+
*
|
| 37 |
+
* @since 0.1.0
|
| 38 |
+
* @access public
|
| 39 |
+
* @return void
|
| 40 |
+
*/
|
| 41 |
+
public function register_post_types() {
|
| 42 |
+
|
| 43 |
+
/* Set up the arguments for the collage item post type. */
|
| 44 |
+
$args = array(
|
| 45 |
+
'description' => '',
|
| 46 |
+
'public' => false,
|
| 47 |
+
'publicly_queryable' => false,
|
| 48 |
+
'show_in_nav_menus' => false,
|
| 49 |
+
'show_in_admin_bar' => true,
|
| 50 |
+
'exclude_from_search' => true,
|
| 51 |
+
'show_ui' => true,
|
| 52 |
+
'show_in_menu' => true,
|
| 53 |
+
'menu_position' => 11,
|
| 54 |
+
'menu_icon' => 'dashicons-images-alt2',
|
| 55 |
+
'can_export' => true,
|
| 56 |
+
'delete_with_user' => false,
|
| 57 |
+
'hierarchical' => false,
|
| 58 |
+
'has_archive' => false,
|
| 59 |
+
'query_var' => false,
|
| 60 |
+
'register_meta_box_cb' => array( &$this, 'collage_metabox' ),
|
| 61 |
+
|
| 62 |
+
/* The rewrite handles the URL structure. */
|
| 63 |
+
'rewrite' => false,
|
| 64 |
+
|
| 65 |
+
/* What features the post type supports. */
|
| 66 |
+
'supports' => array(
|
| 67 |
+
'title',
|
| 68 |
+
'editor',
|
| 69 |
+
'thumbnail',
|
| 70 |
+
'page-attributes',
|
| 71 |
+
),
|
| 72 |
+
|
| 73 |
+
/* Labels used when displaying the posts. */
|
| 74 |
+
'labels' => array(
|
| 75 |
+
'name' => __( 'Collage Items', 'wc-shortcodes' ),
|
| 76 |
+
'singular_name' => __( 'Collage Item', 'wc-shortcodes' ),
|
| 77 |
+
'menu_name' => __( 'Collage', 'wc-shortcodes' ),
|
| 78 |
+
'name_admin_bar' => __( 'Collage Item', 'wc-shortcodes' ),
|
| 79 |
+
'add_new' => __( 'Add New', 'wc-shortcodes' ),
|
| 80 |
+
'add_new_item' => __( 'Add New Collage Item', 'wc-shortcodes' ),
|
| 81 |
+
'edit_item' => __( 'Edit Collage Item', 'wc-shortcodes' ),
|
| 82 |
+
'new_item' => __( 'New Collage Item', 'wc-shortcodes' ),
|
| 83 |
+
'view_item' => __( 'View Collage Item', 'wc-shortcodes' ),
|
| 84 |
+
'search_items' => __( 'Search Collage', 'wc-shortcodes' ),
|
| 85 |
+
'not_found' => __( 'No collage items found', 'wc-shortcodes' ),
|
| 86 |
+
'not_found_in_trash' => __( 'No collage items found in trash', 'wc-shortcodes' ),
|
| 87 |
+
'all_items' => __( 'Collage Items', 'wc-shortcodes' ),
|
| 88 |
+
|
| 89 |
+
// Custom labels b/c WordPress doesn't have anything to handle this.
|
| 90 |
+
'archive_title' => __( 'Collage', 'wc-shortcodes' ),
|
| 91 |
+
)
|
| 92 |
+
);
|
| 93 |
+
|
| 94 |
+
/* Register the collage item post type. */
|
| 95 |
+
register_post_type( 'wcs_collage', $args );
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Register taxonomies for the plugin.
|
| 100 |
+
*
|
| 101 |
+
* @since 0.1.0
|
| 102 |
+
* @access public
|
| 103 |
+
* @return void.
|
| 104 |
+
*/
|
| 105 |
+
public function register_taxonomies() {
|
| 106 |
+
|
| 107 |
+
/* Set up the arguments for the collage taxonomy. */
|
| 108 |
+
$args = array(
|
| 109 |
+
'public' => false,
|
| 110 |
+
'show_ui' => true,
|
| 111 |
+
'show_in_nav_menus' => false,
|
| 112 |
+
'show_tagcloud' => false,
|
| 113 |
+
'show_admin_column' => true,
|
| 114 |
+
'hierarchical' => true,
|
| 115 |
+
'query_var' => false,
|
| 116 |
+
|
| 117 |
+
/* The rewrite handles the URL structure. */
|
| 118 |
+
'rewrite' => false,
|
| 119 |
+
|
| 120 |
+
/* Labels used when displaying taxonomy and terms. */
|
| 121 |
+
'labels' => array(
|
| 122 |
+
'name' => __( 'Collage Categories', 'wc-shortcodes' ),
|
| 123 |
+
'singular_name' => __( 'Collage Category', 'wc-shortcodes' ),
|
| 124 |
+
'menu_name' => __( 'Categories', 'wc-shortcodes' ),
|
| 125 |
+
'name_admin_bar' => __( 'Collage Category', 'wc-shortcodes' ),
|
| 126 |
+
'search_items' => __( 'Search Collage Categories', 'wc-shortcodes' ),
|
| 127 |
+
'popular_items' => __( 'Popular Collage Categories', 'wc-shortcodes' ),
|
| 128 |
+
'all_items' => __( 'All Collage Categories', 'wc-shortcodes' ),
|
| 129 |
+
'edit_item' => __( 'Edit Collage Category', 'wc-shortcodes' ),
|
| 130 |
+
'view_item' => __( 'View Collage Category', 'wc-shortcodes' ),
|
| 131 |
+
'update_item' => __( 'Update Collage Category', 'wc-shortcodes' ),
|
| 132 |
+
'add_new_item' => __( 'Add New Collage Category', 'wc-shortcodes' ),
|
| 133 |
+
'new_item_name' => __( 'New Collage Category Name', 'wc-shortcodes' ),
|
| 134 |
+
'separate_items_with_commas' => __( 'Separate collage categories with commas', 'wc-shortcodes' ),
|
| 135 |
+
'add_or_remove_items' => __( 'Add or remove collage categories', 'wc-shortcodes' ),
|
| 136 |
+
'choose_from_most_used' => __( 'Choose from the most used collage categories', 'wc-shortcodes' ),
|
| 137 |
+
)
|
| 138 |
+
);
|
| 139 |
+
|
| 140 |
+
/* Register the 'collage' taxonomy. */
|
| 141 |
+
register_taxonomy( 'wcs_collage_cat', array( 'wcs_collage' ), $args );
|
| 142 |
+
|
| 143 |
+
/* Set up the arguments for the collage taxonomy. */
|
| 144 |
+
$args = array(
|
| 145 |
+
'public' => false,
|
| 146 |
+
'show_ui' => true,
|
| 147 |
+
'show_in_nav_menus' => false,
|
| 148 |
+
'show_tagcloud' => false,
|
| 149 |
+
'show_admin_column' => true,
|
| 150 |
+
'hierarchical' => false,
|
| 151 |
+
'query_var' => 'collage_tag',
|
| 152 |
+
|
| 153 |
+
/* The rewrite handles the URL structure. */
|
| 154 |
+
'rewrite' => false,
|
| 155 |
+
|
| 156 |
+
/* Labels used when displaying taxonomy and terms. */
|
| 157 |
+
'labels' => array(
|
| 158 |
+
'name' => __( 'Collage Tags', 'wc-shortcodes' ),
|
| 159 |
+
'singular_name' => __( 'Collage Tag', 'wc-shortcodes' ),
|
| 160 |
+
'menu_name' => __( 'Tags', 'wc-shortcodes' ),
|
| 161 |
+
'name_admin_bar' => __( 'Collage Tag', 'wc-shortcodes' ),
|
| 162 |
+
'search_items' => __( 'Search Collage Tags', 'wc-shortcodes' ),
|
| 163 |
+
'popular_items' => __( 'Popular Collage Tags', 'wc-shortcodes' ),
|
| 164 |
+
'all_items' => __( 'All Collage Tags', 'wc-shortcodes' ),
|
| 165 |
+
'edit_item' => __( 'Edit Collage Tag', 'wc-shortcodes' ),
|
| 166 |
+
'view_item' => __( 'View Collage Tag', 'wc-shortcodes' ),
|
| 167 |
+
'update_item' => __( 'Update Collage Tag', 'wc-shortcodes' ),
|
| 168 |
+
'add_new_item' => __( 'Add New Collage Tag', 'wc-shortcodes' ),
|
| 169 |
+
'new_item_name' => __( 'New Collage Tag Name', 'wc-shortcodes' ),
|
| 170 |
+
'separate_items_with_commas' => __( 'Separate collage tags with commas', 'wc-shortcodes' ),
|
| 171 |
+
'add_or_remove_items' => __( 'Add or remove collage tags', 'wc-shortcodes' ),
|
| 172 |
+
'choose_from_most_used' => __( 'Choose from the most used collage tags', 'wc-shortcodes' ),
|
| 173 |
+
)
|
| 174 |
+
);
|
| 175 |
+
|
| 176 |
+
/* Register the 'collage' taxonomy. */
|
| 177 |
+
register_taxonomy( 'wcs_collage_tag', array( 'wcs_collage' ), $args );
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
public function save_meta($post_id, $post) {
|
| 181 |
+
|
| 182 |
+
if ( ! isset( $_POST['collagedetails_noncename'] ) ) {
|
| 183 |
+
return;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
// verify this came from the our screen and with proper authorization,
|
| 187 |
+
// because save_post can be triggered at other times
|
| 188 |
+
if ( ! wp_verify_nonce( $_POST['collagedetails_noncename'], plugin_basename(__FILE__) )) {
|
| 189 |
+
return $post->ID;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
// Is the user allowed to edit the post or page?
|
| 193 |
+
if ( !current_user_can( 'edit_post', $post->ID ))
|
| 194 |
+
return $post->ID;
|
| 195 |
+
|
| 196 |
+
// OK, we're authenticated: we need to find and save the data
|
| 197 |
+
// We'll put it into an array to make it easier to loop though.
|
| 198 |
+
|
| 199 |
+
$meta['_wc_shortcodes_collage_url'] = esc_url_raw( $_POST['_wc_shortcodes_collage_url'] );
|
| 200 |
+
$meta['_wc_shortcodes_collage_text_color'] = WPC_Shortcodes_Sanitize::hex_color( $_POST['_wc_shortcodes_collage_text_color'] );
|
| 201 |
+
$meta['_wc_shortcodes_collage_text_background_color'] = WPC_Shortcodes_Sanitize::hex_color( $_POST['_wc_shortcodes_collage_text_background_color'] );
|
| 202 |
+
$meta['_wc_shortcodes_collage_text_background_opacity'] = WPC_Shortcodes_Sanitize::opacity( $_POST['_wc_shortcodes_collage_text_background_opacity'] );
|
| 203 |
+
$meta['_wc_shortcodes_collage_text_max_width'] = WPC_Shortcodes_Sanitize::positive_number( $_POST['_wc_shortcodes_collage_text_max_width'] );
|
| 204 |
+
$meta['_wc_shortcodes_collage_button_text'] = WPC_Shortcodes_Sanitize::text_field( $_POST['_wc_shortcodes_collage_button_text'] );
|
| 205 |
+
$meta['_wc_shortcodes_collage_background_color'] = WPC_Shortcodes_Sanitize::hex_color( $_POST['_wc_shortcodes_collage_background_color'] );
|
| 206 |
+
|
| 207 |
+
// Add values of $events_meta as custom fields
|
| 208 |
+
|
| 209 |
+
foreach ( $meta as $key => $value ) { // Cycle through the $events_meta array!
|
| 210 |
+
if( $post->post_type == 'revision' ) {
|
| 211 |
+
// Don't store custom data twice
|
| 212 |
+
return;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
// $value = implode(',', (array)$value); // If $value is an array, make it a CSV (unlikely)
|
| 216 |
+
|
| 217 |
+
if ( get_post_meta( $post->ID, $key, false ) ) {
|
| 218 |
+
// If the custom field already has a value
|
| 219 |
+
update_post_meta( $post->ID, $key, $value );
|
| 220 |
+
} else {
|
| 221 |
+
// If the custom field doesn't have a value
|
| 222 |
+
add_post_meta( $post->ID, $key, $value );
|
| 223 |
+
}
|
| 224 |
+
if( ! $value ) {
|
| 225 |
+
delete_post_meta( $post->ID, $key ); // Delete if blank
|
| 226 |
+
}
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
public function collage_details() {
|
| 232 |
+
global $post;
|
| 233 |
+
|
| 234 |
+
// Noncename needed to verify where the data originated
|
| 235 |
+
echo '<input type="hidden" name="collagedetails_noncename" id="collagedetails_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
|
| 236 |
+
|
| 237 |
+
// Get the location data if its already been entered
|
| 238 |
+
$url = get_post_meta($post->ID, '_wc_shortcodes_collage_url', true);
|
| 239 |
+
$text_color = get_post_meta($post->ID, '_wc_shortcodes_collage_text_color', true);
|
| 240 |
+
$text_background_color = get_post_meta($post->ID, '_wc_shortcodes_collage_text_background_color', true);
|
| 241 |
+
$text_background_opacity = get_post_meta($post->ID, '_wc_shortcodes_collage_text_background_opacity', true);
|
| 242 |
+
$text_max_width = get_post_meta($post->ID, '_wc_shortcodes_collage_text_max_width', true);
|
| 243 |
+
$button_text = get_post_meta($post->ID, '_wc_shortcodes_collage_button_text', true);
|
| 244 |
+
$background_color = get_post_meta($post->ID, '_wc_shortcodes_collage_background_color', true);
|
| 245 |
+
|
| 246 |
+
?>
|
| 247 |
+
<p><strong>URL:</strong></p>
|
| 248 |
+
<input type="text" name="_wc_shortcodes_collage_url" value="<?php echo $url; ?>" class="widefat" />
|
| 249 |
+
<p class="description">Enter link this box should go to.</p>
|
| 250 |
+
|
| 251 |
+
<p><strong>Text Color:</strong></p>
|
| 252 |
+
<input type="text" name="_wc_shortcodes_collage_text_color" value="<?php echo $text_color; ?>" class="widefat wpc-color-field" />
|
| 253 |
+
<p class="description">Leave blank to use default theme colors.</p>
|
| 254 |
+
|
| 255 |
+
<p><strong>Text Background Color:</strong></p>
|
| 256 |
+
<input type="text" name="_wc_shortcodes_collage_text_background_color" value="<?php echo $text_background_color; ?>" class="widefat wpc-color-field" />
|
| 257 |
+
<p class="description">Leave blank if you want no test background color.</p>
|
| 258 |
+
|
| 259 |
+
<p><strong>Text Background Opacity:</strong></p>
|
| 260 |
+
<input type="text" name="_wc_shortcodes_collage_text_background_opacity" value="<?php echo $text_background_opacity; ?>" class="widefat" />
|
| 261 |
+
<p class="description">Enter decimal value from 0 to 1. Leave blank for no opacity.</p>
|
| 262 |
+
|
| 263 |
+
<p><strong>Text Max Width:</strong></p>
|
| 264 |
+
<input type="text" name="_wc_shortcodes_collage_text_max_width" value="<?php echo $text_max_width; ?>" class="widefat" />
|
| 265 |
+
<p class="description">Enter pixel value.</p>
|
| 266 |
+
|
| 267 |
+
<p><strong>Button Text:</strong></p>
|
| 268 |
+
<input type="text" name="_wc_shortcodes_collage_button_text" value="<?php echo $button_text; ?>" class="widefat" />
|
| 269 |
+
<p class="description">Leave blank if you do want to display a button.</p>
|
| 270 |
+
|
| 271 |
+
<p><strong>Background Color:</strong></p>
|
| 272 |
+
<input type="text" name="_wc_shortcodes_collage_background_color" value="<?php echo $background_color; ?>" class="widefat wpc-color-field" />
|
| 273 |
+
<p class="description">Leave blank if you want no background color.</p>
|
| 274 |
+
|
| 275 |
+
<script type="text/javascript">
|
| 276 |
+
/* <![CDATA[ */
|
| 277 |
+
jQuery(document).ready(function($){
|
| 278 |
+
$('.wpc-color-field').each(function(){
|
| 279 |
+
$(this).wpColorPicker();
|
| 280 |
+
});
|
| 281 |
+
});
|
| 282 |
+
/* ]]> */
|
| 283 |
+
</script>
|
| 284 |
+
<?php
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
public function collage_metabox() {
|
| 288 |
+
add_meta_box('wc-shortcodes-collage-metabox', 'Collage Details', array( &$this, 'collage_details' ), 'wcs_collage', 'normal', 'high');
|
| 289 |
+
}
|
| 290 |
+
}
|
public/{class-post-types.php → post-types/class-slide-post-type.php}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
|
| 4 |
protected static $instance = null;
|
| 5 |
|
|
@@ -23,6 +23,12 @@ class WPC_Shortcodes_Post_Types {
|
|
| 23 |
add_action( 'save_post', array( &$this, 'save_meta' ), 1, 2 ); // save the custom fields
|
| 24 |
|
| 25 |
add_action( 'add_meta_boxes', array( &$this, 'slide_metabox' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
|
| 28 |
/**
|
| 1 |
<?php
|
| 2 |
+
class WPC_Shortcodes_Slide_Post_Type {
|
| 3 |
|
| 4 |
protected static $instance = null;
|
| 5 |
|
| 23 |
add_action( 'save_post', array( &$this, 'save_meta' ), 1, 2 ); // save the custom fields
|
| 24 |
|
| 25 |
add_action( 'add_meta_boxes', array( &$this, 'slide_metabox' ) );
|
| 26 |
+
// add_action('do_meta_boxes', array( &$this, 'replace_featured_image_box' ) );
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function replace_featured_image_box() {
|
| 30 |
+
remove_meta_box( 'postimagediv', 'wcs_slide', 'side' );
|
| 31 |
+
add_meta_box('postimagediv', __('Slide Image'), 'post_thumbnail_meta_box', 'wcs_slide', 'side', 'low');
|
| 32 |
}
|
| 33 |
|
| 34 |
/**
|
public/templates/collage1/content.php
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$url = get_post_meta($post->ID, '_wc_shortcodes_collage_url', true);
|
| 3 |
+
$text_color = get_post_meta($post->ID, '_wc_shortcodes_collage_text_color', true);
|
| 4 |
+
$text_background_color = get_post_meta($post->ID, '_wc_shortcodes_collage_text_background_color', true);
|
| 5 |
+
$text_background_opacity = get_post_meta($post->ID, '_wc_shortcodes_collage_text_background_opacity', true);
|
| 6 |
+
$text_max_width = get_post_meta($post->ID, '_wc_shortcodes_collage_text_max_width', true);
|
| 7 |
+
$button_text = get_post_meta($post->ID, '_wc_shortcodes_collage_button_text', true);
|
| 8 |
+
$background_color = get_post_meta($post->ID, '_wc_shortcodes_collage_background_color', true);
|
| 9 |
+
|
| 10 |
+
$image_style = array();
|
| 11 |
+
if ( $background_color ) {
|
| 12 |
+
$image_style[] = 'background-color:' . esc_attr( $background_color ) . ';';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
$content_inner_style = array();
|
| 16 |
+
if ( $text_max_width ) {
|
| 17 |
+
$content_inner_style[] = 'max-width:' . intval( $text_max_width ) . 'px;';
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
$content_style = array();
|
| 21 |
+
if ( $text_background_color ) {
|
| 22 |
+
$content_style[] = 'background-color:' . esc_attr( $text_background_color ) . ';';
|
| 23 |
+
}
|
| 24 |
+
if ( $text_background_opacity && $text_background_opacity < 1 ) {
|
| 25 |
+
$content_style[] = 'opacity:' . esc_attr( $text_background_opacity ) . ';';
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$content_text_style = array();
|
| 29 |
+
$content_text_class = array();
|
| 30 |
+
if ( $text_color ) {
|
| 31 |
+
$content_text_style[] = 'color:' . esc_attr( $text_color ) . ';';
|
| 32 |
+
$content_text_class[] = 'wc-shortcodes-collage-content-style';
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
$content = wc_shortcodes_get_the_content();
|
| 36 |
+
$content_text_class[] = 'wc-shortcodes-collage-content';
|
| 37 |
+
|
| 38 |
+
$show_content_box = false;
|
| 39 |
+
if ( $content || $button_text ) {
|
| 40 |
+
$show_content_box = true;
|
| 41 |
+
}
|
| 42 |
+
?>
|
| 43 |
+
|
| 44 |
+
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
|
| 45 |
+
<?php $img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $display['size'] ); ?>
|
| 46 |
+
<?php $image_style[] = 'background-image:url(\''.$img[0].'\');'; ?>
|
| 47 |
+
<?php endif; ?>
|
| 48 |
+
|
| 49 |
+
<?php if ( ! empty( $url ) ) : ?>
|
| 50 |
+
<div data-href="<?php echo esc_url( $url ); ?>" id="post-<?php the_ID(); ?>" <?php post_class( 'wc-shortcodes-collage-panel-background wc-shortcodes-collage-has-link' ); ?> style="<?php echo implode( '', $image_style ); ?>">
|
| 51 |
+
<?php else: ?>
|
| 52 |
+
<div id="post-<?php the_ID(); ?>" <?php post_class( 'wc-shortcodes-collage-panel-background' ); ?> style="<?php echo implode( '', $image_style ); ?>">
|
| 53 |
+
<?php endif; ?>
|
| 54 |
+
|
| 55 |
+
<?php if ( $show_content_box ) : ?>
|
| 56 |
+
|
| 57 |
+
<div class="wc-shortcodes-collage-panel-content" style="<?php echo implode( '', $content_style ); ?>">
|
| 58 |
+
<div class="wc-shortcodes-collage-panel-content-inner" style="<?php echo implode( '', $content_inner_style ); ?>">
|
| 59 |
+
|
| 60 |
+
<?php if ( ! empty( $content ) ) : ?>
|
| 61 |
+
<div class="<?php echo implode( ' ', $content_text_class ); ?>" style="<?php echo implode( '', $content_text_style ); ?>">
|
| 62 |
+
<?php echo $content; ?>
|
| 63 |
+
|
| 64 |
+
<?php if ( ! empty( $button_text ) && ! empty( $url ) ) : ?>
|
| 65 |
+
<div class="wc-shortcodes-collage-button-wrapper">
|
| 66 |
+
<a class="<?php echo esc_attr( $display['button_class'] ); ?>" href="<?php echo esc_url( $url ); ?>"><?php echo $button_text; ?></a>
|
| 67 |
+
</div><!-- .entry-summary -->
|
| 68 |
+
<?php endif; ?>
|
| 69 |
+
|
| 70 |
+
</div><!-- .entry-summary -->
|
| 71 |
+
<?php endif; ?>
|
| 72 |
+
|
| 73 |
+
</div>
|
| 74 |
+
</div><!-- .wc-shortcodes-collage-panel-content -->
|
| 75 |
+
|
| 76 |
+
<?php endif; ?>
|
| 77 |
+
|
| 78 |
+
<?php edit_post_link( __( 'Edit', 'wc-shortcodes' ) ); ?>
|
| 79 |
+
|
| 80 |
+
</div><!-- #post -->
|
public/templates/collage1/index.php
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$count = $wc_shortcodes_posts_query->post_count;
|
| 3 |
+
|
| 4 |
+
$class = array();
|
| 5 |
+
$class[] = 'wc-shortcodes-collage';
|
| 6 |
+
$class[] = 'wc-shortcodes-clearfix';
|
| 7 |
+
$class[] = 'wc-shortcodes-collage-layout-' . $display['layout'];
|
| 8 |
+
$class[] = 'wc-shortcodes-collage-template-' . $display['template'];
|
| 9 |
+
$class[] = 'wc-shortcodes-collage-count-' . $count;
|
| 10 |
+
$slider_enabled = false;
|
| 11 |
+
|
| 12 |
+
// enqueue scripts
|
| 13 |
+
if ( 5 < $count && 'bxslider' == $display['layout'] ) {
|
| 14 |
+
wp_enqueue_script('wc-shortcodes-bxslider');
|
| 15 |
+
$class[] = 'wc-shortcodes-collage-slider-enabled';
|
| 16 |
+
$slider_enabled = true;
|
| 17 |
+
}
|
| 18 |
+
wp_enqueue_script('wc-shortcodes-collage');
|
| 19 |
+
?>
|
| 20 |
+
<style>
|
| 21 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column {
|
| 22 |
+
height: <?php echo $display['desktop_height']; ?>px;
|
| 23 |
+
}
|
| 24 |
+
<?php if ( ! empty( $display['gutter_space'] ) ) : ?>
|
| 25 |
+
.wc-shortcodes-collage.wc-shortcodes-collage-template-collage1,
|
| 26 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-wrapper {
|
| 27 |
+
margin-right: -<?php echo $display['gutter_space']; ?>px;
|
| 28 |
+
}
|
| 29 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-panel-wrapper,
|
| 30 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-1 .wc-shortcodes-collage-panel-4 {
|
| 31 |
+
padding-top: <?php echo $display['gutter_space']; ?>px;
|
| 32 |
+
}
|
| 33 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 .wc-shortcodes-collage-panel-inner,
|
| 34 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-inner {
|
| 35 |
+
padding-right: <?php echo $display['gutter_space']; ?>px;
|
| 36 |
+
}
|
| 37 |
+
<?php endif; ?>
|
| 38 |
+
<?php if ( ! empty( $display['heading_size'] ) ) : ?>
|
| 39 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h1,
|
| 40 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h2,
|
| 41 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h3,
|
| 42 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h4,
|
| 43 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h5,
|
| 44 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h6 {
|
| 45 |
+
font-size: <?php echo $display['heading_size']; ?>px;
|
| 46 |
+
}
|
| 47 |
+
<?php endif; ?>
|
| 48 |
+
@media (max-width: 1150px) {
|
| 49 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column {
|
| 50 |
+
height: <?php echo $display['laptop_height']; ?>px;
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
@media (max-width: 1150px) and (min-width: 991px) {
|
| 54 |
+
<?php if ( ! empty( $display['mobile_heading_size'] ) ) : ?>
|
| 55 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h1,
|
| 56 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h2,
|
| 57 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h3,
|
| 58 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h4,
|
| 59 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h5,
|
| 60 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h6 {
|
| 61 |
+
font-size: <?php echo $display['mobile_heading_size']; ?>px;
|
| 62 |
+
}
|
| 63 |
+
<?php endif; ?>
|
| 64 |
+
}
|
| 65 |
+
@media (max-width: 990px) {
|
| 66 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column {
|
| 67 |
+
width: 100%;
|
| 68 |
+
}
|
| 69 |
+
.wc-shortcodes-collage-template-collage1 .wc-shortcodes-collage-column-2 {
|
| 70 |
+
padding-top: <?php echo $display['gutter_space']; ?>px;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
@media (max-width: 767px) {
|
| 74 |
+
<?php if ( ! empty( $display['mobile_heading_size'] ) ) : ?>
|
| 75 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h1,
|
| 76 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h2,
|
| 77 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h3,
|
| 78 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h4,
|
| 79 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h5,
|
| 80 |
+
#wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-content h6 {
|
| 81 |
+
font-size: <?php echo $display['mobile_heading_size']; ?>px;
|
| 82 |
+
}
|
| 83 |
+
<?php endif; ?>
|
| 84 |
+
}
|
| 85 |
+
@media (max-width: 567px) {
|
| 86 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-panel {
|
| 87 |
+
padding-top: <?php echo $display['gutter_space']; ?>px;
|
| 88 |
+
}
|
| 89 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-panel,
|
| 90 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-panel-background,
|
| 91 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-panel-wrapper {
|
| 92 |
+
height: auto;
|
| 93 |
+
}
|
| 94 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-slider,
|
| 95 |
+
body #wc-shortcodes-collage-<?php echo $instance; ?> .wc-shortcodes-collage-column .wc-shortcodes-collage-panel-background {
|
| 96 |
+
height: <?php echo $display['mobile_height']; ?>px;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
}
|
| 100 |
+
</style>
|
| 101 |
+
|
| 102 |
+
<div id="wc-shortcodes-collage-<?php echo $instance; ?>" class="wc-shortcodes-collage-wrapper">
|
| 103 |
+
<div id="wc-shortcodes-collage" class="<?php echo esc_attr( implode( ' ', $class ) ); ?>">
|
| 104 |
+
|
| 105 |
+
<?php if ( $wc_shortcodes_posts_query->have_posts() ) : ?>
|
| 106 |
+
<div class="wc-shortcodes-collage-column wc-shortcodes-collage-column-1">
|
| 107 |
+
<div class="wc-shortcodes-collage-column-inner">
|
| 108 |
+
<?php if ( 4 <= $count ) : ?>
|
| 109 |
+
<?php if ( 4 < $count ) : ?>
|
| 110 |
+
<?php if ( $slider_enabled ) : ?>
|
| 111 |
+
<?php include( 'loop-slider.php' ); ?>
|
| 112 |
+
<?php else : ?>
|
| 113 |
+
<?php include( 'loop-image.php' ); ?>
|
| 114 |
+
<?php endif; ?>
|
| 115 |
+
<?php endif; ?>
|
| 116 |
+
|
| 117 |
+
<?php if ( 4 == $count ) : ?>
|
| 118 |
+
<div class="wc-shortcodes-collage-panel wc-shortcodes-collage-panel-<?php echo $count; ?>">
|
| 119 |
+
<?php $wc_shortcodes_posts_query->the_post(); ?>
|
| 120 |
+
<?php include( 'content.php' ); ?>
|
| 121 |
+
<?php $count--; ?>
|
| 122 |
+
</div>
|
| 123 |
+
<?php endif; ?>
|
| 124 |
+
<?php endif; ?>
|
| 125 |
+
</div>
|
| 126 |
+
</div>
|
| 127 |
+
<div class="wc-shortcodes-collage-column wc-shortcodes-collage-column-2">
|
| 128 |
+
<div class="wc-shortcodes-collage-column-inner">
|
| 129 |
+
<div class="wc-shortcodes-collage-panel wc-shortcodes-collage-panel-<?php echo $count; ?>">
|
| 130 |
+
<?php $wc_shortcodes_posts_query->the_post(); ?>
|
| 131 |
+
<?php include( 'content.php' ); ?>
|
| 132 |
+
<?php $count--; ?>
|
| 133 |
+
</div>
|
| 134 |
+
<div class="wc-shortcodes-collage-panel-wrapper wc-shortcodes-clearfix">
|
| 135 |
+
<?php while( $wc_shortcodes_posts_query->have_posts() ) : ?>
|
| 136 |
+
<div class="wc-shortcodes-collage-panel wc-shortcodes-collage-panel-<?php echo $count; ?>">
|
| 137 |
+
<div class="wc-shortcodes-collage-panel-inner">
|
| 138 |
+
<?php $wc_shortcodes_posts_query->the_post(); ?>
|
| 139 |
+
<?php include( 'content.php' ); ?>
|
| 140 |
+
<?php $count--; ?>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
<?php endwhile; ?>
|
| 144 |
+
</div>
|
| 145 |
+
</div>
|
| 146 |
+
</div>
|
| 147 |
+
<?php endif; ?>
|
| 148 |
+
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
public/templates/collage1/loop-image.php
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="wc-shortcodes-collage-panel wc-shortcodes-collage-panel-5">
|
| 2 |
+
<?php while ( 4 < $count ) : ?>
|
| 3 |
+
<?php $wc_shortcodes_posts_query->the_post(); ?>
|
| 4 |
+
<?php include( 'content.php' ); ?>
|
| 5 |
+
<?php $count--; ?>
|
| 6 |
+
<?php endwhile; ?>
|
| 7 |
+
</div>
|
public/templates/collage1/loop-slider.php
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class="wc-shortcodes-collage-panel wc-shortcodes-collage-panel-5 wc-shortcodes-loading">
|
| 2 |
+
<div id="" class="wc-shortcodes-collage-slider-wrapper">
|
| 3 |
+
<div class="wc-shortcodes-collage-slider" data-mode="<?php echo esc_attr( $display['slider_mode'] ); ?>" data-pause="<?php echo esc_attr( $display['slider_pause'] ); ?>" data-auto="<?php echo esc_attr( $display['slider_auto'] ); ?>">
|
| 4 |
+
<?php while ( 4 < $count ) : ?>
|
| 5 |
+
<?php $wc_shortcodes_posts_query->the_post(); ?>
|
| 6 |
+
<?php include( 'content.php' ); ?>
|
| 7 |
+
<?php $count--; ?>
|
| 8 |
+
<?php endwhile; ?>
|
| 9 |
+
</div>
|
| 10 |
+
</div>
|
| 11 |
+
</div>
|
public/widgets/widget-collage.php
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @uses WP
|
| 4 |
+
* @uses _Widget
|
| 5 |
+
*/
|
| 6 |
+
class WPC_Shortcodes_Widget_Collage extends WP_Widget {
|
| 7 |
+
function __construct() {
|
| 8 |
+
|
| 9 |
+
$widget_ops = array( 'description' => __('Add a collage to your widget area.') );
|
| 10 |
+
parent::__construct( 'wc_shortcodes_collage', __('Angie Makes - Collage'), $widget_ops );
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
function widget($args, $instance) {
|
| 14 |
+
$shortcode = array();
|
| 15 |
+
foreach ( $instance as $key => $value ) {
|
| 16 |
+
$shortcode[] = $key . '="' . $value . '"';
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
if ( ! empty( $shortcode ) ) {
|
| 20 |
+
$shortcode = implode( " ", $shortcode );
|
| 21 |
+
$shortcode = '[wc_collage ' . $shortcode . '][/wc_collage]';
|
| 22 |
+
}
|
| 23 |
+
else {
|
| 24 |
+
$shortcode = '[wc_collage][/wc_collage]';
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
echo $args['before_widget'];
|
| 28 |
+
echo do_shortcode( $shortcode );
|
| 29 |
+
echo $args['after_widget'];
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
function update( $new_instance, $old_instance ) {
|
| 33 |
+
$new_instance = WPC_Shortcodes_Sanitize::collage_attr_fix_bools( $new_instance );
|
| 34 |
+
$instance = WPC_Shortcodes_Sanitize::collage_attr( $new_instance );
|
| 35 |
+
|
| 36 |
+
return $instance;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
function form( $instance ) {
|
| 40 |
+
// array_merge needs both values to be array.
|
| 41 |
+
if ( ! is_array( $instance ) ) {
|
| 42 |
+
$instance = array();
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
?>
|
| 46 |
+
|
| 47 |
+
<?php
|
| 48 |
+
$o = array_merge( WPC_Shortcodes_Vars::$attr->collage, $instance );
|
| 49 |
+
$o = WPC_Shortcodes_Sanitize::collage_attr( $o );
|
| 50 |
+
|
| 51 |
+
$post_types = array( 'wcs_collage' => 'wcs_collage' );
|
| 52 |
+
$image_title = array( 1 => 'Top Right', 2 => 'Bottom Left', 3=> 'Bottom Right 1', 4=> 'Bottom Right 2' );
|
| 53 |
+
?>
|
| 54 |
+
|
| 55 |
+
<div id="wc-shortcodes-collage-widget-<?php echo $this->number; ?>" class="wc-shortcodes-collage-widget wc-shortcodes-visual-manager wpc-image-wrapper wpc-ui-theme-override">
|
| 56 |
+
<h3>Select Posts</h3>
|
| 57 |
+
<div>
|
| 58 |
+
<p class="wcs-instruction wcs-plain-instructions"><a href="<?php echo admin_url( 'edit.php?post_type=wcs_collage' ); ?>" target="_blank">Configure your collage items</a></p>
|
| 59 |
+
<p>
|
| 60 |
+
<label for="<?php echo $this->get_field_id('pids'); ?>"><?php _e('Post IDs:') ?></label>
|
| 61 |
+
<input type="text" class="wc-shortcodes-widget-option widefat wc-shortcodes-widget-autocomplete-select" id="<?php echo $this->get_field_id('pids'); ?>" data-autocomplete-type="multi" data-autocomplete-lookup="post" name="<?php echo $this->get_field_name('pids'); ?>" value="<?php echo $o['pids']; ?>" />
|
| 62 |
+
<span class="wcs-description">Leave blank to display all posts.</span>
|
| 63 |
+
</p>
|
| 64 |
+
<p>
|
| 65 |
+
<label for="<?php echo $this->get_field_id('order'); ?>"><?php _e('Order:'); ?></label>
|
| 66 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
|
| 67 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::order_fields() as $key => $value ) : ?>
|
| 68 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['order'], $key ); ?>><?php echo $value; ?></option>';
|
| 69 |
+
<?php endforeach; ?>
|
| 70 |
+
</select>
|
| 71 |
+
</p>
|
| 72 |
+
<p>
|
| 73 |
+
<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e('Order By:'); ?></label>
|
| 74 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>">
|
| 75 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::order_by_fields() as $key => $value ) : ?>
|
| 76 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['orderby'], $key ); ?>><?php echo $value; ?></option>';
|
| 77 |
+
<?php endforeach; ?>
|
| 78 |
+
</select>
|
| 79 |
+
</p>
|
| 80 |
+
<p>
|
| 81 |
+
<label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:'); ?></label>
|
| 82 |
+
<select id="<?php echo $this->get_field_id('taxonomy'); ?>" class="wc-shortcodes-widget-option wc-shortcodes-widget-taxonomy-selector" name="<?php echo $this->get_field_name('taxonomy'); ?>">
|
| 83 |
+
<option value=""<?php selected( $o['taxonomy'], "" ); ?>>No Taxonomy</option>';
|
| 84 |
+
<?php foreach ( $post_types as $post_type_name ) : ?>
|
| 85 |
+
<?php $taxonomies = get_object_taxonomies( $post_type_name, 'names' ); ?>
|
| 86 |
+
<?php if ( $taxonomies ) : ?>
|
| 87 |
+
<?php foreach ( $taxonomies as $key ) : ?>
|
| 88 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['taxonomy'], $key ); ?> data-post-type="<?php echo $post_type_name; ?>"><?php echo $key; ?></option>
|
| 89 |
+
<?php endforeach; ?>
|
| 90 |
+
<?php endif; ?>
|
| 91 |
+
<?php endforeach; ?>
|
| 92 |
+
</select>
|
| 93 |
+
</p>
|
| 94 |
+
<p>
|
| 95 |
+
<label for="<?php echo $this->get_field_id('terms'); ?>"><?php _e('Terms:') ?></label>
|
| 96 |
+
<input type="text" class="wc-shortcodes-widget-option widefat wc-shortcodes-widget-autocomplete-select" id="<?php echo $this->get_field_id('terms'); ?>" data-autocomplete-type="multi" data-autocomplete-lookup="terms" name="<?php echo $this->get_field_name('terms'); ?>" value="<?php echo $o['terms']; ?>" />
|
| 97 |
+
<span class="wcs-description">Leave blank to display all terms.</span>
|
| 98 |
+
</p>
|
| 99 |
+
<p>
|
| 100 |
+
<label for="<?php echo $this->get_field_id('posts_per_page'); ?>"><?php _e('Posts Per Page:') ?></label>
|
| 101 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('posts_per_page'); ?>" name="<?php echo $this->get_field_name('posts_per_page'); ?>" value="<?php echo $o['posts_per_page']; ?>" />
|
| 102 |
+
<span class="wcs-description">Enter -1 for unlimited posts.</span>
|
| 103 |
+
</p>
|
| 104 |
+
<p>
|
| 105 |
+
<input type="checkbox" class="wc-shortcodes-widget-option checkbox" id="<?php echo $this->get_field_id('ignore_sticky_posts'); ?>" name="<?php echo $this->get_field_name('ignore_sticky_posts'); ?>" value="1" <?php checked( $o['ignore_sticky_posts'], 1 ); ?> />
|
| 106 |
+
<label for="<?php echo $this->get_field_id('ignore_sticky_posts'); ?>"><?php _e('Ignore Sticky Posts') ?></label>
|
| 107 |
+
</p>
|
| 108 |
+
</div>
|
| 109 |
+
<h3>Content</h3>
|
| 110 |
+
<div>
|
| 111 |
+
<p>
|
| 112 |
+
<label for="<?php echo $this->get_field_id('button_class'); ?>"><?php _e('Button Class:') ?></label>
|
| 113 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('button_class'); ?>" name="<?php echo $this->get_field_name('button_class'); ?>" value="<?php echo $o['button_class']; ?>" />
|
| 114 |
+
<span class="wcs-description">Enter class name for custom CSS styling. (Ex: button primary-button)</span>
|
| 115 |
+
</p>
|
| 116 |
+
<p>
|
| 117 |
+
<label for="<?php echo $this->get_field_id('size'); ?>"><?php _e('Image Size:'); ?></label>
|
| 118 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('size'); ?>" name="<?php echo $this->get_field_name('size'); ?>">
|
| 119 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::image_sizes() as $key => $value ) : ?>
|
| 120 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['size'], $key ); ?>><?php echo $value; ?></option>
|
| 121 |
+
<?php endforeach; ?>
|
| 122 |
+
</select>
|
| 123 |
+
</p>
|
| 124 |
+
</div>
|
| 125 |
+
<h3>Style</h3>
|
| 126 |
+
<div>
|
| 127 |
+
<p>
|
| 128 |
+
<label for="<?php echo $this->get_field_id('template'); ?>"><?php _e('Template:'); ?></label>
|
| 129 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
|
| 130 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::collage_templates() as $key => $value ) : ?>
|
| 131 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['template'], $key ); ?>><?php echo $value; ?></option>';
|
| 132 |
+
<?php endforeach; ?>
|
| 133 |
+
</select>
|
| 134 |
+
</p>
|
| 135 |
+
<p>
|
| 136 |
+
<label for="<?php echo $this->get_field_id('gutter_space'); ?>"><?php _e('Gutter Space:') ?></label>
|
| 137 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('gutter_space'); ?>" name="<?php echo $this->get_field_name('gutter_space'); ?>" value="<?php echo $o['gutter_space']; ?>" />
|
| 138 |
+
<span class="wcs-description">Enter a pixel value between 0 and 50.</span>
|
| 139 |
+
</p>
|
| 140 |
+
<p>
|
| 141 |
+
<label for="<?php echo $this->get_field_id('heading_size'); ?>"><?php _e('Heading Size:') ?></label>
|
| 142 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('heading_size'); ?>" name="<?php echo $this->get_field_name('heading_size'); ?>" value="<?php echo $o['heading_size']; ?>" />
|
| 143 |
+
</p>
|
| 144 |
+
<p>
|
| 145 |
+
<label for="<?php echo $this->get_field_id('mobile_heading_size'); ?>"><?php _e('Mobile Heading Size:') ?></label>
|
| 146 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('mobile_heading_size'); ?>" name="<?php echo $this->get_field_name('mobile_heading_size'); ?>" value="<?php echo $o['mobile_heading_size']; ?>" />
|
| 147 |
+
</p>
|
| 148 |
+
<p>
|
| 149 |
+
<label for="<?php echo $this->get_field_id('desktop_height'); ?>"><?php _e('Desktop Height:') ?></label>
|
| 150 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('desktop_height'); ?>" name="<?php echo $this->get_field_name('desktop_height'); ?>" value="<?php echo $o['desktop_height']; ?>" />
|
| 151 |
+
</p>
|
| 152 |
+
<p>
|
| 153 |
+
<label for="<?php echo $this->get_field_id('laptop_height'); ?>"><?php _e('Laptop Height:') ?></label>
|
| 154 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('laptop_height'); ?>" name="<?php echo $this->get_field_name('laptop_height'); ?>" value="<?php echo $o['laptop_height']; ?>" />
|
| 155 |
+
</p>
|
| 156 |
+
<p>
|
| 157 |
+
<label for="<?php echo $this->get_field_id('mobile_height'); ?>"><?php _e('Mobile Height:') ?></label>
|
| 158 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('mobile_height'); ?>" name="<?php echo $this->get_field_name('mobile_height'); ?>" value="<?php echo $o['mobile_height']; ?>" />
|
| 159 |
+
</p>
|
| 160 |
+
</div>
|
| 161 |
+
<h3>Slider Settings</h3>
|
| 162 |
+
<div>
|
| 163 |
+
<p>
|
| 164 |
+
<label for="<?php echo $this->get_field_id('slider_mode'); ?>"><?php _e('Slider Mode:'); ?></label>
|
| 165 |
+
<select class="wc-shortcodes-widget-option" id="<?php echo $this->get_field_id('slider_mode'); ?>" name="<?php echo $this->get_field_name('slider_mode'); ?>">
|
| 166 |
+
<?php foreach ( WPC_Shortcodes_Widget_Options::post_slider_modes() as $key => $value ) : ?>
|
| 167 |
+
<option value="<?php echo $key; ?>"<?php selected( $o['slider_mode'], $key ); ?>><?php echo $value; ?></option>';
|
| 168 |
+
<?php endforeach; ?>
|
| 169 |
+
</select>
|
| 170 |
+
</p>
|
| 171 |
+
<p>
|
| 172 |
+
<label for="<?php echo $this->get_field_id('slider_pause'); ?>"><?php _e('Slider Pause:') ?></label>
|
| 173 |
+
<input type="text" class="wc-shortcodes-widget-option widefat" id="<?php echo $this->get_field_id('slider_pause'); ?>" name="<?php echo $this->get_field_name('slider_pause'); ?>" value="<?php echo $o['slider_pause']; ?>" />
|
| 174 |
+
<span class="wcs-description">Enter number in milliseconds.</span>
|
| 175 |
+
</p>
|
| 176 |
+
<p>
|
| 177 |
+
<input type="checkbox" class="wc-shortcodes-widget-option checkbox" id="<?php echo $this->get_field_id('slider_auto'); ?>" name="<?php echo $this->get_field_name('slider_auto'); ?>" value="1" <?php checked( $o['slider_auto'], 1 ); ?> />
|
| 178 |
+
<label for="<?php echo $this->get_field_id('slider_auto'); ?>"><?php _e('Enable Auto Transition') ?></label>
|
| 179 |
+
</p>
|
| 180 |
+
</div>
|
| 181 |
+
<input type="hidden" class="wc-shortcodes-widget-option widefat wc-shortcodes-widget-post-type-selector" id="<?php echo $this->get_field_id('post_type'); ?>" name="<?php echo $this->get_field_name('post_type'); ?>" value="<?php echo $o['post_type']; ?>" />
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<script type="text/javascript">
|
| 185 |
+
/* <![CDATA[ */
|
| 186 |
+
jQuery(document).ready(function($){
|
| 187 |
+
$('#wc-shortcodes-collage-widget-<?php echo $this->number; ?>').accordion({heightStyle: "content", collapsible: true}).wcPostsWidget().wcColorPickerWidget();
|
| 188 |
+
});
|
| 189 |
+
/* ]]> */
|
| 190 |
+
</script>
|
| 191 |
+
<?php
|
| 192 |
+
}
|
| 193 |
+
}
|
public/widgets/widget-image-links.php
CHANGED
|
@@ -50,7 +50,7 @@ class WPC_Shortcodes_Widget_Image_Links extends WP_Widget {
|
|
| 50 |
<?php for ( $i = 1; $i <= 4; $i++ ) : ?>
|
| 51 |
<?php
|
| 52 |
$imagestyle = '';
|
| 53 |
-
if ( empty( $o['
|
| 54 |
$imagestyle = ' style="display:none"';
|
| 55 |
}
|
| 56 |
?>
|
| 50 |
<?php for ( $i = 1; $i <= 4; $i++ ) : ?>
|
| 51 |
<?php
|
| 52 |
$imagestyle = '';
|
| 53 |
+
if ( empty( $o['image_'.$i] ) ) {
|
| 54 |
$imagestyle = ' style="display:none"';
|
| 55 |
}
|
| 56 |
?>
|
readme.txt
CHANGED
|
@@ -113,6 +113,12 @@ See our help article on [how to manually upload a plugin](http://knowledgebase.a
|
|
| 113 |
|
| 114 |
== Changelog ==
|
| 115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
= Version 3.35 =
|
| 117 |
|
| 118 |
* updated box slider to version 4.2.12
|
| 113 |
|
| 114 |
== Changelog ==
|
| 115 |
|
| 116 |
+
= Version 3.36 =
|
| 117 |
+
|
| 118 |
+
* Added collage widget
|
| 119 |
+
* Added break to one of the case statements
|
| 120 |
+
* updated sanitation function for posts, post_slider, and featured post
|
| 121 |
+
|
| 122 |
= Version 3.35 =
|
| 123 |
|
| 124 |
* updated box slider to version 4.2.12
|
wc-shortcodes.php
CHANGED
|
@@ -5,7 +5,7 @@ Plugin URI: http://angiemakes.com/feminine-wordpress-blog-themes-women/
|
|
| 5 |
Description: A plugin that adds a useful family of shortcodes to your WordPress theme.
|
| 6 |
Author: Chris Baldelomar
|
| 7 |
Author URI: http://angiemakes.com/
|
| 8 |
-
Version: 3.
|
| 9 |
License: GPLv2 or later
|
| 10 |
*/
|
| 11 |
|
|
@@ -32,7 +32,11 @@ require_once( plugin_dir_path( __FILE__ ) . 'public/class-register.php' );
|
|
| 32 |
require_once( plugin_dir_path( __FILE__ ) . 'public/class-hooks.php' );
|
| 33 |
|
| 34 |
if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
|
| 35 |
-
require_once( plugin_dir_path( __FILE__ ) . 'public/class-post-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
require_once( plugin_dir_path( __FILE__ ) . 'public/class-ajax-front.php' );
|
|
@@ -56,7 +60,11 @@ add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Register', 'get_instance' )
|
|
| 56 |
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Hooks', 'get_instance' ) );
|
| 57 |
|
| 58 |
if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
|
| 59 |
-
add_action( 'plugins_loaded', array( '
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Ajax_Front', 'get_instance' ) );
|
| 5 |
Description: A plugin that adds a useful family of shortcodes to your WordPress theme.
|
| 6 |
Author: Chris Baldelomar
|
| 7 |
Author URI: http://angiemakes.com/
|
| 8 |
+
Version: 3.36
|
| 9 |
License: GPLv2 or later
|
| 10 |
*/
|
| 11 |
|
| 32 |
require_once( plugin_dir_path( __FILE__ ) . 'public/class-hooks.php' );
|
| 33 |
|
| 34 |
if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
|
| 35 |
+
require_once( plugin_dir_path( __FILE__ ) . 'public/post-types/class-slide-post-type.php' ); //Adds basic filters and actions
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
if ( WC_SHORTCODES_COLLAGE_POST_TYPE_ENABLED ) {
|
| 39 |
+
require_once( plugin_dir_path( __FILE__ ) . 'public/post-types/class-collage-post-type.php' ); //Adds basic filters and actions
|
| 40 |
}
|
| 41 |
|
| 42 |
require_once( plugin_dir_path( __FILE__ ) . 'public/class-ajax-front.php' );
|
| 60 |
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Hooks', 'get_instance' ) );
|
| 61 |
|
| 62 |
if ( WC_SHORTCODES_SLIDE_POST_TYPE_ENABLED ) {
|
| 63 |
+
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Slide_Post_Type', 'get_instance' ) );
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
if ( WC_SHORTCODES_COLLAGE_POST_TYPE_ENABLED ) {
|
| 67 |
+
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Collage_Post_Type', 'get_instance' ) );
|
| 68 |
}
|
| 69 |
|
| 70 |
add_action( 'plugins_loaded', array( 'WPC_Shortcodes_Ajax_Front', 'get_instance' ) );
|
