Plugin Directory

Changeset 586317


Ignore:
Timestamp:
08/16/2012 06:01:16 PM (14 years ago)
Author:
siteapps
Message:

update tag, tag type option included

Location:
siteapps/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • siteapps/trunk/insert_id.tpl

    r405788 r586317  
    1919                                        </td>
    2020                                    </tr>
     21                                    <tr>
     22                                        <th valign="top" scrope="row">
     23                                            <label for="sa_id">Tag Type:</label><br>
     24                                        </th>
     25                                        <td valign="top">
     26                                            <input type="radio" value="1" name="sa_tag_type" checked="true">Synchronous
     27                                            <input type="radio" value="2" name="sa_tag_type">Asynchronous
     28                                        </td>
     29                                    </tr>
    2130                                </tbody>
    2231                            </table>                     
  • siteapps/trunk/siteapps.php

    r405788 r586317  
    8383   }
    8484   
    85    public static function getTag($id) {
    86       return '
    87       <script type="text/javascript">
    88         //<![CDATA[[
    89         $SA={s:'.$id.'};
    90         (function(){
    91             var sa = document.createElement("script"); sa.type = "text/javascript"; sa.async = true;
    92             sa.src = ("https:" == document.location.protocol ? "https://sj" : "http://j") + ".siteapps.com/sa.js";
    93             var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(sa, t);
    94         })();
    95         //]]>
    96       </script>
    97       ';
     85   public static function getTag($id, $type) {
     86       if($type === 1) {
     87       return '<script type="text/javascript">
     88            //<![CDATA[[
     89            $SA={s:'.$id.'};
     90            document.write(unescape("%3Cscript src=\'" + ("https:" == document.location.protocol ? "https://" + $SA.s + ".sa" : "http://" + $SA.s + ".a") + ".siteapps.com/" + $SA.s + ".js\' type=\'text/javascript\'%3E%3C/script%3E"));
     91            //]]>
     92            </script>';
     93       }
     94       return '<script type="text/javascript">
     95            //<![CDATA[[
     96            $SA={s:'.$id.',asynch:1};
     97            (function(){
     98                var sa = document.createElement("script"); sa.type = "text/javascript"; sa.async = true;
     99                sa.src = ("https:" == document.location.protocol ? "https://" + $SA.s + ".sa" : "http://" + $SA.s + ".a") + ".siteapps.com/" + $SA.s + ".js";
     100                var t = document.getElementsByTagName("script")[0]; t.parentNode.insertBefore(sa, t);
     101            })();
     102            //]]>
     103            </script>';
     104       
    98105   }
    99106   
     
    130137         
    131138         $options['id'] = (int) $_POST['sa_id'];
    132          $options['tag'] = SiteAppsPlugin::getTag($options['id']);
     139         $options['type'] = (int) $_POST['sa_tag_type'];
     140         $options['tag'] = SiteAppsPlugin::getTag($options['id'],$options['type']);
    133141         update_option('SiteAppsId', $options);
    134142         
Note: See TracChangeset for help on using the changeset viewer.