$this->attributes(), 'render_callback' => [$this, 'render'] ) ); } function attributes(){ return array( 'align' => array( 'type' => 'string', 'default' => '' ), 'cId' => array( 'type' => 'string', 'default' => '' ), 'qrAlign' => array( 'type' => 'string', 'default' => 'center' ), 'url' => array( 'type' => 'string', 'default' => '' ), 'dimension' => array( 'type' => 'number', 'default' => 180 ), 'color' => array( 'type' => 'string', 'default' => '#000' ), 'bgColor' => array( 'type' => 'string', 'default' => '#fff' ) ); } function render( $attributes ){ extract( $attributes ); // Generate Styles $qrCodeStyle = new BBlocksStyleGenerator(); $qrCodeStyle::addStyle( "#bBlocksQRCode-$cId .bBlocksQRCode", array( 'text-align' => $qrAlign ) ); $siteUrl = $url ? $url : 'http://bplugins.com'; $qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=". $dimension ."x". $dimension ."&color=". str_replace('#', '', $color) ."&bgcolor=". str_replace('#', '', $bgColor) ."&ecc=L&qzone=1&data=". $siteUrl; ob_start(); ?>