| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
use ABlocks\Controls\Border; |
| 8 |
use ABlocks\Controls\Dimensions; |
| 9 |
use ABlocks\Controls\Typography; |
| 10 |
use ABlocks\Controls\TextShadow; |
| 11 |
use ABlocks\Controls\Alignment; |
| 12 |
use ABlocks\Controls\Link; |
| 13 |
use ABlocks\Helper; |
| 14 |
use ABlocks\Controls\BoxShadow; |
| 15 |
use ABlocks\Controls\Icon; |
| 16 |
use ABlocks\Controls\Range; |
| 17 |
|
| 18 |
$attributes = [ |
| 19 |
'block_id' => [ |
| 20 |
'type' => 'string', |
| 21 |
'default' => '', |
| 22 |
], |
| 23 |
'blockVersion' => array( |
| 24 |
'type' => 'number', |
| 25 |
'default' => '', |
| 26 |
), |
| 27 |
'text' => [ |
| 28 |
'type' => 'string', |
| 29 |
'default' => 'Buy now', |
| 30 |
], |
| 31 |
'buttonType' => [ |
| 32 |
'type' => 'string', |
| 33 |
'default' => '#032e82', |
| 34 |
], |
| 35 |
'buttonSize' => [ |
| 36 |
'type' => 'string', |
| 37 |
'default' => 'md', |
| 38 |
], |
| 39 |
'textColor' => [ |
| 40 |
'type' => 'string', |
| 41 |
'default' => '#FFFFFF', |
| 42 |
], |
| 43 |
'textColorH' => [ |
| 44 |
'type' => 'string', |
| 45 |
'default' => '', |
| 46 |
], |
| 47 |
'background' => [ |
| 48 |
'type' => 'string', |
| 49 |
'default' => '', |
| 50 |
], |
| 51 |
'backgroundH' => [ |
| 52 |
'type' => 'string', |
| 53 |
'default' => '', |
| 54 |
], |
| 55 |
'transition' => [ |
| 56 |
'type' => 'number', |
| 57 |
'default' => '', |
| 58 |
], |
| 59 |
'showIcon' => [ |
| 60 |
'type' => 'boolean', |
| 61 |
'default' => true, |
| 62 |
], |
| 63 |
'iconPosition' => [ |
| 64 |
'type' => 'string', |
| 65 |
'default' => 'left', |
| 66 |
], |
| 67 |
|
| 68 |
// PayPal Pricing & Payments |
| 69 |
'paypalAccount' => [ |
| 70 |
'type' => 'string', |
| 71 |
'default' => '', |
| 72 |
], |
| 73 |
'trxType' => [ |
| 74 |
'type' => 'string', |
| 75 |
'default' => '_xclick', |
| 76 |
], |
| 77 |
'itemName' => [ |
| 78 |
'type' => 'string', |
| 79 |
'default' => '', |
| 80 |
], |
| 81 |
'sku' => [ |
| 82 |
'type' => 'string', |
| 83 |
'default' => '', |
| 84 |
], |
| 85 |
'price' => [ |
| 86 |
'type' => 'number', |
| 87 |
'default' => '0', |
| 88 |
], |
| 89 |
'currency' => [ |
| 90 |
'type' => 'string', |
| 91 |
'default' => 'USD', |
| 92 |
], |
| 93 |
'quantity' => [ |
| 94 |
'type' => 'number', |
| 95 |
'default' => '1', |
| 96 |
], |
| 97 |
'shippingPrice' => [ |
| 98 |
'type' => 'number', |
| 99 |
'default' => '0', |
| 100 |
], |
| 101 |
'tax' => [ |
| 102 |
'type' => 'number', |
| 103 |
'default' => '0', |
| 104 |
], |
| 105 |
// donation extra |
| 106 |
'isAmountFixed' => [ |
| 107 |
'type' => 'boolean', |
| 108 |
'default' => false, |
| 109 |
], |
| 110 |
// subscription extra |
| 111 |
'isAutoRenewal' => [ |
| 112 |
'type' => 'boolean', |
| 113 |
'default' => true, |
| 114 |
], |
| 115 |
'billingCycle' => [ |
| 116 |
'type' => 'string', |
| 117 |
'default' => 'M', |
| 118 |
], |
| 119 |
|
| 120 |
// PayPal Additional Options |
| 121 |
'redirectionAfterPayment' => [ |
| 122 |
'type' => 'string', |
| 123 |
'default' => '', |
| 124 |
], |
| 125 |
'sandboxMode' => [ |
| 126 |
'type' => 'boolean', |
| 127 |
'default' => false, |
| 128 |
], |
| 129 |
'sandboxEmail' => [ |
| 130 |
'type' => 'string', |
| 131 |
'default' => '', |
| 132 |
], |
| 133 |
'openInNewTab' => [ |
| 134 |
'type' => 'boolean', |
| 135 |
'default' => true, |
| 136 |
], |
| 137 |
'customMessage' => [ |
| 138 |
'type' => 'boolean', |
| 139 |
'default' => false, |
| 140 |
], |
| 141 |
'errorMessage' => [ |
| 142 |
'type' => 'string', |
| 143 |
'default' => 'No payment method connected. Contact seller.', |
| 144 |
] |
| 145 |
|
| 146 |
]; |
| 147 |
|
| 148 |
|
| 149 |
$attributes = array_merge( |
| 150 |
$attributes, |
| 151 |
Icon::get_attribute( 'icon', [ |
| 152 |
'size' => '16', |
| 153 |
'className' => 'fab fa-paypal', |
| 154 |
'path' => 'M111.4 295.9c-3.5 19.2-17.4 108.7-21.5 134-.3 1.8-1 2.5-3 2.5H12.3c-7.6 0-13.1-6.6-12.1-13.9L58.8 46.6c1.5-9.6 10.1-16.9 20-16.9 152.3 0 165.1-3.7 204 11.4 60.1 23.3 65.6 79.5 44 140.3-21.5 62.6-72.5 89.5-140.1 90.3-43.4.7-69.5-7-75.3 24.2zM357.1 152c-1.8-1.3-2.5-1.8-3 1.3-2 11.4-5.1 22.5-8.8 33.6-39.9 113.8-150.5 103.9-204.5 103.9-6.1 0-10.1 3.3-10.9 9.4-22.6 140.4-27.1 169.7-27.1 169.7-1 7.1 3.5 12.9 10.6 12.9h63.5c8.6 0 15.7-6.3 17.4-14.9.7-5.4-1.1 6.1 14.4-91.3 4.6-22 14.3-19.7 29.3-19.7 71 0 126.4-28.8 142.9-112.3 6.5-34.8 4.6-71.4-23.8-92.6z', |
| 155 |
'viewBox' => '0 0 384 512', |
| 156 |
'iconType' => 'default', |
| 157 |
'color' => '#ffffff', |
| 158 |
] ), |
| 159 |
Link::get_attribute( 'link' ), |
| 160 |
Border::get_attribute( 'border', true ), |
| 161 |
Dimensions::get_attribute( 'padding', true ), |
| 162 |
Typography::get_attribute( 'typography', true ), |
| 163 |
TextShadow::get_attribute( 'textShadow' ), |
| 164 |
Alignment::get_attribute( 'position', true, [ 'value' => 'left' ] ), |
| 165 |
Alignment::get_attribute( 'alignment', true, [ 'value' => 'left' ] ), |
| 166 |
BoxShadow::get_attribute( 'boxShadow', true ), |
| 167 |
Range::get_attribute([ |
| 168 |
'attributeName' => 'iconSpace', |
| 169 |
'attributeObjectKey' => 'value', |
| 170 |
'isResponsive' => true, |
| 171 |
'defaultValue' => 10, |
| 172 |
'hasUnit' => true, |
| 173 |
'unitDefaultValue' => 'px', |
| 174 |
]), |
| 175 |
); |
| 176 |
|
| 177 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 178 |
|
| 179 |
|