"; ini_set("soap.wsdl_cache_enabled", 1); ini_set("soap.wsdl_cache_ttl", 86400); //error_reporting(E_ALL); ini_set('display_errors','On'); //echo ""; // License // Our plugin is compatible with the GNU General Public License v2, or any later version. $myEpaperClass = new epaper(); add_action('init', array($myEpaperClass,'epaperTextDomain'), 1); add_action('admin_menu', array($myEpaperClass,'epaperIntegrationMenu')); add_shortcode('ePaper', array($myEpaperClass,'epaperShortcode')); wp_register_sidebar_widget('1000grad-ePaper','1000°ePaper', array($myEpaperClass,'epaperWidget'),array( 'description' => 'Shows the first ePaper Channel' )); wp_register_widget_control('1000grad-ePaper','1000grad-ePaper', array($myEpaperClass,'epaperWidgetControl') ); //wp_register_sidebar_widget('1000grad-ePaper-2','1000°ePaper #2', array($myEpaperClass,'epaperWidget2'),array( 'description' => 'Shows the second ePaper Channel' )); //wp_register_widget_control('1000grad-ePaper-2','1000grad-ePaper #2', array($myEpaperClass,'epaperWidgetControl2')); add_action( 'add_meta_boxes', array( $myEpaperClass, 'addEpaperMetaBox' ) ); add_filter('the_posts', array($myEpaperClass,'conditionally_add_scripts_and_styles')); // doesnt work for the moment :-( //add_action('wp_head', array($myEpaperClass,'colorboxinlineheader')); add_action('wp_footer', array($myEpaperClass,'colorboxinline')); class epaper { function colorboxinlineheader() { echo ''; } function colorboxinline() { echo ''; $code= ' '; // echo $code; } function addEpaperMetaBox() { $epaper_options = get_option("plugin_epaper_options"); $apikey=$epaper_options['apikey']; if($apikey>"") { add_meta_box( 'epaper_editorbox', '1000°ePaper', array(&$this, 'epaperMetaBox'), 'post', 'side', 'high' ); add_meta_box( 'epaper_editorbox', '1000°ePaper', array(&$this, 'epaperMetaBox'), 'page', 'side', 'high' ); } } function conditionally_add_scripts_and_styles($posts) { if (empty($posts)) return $posts; $shortcode_found = false; // use this flag to see if styles and scripts need to be enqueued foreach ($posts as $post) { if (stripos($post->post_content, 'ePaper')) { $shortcode_found = true; // bingo! break; } } // if ($shortcode_found) { // wp_enqueue_script('js_colorbox_min', plugins_url('1000grad-epaper/colorbox/jquery.colorbox-min.js')); wp_enqueue_script('js_colorbox', plugins_url('1000grad-epaper/colorbox/jquery.colorbox.js')); wp_enqueue_style('style_colorbox', plugins_url('1000grad-epaper/colorbox/colorbox.css')); # wp_enqueue_script('yo', 'yo'); # wp_head('yo', 'yo'); } return $posts; } function epaperWidget($args) { extract($args); $epaper_options = get_option("plugin_epaper_options"); $url=$epaper_options['channelurl1']; if($url>"") { $name=$epaper_options['widgetname1']; if ($name=="") $name="ePaper"; echo $before_widget; echo $before_title .$name; echo $after_title; $html=""; $html.='epaper preview gif'; // $html.=''; // $html.="

"; echo $html; echo $after_widget; } } function epaperWidget2($args) { extract($args); $epaper_options = get_option("plugin_epaper_options"); $url=$epaper_options['channelurl2']; if($url>"") { $name=$epaper_options['widgetname2']; if ($name=="") $name="ePaper"; echo $before_widget; echo $before_title .$name; echo $after_title; $html=" '; // $html.=''; echo $html; echo $after_widget; } } function epaperWidgetControl() { $options = get_option("plugin_epaper_options"); if ($_POST['ePaperSubmit']) { $options['widgetname1'] = htmlspecialchars($_POST['ePaperWidgetTitle']); update_option("plugin_epaper_options", $options); } ?>

"", 'url' => "", 'id' => "", 'nr' => "", ), $atts)); if ($nr=="") $nr=1; $epaper_options = get_option("plugin_epaper_options"); if ($url=="") $url=$epaper_options['channelurl'.$nr]; $html=" '; //$html.=''; return $html; } function epaperEditPost($id,$test,$apiKey) { e_('

Poste ePaper

','1000grad-epaper'); try { $editinfo = $test->epaperGetInfos($apiKey,$id); } catch (SoapFault $e) {echo 'Fehler beim Zugriff auf ePaper'.$e->getMessage(); return false;} echo '

'.$editinfo->filename.'

'; $info=json_decode($editinfo); echo 'Element ID '.$info->id; $my_post = array( 'post_title' => 'ePaper '.$info->title, 'post_content' => __('This is my new ePaper','1000grad-epaper').' '.$info->title.': ePaper preview', 'post_status' => 'publish', ); $postid=wp_insert_post( $my_post ); echo __('
was posted (without Category)','1000grad-epaper').'
'.__('Edit this Post','1000grad-epaper') .''; } function epaperEditList($test,$apiKey) { echo "

1000°ePaper

"; _e('

List of uploaded ePapers

','1000grad-epaper'); $clientlist=json_decode($test->ePaperGetList($apiKey)); if (count($clientlist)=="0") { _e('No ePaper existent','1000grad-epaper'); _e('
Please upload a PDF File.','1000grad-epaper'); } echo "
";
    print_r($clientlist);
    echo "
"; foreach ( $clientlist as $clientpaper ) { try { $clientabfrage = $test->ePaperGetInfos($apiKey,$clientpaper->id); } catch (SoapFault $e) {echo 'Fehler beim Zugriff auf ePaper'.$e->getMessage(); return false;} echo "
";
    print_r($clientabfrage);
    echo "
"; $clientinfo=json_decode($clientabfrage); ?>
"; print_r($clientinfo); echo ""; $uploaddir=wp_upload_dir(); echo ''; if ($clientinfo->settings->logo=='1') echo ''; if ($clientinfo->title=='') _e('no title set','1000grad-epaper'); echo '
File: '.$clientpaper->filename.''; echo ' (ID: '.$clientpaper->id.')'; echo __('
Number of Pages:','1000grad-epaper').' '.$clientinfo->pages; if ($clientinfo->status<>'ready') echo '
Status: '.$clientinfo->status.''; else echo '
Status: ready'; echo '
id.'>'.__('edit','1000grad-epaper').' / '; // #deaktivierte Download-Funktion // echo ' id.'>render / '; // echo ' id.'>publizieren / '; // echo ' id.'>'.__('download','1000grad-epaper').' / '; echo ' id.'&channelid=1>'.__('canalize','1000grad-epaper').' / '; echo ' id.'>'.__('delete','1000grad-epaper').' / '; echo ''; ?>

"; } function epaperEditCheck($id,$test,$apiKey) { try { $file = $test->epaperGetInfos($apiKey,$id); } catch (SoapFault $e) {echo 'Error beim Zugriff auf ePaper '.$id.'.
Fehler: '.$e->getMessage(); return false;} $editinfo=json_decode($file); // echo '

'.$editinfo->filename.'

'; // if ($editinfo->zip_url>'') echo '
Export: ZIP download'; // else echo '
Export nicht möglich, Datei noch nicht published'; // echo ' ('.$editinfo->pages.' Seiten)'; // echo '
id.'>publizieren (1 License wird verbraucht!)'; echo '
'; _e('

ePaper Settings

','1000grad-epaper'); ?>

e.g. "Ausgabe 1"
e.g. "de", "en"
settings->logo=='1') echo __('(existing)','1000grad-epaper').''; else echo ''.__('(choose file)','1000grad-epaper').' max. 250x60 Pixel!'; ?>
'; // echo "1000°ePaper ApikeyConnect
"; _e('This Installation is not registered yet.
Please register your installation','1000grad-epaper'); // echo ''; // return false;} try { $testapikey = new SoapClient($Wsdl , array()); } catch (SoapFault $e) {echo 'Fehler beim Connect'.$e->getMessage(); return false;} return true; } function epaperConnect() { global $test; global $apiKey; $epaper_options = get_option("plugin_epaper_options"); if ($epaper_options['apikey']=="") { echo '
'; echo "1000°ePaper
"; _e('This Installation is not registered yet.
Please register your installation','1000grad-epaper'); echo '
'; return false;} $Wsdl = $epaper_options['url']."epaper-wsdl/"; $apiKey=$epaper_options['apikey']; try { $test = new SoapClient($Wsdl , array()); } catch (SoapFault $e) {echo 'Fehler beim Connect'.$e->getMessage(); return false;} return true; } function epaperChannelConnect() { global $channel; global $apiKey; $epaper_options = get_option("plugin_epaper_options"); if ($epaper_options['apikey']==""){ echo '
'; echo "
"; _e('This Installation is not registered yet.
Please register your installation','1000grad-epaper'); echo '
'; return false;} if ($epaper_options['url']==""){ echo '
'; echo "
"; _e('This Installation is not correctly registered.
Please check your installation','1000grad-epaper'); echo '
'; return false; } $Wsdl = $epaper_options['url']."channels-wsdl/"; $apiKey=$epaper_options['apikey']; try { $channel = new SoapClient($Wsdl , array()); } catch (SoapFault $e) { echo 'Fehler beim Connect'.$e->getMessage(); return false;} return true; } function epaperSettingsTest($testchannel,$apiKey) { echo 'API Version: '. $testchannel->getVersion(); echo '

API Key: '. $apiKey; $clientinfo=($testchannel->__getFunctions()); echo __('
Number of API Commands:','1000grad-epaper').' '.count($clientinfo); } function epaperTestWordpress() { global $wp_version; $versionwordpress = $wp_version; $versionphp = phpversion(); $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $memory_limit = (int)(ini_get('memory_limit')); $max_execution_time= (int)(ini_get('max_execution_time')); $max_input_time= (int)(ini_get('max_input_time')); $upload_mb = min($max_upload, $max_post, $memory_limit); $uptime_mb = min($max_execution_time,$max_input_time); echo ""; _e('max. PHP-Upload of this Wordpress:','1000grad-epaper'); echo ' '.$upload_mb.' MByte (upload: '.$max_upload.'MB, Post:'.$max_post.'MB, Speicher:'.$memory_limit.'MB)'; echo "
"; _e('Wordpress & PHP-Version:','1000grad-epaper'); echo ' '.$versionwordpress.' / '.$versionphp; echo "
"; _e('max. PHP-Time for this Wordpress:','1000grad-epaper'); echo ' '.$uptime_mb.' sec. (execution: '.$max_execution_time.'s, Input:'.$max_input_time.'s)'; echo "
"; _e('curl for this Wordpress:','1000grad-epaper'); if (extension_loaded('curl')) echo " OK. "; else _e("
Error, there is NO CURL installed at your wordpress system!",'1000grad-epaper'); //echo ' '.$uptime_mb.' sec. (execution: '.$max_execution_time.'s, Input:'.$max_input_time.'s)'; echo "
"; _e("local plugin settings:",'1000grad-epaper'); echo "
"; echo "

";
        $epaper_options = get_option("plugin_epaper_options");
        print_r($epaper_options);
        echo "
"; } function epaperTestApi() { global $test; global $apiKey; epaper::epaperConnect(); if ($apiKey>'') { try { $version=$test->getVersion(); } catch (SoapFault $e) {_e('
Error with API Handling, please register your plugin!','1000grad-epaper').$e->getMessage(); return false;} echo 'API Version: '. $version; try { $clientinfo=($test->__getFunctions()); } catch (SoapFault $e) {_e('
Error with API Handling, please register your plugin!','1000grad-epaper').$e->getMessage(); return false;} echo __('
Number of API Commands:','1000grad-epaper').' '.count($clientinfo); try { $clientinfos=$test->clientGetInfos($apiKey); } catch (SoapFault $e) {_e('
Error with API Key Authentification','1000grad-epaper').$e->getMessage().''; return false;} echo "
Api Key ist valide"; return true; } } function epaperTestChannelApi() { global $channel; global $apiKey; epaper::epaperChannelConnect(); if ($apiKey>'') { echo 'API Version: '. $channel->getVersion(); $clientinfo=($channel->__getFunctions()); echo __('
Number of API Commands:','1000grad-epaper').' '.count($clientinfo); return true; } } function epaperTestApikeyApi() { global $testapikey; global $apiKey; epaper::epaperApikeyConnect(); if ($apiKey>'') { echo 'API Version: '. $testapikey->getVersion(); $clientinfo=($testapikey->__getFunctions()); echo __('
Number of API Commands:','1000grad-epaper').' '.count($clientinfo); return true; } } function epaperContact() { echo "

"; ?> 1000°DIGITAL GmbH

Lampestr. 2
D-04107 Leipzig
Support: +49 341 96382-63
Fax: +49 341 96382-22

info@1000grad.de
http://www.1000grad.de
http://www.1000grad-epaper.de/loesungen/wp-plugin '') { try { $clientinfos=$test->clientGetInfos($apiKey); } catch (SoapFault $e) {echo '
Fehler bei API Key Athentifizierung'.$e->getMessage().''; return false;} $clientinfo=json_decode($clientinfos); echo 'Name: '.$clientinfo->name; echo ' ('.$clientinfo->firstname.' '.$clientinfo->lastname.') '; echo '
Kurzname: '.$clientinfo->short_name; echo '
Kundennummer: '.$clientinfo->customer_id; echo '
Email: '.$clientinfo->email; echo '
vorhandene Kanäle: '.$clientinfo->channels_count.''; echo '
verwendeter Speicher: '.round($clientinfo->disk_usage / 1024 / 1024 ).' MByte'; echo '
vorhandene ePapers: '.$clientinfo->count_created; echo '
publizierte ePapers: '.$clientinfo->count_published; // echo '
ePapers Limit: '.$clientinfo->count_limit; try { $clientchannels=json_decode($channel->channelsGetList($apiKey)); } catch (SoapFault $e) {echo '
Fehler bei API Key Athentifizierung '.$e->getMessage().''; return false;} echo '
ePapers Channels: '.$clientchannels->count; foreach ( $clientchannels->channels as $channelt ) { // $channelinfo=json_decode($testchannel->GetChannelInfo($apiKey,$channel->id)); echo "
ID: ".$channelt->id; echo " - ".$channelt->time_created; echo " - ".$channelt->time_modified; echo " - ".$channelt->expiry_time; echo " "; if ($channelt->id_epaper>"") echo "- ePaper Nr. ".$channelt->id_epaper; else _e('not used','1000grad-epaper'); } return true; } } function epaperSettings() { $epaper_options = get_option("plugin_epaper_options"); if (!is_array( $epaper_options )) { $epaper_options = array( 'url' => '', 'wordpressapi' => 'http://epaperplugin.1kcloud.com/api/v2/wordpress-wsdl/', 'apikey' => '', ); } if ($_GET['epaper-settings-save']) { $epaper_options['url'] = htmlspecialchars($_GET['epaper_url']); $epaper_options['wordpressapi'] = htmlspecialchars($_GET['epaper_wordpressapi']); $epaper_options['apikey'] = htmlspecialchars($_GET['epaper_apikey']); update_option("plugin_epaper_options", $epaper_options); } // epaper_more_channels if ($_GET['epaper-more-channels']) { echo "upgrade not in settings - tbo"; } // echo "
"; ?>

1000°ePaper

sendFeedback($epaper_options['email'],$text,$more,admin_url(),$phpupload,$phptime,$version_wordpress,$version_php,$language)); } catch (SoapFault $e) { echo '
Error '.$e->getMessage().''; // if ($e->getMessage()=="(605) no valid email adress") _e("
Email adress is not valid.",'1000grad-epaper'); } _e("
Your feedback comment was sent to the 1000°ePaper Support Team. Thank you for contacting us."); echo "
".$text.""; } else { ?>

" class="button" />

"; ?> 1000°DIGITAL GmbH

Lampestr. 2
D-04107 Leipzig
Support: +49 341 96382-63
Fon: +49 341 96382-82
Fax: +49 341 96382-22

info@1000grad.de
http://www.1000grad.de
http://www.1000grad-epaper.de/loesungen/wp-plugin

Error, there is NO CURL installed at your wordpress system!",'1000grad-epaper'); _e("
Please install it first!
apt-get install php5-curl",'1000grad-epaper'); exit(); } ?>



Infos

ePaper Wordpress API

ePaper User API

ePaper Channel API

ePaper API License


"; } function epaperApikey() { global $testapikey; global $apiKey; epaper::epaperApikeyConnect(); global $wp_version; $epaper_options = get_option("plugin_epaper_options"); if (!is_array( $epaper_options )) { $epaper_options = array( 'url' => '', 'email' => '', 'wordpressapi' => 'http://epaperplugin.1kcloud.com/api/v2/wordpress-wsdl/', 'text' => '', 'urlapikey' => '', 'apikey' => '', 'code' => '', 'newsletter' => '', ); } if (isset($_POST['on'])) { $email = $_POST['apikey_email']; $wordpress = $_POST['apikey_wordpress']; $text = $_POST['apikey_text']; $wordpresscode = $_POST['apikey_wordpresscode']; $phpupload = $_POST['apikey_phpupload']; $phptime = $_POST['apikey_phptime']; $newsletter = $_POST['newsletter']; $language = __("en",'1000grad-epaper'); $agb = $_POST['agb']; $version_wordpress = $wp_version; $version_php = phpversion(); _e("Acquiring data.",'1000grad-epaper'); _e("
Please have a look into your email inbox for confirmation code.",'1000grad-epaper'); # Daten werden angefordert. Bitte schauen Sie in Ihr email-Postfach $epaper_options['email'] = $email; $epaper_options['text'] = $text; update_option("plugin_epaper_options", $epaper_options); try { $email=json_decode($testapikey->getRegistrationCodeByEmail($email,$text,$wordpress,$phpupload,$phptime,$wordpresscode,$agb,$newsletter,$version_wordpress,$version_php,$language)); } catch (SoapFault $e) { echo '
Error '.$e->getMessage().''; if ($e->getMessage()=="(605) no valid email adress") _e("
Email adress is not valid.",'1000grad-epaper'); } } global $wp_version; $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $memory_limit = (int)(ini_get('memory_limit')); $max_execution_time= (int)(ini_get('max_execution_time')); $max_input_time= (int)(ini_get('max_input_time')); $upload_mb = min($max_upload, $max_post, $memory_limit); $uptime_mb = min($max_execution_time,$max_input_time); ?>

1000°ePaper

Error, there is NO CURL installed at your wordpress system!",'1000grad-epaper'); _e("
Please install it first!
apt-get install php5-curl",'1000grad-epaper'); exit(); } ?>


terms of use and I agree.",'1000grad-epaper'); ?>

" class="button" />

Confirmation code was entered:",'1000grad-epaper'); echo " "; echo $code; try { $result=json_decode($testapikey->SendCodeGetApikey($email,$code)); } catch (SoapFault $e) {echo '
API-Fehler. '.$e->getMessage().''; return false;} _e("

Your new settings are:

",'1000grad-epaper');
  print_r($result);
  echo "
"; // $epaper_options['code'] = $code; $epaper_options['url']=$result->apiurl; $epaper_options['apikey']=$result->apikey; update_option("plugin_epaper_options", $epaper_options); _e("

Now you can use this ePaper Plugin!.",'1000grad-epaper'); ?>

"")) { ?>



"; echo "
"; echo "
"; ?>

Kontakt

"; echo "
"; echo "
"; } echo "
"; echo "
"; echo "
"; } function epaperChannelUpload() { # // global $test; global $channel; global $apiKey; epaper::epaperConnect(); epaper::epaperChannelConnect(); global $test; global $channel; global $apiKey; epaper::epaperConnect(); epaper::epaperChannelConnect(); $upload=$_FILES['uploadfile']; $id=$_POST['id']; $id_epaper=$_POST['id_epaper']; // echo '
ID channel '.$id; // echo '
ID des alten ePapers '.$id_epaper; // Vorbereitung if ($id_epaper>"") { if ($channel->channelsRemoveEpaperFromChannel($apiKey,$id)) echo '
Kanal freigestelltOK' ; else echo "Fehler beim Kanal-freistellen!"; if ($test->epaperDelete($apiKey,$id_epaper)) echo '
voriges ePaper gelöschtOK' ; else echo "Fehler beim löschen des vorigen epapers!"; } // sooo { echo '

ePaper Upload

Datei '.$upload['name'].' ('.$upload['size'].' byte / '.round($upload['size']/1024/1024).'MByte) '; //print_r($upload); if ($upload['error']=='0') echo "OK"; else { _e("Error! "); echo $upload['error']; echo "
"; _e("
Maybe file is larger than your wordpress php settings.",'1000grad-epaper'); _e("
You can rise up these limits by creating file wp-admin/.htaccess",'1000grad-epaper'); echo "
        php_value upload_max_filesize 100M
        php_value post_max_size 100M
        php_value max_execution_time 200
        php_value max_input_time 200

"; _e("or look for hints at",'1000grad-epaper'); echo " php.net
"; epaper::epaperTestWordpress(); return false; } $file = $upload['tmp_name']; $epaper_options = get_option("plugin_epaper_options"); $apiKey=$epaper_options['apikey']; $uploadUrl = $epaper_options['url']."pdf-upload/"; $postParams =array( 'file' => "@" . $file.';filename='.urlencode($upload['name']), 'apikey' => $apiKey ); // upload if (extension_loaded('curl')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $uploadUrl); curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); if (!$result) { print_r($response); echo '
Error: Could not decode response!'; return false; } elseif (!$result['success']) { echo '

Error: '.$result['errors']['errorDesc'].''; // echo '
Error-Code: '.$result['errors']['errorCode'].' '; // print_r($result); return false; } else { // echo '
PDF-ID: '.$result['pdfId']; } $uploadit=$result['pdfId']; // print_r($result); _e('
Upload was sucessful','1000grad-epaper'); } else { _e("
Error, there is NO CURL installed at your wordpress system!",'1000grad-epaper'); // return false; echo "

";
      $data = "";
      $boundary = "---------------------".substr(md5(rand(0,32000)), 0, 10); 
      $fileContents = file_get_contents($upload['tmp_name']); 
       $data .= "--$boundary\n";
       $data .= "Content-Disposition: form-data; name=\"apikey\"\n\n".$apiKey."\n"; 
       $data .= "--$boundary\n";
        $data .= "Content-Disposition: form-data; name=\"file\"; filename=\"".urlencode($upload['name'])."\"\n";
        $data .= "Content-Type: application/octet-stream\n";
//        $data .= "Content-Transfer-Encoding: binary\n\n";
        $data .= $fileContents."\n";
        $data .= "--$boundary\n"; 

   $opts = array(
    'http'=>array(
      'method'=>"POST ".parse_url($uploadUrl, PHP_URL_PATH),
      'user_agent'=>"Wordpress ePaper upload",
      'header'=>"Accept-language: en\r\n" .
                "Cookie: foo=bar\r\n" .
             "Content-Type: multipart/form-data; boundary=".$boundary,
      'content'=>$data

        )
      );
   print_r($opts);
$context = stream_context_create($opts);
$socket = stream_socket_client("tcp://".parse_url($uploadUrl, PHP_URL_HOST).":80", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
while (!feof($socket)) {
  sleep(1);
        echo fgets($socket, 1024);
    }
    fclose($socket);
echo "xx- upload ende des tests";
return false;
          }

    
    $uploadid = $test->epaperCreateFromPdf($apiKey,$uploadit);
//    _e('
ePaper generation started','1000grad-epaper'); if ($test->epaperStartRenderprocess($apiKey,$uploadid)) _e('
ePaper Rendering was started.','1000grad-epaper'); else _e('
ePaper rendering couldnt start error.','1000grad-epaper'); require_once 'ProgressBar.class.php'; $bar = new ProgressBar(); $bar->setAutohide(true); $bar->setSleepOnFinish(1); $bar->setForegroundColor('#333333'); $elements = 10; //total number of elements to process $bar->setBarLength(400); for($j=5;$j>2;$j++){ $infoj=$test->epaperGetInfos($apiKey,$uploadid); $info = json_decode($infoj, true); // echo "".preg_replace("/(render)/", "", $info['status']).""; echo "".$info['status']." "; $status=$info['status']; if ($status=="ready") $j=0; echo $info['renderprocess']['current_page']."/".$info['pages']; $bar->initialize($elements); //print the empty bar $bar->setMessage($status); for($i=0;$i<$elements;$i++){ sleep(1); $bar->increase(); //calls the bar with every processed element } } echo "
"; echo "

"; epaper::epaperChannelDetailsForm($id,$uploadid,$upload['name']); } } function epaperChannelEmpty() { global $test; global $channel; global $apiKey; epaper::epaperConnect(); epaper::epaperChannelConnect(); $id=$_POST['id']; $id_epaper=$_POST['id_epaper']; if ($id_epaper>"") { if ($channel->channelsRemoveEpaperFromChannel($apiKey,$id)) echo '
Kanal freigestelltOK' ; else echo "Fehler beim Kanal-freistellen!"; if ($test->epaperDelete($apiKey,$id_epaper)) echo '
voriges ePaper gelöschtOK' ; else echo "Fehler beim löschen des vorigen epapers!"; } } function epaperChannelDetails() { global $test; global $channel; global $apiKey; epaper::epaperConnect(); epaper::epaperChannelConnect(); $uploadid=$_POST['id_epaper']; $id=$_POST['id']; $title=$_POST['title']; $lang=$_POST['lang']; _e('
Name:','1000grad-epaper'); echo ' '.($title); if ($test->epaperSetVar($apiKey,$uploadid,'title',html_entity_decode($title))=='1') echo ' OK' ; else echo "probleme beim titel-Setzen"; try { $fileup = $test->epaperSetVar($apiKey,$uploadid,'is_pdf_download','0'); } catch (SoapFault $e) {echo 'Fehler beim Editieren von ePaper (download)'.$e->getMessage(); return false;} try { $fileup = $test->epaperSetVar($apiKey,$uploadid,'is_search','1'); } catch (SoapFault $e) {echo 'Fehler beim Editieren von ePaper (search)'.$e->getMessage(); return false;} try { $fileup = $test->epaperSetVar($apiKey,$uploadid,'use_ipad','1'); } catch (SoapFault $e) {echo 'Fehler beim Editieren von ePaper (mobile)'.$e->getMessage(); return false;} try { $fileup = $test->epaperMove($apiKey,$uploadid,html_entity_decode($title),'1'); } catch (SoapFault $e) {echo 'Fehler beim Umbenennen vom ePaper '.$e->getMessage(); return false;} // channelsPublishEpaperTochannel try { $fileup = $channel->channelsPublishEpaperToChannel($apiKey,$uploadid,$id); } catch (SoapFault $e) {echo '
Fehler beim Kanalisieren von ePaper: '.$e->getMessage(); return false;} if ($fileup=='1') _e('
Publishing started.','1000grad-epaper'); else _e('
Unable to start publishing.','1000grad-epaper'); echo "
"; require_once 'ProgressBar.class.php'; $bar = new ProgressBar(); $bar->setAutohide(true); $bar->setSleepOnFinish(1); $bar->setForegroundColor('#333333'); $elements = 10; //total number of elements to process $bar->setBarLength(400); for($j=5;$j>2;$j++){ $infoj=$test->epaperGetInfos($apiKey,$uploadid); $info = json_decode($infoj, true); $status=$info['status']; if ($status=="ready") $j=0; // echo $info['status']." "; // echo $info['renderprocess']['current_page']."/".$info['pages']; $bar->initialize($elements); //print the empty bar $bar->setMessage($status); for($i=0;$i<$elements;$i++){ sleep(1); // simulate a time consuming process $bar->increase(); //calls the bar with every processed element } } echo "
"; echo "

"; _e("Your ePaper is now ready to use.",'1000grad-epaper'); echo "
"; ?>

weitere Angaben:'; // echo "
channel: ".$id." neues Paper:".$id_epaper." Dateiname: ".htmlentities($name); $name = preg_replace("/^(.+)\.pdf$/i","\\1",$name); ?>



"; ?>


">
""): ?>
">
Poste ePaper Kanal'; // $channelid=$_GET["channelid"]; $channelid=$_POST["channelid"]; if ($channelid=="") $channelid=$_GET["channelid"]; try { $channelinfo = $channel->channelsGetChannelInfo($apiKey,$channelid); } catch (SoapFault $e) {echo 'Fehler beim Zugriff auf ePaper Kanal'.$e->getMessage(); return false;} $info=json_decode($channelinfo); // print_r($info); echo 'Kanal URL '.$info->url; $url=$info->url; $html="[ePaper url=".$url."]"; $text='Hier mein neues ePaper '.$info->title.' zum durchblättern: '; // need only ONE ePaper Link for the beta-test! $text=__("This is my new ePaper, brought to you by the 1000°ePaper service. Even you can share your ePapers with this wordpress plugin! Get your first ePaper Channel FOR FREE during beta stage.",'1000grad-epaper'); $html="[ePaper]"; $text=$html.$text; // ePaper preview'; $my_post = array( 'post_title' => 'ePaper '.$info->title, 'post_content' => $text, 'post_status' => 'publish', ); $postid=wp_insert_post( $my_post ); _e('
was posted (without category)
'); echo ''; _e('Further edit this post'); echo ''; } function epaperChannels() { global $channel; global $apiKey; epaper::epaperChannelConnect(); $modus=$_REQUEST['modus']; // $id=$_REQUEST['id']; // sollten noch mehr Sicherheitsabfragen rein (nur Zahlen und Buchstaben!) // $channelid=$_REQUEST['channelid']; if ($modus=="upload") {epaper::epaperChannelUpload(); } if ($modus=="postpost") {epaper::epaperChannelPostPost(); } if ($modus=="channeldetails") {epaper::epaperChannelDetails(); } if ($modus=="channelupgrade") {epaper::epaperChannelUpgrade(); } if ($modus=="empty") {epaper::epaperChannelEmpty(); } if ($modus=="list") {epaper::epaperList(); } // if ($modus=="upload") {epaper::epaperChannelUpload($channelid,$testchannel,$apiKey); } if ($modus=="" or $modus=="channelupgrade" or $modus=="empty") { ?>

1000°ePaper

"; _e("The new ePaper PlugIn aims to support Wordpress users in creating and adding ePaper publications to the WordPress blog. Creating interactive FLASH and HTML5 based ePapers has never been easier. Upload your pdf file and create your interactive multimedia publication in a few steps. Each publication is optimized for web and mobile (iOS and Android) display and is equipped with an automatic device recognition. Test this new beta service and get one publication channel for free!",'1000grad-epaper'); echo "
"; if (extension_loaded('curl')) echo ""; else _e("
Error, there is NO CURL installed at your wordpress system!",'1000grad-epaper'); if ($apiKey>"") { $channels=json_decode($channel->channelsGetList($apiKey)); // print_r($channels); $channelcount=count($channels->channels); $channelnr=0; // if ($channelcount=="0") _e('

no ePaper Channel existing!

','1000grad-epaper'); // if ($channelcount=="1") _e('

Your ePaper Channel

','1000grad-epaper'); // if ($channelcount> "1") _e('

existing ePaper Channels

','1000grad-epaper'); // // echo "
";
//        print_r($channels);
//   echo "
"; echo "
"; foreach ( $channels->channels as $channelz ) { $channelnr=$channelnr+1; $channelinfo=json_decode($channel->channelsGetChannelInfo($apiKey,$channelz->id)); epaper::epaperChannelShow($channelinfo,$channelnr); } //echo ''; // echo "

"; // echo "
"; $channelnr=$channelnr+1; // echo ""; // echo "

"; // _e("ePaper Channel",'1000grad-epaper'); // echo " #".$channelnr." "; // echo "

"; // echo ""; // echo ""; ?>

"; echo ""; echo ""; epaper::epaperChannelUpgradeForm(); echo ""; _e("You can get more 1000°ePaper channels for your account for instance via PayPal. Coming soon.",'1000grad-epaper'); _e("
Please give us feedback about this plugin",'1000grad-epaper'); echo ""; echo "
"; // echo ""; echo "
"; } } } function epaperChannelUpgradeForm() { ?>
sendCodeGetMoreChannels($email,$code)); } catch (SoapFault $e) { echo '
'; _e('Es ist ein Fehler aufgetreten'); echo ' '.$e->getMessage().''; if ($e->getMessage()=="(610) code failed") echo "
Code ungueltig oder schon verbraucht!
"; if ($e->getMessage()=="(605) no valid email adress") echo "
Bitte die Email-Adresse korrekt angeben!"; if ($e->getMessage()=="(604) no name") echo "
Bitte geben Sie den Name korrekt an!"; else return false; } if ($succ=="ok") _e("Channel upgrade was successful!",'1000grad-epaper'); } function epaperChannelShow($channelinfo,$channelnr) { ?>

title." "; ?>

"; echo ""; if (!isset($channelinfo->id_epaper)) { echo __("no ePaper given",'1000grad-epaper'); } else { // echo ""; // echo ""; $html="url.'/epaper/epaper-ani.gif?rnd='.rand(1000, 9999).'" alt="epaper preview gif" border="0" hspace=20 /> '; // $html.=''; echo $html; } echo ""; epaper::epaperChannelUploadForm($channelinfo->id,$channelinfo->id_epaper); echo ""; if (!isset($channelinfo->id_epaper)) { _e("According to your wordpress settings the maximum upload size is limited to",'1000grad-epaper'); $max_upload = (int)(ini_get('upload_max_filesize')); $max_post = (int)(ini_get('post_max_size')); $memory_limit = (int)(ini_get('memory_limit')); $upload_mb = min($max_upload, $max_post, $memory_limit); echo " ".$upload_mb." MB."; } else { _e("Embed this ePaper:",'1000grad-epaper'); echo "
    "; if ($channelnr=="1") echo "
  • via Widget"; echo "
  • "; _e("wordpress shortcode:",'1000grad-epaper'); if ($channelnr=="1") echo "
    [ePaper]"; else echo "
    [ePaper nr=".$channelnr."]"; echo "
  • "; _e("or",'1000grad-epaper'); echo " [ePaper url=".$channelinfo->url."]"; // if ($id_epaper>"") { // echo "
    ".$channelinfo->url.""; // _e("

    you can",'1000grad-epaper'); echo "

  • "; // _e("Embed this ePaper Channel into Post:",'1000grad-epaper'); echo " id.">"; _e("Create a new post with this ePaper",'1000grad-epaper'); echo ""; //if ($epaper_options['apikey']=="") // echo ""; _e("
  • HTML code for advanced users:",'1000grad-epaper'); echo "

    ".htmlentities("").""; echo "

"; } $url=$channelinfo->url; $epaper_options = get_option("plugin_epaper_options"); $epaper_options['channelurl'.$channelnr]=$url; $epaper_options['channeltitle'.$channelnr]=$channelinfo->title; update_option("plugin_epaper_options", $epaper_options); echo ""; echo "
"; } function epaperMetaBox() { global $channel; global $apiKey; epaper::epaperChannelConnect(); $channels=json_decode($channel->channelsGetList($apiKey)); $channelcount=count($channels->channels); if ($channelcount=="0") _e('

no ePaper Channel existing!

','1000grad-epaper'); _e("insert this shortcode into editor:",'1000grad-epaper'); $channelnr=0; foreach ( $channels->channels as $channell ) { $channelnr=$channelnr+1; $channelinfo=json_decode($channel->channelsGetChannelInfo($apiKey,$channell->id)); epaper::epaperChannelShowBox($channelinfo,$channelnr); } echo "

"; // echo "

So fügen Sie das ePaper manuell hinzu

//

[epaperchannel title='TITEL_EPAPER']

"; } function epaperChannelShowBox($channelinfo,$channelnr) { // epaper::epaperChannelUploadForm($channelinfo->id,$channelinfo->id_epaper); echo "

"; // echo $channelnr.". "; // _e("ePaper Channel ",'1000grad-epaper'); // echo $channelinfo->id.": "; $url=$channelinfo->url; if ($channelnr=="1") echo "[ePaper]"; else echo "[ePaper nr=".$channelnr."]"; if (!isset($channelinfo->id_epaper)) echo __("
Channel empty
please upload a file",'1000grad-epaper'); else { echo ""; // echo ""; echo "".$channelinfo->title."
"; //echo ""; $html=" '; // $html.=''; echo $html; } } }