Plugin Directory

Changeset 1906154


Ignore:
Timestamp:
07/09/2018 03:35:06 AM (8 years ago)
Author:
enamakel
Message:

v1.4.0

Location:
bitwords-io/trunk
Files:
3 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • bitwords-io/trunk/admin/BitwordsSerializer.php

    r1897786 r1906154  
    7676                }
    7777
     78                if (isset($_POST['bitwordsBlacklistDomains'])) {
     79                    $bitwordsBlacklistDomains = sanitize_text_field($_POST['bitwordsBlacklistDomains']);
     80                    $api->updatePlugin(array('blacklistedDomains' => $bitwordsBlacklistDomains));
     81                }
     82
    7883                break;
    7984        }
  • bitwords-io/trunk/admin/views/tab_settings.php

    r1897786 r1906154  
    3838    </div>
    3939
     40
     41    <div class="bitwords-input-group">
     42      <b>Blacklist domains:</b><br />
     43      <span>Here you can specify which domains you'd like to blacklist. Ads from these sites will not be
     44      displayed on this website. </span>
     45      <br />
     46      <input
     47        style="min-width: 300px"
     48        name="bitwordsBlacklistDomains" type="text" placeholder="example1.com,example2.com"
     49        value="<?php echo $dataForPublisher->blacklistedDomains; ?>"/>
     50    </div>
     51
    4052    <!-- <div class="bitwords-input-group">
    4153      <b>Custom CSS</b><br />
  • bitwords-io/trunk/bitwords_admin_settings.php

    r1900694 r1906154  
    66 * Plugin Name:       Bitwords.io
    77 * Description:       Show ads from the Bitwords.io site
    8  * Version:           1.3.0
     8 * Version:           1.4.0
    99 */
    1010if (!defined('WPINC')) die;
     
    1818include_once plugin_dir_path(__FILE__) . "admin/BitwordsSerializer.php";
    1919
     20include_once plugin_dir_path(__FILE__) . "include/shortcode.php";
     21// include_once plugin_dir_path(__FILE__) . "include/widget.php";
     22
    2023
    2124function bitwordsInsertAfterContent ($content) {
    2225    // bail if the user has not accepted the license and the T&C
    2326    if (get_option('bitwordsLicense') != '1') return $content;
     27
     28    if (!is_single()) return $content;
    2429
    2530    $publisherId = get_option('bitwordsPublisherId');
     
    8590function bitwordsScripts() {
    8691    wp_enqueue_style('bitwords_style', plugin_dir_url(__FILE__) . 'assets/style.v3.min.css', array(), '1.3.0');
    87     wp_enqueue_script('bitwords_script', plugin_dir_url(__FILE__) . 'assets/script.v3.min.js', array(), '1.3.0', true);
     92    wp_enqueue_script('bitwords_script', plugin_dir_url(__FILE__) . 'assets/script.v4.min.js', array(), '1.3.0', true);
    8893}
    8994add_action('wp_enqueue_scripts', 'bitwordsScripts');
  • bitwords-io/trunk/include/shortcode.php

    r1897786 r1906154  
    55 */
    66function bitwordsShortcodePublisher($atts) {
    7     extract(shortcode_atts(array('id' => ''), $atts));
     7    extract(shortcode_atts(array(
     8        'posts_count' => '4'
     9    ), $atts));
    810
    9     switch ($id) {
    10         case 1: $shortCodeContent = 'Publisher1'; break;
    11         case 2: $shortCodeContent = 'Publisher2'; break;
    12         case 3: $shortCodeContent = 'Publisher3'; break;
    13         default: break;
    14     }
     11    // switch ($id) {
     12    //     case 1: $shortCodeContent = 'Publisher1'; break;
     13    //     case 2: $shortCodeContent = 'Publisher2'; break;
     14    //     case 3: $shortCodeContent = 'Publisher3'; break;
     15    //     default: break;
     16    // }
    1517
    16     require_once( plugin_dir_path(__FILE__) . 'views/publisher.php' );
    17     return $html;
     18    $pluginLogo = plugin_dir_url(__FILE__) . '../assets/logo.png';
     19
     20    // process the php view file and capture the output in a variable
     21    ob_start();
     22    include(plugin_dir_path(__FILE__) . '../views/publisher.php');
     23    $output = ob_get_contents();
     24    ob_end_clean(); // Clear the buffer.
     25
     26    // require_once(plugin_dir_path(__FILE__) . '../views/publisher.php' );
     27    return $output;
    1828}
    1929
     
    2232 * Define publisher shortcode name
    2333 */
    24 function wpc_register_shortcode() {
     34function bitwordsRegisterShortcode() {
    2535    add_shortcode('bitwords', 'bitwordsShortcodePublisher');
    2636}
    27 add_action('init', 'wpc_register_shortcode');
     37add_action('init', 'bitwordsRegisterShortcode');
  • bitwords-io/trunk/include/widget.php

    r1892920 r1906154  
    44 * Register and load the widget
    55 */
    6 function bitwords_load_widget() {
     6function bitwordsRegisterWidget() {
    77    register_widget('bitwords_widget');
    88}
    9 add_action('widgets_init', 'bitwords_load_widget');
     9add_action('widgets_init', 'bitwordsRegisterWidget');
    1010
    1111
     
    6666        </p>
    6767        <p>
     68            <input
     69                name="bitwordsAfterArticleMaxStories"
     70                type="number" min="0" max="10" placeholder="6"
     71                value="<?php echo $this->get_field_id('bitwordsAfterArticleMaxStories'); ?>" />
     72            <label for="<?php echo $this->get_field_id('bitwords_checkbox'); ?>"><?php _e('Display publishers?'); ?></label>
     73        </p>
     74        <p>
    6875            <input class="checkbox" type="checkbox"<?php checked($bitwords_checkbox); ?> id="<?php echo $this->get_field_id('bitwords_checkbox'); ?>" name="<?php echo $this->get_field_name('bitwords_checkbox'); ?>" />
    6976            <label for="<?php echo $this->get_field_id('bitwords_checkbox'); ?>"><?php _e('Display publishers?'); ?></label>
  • bitwords-io/trunk/lib/BitwordsAPI.php

    r1900694 r1906154  
    1616     */
    1717    private function _api($url, $data = array()) {
    18         $HOST = "https://app.bitwords.io/api/v1";
     18        // $HOST = "https://app.bitwords.io/api/v1";
     19        $HOST = "http://172.16.0.157:5999/api/v1";
    1920
    2021        // Find the publisher's key so that we can authenticate with the server
     
    7778
    7879    /**
    79      * send published or updated articles to bitwords
     80     * Send published or updated articles to bitwords
    8081     */
    8182    public function sendPost ($post) {
    8283        $this-> _api('/publishers/wordpress/post', $post);
    8384    }
     85
     86
     87    /**
     88     * Update the plublisher's plugin
     89     */
     90    public function updatePlugin ($plugin) {
     91        $this-> _api('/publishers/wordpress/update', $plugin);
     92    }
    8493}
Note: See TracChangeset for help on using the changeset viewer.