Plugin Directory

Changeset 843925


Ignore:
Timestamp:
01/23/2014 04:50:21 PM (12 years ago)
Author:
appendad
Message:

New targeting support

Location:
appendad/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • appendad/trunk/appendad.php

    r810173 r843925  
    22/* Plugin Name: AppendAd
    33Plugin URI: http://www.appendad.com/
    4 Version: 1.0.2
     4Version: 1.1.0
    55Description: 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.
    66Author: AppendAd
     
    4343if($ssb['synca']=="async"){
    4444    add_action( 'wp_footer', 'ssb_output_g' ); // if asynchronous then in footer
     45    add_action( 'wp_footer', 'ssb_page_data' );
    4546}elseif($ssb['synca']=="sync"){
    4647    add_action( 'wp_head', 'ssb_output_g' ); //else if synchronous then in header
     48        add_action( 'wp_footer', 'ssb_page_data' );
    4749}else  {
    4850    print_r($ssb);
     
    5557{
    5658
    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
     94function 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
     107function 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;
    89133}
    90134
     
    93137function ssb_output_g()
    94138{
    95     echo ssb_output();
     139    echo ssb_output();
    96140}
    97141
     
    162206
    163207                <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>
    165209        </div>
    166210    <?php
  • appendad/trunk/readme.txt

    r822450 r843925  
    66Donate link: http://vasuchawla.com/
    77Tested up to: 3.8
    8 Stable tag: 1.0.2
     8Stable tag: 1.1.0
    99
    1010
     
    3333
    3434== Upgrade Notice ==
     35= 1.1.0 =
     36Added support for targeting placements by author, tags and categories
    3537
    3638= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.