function addthis_plugin_options_php4()
    {
        global $current_user;
        $user_id = $current_user->ID;
        global $addThisConfigs;
        $options = $addThisConfigs->getConfigs();
        global $cmsConnector;
        if (get_user_meta($user_id, 'addthis_nag_updated_options')) {
            delete_user_meta($user_id, 'addthis_nag_updated_options', 'true');
        }
        ?>
        <div class="wrap">
            <h2 class='placeholder'>&nbsp;</h2>

            <form
                id="addthis-settings"
                method="post"
                action="options.php"
            >
                <?php 
        // use the old-school settings style in older versions of wordpress
        if ($cmsConnector->getCmsMinorVersion() >= 2.7 || $cmsConnector->assumeLatest()) {
            settings_fields('addthis');
        } else {
            wp_nonce_field('update-options');
        }
        ?>

                <div class="Header">
                    <h1><em>AddThis</em> Sharing Buttons</h1>
                </div>

                <?php 
        if (_addthis_is_csr_form()) {
            // Get Confirmation form
            echo addthis_profile_id_csr_confirmation();
        } else {
            addthis_wordpress_mode_tabs();
        }
        ?>

                <div class="Btn-container-end">
                    <?php 
        echo _addthis_settings_buttons();
        ?>
                    <p>
                        <small>
                            <?php 
        echo _addthis_eula_text();
        ?>
                        </small>
                    </p>
                </div>

            </form>
        </div>
    <?php 
    }
    /**
     * Get the HTML for addthis settings page
     *
     * @param string $updateResult Updated message
     *
     * @return string
     */
    private function _getHTML($updateResult)
    {
        $html = '
            <div class="wrap">
                <form
                    id="addthis-settings"
                    method="post"
                    action="'.$this->cmsConnector->getSettingsPageUrl().'"
                >
                    <div class="Header">
                        <h1><em>AddThis</em> Sharing Buttons</h1>';
        $html .= '</div>';

        if ($this->_upgrade && !$this->addThisConfigs->getProfileId()) {
            $html .= $this->_getupdateSuccessMessage();
        }

        if ($this->_checkAddPubidFailure()) {
            $html .= $this->_getPubIdFromAddthisFailureMessage();
        }

        if ($updateResult) {
            $html .= $updateResult;
        }

        if ($this->_checkPubidFromAddThis()
            || (isset($this->_getVariables['advanced_settings'])
            && ($this->_getVariables['advanced_settings'] == 'true'))
        ) {
            // Get Confirmation form
            $html .= addthis_profile_id_csr_confirmation();
        } else {
            $html .= $this->_getAddThisLinkButton();
        }

        if (!_addthis_is_csr_form()) {
            $html .= '
                    <div class="Btn-container-end">
                        ' . _addthis_settings_buttons(false) . '
                    </div>
                    <p>
                        <small>
                            '._addthis_eula_text().'
                        </small>
                    </p>
                </form>';
        }

        return $html;
    }
Ejemplo n.º 3
0
 /**
  * Back-end widget form.
  *
  * @param array $instance Previously saved values from database.
  *
  * @return null
  */
 public function form($instance)
 {
     if (isset($instance['title'])) {
         $title = $instance['title'];
     } else {
         $title = __('Addthis', 'vertical_recomended_widget_domain');
     }
     echo "<p>" . '<label for="' . $this->get_field_id('title') . '">' . _e('Title:') . '</label>' . '<input id="' . $this->get_field_id('title') . '" ' . 'name="' . $this->get_field_name('title') . '" ' . 'type="text" value="' . esc_attr($title) . '">' . "</p>\n              <p>\n                  <small>\n                      " . _addthis_eula_text(esc_html__('Save')) . "\n                  </small>\n              </p>\n             ";
 }
    /**
     *  The form with the widget options
     */
    function form($instance)
    {
        global $cmsConnector;

        if (empty($instance)) {
            $instance = array('style'=> '' , 'title' => '');
        }

        $style = (empty($instance['style'])) ? addthis_style_default : esc_attr($instance['style']);
        $title = (empty($instance['title'])) ? '' : esc_attr($instance['title']);

        global $addthis_new_styles;

        ?>
            <p>
                <label for="<?php echo $this->get_field_id('title'); ?>">
                    <?php _e('Title:'); ?>
                    <input
                        class="widefat"
                        id="<?php echo $this->get_field_id('title'); ?>"
                        name="<?php echo $this->get_field_name('title'); ?>"
                        type="text"
                        value="<?php echo $title; ?>"
                    />
                </label>
            </p>

            <p>
                <label for="<?php echo $this->get_field_id('style');?>">
                    <?php _e('Style:', 'addthis'); ?>
                    <br />
                </label>
            </p>
            <?php
            foreach ($addthis_new_styles as $k => $v) {
                $checked = '';
                if ($k === $style) {
                    $checked = 'checked="checked"';
                }

                echo '
                    <div style="height:auto;">
                        <input '.$checked.'
                            style="margin:5px 5px 0 0;"
                            type="radio"
                            name="' . $this->get_field_name('style') . '"
                            value="'.$k.'"
                        />
                        <img
                            align="middle"
                            style="padding:5px 0"
                            src="'. $cmsConnector->getPluginImageFolderUrl() .  $v['img'] .'"
                        />
                    </div>';
            }
                ?>
                    <p>
                        <small>
                            <?php echo _addthis_eula_text(esc_html__('Save')); ?>
                        </small>
                    </p>
        <?php
    }