Changeset 843925
- Timestamp:
- 01/23/2014 04:50:21 PM (12 years ago)
- Location:
- appendad/trunk
- Files:
-
- 2 edited
-
appendad.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
appendad/trunk/appendad.php
r810173 r843925 2 2 /* Plugin Name: AppendAd 3 3 Plugin URI: http://www.appendad.com/ 4 Version: 1. 0.24 Version: 1.1.0 5 5 Description: AppendAd is the first platform that enables publishers to create new ad placements anywhere on their website in seconds and in any format, without programmers or graphic designers. These placements can be monetized with the publisher's existing ad inventory or through AppendAd certified ad networks. 6 6 Author: AppendAd … … 43 43 if($ssb['synca']=="async"){ 44 44 add_action( 'wp_footer', 'ssb_output_g' ); // if asynchronous then in footer 45 add_action( 'wp_footer', 'ssb_page_data' ); 45 46 }elseif($ssb['synca']=="sync"){ 46 47 add_action( 'wp_head', 'ssb_output_g' ); //else if synchronous then in header 48 add_action( 'wp_footer', 'ssb_page_data' ); 47 49 }else { 48 50 print_r($ssb); … … 55 57 { 56 58 57 //get the settings from database 58 $ssb = get_option("ssb_options"); 59 60 //adding the script result in a variable 61 $output = ""; 62 $output .= "<script> 63 (function(){ 64 "; 65 66 /// condition showing of script according to settings saved 67 if($ssb['acceler']=="true") 68 $output .="var apd_accelerate=1; 69 "; 70 71 /// condition showing of script according to settings saved 72 if($ssb['dynmic']=="true") 73 $output .="var apd_disabledynamic=1; 74 "; 75 76 $output .="var apd = document.createElement('script'); 77 apd.type = 'text/javascript'; apd.async = true; 78 apd.src = ('https:' == document.location.protocol || window.parent.location!=window.location ? 'https://secure' : 'http://cdn') + '.appendad.com/apd.js?id="; 79 80 //adding of site id in output 81 $output .= $ssb['site_id']; 82 83 84 $output .="';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(apd, s);})();</script>"; 85 86 //outpur created, now returning it back to the calling element ! 87 return $output; 88 59 //get the settings from database 60 $ssb = get_option("ssb_options"); 61 62 //adding the script result in a variable 63 $output = "<!-- AppendAd Site Tag - Start -->\n"; 64 $output .= "<script> 65 (function(){ 66 "; 67 68 /// condition showing of script according to settings saved 69 if($ssb['acceler']=="true") 70 $output .="var apd_accelerate=1; 71 "; 72 73 /// condition showing of script according to settings saved 74 if($ssb['dynmic']=="true") 75 $output .="var apd_disabledynamic=1; 76 "; 77 78 $output .="var apd = document.createElement('script'); 79 apd.type = 'text/javascript'; apd.async = true; 80 apd.src = ('https:' == document.location.protocol || window.parent.location!=window.location ? 'https://secure' : 'http://cdn') + '.appendad.com/apd.js?id="; 81 82 //adding of site id in output 83 $output .= $ssb['site_id']; 84 85 86 $output .="';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(apd, s);})();</script>"; 87 88 $output .= "\n<!-- AppendAd Site Tag - End -->\n\n"; 89 //outpur created, now returning it back to the calling element ! 90 return $output; 91 92 } 93 94 function ssb_page_data_demo() { 95 $output = "\n" . '<!-- AppendAd Targeting - Start --> 96 <div id="apdPageData" style="display:none;visibility:hidden;"> 97 <span id="apdPageData_categories">[categories]</span> 98 <span id="apdPageData_tags">[tags]</span> 99 <span id="apdPageData_author">[author]</span> 100 </div> 101 <!-- AppendAd Targeting - End -->'; 102 103 echo $output; 104 } 105 106 107 function ssb_page_data() { 108 global $post; 109 110 //Returns All category Items 111 $term_array = wp_get_post_terms($post->ID, 'category', array("fields" => "names")); 112 $category_list = ( empty($term_array) OR is_wp_error($term_array) ) ? '' : implode(',', $term_array); 113 114 //Returns Array of Tag Names 115 $term_array = wp_get_post_terms($post->ID, 'post_tag', array("fields" => "names")); 116 $tag_list = ( empty($term_array) OR is_wp_error($term_array) ) ? '' : implode(',', $term_array); 117 118 $display_name = get_the_author_meta('display_name'); 119 $display_name = ( empty($display_name) OR is_wp_error($display_name) ) ? '' : $display_name; 120 121 $output = "\n" . '<!-- AppendAd Targeting - Start -->'; 122 $output .= "\n" . '<div id="apdPageData" style="display:none;visibility:hidden;">'; 123 $output .= "\n\t" . '<span id="apdPageData_categories">' . $category_list . '</span>'; 124 125 if(is_single()) { 126 $output .= "\n\t" . '<span id="apdPageData_tags">' . $tag_list . '</span>'; 127 $output .= "\n\t" . '<span id="apdPageData_author">' . $display_name . '</span>'; 128 } 129 130 $output .= "\n" . "</div>\n<!-- AppendAd Targeting - End -->"; 131 132 echo $output; 89 133 } 90 134 … … 93 137 function ssb_output_g() 94 138 { 95 echo ssb_output();139 echo ssb_output(); 96 140 } 97 141 … … 162 206 163 207 <p>The following code will be embedded in your site's template:<br /> 164 <textarea style="width: 77%;height: 142px;" class="result_demo"><?php echo htmlentities(ssb_output());?></textarea></p>208 <textarea style="width: 77%;height: 342px;" class="result_demo"><?php echo htmlentities(ssb_output());echo htmlentities(ssb_page_data_demo());?></textarea></p> 165 209 </div> 166 210 <?php -
appendad/trunk/readme.txt
r822450 r843925 6 6 Donate link: http://vasuchawla.com/ 7 7 Tested up to: 3.8 8 Stable tag: 1. 0.28 Stable tag: 1.1.0 9 9 10 10 … … 33 33 34 34 == Upgrade Notice == 35 = 1.1.0 = 36 Added support for targeting placements by author, tags and categories 35 37 36 38 = 1.0.2 =
Note: See TracChangeset
for help on using the changeset viewer.