Changeset 1489651
- Timestamp:
- 09/04/2016 07:44:05 AM (10 years ago)
- Location:
- sepa-girocode
- Files:
-
- 1 added
- 2 edited
-
assets/screenshot-2.png (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/sepa-girocode.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sepa-girocode/trunk/readme.txt
r1484707 r1489651 22 22 Just use the shortcode [girocode] in any page or post you want to display a girocode. 23 23 24 = And how to show the girocode generator form? = 25 26 Just use the shortcode [girocode-generator]. 27 24 28 = Which parameters are available? = 25 29 30 For [girocode]: 26 31 * iban: International Bank Account Number of the beneficiary 27 32 * bic: Bank Identifier Code, facultative for participants of the European Economic Area … … 35 40 * dimension: Width (and also height) of the code in pixels (standard = 150) 36 41 * divclass: Optional CSS-class for wrapping div-element 42 43 For [girocode-generator]: 44 There are currently now parameters available. 37 45 38 46 = Come on, show me an example ... = … … 50 58 1. Some example Girocodes 51 59 60 2. Girocode generator form 61 52 62 == Changelog == 63 = 0.5 (2016-09-04) = 64 * Added girocode-generator form 65 53 66 = 0.4.4 (2016-08-27) = 54 67 * Fixed transient lifetime -
sepa-girocode/trunk/sepa-girocode.php
r1484703 r1489651 9 9 Plugin URI: http://www.halli-online.de/sepa-girocode/ 10 10 Description: Create EPC-Codes (in Germany known as Girocode) for money transfer | Girocode-Barcode für SEPA-Überweisungen erstellen 11 Version: 0. 4.411 Version: 0.5 12 12 Author: Michael Hallmann 13 13 Author URI: http://www.halli-online.de/ … … 45 45 $this->data['dimension'] = 150; 46 46 $this->data['frame'] = 1; 47 $this->data['divclass'] = ""; 47 $this->data['divclass'] = ""; // deprecated 48 $this->data['style'] = ''; 49 $this->data['class'] = ''; 50 $this->data['alt'] = ''; 51 $this->data['title'] = ''; 48 52 49 53 } … … 225 229 } 226 230 227 public function getQr Div() {231 public function getQrImgTag() { 228 232 $key = $this->getTransientKey(); 229 233 $img_src = "index.php?sepa-girocode=show-code&key=" . $key; 230 234 $click_url = "index.php?sepa-girocode=get-codefile&key=" . $key; 231 235 $width_height = $this->dimension; 232 $output = ""; 233 $a = ""; 234 $ae = ""; 236 235 237 236 238 if ($this->isclickable == 1) { 237 $a = "<a href='$click_url' target='_blank'>"; 238 $ae = "</a>"; 239 } 240 241 242 if (strlen($this->divclass) == 0) { 243 $output .= "<div>"; 239 $a = "<a href=\"$click_url\" target=\"_blank\">"; 240 $ae = "</a>"; 244 241 } else { 245 $output .= "<div class='" . $this->divclass . "'>"; 246 } 247 248 $output .= "$a<img src='$img_src' width='$width_height' height='$width_height'></img>$ae</div>"; 242 $a = ""; 243 $ae = ""; 244 } 245 246 $output = "<img src=\"$img_src\" width=\"$width_height\" height=\"$width_height\""; 247 248 if (strlen($this->class) > 0) { 249 $output .= " class=\"" . $this->class . "\""; 250 } 251 252 if (strlen($this->title) > 0) { 253 $output .= " title=\"" . $this->title . "\""; 254 } 255 256 if (strlen($this->alt) > 0) { 257 $output .= " alt=\"" . $this->alt . "\""; 258 } 259 260 if (strlen($this->style) > 0) { 261 $output .= " style=\"" . $this->style . "\""; 262 } 263 264 $output = $a . $output . "/>" . $ae; 249 265 250 266 return $output; … … 267 283 } 268 284 269 285 function sepa_girocode_update() { 286 global $wpdb; 287 // delete all transients 288 $result = $wpdb->get_results("SELECT * FROM $wpdb->options WHERE option_name LIKE '_transient_sgc_%'"); 289 foreach ($result as $transient) { 290 delete_transient(trim(substr($transient->option_name, 11, 999))); 291 } 292 } 270 293 271 294 … … 291 314 } 292 315 293 return $sgc->getQr Div();316 return $sgc->getQrImgTag(); 294 317 } 295 318 … … 336 359 337 360 361 // Generator 362 function sepa_girocode_shortcode_generator( $atts ) { 363 364 $output = ""; 365 366 if ( isset( $_POST['gcf-submitted'] ) ) { 367 368 $sgc = new sepa_girocode_class(); 369 $sgc->beneficiary = sanitize_text_field( $_POST["gcf-beneficiary"] ); 370 $sgc->iban = sanitize_text_field( $_POST["gcf-iban"] ); 371 $sgc->bic = sanitize_text_field( $_POST["gcf-bic"] ); 372 $sgc->amount = sanitize_text_field( $_POST["gcf-amount"] ); 373 $sgc->purpose = sanitize_text_field( $_POST["gcf-purpose"] ); 374 $sgc->purposecode = sanitize_text_field( $_POST["gcf-purposecode"] ); 375 $sgc->isclickable = 0; 376 $sgc->dimension = 300; 377 378 // $to = get_option( 'admin_email' ); 379 380 $key = $sgc->getTransientKey(); 381 382 if ( false === ( $value = get_transient($key) ) ) { 383 $tmp = set_transient($key, 384 $sgc, 385 HOUR_IN_SECONDS); 386 if (!$tmp) die ("Konnte Transient nicht setzen! KEY = " . $key); 387 } 388 389 $output .= '<div style="float:right;width=300px;"><p>' . $sgc->getQrImgTag() . '</p></div>'; 390 391 392 } 393 394 395 396 //$sgc = new sepa_girocode_class(); 397 398 $output .= '<form action="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" method="post">'; 399 400 $output .= '<p>'; 401 $output .= 'Zahlungsempfänger*<br />'; 402 $output .= '<input type="text" name="gcf-beneficiary" title="nur Buchstaben, Zahlen, Leerzeichen und die Zeichen :?,-(+.)/ sind erlaubt, max. 70 Zeichen" minlength="2" maxlenth="70" pattern="[a-zA-Z0-9 :?,-(+.)/]+" value="' . ( isset( $_POST["gcf-beneficiary"] ) ? esc_attr( $_POST["gcf-beneficiary"] ) : 'Deutsches Rotes Kreuz' ) . '" size="40" required />'; 403 $output .= '</p>'; 404 405 $output .= '<p>'; 406 $output .= 'IBAN* <br />'; 407 $output .= '<input type="text" name="gcf-iban" minlength="15" maxlength="31" title="nur Buchstaben und Zahlen erlaubt" pattern="[a-zA-Z0-9]+" value="' . ( isset( $_POST["gcf-iban"] ) ? esc_attr( $_POST["gcf-iban"] ) : 'DE63370205000005023307' ) . '" size="40" required/>'; 408 $output .= '</p>'; 409 410 $output .= '<p>'; 411 $output .= 'BIC* <br />'; 412 $output .= '<input type="text" name="gcf-bic" minlength="8" maxlength="11" title="nur Buchstaben und Zahlen erlaubt, min. 8, max. 11 Stellen" pattern="[a-zA-Z0-9]+" value="' . ( isset( $_POST["gcf-bic"] ) ? esc_attr( $_POST["gcf-bic"] ) : 'BFSWDE33XXX' ) . '" size="40" required />'; 413 $output .= '</p>'; 414 415 $output .= '<p>'; 416 $output .= 'Betrag in EUR* <br />'; 417 $output .= '<input type="number" name="gcf-amount" min="0" max="999999999" step="1" value="' . ( isset( $_POST["gcf-amount"] ) ? esc_attr( $_POST["gcf-amount"] ) : '20' ) . '" size="40" />'; 418 $output .= '</p>'; 419 420 $output .= '<p>'; 421 $output .= 'Verwendungszweck*<br />'; 422 $output .= '<input type="text" name="gcf-purpose" title="nur Buchstaben, Zahlen, Leerzeichen und die Zeichen :?,-(+.)/ sind erlaubt, max. 140 Zeichen" maxlength="140" pattern="[a-zA-Z0-9 :?,-(+.)/]+" value="' . ( isset( $_POST["gcf-purpose"] ) ? esc_attr( $_POST["gcf-purpose"] ) : 'Spende' ) . '" size="40" required />'; 423 $output .= '</p>'; 424 425 $output .= '<p>'; 426 $output .= 'Purpose-Code*<br />'; 427 $output .= '<fieldset>'; 428 $output .= '<input type="radio" name="gcf-purposecode" id = "standard" value = "" ' . ( ! isset($_POST["gcf-purposecode"]) || $_POST["gcf-purposecode"] == "" ? 'checked' : '' ) . ' size="40" />'; 429 $output .= '<label for="standard">Standard</label>'; 430 $output .= '</br>'; 431 $output .= '<input type="radio" name="gcf-purposecode" id = "char" value = "CHAR" ' . ( isset($_POST["gcf-purposecode"]) && $_POST["gcf-purposecode"] == "CHAR" ? 'checked' : '' ) . ' size="40" />'; 432 $output .= '<label for="char">Spende (CHAR)</label>'; 433 $output .= '</fieldset>'; 434 $output .= '</p>'; 435 436 437 438 439 $output .= '<p><input type="submit" name="gcf-submitted" value="Girocode generieren"/></p>'; 440 $output .= '</form>'; 441 442 return $output; 443 } 444 445 446 447 448 338 449 register_activation_hook( __FILE__, 'sepa_girocode_activate' ); 339 450 register_deactivation_hook( __FILE__, 'sepa_girocode_deactivate' ); 340 451 452 341 453 add_shortcode( 'girocode', 'sepa_girocode_shortcode' ); 454 add_shortcode( 'girocode-generator', 'sepa_girocode_shortcode_generator' ); 455 456 342 457 add_action('parse_request', 'sepa_girocode_parse_request'); 343 458 add_filter('query_vars', 'sepa_girocode_query_vars'); 344 459 460 add_action( 'upgrader_process_complete', 'sepa_girocode_upgrade'); 461 462 345 463 ?>
Note: See TracChangeset
for help on using the changeset viewer.