Changeset 3101097
- Timestamp:
- 06/11/2024 10:48:38 AM (22 months ago)
- Location:
- a-ads
- Files:
-
- 4 edited
-
assets/icon.svg (modified) (1 diff)
-
trunk/A-ADS.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/widget.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
a-ads/assets/icon.svg
r2431002 r3101097 1 <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"> 2 <rect width="256" height="256" fill="white"/> 3 <path fill-rule="evenodd" clip-rule="evenodd" d="M42.9403 195.687C40.1596 195.687 38.8213 192.872 39.9151 190.315L52.8483 160.086C53.7977 157.867 55.9789 156.428 58.3925 156.428V156.428C60.8014 156.428 62.9792 157.861 63.9316 160.074L76.8405 190.068C77.9572 192.663 76.127 195.571 73.3047 195.687V195.687V195.687C71.366 195.54 69.6755 194.313 68.9344 192.515L66.5605 186.757H49.9913L47.7359 192.326C46.8925 194.409 45.1873 195.687 42.9403 195.687V195.687V195.687ZM53.0696 179.232H63.4813L60.379 170.863C59.6555 168.912 56.8954 168.912 56.172 170.863L53.0696 179.232ZM102.51 195.447C99.9876 195.447 98.2884 192.865 99.2856 190.548L112.399 160.078C113.353 157.863 115.533 156.428 117.945 156.428V156.428C120.357 156.428 122.537 157.863 123.49 160.078L136.437 190.161C137.513 192.661 135.674 195.616 132.958 195.447V195.447V195.447C130.986 195.447 129.21 194.257 128.458 192.435L126.118 186.757H109.548L107.283 192.252C106.486 194.185 104.601 195.447 102.51 195.447V195.447V195.447ZM112.627 179.232H123.039L119.936 170.863C119.213 168.912 116.453 168.912 115.729 170.863L112.627 179.232ZM153.016 195.449C148.06 195.449 144.043 191.432 144.043 186.476V165.681C144.043 160.725 148.06 156.707 153.016 156.707H159.324C171.639 156.707 179.3 165.064 179.3 176.078C179.3 186.981 171.639 195.449 159.324 195.449H153.016ZM152.663 185.51C152.663 186.749 153.668 187.753 154.907 187.753H159.325C166.378 187.753 170.288 183.049 170.288 176.075C170.288 169.213 166.378 164.397 159.325 164.397H154.907C153.668 164.397 152.663 165.402 152.663 166.641V185.51ZM202.08 196C210.533 196 216.466 191.683 216.466 183.99C216.466 177.127 211.988 174.305 204.039 172.257C197.266 170.541 195.587 169.711 195.587 167.165C195.587 165.173 197.843 163.524 200.478 163.524C203.113 163.524 207.902 165.341 209.785 166.04C211.668 166.739 214.161 166.853 215.157 165.189C216.153 163.524 216.01 161.692 214.491 160.286C212.972 158.881 206.446 156.151 200.737 156.151C192.732 156.151 187.022 160.8 187.022 167.829C187.022 175.633 192.116 177.792 200.009 179.784C206.558 181.444 207.902 182.551 207.902 184.71C207.902 187.09 205.607 188.878 202.08 188.878C197.602 188.878 192.737 185.513 191.322 184.781C189.908 184.049 187.584 183.875 186.227 185.712C184.869 187.549 185.898 189.789 187.216 191.016C188.534 192.242 194.272 196 202.08 196Z" fill="#263238"/> 4 <path fill-rule="evenodd" clip-rule="evenodd" d="M88.5315 179.181C90.7323 179.181 92.5164 177.397 92.5164 175.196C92.5164 172.995 90.7323 171.211 88.5315 171.211C86.3307 171.211 84.5466 172.995 84.5466 175.196C84.5466 177.397 86.3307 179.181 88.5315 179.181Z" fill="#03A9F4"/> 5 <path fill-rule="evenodd" clip-rule="evenodd" d="M89.8394 127.218C90.9326 129.352 92.6046 131.171 94.7267 132.552C96.9775 134.058 99.4212 135.187 101.929 135.94C104.501 136.693 107.202 137.07 109.903 137.07C113.44 137.07 116.977 136.38 120.192 135.062C122.893 133.995 125.401 132.489 127.652 130.607C129.903 132.489 132.411 133.995 135.047 135.062C138.327 136.38 141.864 137.07 145.401 137.07C148.102 137.07 150.738 136.693 153.31 135.94C155.883 135.187 158.326 134.058 160.577 132.552C162.699 131.171 164.371 129.352 165.464 127.218C166.622 125.148 167.265 122.763 167.265 120.316C167.265 117.492 166.493 114.857 165.014 112.598C163.6 110.276 161.477 108.394 158.969 107.139C158.005 106.637 156.847 107.014 156.397 107.955C156.011 108.645 156.14 109.461 156.654 110.025C156.912 110.339 157.105 110.716 157.233 111.092C157.426 111.469 157.49 111.908 157.49 112.347C157.49 113.414 157.04 114.355 156.333 115.045C155.626 115.736 154.661 116.175 153.568 116.175C153.118 116.175 152.667 116.049 152.217 115.924L152.217 115.924C151.831 115.798 151.446 115.547 151.06 115.234C148.938 113.539 146.687 112.096 144.243 110.904C142.828 110.276 141.414 109.712 139.999 109.273C141.349 107.767 142.507 106.01 143.279 104.064C145.208 103.939 147.008 103.123 148.359 101.806C149.774 100.362 150.674 98.4172 150.674 96.221C150.674 94.0876 149.774 92.1424 148.359 90.6992C146.88 89.256 144.886 88.3776 142.635 88.3776L141.221 81.9146C143.857 83.797 147.073 84.9264 150.545 84.9264H162.442C166.3 84.9264 169.837 83.6087 172.538 81.2871C175.239 79.0282 177.168 75.828 177.811 72.1887L179.226 63.0903C179.291 63.0903 179.291 63.0275 179.291 62.9648V62.902C179.869 62.7138 180.448 62.4 180.898 61.9608C181.541 61.2706 181.991 60.3294 181.991 59.3254C181.991 58.3842 181.606 57.5057 181.027 56.8155L180.898 56.69C180.191 55.9998 179.226 55.5605 178.197 55.5605H178.133H172.667H139.87H139.806C137.941 55.5605 136.333 56.3135 135.112 57.5057C134.919 57.694 134.661 57.945 134.468 58.1959C133.761 57.8195 132.989 57.5057 132.218 57.2547C130.739 56.8155 129.195 56.5645 127.652 56.5645C126.109 56.5645 124.565 56.8155 123.086 57.2547C122.314 57.5057 121.543 57.8195 120.835 58.1959C120.642 57.945 120.385 57.694 120.192 57.5057C118.97 56.3135 117.363 55.5605 115.498 55.5605H115.434H82.637H77.1066C76.0777 55.5605 75.1131 55.9998 74.4057 56.69C74.366 56.69 74.3508 56.714 74.3298 56.7471C74.3168 56.7676 74.3017 56.7915 74.2771 56.8155C73.6983 57.5057 73.3125 58.3842 73.3125 59.3254C73.3125 60.3294 73.6983 61.2706 74.4057 61.9608C74.8559 62.4 75.3703 62.7138 76.0134 62.902V62.9648V63.0903L77.4925 72.1887C78.1355 75.828 80.0004 79.0282 82.7656 81.2871C85.4665 83.6087 89.0034 84.9264 92.8618 84.9264H104.759C108.231 84.9264 111.447 83.797 114.083 81.9146L112.668 88.3776C110.482 88.3776 108.553 89.1933 107.074 90.5737L106.945 90.6992C105.466 92.1424 104.566 94.0876 104.566 96.221C104.566 98.4172 105.466 100.362 106.945 101.806C108.296 103.123 110.032 103.939 112.025 104.064C112.797 106.01 113.89 107.767 115.305 109.273C113.89 109.712 112.475 110.276 111.061 110.904C108.617 112.096 106.302 113.539 104.244 115.234C103.858 115.547 103.473 115.798 103.087 115.924L103.087 115.924C102.636 116.049 102.186 116.175 101.736 116.175C100.643 116.175 99.6784 115.736 98.971 115.045C98.2636 114.355 97.8135 113.414 97.8135 112.347C97.8135 111.908 97.8778 111.469 98.0707 111.092C98.1993 110.716 98.3922 110.339 98.6495 110.025C99.1639 109.461 99.2925 108.645 98.9067 107.955C98.4566 107.014 97.299 106.637 96.3344 107.139C93.7621 108.394 91.7043 110.276 90.2896 112.598C88.8105 114.857 88.0388 117.492 88.0388 120.316C88.0388 122.763 88.6819 125.148 89.8394 127.218ZM131.896 64.0947C133.053 65.0359 133.889 66.2281 134.211 67.734L134.404 68.6125L134.468 68.6752L135.368 73.0048V73.0676L139.227 90.8252C139.42 91.8291 140.448 92.5193 141.477 92.2683H141.67C141.743 92.2331 141.815 92.2177 141.898 92.1998C141.964 92.1858 142.036 92.1704 142.12 92.1429H142.635C143.792 92.1429 144.886 92.5821 145.657 93.3351C146.365 94.088 146.879 95.092 146.879 96.2215C146.879 97.4137 146.365 98.4176 145.657 99.1706C145.272 99.5471 144.757 99.8608 144.243 100.049C144.307 99.4843 144.371 98.8568 144.371 98.2294C144.371 97.2254 143.535 96.3469 142.442 96.3469C141.413 96.3469 140.513 97.2254 140.513 98.2294C140.513 99.4216 140.384 100.551 140.063 101.618C140.063 101.68 140.063 101.68 139.998 101.743C139.42 103.814 138.262 105.634 136.783 107.14C134.468 109.398 131.253 110.779 127.716 110.779H127.651H127.587C124.05 110.779 120.835 109.398 118.52 107.14C117.041 105.634 115.883 103.814 115.304 101.743C115.267 101.707 115.252 101.692 115.245 101.673C115.24 101.66 115.24 101.644 115.24 101.618C114.919 100.551 114.79 99.4216 114.79 98.2294C114.79 97.2254 113.89 96.3469 112.861 96.3469C111.768 96.3469 110.932 97.2254 110.932 98.2294C110.932 98.8568 110.996 99.4843 111.06 100.049C110.546 99.8608 110.031 99.5471 109.645 99.1706C108.874 98.4176 108.424 97.4137 108.424 96.2215C108.424 95.092 108.874 94.088 109.645 93.3351C109.678 93.3351 109.694 93.3194 109.71 93.3037C109.726 93.288 109.742 93.2723 109.774 93.2723C110.481 92.5821 111.51 92.1429 112.668 92.1429H113.182C113.247 92.1742 113.327 92.1899 113.407 92.2056L113.407 92.2056C113.488 92.2213 113.568 92.237 113.632 92.2683H113.825C114.854 92.5193 115.883 91.8291 116.076 90.8252L119.87 73.0676H119.935V73.0048L120.835 68.6752V68.6125L121.092 67.734C121.414 66.2281 122.25 65.0359 123.407 64.0947C124.565 63.2162 126.044 62.6515 127.651 62.6515C129.259 62.6515 130.738 63.2162 131.896 64.0947ZM139.098 72.253H139.162C139.741 74.8884 141.22 77.0845 143.214 78.716C145.207 80.2847 147.779 81.2259 150.545 81.2259H162.441C165.335 81.2259 167.972 80.1592 170.03 78.465C172.087 76.7708 173.567 74.3236 174.017 71.5627L175.496 62.5271V62.4643V62.2761V62.0879C175.496 61.3349 175.174 60.6447 174.66 60.1427C174.145 59.6407 173.438 59.327 172.666 59.327H139.87C139.034 59.327 138.326 59.6407 137.812 60.1427C137.297 60.6447 136.976 61.3349 136.976 62.0879C136.976 62.2134 136.976 62.3388 137.04 62.4016V62.5898V62.6526L138.198 67.8606V67.9234L139.098 72.253ZM117.105 67.9234L116.14 72.253C115.562 74.8884 114.083 77.0845 112.089 78.716C110.031 80.2847 107.523 81.2259 104.758 81.2259H92.8612C89.9674 81.2259 87.2665 80.1592 85.273 78.465C83.2151 76.7708 81.7361 74.3236 81.2859 71.5627L79.8069 62.5271V62.4643V62.2761V62.0879C79.8069 61.3349 80.1284 60.6447 80.6429 60.1427C81.1573 59.6407 81.8647 59.327 82.6364 59.327H115.433C116.269 59.327 116.976 59.6407 117.491 60.1427C118.005 60.6447 118.327 61.3349 118.327 62.0879C118.327 62.1614 118.305 62.2349 118.286 62.2958C118.273 62.3388 118.262 62.3756 118.262 62.4016V62.5898V62.6526L117.105 67.8606V67.9234Z" fill="#03A9F4"/> 1 <?xml version="1.0" encoding="UTF-8"?> 2 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> 3 <g id="surface1"> 4 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(16.078431%,66.27451%,96.470588%);fill-opacity:1;" d="M 0 0 C 7.921875 0 15.839844 0 24 0 C 24 7.921875 24 15.839844 24 24 C 16.078125 24 8.160156 24 0 24 C 0 16.078125 0 8.160156 0 0 Z M 0 0 "/> 5 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(99.607843%,99.607843%,99.607843%);fill-opacity:1;" d="M 11.785156 2.449219 C 11.824219 2.449219 11.863281 2.449219 11.902344 2.449219 C 13.980469 2.460938 15.949219 3.03125 17.628906 4.285156 C 17.679688 4.320312 17.726562 4.355469 17.777344 4.394531 C 19.78125 5.949219 21.035156 8.125 21.449219 10.617188 C 21.476562 10.832031 21.484375 11.046875 21.484375 11.261719 C 21.484375 11.304688 21.484375 11.347656 21.484375 11.390625 C 21.5 13.136719 21.5 13.136719 21.308594 13.949219 C 21.292969 14.023438 21.292969 14.023438 21.277344 14.09375 C 21.109375 14.816406 20.871094 15.484375 20.539062 16.144531 C 20.523438 16.183594 20.503906 16.21875 20.488281 16.257812 C 19.40625 18.457031 17.390625 20.15625 15.082031 20.953125 C 14.707031 21.074219 14.335938 21.175781 13.949219 21.253906 C 13.894531 21.265625 13.894531 21.265625 13.835938 21.277344 C 12.617188 21.539062 11.148438 21.5625 9.941406 21.253906 C 9.875 21.238281 9.875 21.238281 9.804688 21.222656 C 9.101562 21.046875 8.449219 20.804688 7.796875 20.484375 C 7.761719 20.46875 7.726562 20.449219 7.6875 20.429688 C 7.15625 20.167969 6.675781 19.855469 6.207031 19.496094 C 6.15625 19.457031 6.105469 19.421875 6.054688 19.382812 C 5.105469 18.636719 4.335938 17.738281 3.734375 16.695312 C 3.699219 16.632812 3.664062 16.574219 3.625 16.511719 C 3.183594 15.738281 2.867188 14.875 2.691406 14.003906 C 2.675781 13.9375 2.660156 13.871094 2.648438 13.804688 C 2.117188 11.3125 2.695312 8.769531 4.0625 6.644531 C 4.402344 6.148438 4.804688 5.707031 5.21875 5.273438 C 5.261719 5.226562 5.304688 5.179688 5.347656 5.132812 C 6.171875 4.265625 7.210938 3.664062 8.292969 3.183594 C 8.34375 3.160156 8.394531 3.136719 8.445312 3.113281 C 8.8125 2.945312 9.191406 2.839844 9.582031 2.734375 C 9.65625 2.714844 9.65625 2.714844 9.738281 2.695312 C 10.417969 2.519531 11.082031 2.449219 11.785156 2.449219 Z M 11.785156 2.449219 "/> 6 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(99.607843%,99.607843%,99.607843%);fill-opacity:1;" d="M 0 0 C 7.921875 0 15.839844 0 24 0 C 24 7.921875 24 15.839844 24 24 C 16.078125 24 8.160156 24 0 24 C 0 16.078125 0 8.160156 0 0 Z M 7.25 1.261719 C 7.175781 1.296875 7.101562 1.332031 7.027344 1.367188 C 5.402344 2.109375 3.898438 3.25 2.800781 4.667969 C 2.773438 4.703125 2.746094 4.738281 2.714844 4.777344 C 1.582031 6.257812 0.800781 7.945312 0.4375 9.777344 C 0.429688 9.816406 0.421875 9.855469 0.414062 9.898438 C -0.15625 12.789062 0.585938 15.996094 2.195312 18.433594 C 2.605469 19.03125 3.070312 19.578125 3.570312 20.101562 C 3.59375 20.128906 3.621094 20.15625 3.648438 20.183594 C 5.566406 22.203125 8.421875 23.539062 11.214844 23.625 C 14.738281 23.707031 17.746094 22.632812 20.320312 20.210938 C 20.355469 20.175781 20.394531 20.144531 20.429688 20.109375 C 22.554688 18.058594 23.675781 15.003906 23.746094 12.09375 C 23.757812 11.035156 23.644531 9.976562 23.339844 8.964844 C 23.285156 8.785156 23.238281 8.605469 23.195312 8.425781 C 22.34375 5.472656 20.101562 3.074219 17.464844 1.597656 C 17.195312 1.449219 16.921875 1.324219 16.640625 1.207031 C 16.601562 1.191406 16.558594 1.175781 16.515625 1.15625 C 15.820312 0.867188 15.125 0.664062 14.382812 0.519531 C 14.277344 0.496094 14.277344 0.496094 14.167969 0.4375 C 11.925781 -0.0195312 9.308594 0.242188 7.25 1.261719 Z M 7.25 1.261719 "/> 7 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(16.078431%,66.27451%,96.470588%);fill-opacity:1;" d="M 12.59375 5.707031 C 13.191406 6.070312 13.441406 6.636719 13.714844 7.246094 C 13.753906 7.328125 13.792969 7.414062 13.832031 7.496094 C 13.910156 7.664062 13.984375 7.832031 14.0625 8 C 14.183594 8.269531 14.304688 8.535156 14.429688 8.800781 C 14.507812 8.972656 14.589844 9.148438 14.667969 9.320312 C 14.832031 9.675781 15 10.035156 15.164062 10.390625 C 15.371094 10.832031 15.574219 11.277344 15.78125 11.71875 C 15.800781 11.765625 15.820312 11.808594 15.84375 11.855469 C 15.925781 12.039062 16.011719 12.222656 16.097656 12.40625 C 16.316406 12.878906 16.535156 13.351562 16.753906 13.824219 C 16.773438 13.863281 16.789062 13.902344 16.808594 13.9375 C 16.890625 14.113281 16.972656 14.285156 17.050781 14.457031 C 17.191406 14.753906 17.328125 15.050781 17.457031 15.347656 C 17.488281 15.425781 17.488281 15.425781 17.523438 15.503906 C 17.632812 15.820312 17.613281 16.121094 17.519531 16.441406 C 17.359375 16.648438 17.21875 16.773438 16.96875 16.859375 C 16.574219 16.910156 16.144531 16.933594 15.796875 16.714844 C 15.359375 16.351562 15.164062 15.773438 14.9375 15.269531 C 14.914062 15.210938 14.914062 15.210938 14.886719 15.152344 C 14.609375 14.53125 14.609375 14.53125 14.609375 14.335938 C 12.027344 14.359375 12.027344 14.359375 9.390625 14.390625 C 9.15625 14.933594 8.921875 15.476562 8.675781 16.035156 C 8.246094 16.757812 8.246094 16.757812 7.910156 16.859375 C 7.488281 16.90625 7.125 16.921875 6.753906 16.695312 C 6.523438 16.480469 6.414062 16.28125 6.402344 15.96875 C 6.40625 15.527344 6.582031 15.179688 6.773438 14.789062 C 6.808594 14.710938 6.847656 14.632812 6.882812 14.554688 C 6.964844 14.386719 7.042969 14.21875 7.125 14.050781 C 7.25 13.78125 7.378906 13.511719 7.5 13.242188 C 7.523438 13.195312 7.542969 13.148438 7.566406 13.101562 C 7.609375 13.007812 7.652344 12.914062 7.695312 12.820312 C 7.804688 12.582031 7.917969 12.34375 8.027344 12.105469 C 8.285156 11.550781 8.542969 10.992188 8.800781 10.433594 C 8.820312 10.390625 8.839844 10.347656 8.863281 10.300781 C 9.113281 9.753906 9.363281 9.207031 9.613281 8.660156 C 9.746094 8.367188 9.878906 8.074219 10.011719 7.78125 C 10.074219 7.648438 10.132812 7.519531 10.191406 7.386719 C 10.269531 7.210938 10.351562 7.039062 10.429688 6.863281 C 10.453125 6.816406 10.476562 6.765625 10.496094 6.714844 C 10.699219 6.285156 11.003906 5.828125 11.460938 5.632812 C 11.84375 5.535156 12.230469 5.546875 12.59375 5.707031 Z M 12.59375 5.707031 "/> 8 <path style=" stroke:none;fill-rule:nonzero;fill:rgb(98.431373%,99.215686%,99.607843%);fill-opacity:1;" d="M 11.917969 8.347656 C 11.953125 8.347656 11.988281 8.347656 12.027344 8.347656 C 12.191406 8.726562 12.355469 9.101562 12.515625 9.480469 C 12.570312 9.609375 12.628906 9.738281 12.683594 9.863281 C 12.707031 9.925781 12.734375 9.988281 12.761719 10.050781 C 12.789062 10.113281 12.816406 10.175781 12.84375 10.238281 C 12.921875 10.421875 13.003906 10.605469 13.082031 10.792969 C 13.183594 11.027344 13.285156 11.257812 13.386719 11.492188 C 13.421875 11.574219 13.421875 11.574219 13.457031 11.652344 C 13.5 11.753906 13.542969 11.851562 13.585938 11.953125 C 13.605469 11.996094 13.625 12.039062 13.644531 12.085938 C 13.660156 12.125 13.675781 12.160156 13.695312 12.199219 C 13.730469 12.300781 13.730469 12.300781 13.730469 12.46875 C 12.570312 12.46875 11.410156 12.46875 10.214844 12.46875 C 10.414062 11.867188 10.632812 11.292969 10.902344 10.722656 C 10.984375 10.546875 11.054688 10.367188 11.121094 10.1875 C 11.234375 9.882812 11.367188 9.589844 11.507812 9.296875 C 11.617188 9.050781 11.714844 8.796875 11.808594 8.539062 C 11.863281 8.402344 11.863281 8.402344 11.917969 8.347656 Z M 11.917969 8.347656 "/> 9 </g> 6 10 </svg> -
a-ads/trunk/A-ADS.php
r2461474 r3101097 8 8 * Plugin URI: https://a-ads.com 9 9 * Description: Simple advertising blocks integration. 10 * Version: 1.1.010 * Version: 2.0.1 11 11 * Requires at least: 5.2 12 12 * Requires PHP: 5.2 … … 40 40 defined('ABSPATH') or die("You can't access this file"); 41 41 42 //Include core.php43 require_once(plugin_dir_path(__FILE__).'/core.php' );44 45 42 //Include widget.php 46 43 require_once(plugin_dir_path(__FILE__).'/widget.php' ); 47 44 45 //Include block.php 46 require_once(plugin_dir_path(__FILE__).'/block.php' ); 47 48 //Plugin Core 49 class aads_core_functions 50 { 51 function __construct() { 52 add_action( 'widgets_init', array($this,'register_ads_widget')); 53 } 54 55 function activate() { 56 //Run on activation of plugin 57 flush_rewrite_rules(); 58 } 59 60 function deactivate() { 61 //Run on deactivation of plugin 62 //unregister_widget('ads_widget'); 63 flush_rewrite_rules(); 64 } 65 66 function uninstall() { 67 //Run on unstallation of plugin 68 flush_rewrite_rules(); 69 } 70 71 //Register wiget 72 function register_ads_widget() { 73 register_widget( 'aads_ads_widget' ); 74 } 75 76 //Add Extra Scripts 77 function extra_code() { 78 // 79 } 80 81 } 82 83 // Instantiate the class 84 if (class_exists('aads_core_functions')) { 85 $CoreFunctions = new aads_core_functions(); 86 87 //activation() hook 88 register_activation_hook( __FILE__, array($CoreFunctions, 'activate')); 89 90 //deactivate() hook 91 register_deactivation_hook( __FILE__, array($CoreFunctions, 'deactivate')); 92 } 93 //uninstall() hook 94 register_uninstall_hook( __FILE__, 'aads_uninstall_function'); 95 96 function aads_uninstall_function() { 97 $core_functions = new aads_core_functions(); 98 $core_functions->uninstall(); 99 } 100 48 101 ?> -
a-ads/trunk/readme.txt
r2746376 r3101097 3 3 Tags: ads, banner, widget 4 4 Requires at least: 3.5 5 Tested up to: 6. 0.06 Stable tag: 1.2.05 Tested up to: 6.5.3 6 Stable tag: 2.0.1 7 7 License: GPL v2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 12 12 == Description == 13 13 14 This plugin allows you to easily integrate https://a-ads.com/ banner advertisement into your website using WordPress widgets.14 This plugin allows you to easily integrate https://a-ads.com/ banner advertisement into your website using WordPress Blocks or legacy widgets. 15 15 It's as simple as drag and drop. 16 16 … … 46 46 = 1.2 = 47 47 * Minor bugs fixed 48 49 = 2.0.1 = 50 * Minor bugs fixed 51 52 **Features include:** 53 54 * Support for Block themes. 55 * Auto-get Ad Unit Size. -
a-ads/trunk/widget.php
r2457287 r3101097 1 1 <?php 2 3 //Simple security measure 4 defined('ABSPATH') or die("You can't access this file"); 2 5 /* 3 6 … … 42 45 43 46 // Widget Output 44 //Set width and height dynamically for ad units 45 if ($instance['ad_unit_size'] == '120x60') { 46 $width = "120px" ; 47 $height = "60px"; 48 } 49 50 if ($instance['ad_unit_size'] == '120x600') { 51 $width = "120px" ; 52 $height = "600px"; 53 } 54 55 if ($instance['ad_unit_size'] == '125x125') { 56 $width = "125px" ; 57 $height = "125px"; 58 } 59 60 if ($instance['ad_unit_size'] == '160x600') { 61 $width = "160px" ; 62 $height = "600px"; 63 } 64 65 if ($instance['ad_unit_size'] == '200x200') { 66 $width = "200px" ; 67 $height = "200px"; 68 } 69 70 if ($instance['ad_unit_size'] == '240x400') { 71 $width = "240px" ; 72 $height = "400px"; 73 } 74 75 if ($instance['ad_unit_size'] == '250x250') { 76 $width = "250px" ; 77 $height = "250px"; 78 } 79 80 if ($instance['ad_unit_size'] == '300x250') { 81 $width = "300px" ; 82 $height = "250px"; 83 } 84 85 if ($instance['ad_unit_size'] == '300x600') { 86 $width = "300px" ; 87 $height = "600px"; 88 } 89 90 if ($instance['ad_unit_size'] == '320x50') { 91 $width = "320px" ; 92 $height = "50px"; 93 } 94 95 if ($instance['ad_unit_size'] == '320x100') { 96 $width = "320px" ; 97 $height = "100px"; 98 } 99 100 if ($instance['ad_unit_size'] == '336x280') { 101 $width = "336px" ; 102 $height = "280px"; 103 } 104 105 if ($instance['ad_unit_size'] == '468x60') { 106 $width = "468px" ; 107 $height = "60px"; 108 } 109 110 if ($instance['ad_unit_size'] == '728x90') { 111 $width = "728px" ; 112 $height = "90px"; 113 } 114 115 if ($instance['ad_unit_size'] == '970x90') { 116 $width = "970px" ; 117 $height = "90px"; 118 } 119 120 if ($instance['ad_unit_size'] == '970x250') { 121 $width = "970px" ; 122 $height = "250px"; 123 } 47 // Define ad unit sizes and their corresponding width and height 48 $ad_sizes = array( 49 '120x60' => array('width' => '120px', 'height' => '60px'), 50 '120x600' => array('width' => '120px', 'height' => '600px'), 51 '125x125' => array('width' => '125px', 'height' => '125px'), 52 '160x600' => array('width' => '160px', 'height' => '600px'), 53 '200x200' => array('width' => '200px', 'height' => '200px'), 54 '240x400' => array('width' => '240px', 'height' => '400px'), 55 '250x250' => array('width' => '250px', 'height' => '250px'), 56 '300x250' => array('width' => '300px', 'height' => '250px'), 57 '300x600' => array('width' => '300px', 'height' => '600px'), 58 '320x50' => array('width' => '320px', 'height' => '50px'), 59 '320x100' => array('width' => '320px', 'height' => '100px'), 60 '336x280' => array('width' => '336px', 'height' => '280px'), 61 '468x60' => array('width' => '468px', 'height' => '60px'), 62 '728x90' => array('width' => '728px', 'height' => '90px'), 63 '970x90' => array('width' => '970px', 'height' => '90px'), 64 '970x250' => array('width' => '970px', 'height' => '250px') 65 ); 66 67 // Set width and height based on ad unit size 68 if (isset($ad_sizes[$instance['ad_unit_size']])) { 69 $width = $ad_sizes[$instance['ad_unit_size']]['width']; 70 $height = $ad_sizes[$instance['ad_unit_size']]['height']; 71 } else { 72 // Default width and height if ad unit size is not found 73 $width = "100px"; 74 $height = "100px"; 75 } 124 76 125 77 … … 157 109 } 158 110 159 /** 160 * Back-end widget form. 161 * 162 * @see WP_Widget::form() 163 * 164 * @param array $instance Previously saved values from database. 165 */ 166 public function form( $instance ) { 167 // 168 if ( isset( $instance[ 'title' ] ) ) { 169 $title = $instance[ 'title' ]; 170 } 171 else { 172 $title = __( 'A-ADS', 'ads_domain' ); 173 } 111 112 /** 113 * Back-end widget form. 114 * 115 * @see WP_Widget::form() 116 * 117 * @param array $instance Previously saved values from database. 118 */ 119 public function form( $instance ) { 120 if ( isset( $instance['title'] ) ) { 121 $title = $instance['title']; 122 } else { 123 $title = __( 'A-ADS', 'ads_domain' ); 124 } 125 126 // If $instance['ad_unit_ID'] is set 127 if ( isset( $instance['ad_unit_ID'] ) ) { 128 $ad_unit_ID = $instance['ad_unit_ID']; 129 } else { 130 $ad_unit_ID = 1; // Default ad unit ID 131 } 132 133 // If $instance['ad_unit_size'] is set 134 if ( isset( $instance['ad_unit_size'] ) ) { 135 $ad_unit_size = $instance['ad_unit_size']; 136 } else { 137 $ad_unit_size = 'Adaptive'; // Default ad unit size 138 } 139 /* 140 // Make API request to get ad unit details 141 $api_response = wp_remote_get( 'https://a-ads.com/api/v1/ad_units/' . $ad_unit_ID ); 142 143 // Check if API request was successful 144 if ( ! is_wp_error( $api_response ) && wp_remote_retrieve_response_code( $api_response ) === 200 ) { 145 $api_data = json_decode( wp_remote_retrieve_body( $api_response ), true ); 174 146 175 176 //If $instance['ad_unit_ID'] is set 177 if ( isset( $instance[ 'ad_unit_ID' ] ) ) { 178 $ad_unit_ID = $instance[ 'ad_unit_ID' ]; 179 } 180 else { 181 $ad_unit_ID = __( 1, 'ads_domain' ); 182 } 183 184 // 185 if ( isset( $instance[ 'ad_unit_size' ] ) ) { 186 $ad_unit_size = $instance[ 'ad_unit_size' ]; 187 } 188 else { 189 $ad_unit_size = __( 'default', 'ads_domain' ); 190 } 191 ?> 192 193 <p> 194 <label 195 for="<?php echo $this->get_field_name( 'title' ); ?>"> 147 // Extract size from API response 148 if ( isset( $api_data['data']['attributes']['size'] ) ) { 149 $ad_unit_size = $api_data['data']['attributes']['size']; 150 } else { 151 $ad_unit_size = 'default'; // Default size if not found in API response 152 } 153 } else { 154 $ad_unit_size = 'default'; // Default size if API request fails 155 } 156 */ 157 ?> 158 159 <p> 160 <label for="<?php echo $this->get_field_name( 'title' ); ?>"> 196 161 <?php _e( 'Title:' ); ?> 197 </label> 198 199 <input 200 class="widefat" 201 id="<?php echo $this->get_field_id( 'title' ); ?>" 202 name="<?php echo $this->get_field_name( 'title' ); ?>" 203 type="text" 204 value="<?php echo esc_attr( $title ); ?>" /> 205 </p> 206 207 <p> 208 <label 209 for="<?php echo $this->get_field_name( 'ad_unit_ID' ); ?>"> 162 </label> 163 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> 164 </p> 165 166 <p> 167 <label for="<?php echo $this->get_field_name( 'ad_unit_ID' ); ?>"> 210 168 <?php _e( 'Ad Unit ID:' ); ?> 211 </label> 212 213 <input 214 class="widefat" 215 id="<?php echo $this->get_field_id( 'ad_unit_ID' ); ?>" 216 name="<?php echo $this->get_field_name( 'ad_unit_ID' ); ?>" 217 type="number" 218 value="<?php echo ( $ad_unit_ID ); ?>" /> 219 </p> 220 221 <p> 222 <label 223 for="<?php echo $this->get_field_name( 'ad_unit_size' ); ?>"> 224 <?php _e( 'Ad Unit Size:' ); ?> 225 </label> 226 227 <select 228 class="widefat" 229 id="<?php echo $this->get_field_id( 'ad_unit_size' ); ?>" 230 name="<?php echo $this->get_field_name( 'ad_unit_size' ); ?>"> 231 <option value = "adaptive" <?php echo($ad_unit_size == 'adaptive') ? 'selected' : ''; ?>> 232 Adaptive 233 </option> 234 235 <option value = "120x60" <?php echo($ad_unit_size == '120x60') ? 'selected' : ''; ?>> 236 120x60 237 </option> 238 239 <option value = "120x600" <?php echo($ad_unit_size == '120x600') ? 'selected' : ''; ?>> 240 120x600 241 </option> 242 243 <option value = "125x125" <?php echo($ad_unit_size == '125x125') ? 'selected' : ''; ?>> 244 125x125 245 </option> 246 247 <option value = "160x600" <?php echo($ad_unit_size == '160x600') ? 'selected' : ''; ?>> 248 160x600 249 </option> 250 251 <option value = "200x200" <?php echo($ad_unit_size == '200x200') ? 'selected' : ''; ?>> 252 200x200 253 </option> 254 255 <option value = "240x400" <?php echo($ad_unit_size == '240x400') ? 'selected' : ''; ?>> 256 240x400 257 </option> 258 259 <option value = "250x250" <?php echo($ad_unit_size == '250x250') ? 'selected' : ''; ?>> 260 250x250 261 </option> 262 263 <option value = "300x250" <?php echo($ad_unit_size == '300x250') ? 'selected' : ''; ?>> 264 300x250 265 </option> 266 267 <option value = "300x600" <?php echo($ad_unit_size == '300x600') ? 'selected' : ''; ?>> 268 300x600 269 </option> 270 271 <option value = "320x50" <?php echo($ad_unit_size == '320x50') ? 'selected' : ''; ?>> 272 320x50 273 </option> 274 275 <option value = "320x100" <?php echo($ad_unit_size == '320x100') ? 'selected' : ''; ?>> 276 320x100 277 </option> 278 279 <option value = "336x280" <?php echo($ad_unit_size == '336x280') ? 'selected' : ''; ?>> 280 336x280 281 </option> 282 283 <option value = "468x60" <?php echo($ad_unit_size == '468x60') ? 'selected' : ''; ?>> 284 468x60 285 </option> 286 287 <option value = "728x90" <?php echo($ad_unit_size == '728x90') ? 'selected' : ''; ?>> 288 728x90 289 </option> 290 291 <option value = "970x90" <?php echo($ad_unit_size == '970x90') ? 'selected' : ''; ?>> 292 970x90 293 </option> 294 295 <option value = "970x250" <?php echo($ad_unit_size == '970x250') ? 'selected' : ''; ?>> 296 970x250 297 </option> 298 299 300 </select> 301 </p> 169 </label> 170 <input class="widefat" id="<?php echo $this->get_field_id( 'ad_unit_ID' ); ?>" name="<?php echo $this->get_field_name( 'ad_unit_ID' ); ?>" type="number" value="<?php echo esc_attr( $ad_unit_ID ); ?>" /> 171 </p> 172 173 <input type="hidden" name="<?php echo $this->get_field_name( 'ad_unit_size' ); ?>" value="<?php echo esc_attr( $ad_unit_size ); ?>" /> 174 302 175 303 176 <?php … … 318 191 $instance['title'] = ( !empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; 319 192 $instance['ad_unit_ID'] = ( !empty( $new_instance['ad_unit_ID'] ) ) ? strip_tags( $new_instance['ad_unit_ID'] ) : ''; 320 $instance['ad_unit_size'] = ( !empty( $new_instance['ad_unit_size'] ) ) ? strip_tags( $new_instance['ad_unit_size'] ) : ''; 321 return $instance; 322 } 193 194 // Make API request to get ad unit details 195 $api_response = wp_remote_get( 'https://a-ads.com/api/v1/ad_units/' . $instance['ad_unit_ID'] ); 196 197 // Check if API request was successful 198 if ( ! is_wp_error( $api_response ) && wp_remote_retrieve_response_code( $api_response ) === 200 ) { 199 $api_data = json_decode( wp_remote_retrieve_body( $api_response ), true ); 200 201 if (isset($api_data['data']['attributes']['size'])) { 202 $instance['ad_unit_size'] = $api_data['data']['attributes']['size']; 203 } else { 204 // Handle case where the key doesn't exist in the API response 205 } 206 207 } else { 208 // Handle API request error 209 // For example: 210 // $instance['ad_unit_size'] = 'Error: API request failed'; 211 } 212 213 return $instance; // Return the updated instance array 214 } 215 323 216 324 217
Note: See TracChangeset
for help on using the changeset viewer.