Plugin Directory

Changeset 472905


Ignore:
Timestamp:
12/09/2011 06:33:44 PM (14 years ago)
Author:
lucascolin
Message:

2.0 update. Added PDF, EMail buttons, publisher logo, rework the settings page.

Location:
cleanprint-lt/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cleanprint-lt/trunk/EULA.txt

    r450830 r472905  
    120120therefore periodically visit the Format Dynamics website to review the current
    121121EULA.
     122
  • cleanprint-lt/trunk/cleanprint.php

    r452221 r472905  
    44Plugin URI: http://www.formatdynamics.com
    55Description: Brings print functionality to your blog
    6 Version: 1.5.0
     6Version: 2.0
    77Author: Format Dynamics
    88Author URI: http://www.formatdynamics.com
     
    1919$defaultPrintBtnImg   = $pluginName . '/BlogPrintButton.png';
    2020$defaultLocalBtnUrl   = plugins_url($defaultPrintBtnImg);
     21$defaultLogoUrl       = 'http://cache-02.cleanprint.net/media/logos/Default.png';
    2122$defaultVipBtnUrl     = get_bloginfo('template_directory') . '/plugins/' . $defaultPrintBtnImg;
    22 $oldBlogButtonUrl     = function_exists(wpcom_is_vip) ? $defaultVipBtnUrl : $defaultLocalBtnUrl;
    23 $publisherKey         = 'wpdefault15';
     23$publisherKey         = 'wpdefault15';
    2424$cleanprintUrl        = 'http://cache-02.cleanprint.net/cpf/cleanprint';
    25 $blackButtonUrl       = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_black.png';
    26 $whiteButtonUrl       = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_white.png';
    27 $opaqueButtonUrl      = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_transparent.png';
    28 $textButtonUrl        = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_text.png';
     25$buttonUrl            = 'http://cache-02.cleanprint.net/media/pfviewer/images';
     26$blackPrintButtonUrl  = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_black.png';
     27$blackPDFButtonUrl    = 'http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_black.png';
     28$blackEmailButtonUrl  = 'http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_black.png';
     29$whitePrintButtonUrl  = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_white.png';
     30$whitePDFButtonUrl    = 'http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_white.png';
     31$whiteEmailButtonUrl  = 'http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_white.png';
     32$opaquePrintButtonUrl = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_transparent.png';
     33$opaquePDFButtonUrl   = 'http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_transparent.png';
     34$opaqueEmailButtonUrl = 'http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_transparent.png';
     35$textPrintButtonUrl   = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_text.png';
     36$textPDFButtonUrl     = 'http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_text.png';
     37$textEmailButtonUrl   = 'http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_text.png';
    2938$readmeTxt            = $pluginName . '/readme.txt';
    3039$readmeLocalUrl       = plugins_url($readmeTxt);
     
    3948   global $pluginName;
    4049?>
    41     <div class="wrap">
    42         <div id="icon-options-general" class="icon32"><br /></div>
    43         <h2>CleanPrint Settings</h2>
    44         <form action="options.php" method="post">
    45             <?php settings_fields     ($optionsName); ?>
    46             <?php do_settings_sections($pluginName); ?>
    47 
    48             <input name="Submit" type="submit" value="Save Changes" />
    49         </form>
    50     </div>
     50    <div class="wrap">
     51        <div id="icon-options-general" class="icon32"><br /></div>
     52        <h2>CleanPrint Settings</h2>
     53        <form action="options.php" method="post">
     54            <?php settings_fields     ($optionsName); ?>
     55            <?php do_settings_sections($pluginName); ?>
     56
     57            <input name="Submit" type="submit" value="Save Changes" />
     58        </form>
     59    </div>
    5160<?php
    5261}
     
    5665function echoSectionText() {
    5766?>
    58     Provided is the ability to use a variety of print buttons styles or your own button. 
    59     If Google Analytics is enabled for your site you also have the ability to track print activity (**The site must contain Google Analytic for tracking to function**). 
     67    Thanks for installing CleanPrint on your site and helping your users save paper, ink, money and trees! Below are a few options to customize CleanPrint and make it your own. You can use your logo and choose from a variety of button styles or use your own button. You may also select the corner of your post where the button(s) will appear.
     68    If you would like to place the button(s) in a custom position please see intallation instructions. Also, if you choose to use Google Analytics custom event tracking for CleanPrint your site *MUST* have Google Analytics running. 
     69    <?php printf("<tr><td><h2>Logo</h2><hr /></td></tr>");?>
    6070<?php
    6171}
    6272
     73// WP callback for handling the Logo URL (default/custom) option
     74function echoLogoUrlSetting() {
     75    global $optionsName;
     76    global $defaultLogoUrl;
     77   
     78    $options        = get_option($optionsName);
     79    $logoUrl        = $options['logoUrl'];
     80    $customChecked  = isset($logoUrl) && $logoUrl!=$defaultLogoUrl;
     81    $defaultChecked = !$customChecked;
     82    $defaultGravity = "center";
     83
     84    printf( "<input type='radio' id='plugin_logoUrl' name='%s[logoUrl]' value='%s' %s />", $optionsName, $defaultLogoUrl, $defaultChecked?"checked='checked'":"");
     85    printf( "Default<br />\n");
     86
     87    printf( "<input type='radio' id='plugin_logoUrl' name='%s[logoUrl]' value='custom' %s />", $optionsName, $customChecked ?"checked='checked'":"");
     88    printf( "Custom:");
     89    printf( "<input type='text'  id='plugin_logoUrl' name='%s[customLogo]' value='%s' /><br>\n", $optionsName, $customChecked ? $logoUrl : "");
     90    printf( "<td>Logo Preview<br /><div style='background-color:#DDD; border: 1px solid #BBB; padding: 10px; text-align:center;'><img height='40px' src='%s'></div></td>", $customChecked ? $logoUrl : $defaultLogoUrl);
     91    printf("<tr><td  colspan='3'><h2>Buttons</h2><hr /></td></tr>");
     92}
    6393
    6494// WP callback for handling the Print Button URL (default/custom) option
    65 function echoButtonUrlSetting() {
    66     global $optionsName;
    67     global $blackButtonUrl;
    68     global $whiteButtonUrl;
    69     global $opaqueButtonUrl;
    70     global $textButtonUrl;
     95function echoButtonColorSetting() {
     96    global $optionsName;
    7197    global $readmeUrl;
    72    
    73     $options        = get_option($optionsName);
    74     $buttonUrl      = $options['buttonUrl'];
    75     $blackChecked   = !isset($buttonUrl) || $buttonUrl==$blackButtonUrl;
    76     $whiteChecked   =  $buttonUrl==$whiteButtonUrl;
    77     $opaqueChecked  =  $buttonUrl==$opaqueButtonUrl;
    78     $textChecked    =  $buttonUrl==$textButtonUrl;
    79     $removeChecked  =  $buttonUrl=='none';
    80     $customChecked  =  $blackChecked==false && $whiteChecked==false && $opaqueChecked==false && $textChecked==false && $removeChecked==false;
    81 
    82     printf( "<input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='%s' %s />", $optionsName, $blackButtonUrl, ($blackChecked?"checked='checked'":""));
    83     printf( " <img src='$blackButtonUrl'><br />\n");
    84 
    85     printf( "<input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='%s' %s />", $optionsName, $whiteButtonUrl, ($whiteChecked?"checked='checked'":""));
    86     printf( "<img src='$whiteButtonUrl'><br />\n");
    87 
    88     printf( "<input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='%s' %s />", $optionsName, $opaqueButtonUrl, ($opaqueChecked?"checked='checked'":""));
    89     printf( " <img src='$opaqueButtonUrl'><br />\n");
    90 
    91     printf( "<input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='%s' %s />", $optionsName, $textButtonUrl, ($textChecked?"checked='checked'":""));
    92     printf( " <img src='$textButtonUrl'><br />\n");
    93    
    94     printf( "<input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='custom' %s />", $optionsName, ($customChecked ?"checked='checked'":""));
    95     printf( "Custom:");
    96     printf( "<input type='' name='%s[customButton]' value='%s' /><br>\n", $optionsName, $customChecked ? $buttonUrl : "");
    97    
    98     printf( "<br /><input type='radio' id='plugin_buttonUrl' name='%s[buttonUrl]' value='none' %s />", $optionsName, $removeChecked ?"checked='checked'":"");
    99     printf( "Remove (see <a href='%s' target='_wpinst'>installation</a> instructions)<br />", $readmeUrl);
     98    global $buttonUrl;
     99   
     100    $options        = get_option($optionsName);
     101    $buttonColor    = $options['buttonColor'];
     102    $blackChecked   = $buttonColor=='black';
     103    $whiteChecked   = !isset($buttonColor) || $buttonColor=='white';
     104    $transparentChecked  =  $buttonColor=='transparent';
     105    $textChecked    =  $buttonColor=='text';
     106//    $removeChecked  =  $buttonColor=='none';
     107    $customChecked  =  $blackChecked==false && $whiteChecked==false && $opaqueChecked==false && $textChecked==false && $removeChecked==false;
     108   
     109    if(!isset($options['buttonColor'])) {
     110        $buttonColor = 'white';
     111    }
     112   
     113    printf("<script>function changeButtons(select) {");
     114    printf("var index  = select.selectedIndex;");
     115    printf("var value  = select.options[index].value;");
     116    printf("cpUrl    = 'http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_' + value + '.png';");
     117    printf("pdfUrl   = 'http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_'        + value + '.png';");
     118    printf("emailUrl = 'http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_'      + value + '.png';");
     119    printf("document.getElementById('cpImg')   .src = cpUrl;");
     120    printf("document.getElementById('pdfImg')  .src = pdfUrl;");
     121    printf("document.getElementById('emailImg').src = emailUrl;");
     122    printf("}</script>");
     123
     124    printf( "<select id='plugin_buttonColor' name='%s[buttonColor]' onchange='changeButtons(this); return false;'>", $optionsName);
     125    printf( "<option value='white' %s>White</option>", ($whiteChecked?"selected='selected'":""));
     126    printf( "<option value='black' %s>Black</option>", ($blackChecked?"selected='selected'":""));
     127    printf( "<option value='transparent' %s>Transparent</option>", ($transparentChecked?"selected='selected'":""));
     128    printf( "<option value='text' %s>Simple</option>", ($textChecked?"selected='selected'":""));
     129//  printf( "<option value='none' %s>None</option>", ($removeChecked?"selected='selected'":""));
     130    printf( "</select> <td>Button Preview<br /><div id='sampleArea' style='border: 1px solid #BBB; padding: 10px; text-align:center;'><img id='cpImg' src='$buttonUrl/CleanPrintBtn_$buttonColor.png'><img id='pdfImg' src='$buttonUrl/PdfBtn_$buttonColor.png'><img id='emailImg' src='$buttonUrl/EmailBtn_$buttonColor.png'></div></td>");
     131
     132}
     133
     134// WP callback for handling button include
     135function echoPrintInclude() {
     136    global $optionsName;
     137   
     138    $options         = get_option($optionsName);
     139    $PrintInclude    = $options['PrintInclude'];
     140    $printChecked    = !isset($PrintInclude) || $PrintInclude =="include";
     141   
     142    printf( "<select id='plugin_PrintInclude' name='%s[PrintInclude]'>", $optionsName);
     143    printf( "<option value='include' %s>Include</option>", ($printChecked ?"selected='selected'":""));
     144    printf( "<option value='exclude' %s>Exclude</option>", (!$printChecked ?"selected='selected'":""));
     145    printf( "</select>");
     146
     147}
     148
     149// WP callback for handling button include
     150function echoPDFInclude() {
     151    global $optionsName;
     152   
     153    $options         = get_option($optionsName);
     154    $PDFInclude      = $options['PDFInclude'];
     155    $pdfChecked      = !isset($PDFInclude) || $PDFInclude =="include";
     156   
     157    printf( "<select id='plugin_PDFInclude' name='%s[PDFInclude]'>", $optionsName);
     158    printf( "<option value='include' %s>Include</option>", ($pdfChecked  ?"selected='selected'":""));
     159    printf( "<option value='exclude' %s>Exclude</option>", (!$pdfChecked ?"selected='selected'":""));
     160    printf( "</select>");
     161   
     162}
     163
     164// WP callback for handling button include
     165function echoEmailInclude() {
     166    global $optionsName;
     167   
     168    $options         = get_option($optionsName);
     169    $EmailInclude    = $options['EmailInclude'];
     170    $emailChecked    = !isset($EmailInclude) || $EmailInclude =="include";
     171   
     172    printf( "<select id='plugin_EmailInclude' name='%s[EmailInclude]'>", $optionsName);
     173    printf( "<option value='include' %s>Include</option>", ($emailChecked  ?"selected='selected'":""));
     174    printf( "<option value='exclude' %s>Exclude</option>", (!$emailChecked  ?"selected='selected'":""));
     175    printf( "</select>");
    100176}
    101177
     
    104180    global $optionsName;
    105181   
    106     $options         = get_option($optionsName);
    107     $ButtonPlacement = $options['ButtonPlacement'];
    108     $trChecked  = !isset($ButtonPlacement) || $ButtonPlacement=="tr";
     182    $options         = get_option($optionsName);
     183    $ButtonPlacement = $options['ButtonPlacement'];
     184    $trChecked  = !isset($ButtonPlacement) || $ButtonPlacement=="tr";
    109185    $tlChecked  = $ButtonPlacement=="tl";
    110     $blChecked  = $ButtonPlacement=="bl";
    111     $brChecked  = $ButtonPlacement=="br";
    112    
     186    $blChecked  = $ButtonPlacement=="bl";
     187    $brChecked  = $ButtonPlacement=="br";
     188   
    113189    printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='tl' %s />", $optionsName, $tlChecked ?"checked='checked'":"");
    114     printf( "Top Left<br />\n");
    115 
    116     printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='tr' %s />", $optionsName, $trChecked  ?"checked='checked'":"");
    117     printf( "Top Right<br />\n");
    118    
    119     printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='bl' %s />", $optionsName, $blChecked  ?"checked='checked'":"");
    120     printf( "Bottom Left<br />\n");
    121    
    122     printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='br' %s />", $optionsName, $brChecked  ?"checked='checked'":"");
    123     printf( "Bottom Right<br />\n");
     190    printf( "Top Left<br />\n");
     191
     192    printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='tr' %s />", $optionsName, $trChecked  ?"checked='checked'":"");
     193    printf( "Top Right<br />\n");
     194   
     195    printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='bl' %s />", $optionsName, $blChecked  ?"checked='checked'":"");
     196    printf( "Bottom Left<br />\n");
     197   
     198    printf( "<input type='radio' id='plugin_buttonplacement' name='%s[ButtonPlacement]' value='br' %s />", $optionsName, $brChecked  ?"checked='checked'":"");
     199    printf( "Bottom Right<br />\n");
     200    printf("<tr><td  colspan='3'><h2>Google Analytics</h2><hr /></td></tr>");
    124201}
    125202
     
    128205    global $optionsName;
    129206   
    130     $options         = get_option($optionsName);
    131     $GASetting       = $options['GASetting'];
    132     $disabledChecked = !isset($GASetting) || $GASetting=="false";
     207    $options         = get_option($optionsName);
     208    $GASetting       = $options['GASetting'];
     209    $disabledChecked = !isset($GASetting) || $GASetting=="false";
    133210    $enabledChecked  = $GASetting;
    134211   
    135212    printf( "<input type='radio' id='plugin_gaOption' name='%s[GASetting]' value='true' %s />", $optionsName, $enabledChecked?"checked='checked'":"");
    136     printf( "Enabled<br />\n");
    137 
    138     printf( "<input type='radio' id='plugin_gaOption' name='%s[GASetting]' value='false' %s />", $optionsName, $disabledChecked ?"checked='checked'":"");
    139     printf( "Disabled\n");
     213    printf( "Enabled<br />\n");
     214
     215    printf( "<input type='radio' id='plugin_gaOption' name='%s[GASetting]' value='false' %s />", $optionsName, $disabledChecked ?"checked='checked'":"");
     216    printf( "Disabled<br /><br />\n");
    140217}
    141218
    142219function pluginQueryVars($vars) {
    143     global $pluginAttr;
    144     global $printAttr;
    145        
    146     array_push($vars, $printAttr,$pluginAttr);
     220    global $pluginAttr;
     221    global $printAttr;
     222       
     223    array_push($vars, $printAttr,$pluginAttr);
    147224    return $vars;
    148225}
     
    151228// Clean up the DB properties
    152229function sanitizeSettings($options) {
    153    global $oldBlogButtonUrl;
    154    global $blackButtonUrl;
     230   global $defaultLogoUrl;
    155231   
    156    $buttonUrl    = $options['buttonUrl'];
    157    $customButton = $options['customButton'];
    158 
    159    if (isset($buttonUrl) && $buttonUrl=="custom") {
    160       $options['buttonUrl'] = $customButton;
     232   $logoUrl              = $options['logoUrl'];
     233   $customLogo           = $options['customLogo'];
     234   $buttonColor          = $options['buttonColor'];
     235   $customPrintButton    = $options['customPrintButton'];
     236   $GASetting            = $options['GASetting'];
     237   $ButtonPlacement      = $options['ButtonPlacement'];
     238   
     239    if (isset($logoUrl) && $logoUrl!=$defaultLogoUrl) {
     240      $options['logoUrl'] = $customLogo;
     241   }
     242
     243   if (isset($buttonColor) && $buttonColor=="custom") {
     244      $options['buttonColor'] = $customPrintButton;
    161245   }
    162246
     
    176260// WP callback for initializing the options menu
    177261function initCleanPrintAdmin() {
    178     global $pluginName;
    179     global $pluginFile;
    180     global $optionsName;
    181    
    182     register_setting       ($optionsName, $optionsName, 'sanitizeSettings');
    183     register_uninstall_hook($pluginFile, 'addCleanPrintUninstallHook');
    184 
    185     add_settings_section   ('plugin_main', '',       'echoSectionText',    $pluginName);
    186     add_settings_field     ('plugin_buttonUrl',      'Print button image', 'echoButtonUrlSetting',     $pluginName, 'plugin_main');
    187     add_settings_field     ('plugin_buttonplacement','Button Placement',   'echoButtonPlacement',      $pluginName, 'plugin_main');
    188     add_settings_field     ('plugin_gaOption',       'Google analytics',   'echoGASetting',            $pluginName, 'plugin_main');
     262    global $pluginName;
     263    global $pluginFile;
     264    global $optionsName;
     265   
     266    register_setting       ($optionsName, $optionsName, 'sanitizeSettings');
     267    register_uninstall_hook($pluginFile, 'addCleanPrintUninstallHook');
     268
     269    add_settings_section   ('plugin_main', '',      'echoSectionText',    $pluginName);
     270    add_settings_field     ('plugin_logoUrl',       '<strong>Logo Image:</strong>',       'echoLogoUrlSetting',       $pluginName, 'plugin_main');
     271    add_settings_field     ('plugin_buttonColor',     '<strong>Button Style:</strong>', 'echoButtonColorSetting',     $pluginName, 'plugin_main');
     272    add_settings_field     ('plugin_PrintInclude',     '<strong>Print Button:</strong>', 'echoPrintInclude',     $pluginName, 'plugin_main');
     273    add_settings_field     ('plugin_PDFInclude',     '<strong>PDF Button:</strong>', 'echoPDFInclude',     $pluginName, 'plugin_main');
     274    add_settings_field     ('plugin_EmailInclude',     '<strong>Email Button:</strong>', 'echoEmailInclude',     $pluginName, 'plugin_main');
     275    add_settings_field     ('plugin_buttonplacement',      '<strong>Button Placement:</strong>',   'echoButtonPlacement',      $pluginName, 'plugin_main');
     276    add_settings_field     ('plugin_gaOption',      '<strong>Google Analytics CleanPrint event tracking:</strong>',   'echoGASetting',            $pluginName, 'plugin_main');
    189277}
    190278
    191279// Add the hooks for print functionality
    192280function addCleanPrintContentTags($content) {
    193    
    194     global $optionsName;
    195     global $blackButtonUrl;
    196            
    197     $options        = get_option($optionsName);
    198     $buttonUrl      = $options['buttonUrl'];
    199     $nothingChecked = !isset($buttonUrl);
    200     $removeChecked  =  isset($buttonUrl) && $buttonUrl=="none";
    201     $ButtonPlacement = $options['ButtonPlacement'];
    202     $width          = '100%';
    203        
     281   
     282    global $optionsName;
     283    global $blackPrintButtonUrl;
     284    global $buttonUrl;
     285           
     286    $options         = get_option($optionsName);
     287    $buttonColor     = $options['buttonColor'];
     288    $nothingChecked  = !isset($buttonColor);
     289    $removeChecked   = $options['PrintInclude'] == 'exclude' && $options['PDFInclude'] == 'exclude' && $options['EmailInclude'] == 'exclude';
     290    $ButtonPlacement = $options['ButtonPlacement'];
     291   
     292    if ($options['PrintInclude'] == 'include') {
     293        $displayPrint = 'inline';
     294    }else{
     295        $displayPrint = 'none';
     296    }
     297    if ($options['PDFInclude'] == 'include') {
     298        $displayPDF = 'inline';
     299    }else{
     300        $displayPDF = 'none';
     301    }
     302    if ($options['EmailInclude'] == 'include') {
     303        $displayEmail = 'inline';
     304    }else{
     305        $displayEmail = 'none';
     306    }
     307       
    204308    if ($nothingChecked) {
    205         $buttonUrl = $blackButtonUrl;
     309        $buttonColor = 'white';
    206310    }
    207311
    208     if ($removeChecked) {
    209 
     312    if ($removeChecked) {
     313        //dont add a button
    210314    } else if ($ButtonPlacement=="tl") {
    211         $content = sprintf("<a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='%s'></a><br />%s", $buttonUrl, $content);
    212     } else if ($ButtonPlacement=="tr") {
    213         $content = sprintf("<div style='text-align: right;'><a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='%s'></a></div><br />%s", $buttonUrl, $content);
    214     } else if($ButtonPlacement=="bl") {
    215         $content = sprintf("%s<br /><a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='%s'></a>", $content, $buttonUrl); 
    216     } else {
    217         $content = sprintf("%s<br /><div style='text-align: right;'><a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='%s'></a></div>", $content, $buttonUrl);   
    218     }
    219     return $content;
     315        $content = sprintf("<a style='display:$displayPrint' href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='$buttonUrl/CleanPrintBtn_$buttonColor.png' /></a><a style='display:$displayPDF' href='.' onClick='CleanPDF(); return false' class='button' title='PDF page'><img src='$buttonUrl/PdfBtn_$buttonColor.png' /></a><a style='display:$displayEmail' href='.' onClick='CleanEmail(); return false' class='button' title='Email page'><img src='$buttonUrl/EmailBtn_$buttonColor.png' /></a><br />%s", $content);
     316    } else if ($ButtonPlacement=="tr") {
     317        $content = sprintf("<div style='text-align: right;'><a style='display:$displayPrint' href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='$buttonUrl/CleanPrintBtn_$buttonColor.png' /></a><a style='display:$displayPDF' href='.' onClick='CleanPDF(); return false' class='button' title='PDF page'><img src='$buttonUrl/PdfBtn_$buttonColor.png' /></a><a style='display:$displayEmail' href='.' onClick='CleanEmail(); return false' class='button' title='Email page'><img src='$buttonUrl/EmailBtn_$buttonColor.png' /></a></div><br />%s", $content);
     318    } else if($ButtonPlacement=="bl") {
     319        $content = sprintf("%s<br /><a style='display:$displayPrint' href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='$buttonUrl/CleanPrintBtn_$buttonColor.png' /></a><a style='display:$displayPDF' href='.' onClick='CleanPDF(); return false' class='button' title='PDF page'><img src='$buttonUrl/PdfBtn_$buttonColor.png' /></a><a style='display:$displayEmail' href='.' onClick='CleanEmail(); return false' class='button' title='Email page'><img src='$buttonUrl/EmailBtn_$buttonColor.png' /></a>", $content);
     320    } else {
     321        $content = sprintf("%s<br /><div style='text-align: right;'><a style='display:$displayPrint' href='.' onClick='CleanPrint(); return false' class='button' title='Print page'><img src='$buttonUrl/CleanPrintBtn_$buttonColor.png' /></a><a style='display:$displayPDF' href='.' onClick='CleanPDF(); return false' class='button' title='PDF page'><img src='$buttonUrl/PdfBtn_$buttonColor.png' /></a><a style='display:$displayEmail' href='.' onClick='CleanEmail(); return false' class='button' title='Email page'><img src='$buttonUrl/EmailBtn_$buttonColor.png' /></a></div>", $content);   
     322    }
     323    return $content;
    220324}
    221325
     
    226330    global $cleanprintUrl;
    227331    global $publisherKey;
     332    global $defaultLogoUrl;
    228333   
    229     $options              = get_option($optionsName);
    230     $GASetting            = $options['GASetting'];
    231     $gravity              = $options['gravity'];
    232 
    233     if (!isset($gravity)) $gravity = "center";
    234    
    235         printf( "<script type='text/javascript'>\n");
    236         printf( "   function CleanPrint() {");
    237         printf( "   CleanPrintPrintHtml();\n");
    238         if ($GASetting=="true") {
    239             printf( "   _gaq.push(['_trackEvent', 'CleanPrint', 'Print']);\n");
    240         }
    241         printf( "   }");
    242         printf( "</script>\n");
    243    
    244     printf( "<script language='javascript' type='text/javascript' src='%s?key=%s'></script>\n", $cleanprintUrl, $publisherKey);
    245        
     334    $options              = get_option($optionsName);
     335    $GASetting            = $options['GASetting'];
     336    $gravity              = $options['gravity'];
     337    $logoUrl              = $options['logoUrl'];
     338    $customChecked        = isset($logoUrl) && $logoUrl!=$defaultLogoUrl;
     339   
     340    if (!isset($gravity)) $gravity = "center";
     341       
     342        printf( "<script type='text/javascript'>\n");
     343        printf( "   function CleanPrint() {");
     344        printf( "       CleanPrintPrintHtml();\n");
     345                        if ($GASetting=="true") {
     346                            printf( "   _gaq.push(['_trackEvent', 'CleanPrint', 'Print']);\n");
     347                        }
     348        printf( "   }");
     349        printf( "   function CleanEmail() {");
     350        printf( "       CleanPrintSendEmail();\n");
     351                        if ($GASetting=="true") {
     352                            printf( "   _gaq.push(['_trackEvent', 'CleanPrint', 'Email']);\n");
     353                        }
     354        printf( "   }");
     355        printf( "   function CleanPDF() {");
     356        printf( "       CleanPrintGeneratePdf();\n");
     357                        if ($GASetting=="true") {
     358                            printf( "   _gaq.push(['_trackEvent', 'CleanPrint', 'PDF']);\n");
     359                        }
     360        printf( "   }");
     361        printf( "</script>\n");
     362   
     363    printf( "<script language='javascript' type='text/javascript' src='%s?key=%s&logo=%s'></script>\n", $cleanprintUrl, $publisherKey, $customChecked ? $logoUrl : $defaultLogoUrl);
    246364}
    247365
     
    250368// Add the Settings menu link to the plugin page
    251369function addCleanPrintActions($links, $file) {
    252     global $pluginName;
     370    global $pluginName;
    253371    global $pluginFile;
    254372   
    255373    if ($file == $pluginFile) {
    256         $links[] = sprintf("<a href='options-general.php?page=%s'>Settings</a>", $pluginName);
    257     }
    258     return $links;
     374        $links[] = sprintf("<a href='options-general.php?page=%s'>Settings</a>", $pluginName);
     375    }
     376    return $links;
    259377}
    260378
     
    263381function addCleanPrintUninstallHook() {
    264382    // cannot use the global, chicken/egg problem
    265     delete_option('CleanPrintAdminOptions');
     383    delete_option('CleanPrintAdminOptions');
    266384}
    267385
  • cleanprint-lt/trunk/readme.txt

    r452539 r472905  
    22Contributors: johncadams, lucascolin
    33Donate link: http://www.formatdynamics.com/aboutus-contactus.php
    4 Tags: pdf, print, printer, printable, printing, widget, email, save, ads, advertise, revenue, optimize, output, edit, editing, eco-friendly, environmental, sustainable
     4Tags: pdf, print, printer, printable, printing, widget, email, save, ads, advertise, revenue, optimize, output, edit, editing, eco-friendly, environmental, sustainable, Reader, iPad, tablet, saving, ecological, eco, ink, printer friendly, print friendly, airprint, advertising, monetize, social, dropbox, output, plugin, saver, adsense
    55Requires at least: 2.0.2
    66Tested up to: 3.2
    7 Stable tag: 1.5.0
     7Stable tag: 2.0
    88 
    9 CleanPrint 4.0 – Efficient content output to print, PDF, email
     9CleanPrint 4.0 – Efficient content output to print, PDF, email, Dropbox (coming soon)
    1010
    1111== Description ==
    12 CleanPrint has processed hundreds of millions of print jobs on top 20 web sites. We’ve taken everything we’ve learned and built it into this economically and ecologically friendly print tool that saves paper, ink, and money for your users.
     12CleanPrint has processed hundreds of millions of print jobs on top web sites. We’ve taken everything we’ve learned and built it into this economically and ecologically friendly print tool that saves paper, ink, and money for your users.
    1313
    1414How CleanPrint Works
     
    3232</ul>
    3333
    34 Try CleanPrint at
    35 http://cpf.cleanprint.net/cpf/instructions.html.
     34For more info go to :
     35http://www.formatdynamics.com/cpconfig/
    3636
    3737== Installation ==
     
    39391. Log into your WordPress installation as an administrator.
    40402. On the navigation on the left hand side, click 'Plugins', then 'Add New' from the menu.
    41 3. Enable the CleanPrint plugin
    42 4. Visit the CleanPrint Settings for options
     413. Enable the CleanPrint plugin.
     424. Visit the CleanPrint Settings page, select the appropiate options and click "Save Changes".
    4343
    4444Print Button Removal
     
    4646If you prefer to use your own print link instead of one of the provided buttons you may do so by:
    4747
    48 1. Disable the Print button via the 'Remove' option in the CleanPrint Settings page.
     481. Disable the Print button via the 'exclude' button option in the CleanPrint Settings page.
    49492. Insert a hyperlink into your page as per the example below:
    50    * &lt;a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'&gt;Print&lt;/a&gt;
     50   * <a href='.' onClick='CleanPrint(); return false' class='button' title='Print page'>Print</a>
     51   * <a href='.' onClick='CleanEmail(); return false' class='button' title='Email page'>Email</a>
     52   * <a href='.' onClick='CleanPDF(); return false' class='button' title='PDF page'>Email</a>
    5153
    52 Below are paths to each of our standard buttons.
     54Below are paths to each of our standard Print buttons.
    5355
    54     Black        : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_black.png< br />
    55     White        : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_white.png<br />
    56     Transparent  : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_transparent.png<br />
    57     Text         : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_text.png<br />
     56    Black        : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_black.png
     57    White        : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_white.png
     58    Transparent  : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_transparent.png
     59    Text         : http://cache-02.cleanprint.net/media/pfviewer/images/CleanPrintBtn_text.png
     60
     61Below are paths to each of our standard PDF buttons.
     62
     63    Black        : http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_black.png
     64    White        : http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_white.png
     65    Transparent  : http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtnv_transparent.png
     66    Text         : http://cache-02.cleanprint.net/media/pfviewer/images/PdfBtn_text.png
     67
     68Below are paths to each of our standard Email buttons.
     69
     70    Black        : http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_black.png
     71    White        : http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_white.png
     72    Transparent  : http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_transparent.png
     73    Text         : http://cache-02.cleanprint.net/media/pfviewer/images/EmailBtn_text.png
    5874
    5975
     
    7894== Upgrade Notice ==
    7995
    80 All CleanPrint 1.0 users please upgrade to the 1.5 version.  We have upgraded our systems and are discontinuing the old.  The CleanPrint 1.1 termination date is 12/1/2011, if you have any questions please email tech@formatdynamics.com.
     96All CleanPrint 1.0 users please upgrade to the 1.5 version.  We have upgraded our systems and are discontinuing the old.  The CleanPrint 1.1 termination date is 1/1/2012, if you have any questions please email tech@formatdynamics.com.
    8197
    8298== Advertising ==
Note: See TracChangeset for help on using the changeset viewer.