Plugin Directory

Changeset 1585495


Ignore:
Timestamp:
01/31/2017 03:29:09 AM (9 years ago)
Author:
itmatio
Message:

allow search by job id and story id. bug fix story image last modified

Location:
interserve-data-feed/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • interserve-data-feed/trunk

    • Property svn:ignore
      •  

        old new  
        11.idea
         2.vagrant
  • interserve-data-feed/trunk/Manager.php

    r1585453 r1585495  
    123123        }
    124124
     125        /** @var Base $plugin */
    125126        $plugin = new $className();
    126127        $plugin->setFeed($this->feed);
  • interserve-data-feed/trunk/PostType/Job.php

    r1585466 r1585495  
    207207        $sql .= 'FROM ' . $wpdb->posts . ' post';
    208208        $sql .= ', ' . $wpdb->postmeta . ' postpriority';
     209        $sql .= ', ' . $wpdb->postmeta . ' postjob_id';
    209210        $sql .= ' WHERE ';
    210211        $sql .= 'post.post_status = "publish" ';
     
    212213        $sql .= 'AND post.ID = postpriority.post_id ';
    213214        $sql .= 'AND postpriority.meta_key = "is_priority" ';
     215        $sql .= 'AND post.ID = postjob_id.post_id ';
     216        $sql .= 'AND postjob_id.meta_key = "job_id" ';
    214217        foreach ($context->getTaxonomyTerms() as $taxonomy => $values) {
    215218            if (empty($values)) {
     
    220223        }
    221224        if ($context->hasSearchText()) {
    222             $pattern = $wpdb->_escape($wpdb->esc_like($context->getSearchText()));
    223             $sql .= 'AND (post.post_title like "%' . $pattern . '%" or post.post_content like "%' . $pattern . '%") ';
     225            $pattern = $context->getSearchText();
     226            if (is_numeric($pattern)) {
     227                $sql .= 'AND postjob_id.meta_value = "' . intval($pattern) . '" ';
     228            } else {
     229                $pattern = $wpdb->_escape($wpdb->esc_like($pattern));
     230                $sql .= 'AND (post.post_title like "%' . $pattern . '%" or post.post_content like "%' . $pattern . '%") ';
     231            }
    224232        }
    225233        $sql .= 'ORDER BY postpriority.meta_value DESC, post.post_date DESC, post.post_title ';
  • interserve-data-feed/trunk/PostType/Story.php

    r1585472 r1585495  
    175175            return;
    176176        }
    177 
    178177        $modified = get_post_meta($postID, 'story_image_modified', true);
    179178        if (!empty($modified) && $modified >= $story['image_modified']) {
     
    215214    public function deleteMedia($postID)
    216215    {
     216        update_post_meta($postID, 'story_image_modified', 0);
    217217        $args        = ['post_parent' => $postID, 'post_type' => 'attachment', 'post_mime_type' => 'image'];
    218218        $attachments = get_children($args);
     
    293293        $sql = 'SELECT post.*';
    294294        $sql .= 'FROM ' . $wpdb->posts . ' post';
     295        $sql .= ', ' . $wpdb->postmeta . ' poststory_id';
    295296        $sql .= ' WHERE ';
    296297        $sql .= 'post.post_status = "publish" ';
    297298        $sql .= 'AND post.post_type = "' . $this->getWordpressName() . '" ';
     299        $sql .= 'AND post.ID = poststory_id.post_id ';
     300        $sql .= 'AND poststory_id.meta_key = "story_id" ';
    298301        foreach ($context->getTaxonomyTerms() as $taxonomy => $values) {
    299302            if (empty($values)) {
     
    304307        }
    305308        if ($context->hasSearchText()) {
    306             $pattern = $wpdb->_escape($wpdb->esc_like($context->getSearchText()));
    307             $sql .= 'AND (post.post_title like "%' . $pattern . '%" or post.post_content like "%' . $pattern . '%") ';
     309            $pattern = $context->getSearchText();
     310            if (is_numeric($pattern)) {
     311                $sql .= 'AND poststory_id.meta_value = "' . intval($pattern) . '" ';
     312            } else {
     313                $pattern = $wpdb->_escape($wpdb->esc_like($pattern));
     314                $sql .= 'AND (post.post_title like "%' . $pattern . '%" or post.post_content like "%' . $pattern . '%") ';
     315            }
    308316        }
    309317        $sql .= 'ORDER BY post.post_date DESC, post.post_title ';
  • interserve-data-feed/trunk/Vagrantfile

    r1585453 r1585495  
    5454        #fi
    5555
     56cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
     57xdebug.scream=1
     58xdebug.cli_color=1
     59xdebug.show_local_vars=1
     60xdebug.remote_enable=1
     61xdebug.remote_host=192.168.178.30
     62xdebug.remote_connect_back=1
     63xdebug.idekey="PHPSTORM"
     64EOF
     65
    5666        # configure php
    5767        sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.1/apache2/php.ini
  • interserve-data-feed/trunk/readme.txt

    r1585466 r1585495  
    4242  Use name="Jobs" to return just the number for the count of job openings. This works for any of the other numbers
    4343  reported by the bare tag.
    44 - [isdata_child_pages] shows the pages that are children of this page
     44- [isdata_child_pages] shows the pages that are children of this page. It is not related to any of the isdata
     45  data sets: it is included as a utility / tool to help build navigation of your site.
    4546
    4647In the above, shortcode parameters are
Note: See TracChangeset for help on using the changeset viewer.