Changeset 416668
- Timestamp:
- 07/28/2011 10:30:34 PM (15 years ago)
- Location:
- simplereach-slide/trunk
- Files:
-
- 1 deleted
- 5 edited
-
images (deleted)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (modified) (previous)
-
srslide.php (modified) (1 diff)
-
srslide_admin.php (modified) (6 diffs)
-
srslide_functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simplereach-slide/trunk/readme.txt
r413935 r416668 1 1 === SimpleReach Slide === 2 Tags: slide, simplereach, content, recommendation, relevant, related, pageviews, traffic, plugin, widget, thumbnails, headlines, articles, links2 Tags: articles, content, headlines, links, pageviews, plugin, recommendation, related, relevant, simplereach, slide, thumbnails, traffic, widget, posts, slider, flyout, fly-out, best, readers, engagement 3 3 Contributors: elubow 4 Plugin Name: SimpleReach Slide4 Plugin Name: The Slide by SimpleReach 5 5 Plugin URI: https://github.com/simplereach/srslide_wordpress 6 6 Requires at least: 2.7 7 7 Tested up to: 3.2.1 8 Stable tag: trunk8 Stable tag: 0.4.7 9 9 10 The S impleReach Slide recommends related posts on a widget that "slides" in at the bottom of the page -- increasing pageviews and time spent on site.10 The Slide recommends related posts from within your site on a widget that "slides" in at the bottom of the page. 11 11 12 12 == Description == 13 The S impleReach Slideis the best way to help readers discover more of your content.13 The Slide by SimpleReach is the best way to help readers discover more of your content. 14 14 15 The Slide recommends related posts on a widget that "slides" in at the bottom of the page -- increasing pageviews and time spent on your site. You've seen a similar content recommendation widget on sites like NYTimes.com, and now SimpleReach is allowing anybody to take advantage of this awesome plugin for free. 15 The Slide recommends related posts from within your site on a widget that "slides" in at the bottom of the page. You've seen a similar content recommendation widget on sites like NYTimes.com, and now SimpleReach is allowing anybody to take advantage of this awesome plugin for free. 16 17 NOTE: After installation, you must go to _Settings -> SimpleReach Slide_ in your plugins list to turn on The Slide 16 18 17 19 If you have any questions, please contact us at info@simplereach.com or visit our [website](https://www.simplereach.com/). 18 20 19 = Highlights = 20 * Boost sharing on Twitter, Facebook, and Google +1 with embedded social buttons 21 * Access full Reporting/Analytics Dashboard at SimpleReach.com 22 * Customize The Slide's look and feel 21 = Benefits = 22 * Increased pageviews and time on site 23 * Increased sharing on Twitter, Facebook and Google +1 via embedded social buttons 24 * Access to full analytics in 'Reports' at SimpleReach.com 25 * Customize The Slide's style and functionality 23 26 * Allow readers to opt-out 24 27 25 28 = Technology = 26 Content recommendations are based on SimpleReach's proprietary targeting algorithm. Variables include: 27 * Contextual, behavioral, and sentiment analysis 29 * Contextual, behavioral and sentiment analysis 28 30 * Posts most likely to be shared on social networks 29 31 * Posts related to socially trending topics 30 32 31 SimpleReach uses _asynchronous loading_ and will not affect the load time of your pages. 32 33 Content recommendations are determined by SimpleReach's proprietary targeting algorithm, which factors in the above variables. The Slide uses ‘asynchronous loading’ and will not affect the load time of your pages. 33 34 34 35 == Installation == … … 36 37 2. Log in to yourdomain.com/wp-admin 37 38 3. Click Plugins -> Add New -> Upload 38 4. After installation, go to Settings -> SimpleReach Slide and register for a SimpleReach account39 4. After installation, you must go to _Settings -> SimpleReach Slide_ in your plugins list to turn on The Slide 39 40 5. You're finished! 40 41 … … 53 54 54 55 == Changelog == 56 57 = 0.4.7 = 58 * Ability to change Slide styling 59 * Verbage fixes 55 60 56 61 = 0.4.6 = -
simplereach-slide/trunk/srslide.php
r413935 r416668 1 1 <?php 2 2 /* 3 Plugin Name: SimpleReach Slide3 Plugin Name: The Slide by SimpleReach 4 4 Plugin URI: https://www.simplereach.com 5 5 Description: After installation, you must click '<a href='options-general.php?page=SimpleReach-Slide'>Settings → SimpleReach Slide</a>' to turn on The Slide. 6 Version: 0.4. 66 Version: 0.4.7 7 7 Author: SimpleReach 8 8 Author URI: https://www.simplereach.com -
simplereach-slide/trunk/srslide_admin.php
r413935 r416668 14 14 array_push($errors, "Header text cannot be more than 30 characters."); 15 15 } else { 16 update_option('srslide_header_text',$_POST['srslide_header_text']); 16 update_option('srslide_header_text', strtoupper($_POST['srslide_header_text']) ); 17 } 18 19 // Convert the style settings into a hash and save it 20 $style_hash = create_style_hash($_POST); 21 update_option('srslide_styles',$style_hash); 22 $style_error = update_slide_styles(); 23 if ($style_error != "OK") { 24 array_push($errors, $style_error); 17 25 } 18 26 … … 20 28 if (count($errors) == 0) { 21 29 ?> 22 <div class="updated"><p><strong><?php _e('Options saved. '); ?></strong></p></div>30 <div class="updated"><p><strong><?php _e('Options saved. If you shifted The Slide position or adjusted the link color, it could take up to 15 minutes for your changes to take effect.'); ?></strong></p></div> 23 31 <?php 24 32 } else { … … 43 51 foreach($_POST as $name => $value) { 44 52 // Only pass vars that start with srslide_sr 45 if (!preg_match('/^srslide_sr_.+/',$name)) { next; }53 if (!preg_match('/^srslide_sr_.+/',$name)) { continue; } 46 54 $encoded_params .= urlencode($name).'='.urlencode($value).'&'; 47 55 } … … 106 114 107 115 <div class="wrap"> 108 <?php echo "<h2>" . __( ' SimpleReach Slide', 'srslide_adminopt' ) . "</h2>"; ?>116 <?php echo "<h2>" . __( 'The Slide by SimpleReach', 'srslide_adminopt' ) . "</h2>"; ?> 109 117 110 118 <?php if ($sr_is_registered) { … … 113 121 $srlogin = get_option('srslide_sr_login'); 114 122 $srslide_header_text = get_option('srslide_header_text'); 123 $srslide_style = get_option('srslide_styles'); 115 124 $debug_info = create_debug_info(); 116 125 … … 136 145 <hr /> 137 146 138 <?php echo "<h3>" . __(' SlideSettings', 'srslide_adminopt') . "</h3>"; ?>147 <?php echo "<h3>" . __('Display Settings', 'srslide_adminopt') . "</h3>"; ?> 139 148 140 149 <div style='float:left;'> 141 150 <form name="srslide_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 151 142 152 <input type="hidden" name="srslide_save_hidden" value="Y"> 143 153 144 <table border='0' cellspacing='5'> 154 <table border='0'> 155 <tr> 156 <td> 157 <div style='margin-bottom:40px;'><?php _e("Edit Header (Max 30 char):"); ?></div> 158 </td> 159 <td colspan='2'> 160 <div style='margin-bottom:20px;'> 161 <input style='width:220px;' type="textbox" name="srslide_header_text" value='<?php echo $srslide_header_text; ?>' /><br /> 162 <span style='font-size:10px;'><?php _e("All letters will be uppercase."); ?> (<?php _e("Default: RECOMMENDED FOR YOU"); ?>)</span> 163 </div> 164 </td> 165 </tr> 166 167 <tr> 168 <td colspan='3'> 169 <div style='margin-bottom:10px;'> 170 <div style='margin-top:5px;float:left;width:80px;overflow:hidden;'><?php _e("Link Color:"); ?></div> 171 <?php 172 $srslide_default_link_colors = array('#FE3F10', '#3B5998', '#CC0000'); 173 foreach ($srslide_default_link_colors as $color) { 174 ?> 175 <div style='margin-top:7px;margin-left:5px;width:40px;overflow:hidden;float:left;'> 176 <input type='radio' style='float:left;margin-top:3px;' name='srslide_style_link_color' value='<?php echo $color; ?>' <?php if ($srslide_style['link']['color'] == $color) { echo "CHECKED"; } ?>> 177 <div style='border:1px solid;background-color:<?php echo $color; ?>;float:left;width:15px;height:15px;margin-left:5px;'></div> 178 </div> 179 <?php 180 } 181 ?> 182 <input type='radio' name='srslide_style_link_color' value='other' <?php if (!in_array($srslide_style['link']['color'],$srslide_default_link_colors)) { echo "CHECKED"; } ?> style='margin-top:10px;float:left;margin-left:10px;'> <input style='margin-top:3px;width:60px;margin-left:-15px;' type="textbox" name="srslide_style_link_color_text" value='<?php if (!in_array($srslide_style['link']['color'],$srslide_default_link_colors)) { echo "{$srslide_style['link']['color']}"; } ?>' /> 183 <div style='margin-left:8px;font-size:12px;float:left;width:80px;overflow:hidden;line-height:16px;'><?php _e("hex code "); ?><br /><span style='font-size:10px;'><?php _e("(eg #FE3F10):"); ?></span></div> 184 </div> 185 </div> 186 </td> 187 </tr> 188 189 <tr> 190 <td colspan='3'> 191 <span style='line-height:50px;'><?php _e("Shift The Slide up by: "); ?></span> 192 <select name='srslide_style_element_bottom'> 193 <option value='0px' <?php if ($srslide_style['element']['bottom'] == '0px') { echo "SELECTED"; } ?>>0px</option> 194 <option value='30px' <?php if ($srslide_style['element']['bottom'] == '30px') { echo "SELECTED"; } ?>>30px</option> 195 <option value='40px' <?php if ($srslide_style['element']['bottom'] == '40px') { echo "SELECTED"; } ?>>40px</option> 196 <option value='50px' <?php if ($srslide_style['element']['bottom'] == '50px') { echo "SELECTED"; } ?>>50px</option> 197 <option value='60px' <?php if ($srslide_style['element']['bottom'] == '60px') { echo "SELECTED"; } ?>>60px</option> 198 </select> 199 </td> 200 </tr> 201 145 202 <tr> 146 203 <td colspan='3'> 147 204 <input type="checkbox" name="srslide_show_logo" <?php echo $slide_show_logo; ?> /> 148 <span style='line-height:35px;'><?php _e("I would like to display The Slide logo (increases engagement)"); ?></span> 149 </td> 150 </tr> 151 152 <tr> 153 <td> 154 <span><?php _e("Edit Header (Max 30 char):"); ?></span> 155 </td> 156 <td colspan='2'> 157 <input style='width:220px;' type="textbox" name="srslide_header_text" value='<?php echo $srslide_header_text; ?>' /> 158 </td> 159 </tr> 160 <tr> 161 <td> </td> 162 <td colspan='2'> 163 <span style='font-size:10px;'>(<?php _e("default: RECOMMENDED FOR YOU"); ?>)</span> 164 </td> 165 </tr> 166 167 168 <tr> 169 <td style='text-align:right' colspan='3'> 170 <input style="font-size:14px;margin-top:5px;" type="submit" name="Submit" value="<?php _e('Save', 'srslide_adminopt' ); ?>" /> 205 <span style='line-height:25px;'><?php _e("Display The Slide logo (increases engagement)"); ?></span> 171 206 </td> 172 207 </tr> 173 208 </table> 209 210 <input style="font-size:14px;margin-top:15px;padding:4px;" type="submit" name="Submit" value="<?php _e('Save', 'srslide_adminopt' ); ?>" /> 174 211 </form> 175 212 </div> 176 213 177 214 <div style='float:right;'> 178 <img style='margin-bottom:25px;border:1px solid;' src='/wp-content/plugins/srslide_wordpress/ images/example.png'>215 <img style='margin-bottom:25px;border:1px solid;' src='/wp-content/plugins/srslide_wordpress/screenshot-1.png'> 179 216 </div> 180 217 -
simplereach-slide/trunk/srslide_functions.php
r413935 r416668 11 11 function sr_plugin_version() 12 12 { 13 return "0.4.6"; 13 return "0.4.7"; 14 } 15 16 /** 17 * Convert the $_POST variable into a style hash 18 * 19 * @author Eric Lubow <elubow@simplereach.com> 20 * @param Object $POST Post object being shown on the page 21 * @return Array $style An associative array of styles for The Slide 22 */ 23 function create_style_hash($POST) 24 { 25 $style = array(); 26 27 // Iterate over our $_POST var and rip out the styles to put into a hash 28 foreach ($POST as $name => $value) { 29 if (!preg_match('/^srslide_style_(.+?)_(.+?)$/',$name,$style_name)) { continue; } 30 $style[$style_name[1]][$style_name[2]] = $value; 31 } 32 33 return clean_style_options($style); 34 } 35 36 /** 37 * Remove the extra style options prior to save/send to SimpleReach 38 * 39 * @author Eric Lubow <elubow@simplereach.com> 40 * @param Array $style The associative array of styles for The Slide 41 * @return Array $style The clean associative array of styles for The Slide 42 */ 43 function clean_style_options($style) 44 { 45 // Remove the link_color_text and just have link_color 46 if ($style['link']['color'] == 'other') { 47 $style['link']['color'] = check_hash($style['link']['color_text']); 48 } 49 unset($style['link']['color_text']); 50 51 return $style; 52 } 53 54 /** 55 * Add the leading '#' to a string if it doesn't exist 56 * 57 * @author Eric Lubow <elubow@simplereach.com> 58 * @param String $value Any string 59 * @return String $value String with the '#' added 60 */ 61 function check_hash($val) 62 { 63 if (preg_match('/^#/',$val)) { 64 return $val; 65 } else { 66 return "#{$val}"; 67 } 14 68 } 15 69 … … 69 123 $wptags = wp_get_post_tags($post->ID); 70 124 foreach ($wptags as $tag) { 71 $tags .= addslashes($tag->name). ",";125 $tags .= $tag->name . ","; 72 126 } 73 127 $tags = rtrim($tags,","); 74 128 } 75 129 76 return $tags;130 return addslashes($tags); 77 131 } 78 132 … … 83 137 * @author Eric Lubow <elubow@simplereach.com> 84 138 * @param Object $post_data The result of the $_POST data from the registration 85 * @return N ne139 * @return None 86 140 */ 87 141 function set_srslide_defaults($post_data) … … 93 147 94 148 update_option('srslide_header_text','RECOMMENDED FOR YOU'); 149 150 $style_defaults = array( 151 'element' => array( 152 'bottom' => '0px' 153 ), 154 'link' => array( 155 'color' => 'FE3F10' 156 ) 157 ); 158 update_option('srslide_styles',$style_defaults); 159 } 160 161 162 /** 163 * Update The Slide styles on the SimpleReach site 164 * 165 * @author Eric Lubow <elubow@simplereach.com> 166 * @param Array $styles Style to be converted to JSON 167 * @return String OK or error string 168 */ 169 function update_slide_styles() 170 { 171 // Pull all the necessary options 172 $srpid = get_option('srslide_pid'); 173 $srlogin = get_option('srslide_sr_login'); 174 $srapi_key = get_option('srslide_api_key'); 175 $srslide_style = get_option('srslide_styles'); 176 177 // Setup our POST parameters 178 $encoded_params = 'ts='.(int)gmdate('U').'&'; 179 $encoded_params .= "pid=".urlencode($srpid)."&"; 180 $encoded_params .= "login=".urlencode($srlogin)."&"; 181 182 // Handle if the user's API key isn't saved in WP 183 if (strlen($srapi_key) != 32) { 184 $encoded_params .= "pass=".urlencode(get_option('srslide_sr_pass'))."&"; 185 } else { 186 $encoded_params .= "api_key=".urlencode($srapi_key)."&"; 187 } 188 189 // Add the styles to the POST 190 $style_array = array('style' => get_option('srslide_styles')); 191 $encoded_params .= http_build_query($style_array); 192 193 // Curl call for registration 194 $curl = curl_init(); 195 curl_setopt($curl, CURLOPT_URL, "https://www.simplereach.com/publisher/generate_slide_css"); 196 curl_setopt($curl, CURLOPT_POST, count(explode('&',$encoded_params))); 197 curl_setopt($curl, CURLOPT_POSTFIELDS, $encoded_params); 198 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 199 $curl_resp = curl_exec($curl); 200 curl_close($curl); 201 202 // Decode the JSON 203 $resp = json_decode($curl_resp); 204 205 if ($resp->{'success'}) { 206 return "OK"; 207 } else { 208 if ($resp->{'error'} == 'Incorrect Timestamp') { 209 return "There was an error while you were attempting to register. Please try again or contact <a href='mailto:support@simplereach.com'>SimpleReach support</a> if you believe you have received this message in error."; 210 } else if ($resp->{'error'} == 'Invalid Password') { 211 return "The user name that you are attempting to register with already exists, but the password you entered was incorrect. Please try again or contact <a href='mailto:support@simplereach.com'>SimpleReach support</a> if you believe you have received this message in error."; 212 } else { 213 // We should never get here 214 return "There was an error contacting SimpleReach. Please try saving your options again."; 215 } 216 } 217 218 // We should never get here either 219 return "There was an error contacting SimpleReach. Please try your re-saving your options."; 95 220 } 96 221
Note: See TracChangeset
for help on using the changeset viewer.