MR. HAW CODE / MODX / PLUGINS / ReadSpeaker webReader Plugin 2.0

FEBRUARY 2010 (MODx 096x/Evolution 1.0/Evolution 1.0.2)

Listen with webreader

10 reasons for giving your web site or blog a voice

1. It helps certain users get better access to our web site, notably all those that have different reading handicaps such as dyslexia or a certain degree of visual impairment.
2. It is a great comfort tool for users who spend long periods of time in front of their computer or mobile phone and who appreciate listening to a web page to ease the strain of reading text.
3. It is a very easy way for listening to our text wherever our user is and whenever he/she wants to listen. Thanks to the save mp3 feature or the ability to convert RSS feeds into podcasts, our text content is portable to mobile devices like a smartphone or mp3 device.
4. It is a learning tool that helps our web site visitors whose language is not the same we write our content in better understand by listening to it.
5. We can reach out to more users, increase the trafic to our web site or blog and at the same time show that we care for those that benefit from listening instead of reading our online content.
6. It helps our users in multi-task contexts listen to our content while engaging in other activities. This can range from listening to cooking recipes while in front of the stove, to listening to step by step do-it-yourself activities like putting up a new window.
7. It provides us with the missing link, we can now have our users listen as well as sharing, printing, sending our content.
8. It immediately and on-the-fly converts our online text content into voice thereby giving us an effortless audio channel that we can propose for free to our followers.
9. Because of the server-side service proposed by ReadSpeaker, our content can be listened to from any device connected to the Internet, whether from home, at the work place or from any location with Internet connectivity.
10. Since ReadSpeaker is device independent, we are sure that our visitors can listen to what we have to say whatever hardware they use, from a PC to an Android supported phone but also gaming consoles, interactive Internet-TV systems, Internet kiosks, etc.

http://blog.readspeaker.com/2009/08/04/10-reasons-for-giving-your-web-site-or-blog-a-voice/


Implement webReader in MODxImplement webReader in MODx

Tip jar ; )

This code is 100% free to use and modify.

Dricksburk ; )

Den här koden är 100% gratis och fri att modifiera.
/*
    --------------------------------------------------------------------------------
    ::: ReadSpeaker webReader Plugin 2.0 :::
    Originally written for MODx 096x/Evolution 1.0 by ANDREAS WETTAINEN (mrhaw)
    http://4up2date.info/webreader
    CHANGE LOG
    2010-02-23 Changed lang variable http://modxcms.com/forums/index.php/topic,39039.0.html
    --------------------------------------------------------------------------------
    To install it:
    | 1 | Create a new plugin and paste this code WITHOUT <?php opening and closing ?> tags
    into the Plugin code text-box. Name it: webReader
    
    | 2 | Navigate to Configuration Tab and copy/paste into the Plugin configuration 
    text-box: (NOT the ###...)
  
    ################################################################################     
    
    &wRtags=How to implement webReader;list;Tags,Automatic;Automatic 
    &exclude=Exclude Templates;string;Enter comma separated Template ID Numbers 
    &cid=CID;string;Enter your CID Key 
    &lng=Language;list;de_de,sv_se,en_us,en_uk,fr_fr,it_it,es_es,pt_pt,nl_nl;en_us
    
    ################################################################################     
    
    Now click somewhere outside it and you see:

    How to implement webReader: Automatic 
    - Default: "Automatic" - this plugin will automatically add the Listen (play)
    button (and javascript expanding <div>) just before your MODx Document-Object 
    tag: [*content*]/[*#content*] and read all what's in it. "Tags" - see number 4.
    
    Exclude Templates: Enter comma separated Template ID Numbers
    - Here you can set one or many Template ID's separated by a comma, of which templates you
    want to exclude from using webReader. The ID Number is shown inside parenthesis next to
    the name of the Template in the template listing.

    CID: Enter your CID Key
    - Register on http://webreader.readspeaker.com

    Language: en_us  
    - Choose your language! Default: US English
    
    | 3 | Navigate to System Events Tab and mark checkbox "OnParseDocument" (Under Template Service Events)
    and SAVE!
    
    | 4 | If you chose to use "Tags" (instead of "Automatic") - use these tags in your Template and code:

    ################################################################################  
   
    <wRbox> - Where the Listen (play) button (and javascript expanding <div>) should appear.
    <wRstart> - Where to start read.
    <wRstop> - Where to stop read.
    
    ################################################################################  

    Enjoy webReader! : )
    
    --------------------------------------------------------------------------------
*/
$e= &$modx->Event;

$title = $modx->documentObject['alias'];
$page = str_replace("/", "", $_SERVER['REQUEST_URI']);
$url = $modx->config['site_url'] . $page;
$exclude2 = ",". $exclude .",";
$template = strpos($exclude2,",".$modx->documentObject['template'].","); 

$alt['de_de']='Vorlesen mit webReader';
$alt['sv_se']='L&auml;s med webReader';
$alt['en_us']='Listen with webreader';
$alt['en_uk']='Listen with webReader';
$alt['fr_fr']='Lis moi avec webReader';
$alt['it_it']='Ascolta con webReader';
$alt['es_es']='Escuchar con webReader';
$alt['pt_pt']='Ouvir com webReader';
$alt['nl_nl']='Lees voor met webReader';

$box = '<a href="http://wr.readspeaker.com/webreader/webreader.php?cid='. $cid .'&amp;t=modx&amp;title='. $title .'&amp;url='. $url .'" onclick="readpage(this.href,1);return false;"><img src="http://media.readspeaker.com/images/webreader/listen_'. $lng .'.gif" style="border-style: none;" title="'. $alt[$lng] .'" alt="'. $alt[$lng] .'" /></a>
<div id="WR_1"></div>';
$start = '<!-- RSPEAK_START -->';
$stop = '<!-- RSPEAK_STOP -->';

switch ($e->name) {
     case "OnParseDocument":
     $output = &$modx->documentOutput;
     if ($template === false && $wRtags == "Tags") {     
                $modx->regClientStartupScript('http://wr.readspeaker.com/webreader/webreader.js.php?cid='. $cid);      
                $output = str_replace("<wRbox>", $box, $output);
                $output = str_replace("<wRstart>", $start, $output);
                $output = str_replace("<wRstop>", $stop, $output);
                return $output;
     }
     elseif ($template === false && $wRtags == "Automatic") {    
                $modx->regClientStartupScript('http://wr.readspeaker.com/webreader/webreader.js.php?cid='. $cid);       
                $output = str_replace("[*content*]", $box ."<br />". $start ."[*content*]". $stop, $output);
                $output = str_replace("[*#content*]", $box ."<br />". $start ."[*#content*]". $stop, $output);
                return $output;           
     }
     else {        
                $output = str_replace("<wRbox>", "This Template is excluded from webReader in plugin config!", $output);
                return $output;
     }
     break;
     default:
     return;
     break;
}

CONFIGURATION OPTIONS SEEN IN MODx 096x and Evo 1.0


webReader config in 096x webReader config in EVO