Esempio n. 1
0
    /**
     * Display the widget update form
     * @param array $instance
     */
    function form($instance)
    {
        $link_id = $this->get_field_id('w_link');
        $img_id = $this->get_field_id('w_img');
        $defaults = array('w_link' => get_bloginfo('url'), 'w_img' => '', 'w_adv' => 'New Advertiser', 'w_resize' => 'no', 'w_new' => 'no');
        $instance = wp_parse_args((array) $instance, $defaults);
        $img = $instance['w_img'];
        $link = $instance['w_link'];
        $adv = $instance['w_adv'];
        ?>
        <div class="widget-content">
       <p style="text-align: center;" class="bs-proof">
           <?php 
        if ($instance['w_img']) {
            ?>
                Your ad is ready.
                <br/><br/><strong>Scaled Visual:</strong><br/>
                <div class="bs-proof"><img style="width:100%;" src="<?php 
            echo $instance['w_img'];
            ?>
" alt="Ad" /></div><br/>
           <?php 
        }
        ?>
           <a href="#" class="upload-button" rel="<?php 
        echo $img_id;
        ?>
">Click here to upload a new image.</a> You can also paste in an image URL below.
           
       </p>
       <input class="widefat tag" placeholder="Image URL" type="text" id="<?php 
        echo $img_id;
        ?>
" name="<?php 
        echo $this->get_field_name('w_img');
        ?>
" value="<?php 
        echo htmlentities($instance['w_img']);
        ?>
" />
       <br/><br/> 
       <p>
            <label for="<?php 
        echo $this->get_field_id('w_link');
        ?>
">Ad Click Destination:</label><br/>
            <input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('w_link');
        ?>
" name="<?php 
        echo $this->get_field_name('w_link');
        ?>
" value="<?php 
        echo $instance['w_link'];
        ?>
" />
        </p>
       <p>
            <label for="<?php 
        echo $this->get_field_id('w_adv');
        ?>
">Advertiser Name:</label><br/>
            <input class="widefat" type="text" id="<?php 
        echo $this->get_field_id('w_adv');
        ?>
" name="<?php 
        echo $this->get_field_name('w_adv');
        ?>
" value="<?php 
        echo $instance['w_adv'];
        ?>
" />
        </p>
       <p>
           <label for="<?php 
        echo $this->get_field_id('w_resize');
        ?>
">Auto Resize to Max Width? </label>
           <input type="checkbox" name="<?php 
        echo $this->get_field_name('w_resize');
        ?>
" value="yes"  <?php 
        if ($instance['w_resize'] == 'yes') {
            echo 'checked';
        }
        ?>
 />
       </p>
       <p>
           <label for="<?php 
        echo $this->get_field_id('w_new');
        ?>
">Open in New Window? </label>
           <input type="checkbox" name="<?php 
        echo $this->get_field_name('w_new');
        ?>
" value="yes"  <?php 
        if ($instance['w_new'] == 'yes') {
            echo 'checked';
        }
        ?>
 />
       </p>
       <p>
           <span style="color: green; font-weight: bold;">Tip:</span> If you're using this widget, you might also find <a target="_blank" href="http://broadstreetads.com/ad-platform/ad-formats/">our special ad formats for sales people and publishers</a> useful.
       </p>
       <?php 
        if (!Broadstreet_Adwidget_Mini_Utility::hasAdserving()) {
            ?>
        <p>
            When you're ready for a more powerful adserver with click reporting <a target="_blank" href="#" onclick="broadstreet_upgrade(); return false;">click here</a>.
            <script language="javascript">
                if(!window.broadstreet_upgrade)
                {
                    function broadstreet_upgrade()
                    {
                        window.send_to_editor = function(html) {
                            tb_remove();
                            alert('Save any unsaved widgets and refresh this page to see new upgraded options');
                        };

                        tb_show('Broadstreet', '<?php 
            echo bsadwidget_get_base_url('views/modal/');
            ?>
' + '?fake=fake&width=650&height=580&TB_iframe=true');
                    }
                }
            </script>
        </p>
        <?php 
        } elseif (isset($instance['bs_ad_id'])) {
            ?>
        <p>
            Reporting: <a target="_blank" href="#" onclick="broadstreet_reports(); return false;">View stats for clicks and views</a>
            <script language="javascript">
                if(!window.broadstreet_reports)
                {
                    function broadstreet_reports()
                    {
                        window.send_to_editor = function(html) {
                            tb_remove();
                        };

                        tb_show('Broadstreet', '<?php 
            echo bsadwidget_get_base_url('views/modal/?step=reports&adv_id=' . @$instance['bs_adv_id'] . '&ad_id=' . @$instance['bs_ad_id']);
            ?>
' + '&width=650&height=580&TB_iframe=true');
                    }
                }
            </script>
        </p>
        <?php 
        }
        ?>
        </div>
       <?php 
    }
Esempio n. 2
0
 /**
  * Get the base URL of the Broadstreet Mini vendor plugin
  * @param string $append A path to append to the base url
  * @return string The final path
  */
 public static function getBaseURL($append = false)
 {
     return bsadwidget_get_base_url($append);
 }