Exemplo n.º 1
0
        public function settings_html()
        {
            if (!get_option('goracash_idw')) {
                printf('<div class="alert alert-warning"><strong>%s</strong>: %s <a href="https://account.goracash.com/my/tokens">%s</a></div>', __('Warning', 'goracash'), __('Your affiliate ID is missing.', 'goracash'), __('Learn more', 'goracash'));
            }
            $this->check_api_credentials();
            ob_start();
            submit_button();
            $button = ob_get_clean();
            ob_start();
            settings_fields('goracash_settings');
            $settings = ob_get_clean();
            printf('<h1>%s</h1>
                <form method="post" action="options.php">
                    %s
                    <h3 class="title">%s</h3>
                    <p>%s <a href="https://account.goracash.com/signup?utm_source=wordpress">%s</a></p>
                    <table class="form-table">
                        <tbody>
                            <tr>
                                <th><label for="goracash_idw">%s</label></th>
                                <td>
                                    <input type="text" name="goracash_idw" id="goracash_idw" value="%s" class="regular-text" size="4" style="width: 50px;" maxlength="4" />
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_client_id">%s</label></th>
                                <td>
                                    <input type="text" name="goracash_client_id" id="goracash_client_id" value="%s" class="regular-text" />
                                    <span class="description">%s <a href="https://account.goracash.com/my/tokens">%s</a></span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_client_secret">%s</label></th>
                                <td>
                                    <input type="text" name="goracash_client_secret" id="goracash_client_secret" value="%s" class="regular-text" />
                                    <span class="description">%s <a href="https://account.goracash.com/my/tokens">%s</a></span>
                                </td>
                            </tr>
                        </tbody>
                    </table>

                    <h3 class="title">%s</h3>
                    <p>%s</p>
                    <table class="form-table">
                        <tbody>
                            <tr>
                                <th><label for="goracash_ads_thematic">%s</label></th>
                                <td>
                                    <select name="goracash_ads_thematic" id="goracash_ads_thematic">
                                        %s
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_advertiser">%s</label></th>
                                <td>
                                    <select name="goracash_ads_advertiser" id="goracash_ads_advertiser">
                                        %s
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_default_lang">%s</label></th>
                                <td>
                                    <select name="goracash_ads_default_lang" id="goracash_ads_default_lang">
                                        %s
                                    </select>
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_default_market">%s</label></th>
                                <td>
                                    <select name="goracash_ads_default_market" id="goracash_ads_default_market">
                                        %s
                                    </select>
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_force_ssl">%s</label></th>
                                <td>
                                    <input type="checkbox" name="goracash_ads_force_ssl" id="goracash_ads_force_ssl" value="1" %s />
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_popexit">%s</label></th>
                                <td>
                                    <input type="checkbox" name="goracash_ads_popexit" id="goracash_ads_popexit" value="1" %s />
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th><label for="goracash_ads_top_bar">%s</label></th>
                                <td>
                                    <input type="checkbox" name="goracash_ads_top_bar" id="goracash_ads_top_bar" value="1" %s />
                                    <span class="description">%s</span>
                                </td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>%s</td>
                            </tr>
                        </tbody>
                    </table>
                </form>', get_admin_page_title(), $settings, __('General settings', 'goracash'), __('To use our different tools, you need a Goracash account.', 'goracash'), __('Create a free account', 'goracash'), __('Identifier', 'goracash'), get_option('goracash_idw'), __('This ID is 4 digits and are located at the top right of your affiliate interface', 'goracash'), __('Your API client ID', 'goracash'), get_option('goracash_client_id'), __('This identifier is generated in your affiliate interface.', 'goracash'), __('Learn more', 'goracash'), __('Your API secret Key', 'goracash'), get_option('goracash_client_secret'), __('This information is provided to you in your affiliate interface.', 'goracash'), __('Learn more', 'goracash'), __('Content settings', 'goracash'), __('This section allows you to specify the default settings to all content you use, they can be overloaded by the individual on.', 'goracash'), __('Thematic', 'goracash'), $this->get_dropdown(Goracash_Banner::get_thematics(), get_option('goracash_ads_thematic')), __('Advertiser', 'goracash'), $this->get_dropdown(Goracash_Banner::get_advertisers(), get_option('goracash_ads_advertiser')), __('Default language', 'goracash'), $this->get_dropdown(Goracash_Banner::get_langs(), get_option('goracash_ads_default_lang')), __('This language will be used in case we do not detect the language of the user.', 'goracash'), __('Default market', 'goracash'), $this->get_dropdown(Goracash_Banner::get_markets(), get_option('goracash_ads_default_market')), __('This market will be used in case we did not detect the location of the user.', 'goracash'), __('Forcing SSL', 'goracash'), get_option('goracash_ads_force_ssl') ? 'checked="checked"' : '', __('This option allows you to force all request in safe mode.', 'goracash'), __('Enable Pop-Exit', 'goracash'), get_option('goracash_ads_popexit') ? 'checked="checked"' : '', __('This option enables our popexit on your entire site.', 'goracash'), __('Enable Top-Bar', 'goracash'), get_option('goracash_ads_top_bar') ? 'checked="checked"' : '', __('This option enables our top bar on your entire site.', 'goracash'), $button);
        }
Exemplo n.º 2
0
 public function form($instance)
 {
     printf('
         <p><em>%s</em></p>
         <p>
             <label for="%s">%s :</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         <p>
             <label for="%s">%s :</label>
             <select class="widefat" id="%s" name="%s" type="text">
                 <option value="">%s</option>
                 %s
             </select>
         </p>
         <p>
             <label for="%s">%s :</label>
             <select class="widefat" id="%s" name="%s" type="text">
                 %s
             </select>
         </p>
         <p>
             <label for="%s">%s :</label>
             <select class="widefat" id="%s" name="%s" type="text">
                 <option value="">%s</option>
                 %s
             </select>
         </p>
         <p>
             <label for="%s">%s :</label>
             <select class="widefat" id="%s" name="%s" type="text">
                 <option value="">%s</option>
                 %s
             </select>
         </p>
         <p>
             <label for="%s">%s :</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         <p>
             <label for="%s">%s :</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         <p>
             <label for="%s">%s</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         <p>
             <label for="%s">%s</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         <p>
             <label for="%s">%s</label>
             <input class="widefat" id="%s" name="%s" type="text" value="%s" />
         </p>
         ', __('All fields are optional.', 'goracash'), $this->get_field_name('title'), __('Title', 'goracash'), $this->get_field_id('title'), $this->get_field_name('title'), $this->get_value('title', $instance, ''), $this->get_field_name('thematic'), __('Thematic', 'goracash'), $this->get_field_id('thematic'), $this->get_field_name('thematic'), __('By default', 'goracash'), $this->get_dropdown(Goracash_Banner::get_thematics(), $this->get_value('thematic', $instance, '')), $this->get_field_name('advertiser'), __('Advertiser', 'goracash'), $this->get_field_id('advertiser'), $this->get_field_name('advertiser'), $this->get_dropdown(Goracash_Banner::get_advertisers(), $this->get_value('advertiser', $instance, '')), $this->get_field_name('defaultLanguage'), __('Default language', 'goracash'), $this->get_field_id('defaultLanguage'), $this->get_field_name('defaultLanguage'), __('By default', 'goracash'), $this->get_dropdown(Goracash_Banner::get_langs(), $this->get_value('defaultLanguage', $instance, '')), $this->get_field_name('defaultMarket'), __('Default market', 'goracash'), $this->get_field_id('defaultMarket'), $this->get_field_name('defaultMarket'), __('By default', 'goracash'), $this->get_dropdown(Goracash_Banner::get_markets(), $this->get_value('defaultMarket', $instance, '')), $this->get_field_name('tracker'), __('Your tracker', 'goracash'), $this->get_field_id('tracker'), $this->get_field_name('tracker'), $this->get_value('tracker', $instance, ''), $this->get_field_name('minWidth'), __('Minimum width (in px)', 'goracash'), $this->get_field_id('minWidth'), $this->get_field_name('minWidth'), $this->get_value('minWidth', $instance, ''), $this->get_field_name('maxWidth'), __('Maximum width (in px)', 'goracash'), $this->get_field_id('maxWidth'), $this->get_field_name('maxWidth'), $this->get_value('maxWidth', $instance, ''), $this->get_field_name('minHeight'), __('Minimum height (in px)', 'goracash'), $this->get_field_id('minHeight'), $this->get_field_name('minHeight'), $this->get_value('minHeight', $instance, ''), $this->get_field_name('maxHeight'), __('Maximum height (in px)', 'goracash'), $this->get_field_id('maxHeight'), $this->get_field_name('maxHeight'), $this->get_value('maxHeight', $instance, ''));
 }