77 |
|
102 |
├── assets ├── css │ ├── hubaga.css │ └── index.php ├── images │ ├── index.php │ ├── screenshot-1.png │ ├── screenshot-2.png │ ├── screenshot-3.png │ └── screenshot-8.png ├── index.php └── js │ ├── hubaga.js │ ├── index.php │ └── instacheck.js ├── hubaga.php ├── includes ├── admin │ ├── admin.php │ ├── assets │ │ ├── css │ │ │ ├── admin.css │ │ │ └── index.php │ │ ├── images │ │ │ └── index.php │ │ ├── index.php │ │ └── js │ │ │ ├── admin.js │ │ │ ├── index.php │ │ │ ├── jquery.flot.categories.js │ │ │ ├── jquery.flot.js │ │ │ ├── jquery.flot.min.js │ │ │ ├── jquery.flot.resize.js │ │ │ ├── jquery.flot.time.js │ │ │ ├── vue.js │ │ │ └── vue.min.js │ ├── elements │ │ ├── editor.php │ │ ├── index.php │ │ ├── order_overview.php │ │ ├── reports_cards.php │ │ ├── reports_footer.php │ │ ├── reports_header.php │ │ ├── reports_header1.php │ │ └── tag.php │ ├── index.php │ ├── metaboxes.php │ ├── reports.php │ ├── settings.php │ └── views │ │ ├── coupon-details.php │ │ ├── coupon-template.php │ │ ├── extensions-template.php │ │ ├── index.php │ │ ├── order-details.php │ │ ├── order-template.php │ │ ├── product-details.php │ │ ├── product-template.php │ │ └── reports-template.php ├── ajax.php ├── checkout │ ├── abstract-payments-class.php │ ├── functions.php │ ├── gateways │ │ ├── index.php │ │ ├── paypal │ │ │ ├── paypal-gateway.php │ │ │ └── settings-paypal.php │ │ └── test-gateway.php │ ├── index.php │ └── payments-class.php ├── coupon-class.php ├── coupons.php ├── customer-class.php ├── customers.php ├── data │ ├── currencies.php │ ├── currency_symbols.php │ ├── email-template.php │ └── index.php ├── download.php ├── elementa │ ├── assets │ │ ├── css │ │ │ ├── datepicker.css │ │ │ ├── elementa.css │ │ │ └── selectize.bootstrap3.css │ │ └── js │ │ │ ├── datepicker.js │ │ │ ├── datepicker.min.js │ │ │ ├── elementa.js │ │ │ ├── selectize.js │ │ │ └── selectize.min.js │ ├── data │ │ └── countries.php │ ├── elementa.php │ ├── elements │ │ ├── alert.php │ │ ├── button.php │ │ ├── card.php │ │ ├── checkbox.php │ │ ├── color.php │ │ ├── date.php │ │ ├── email.php │ │ ├── import.php │ │ ├── list_group.php │ │ ├── multiselect.php │ │ ├── number.php │ │ ├── password.php │ │ ├── radio.php │ │ ├── range.php │ │ ├── raw.php │ │ ├── save.php │ │ ├── search.php │ │ ├── select.php │ │ ├── switch.php │ │ ├── text.php │ │ ├── textarea.php │ │ └── title.php │ ├── index.php │ ├── template.php │ └── template2.php ├── functions.php ├── index.php ├── install.php ├── notifications.php ├── order-class.php ├── orders.php ├── product-class.php ├── product-widget.php ├── products.php ├── shortcodes.php ├── system-info.php └── template.php ├── index.php ├── languages └── index.php ├── license.txt ├── readme.md ├── readme.txt └── uninstall.php /assets/css/index.php: -------------------------------------------------------------------------------- 1 | 500 && $( window ).width() > 350 10 | } 11 | 12 | // Prepare the variables needed to start the train 13 | var ajax_url = instacheck_params.ajaxurl, 14 | checkoutUrl = instacheck_params.checkout_url, 15 | accountUrl = instacheck_params.account_url, 16 | nonce = instacheck_params.pc_nonce, 17 | checkout = $( '.hubaga-instacheck-wrapper' ), 18 | loader = $( '.hubaga-loader-wrapper' ); 19 | 20 | // Init instacheck when a buy button is clicked 21 | $('.hubaga-buy') 22 | .on('click', 23 | function( e ) { 24 | 25 | //Ensure that instacheck is supported 26 | if( !is_instacheck() ){ 27 | return; 28 | } 29 | 30 | // Make sure that this is really a buy button 31 | if( $( this ).data( 'action' ) != 'hubaga_buy' ){ 32 | return; 33 | } 34 | 35 | // Great! Prevent the default event behaviour 36 | e.preventDefault(); 37 | 38 | // Post data 39 | var product = $( this ).data( 'product' ), 40 | _link = $( this ).attr( 'href' ); 41 | 42 | fetchCheckout( { 43 | nonce: nonce, 44 | action: 'hubaga_get_checkout', 45 | fetchedBy: 'instacheck', 46 | product: product 47 | } ).fail( 48 | //If there was a problem; redirect to the checkout page 49 | function() { 50 | window.location = _link; 51 | }); 52 | }); 53 | 54 | /* Helper function to fetch the checkouts */ 55 | var fetchCheckout = function( data ) { 56 | 57 | // Hide the checkout overlay and display the loader 58 | $( checkout ).hide(); 59 | $( loader ).show(); 60 | 61 | // Post the data then return a promise 62 | return $.post( 63 | ajax_url, 64 | data, 65 | function( html ) { 66 | 67 | //If this is JSON.... 68 | if( $.isPlainObject( html ) ) { 69 | if ( html.action == 'redirect' ) { 70 | window.location = html.url 71 | } 72 | } else { 73 | var innerCheckout = $( checkout ).find( '.hubaga-instacheck-overlay' ); 74 | $( innerCheckout ).html( html ); 75 | 76 | //Appends a close button 77 | appendCloseButton( innerCheckout, checkout ); 78 | 79 | //Updates event handlers 80 | updateCheckoutHandlers( innerCheckout ); 81 | } 82 | //Display the checkout 83 | $( loader ).hide(); 84 | $( checkout ).show(); 85 | }); 86 | } 87 | 88 | // Appends a button to el that closes victiom when clicked 89 | var appendCloseButton = function( el, victim ) { 90 | return $( '×' ) 91 | .appendTo( el ) 92 | .on( 'click.pc_close', 93 | function( e ) { 94 | e.preventDefault(); 95 | $( victim ).hide(); 96 | }); 97 | } 98 | 99 | //Updates checkout event handlers 100 | var updateCheckoutHandlers = function( el ){ 101 | 102 | var checkoutForm = $( el ).find( '.hubaga-checkout-form:not(.instacheck_disabled)' ); 103 | 104 | //Whenever the user clicks outside our checkout overlay 105 | $( document ) 106 | .on('mouseup.hubaga-instacheck', function(e){ 107 | if(!el.is(e.target) && el.has(e.target).length === 0 ) { 108 | $( checkout ).hide(); 109 | } 110 | }); 111 | 112 | //Handle form submissions 113 | $( checkoutForm ) 114 | .on( 'submit.hubaga-instacheck', 115 | function( e ){ 116 | e.preventDefault(); 117 | var data = $( checkoutForm ).serialize(); 118 | data = data + '&nonce=' + nonce; 119 | fetchCheckout( data ) 120 | .fail( 121 | function( data ) { 122 | window.location = checkoutUrl + '?' + $( checkoutForm ).serialize(); 123 | }); 124 | }); 125 | 126 | //Submit form when a gateway is clicked 127 | $( checkoutForm ) 128 | .find( '[name="gateway"]' ) 129 | .on( 'change.hubaga-instacheck', 130 | function( e ){ 131 | $( checkoutForm ).trigger( 'submit' ); 132 | }); 133 | 134 | // When a user clicks on the show coupon link... 135 | $( checkoutForm ). 136 | find('.hubaga-show-coupon') 137 | .on('click.hubaga-instacheck', 138 | function( e ) { 139 | e.preventDefault(); 140 | $ ( this ).closest( 'form' ).find( '.hubaga-coupon-grid' ).toggle(); 141 | }); 142 | 143 | // Input field events 144 | $( checkoutForm ). 145 | find('.hubaga-field') 146 | .on( 'focus', function(){ 147 | $(this).addClass( 'hubaga-is-focused' ) 148 | }) 149 | 150 | .on( 'blur', function(){ 151 | $(this).removeClass( 'hubaga-is-focused' ) 152 | }) 153 | 154 | .on( 'keyup', function(){ 155 | if ($(this).val().length === 0) { 156 | $(this).addClass('hubaga-is-empty'); 157 | } else { 158 | $(this).removeClass('hubaga-is-empty'); 159 | } 160 | }) 161 | 162 | 163 | //When a user applies a coupon 164 | $('.hubaga-coupon-btn') 165 | .on('click', 166 | function( e ) { 167 | 168 | e.preventDefault(); 169 | var that = this; 170 | var product= $( this ).closest( 'form' ).find( '[name="hubaga_buy"]' ).val(); 171 | var email = $( this ).closest( 'form' ).find( '[name="email"]' ).val(); 172 | var coupon = $( this ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-input' ).val(); 173 | if( coupon === '' ) { 174 | $( this ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-notices' ).text( instacheck_params.empty_coupon ); 175 | return; 176 | } 177 | 178 | $( that ).closest( 'form' ).fadeTo( 360, 0.5 ); 179 | 180 | $.post( 181 | ajax_url, 182 | { 183 | coupon: coupon, 184 | action: 'hubaga_apply_coupon', 185 | product: product, 186 | email: email, 187 | nonce: nonce 188 | }, 189 | function ( json ) { 190 | 191 | $( that ).closest( 'form' ).fadeTo( 360, 1 ); 192 | 193 | if ( json.result == 'success' ) { 194 | 195 | $( that ).closest( '.hubaga-coupon-grid' ).hide(); 196 | $( that ).closest( 'form' ).find( '.hubaga-order-total' ).html( json.price ); 197 | $( that ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-notices' ).text( '' ); 198 | $( that ).closest( 'form' ).find( '.hubaga-coupon-notice' ).hide(); 199 | 200 | } else if( json.result == 'error' ){ 201 | 202 | $( that ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-notices' ).text( json.error ); 203 | 204 | }else { 205 | 206 | $( that ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-notices' ).text( instacheck_params.coupon_error ); 207 | 208 | } 209 | 210 | }).fail( function(){ 211 | $( that ).closest( 'form' ).fadeTo( 360, 1 ); 212 | $( that ).closest( '.hubaga-coupon-grid' ).find( '.hubaga-coupon-notices' ).text( instacheck_params.coupon_error ); 213 | }); 214 | 215 | }); 216 | } 217 | 218 | } )( jQuery ); 219 | -------------------------------------------------------------------------------- /includes/admin/assets/css/admin.css: -------------------------------------------------------------------------------- 1 | /* Hide coupon visibility settings on coupon pages */ 2 | .post-type-h_coupon .misc-pub-visibility{ 3 | display: none; 4 | } 5 | 6 | .hubaga-action-btn { 7 | font-size: 28px; 8 | padding: 0 0.8rem; 9 | padding-bottom: 4px; 10 | background-color: #ff4081; 11 | color: #fff; 12 | border: none; 13 | border-radius: 2px; 14 | display: inline-block; 15 | } 16 | 17 | @media only screen and (min-width: 601px){ 18 | .hubaga-filters { 19 | background: rgba(238, 235, 235, 0.06); 20 | padding-top: 1em; 21 | } 22 | } 23 | 24 | .report-card-wrapper{ 25 | margin-bottom: 1em; 26 | } 27 | .hubaga-report-card-aggregate{ 28 | padding: 1em; 29 | text-align: center; 30 | } 31 | 32 | .card-num { 33 | display: block; 34 | font-size: 25px; 35 | margin-bottom: 10px; 36 | } 37 | 38 | .hubaga-flotchart-placeholder{ 39 | width: 100%; 40 | height: 400px; 41 | } 42 | 43 | #hubaga_reports{ 44 | padding: 1em; 45 | } 46 | 47 | .hubaga-filter-btn{ 48 | width: 100%; 49 | } 50 | .btn-right{ 51 | float: right; 52 | } 53 | 54 | .hubaga-block{ 55 | display: block; 56 | } 57 | 58 | .hubaga-unstyled{ 59 | text-decoration: none; 60 | list-style-type: none; 61 | } 62 | 63 | .hubaga-price-more{ 64 | max-width: 320px; 65 | padding: 1em; 66 | margin-left: 0; 67 | margin-top: 2em; 68 | position: relative; 69 | } 70 | 71 | .hubaga-price-more::after { 72 | content: ''; 73 | display: block; 74 | position: absolute; 75 | top: -2.6em; 76 | width: 0; 77 | height: 0; 78 | border: 16px solid; 79 | left: 10%; 80 | border-color: transparent transparent rgba(0, 0, 0, 0.2) transparent; 81 | } 82 | 83 | .list-group.elementa-dropdown-content{ 84 | margin-top: 0; 85 | } 86 | 87 | .elementa .list-group-inner-item { 88 | border-bottom: 1px solid rgba(255, 255, 255, 0.16); 89 | padding-bottom: 5px; 90 | padding-top: 1em; 91 | } 92 | 93 | .stream-price, .hubaga-stream-price{ 94 | padding: 5px; 95 | color: #fff; 96 | } 97 | 98 | .hubaga-stream-price.green{background-color:#4CAF50!important} 99 | .hubaga-stream-price.orange{background-color:#ff9800!important} 100 | .hubaga-stream-price.black{background-color:#000!important} 101 | .hubaga-stream-price.red{background-color:#F44336!important} 102 | .hubaga-stream-price.teal{background-color:#009688!important} 103 | .hubaga-stream-price.light-blue{background-color:#03a9f4!important} 104 | 105 | .hubaga-price-muted { 106 | color: #888; 107 | font-weight: bold; 108 | border: 1px solid #aaa; 109 | padding: 5px; 110 | } 111 | 112 | .hubaga-muted { 113 | color: #888; 114 | font-size: 1.2em; 115 | margin-top: 0; 116 | font-weight: bold; 117 | } 118 | 119 | #hubaga_order_details .handlediv, 120 | #hubaga_order_details .hndle, 121 | .post-type-h_order #minor-publishing-actions, 122 | .post-type-h_order #visibility { 123 | display: none; 124 | } 125 | 126 | .hubaga-order-notes:after{ 127 | content:""; 128 | display:table; 129 | clear:both 130 | } 131 | 132 | .hubaga-note{ 133 | padding: 0.4em; 134 | border-radius: 5px; 135 | width: 80%; 136 | position: relative; 137 | } 138 | 139 | .hubaga-note:nth-child(even){ 140 | background: #009688; 141 | border: 1px solid #fff; 142 | color: #fff; 143 | float: right; 144 | } 145 | 146 | .hubaga-note:nth-child(odd){ 147 | background: #fff; 148 | border: 1px solid rgba(35, 40, 45, 0.23); 149 | float: left; 150 | } 151 | 152 | .hubaga-overlay-wrapper { 153 | position: fixed; 154 | top: 0; 155 | left: 0; 156 | width: 100%; 157 | height: 100%; 158 | z-index: 1000; 159 | background: rgba(0, 0, 0, 0.53); 160 | } 161 | 162 | .hubaga-loader { 163 | display: block; 164 | position: relative; 165 | left: 50%; 166 | top: 50%; 167 | width: 150px; 168 | height: 150px; 169 | margin: -75px 0 0 -75px; 170 | border-radius: 50%; 171 | border: 3px solid transparent; 172 | border-top-color: #3498db; 173 | -webkit-animation: hspin 2s linear infinite; 174 | animation: hspin 2s linear infinite; 175 | z-index: 1001; 176 | } 177 | 178 | .hubaga-loader:before { 179 | content: ""; 180 | position: absolute; 181 | top: 5px; 182 | left: 5px; 183 | right: 5px; 184 | bottom: 5px; 185 | border-radius: 50%; 186 | border: 3px solid transparent; 187 | border-top-color: #e74c3c; 188 | -webkit-animation: hspin 3s linear infinite; 189 | animation: hspin 3s linear infinite; 190 | } 191 | 192 | .hubaga-loader:after { 193 | content: ""; 194 | position: absolute; 195 | top: 15px; 196 | left: 15px; 197 | right: 15px; 198 | bottom: 15px; 199 | border-radius: 50%; 200 | border: 3px solid transparent; 201 | border-top-color: #f9c922; 202 | -webkit-animation: hspin 1.5s linear infinite; 203 | animation: hspin 1.5s linear infinite; 204 | } 205 | 206 | /*---------------------------------------- 207 | Animations 208 | ------------------------------------------*/ 209 | 210 | @-webkit-keyframes hspin { 211 | 0% { 212 | -webkit-transform: rotate(0deg); 213 | -ms-transform: rotate(0deg); 214 | transform: rotate(0deg); 215 | } 216 | 100% { 217 | -webkit-transform: rotate(360deg); 218 | -ms-transform: rotate(360deg); 219 | transform: rotate(360deg); 220 | } 221 | } 222 | 223 | @keyframes hspin { 224 | 0% { 225 | -webkit-transform: rotate(0deg); 226 | -ms-transform: rotate(0deg); 227 | transform: rotate(0deg); 228 | } 229 | 100% { 230 | -webkit-transform: rotate(360deg); 231 | -ms-transform: rotate(360deg); 232 | transform: rotate(360deg); 233 | } 234 | } 235 | 236 | .hubaga-extensions-template{ 237 | max-width: 620px; 238 | } 239 | 240 | .hubaga-hubaga-product-card { 241 | box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15); 242 | padding: 0; 243 | max-width: 100%; 244 | width: 300px; 245 | position: relative; 246 | min-height: 200px; 247 | margin: auto; 248 | margin-bottom: 1em; 249 | -webkit-box-sizing: border-box; 250 | -moz-box-sizing: border-box; 251 | box-sizing: border-box; 252 | } 253 | 254 | .hubaga-hubaga-product-card * { 255 | -webkit-box-sizing: border-box; 256 | -moz-box-sizing: border-box; 257 | box-sizing: border-box; 258 | } 259 | 260 | .hubaga-hubaga-product-card:after { 261 | content: ""; 262 | display: table; 263 | clear: both; 264 | } 265 | 266 | .hubaga-hubaga-product-card-header { 267 | min-height: 200px; 268 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); 269 | } 270 | 271 | .hubaga-hubaga-product-card-body { 272 | padding: 1em; 273 | } 274 | 275 | .hubaga-hubaga-card-price { 276 | position: absolute; 277 | top: 10px; 278 | left: 10px; 279 | border-radius: 50%; 280 | border: 2px solid #fff; 281 | width: 64px; 282 | height: 64px; 283 | padding-top: 1em; 284 | color: #ff5722; 285 | background: #fff; 286 | font-weight: bold; 287 | font-size: 15px; 288 | padding-left: 6px; 289 | } 290 | 291 | .hubaga-hubaga-product-card h2 { 292 | font-size: 1.62rem; 293 | margin: 1.78rem 0 1.424rem 0; 294 | font-weight: normal; 295 | line-height: 1.5; 296 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, sans-serif; 297 | } 298 | 299 | .hubaga-hubaga-product-card p{ 300 | font-size: 1rem; 301 | } 302 | 303 | @media only screen and (min-width: 620px) { 304 | 305 | .hubaga-hubaga-product-card { 306 | width: 100% !important; 307 | min-width: 100% !important; 308 | float: none; 309 | } 310 | 311 | .hubaga-hubaga-product-card-header { 312 | width: 30% !important; 313 | float: left !important; 314 | height: 100% !important; 315 | } 316 | 317 | .hubaga-hubaga-product-card-body { 318 | width: 70% !important; 319 | float: right !important; 320 | height: 100% !important; 321 | } 322 | 323 | .hubaga-hubaga-buy { 324 | position: absolute !important; 325 | bottom: 5px !important; 326 | right: 0 !important; 327 | width: 240px !important; 328 | } 329 | 330 | } 331 | 332 | #hubaga_product_editor{ 333 | max-width: 920px; 334 | } 335 | -------------------------------------------------------------------------------- /includes/admin/assets/css/index.php: -------------------------------------------------------------------------------- 1 | ', 9 | mounted: function () { 10 | $.plot( $( this.$el ) , this.datasets, this.options); 11 | }, 12 | 13 | watch: { 14 | datasets: function (datasets) { 15 | $.plot( $( this.$el ) , datasets, this.options); 16 | }, 17 | options: function (options) { 18 | $.plot( $( this.$el ) , this.datasets, options); 19 | }, 20 | currentCard: function (currentCard) { 21 | $.plot( $( this.$el ) , this.datasets, this.options); 22 | } 23 | } 24 | }); 25 | 26 | //Selectize component 27 | Vue.component('hubaga-reports-selectize', { 28 | props: ['options', 'value'], 29 | template: '', 30 | mounted: function () { 31 | var vm = this 32 | 33 | $(this.$el) 34 | .val(this.value) 35 | // init selectize 36 | .selectize({ 'options': this.options }) 37 | // emit event on change. 38 | .on('change', function () { 39 | vm.$emit('input', this.value) 40 | }) 41 | 42 | }, 43 | watch: { 44 | value: function (value) { 45 | // update value 46 | $(this.$el).val(value).trigger('change') 47 | }, 48 | options: function (options) { 49 | // update options 50 | $(this.$el).selectize({ 'options': this.options }) 51 | } 52 | }, 53 | destroyed: function () { 54 | $(this.$el).off().selectize('destroy') 55 | } 56 | }) 57 | 58 | //Custom click outside directive with caching 59 | Vue.directive( 'hubaga-click-outside', { 60 | bind: function( el, binding, vNode ){ 61 | function handler(e){ 62 | if(!vNode.context)return 63 | 64 | if(!$(el).is(e.target) && $(el).has(e.target).length === 0 ) { 65 | el.__hubagaClickOutside__.callback(e) 66 | } 67 | } 68 | 69 | el.__hubagaClickOutside__ = { 70 | handler: handler, 71 | callback: binding.value 72 | } 73 | 74 | $(document).on('mouseup', handler ); 75 | 76 | }, 77 | 78 | update: function( el, binding ){ 79 | el.__hubagaClickOutside__.callback = binding.value 80 | }, 81 | 82 | unbind: function( el, binding ){ 83 | $(document).off('mouseup', el.__hubagaClickOutside__.handler ) 84 | delete el.__hubagaClickOutside__ 85 | } 86 | }); 87 | 88 | //Reports app 89 | window.hubaga.reportsVue = function( data, el ){ 90 | return new Vue({ 91 | el: el, 92 | 93 | data: data, 94 | 95 | methods: { 96 | 97 | isFiltersShowing: function(){ 98 | return this.filters.showing === false 99 | }, 100 | 101 | toggleFiltersShowing: function(){ 102 | this.filtersShowing = !this.filtersShowing 103 | }, 104 | 105 | applyFilters: function(){ 106 | 107 | var vm = this; 108 | vm.loading = true; 109 | $.get( 110 | this.ajaxUrl, 111 | this.filters, 112 | function( data, status ) { 113 | vm.loading = false; 114 | vm.cards = data.cards; 115 | vm.filtersShowing = false; 116 | }).fail(function(){ 117 | vm.loading = false; 118 | vm.filtersShowing = false; 119 | }); 120 | }, 121 | 122 | hideStream: function( stream ) { 123 | this.currentStream = false 124 | }, 125 | 126 | showStream: function(key){ 127 | this.currentStream = key 128 | }, 129 | 130 | isCurrentCard: function( card ){ 131 | return this.currentCard == card.title 132 | }, 133 | 134 | changeCurrentCard: function( card ){ 135 | this.currentCard = card.title 136 | }, 137 | 138 | }, 139 | 140 | }); 141 | } 142 | 143 | } )( jQuery ); 144 | -------------------------------------------------------------------------------- /includes/admin/assets/js/index.php: -------------------------------------------------------------------------------- 1 | index) 102 | index = categories[v]; 103 | 104 | return index + 1; 105 | } 106 | 107 | function categoriesTickGenerator(axis) { 108 | var res = []; 109 | for (var label in axis.categories) { 110 | var v = axis.categories[label]; 111 | if (v >= axis.min && v <= axis.max) 112 | res.push([v, label]); 113 | } 114 | 115 | res.sort(function (a, b) { return a[0] - b[0]; }); 116 | 117 | return res; 118 | } 119 | 120 | function setupCategoriesForAxis(series, axis, datapoints) { 121 | if (series[axis].options.mode != "categories") 122 | return; 123 | 124 | if (!series[axis].categories) { 125 | // parse options 126 | var c = {}, o = series[axis].options.categories || {}; 127 | if ($.isArray(o)) { 128 | for (var i = 0; i < o.length; ++i) 129 | c[o[i]] = i; 130 | } 131 | else { 132 | for (var v in o) 133 | c[v] = o[v]; 134 | } 135 | 136 | series[axis].categories = c; 137 | } 138 | 139 | // fix ticks 140 | if (!series[axis].options.ticks) 141 | series[axis].options.ticks = categoriesTickGenerator; 142 | 143 | transformPointsOnAxis(datapoints, axis, series[axis].categories); 144 | } 145 | 146 | function transformPointsOnAxis(datapoints, axis, categories) { 147 | // go through the points, transforming them 148 | var points = datapoints.points, 149 | ps = datapoints.pointsize, 150 | format = datapoints.format, 151 | formatColumn = axis.charAt(0), 152 | index = getNextIndex(categories); 153 | 154 | for (var i = 0; i < points.length; i += ps) { 155 | if (points[i] == null) 156 | continue; 157 | 158 | for (var m = 0; m < ps; ++m) { 159 | var val = points[i + m]; 160 | 161 | if (val == null || !format[m][formatColumn]) 162 | continue; 163 | 164 | if (!(val in categories)) { 165 | categories[val] = index; 166 | ++index; 167 | } 168 | 169 | points[i + m] = categories[val]; 170 | } 171 | } 172 | } 173 | 174 | function processDatapoints(plot, series, datapoints) { 175 | setupCategoriesForAxis(series, "xaxis", datapoints); 176 | setupCategoriesForAxis(series, "yaxis", datapoints); 177 | } 178 | 179 | function init(plot) { 180 | plot.hooks.processRawData.push(processRawData); 181 | plot.hooks.processDatapoints.push(processDatapoints); 182 | } 183 | 184 | $.plot.plugins.push({ 185 | init: init, 186 | options: options, 187 | name: 'categories', 188 | version: '1.0' 189 | }); 190 | })(jQuery); 191 | -------------------------------------------------------------------------------- /includes/admin/assets/js/jquery.flot.resize.js: -------------------------------------------------------------------------------- 1 | /* Flot plugin for automatically redrawing plots as the placeholder resizes. 2 | 3 | Copyright (c) 2007-2014 IOLA and Ole Laursen. 4 | Licensed under the MIT license. 5 | 6 | It works by listening for changes on the placeholder div (through the jQuery 7 | resize event plugin) - if the size changes, it will redraw the plot. 8 | 9 | There are no options. If you need to disable the plugin for some plots, you 10 | can just fix the size of their placeholders. 11 | 12 | */ 13 | 14 | /* Inline dependency: 15 | * jQuery resize event - v1.1 - 3/14/2010 16 | * http://benalman.com/projects/jquery-resize-plugin/ 17 | * 18 | * Copyright (c) 2010 "Cowboy" Ben Alman 19 | * Dual licensed under the MIT and GPL licenses. 20 | * http://benalman.com/about/license/ 21 | */ 22 | (function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this); 23 | 24 | (function ($) { 25 | var options = { }; // no options 26 | 27 | function init(plot) { 28 | function onResize() { 29 | var placeholder = plot.getPlaceholder(); 30 | 31 | // somebody might have hidden us and we can't plot 32 | // when we don't have the dimensions 33 | if (placeholder.width() == 0 || placeholder.height() == 0) 34 | return; 35 | 36 | plot.resize(); 37 | plot.setupGrid(); 38 | plot.draw(); 39 | } 40 | 41 | function bindEvents(plot, eventHolder) { 42 | plot.getPlaceholder().resize(onResize); 43 | } 44 | 45 | function shutdown(plot, eventHolder) { 46 | plot.getPlaceholder().unbind("resize", onResize); 47 | } 48 | 49 | plot.hooks.bindEvents.push(bindEvents); 50 | plot.hooks.shutdown.push(shutdown); 51 | } 52 | 53 | $.plot.plugins.push({ 54 | init: init, 55 | options: options, 56 | name: 'resize', 57 | version: '1.0' 58 | }); 59 | })(jQuery); 60 | -------------------------------------------------------------------------------- /includes/admin/elements/editor.php: -------------------------------------------------------------------------------- 1 | 5, 13 | 'teeny' => true, 14 | ); 15 | 16 | wp_editor( $value, $id, $options ); 17 | 18 | if (! empty( $description ) ) { 19 | echo "
$description
"; 20 | } -------------------------------------------------------------------------------- /includes/admin/elements/index.php: -------------------------------------------------------------------------------- 1 | ID ); 11 | 12 | $data = apply_filters( 'hubaga_order_notes_editor_data', array( 13 | 'notes' => hubaga_get_order_notes( $order ), 14 | 'newNoteAuthor' => hubaga_get_customer_name( get_current_user_id() ), 15 | 'newNoteContent' => '', 16 | )); 17 | ?> 18 |{{note.content}}
35 |{{filters.dateFilter.label}}
49 |$description
"; 19 | } 20 | 21 | echo " 22 | 30 | "; -------------------------------------------------------------------------------- /includes/admin/index.php: -------------------------------------------------------------------------------- 1 | array ( 20 | 'type' => 'select', 21 | 'data' => 'pages', 22 | 'data_args' => array( 'number' => '100' ), 23 | 'section' => 'General', 24 | 'placeholder' => esc_html__( 'Select Page', 'hubaga' ), 25 | 'title' => esc_html__( 'Account Page', 'hubaga' ), 26 | 'description' => esc_html__( 'Do not forget to include the [h-account] shortcode on this page.', 'hubaga' ), 27 | ), 28 | 'checkout_page_id' => array ( 29 | 'type' => 'select', 30 | 'data' => 'pages', 31 | 'data_args' => array( 'number' => '100' ), 32 | 'section' => 'General', 33 | 'placeholder' => esc_html__( 'Select Page', 'hubaga' ), 34 | 'title' => esc_html__( 'Checkout Page', 'hubaga' ), 35 | 'description' => esc_html__( 'Do not forget to include the [h-checkout] shortcode on this page.', 'hubaga' ), 36 | ), 37 | 'download_method' => array ( 38 | 'type' => 'select', 39 | 'options' => array( 40 | 'force' => esc_html__( 'Force Downloads', 'hubaga' ), 41 | 'redirect' => esc_html__( 'Redirect', 'hubaga' ), 42 | ), 43 | 'section' => 'General', 44 | 'placeholder' => esc_html__( 'Select Download Method', 'hubaga' ), 45 | 'title' => esc_html__( 'Download Method', 'hubaga' ), 46 | 'description' => esc_html__( 'Force Downloads is the best but might not work well for huge files.', 'hubaga' ), 47 | ), 48 | 'currency' => array ( 49 | 'type' => 'select', 50 | 'options' => $currencies, 51 | 'default' => 'USD', 52 | 'section' => 'General', 53 | 'placeholder' => esc_html__( 'Select Main Currency', 'hubaga' ), 54 | 'title' => esc_html__( 'Store Currency', 'hubaga' ), 55 | 'description' => esc_html__( 'This is the currency by which your customers will be charged.', 'hubaga' ), 56 | ), 57 | 'currency_position' => array ( 58 | 'type' => 'select', 59 | 'options' => array( 60 | 'left' => esc_html__( 'Left', 'hubaga' ), 61 | 'right' => esc_html__( 'Right', 'hubaga' ), 62 | ), 63 | 'default' => 'left', 64 | 'section' => 'General', 65 | 'placeholder' => esc_html__( 'Select Currency Location', 'hubaga' ), 66 | 'title' => esc_html__( 'Currency Position', 'hubaga' ), 67 | ), 68 | 'thousand_separator' => array ( 69 | 'type' => 'text', 70 | 'default' => ',', 71 | 'section' => 'General', 72 | 'title' => esc_html__( 'Thousand Separator', 'hubaga' ), 73 | 'custom_attributes' => array( 74 | 'style' => 'max-width: 100px;' 75 | ), 76 | ), 77 | 'decimal_separator' => array ( 78 | 'type' => 'text', 79 | 'default' => '.', 80 | 'section' => 'General', 81 | 'title' => esc_html__( 'Decimal Separator', 'hubaga' ), 82 | 'custom_attributes' => array( 83 | 'style' => 'max-width: 100px;' 84 | ), 85 | ), 86 | 'sandbox' => array ( 87 | 'type' => 'checkbox', 88 | 'default' => '0', 89 | 'section' => 'General', 90 | 'class' => 'filled-in', 91 | 'title' => esc_html__( 'Activate Test Mode', 'hubaga' ), 92 | 'description' => esc_html__( 'No actual transaction will happen. This is also called sandbox mode.', 'hubaga' ), 93 | 'custom_attributes' => array( 94 | 'style' => 'max-width: 100px;' 95 | ), 96 | ), 97 | 'enable_instacheck' => array ( 98 | 'type' => 'checkbox', 99 | 'default' => '1', 100 | 'section' => 'General', 101 | 'class' => 'filled-in', 102 | 'title' => esc_html__( 'Activate Instacheck', 'hubaga' ), 103 | 'description' => esc_html__( 'Instacheck allows customers on large screens to checkout without reloading pages.', 'hubaga' ), 104 | 'custom_attributes' => array( 105 | 'style' => 'max-width: 100px;' 106 | ), 107 | ), 108 | 'enable_coupons' => array ( 109 | 'type' => 'checkbox', 110 | 'default' => '1', 111 | 'section' => 'General', 112 | 'class' => 'filled-in', 113 | 'title' => esc_html__( 'Enable Coupons', 'hubaga' ), 114 | 'description' => esc_html__( 'Allow customers to use coupons during checkout.', 'hubaga' ), 115 | 'custom_attributes' => array( 116 | 'style' => 'max-width: 100px;' 117 | ), 118 | ), 119 | //Force the gateway section to follow general section 120 | 'gateway_section_title' => array ( 121 | 'type' => 'title', 122 | 'section' => 'Gateways', 123 | 'title' => esc_html__( 'Payment Gateways', 'hubaga' ), 124 | 'subtitle' => esc_html__( 'This section allows you to activate or deactivate the various payment gateways.', 'hubaga' ), 125 | ), 126 | 'notifications_title' => array( 127 | 'type' => 'title', 128 | 'title' => esc_html__( 'Notifications', 'hubaga' ), 129 | 'section' => 'Notifications', 130 | 'sub_section' => 'Emails', 131 | ), 132 | 'mailer_from_name' => array( 133 | 'type' => 'text', 134 | 'default' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), 135 | 'title' => esc_html__( 'From Name', 'hubaga' ), 136 | 'description' => esc_html__( 'Fills the "from" field of outgoing emails', 'hubaga' ), 137 | 'section' => 'Notifications', 138 | 'sub_section' => 'Emails', 139 | ), 140 | 'mailer_from_email' => array( 141 | 'type' => 'text', 142 | 'default' => wp_specialchars_decode( get_option( 'admin_email' ), ENT_QUOTES ), 143 | 'title' => esc_html__( 'From Email', 'hubaga' ), 144 | 'description' => esc_html__( 'Fills the "reply to" field of outgoing emails', 'hubaga' ), 145 | 'section' => 'Notifications', 146 | 'sub_section' => 'Emails', 147 | ), 148 | 'mailer_header_bg' => array( 149 | 'type' => 'color', 150 | 'default' => '#ff5722', 151 | 'title' => esc_html__( 'Header Background', 'hubaga' ), 152 | 'section' => 'Notifications', 153 | 'sub_section' => 'Emails', 154 | ), 155 | 'mailer_header_color' => array( 156 | 'type' => 'color', 157 | 'default' => '#fff', 158 | 'title' => esc_html__( 'Header Color', 'hubaga' ), 159 | 'section' => 'Notifications', 160 | 'sub_section' => 'Emails', 161 | ), 162 | 'mailer_business_address' => array( 163 | 'type' => 'text', 164 | 'default' => 'Business Inc. 357 Westlands, Nairobi 00100', 165 | 'title' => esc_html__( 'Business Address', 'hubaga' ), 166 | 'description' => esc_html__( 'Helps escape spam filters.', 'hubaga' ), 167 | 'section' => 'Notifications', 168 | 'sub_section' => 'Emails', 169 | ), 170 | ); 171 | -------------------------------------------------------------------------------- /includes/admin/views/coupon-details.php: -------------------------------------------------------------------------------- 1 | array ( 14 | 'type' => 'text', 15 | 'title' => esc_html__( 'Coupon Code', 'hubaga' ), 16 | 'description' => esc_html__( 'The coupon code that customers enter during checkout. The shorter the better.', 'hubaga' ), 17 | 'placeholder' => 'SUMMERSALE', 18 | ), 19 | 20 | 'discount_type' => array ( 21 | 'type' => 'select', 22 | 'options' => hubaga_get_coupon_types(), 23 | 'title' => esc_html__( 'Coupon Type', 'hubaga' ), 24 | 'description' => esc_html__( 'The coupon type.', 'hubaga' ), 25 | ), 26 | 27 | 'amount' => array ( 28 | 'type' => 'text', 29 | 'title' => esc_html__( 'Amount', 'hubaga' ), 30 | 'description' => esc_html__( 'This is the amount that is discounted from the total order.', 'hubaga' ), 31 | ), 32 | 33 | 'date_expires' => array ( 34 | 'type' => 'date', 35 | 'title' => esc_html__( 'Expiry Date', 'hubaga' ), 36 | 'placeholder' => esc_html__( 'No expiry date', 'hubaga' ), 37 | 'description' => esc_html__( 'If you leave this blank then the coupon will never expire.', 'hubaga' ), 38 | ), 39 | 40 | 'usage_limit' => array ( 41 | 'type' => 'number', 42 | 'title' => esc_html__( 'Coupon Limit', 'hubaga' ), 43 | 'placeholder' => esc_html__( 'Unlimited', 'hubaga' ), 44 | 'description' => esc_html__( 'Set this to zero if you want the coupon to be used for an unlimited number of times.', 'hubaga' ), 45 | ), 46 | 47 | 'minimum_amount' => array ( 48 | 'type' => 'text', 49 | 'title' => esc_html__( 'Minimum Spend', 'hubaga' ), 50 | 'placeholder' => esc_html__( 'No Minimum Amount', 'hubaga' ), 51 | 'description' => esc_html__( 'The coupon will only be valid if the user spents at least the value you provide here.', 'hubaga' ), 52 | ), 53 | 54 | 'maximum_amount' => array ( 55 | 'type' => 'text', 56 | 'title' => esc_html__( 'Maximum Spend', 'hubaga' ), 57 | 'placeholder' => esc_html__( 'No Maximum Amount', 'hubaga' ), 58 | 'description' => esc_html__( 'Set this to 0 if you do not want to prevent users that spent more than the given amount from using this coupon.', 'hubaga' ), 59 | ), 60 | 61 | 'product_ids' => array ( 62 | 'type' => 'multiselect', 63 | 'data_args' => array( 'post_type' => hubaga_get_product_post_type() ), 64 | 'data' => "posts", 65 | 'title' => esc_html__( 'Products', 'hubaga' ), 66 | 'placeholder' => esc_html__( 'Applicable on all products', 'hubaga' ), 67 | 'description' => esc_html__( 'Leave this blank if you want it applicable on all products.', 'hubaga' ), 68 | ), 69 | 70 | 'excluded_product_ids' => array ( 71 | 'type' => 'multiselect', 72 | 'data_args' => array( 'post_type' => hubaga_get_product_post_type() ), 73 | 'data' => "posts", 74 | 'title' => esc_html__( 'Excluded Products', 'hubaga' ), 75 | 'placeholder' => esc_html__( 'Do not exclude any product', 'hubaga' ), 76 | 'description' => esc_html__( 'Leave this blank if you do not want to exclude any products.', 'hubaga' ), 77 | ), 78 | 79 | 'email_restrictions' => array ( 80 | 'type' => 'tag', 81 | 'title' => esc_html__( 'Emails', 'hubaga' ), 82 | 'placeholder' => esc_html__( 'Can be used by anyone', 'hubaga' ), 83 | 'description' => esc_html__( 'Leave this blank if you do not want to restrict the coupon to specific customer email addresses.', 'hubaga' ), 84 | ), 85 | 86 | ); 87 | -------------------------------------------------------------------------------- /includes/admin/views/coupon-template.php: -------------------------------------------------------------------------------- 1 | '; 15 | 16 | foreach ( $elements as $element ) { 17 | $this->render_element( $element ); 18 | } 19 | //Security check 20 | wp_nonce_field('hubaga_coupon_inner_custom_box','hubaga_coupon_inner_custom_box_nonce'); 21 | 22 | echo '72 | |
73 |
74 |
112 |
|
113 | 114 | |
$description
"; 28 | -------------------------------------------------------------------------------- /includes/elementa/elements/card.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | //Loop through the cards and display them 20 | foreach( $args['cards'] as $card => $details ) { 21 | 22 | $class = 'col s12 '; 23 | $inner_class = ' '; 24 | if( isset( $details['card_class'] ) ) { 25 | $class .= $details['card_class']; 26 | } 27 | 28 | if( isset( $details['card_inner_class'] ) ) { 29 | $inner_class .= $details['card_inner_class']; 30 | } 31 | 32 | echo "$description
"; 23 | } 24 | echo ""; // elementa-color-wrapper -------------------------------------------------------------------------------- /includes/elementa/elements/date.php: -------------------------------------------------------------------------------- 1 | "; 17 | 18 | if (! empty( $description ) ) { 19 | echo "$description
"; 20 | } 21 | -------------------------------------------------------------------------------- /includes/elementa/elements/email.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if (! empty( $description ) ) { 20 | echo "$description
"; 21 | } 22 | -------------------------------------------------------------------------------- /includes/elementa/elements/import.php: -------------------------------------------------------------------------------- 1 | get_options() ) ); 9 | ?> 10 | 11 |Copy your export data into this field and click the continue button below. Your existing data will be lost.
19 | 20 |Copy the contents of this textarea into a safe place or click the button below to download it.
25 |$description
"; 48 | } -------------------------------------------------------------------------------- /includes/elementa/elements/number.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if (! empty( $description ) ) { 20 | echo "$description
"; 21 | } 22 | -------------------------------------------------------------------------------- /includes/elementa/elements/password.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if (! empty( $description ) ) { 20 | echo "$description
"; 21 | } 22 | -------------------------------------------------------------------------------- /includes/elementa/elements/radio.php: -------------------------------------------------------------------------------- 1 | $label ) { 15 | echo ""; 20 | } 21 | 22 | if (! empty( $descprition ) ) { 23 | echo "$descprition
"; 24 | } 25 | -------------------------------------------------------------------------------- /includes/elementa/elements/range.php: -------------------------------------------------------------------------------- 1 | "; 33 | 34 | // The description 35 | if (! empty( $description ) ) { 36 | echo "$description
"; 37 | } 38 | -------------------------------------------------------------------------------- /includes/elementa/elements/raw.php: -------------------------------------------------------------------------------- 1 | "; 15 | echo ""; 16 | 17 | if (! empty( $description ) ) 18 | echo "$description
"; 19 | -------------------------------------------------------------------------------- /includes/elementa/elements/search.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if (! empty( $description ) ) { 20 | echo "$description
"; 21 | } 22 | -------------------------------------------------------------------------------- /includes/elementa/elements/select.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | //Loop over options and print them 20 | if ( is_array( $options ) ) { 21 | 22 | foreach ( $options as $key => $val ) { 23 | 24 | $value = esc_attr( $key ); 25 | $current = $args['_value']; 26 | 27 | echo ""; 41 | } 42 | 43 | } 44 | echo ""; 45 | 46 | 47 | if (! empty( $description ) ) { 48 | echo "$description
"; 49 | } -------------------------------------------------------------------------------- /includes/elementa/elements/switch.php: -------------------------------------------------------------------------------- 1 | "; 20 | -------------------------------------------------------------------------------- /includes/elementa/elements/text.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if (! empty( $description ) ) { 20 | echo "$description
"; 21 | } 22 | -------------------------------------------------------------------------------- /includes/elementa/elements/textarea.php: -------------------------------------------------------------------------------- 1 | $value"; 19 | 20 | if (! empty( $description ) ) { 21 | echo "$description
"; 22 | } 23 | -------------------------------------------------------------------------------- /includes/elementa/elements/title.php: -------------------------------------------------------------------------------- 1 | "; 18 | 19 | if ( isset( $args['title'] ) ) { 20 | echo '89 | 90 | 91 |
92 | 93 |94 | 95 | 103 |
104 | save(); 34 | } 35 | 36 | /** 37 | * Returns a products ID 38 | * 39 | * @since Hubaga 1.0.0 40 | * 41 | * @returns a string containing the product id 42 | */ 43 | function hubaga_get_product_id( $product ) { 44 | return hubaga_get_product( $product )->ID; 45 | } 46 | add_filter( 'hubaga_product_ID', 'absint' ); 47 | 48 | 49 | /** 50 | * Returns a products title 51 | * 52 | * @since Hubaga 1.0.0 53 | * 54 | * @returns a string containing the product title 55 | */ 56 | function hubaga_get_product_title( $product ) { 57 | return hubaga_get_product( $product )->post_title; 58 | } 59 | add_filter( 'hubaga_product_title', 'sanitize_text_field' ); 60 | 61 | 62 | /** 63 | * Returns a products short description 64 | * 65 | * @since Hubaga 1.0.0 66 | * 67 | * @returns a string containing the product description 68 | */ 69 | function hubaga_get_product_description( $product ) { 70 | return hubaga_get_product( $product )->short_description; 71 | } 72 | add_filter( 'hubaga_product_short_description', 'wptexturize' ); 73 | add_filter( 'hubaga_product_short_description', 'convert_smilies' ); 74 | add_filter( 'hubaga_product_short_description', 'convert_chars' ); 75 | add_filter( 'hubaga_product_short_description', 'wpautop' ); 76 | add_filter( 'hubaga_product_short_description', 'shortcode_unautop' ); 77 | add_filter( 'hubaga_product_short_description', 'prepend_attachment' ); 78 | add_filter( 'hubaga_product_short_description', 'do_shortcode', 11 ); // AFTER wpautop() 79 | 80 | /** 81 | * Returns the number of times a product has been sold 82 | * 83 | * @since Hubaga 1.0.0 84 | * 85 | * @returns a string containing the product sell count 86 | */ 87 | function hubaga_get_product_sell_count( $product ) { 88 | return hubaga_get_product( $product )->sell_count; 89 | } 90 | add_filter( 'hubaga_product_sell_count', 'absint' ); 91 | 92 | 93 | /** 94 | * Returns a product type 95 | * 96 | * @since Hubaga 1.0.0 97 | * 98 | * @returns a string containing the product type 99 | */ 100 | function hubaga_get_product_type( $product ) { 101 | return hubaga_get_product( $product )->type; 102 | } 103 | add_filter( 'hubaga_product_type', 'sanitize_title' ); 104 | 105 | /** 106 | * Returns the downloads attached to a product 107 | * 108 | * @since Hubaga 1.0.0 109 | * 110 | * @returns an array containing the downloads. 111 | */ 112 | function hubaga_get_product_downloads( $product ) { 113 | $product = hubaga_get_product( $product ); 114 | $downloads= array(); 115 | if( $product->download_url ){ 116 | $downloads[] = array( 117 | 'name' => $product->download_name, 118 | 'url' => $product->download_url, 119 | ); 120 | } 121 | return apply_filters( 'hubaga_product_downloads', $downloads, $product); 122 | } 123 | 124 | /** 125 | * Returns a product status 126 | * 127 | * @since Hubaga 1.0.0 128 | * 129 | * @returns a string containing the product status 130 | */ 131 | function hubaga_get_product_status( $product ) { 132 | return hubaga_get_product( $product )->post_status; 133 | } 134 | 135 | 136 | /** 137 | * Returns a product price with the symbol 138 | * 139 | * @since Hubaga 1.0.0 140 | * 141 | * @returns a string containing the product price 142 | */ 143 | function hubaga_get_product_price( $product ) { 144 | return hubaga_get_product( $product )->price; 145 | } 146 | 147 | /** 148 | * Returns a formatted product price with the symbol 149 | * 150 | * @since Hubaga 1.0.0 151 | * 152 | * @returns a string containing the product price 153 | */ 154 | function hubaga_get_formatted_product_price( $product ) { 155 | $price = hubaga_price( hubaga_get_product_price( $product ) ); 156 | return apply_filters( 'hubaga_formatted_product_price', $price, $product ); 157 | } 158 | 159 | /** 160 | * Checks if the provided product exists in the db 161 | * @since 1.0 162 | * @param mixed $product ID, details or object 163 | * @return bool 164 | */ 165 | function hubaga_is_product( $product ) { 166 | return hubaga_get_product( $product )->is_product(); 167 | } 168 | 169 | /** 170 | * Checks if the provided product can be bought 171 | * @since 1.0 172 | * @param mixed $product ID, details or object 173 | * @return bool 174 | */ 175 | function hubaga_can_buy_product( $product ) { 176 | return hubaga_get_product( $product )->can_buy(); 177 | } 178 | 179 | /** 180 | * Checks if the provided product is free 181 | * @since 1.0 182 | * @param mixed $product ID, details or object 183 | * @return bool 184 | */ 185 | function hubaga_is_product_free( $product ) { 186 | return hubaga_get_product( $product )->is_free(); 187 | } 188 | 189 | /** 190 | * Updates a products sell count 191 | * @since 1.0 192 | * @param mixed $product ID, details or object 193 | * @return bool 194 | */ 195 | function hubaga_update_product_sell_count( $product, $by = 1 ) { 196 | return hubaga_get_product( $product )->update_sell_count( $by ); 197 | } 198 | 199 | /** 200 | * Retrieves a list of product types 201 | * 202 | * @since 1.0 203 | * @return array 204 | */ 205 | function hubaga_get_product_types() { 206 | return apply_filters( 'hubaga_get_product_types', array( 207 | 'normal' => _x( 'Normal Product', 'A normal product that accepts a single payment', 'hubaga' ), 208 | ) ); 209 | } 210 | 211 | /** 212 | * Retrieves a list of product labels 213 | * 214 | * @since 1.0 215 | * @return array 216 | */ 217 | function hubaga_get_product_post_type_labels() { 218 | return apply_filters( 219 | 'hubaga_product_post_type_labels', 220 | array( 221 | 'name' => __( 'Products', 'hubaga' ), 222 | 'singular_name' => __( 'Product', 'hubaga' ), 223 | 'menu_name' => _x( 'Hubaga', 'Admin menu name', 'hubaga' ), 224 | 'add_new' => __( 'Add product', 'hubaga' ), 225 | 'add_new_item' => __( 'Add new product', 'hubaga' ), 226 | 'edit' => __( 'Edit', 'hubaga' ), 227 | 'edit_item' => __( 'Edit product', 'hubaga' ), 228 | 'new_item' => __( 'New product', 'hubaga' ), 229 | 'view' => __( 'View product', 'hubaga' ), 230 | 'view_item' => __( 'View product', 'hubaga' ), 231 | 'search_items' => __( 'Search products', 'hubaga' ), 232 | 'not_found' => __( 'No products found', 'hubaga' ), 233 | 'not_found_in_trash' => __( 'No products found in trash', 'hubaga' ), 234 | 'parent' => __( 'Parent product', 'hubaga' ), 235 | 'featured_image' => __( 'Product image', 'hubaga' ), 236 | 'set_featured_image' => __( 'Set product image', 'hubaga' ), 237 | 'remove_featured_image' => __( 'Remove product image', 'hubaga' ), 238 | 'use_featured_image' => __( 'Use as product image', 'hubaga' ), 239 | 'insert_into_item' => __( 'Insert into product', 'hubaga' ), 240 | 'uploaded_to_this_item' => __( 'Uploaded to this product', 'hubaga' ), 241 | 'filter_items_list' => __( 'Filter products', 'hubaga' ), 242 | 'items_list_navigation' => __( 'Products navigation', 'hubaga' ), 243 | 'items_list' => __( 'Products list', 'hubaga' ), 244 | ) ); 245 | } 246 | 247 | 248 | 249 | /** 250 | * Returns product post type details 251 | */ 252 | function hubaga_get_product_post_type_details(){ 253 | return apply_filters( 254 | 'hubaga_product_post_type_details', 255 | array( 256 | 'labels' => hubaga_get_product_post_type_labels(), 257 | 'description' => __( 'This is where you can add new digital products to your website.', 'hubaga' ), 258 | 'public' => false, 259 | 'show_ui' => true, 260 | 'map_meta_cap' => true, 261 | 'publicly_queryable' => false, 262 | 'exclude_from_search' => true, 263 | 'hierarchical' => false, // Hierarchical causes memory issues - WP loads all records! 264 | 'query_var' => true, 265 | 'supports' => array( 'title' ), 266 | 'has_archive' => false, 267 | 'show_in_nav_menus' => false, 268 | 'show_in_rest' => true, 269 | 'menu_icon' => 'dashicons-products' 270 | )); 271 | } 272 | 273 | /** 274 | * Returns product post type 275 | */ 276 | function hubaga_get_product_post_type(){ 277 | return hubaga()->product_post_type; 278 | } 279 | 280 | /** 281 | * Returns product post type menu name 282 | */ 283 | function hubaga_get_product_post_type_menu_name(){ 284 | return apply_filters( 'hubaga_product_post_type_menu_name', 'edit.php?post_type=' . hubaga_get_product_post_type()); 285 | } 286 | 287 | /** 288 | * Trigger a product purchase hook 289 | */ 290 | function hubaga_trigger_product_purchased_hook( $order ){ 291 | do_action( 'hubaga_product_purchased', hubaga_get_product( $order->product ), $order ); 292 | } 293 | add_action( 'hubaga_order_complete', 'hubaga_trigger_product_purchased_hook' ); 294 | -------------------------------------------------------------------------------- /includes/shortcodes.php: -------------------------------------------------------------------------------- 1 | add_shortcodes(); 33 | $this->template = hubaga()->template; 34 | } 35 | 36 | /** 37 | * Registers shortocodes 38 | * 39 | * @since Hubaga 1.0.0 40 | * @access private 41 | * 42 | * @uses apply_filters() 43 | */ 44 | private function add_shortcodes() { 45 | 46 | // Available shortcodes 47 | $shortcodes = apply_filters( 'hubaga_shortcodes', array( 48 | 'h-product' => array( $this, 'display_product' ), 49 | 'h-checkout' => array( $this, 'display_checkout' ), 50 | 'h-account' => array( $this, 'display_account' ), 51 | 'h-buy-button' => array( $this, 'display_buy_button' ), 52 | ) ); 53 | 54 | foreach ( $shortcodes as $code => $cb ) { 55 | add_shortcode( $code, $cb ); 56 | } 57 | } 58 | 59 | /** 60 | * Displays a single product 61 | * 62 | * @since Hubaga 1.0.0 63 | * 64 | * @param array $attr 65 | * @return string 66 | */ 67 | public function display_product( $atts ) { 68 | 69 | $options = shortcode_atts( array( 70 | 'id' => 0, 71 | 'class' => '', 72 | ), $atts ); 73 | 74 | return $this->template->get_view_product_html( $options ); 75 | } 76 | 77 | /** 78 | * Displays a the checkout page 79 | * 80 | * @since Hubaga 1.0.0 81 | * 82 | * @return string 83 | */ 84 | public function display_checkout() { 85 | return $this->template->get_checkout_html(); 86 | } 87 | 88 | /** 89 | * Displays a the account page 90 | * 91 | * @since Hubaga 1.0.0 92 | * 93 | * @return string 94 | */ 95 | public function display_account() { 96 | return $this->template->get_account_html(); 97 | } 98 | 99 | /** 100 | * Displays a list of products 101 | * 102 | * @since Hubaga 1.0.0 103 | * 104 | * @return string 105 | */ 106 | public function display_buy_button( $atts, $content ) { 107 | 108 | if(! $content ) { 109 | $content = 'BUY'; 110 | } 111 | 112 | $options = shortcode_atts( array( 113 | 'id' => 0, 114 | 'class' => '', 115 | 'content' => $content, 116 | ), $atts ); 117 | 118 | return $this->template->get_buy_button( $options ); 119 | } 120 | 121 | } 122 | endif; -------------------------------------------------------------------------------- /includes/system-info.php: -------------------------------------------------------------------------------- 1 | info = $this->get_info(); 31 | } 32 | 33 | /** 34 | * Returns an array of system information 35 | * in the form 36 | * 37 | * array( 'category' => array( ) ) 38 | * 39 | * @since Hubaga 1.0.0 40 | * 41 | */ 42 | public function get_info() { 43 | 44 | $plugins = hubaga_get_all_plugins(); 45 | 46 | //These have intentionally been untranslated 47 | return apply_filters( 'hubaga_system_info', array( 48 | 'Site Info' => $this->get_site_info(), 49 | 'WordPress Configuration' => $this->get_wordpress_config(), 50 | 'Server Info' => $this->get_server_info(), 51 | 'Active Plugins' => $plugins['active_plugins'], 52 | 'Inactive Plugins' => $plugins['inactive_plugins'], 53 | ) ); 54 | } 55 | 56 | /** 57 | * Returns the system information as a text string for use in textarea elements 58 | * 59 | * @since Hubaga 1.0.0 60 | * 61 | */ 62 | public function get_info_as_text() { 63 | $info = $this->info; 64 | $text = "### Begin System Info ###\n\n"; 65 | 66 | foreach( $info as $cat => $info ){ 67 | 68 | if( is_array( $info ) ) { 69 | 70 | $text .= "\n\n ----------- $cat -------------- \n\n"; 71 | 72 | foreach( $info as $label => $value ){ 73 | 74 | if ( is_array( $value ) ) { 75 | $value = print_r( $value, true ); 76 | } 77 | 78 | $text .= "\t $label : $value \n\n"; 79 | } 80 | 81 | } else { 82 | $text .= "$cat : $info \n\n"; 83 | } 84 | } 85 | 86 | $text .= "\n ### End System Info ###"; 87 | return apply_filters( 'hubaga_system_info_text', $text ); 88 | } 89 | 90 | 91 | /** 92 | * Returns the system information as a json string for use with apis or download 93 | * 94 | * @since Hubaga 1.0.0 95 | * 96 | */ 97 | public function get_info_as_json() { 98 | $info = wp_json_encode( $this->info ); 99 | return apply_filters( 'hubaga_system_info_json', $info ); 100 | } 101 | 102 | /** 103 | * Returns information about the current WordPress site configuration 104 | * 105 | * 106 | * @since Hubaga 1.0.0 107 | * 108 | */ 109 | public function get_site_info() { 110 | 111 | return apply_filters( 'hubaga_site_system_info', array( 112 | 'Site URL' => site_url(), 113 | 'Home URL' => home_url(), 114 | 'Multisite' => ( is_multisite() ? 'Yes' : 'No' ), 115 | ) ); 116 | } 117 | 118 | /** 119 | * Returns information about the current WordPress site configuration 120 | * 121 | * 122 | * @since Hubaga 1.0.0 123 | * 124 | */ 125 | public function get_wordpress_config() { 126 | 127 | global $wpdb; 128 | $theme_data = wp_get_theme(); 129 | $theme = $theme_data->Name . ' ' . $theme_data->Version . ' (' . $theme_data->uri . ')'; 130 | 131 | return apply_filters( 'hubaga_wordpress_config_system_info', array( 132 | 'Version' => get_bloginfo( 'version' ), 133 | 'Language' => get_locale(), 134 | 'Permalink Structure' => ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ), 135 | 'Active Theme' => $theme, 136 | 'Table Prefix' => $wpdb->prefix, 137 | 'WP_DEBUG' => ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ), 138 | 'Memory Limit' => WP_MEMORY_LIMIT, 139 | 'Registered Post Stati' => implode( ', ', get_post_stati() ), 140 | ) ); 141 | } 142 | 143 | /** 144 | * Returns information about the server 145 | * 146 | * 147 | * @since Hubaga 1.0.0 148 | * 149 | */ 150 | public function get_server_info() { 151 | 152 | global $wpdb; 153 | $server_data = array(); 154 | 155 | if ( function_exists( 'ini_get' ) ) { 156 | 157 | $server_data['Post Max Size'] = size_format( ini_get( 'post_max_size' ) ); 158 | $server_data['Safe Mode'] = ini_get( 'safe_mode' ) ? 'Enabled' : 'Disabled'; 159 | $server_data['Memory Limit'] = ini_get( 'memory_limit' ); 160 | $server_data['Upload Max Size'] = ini_get( 'upload_max_filesize' ); 161 | $server_data['Time Limit'] = ini_get( 'max_execution_time' ); 162 | $server_data['Max Input Vars'] = ini_get( 'max_input_vars' ); 163 | 164 | } 165 | 166 | return apply_filters( 'hubaga_server_system_info', array_merge( array( 167 | 'PHP Version' => PHP_VERSION, 168 | 'MySQL Version' => $wpdb->db_version(), 169 | 'Server' => ( empty( $_SERVER['SERVER_SOFTWARE'] ) ? 'Unknown' : $_SERVER['SERVER_SOFTWARE'] ), 170 | 'cURL' => ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ), 171 | 'fsockopen' => ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ), 172 | 'SOAP Client' => ( class_exists( 'SoapClient' ) ? 'Installed' : 'Not Installed' ), 173 | 'Suhosin' => ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ), 174 | ), $server_data ) ); 175 | } 176 | 177 | } 178 | endif; // class_exists check 179 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | New > Upload then upload the the source code that you just downloaded. 38 | 39 | Before you can sell your products; you will have to set up PayPal. This can be done by clicking on Hubaga in your WordPress dashboard then selecting settings. 40 | 41 | 42 | ## Found a Bug? 43 | 44 | You can let us know by [opening a new issue](https://github.com/picocodes/hubaga/issues). 45 | 46 | ## Contributing 47 | 48 | Make sure to communicate the changes to your code via an issue or email before [sending a pull request](https://help.github.com/articles/creating-a-pull-request/). 49 | 50 | ## Versioning 51 | 52 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/picocodes/hubaga/tags). 53 | 54 | 55 | ## License 56 | 57 | This project is licensed under the GPL3 License - see the [license.txt](license.txt) file for details 58 | 59 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Hubaga Sell Digital Downloads === 2 | Contributors: hubaga 3 | Tags: ecommerce, e-commerce, store, sell downloads, sell, shop, cart, checkout, downloads, paypal, digital downloads 4 | Donate link: https://hubaga.com 5 | Requires at least: 4.1 6 | Tested up to: 4.9 7 | Requires PHP: 5.2.4 8 | Stable tag: 1.0.3 9 | License: GPLv3 10 | License URI: https://www.gnu.org/licenses/gpl-3.0.html 11 | 12 | Use this light-weight eCommerce plugin to sell your software and other digital products. 13 | 14 | == Description == 15 | Hubaga was built to make it easy to sell digital products without using bloated plugins. 16 | 17 | It uses a single-field checkout to keep the checkout process short. In addition; you can enable instacheck and load the checkout form via ajax further speeding up the checkout process. 18 | 19 | Hubaga maximizes conversions by applying several checkout optimisation techniques such as short checkout processes and strategic application of trust seals. 20 | 21 | == Installation == 22 | = Minimum Requirements = 23 | 24 | * PHP version 5.2.4 or greater (PHP 7 or greater is recommended) 25 | * fsockopen or cURL enabled to confirm payments 26 | * WordPress 4.1+ 27 | 28 | = Automatic installation = 29 | 30 | Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of Hubaga, log in to your WordPress dashboard, navigate to the Plugins menu and click Add New. 31 | 32 | In the search field type “Hubaga” and click Search Plugins. Once you’ve found our eCommerce plugin, you can install it by simply clicking “Install Now”. 33 | 34 | = Manual installation = 35 | 36 | The manual installation method involves downloading our eCommerce plugin and uploading it to your webserver via your favourite FTP application. The WordPress codex contains [instructions on how to do this here](https://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation). 37 | 38 | 39 | == Frequently Asked Questions == 40 | = Where can I get support? = 41 | 42 | If you get stuck, you can ask for help in the [Hubaga Plugin Forum](https://wordpress.org/support/plugin/woocommerce). 43 | 44 | Our premium customers can contact us at [our helpdesk](https://hubaga.freshdesk.com/). 45 | 46 | = Will Hubaga work with my theme? = 47 | Yes. 48 | 49 | = Where can I report bugs or contribute to the project? = 50 | 51 | Bugs can be reported on the [Hubaga GitHub repository](https://github.com/hubaga/hubaga/issues). 52 | 53 | 54 | == Screenshots == 55 | 1. Sample Product Card 56 | 2. Reports page 57 | 3. Instacheck -------------------------------------------------------------------------------- /uninstall.php: -------------------------------------------------------------------------------- 1 |