Example #1
0
function _parse_attributes($string)
{
    return is_array($string) ? $string : WPOTools::stringToArray($string);
}
 /**
  * Uninstalls
  *
  *
  */
 function uninstall()
 {
     global $wpdb;
     foreach ($this->db as $table) {
         $wpdb->query("DROP TABLE {$table} ");
     }
     // Delete options
     WPOTools::deleteOptions(array('wpo_log', 'wpo_log_stdout', 'wpo_unixcron', 'wpo_croncode', 'wpo_cacheimages', 'wpo_cachepath'));
 }
Example #3
0
 /**
  * Called when autoreader plugin is first activated
  *
  *
  */
 public function activate($h, $force_install = false)
 {
     // only re-install if there is new version or plugin has been uninstalled
     if ($force_install || !$h->getPluginVersion() || $h->getPluginVersion() != $this->version) {
         # autoreader_campaign
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['campaign']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['campaign'] . " (\n                                id int(11) unsigned NOT NULL auto_increment,\n                                title varchar(255) NOT NULL default '',\n                                active tinyint(1) default '1',\n                                slug varchar(250) default '',\n                                template MEDIUMTEXT default '',\n                                frequency int(5) default '180',\n                                feeddate tinyint(1) default '0',\n                                cacheimages tinyint(1) default '1',\n                                posttype enum('new','pending','top') NOT NULL default 'pending',\n                                authorid int(11) default NULL,\n                                comment_status enum('open','closed','registered_only') NOT NULL default 'open',\n                                allowpings tinyint(1) default '1',\n                                dopingbacks tinyint(1) default '1',\n                                max smallint(3) default '10',\n                                linktosource tinyint(1) default '0',\n                                count int(11) default '0',\n                                lastactive datetime NOT NULL default '0000-00-00 00:00:00',\n                                created_on datetime NOT NULL default '0000-00-00 00:00:00',\n                                PRIMARY KEY (id)\n                           ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader campaign'; ");
         } else {
             //update for 0.1 versions
             $sql = "ALTER TABLE " . $this->db['campaign'] . " MODIFY COLUMN posttype enum('new','pending','top') NOT NULL default 'pending'";
             $h->db->query($h->db->prepare($sql));
         }
         # autoreader_campaign_category
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['campaign_category']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['campaign_category'] . " (\n  \t\t\t\t\t\t    id int(11) unsigned NOT NULL auto_increment,\n  \t\t\t\t\t\t\t  category_id int(11) NOT NULL,\n  \t\t\t\t\t\t\t  campaign_id int(11) NOT NULL,\n  \t\t\t\t\t\t\t  PRIMARY KEY  (id)\n  \t\t\t\t\t\t ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader campaign category'; ");
         }
         # autoreader_campaign_feed
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['campaign_feed']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['campaign_feed'] . " (\n                                id int(11) unsigned NOT NULL auto_increment,\n                                  campaign_id int(11) NOT NULL default '0',\n                                  url varchar(255) NOT NULL default '',\n                                  type varchar(255) NOT NULL default '',\n                                  title varchar(255) NOT NULL default '',\n                                  description varchar(255) NOT NULL default '',\n                                  logo varchar(255) default '',\n                                  count int(11) default '0',\n                                  hash varchar(255) default '',\n                                  lastactive datetime NOT NULL default '0000-00-00 00:00:00',\n                                  PRIMARY KEY  (id)\n                             ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader campaign feed'; ");
         }
         # autoreader_campaign_post
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['campaign_post']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['campaign_post'] . " (\n                            id int(11) unsigned NOT NULL auto_increment,\n                              campaign_id int(11) NOT NULL,\n                              feed_id int(11) NOT NULL,\n                              post_id int(11) NOT NULL,\n                                hash varchar(255) default '',\n                              PRIMARY KEY  (id)\n                          ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader campaign post'; ");
         }
         # autoreader_campaign_word
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['campaign_word']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['campaign_word'] . " (\n                                id int(11) unsigned NOT NULL auto_increment,\n                                  campaign_id int(11) NOT NULL,\n                                  word varchar(255) NOT NULL default '',\n                                  regex tinyint(1) default '0',\n                                  rewrite tinyint(1) default '1',\n                                  rewrite_to varchar(255) default '',\n                                  relink varchar(255) default '',\n                                  PRIMARY KEY  (id)\n                              ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader campaign word'; ");
         }
         # autoreader_log
         $exists = $h->db->table_exists(str_replace(DB_PREFIX, "", $this->db['log']));
         if (!$exists) {
             $h->db->query("CREATE TABLE " . $this->db['log'] . " (\n                                id int(11) unsigned NOT NULL auto_increment,\n                                  message mediumtext NOT NULL default '',\n                                  created_on datetime NOT NULL default '0000-00-00 00:00:00',\n                                  PRIMARY KEY  (id)\n                              ) ENGINE=" . DB_ENGINE . " DEFAULT CHARSET=" . DB_CHARSET . " COLLATE=" . DB_COLLATE . " COMMENT='autoreader log'; ");
         }
         # Options
         WPOTools::addMissingOptions(array('wpo_log' => array(1, 'Log WP-o-Matic actions'), 'wpo_log_stdout' => array(0, 'Output logs to browser while a campaign is being processed'), 'wpo_unixcron' => array(WPOTools::isUnix(), 'Use unix-style cron'), 'wpo_croncode' => array(substr(md5(time()), 0, 8), 'Cron job password.'), 'wpo_cacheimages' => array(0, 'Cache all images. Overrides campaign options'), 'wpo_cachepath' => array('cache', 'Cache path relative to wpomatic directory')));
         $this->installed = true;
     }
 }
Example #4
0
 function adminUpdateCampaignPosts($id, $properties)
 {
     global $wpdb;
     $posts = $this->getCampaignPosts($id);
     foreach ($posts as $post) {
         $wpdb->query(WPOTools::updateQuery($wpdb->posts, $properties, "ID = {$post->id}"));
     }
 }
Example #5
0
 Displaying <?php 
echo $total;
?>
 log entries
      </div>
    </div>
    
    <?php 
if ($logs) {
    ?>
    <ul id="logs">
    <?php 
    foreach ($logs as $log) {
        ?>
      <li><?php 
        echo WPOTools::timezoneMysql('F j, g:i:s a', $log->created_on);
        ?>
 - <?php 
        echo $log->message;
        ?>
</li>
    <?php 
    }
    ?>
    </ul>
    <?php 
} else {
    ?>
    <p><?php 
    _e('No logs to show', 'wpomatic');
    ?>
Example #6
0
 function stringToArray($string)
 {
     preg_match_all('/
   \\s*(\\w+)              # key                               \\1
   \\s*=\\s*               # =
   (\'|")?               # values may be included in \' or " \\2
   (.*?)                 # value                             \\3
   (?(2) \\2)            # matching \' or " if needed        \\4
   \\s*(?:
     (?=\\w+\\s*=) | \\s*$  # followed by another key= or the end of the string
   )
 /x', $string, $matches, PREG_SET_ORDER);
     $attributes = array();
     foreach ($matches as $val) {
         $attributes[$val[1]] = WPOTools::literalize($val[3]);
     }
     return $attributes;
 }
Example #7
0
    ?>
</p>
            <p><?php 
    _e('If you need to edit existing posts, you can do so by using the options under the Tools tab', 'wpomatic');
    ?>
</p>
          </div>
          <?php 
}
?>
          

          <?php 
$f = _data_value($data['main'], 'frequency');
if ($f) {
    $frequency = WPOTools::calcTime($f);
} else {
    $frequency = array();
}
?>

          <table class="form-table">
            <tr>
              <th><label for="campaign_templatechk"><?php 
_e('Custom post template', 'wpomatic');
?>
</label> </th>
              <td>
                <?php 
echo checkbox_tag('campaign_templatechk', 1, _data_value($data['main'], 'template'));
?>
if (count($lastcampaigns) == 0) {
    ?>
      <p class="none"><?php 
    _e('No campaigns to display', 'wpomatic');
    ?>
      <?php 
} else {
    ?>
        <ol class="campaignlist">
          <?php 
    foreach ($lastcampaigns as $campaign) {
        ?>
                         
          <li>
            <span class="details"><?php 
        echo WPOTools::timezoneMysql('F j, g:i a', $campaign->lastactive);
        ?>
</span>
            <a href="<?php 
        echo $this->adminurl;
        ?>
&amp;s=list&amp;id=<?php 
        echo $campaign->id;
        ?>
"><?php 
        echo attribute_escape($campaign->title);
        ?>
</a></li>
          <?php 
    }
    ?>
function action_add($h, $arObj, $data = null, $action = 'add')
{
    $arObj = new Autoreader($h);
    $autoreader_settings = $arObj->getOptionSettings($h);
    ?>
    <form id="edit_campaign" action="" method="post" accept-charset="utf-8">
      
      <?php 
    if ($action == 'edit') {
        $id = $data['main']['id'];
        echo input_hidden_tag('campaign_edit', $id);
    } else {
        echo input_hidden_tag('campaign_add', 1);
        $data = $arObj->campaign_structure;
    }
    ?>

      <ul id="edit_buttons" class="submit">
         <?php 
    if ($autoreader_settings['wpo_help']) {
        ?>
                <li><a href="help.php?item=campaigns" class="help_link">Help</a></li>
         <?php 
    }
    ?>
       
        <li><input type="submit" name="edit_submit" value="Save" id="edit_submit" /></li>
      </ul>
        <div id="error_message"></div>
      <div id="admin_plugin_tabs">
      <ul class="tabs">
        <li class="current"><a href="#section_basic" id="tab_basic">Basic</a></li>
        <li><a href="#section_feeds" id="tab_feeds">Feeds</a></li>
        <li><a href="#section_categories" id="tab_categories">Categories</a></li>
        <li><a href="#section_rewrite" id="tab_rewrite">Rewrite</a></li>
        <li><a href="#section_options" id="tab_options">Options</a></li>
        <?php 
    if ($action == 'edit') {
        ?>
            <li><a href="#section_tools" id="tab_tools">Tools</a></li>
        <?php 
    }
    ?>
      </ul>
      </div>


      <div id="edit_sections">
        <!-- Basic section -->
        <div class="section current" id="section_basic">
          <div class="longtext required">
            <?php 
    echo label_for('campaign_title', 'Title');
    ?>
            <?php 
    echo input_tag('campaign_title', _data_value($data['main'], 'title'));
    ?>
            <p class="note">Tip: pick a name that describes the collection of this campaign's feeds (eg: Basketball)</p>
          </div>

          <div class="checkbox required">
            <?php 
    echo label_for('campaign_active', 'Active?');
    ?>
            <?php 
    echo checkbox_tag('campaign_active', 1, _data_value($data['main'], 'active', true));
    ?>
            <p class="note">If inactive, the parser will ignore these feeds</p>
          </div>

          <div class="text">
            <?php 
    echo label_for('campaign_slug', 'Campaign slug');
    ?>
            <?php 
    echo input_tag('campaign_slug', _data_value($data['main'], 'slug'));
    ?>
            <p class="note">Optionally, you can set an identifier for this campaign. Useful for detailed track of your ad-revenue.</p>
          </div>
        </div>

        <!-- Feeds section -->
        <div class="section" id="section_feeds">
          <p>Please fill in at least one feed. If you are not sure about the exact feed url, just type in the domain name, and the feed will be autodetected</p>

          <div id="edit_feed">
            <?php 
    if (isset($data['feeds']['edit'])) {
        ?>
              <?php 
        foreach ($data['feeds']['edit'] as $id => $feed) {
            ?>
              <div class="inlinetext required">
                <?php 
            echo label_for('campaign_feed_edit_' . $id, 'Feed URL');
            ?>
                <?php 
            echo input_tag('campaign_feed[edit][' . $id . ']', $feed, 'disabled=disabled class=input_text id=campaign_feed_edit_' . $id);
            ?>
                <?php 
            echo checkbox_tag('campaign_feed[delete][' . $id . ']', 1, isset($data['feeds']['delete']) && _data_value($data['feeds']['delete'], $id), 'id=campaign_feed_delete_' . $id);
            ?>
 <label for="campaign_feed_delete_<?php 
            echo $id;
            ?>
" class="delete_label">Delete ?</label>
              </div>
              <?php 
        }
        ?>
            <?php 
    }
    ?>

            <?php 
    if (isset($data['feeds']['new'])) {
        ?>
              <?php 
        foreach ($data['feeds']['new'] as $i => $feed) {
            ?>
              <div class="inlinetext required">
                <?php 
            echo label_for('campaign_feed_new_' . $i, 'Feed URL');
            ?>
                <?php 
            echo input_tag('campaign_feed[new][' . $i . ']', $feed, 'class=input_text id=campaign_feed_new_' . $i);
            ?>
              </div>
              <?php 
        }
        ?>
            <?php 
    } else {
        ?>
              <?php 
        for ($i = 0; $i < 4; $i++) {
            ?>
              <div class="inlinetext required">
                <?php 
            echo label_for('campaign_feed_new_' . $i, 'Feed URL');
            ?>
                <?php 
            echo input_tag('campaign_feed[new][]', null, 'class=input_text id=campaign_feed_new_' . $i);
            ?>
              </div>
              <?php 
        }
        ?>
            <?php 
    }
    ?>
          </div>
         <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
            <a href="#add_feed" id="add_feed">Add more</a> | <a href="#" id="test_feeds">Check all</a>
          <?php 
    }
    ?>
        </div>

        <!-- Categories section -->
        <div class="section" id="section_categories">
          <p>These are the categories where the posts will be created once they are fetched from the feeds.</p>
          <p>Please select one.</p>

          <ul id="categories">
            <?php 
    $arObj->adminEditCategories($h, $data);
    ?>

            <?php 
    if (isset($data['categories']['new'])) {
        ?>
              <?php 
        foreach ($data['categories']['new'] as $i => $catname) {
            ?>
              <li>
                <?php 
            echo checkbox_tag('campaign_newcat[]', 1, true, 'id=campaign_newcat_' . $i);
            ?>
                <?php 
            echo input_tag('campaign_newcatname[]', $catname, 'class=input_text id=campaign_newcatname_' . $i);
            ?>
              </li>
              <?php 
        }
        ?>
            <?php 
    }
    ?>
          </ul>

        
           <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
                <a href="#quick_add" id="quick_add">Quick add</a>
           <?php 
    }
    ?>
        </div>

        <!-- Rewrite section -->
        <div class="section" id="section_rewrite">
        <?php 
    if ($autoreader_settings['wpo_help']) {
        ?>
          <p>Want to transform a word into another? Or link a specific word to some website?
            <?php 
        // echo '<a href=' . $arObj->helpurl . '" class="help_link">Read more</a>'
        ?>
</p>

          <ul id="edit_words">
            <?php 
        if (isset($data['rewrites']) && count($data['rewrites'])) {
            ?>
              <?php 
            foreach ($data['rewrites'] as $i => $rewrite) {
                ?>
                <li class="word">
                  <div class="origin textarea">
                    <?php 
                echo label_for('campaign_word_origin_' . $i, 'Origin');
                ?>
                    <?php 
                echo textarea_tag('campaign_word_origin[' . $i . ']', $rewrite['origin']['search'], 'id=campaign_word_origin_' . $rewrite->id);
                ?>
                    <label class="regex">
                      <?php 
                echo checkbox_tag('campaign_word_option_regex[' . $i . ']', 1, $rewrite['origin']['regex']);
                ?>
                      <span><?php 
                _e('RegEx', 'wpomatic');
                ?>
</span>
                    </label>
                  </div>

                  <div class="rewrite textarea">
                    <label>
                      <?php 
                echo checkbox_tag('campaign_word_option_rewrite[' . $i . ']', 1, isset($rewrite['rewrite']));
                ?>
                      <span>Rewrite to:</span>
                    </label>
                    <?php 
                echo textarea_tag('campaign_word_rewrite[' . $i . ']', _data_value($rewrite, 'rewrite'));
                ?>
                  </div>

                  <div class="relink textarea">
                    <label>
                      <?php 
                echo checkbox_tag('campaign_word_option_relink[' . $i . ']', 1, isset($rewrite['relink']));
                ?>
                      <span>Relink to:</span>
                    </label>
                    <?php 
                echo textarea_tag('campaign_word_relink[' . $i . ']', _data_value($rewrite, 'relink'));
                ?>
                  </div>
                </li>
              <?php 
            }
            ?>
            <?php 
        } else {
            ?>
            <li class="word">
              <div class="origin textarea">
                <label for="campaign_word_origin_new1">Origin</label>
                <textarea name="campaign_word_origin[new1]" id="campaign_word_origin_new1"></textarea>
                <label class="regex"><input type="checkbox" name="campaign_word_option_regex[new1]" /> <span>RegEx</span></label>
              </div>
              <div class="rewrite textarea">
                <label><input type="checkbox" value="1" name="campaign_word_option_rewrite[new1]" /> <span>Rewrite to:</span></label>
                <textarea name="campaign_word_rewrite[new1]"></textarea>
              </div>
              <div class="relink textarea">
                <label><input type="checkbox" value="1" name="campaign_word_option_relink[new1]" /> <span>Relink to:</span></label>
                <textarea name="campaign_word_relink[new1]"></textarea>
              </div>
            </li>
            <?php 
        }
        ?>
          </ul>

           
                <a href="#add_word" id="add_word">Add more</a>
           <?php 
    } else {
        echo "This section is being worked on and will be added in a future release of this plugin.";
    }
    ?>
                
        </div>

        <!-- Options -->
        <div class="section" id="section_options">
          <?php 
    if (isset($campaign_edit)) {
        ?>
          <div class="section_warn">
            <img src="<?php 
        echo $arObj->tplpath;
        ?>
/images/icon_alert.gif" alt="Warning" class="icon" />
            <h3>Note</h3>
            <p>Changing these options only affects the creation of posts after the next time feeds are parsed.</p>
            <p>If you need to edit existing posts, you can do so by using the options under the Tools tab</p>
          </div>
          <?php 
    }
    ?>

             <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
                  <div class="checkbox">
                    <label for="campaign_templatechk">Custom post template</label>
                    <?php 
        echo checkbox_tag('campaign_templatechk', 1, _data_value($data['main'], 'template'));
        ?>

                    <div id="post_template" class="textarea <?php 
        if (_data_value($data['main'], 'template', '{content}') !== '{content}') {
            echo 'current';
        }
        ?>
">
                      <?php 
        echo textarea_tag('campaign_template', _data_value($data['main'], 'template', '{content}'));
        ?>
                      <a href="#" id="enlarge_link">Enlarge</a>

                      <p class="note" id="tags_note">
                        'Valid tags:
                      </p>
                      <p id="tags_list">
                        <span class="tag">{content}</span>, <span class="tag">{title}</span>, <span class="tag">{permalink}</span>, <span class="tag">{feedurl}</span>, <span class="tag">{feedtitle}</span>, <span class="tag">{feedlogo}</span>,<br /> <span class="tag">{campaigntitle}</span>, <span class="tag">{campaignid}</span>, <span class="tag">{campaignslug}</span>
                      </p>
                    </div>

                    <p class="note">Read about <a href="<?php 
        echo $arObj->helpurl;
        ?>
" class="help_link">post templates</a>, or check some <a href="<?php 
        echo $arObj->helpurl;
        ?>
" class="help_link">examples</a> ?></p>
                  </div>
          <?php 
    }
    ?>
          <div class="multipletext">
            <?php 
    $f = _data_value($data['main'], 'frequency');
    if ($f) {
        $frequency = WPOTools::calcTime($f);
    } else {
        $frequency = array();
    }
    ?>

            <label>Frequency</label>

             <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
                <?php 
        echo input_tag('campaign_frequency_d', _data_value($frequency, 'days', 1), 'size=2 maxlength=3');
        ?>
                d

                <?php 
        echo input_tag('campaign_frequency_h', _data_value($frequency, 'hours', 5), 'size=2 maxlength=2');
        ?>
                h

                <?php 
        echo input_tag('campaign_frequency_m', _data_value($frequency, 'minutes', 0), 'size=2 maxlength=2');
        ?>
                m
             <?php 
    }
    ?>

             <?php 
    echo select_tag('campaign_frequency_h', options_for_select(array('3600' => 'hourly', '43200' => 'twice daily', '86400' => 'daily', '302400' => 'weekly'), _data_value($data['main'], 'frequency', '1')));
    ?>
                

            <p class="note">How often should this feed be checked? </p>
          </div>

           <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
              <div class="checkbox">
                <?php 
        echo label_for('campaign_cacheimages', 'Cache images');
        ?>
                <?php 
        // need to install timthumb folder to get the following working
        ?>
                <?php 
        echo checkbox_tag('campaign_cacheimages', 1, _data_value($data['main'], 'cacheimages', is_writable($autoreader_settings['wpo_cachepath'])));
        ?>
                <p class="note">Images will be stored in your server, instead of hotlinking from the original site.
                     <?php 
        if ($autoreader_settings['wpo_help']) {
            ?>
<a href="helpurl image_caching" class="help_link">More</a><?php 
        }
        ?>
</p>
              </div>
           <?php 
    }
    ?>

          <div class="checkbox">
            <?php 
    echo label_for('campaign_feeddate', 'Use feed date');
    ?>
            <?php 
    echo checkbox_tag('campaign_feeddate', 1, _data_value($data['main'], 'feeddate', false));
    ?>
            <p class="note">Use the original date from the post instead of the time the post is created by this plugin.
                </p>
          </div>

          <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
              <div class="checkbox">
                <?php 
        echo label_for('campaign_dopingbacks', 'Perform pingbacks');
        ?>
                <?php 
        echo checkbox_tag('campaign_dopingbacks', 1, _data_value($data['main'], 'dopingbacks', false));
        ?>
              </div>
          <?php 
    }
    ?>

          <div class="radio">
            <label class="main">Type of post to create</label>

            <?php 
    echo radiobutton_tag('campaign_posttype', 'new', !isset($data['main']['posttype']) || _data_value($data['main'], 'posttype') == 'new', 'id=type_new');
    ?>
            <?php 
    echo label_for('type_new', 'Published (New)');
    ?>

	    <?php 
    echo radiobutton_tag('campaign_posttype', 'top', !isset($data['main']['posttype']) || _data_value($data['main'], 'posttype') == 'top', 'id=type_top');
    ?>
            <?php 
    echo label_for('type_top', 'Published (Top)');
    ?>

            <?php 
    echo radiobutton_tag('campaign_posttype', 'pending', _data_value($data['main'], 'posttype') == 'pending', 'id=type_pending');
    ?>
            <?php 
    echo label_for('type_pending', 'Pending');
    ?>
          </div>

          <div class="text">
            <?php 
    echo label_for('campaign_author', 'Author:');
    ?>
            <?php 
    echo input_tag('campaign_author', _data_value($data['main'], 'author'));
    ?>
 <?php 
    // echo select_tag('campaign_author', options_for_select($author_usernames, _data_value($data['main'], 'author', 'admin')))
    ?>
            <p class="note">If blank, the created posts will be assigned to the current user.</p>
          </div>

          <div class="text required">
            <?php 
    echo label_for('campaign_max', 'Max items to create on each fetch');
    ?>
            <?php 
    echo input_tag('campaign_max', _data_value($data['main'], 'max', '10'), 'size=2 maxlength=3');
    ?>
            <p class="note">Set it to 0 for unlimited. If set to a value, only the last X items will be selected, ignoring the older ones.</p>
          </div>

          <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
              <div class="checkbox">
                <?php 
        echo label_for('campaign_linktosource', 'Post title links to source?');
        ?>
                <?php 
        echo checkbox_tag('campaign_linktosource', 1, _data_value($data['main'], 'linktosource', false));
        ?>
              </div>
          <?php 
    }
    ?>

          <?php 
    if ($autoreader_settings['wpo_premium']) {
        ?>
              <div class="radio">
                <label class="main">Discussion options:</label>

                <?php 
        echo select_tag('campaign_commentstatus', options_for_select(array('open' => 'Open', 'closed' => 'Closed', 'registered_only' => 'Registered only'), _data_value($data['main'], 'comment_status', 'open')));
        ?>

                <?php 
        echo checkbox_tag('campaign_allowpings', 1, _data_value($data['main'], 'allowpings', true));
        ?>
                <?php 
        echo label_for('campaign_allowpings', 'Allow pings');
        ?>
              </div>
         <?php 
    }
    ?>
        </div>

         
        <?php 
    if ($action == 'edit') {
        ?>
       
        <!-- Tools -->
        <div class="section" id="section_tools">
            <?php 
        if (!$autoreader_settings['wpo_premium']) {
            ?>
          <div class="buttons">
            <h3>Posts action</h3>
            <p class="note">The selected action applies to all the posts created by this campaign</p>
            <ul>
              <li>
                 <div class="text">
                    Check hotaru Cron to confirm running of this campaign. <a href="/admin_index.php?page=plugin_settings&plugin=cron">check now</a>
                 </div>
              </li>
              <li>
                
                <label class="main">Delete posts for this campaign:</label>
                <div class="btn">
                  <input type="submit" name="tool_removeall" value="Remove all posts" id="tool_removeall"/>
                </div>                
               
              </li>
              <li>
                <div class="radio">
                  <label class="main">Change status to:</label>
                  <input type="radio" name="campaign_tool_changetype" value="new" id="changetype_new" checked="checked" /> <label for="changetype_new">Published (New)</label>
		    <input type="radio" name="campaign_tool_changetype" value="top" id="changetype_top" checked="checked" /> <label for="changetype_top">Published (Top)</label>
                  <input type="radio" name="campaign_tool_changetype" value="pending" id="changetype_pending" /> <label for="changetype_pending">Pending</label>
                 <input type="submit" name="tool_changetype" value="Change" id="tool_changetype" />
                </div>
              </li>
              <li>
                <div class="text">
                  <?php 
            echo label_for('campaign_tool_changeauthor', 'Change author username to:');
            ?>
                  <?php 
            echo input_tag('campaign_tool_changeauthor', _data_value($data['main'], 'author'));
            ?>
                  <input type="submit" name="tool_changeauthor" value="Change" id="tool_changeauthor" />
                  <p class="note">If blank, the created posts will be assigned to the current user.</p>
                </div>
              </li>             
            </ul>
          </div>

          <!--
          <div class="btn">
            <label>Test all feeds</label>
            <input type="button" name="campaign_tool_testall_btn" value="Test" />
            <p class="note">This option creates one draft from each feed you added.</p>
          </div>
          -->
           <?php 
        }
        ?>
        </div>
        <?php 
    }
    ?>
       
      </div>

        
    </form>



<?php 
}
Example #10
0
if (!$logs) {
    ?>
                <p class="none"><?php 
    echo _e('No actions to display', 'wpomatic');
    ?>
</p>
                <?php 
} else {
    ?>
                <ul id="logs">
                  <?php 
    foreach ($logs as $log) {
        ?>
                         
                  <li><?php 
        echo WPOTools::timezoneMysql('F j, g:i a', $log->created_on) . ' &mdash; <strong>' . attribute_escape($log->message);
        ?>
</strong></li>
                  <?php 
    }
    ?>
                </ul>         
                <?php 
}
?>
                                                                               

                <!-- <p id="log_status"><?php 
_e(sprintf('Logging is currently <strong>%s</strong>', __($logging ? 'enabled' : 'disabled')), 'wpomatic');
?>
 (<a title="<?php 
        ?>
</th> 
            <td><?php 
        echo attribute_escape($campaign->title);
        ?>
</td>          
            <td style="text-align: center"><?php 
        echo _e($campaign->active ? 'Yes' : 'No', 'wpomatic');
        ?>
</td>
            <td style="text-align: center"><?php 
        echo $campaign->count;
        ?>
</td>        
            <td><?php 
        echo $campaign->lastactive != '0000-00-00 00:00:00' ? WPOTools::timezoneMysql('F j, g:i a', $campaign->lastactive) : __('Never', 'wpomatic');
        ?>
</td>
            <td><a href="<?php 
        echo $this->adminurl;
        ?>
&amp;s=edit&amp;id=<?php 
        echo $campaign->id;
        ?>
" class='edit'>Edit</a></td> 
            <td><?php 
        echo "<a href='" . wp_nonce_url($this->adminurl . '&amp;s=forcefetch&amp;id=' . $campaign->id, 'forcefetch-campaign_' . $campaign->id) . "' class='edit' onclick=\"return confirm('" . __('Are you sure you want to process all feeds from this campaign?', 'wpomatic') . "')\">" . __('Fetch', 'wpomatic') . "</a>";
        ?>
</td>
            <td><?php 
        echo "<a href='" . wp_nonce_url($this->adminurl . '&amp;s=reset&amp;id=' . $campaign->id, 'reset-campaign_' . $campaign->id) . "' class='delete' onclick=\"return confirm('" . __('Are you sure you want to reset this campaign? Resetting does not affect already created wp posts.', 'wpomatic') . "')\">" . __('Reset', 'wpomatic') . "</a>";