cost-calculator-for-elementor
Last commit date
fields
2 years ago
free
2 years ago
languages
2 years ago
libs
2 years ago
superaddons
2 years ago
add-ons.php
2 years ago
cost-calculator-for-elementor.php
2 years ago
readme.txt
2 years ago
add-ons.php
362 lines
| 1 | <?php |
| 2 | if ( !function_exists( 'add_action' ) ) { |
| 3 | echo 'Hi there! I\'m just a plugin, not much I can do when called directly.'; |
| 4 | exit; |
| 5 | } |
| 6 | class Superaddons_List_Addons { |
| 7 | function __construct(){ |
| 8 | add_action('admin_menu', array($this,"add_menu"),9999); |
| 9 | add_action('admin_head', array($this,"admin_head")); |
| 10 | add_filter( "fluentform_global_addons", array($this,"fluentform_global_addons") ); |
| 11 | if(isset($_GET["page"]) && $_GET["page"] == "ninja-forms") { |
| 12 | add_action('admin_init', array($this,"add_ninja_form")); |
| 13 | } |
| 14 | } |
| 15 | function add_menu(){ |
| 16 | add_submenu_page( "wpcf7","contact-form-7 addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "contact-form-7-addons", array( $this, 'page_addons_cf7' ), 999 ); |
| 17 | add_submenu_page( "elementor","elementor form addons", "<span style='color:#f18500'>Forms Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>15</span></span>", "manage_options", "elementor-forms-addons", array( $this, 'page_addons_elementor' ), 999 ); |
| 18 | add_submenu_page( "fluent_forms", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "fluent_forms-addons", array( $this, 'page_addons_fluent_forms' ) ); |
| 19 | add_submenu_page( "formidable", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "formidable-addons", array( $this, 'page_addons_formidable' ),999 ); |
| 20 | add_submenu_page( "quform.dashboard", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>36</span></span>", "manage_options", "quform.dashboard-addons", array( $this, 'page_addons_quform' ),999 ); |
| 21 | add_submenu_page( "wpforms-overview", "addons", "<span style='color:#f18500'>Add-ons </span><span class='update-plugins count-1'><span class='plugin-count'>9</span></span>", "manage_options", "wpforms.dashboard-addons", array( $this, 'page_addons_wpforms' ),999 ); |
| 22 | add_filter("http_response",array($this,"http_response_eform"),10,3); |
| 23 | } |
| 24 | function page_addons_cf7(){ |
| 25 | $this->page_addons("cf7"); |
| 26 | } |
| 27 | function page_addons_elementor(){ |
| 28 | $this->page_addons("elementor"); |
| 29 | } |
| 30 | function page_addons_fluent_forms(){ |
| 31 | $this->page_addons("fluent_forms"); |
| 32 | } |
| 33 | function page_addons_formidable(){ |
| 34 | $this->page_addons("formidable"); |
| 35 | } |
| 36 | function page_addons_quform(){ |
| 37 | $this->page_addons("quform"); |
| 38 | } |
| 39 | function page_addons_wpforms(){ |
| 40 | $this->page_addons("wpforms"); |
| 41 | } |
| 42 | function admin_head(){ |
| 43 | ?> |
| 44 | <style type="text/css"> |
| 45 | .pro_disable::after { |
| 46 | content: "Pro"; |
| 47 | position: absolute; |
| 48 | bottom: 0; |
| 49 | right: 0; |
| 50 | background: red; |
| 51 | padding: 3px; |
| 52 | font-size: 11px; |
| 53 | color: #fff; |
| 54 | border-radius: 5px 0 0 0; |
| 55 | } |
| 56 | .pro_disable { |
| 57 | position: relative; |
| 58 | } |
| 59 | .pro_disable_padding{ |
| 60 | padding: 10px !important; |
| 61 | } |
| 62 | .pro_text_style{ |
| 63 | color:#9f9e9e; |
| 64 | } |
| 65 | body .pro_disable_fff { |
| 66 | background: transparent; |
| 67 | } |
| 68 | .cf7-container-bundle { |
| 69 | border: 1px solid #e7e7e7; |
| 70 | padding: 10px; |
| 71 | text-align: center; |
| 72 | background: #fff; |
| 73 | border-radius: 5px; |
| 74 | } |
| 75 | .cf7-container-bundle-h { |
| 76 | font-size: 30px; |
| 77 | font-weight: bold; |
| 78 | text-align: center; |
| 79 | } |
| 80 | .cf7-container-bundle-h p{ |
| 81 | font-size: 30px; |
| 82 | font-weight: bold; |
| 83 | padding: 0; |
| 84 | margin: 0; |
| 85 | } |
| 86 | .list-addons-container { |
| 87 | display: flex; |
| 88 | flex-flow: row wrap; |
| 89 | padding: 10px; |
| 90 | } |
| 91 | .add-ons-box { |
| 92 | margin: 0 0 20px; |
| 93 | width: 400px; |
| 94 | position: relative; |
| 95 | margin-right: 30px; |
| 96 | border: 1px solid #f7f7f7; |
| 97 | padding: 14px; |
| 98 | background: #fff; |
| 99 | border-radius: 10px; |
| 100 | } |
| 101 | .add-ons-box-actions-button-live { |
| 102 | border: 0; |
| 103 | border-radius: 4px; |
| 104 | cursor: pointer; |
| 105 | display: inline-block; |
| 106 | font-size: 17px; |
| 107 | padding: 10px 30px; |
| 108 | text-align: center; |
| 109 | text-decoration: none; |
| 110 | text-transform: uppercase; |
| 111 | -webkit-appearance: none; |
| 112 | -moz-appearance: none; |
| 113 | appearance: none; |
| 114 | background: #fff; |
| 115 | border: 1px solid #1ea9ea; |
| 116 | color: #1ea9ea; |
| 117 | margin-right:50px; |
| 118 | } |
| 119 | .add-ons-box-actions-button-download { |
| 120 | border: 0; |
| 121 | border-radius: 4px; |
| 122 | cursor: pointer; |
| 123 | display: inline-block; |
| 124 | font-size: 17px; |
| 125 | padding: 10px 30px; |
| 126 | text-align: center; |
| 127 | text-decoration: none; |
| 128 | text-transform: uppercase; |
| 129 | -webkit-appearance: none; |
| 130 | -moz-appearance: none; |
| 131 | appearance: none; |
| 132 | background: #fff; |
| 133 | border: 1px solid #1ea9ea; |
| 134 | color: #1ea9ea; |
| 135 | background: #1ea9ea; |
| 136 | border: 1px solid #1ea9ea; |
| 137 | color: #fff; |
| 138 | } |
| 139 | .add-ons-box-actions { |
| 140 | text-align:center; |
| 141 | } |
| 142 | .add-ons-box-actions a:hover { |
| 143 | opacity: 0.8; |
| 144 | } |
| 145 | </style> |
| 146 | <?php |
| 147 | } |
| 148 | function fluentform_global_addons($add_ons_ok ){ |
| 149 | $datas = $this->get_addons(); |
| 150 | $add_ons = array(); |
| 151 | foreach( $datas as $k=> $data ){ |
| 152 | $add_ons[$k] = array( |
| 153 | "logo"=>$data["img"], |
| 154 | "url"=>$data["download"], |
| 155 | "title"=>$data["name"], |
| 156 | "description"=>$data["des"], |
| 157 | "purchase_url"=>$data["download"], |
| 158 | "category"=>"a", |
| 159 | ); |
| 160 | } |
| 161 | return array_merge($add_ons,$add_ons_ok); |
| 162 | } |
| 163 | function add_ninja_form(){ |
| 164 | $saved = get_option( 'ninja_forms_addons_feed', false ); |
| 165 | $datas = $this->get_addons("ninja_forms"); |
| 166 | $add_ons = array(); |
| 167 | foreach( $datas as $k=> $data ){ |
| 168 | $add_ons[] = array( |
| 169 | "image"=>$data["img"], |
| 170 | "url"=>$data["download"], |
| 171 | "title"=>$data["name"], |
| 172 | "content"=>$data["des"], |
| 173 | "link"=>$data["download"], |
| 174 | "plugin"=>"a", |
| 175 | "version"=>"3.0.1", |
| 176 | "categories" => array( |
| 177 | array( |
| 178 | "name"=>"Look & Feel", |
| 179 | "slug"=>"form-function-design" |
| 180 | ) |
| 181 | ) |
| 182 | ); |
| 183 | } |
| 184 | update_option("ninja_forms_addons_feed", json_encode($add_ons)); |
| 185 | } |
| 186 | function http_response_eform($response,$datas,$url){ |
| 187 | $add_ons = array(); |
| 188 | switch ($url) { |
| 189 | case "https://wpquark.com/wp-json/ipt-api/v1/fsqm/": |
| 190 | // eforms |
| 191 | $datas = $this->get_addons("eforms"); |
| 192 | foreach( $datas as $data ){ |
| 193 | $add_ons[] = array( |
| 194 | "image"=>$data["img"], |
| 195 | "url"=>$data["download"], |
| 196 | "name"=>$data["name"], |
| 197 | "description"=>$data["des"], |
| 198 | "author"=>"rednumber", |
| 199 | "authorurl"=>"https://add-ons.org", |
| 200 | "class"=>"", |
| 201 | "star"=>5, |
| 202 | "starnum"=>rand(10,100), |
| 203 | "downloaded"=>rand(100,1000), |
| 204 | "version"=>"2.".rand(10,100), |
| 205 | "compatible"=>"4.0", |
| 206 | "date"=> date("Y-m-d h:i:sa") |
| 207 | ); |
| 208 | $datas_rs = json_decode($response['body'],true); |
| 209 | $add_on=$datas_rs["addons"]; |
| 210 | $datas_rs["addons"] = array_merge($add_ons,$add_on); |
| 211 | $response["body"] = json_encode($datas_rs); |
| 212 | } |
| 213 | break; |
| 214 | case "https://gravityapi.com/wp-content/plugins/gravitymanager/api.php?op=plugin_browser&page=gf_addons": |
| 215 | // gravity form |
| 216 | ob_start(); |
| 217 | ?> |
| 218 | <h1><?php esc_html_e("Improve your forms with our premium addons.","rednumber") ?></h1> |
| 219 | <div class="list-addons-container"> |
| 220 | <?php |
| 221 | $datas = $this->get_addons("gravity"); |
| 222 | foreach ($datas as $data) { |
| 223 | ?> |
| 224 | <div class="add-ons-box"> |
| 225 | <img src="<?php echo esc_attr($data["img"]) ?>"> |
| 226 | <h3><?php echo esc_attr($data["name"]) ?></h3> |
| 227 | <div class="add-ons-box-content"> |
| 228 | <p><?php echo esc_attr($data["des"]) ?></p> |
| 229 | <div class="add-ons-box-actions"> |
| 230 | <a href="<?php echo esc_attr($data["demo"]) ?>" target="_blank" class="add-ons-box-actions-button-live"><?php esc_html_e("Live Demo") ?></a> |
| 231 | <?php |
| 232 | if( wp_http_validate_url($data["download"])){ |
| 233 | $dl = $data["download"]; |
| 234 | }else{ |
| 235 | $dl = "https://".$data["download"]; |
| 236 | } |
| 237 | ?> |
| 238 | <a href="<?php echo esc_attr($dl) ?>" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Download") ?></a> |
| 239 | </div> |
| 240 | </div> |
| 241 | </div> |
| 242 | <?php } ?> |
| 243 | </div> |
| 244 | <?php |
| 245 | $html= ob_get_clean(); |
| 246 | $response["body"] = $html . $response["body"]; |
| 247 | break; |
| 248 | case "http://api.ninjaforms.com/feeds/?fetch=addons": |
| 249 | $datas = $this->get_addons("ninja_forms"); |
| 250 | $add_ons = array(); |
| 251 | foreach( $datas as $k=> $data ){ |
| 252 | $add_ons[] = array( |
| 253 | "image"=>$data["img"], |
| 254 | "url"=>$data["download"], |
| 255 | "title"=>$data["name"], |
| 256 | "content"=>$data["des"], |
| 257 | "link"=>$data["download"], |
| 258 | "plugin"=>"a", |
| 259 | "version"=>"3.0.1", |
| 260 | "categories" => array( |
| 261 | array( |
| 262 | "name"=>"Look & Feel", |
| 263 | "slug"=>"form-function-design" |
| 264 | ) |
| 265 | ) |
| 266 | ); |
| 267 | } |
| 268 | $add_on = json_decode($response['body'],true); |
| 269 | $response["body"] = json_encode( array_merge($add_ons,$add_on) ); |
| 270 | break; |
| 271 | default: |
| 272 | // code... |
| 273 | break; |
| 274 | } |
| 275 | return $response; |
| 276 | } |
| 277 | function page_addons($addon=""){ |
| 278 | ?> |
| 279 | <div class="wrap"> |
| 280 | <h2><?php esc_html_e("Improve your forms with our premium addons.","rednumber") ?></h2> |
| 281 | <p></p> |
| 282 | <?php |
| 283 | switch($addon){ |
| 284 | case "cf7": |
| 285 | ?> |
| 286 | <div class="cf7-container-bundle"> |
| 287 | <div class="cf7-container-bundle-h"><p>Having a tough time choosing just a few? </p> |
| 288 | <p>Bundle and save big with $59</p></div> |
| 289 | <p>This is a special pack including all add-on for contact form 7 issued by us and every released add-on! |
| 290 | </p> |
| 291 | <h3>Save up to 95%</h3> |
| 292 | <p>In fact, purchasing every item singularly you would spend at least $891. Bundle Price – Only $59</p> |
| 293 | <a href="https://add-ons.org/plugin/contact-form-7-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download">Get Now</a> |
| 294 | </div> |
| 295 | <?php |
| 296 | break; |
| 297 | case "wpforms": |
| 298 | ?> |
| 299 | <div class="cf7-container-bundle"> |
| 300 | <div class="cf7-container-bundle-h"><p>Having a tough time choosing just a few? </p> |
| 301 | <p>Bundle and save big with $49</p></div> |
| 302 | <p>This is a special pack including all add-on for WPForms issued by us and every released add-on! |
| 303 | </p> |
| 304 | <h3>Save up to 80%</h3> |
| 305 | <p>In fact, purchasing every item singularly you would spend at least $250. Bundle Price – Only $49</p> |
| 306 | <a href="https://add-ons.org/plugin/wpforms-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download">Get Now</a> |
| 307 | </div> |
| 308 | <?php |
| 309 | break; |
| 310 | case "elementor": |
| 311 | ?> |
| 312 | <div class="cf7-container-bundle"> |
| 313 | <div class="cf7-container-bundle-h"><p>Having a tough time choosing just a few? </p> |
| 314 | <p>Bundle and save big with $49</p></div> |
| 315 | <p>This is a special pack including all add-on for Elementor Forms issued by us and every released add-on! |
| 316 | </p> |
| 317 | <h3>Save up to 85%</h3> |
| 318 | <p>In fact, purchasing every item singularly you would spend at least $350. Bundle Price – Only $49</p> |
| 319 | <a href="https://add-ons.org/plugin/elementor-forms-add-on-bundle-all-in-one/" target="_blank" class="add-ons-box-actions-button-download">Get Now</a> |
| 320 | </div> |
| 321 | <?php |
| 322 | break; |
| 323 | } |
| 324 | ?> |
| 325 | <div class="list-addons-container"> |
| 326 | <?php |
| 327 | $datas = $this->get_addons($addon); |
| 328 | foreach ($datas as $data) { |
| 329 | ?> |
| 330 | <div class="add-ons-box"> |
| 331 | <img src="<?php echo esc_attr($data["img"]) ?>"> |
| 332 | <h3><?php echo esc_attr($data["name"]) ?></h3> |
| 333 | <div class="add-ons-box-content"> |
| 334 | <p><?php echo esc_attr($data["des"]) ?></p> |
| 335 | <div class="add-ons-box-actions"> |
| 336 | <a href="<?php echo esc_attr($data["demo"]) ?>" target="_blank" class="add-ons-box-actions-button-live"><?php esc_html_e("Live Demo") ?></a> |
| 337 | <?php |
| 338 | if( wp_http_validate_url($data["download"])){ |
| 339 | $dl = $data["download"]; |
| 340 | }else{ |
| 341 | $dl = "https://".$data["download"]; |
| 342 | } |
| 343 | ?> |
| 344 | <a href="<?php echo esc_attr($dl) ?>" target="_blank" class="add-ons-box-actions-button-download"><?php esc_html_e("Download") ?></a> |
| 345 | </div> |
| 346 | </div> |
| 347 | </div> |
| 348 | <?php } ?> |
| 349 | </div> |
| 350 | <?php |
| 351 | } |
| 352 | function get_addons($add_on=null){ |
| 353 | if( isset($add_on) ){ |
| 354 | $rs = wp_remote_get("https://cdn.add-ons.org/plugins.php?type=".$add_on); |
| 355 | }else{ |
| 356 | $rs = wp_remote_get("https://cdn.add-ons.org/plugins.php"); |
| 357 | } |
| 358 | return json_decode($rs['body'],true); |
| 359 | } |
| 360 | } |
| 361 | new Superaddons_List_Addons; |
| 362 |