RSS Post Importer - Version 2.1.0

Version Description

Download this release

Release Info

Developer promz
Plugin Icon 128x128 RSS Post Importer
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.17 to 2.1.0

app/assets/css/style.css CHANGED
@@ -1,86 +1,98 @@
1
  /*!
2
-
3
  * Font Awesome 3.2.1
4
-
5
  * the iconic font designed for Bootstrap
6
-
7
  * ------------------------------------------------------------------------------
8
-
9
  * The full suite of pictographic icons, examples, and documentation can be
10
-
11
  * found at http://fontawesome.io. Stay up to date on Twitter at
12
-
13
  * http://twitter.com/fontawesome.
14
-
15
  *
16
-
17
  * License
18
-
19
  * ------------------------------------------------------------------------------
20
-
21
  * - The Font Awesome font is licensed under SIL OFL 1.1 -
22
-
23
  * http://scripts.sil.org/OFL
24
-
25
  * - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
26
-
27
  * http://opensource.org/licenses/mit-license.html
28
-
29
  * - Font Awesome documentation licensed under CC BY 3.0 -
30
-
31
  * http://creativecommons.org/licenses/by/3.0/
32
-
33
  * - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
34
-
35
  * "Font Awesome by Dave Gandy - http://fontawesome.io"
36
-
37
  *
38
-
39
  * Author - Dave Gandy
40
-
41
  * ------------------------------------------------------------------------------
42
-
43
  * Email: dave@fontawesome.io
44
-
45
  * Twitter: http://twitter.com/davegandy
46
-
47
  * Work: Lead Product Designer @ Kyruus - http://kyruus.com
48
-
49
- */@font-face{font-family:FontAwesome;src:url(../font/fontawesome-webfont.eot?v=3.2.1);src:url(../font/fontawesome-webfont.eot?#iefix&v=3.2.1) format('embedded-opentype'),url(../font/fontawesome-webfont.woff?v=3.2.1) format('woff'),url(../font/fontawesome-webfont.ttf?v=3.2.1) format('truetype'),url(../font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1) format('svg');font-weight:400;font-style:normal}[class^=icon-],[class*=" icon-"]{font-family:FontAwesome;font-weight:400;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;}[class^=icon-]:before,[class*=" icon-"]:before{text-decoration:inherit;display:inline-block;speak:none}.icon-large:before{vertical-align:-10%;font-size:1.33333333em}a [class^=icon-],a [class*=" icon-"]{display:inline}[class^=icon-].icon-fixed-width,[class*=" icon-"].icon-fixed-width{display:inline-block;width:1.14285714em;text-align:right;padding-right:.28571429em}[class^=icon-].icon-fixed-width.icon-large,[class*=" icon-"].icon-fixed-width.icon-large{width:1.42857143em}.icons-ul{margin-left:2.14285714em;list-style-type:none}.icons-ul>li{position:relative}.icons-ul .icon-li{position:absolute;left:-2.14285714em;width:2.14285714em;text-align:center;line-height:inherit}[class^=icon-].hide,[class*=" icon-"].hide{display:none}.icon-muted{color:#eee}.icon-light{color:#fff}.icon-dark{color:#333}.icon-border{border:solid 1px #eee;padding:.2em .25em .15em;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:3px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.icon-2x{font-size:2em}.icon-2x.icon-border{border-width:2px;-webkit-border-top-right-radius:4px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.icon-3x{font-size:3em}.icon-3x.icon-border{border-width:3px;-webkit-border-top-right-radius:5px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:5px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:5px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.icon-4x{font-size:4em}.icon-4x.icon-border{border-width:4px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:6px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.icon-5x{font-size:5em}.icon-5x.icon-border{border-width:5px;-webkit-border-top-right-radius:7px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:7px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:7px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.pull-right{float:right}.pull-left{float:left}[class^=icon-].pull-left,[class*=" icon-"].pull-left{margin-right:.3em}[class^=icon-].pull-right,[class*=" icon-"].pull-right{margin-left:.3em}.icon-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:-35%}.icon-stack [class^=icon-],.icon-stack [class*=" icon-"]{display:block;text-align:center;position:absolute;width:100%;height:100%;font-size:1em;line-height:inherit;}.icon-stack .icon-stack-base{font-size:2em;}.icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}a .icon-stack,a .icon-spin{display:inline-block;text-decoration:none}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.icon-rotate-90:before{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1)}.icon-rotate-180:before{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}.icon-rotate-270:before{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3)}.icon-flip-horizontal:before{-webkit-transform:scale(-1,1);-moz-transform:scale(-1,1);-ms-transform:scale(-1,1);-o-transform:scale(-1,1);transform:scale(-1,1)}.icon-flip-vertical:before{-webkit-transform:scale(1,-1);-moz-transform:scale(1,-1);-ms-transform:scale(1,-1);-o-transform:scale(1,-1);transform:scale(1,-1)}a .icon-rotate-90:before,a .icon-rotate-180:before,a .icon-rotate-270:before,a .icon-flip-horizontal:before,a .icon-flip-vertical:before{display:inline-block}.icon-glass:before{content:"\f000"}.icon-music:before{content:"\f001"}.icon-search:before{content:"\f002"}.icon-envelope-alt:before{content:"\f003"}.icon-heart:before{content:"\f004"}.icon-star:before{content:"\f005"}.icon-star-empty:before{content:"\f006"}.icon-user:before{content:"\f007"}.icon-film:before{content:"\f008"}.icon-th-large:before{content:"\f009"}.icon-th:before{content:"\f00a"}.icon-th-list:before{content:"\f00b"}.icon-ok:before{content:"\f00c"}.icon-remove:before{content:"\f00d"}.icon-zoom-in:before{content:"\f00e"}.icon-zoom-out:before{content:"\f010"}.icon-power-off:before,.icon-off:before{content:"\f011"}.icon-signal:before{content:"\f012"}.icon-gear:before,.icon-cog:before{content:"\f013"}.icon-trash:before{content:"\f014"}.icon-home:before{content:"\f015"}.icon-file-alt:before{content:"\f016"}.icon-time:before{content:"\f017"}.icon-road:before{content:"\f018"}.icon-download-alt:before{content:"\f019"}.icon-download:before{content:"\f01a"}.icon-upload:before{content:"\f01b"}.icon-inbox:before{content:"\f01c"}.icon-play-circle:before{content:"\f01d"}.icon-rotate-right:before,.icon-repeat:before{content:"\f01e"}.icon-refresh:before{content:"\f021"}.icon-list-alt:before{content:"\f022"}.icon-lock:before{content:"\f023"}.icon-flag:before{content:"\f024"}.icon-headphones:before{content:"\f025"}.icon-volume-off:before{content:"\f026"}.icon-volume-down:before{content:"\f027"}.icon-volume-up:before{content:"\f028"}.icon-qrcode:before{content:"\f029"}.icon-barcode:before{content:"\f02a"}.icon-tag:before{content:"\f02b"}.icon-tags:before{content:"\f02c"}.icon-book:before{content:"\f02d"}.icon-bookmark:before{content:"\f02e"}.icon-print:before{content:"\f02f"}.icon-camera:before{content:"\f030"}.icon-font:before{content:"\f031"}.icon-bold:before{content:"\f032"}.icon-italic:before{content:"\f033"}.icon-text-height:before{content:"\f034"}.icon-text-width:before{content:"\f035"}.icon-align-left:before{content:"\f036"}.icon-align-center:before{content:"\f037"}.icon-align-right:before{content:"\f038"}.icon-align-justify:before{content:"\f039"}.icon-list:before{content:"\f03a"}.icon-indent-left:before{content:"\f03b"}.icon-indent-right:before{content:"\f03c"}.icon-facetime-video:before{content:"\f03d"}.icon-picture:before{content:"\f03e"}.icon-pencil:before{content:"\f040"}.icon-map-marker:before{content:"\f041"}.icon-adjust:before{content:"\f042"}.icon-tint:before{content:"\f043"}.icon-edit:before{content:"\f044"}.icon-share:before{content:"\f045"}.icon-check:before{content:"\f046"}.icon-move:before{content:"\f047"}.icon-step-backward:before{content:"\f048"}.icon-fast-backward:before{content:"\f049"}.icon-backward:before{content:"\f04a"}.icon-play:before{content:"\f04b"}.icon-pause:before{content:"\f04c"}.icon-stop:before{content:"\f04d"}.icon-forward:before{content:"\f04e"}.icon-fast-forward:before{content:"\f050"}.icon-step-forward:before{content:"\f051"}.icon-eject:before{content:"\f052"}.icon-chevron-left:before{content:"\f053"}.icon-chevron-right:before{content:"\f054"}.icon-plus-sign:before{content:"\f055"}.icon-minus-sign:before{content:"\f056"}.icon-remove-sign:before{content:"\f057"}.icon-ok-sign:before{content:"\f058"}.icon-question-sign:before{content:"\f059"}.icon-info-sign:before{content:"\f05a"}.icon-screenshot:before{content:"\f05b"}.icon-remove-circle:before{content:"\f05c"}.icon-ok-circle:before{content:"\f05d"}.icon-ban-circle:before{content:"\f05e"}.icon-arrow-left:before{content:"\f060"}.icon-arrow-right:before{content:"\f061"}.icon-arrow-up:before{content:"\f062"}.icon-arrow-down:before{content:"\f063"}.icon-mail-forward:before,.icon-share-alt:before{content:"\f064"}.icon-resize-full:before{content:"\f065"}.icon-resize-small:before{content:"\f066"}.icon-plus:before{content:"\f067"}.icon-minus:before{content:"\f068"}.icon-asterisk:before{content:"\f069"}.icon-exclamation-sign:before{content:"\f06a"}.icon-gift:before{content:"\f06b"}.icon-leaf:before{content:"\f06c"}.icon-fire:before{content:"\f06d"}.icon-eye-open:before{content:"\f06e"}.icon-eye-close:before{content:"\f070"}.icon-warning-sign:before{content:"\f071"}.icon-plane:before{content:"\f072"}.icon-calendar:before{content:"\f073"}.icon-random:before{content:"\f074"}.icon-comment:before{content:"\f075"}.icon-magnet:before{content:"\f076"}.icon-chevron-up:before{content:"\f077"}.icon-chevron-down:before{content:"\f078"}.icon-retweet:before{content:"\f079"}.icon-shopping-cart:before{content:"\f07a"}.icon-folder-close:before{content:"\f07b"}.icon-folder-open:before{content:"\f07c"}.icon-resize-vertical:before{content:"\f07d"}.icon-resize-horizontal:before{content:"\f07e"}.icon-bar-chart:before{content:"\f080"}.icon-twitter-sign:before{content:"\f081"}.icon-facebook-sign:before{content:"\f082"}.icon-camera-retro:before{content:"\f083"}.icon-key:before{content:"\f084"}.icon-gears:before,.icon-cogs:before{content:"\f085"}.icon-comments:before{content:"\f086"}.icon-thumbs-up-alt:before{content:"\f087"}.icon-thumbs-down-alt:before{content:"\f088"}.icon-star-half:before{content:"\f089"}.icon-heart-empty:before{content:"\f08a"}.icon-signout:before{content:"\f08b"}.icon-linkedin-sign:before{content:"\f08c"}.icon-pushpin:before{content:"\f08d"}.icon-external-link:before{content:"\f08e"}.icon-signin:before{content:"\f090"}.icon-trophy:before{content:"\f091"}.icon-github-sign:before{content:"\f092"}.icon-upload-alt:before{content:"\f093"}.icon-lemon:before{content:"\f094"}.icon-phone:before{content:"\f095"}.icon-unchecked:before,.icon-check-empty:before{content:"\f096"}.icon-bookmark-empty:before{content:"\f097"}.icon-phone-sign:before{content:"\f098"}.icon-twitter:before{content:"\f099"}.icon-facebook:before{content:"\f09a"}.icon-github:before{content:"\f09b"}.icon-unlock:before{content:"\f09c"}.icon-credit-card:before{content:"\f09d"}.icon-rss:before{content:"\f09e"}.icon-hdd:before{content:"\f0a0"}.icon-bullhorn:before{content:"\f0a1"}.icon-bell:before{content:"\f0a2"}.icon-certificate:before{content:"\f0a3"}.icon-hand-right:before{content:"\f0a4"}.icon-hand-left:before{content:"\f0a5"}.icon-hand-up:before{content:"\f0a6"}.icon-hand-down:before{content:"\f0a7"}.icon-circle-arrow-left:before{content:"\f0a8"}.icon-circle-arrow-right:before{content:"\f0a9"}.icon-circle-arrow-up:before{content:"\f0aa"}.icon-circle-arrow-down:before{content:"\f0ab"}.icon-globe:before{content:"\f0ac"}.icon-wrench:before{content:"\f0ad"}.icon-tasks:before{content:"\f0ae"}.icon-filter:before{content:"\f0b0"}.icon-briefcase:before{content:"\f0b1"}.icon-fullscreen:before{content:"\f0b2"}.icon-group:before{content:"\f0c0"}.icon-link:before{content:"\f0c1"}.icon-cloud:before{content:"\f0c2"}.icon-beaker:before{content:"\f0c3"}.icon-cut:before{content:"\f0c4"}.icon-copy:before{content:"\f0c5"}.icon-paperclip:before,.icon-paper-clip:before{content:"\f0c6"}.icon-save:before{content:"\f0c7"}.icon-sign-blank:before{content:"\f0c8"}.icon-reorder:before{content:"\f0c9"}.icon-list-ul:before{content:"\f0ca"}.icon-list-ol:before{content:"\f0cb"}.icon-strikethrough:before{content:"\f0cc"}.icon-underline:before{content:"\f0cd"}.icon-table:before{content:"\f0ce"}.icon-magic:before{content:"\f0d0"}.icon-truck:before{content:"\f0d1"}.icon-pinterest:before{content:"\f0d2"}.icon-pinterest-sign:before{content:"\f0d3"}.icon-google-plus-sign:before{content:"\f0d4"}.icon-google-plus:before{content:"\f0d5"}.icon-money:before{content:"\f0d6"}.icon-caret-down:before{content:"\f0d7"}.icon-caret-up:before{content:"\f0d8"}.icon-caret-left:before{content:"\f0d9"}.icon-caret-right:before{content:"\f0da"}.icon-columns:before{content:"\f0db"}.icon-sort:before{content:"\f0dc"}.icon-sort-down:before{content:"\f0dd"}.icon-sort-up:before{content:"\f0de"}.icon-envelope:before{content:"\f0e0"}.icon-linkedin:before{content:"\f0e1"}.icon-rotate-left:before,.icon-undo:before{content:"\f0e2"}.icon-legal:before{content:"\f0e3"}.icon-dashboard:before{content:"\f0e4"}.icon-comment-alt:before{content:"\f0e5"}.icon-comments-alt:before{content:"\f0e6"}.icon-bolt:before{content:"\f0e7"}.icon-sitemap:before{content:"\f0e8"}.icon-umbrella:before{content:"\f0e9"}.icon-paste:before{content:"\f0ea"}.icon-lightbulb:before{content:"\f0eb"}.icon-exchange:before{content:"\f0ec"}.icon-cloud-download:before{content:"\f0ed"}.icon-cloud-upload:before{content:"\f0ee"}.icon-user-md:before{content:"\f0f0"}.icon-stethoscope:before{content:"\f0f1"}.icon-suitcase:before{content:"\f0f2"}.icon-bell-alt:before{content:"\f0f3"}.icon-coffee:before{content:"\f0f4"}.icon-food:before{content:"\f0f5"}.icon-file-text-alt:before{content:"\f0f6"}.icon-building:before{content:"\f0f7"}.icon-hospital:before{content:"\f0f8"}.icon-ambulance:before{content:"\f0f9"}.icon-medkit:before{content:"\f0fa"}.icon-fighter-jet:before{content:"\f0fb"}.icon-beer:before{content:"\f0fc"}.icon-h-sign:before{content:"\f0fd"}.icon-plus-sign-alt:before{content:"\f0fe"}.icon-double-angle-left:before{content:"\f100"}.icon-double-angle-right:before{content:"\f101"}.icon-double-angle-up:before{content:"\f102"}.icon-double-angle-down:before{content:"\f103"}.icon-angle-left:before{content:"\f104"}.icon-angle-right:before{content:"\f105"}.icon-angle-up:before{content:"\f106"}.icon-angle-down:before{content:"\f107"}.icon-desktop:before{content:"\f108"}.icon-laptop:before{content:"\f109"}.icon-tablet:before{content:"\f10a"}.icon-mobile-phone:before{content:"\f10b"}.icon-circle-blank:before{content:"\f10c"}.icon-quote-left:before{content:"\f10d"}.icon-quote-right:before{content:"\f10e"}.icon-spinner:before{content:"\f110"}.icon-circle:before{content:"\f111"}.icon-mail-reply:before,.icon-reply:before{content:"\f112"}.icon-github-alt:before{content:"\f113"}.icon-folder-close-alt:before{content:"\f114"}.icon-folder-open-alt:before{content:"\f115"}.icon-expand-alt:before{content:"\f116"}.icon-collapse-alt:before{content:"\f117"}.icon-smile:before{content:"\f118"}.icon-frown:before{content:"\f119"}.icon-meh:before{content:"\f11a"}.icon-gamepad:before{content:"\f11b"}.icon-keyboard:before{content:"\f11c"}.icon-flag-alt:before{content:"\f11d"}.icon-flag-checkered:before{content:"\f11e"}.icon-terminal:before{content:"\f120"}.icon-code:before{content:"\f121"}.icon-reply-all:before{content:"\f122"}.icon-mail-reply-all:before{content:"\f122"}.icon-star-half-full:before,.icon-star-half-empty:before{content:"\f123"}.icon-location-arrow:before{content:"\f124"}.icon-crop:before{content:"\f125"}.icon-code-fork:before{content:"\f126"}.icon-unlink:before{content:"\f127"}.icon-question:before{content:"\f128"}.icon-info:before{content:"\f129"}.icon-exclamation:before{content:"\f12a"}.icon-superscript:before{content:"\f12b"}.icon-subscript:before{content:"\f12c"}.icon-eraser:before{content:"\f12d"}.icon-puzzle-piece:before{content:"\f12e"}.icon-microphone:before{content:"\f130"}.icon-microphone-off:before{content:"\f131"}.icon-shield:before{content:"\f132"}.icon-calendar-empty:before{content:"\f133"}.icon-fire-extinguisher:before{content:"\f134"}.icon-rocket:before{content:"\f135"}.icon-maxcdn:before{content:"\f136"}.icon-chevron-sign-left:before{content:"\f137"}.icon-chevron-sign-right:before{content:"\f138"}.icon-chevron-sign-up:before{content:"\f139"}.icon-chevron-sign-down:before{content:"\f13a"}.icon-html5:before{content:"\f13b"}.icon-css3:before{content:"\f13c"}.icon-anchor:before{content:"\f13d"}.icon-unlock-alt:before{content:"\f13e"}.icon-bullseye:before{content:"\f140"}.icon-ellipsis-horizontal:before{content:"\f141"}.icon-ellipsis-vertical:before{content:"\f142"}.icon-rss-sign:before{content:"\f143"}.icon-play-sign:before{content:"\f144"}.icon-ticket:before{content:"\f145"}.icon-minus-sign-alt:before{content:"\f146"}.icon-check-minus:before{content:"\f147"}.icon-level-up:before{content:"\f148"}.icon-level-down:before{content:"\f149"}.icon-check-sign:before{content:"\f14a"}.icon-edit-sign:before{content:"\f14b"}.icon-external-link-sign:before{content:"\f14c"}.icon-share-sign:before{content:"\f14d"}.icon-compass:before{content:"\f14e"}.icon-collapse:before{content:"\f150"}.icon-collapse-top:before{content:"\f151"}.icon-expand:before{content:"\f152"}.icon-euro:before,.icon-eur:before{content:"\f153"}.icon-gbp:before{content:"\f154"}.icon-dollar:before,.icon-usd:before{content:"\f155"}.icon-rupee:before,.icon-inr:before{content:"\f156"}.icon-yen:before,.icon-jpy:before{content:"\f157"}.icon-renminbi:before,.icon-cny:before{content:"\f158"}.icon-won:before,.icon-krw:before{content:"\f159"}.icon-bitcoin:before,.icon-btc:before{content:"\f15a"}.icon-file:before{content:"\f15b"}.icon-file-text:before{content:"\f15c"}.icon-sort-by-alphabet:before{content:"\f15d"}.icon-sort-by-alphabet-alt:before{content:"\f15e"}.icon-sort-by-attributes:before{content:"\f160"}.icon-sort-by-attributes-alt:before{content:"\f161"}.icon-sort-by-order:before{content:"\f162"}.icon-sort-by-order-alt:before{content:"\f163"}.icon-thumbs-up:before{content:"\f164"}.icon-thumbs-down:before{content:"\f165"}.icon-youtube-sign:before{content:"\f166"}.icon-youtube:before{content:"\f167"}.icon-xing:before{content:"\f168"}.icon-xing-sign:before{content:"\f169"}.icon-youtube-play:before{content:"\f16a"}.icon-dropbox:before{content:"\f16b"}.icon-stackexchange:before{content:"\f16c"}.icon-instagram:before{content:"\f16d"}.icon-flickr:before{content:"\f16e"}.icon-adn:before{content:"\f170"}.icon-bitbucket:before{content:"\f171"}.icon-bitbucket-sign:before{content:"\f172"}.icon-tumblr:before{content:"\f173"}.icon-tumblr-sign:before{content:"\f174"}.icon-long-arrow-down:before{content:"\f175"}.icon-long-arrow-up:before{content:"\f176"}.icon-long-arrow-left:before{content:"\f177"}.icon-long-arrow-right:before{content:"\f178"}.icon-apple:before{content:"\f179"}.icon-windows:before{content:"\f17a"}.icon-android:before{content:"\f17b"}.icon-linux:before{content:"\f17c"}.icon-dribbble:before{content:"\f17d"}.icon-skype:before{content:"\f17e"}.icon-foursquare:before{content:"\f180"}.icon-trello:before{content:"\f181"}.icon-female:before{content:"\f182"}.icon-male:before{content:"\f183"}.icon-gittip:before{content:"\f184"}.icon-sun:before{content:"\f185"}.icon-moon:before{content:"\f186"}.icon-archive:before{content:"\f187"}.icon-bug:before{content:"\f188"}.icon-vk:before{content:"\f189"}.icon-weibo:before{content:"\f18a"}.icon-renren:before{content:"\f18b"}#postbox-container-1 h3.version{font-family:HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",sans-serif;background:0 0;margin-bottom:10px;border-bottom:0 none;padding:7px 0;-webkit-box-shadow:0 0 0 #fff;-moz-box-shadow:0 0 0 #fff;box-shadow:0 0 0 #fff}#postbox-container-1 ul li i{font-size:1.2em;margin-right:10px}.log{margin:40px 0}.log code{font-size:1.2em;line-height:1.2em}.loader{margin-top:20px}.rate-box h4{font-family:HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",sans-serif;font-weight:400;font-size:1.2em}.rate-box i{color:#fcd237;text-shadow:0 0 1px #c59e43;font-size:1.9em;margin-bottom:10px;display:inline-block}.rate-box a{font-size:.8em;text-decoration:none;font-style:normal}.rss_pi-table{margin-bottom:20px}.rss_pi-table tbody tr.edit-row{display:none}.rss_pi-table tbody tr.edit-row.show{display:table-row}.rss_pi-table tbody tr.edit-row>td{padding:0;border-top:0 none}.rss_pi-table tbody tr.edit-row table{border:0 none;margin:0}.rss_pi-table tbody tr.edit-row table tr td{border:0 none;border-top:1px solid #F0F0F0;background:#fff}.rss_pi-table tbody tr.edit-row table tr td:first-child{background:#F9F9F9;border-right:1px solid #E1E1E1;width:440px}.rss_pi-table tbody tr.edit-row table tr td label{font-weight:700}.rss_pi-table tbody tr.edit-row table tr td p.description{color:#9f9f9f;font-size:.8em;line-height:2em;font-style:normal}.rss_pi-table tbody tr.edit-row table tr td input,.rss_pi-table tbody tr.edit-row table tr td textarea{padding:8px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}.rss_pi-table tbody tr.edit-row table tr td .radiolist li label{font-weight:400;display:inline-block}.rss_pi-table tbody tr.edit-row table tr td .radiolist li label input{display:inline-block;width:auto;margin-right:10px}.rss_pi-table tbody tr.data-row.show td{background:#2a95c5;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#185571),color-stop(1,#2a95c5));background:-ms-linear-gradient(bottom,#185571,#2a95c5);background:-moz-linear-gradient(center bottom,#185571 0,#2a95c5 100%);background:-o-linear-gradient(#2a95c5,#185571);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#2a95c5', endColorstr='#185571', GradientType=0);border-top:1px solid #2a95c5;color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.5)}.rss_pi-table tbody tr.data-row.show td a{color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.5)}.rss_pi-table tbody tr td{border-bottom:1px solid #E1E1E1;padding:10px}.rss_pi-table tbody tr td .row-options{visibility:hidden}.rss_pi-table tbody tr:hover .row-options{visibility:visible}.rss_pi-table tfoot tr td{padding:10px;text-align:right}.rss_pi-table code{display: block;float: left;clear: both;padding: 3px 5px;font-size: 0.9em;background: none;border: 1px #eaeaea solid;}a.delete-row {color: #a00;}a.delete-row:hover{color: red;}.rss-pi-error{margin: 5px 0 15px;border-left: 4px solid #dd3d36;background: #fff;box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);padding: 1px 12px;} .selectit > input,.tags_container input {
50
-
51
  width: 4% !important;
52
-
53
  }
54
-
55
- label.selectit,.tags_container label{ color:#555555 !important; font-weight: normal !important; }
56
-
57
- div.category_container ul.children{
58
-
59
- margin-bottom: 6px;
60
-
61
- margin-top: 7px;
62
-
63
  }
64
-
65
- div.category_container,div.tags_container{
66
-
67
- height: 205px;
68
-
69
- overflow: auto;
70
-
71
  }
72
-
73
- .rss_pi_stat_div {
74
- height: 500px;
75
- margin: 50px auto;
76
- width: 800px !important;
 
 
 
 
 
 
77
  }
78
-
79
  .rss_pi_stats_date {
80
- margin: 30px auto;
81
- width: 90%;
 
82
  }
83
-
84
  .rss_filter_heading {
85
- font-weight: bold;
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  /*!
 
2
  * Font Awesome 3.2.1
 
3
  * the iconic font designed for Bootstrap
 
4
  * ------------------------------------------------------------------------------
 
5
  * The full suite of pictographic icons, examples, and documentation can be
 
6
  * found at http://fontawesome.io. Stay up to date on Twitter at
 
7
  * http://twitter.com/fontawesome.
 
8
  *
 
9
  * License
 
10
  * ------------------------------------------------------------------------------
 
11
  * - The Font Awesome font is licensed under SIL OFL 1.1 -
 
12
  * http://scripts.sil.org/OFL
 
13
  * - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
 
14
  * http://opensource.org/licenses/mit-license.html
 
15
  * - Font Awesome documentation licensed under CC BY 3.0 -
 
16
  * http://creativecommons.org/licenses/by/3.0/
 
17
  * - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
 
18
  * "Font Awesome by Dave Gandy - http://fontawesome.io"
 
19
  *
 
20
  * Author - Dave Gandy
 
21
  * ------------------------------------------------------------------------------
 
22
  * Email: dave@fontawesome.io
 
23
  * Twitter: http://twitter.com/davegandy
 
24
  * Work: Lead Product Designer @ Kyruus - http://kyruus.com
25
+ */
26
+ @font-face{font-family:FontAwesome;src:url(../font/fontawesome-webfont.eot?v=3.2.1);src:url(../font/fontawesome-webfont.eot?#iefix&v=3.2.1) format('embedded-opentype'),url(../font/fontawesome-webfont.woff?v=3.2.1) format('woff'),url(../font/fontawesome-webfont.ttf?v=3.2.1) format('truetype'),url(../font/fontawesome-webfont.svg#fontawesomeregular?v=3.2.1) format('svg');font-weight:400;font-style:normal}[class^=icon-],[class*=" icon-"]{font-family:FontAwesome;font-weight:400;font-style:normal;text-decoration:inherit;-webkit-font-smoothing:antialiased;}[class^=icon-]:before,[class*=" icon-"]:before{text-decoration:inherit;display:inline-block;speak:none}.icon-large:before{vertical-align:-10%;font-size:1.33333333em}a [class^=icon-],a [class*=" icon-"]{display:inline}[class^=icon-].icon-fixed-width,[class*=" icon-"].icon-fixed-width{display:inline-block;width:1.14285714em;text-align:right;padding-right:.28571429em}[class^=icon-].icon-fixed-width.icon-large,[class*=" icon-"].icon-fixed-width.icon-large{width:1.42857143em}.icons-ul{margin-left:2.14285714em;list-style-type:none}.icons-ul>li{position:relative}.icons-ul .icon-li{position:absolute;left:-2.14285714em;width:2.14285714em;text-align:center;line-height:inherit}[class^=icon-].hide,[class*=" icon-"].hide{display:none}.icon-muted{color:#eee}.icon-light{color:#fff}.icon-dark{color:#333}.icon-border{border:solid 1px #eee;padding:.2em .25em .15em;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:3px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.icon-2x{font-size:2em}.icon-2x.icon-border{border-width:2px;-webkit-border-top-right-radius:4px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.icon-3x{font-size:3em}.icon-3x.icon-border{border-width:3px;-webkit-border-top-right-radius:5px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:5px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:5px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.icon-4x{font-size:4em}.icon-4x.icon-border{border-width:4px;-webkit-border-top-right-radius:6px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:6px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.icon-5x{font-size:5em}.icon-5x.icon-border{border-width:5px;-webkit-border-top-right-radius:7px;-webkit-border-bottom-right-radius:0;-webkit-border-bottom-left-radius:0;-webkit-border-top-left-radius:0;-moz-border-radius-topright:7px;-moz-border-radius-bottomright:0;-moz-border-radius-bottomleft:0;-moz-border-radius-topleft:0;border-top-right-radius:7px;border-bottom-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0;-moz-background-clip:padding-box;-webkit-background-clip:padding-box;background-clip:padding-box;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.pull-right{float:right}.pull-left{float:left}[class^=icon-].pull-left,[class*=" icon-"].pull-left{margin-right:.3em}[class^=icon-].pull-right,[class*=" icon-"].pull-right{margin-left:.3em}.icon-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:-35%}.icon-stack [class^=icon-],.icon-stack [class*=" icon-"]{display:block;text-align:center;position:absolute;width:100%;height:100%;font-size:1em;line-height:inherit;}.icon-stack .icon-stack-base{font-size:2em;}.icon-spin{display:inline-block;-moz-animation:spin 2s infinite linear;-o-animation:spin 2s infinite linear;-webkit-animation:spin 2s infinite linear;animation:spin 2s infinite linear}a .icon-stack,a .icon-spin{display:inline-block;text-decoration:none}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.icon-rotate-90:before{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1)}.icon-rotate-180:before{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}.icon-rotate-270:before{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3)}.icon-flip-horizontal:before{-webkit-transform:scale(-1,1);-moz-transform:scale(-1,1);-ms-transform:scale(-1,1);-o-transform:scale(-1,1);transform:scale(-1,1)}.icon-flip-vertical:before{-webkit-transform:scale(1,-1);-moz-transform:scale(1,-1);-ms-transform:scale(1,-1);-o-transform:scale(1,-1);transform:scale(1,-1)}a .icon-rotate-90:before,a .icon-rotate-180:before,a .icon-rotate-270:before,a .icon-flip-horizontal:before,a .icon-flip-vertical:before{display:inline-block}.icon-glass:before{content:"\f000"}.icon-music:before{content:"\f001"}.icon-search:before{content:"\f002"}.icon-envelope-alt:before{content:"\f003"}.icon-heart:before{content:"\f004"}.icon-star:before{content:"\f005"}.icon-star-empty:before{content:"\f006"}.icon-user:before{content:"\f007"}.icon-film:before{content:"\f008"}.icon-th-large:before{content:"\f009"}.icon-th:before{content:"\f00a"}.icon-th-list:before{content:"\f00b"}.icon-ok:before{content:"\f00c"}.icon-remove:before{content:"\f00d"}.icon-zoom-in:before{content:"\f00e"}.icon-zoom-out:before{content:"\f010"}.icon-power-off:before,.icon-off:before{content:"\f011"}.icon-signal:before{content:"\f012"}.icon-gear:before,.icon-cog:before{content:"\f013"}.icon-trash:before{content:"\f014"}.icon-home:before{content:"\f015"}.icon-file-alt:before{content:"\f016"}.icon-time:before{content:"\f017"}.icon-road:before{content:"\f018"}.icon-download-alt:before{content:"\f019"}.icon-download:before{content:"\f01a"}.icon-upload:before{content:"\f01b"}.icon-inbox:before{content:"\f01c"}.icon-play-circle:before{content:"\f01d"}.icon-rotate-right:before,.icon-repeat:before{content:"\f01e"}.icon-refresh:before{content:"\f021"}.icon-list-alt:before{content:"\f022"}.icon-lock:before{content:"\f023"}.icon-flag:before{content:"\f024"}.icon-headphones:before{content:"\f025"}.icon-volume-off:before{content:"\f026"}.icon-volume-down:before{content:"\f027"}.icon-volume-up:before{content:"\f028"}.icon-qrcode:before{content:"\f029"}.icon-barcode:before{content:"\f02a"}.icon-tag:before{content:"\f02b"}.icon-tags:before{content:"\f02c"}.icon-book:before{content:"\f02d"}.icon-bookmark:before{content:"\f02e"}.icon-print:before{content:"\f02f"}.icon-camera:before{content:"\f030"}.icon-font:before{content:"\f031"}.icon-bold:before{content:"\f032"}.icon-italic:before{content:"\f033"}.icon-text-height:before{content:"\f034"}.icon-text-width:before{content:"\f035"}.icon-align-left:before{content:"\f036"}.icon-align-center:before{content:"\f037"}.icon-align-right:before{content:"\f038"}.icon-align-justify:before{content:"\f039"}.icon-list:before{content:"\f03a"}.icon-indent-left:before{content:"\f03b"}.icon-indent-right:before{content:"\f03c"}.icon-facetime-video:before{content:"\f03d"}.icon-picture:before{content:"\f03e"}.icon-pencil:before{content:"\f040"}.icon-map-marker:before{content:"\f041"}.icon-adjust:before{content:"\f042"}.icon-tint:before{content:"\f043"}.icon-edit:before{content:"\f044"}.icon-share:before{content:"\f045"}.icon-check:before{content:"\f046"}.icon-move:before{content:"\f047"}.icon-step-backward:before{content:"\f048"}.icon-fast-backward:before{content:"\f049"}.icon-backward:before{content:"\f04a"}.icon-play:before{content:"\f04b"}.icon-pause:before{content:"\f04c"}.icon-stop:before{content:"\f04d"}.icon-forward:before{content:"\f04e"}.icon-fast-forward:before{content:"\f050"}.icon-step-forward:before{content:"\f051"}.icon-eject:before{content:"\f052"}.icon-chevron-left:before{content:"\f053"}.icon-chevron-right:before{content:"\f054"}.icon-plus-sign:before{content:"\f055"}.icon-minus-sign:before{content:"\f056"}.icon-remove-sign:before{content:"\f057"}.icon-ok-sign:before{content:"\f058"}.icon-question-sign:before{content:"\f059"}.icon-info-sign:before{content:"\f05a"}.icon-screenshot:before{content:"\f05b"}.icon-remove-circle:before{content:"\f05c"}.icon-ok-circle:before{content:"\f05d"}.icon-ban-circle:before{content:"\f05e"}.icon-arrow-left:before{content:"\f060"}.icon-arrow-right:before{content:"\f061"}.icon-arrow-up:before{content:"\f062"}.icon-arrow-down:before{content:"\f063"}.icon-mail-forward:before,.icon-share-alt:before{content:"\f064"}.icon-resize-full:before{content:"\f065"}.icon-resize-small:before{content:"\f066"}.icon-plus:before{content:"\f067"}.icon-minus:before{content:"\f068"}.icon-asterisk:before{content:"\f069"}.icon-exclamation-sign:before{content:"\f06a"}.icon-gift:before{content:"\f06b"}.icon-leaf:before{content:"\f06c"}.icon-fire:before{content:"\f06d"}.icon-eye-open:before{content:"\f06e"}.icon-eye-close:before{content:"\f070"}.icon-warning-sign:before{content:"\f071"}.icon-plane:before{content:"\f072"}.icon-calendar:before{content:"\f073"}.icon-random:before{content:"\f074"}.icon-comment:before{content:"\f075"}.icon-magnet:before{content:"\f076"}.icon-chevron-up:before{content:"\f077"}.icon-chevron-down:before{content:"\f078"}.icon-retweet:before{content:"\f079"}.icon-shopping-cart:before{content:"\f07a"}.icon-folder-close:before{content:"\f07b"}.icon-folder-open:before{content:"\f07c"}.icon-resize-vertical:before{content:"\f07d"}.icon-resize-horizontal:before{content:"\f07e"}.icon-bar-chart:before{content:"\f080"}.icon-twitter-sign:before{content:"\f081"}.icon-facebook-sign:before{content:"\f082"}.icon-camera-retro:before{content:"\f083"}.icon-key:before{content:"\f084"}.icon-gears:before,.icon-cogs:before{content:"\f085"}.icon-comments:before{content:"\f086"}.icon-thumbs-up-alt:before{content:"\f087"}.icon-thumbs-down-alt:before{content:"\f088"}.icon-star-half:before{content:"\f089"}.icon-heart-empty:before{content:"\f08a"}.icon-signout:before{content:"\f08b"}.icon-linkedin-sign:before{content:"\f08c"}.icon-pushpin:before{content:"\f08d"}.icon-external-link:before{content:"\f08e"}.icon-signin:before{content:"\f090"}.icon-trophy:before{content:"\f091"}.icon-github-sign:before{content:"\f092"}.icon-upload-alt:before{content:"\f093"}.icon-lemon:before{content:"\f094"}.icon-phone:before{content:"\f095"}.icon-unchecked:before,.icon-check-empty:before{content:"\f096"}.icon-bookmark-empty:before{content:"\f097"}.icon-phone-sign:before{content:"\f098"}.icon-twitter:before{content:"\f099"}.icon-facebook:before{content:"\f09a"}.icon-github:before{content:"\f09b"}.icon-unlock:before{content:"\f09c"}.icon-credit-card:before{content:"\f09d"}.icon-rss:before{content:"\f09e"}.icon-hdd:before{content:"\f0a0"}.icon-bullhorn:before{content:"\f0a1"}.icon-bell:before{content:"\f0a2"}.icon-certificate:before{content:"\f0a3"}.icon-hand-right:before{content:"\f0a4"}.icon-hand-left:before{content:"\f0a5"}.icon-hand-up:before{content:"\f0a6"}.icon-hand-down:before{content:"\f0a7"}.icon-circle-arrow-left:before{content:"\f0a8"}.icon-circle-arrow-right:before{content:"\f0a9"}.icon-circle-arrow-up:before{content:"\f0aa"}.icon-circle-arrow-down:before{content:"\f0ab"}.icon-globe:before{content:"\f0ac"}.icon-wrench:before{content:"\f0ad"}.icon-tasks:before{content:"\f0ae"}.icon-filter:before{content:"\f0b0"}.icon-briefcase:before{content:"\f0b1"}.icon-fullscreen:before{content:"\f0b2"}.icon-group:before{content:"\f0c0"}.icon-link:before{content:"\f0c1"}.icon-cloud:before{content:"\f0c2"}.icon-beaker:before{content:"\f0c3"}.icon-cut:before{content:"\f0c4"}.icon-copy:before{content:"\f0c5"}.icon-paperclip:before,.icon-paper-clip:before{content:"\f0c6"}.icon-save:before{content:"\f0c7"}.icon-sign-blank:before{content:"\f0c8"}.icon-reorder:before{content:"\f0c9"}.icon-list-ul:before{content:"\f0ca"}.icon-list-ol:before{content:"\f0cb"}.icon-strikethrough:before{content:"\f0cc"}.icon-underline:before{content:"\f0cd"}.icon-table:before{content:"\f0ce"}.icon-magic:before{content:"\f0d0"}.icon-truck:before{content:"\f0d1"}.icon-pinterest:before{content:"\f0d2"}.icon-pinterest-sign:before{content:"\f0d3"}.icon-google-plus-sign:before{content:"\f0d4"}.icon-google-plus:before{content:"\f0d5"}.icon-money:before{content:"\f0d6"}.icon-caret-down:before{content:"\f0d7"}.icon-caret-up:before{content:"\f0d8"}.icon-caret-left:before{content:"\f0d9"}.icon-caret-right:before{content:"\f0da"}.icon-columns:before{content:"\f0db"}.icon-sort:before{content:"\f0dc"}.icon-sort-down:before{content:"\f0dd"}.icon-sort-up:before{content:"\f0de"}.icon-envelope:before{content:"\f0e0"}.icon-linkedin:before{content:"\f0e1"}.icon-rotate-left:before,.icon-undo:before{content:"\f0e2"}.icon-legal:before{content:"\f0e3"}.icon-dashboard:before{content:"\f0e4"}.icon-comment-alt:before{content:"\f0e5"}.icon-comments-alt:before{content:"\f0e6"}.icon-bolt:before{content:"\f0e7"}.icon-sitemap:before{content:"\f0e8"}.icon-umbrella:before{content:"\f0e9"}.icon-paste:before{content:"\f0ea"}.icon-lightbulb:before{content:"\f0eb"}.icon-exchange:before{content:"\f0ec"}.icon-cloud-download:before{content:"\f0ed"}.icon-cloud-upload:before{content:"\f0ee"}.icon-user-md:before{content:"\f0f0"}.icon-stethoscope:before{content:"\f0f1"}.icon-suitcase:before{content:"\f0f2"}.icon-bell-alt:before{content:"\f0f3"}.icon-coffee:before{content:"\f0f4"}.icon-food:before{content:"\f0f5"}.icon-file-text-alt:before{content:"\f0f6"}.icon-building:before{content:"\f0f7"}.icon-hospital:before{content:"\f0f8"}.icon-ambulance:before{content:"\f0f9"}.icon-medkit:before{content:"\f0fa"}.icon-fighter-jet:before{content:"\f0fb"}.icon-beer:before{content:"\f0fc"}.icon-h-sign:before{content:"\f0fd"}.icon-plus-sign-alt:before{content:"\f0fe"}.icon-double-angle-left:before{content:"\f100"}.icon-double-angle-right:before{content:"\f101"}.icon-double-angle-up:before{content:"\f102"}.icon-double-angle-down:before{content:"\f103"}.icon-angle-left:before{content:"\f104"}.icon-angle-right:before{content:"\f105"}.icon-angle-up:before{content:"\f106"}.icon-angle-down:before{content:"\f107"}.icon-desktop:before{content:"\f108"}.icon-laptop:before{content:"\f109"}.icon-tablet:before{content:"\f10a"}.icon-mobile-phone:before{content:"\f10b"}.icon-circle-blank:before{content:"\f10c"}.icon-quote-left:before{content:"\f10d"}.icon-quote-right:before{content:"\f10e"}.icon-spinner:before{content:"\f110"}.icon-circle:before{content:"\f111"}.icon-mail-reply:before,.icon-reply:before{content:"\f112"}.icon-github-alt:before{content:"\f113"}.icon-folder-close-alt:before{content:"\f114"}.icon-folder-open-alt:before{content:"\f115"}.icon-expand-alt:before{content:"\f116"}.icon-collapse-alt:before{content:"\f117"}.icon-smile:before{content:"\f118"}.icon-frown:before{content:"\f119"}.icon-meh:before{content:"\f11a"}.icon-gamepad:before{content:"\f11b"}.icon-keyboard:before{content:"\f11c"}.icon-flag-alt:before{content:"\f11d"}.icon-flag-checkered:before{content:"\f11e"}.icon-terminal:before{content:"\f120"}.icon-code:before{content:"\f121"}.icon-reply-all:before{content:"\f122"}.icon-mail-reply-all:before{content:"\f122"}.icon-star-half-full:before,.icon-star-half-empty:before{content:"\f123"}.icon-location-arrow:before{content:"\f124"}.icon-crop:before{content:"\f125"}.icon-code-fork:before{content:"\f126"}.icon-unlink:before{content:"\f127"}.icon-question:before{content:"\f128"}.icon-info:before{content:"\f129"}.icon-exclamation:before{content:"\f12a"}.icon-superscript:before{content:"\f12b"}.icon-subscript:before{content:"\f12c"}.icon-eraser:before{content:"\f12d"}.icon-puzzle-piece:before{content:"\f12e"}.icon-microphone:before{content:"\f130"}.icon-microphone-off:before{content:"\f131"}.icon-shield:before{content:"\f132"}.icon-calendar-empty:before{content:"\f133"}.icon-fire-extinguisher:before{content:"\f134"}.icon-rocket:before{content:"\f135"}.icon-maxcdn:before{content:"\f136"}.icon-chevron-sign-left:before{content:"\f137"}.icon-chevron-sign-right:before{content:"\f138"}.icon-chevron-sign-up:before{content:"\f139"}.icon-chevron-sign-down:before{content:"\f13a"}.icon-html5:before{content:"\f13b"}.icon-css3:before{content:"\f13c"}.icon-anchor:before{content:"\f13d"}.icon-unlock-alt:before{content:"\f13e"}.icon-bullseye:before{content:"\f140"}.icon-ellipsis-horizontal:before{content:"\f141"}.icon-ellipsis-vertical:before{content:"\f142"}.icon-rss-sign:before{content:"\f143"}.icon-play-sign:before{content:"\f144"}.icon-ticket:before{content:"\f145"}.icon-minus-sign-alt:before{content:"\f146"}.icon-check-minus:before{content:"\f147"}.icon-level-up:before{content:"\f148"}.icon-level-down:before{content:"\f149"}.icon-check-sign:before{content:"\f14a"}.icon-edit-sign:before{content:"\f14b"}.icon-external-link-sign:before{content:"\f14c"}.icon-share-sign:before{content:"\f14d"}.icon-compass:before{content:"\f14e"}.icon-collapse:before{content:"\f150"}.icon-collapse-top:before{content:"\f151"}.icon-expand:before{content:"\f152"}.icon-euro:before,.icon-eur:before{content:"\f153"}.icon-gbp:before{content:"\f154"}.icon-dollar:before,.icon-usd:before{content:"\f155"}.icon-rupee:before,.icon-inr:before{content:"\f156"}.icon-yen:before,.icon-jpy:before{content:"\f157"}.icon-renminbi:before,.icon-cny:before{content:"\f158"}.icon-won:before,.icon-krw:before{content:"\f159"}.icon-bitcoin:before,.icon-btc:before{content:"\f15a"}.icon-file:before{content:"\f15b"}.icon-file-text:before{content:"\f15c"}.icon-sort-by-alphabet:before{content:"\f15d"}.icon-sort-by-alphabet-alt:before{content:"\f15e"}.icon-sort-by-attributes:before{content:"\f160"}.icon-sort-by-attributes-alt:before{content:"\f161"}.icon-sort-by-order:before{content:"\f162"}.icon-sort-by-order-alt:before{content:"\f163"}.icon-thumbs-up:before{content:"\f164"}.icon-thumbs-down:before{content:"\f165"}.icon-youtube-sign:before{content:"\f166"}.icon-youtube:before{content:"\f167"}.icon-xing:before{content:"\f168"}.icon-xing-sign:before{content:"\f169"}.icon-youtube-play:before{content:"\f16a"}.icon-dropbox:before{content:"\f16b"}.icon-stackexchange:before{content:"\f16c"}.icon-instagram:before{content:"\f16d"}.icon-flickr:before{content:"\f16e"}.icon-adn:before{content:"\f170"}.icon-bitbucket:before{content:"\f171"}.icon-bitbucket-sign:before{content:"\f172"}.icon-tumblr:before{content:"\f173"}.icon-tumblr-sign:before{content:"\f174"}.icon-long-arrow-down:before{content:"\f175"}.icon-long-arrow-up:before{content:"\f176"}.icon-long-arrow-left:before{content:"\f177"}.icon-long-arrow-right:before{content:"\f178"}.icon-apple:before{content:"\f179"}.icon-windows:before{content:"\f17a"}.icon-android:before{content:"\f17b"}.icon-linux:before{content:"\f17c"}.icon-dribbble:before{content:"\f17d"}.icon-skype:before{content:"\f17e"}.icon-foursquare:before{content:"\f180"}.icon-trello:before{content:"\f181"}.icon-female:before{content:"\f182"}.icon-male:before{content:"\f183"}.icon-gittip:before{content:"\f184"}.icon-sun:before{content:"\f185"}.icon-moon:before{content:"\f186"}.icon-archive:before{content:"\f187"}.icon-bug:before{content:"\f188"}.icon-vk:before{content:"\f189"}.icon-weibo:before{content:"\f18a"}.icon-renren:before{content:"\f18b"}
27
+ #postbox-container-1 h3.version{font-family:HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",sans-serif;background:0 0;margin-bottom:10px;border-bottom:0 none;padding:7px 0;-webkit-box-shadow:0 0 0 #fff;-moz-box-shadow:0 0 0 #fff;box-shadow:0 0 0 #fff}#postbox-container-1 ul li i{font-size:1.2em;margin-right:10px}.log{margin:40px 0}.log code{font-size:1.2em;line-height:1.2em}.loader{margin-top:20px}.rate-box h4{font-family:HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",sans-serif;font-weight:400;font-size:1.2em}.rate-box i{color:#fcd237;text-shadow:0 0 1px #c59e43;font-size:1.9em;margin-bottom:10px;display:inline-block}.rate-box a{font-size:.8em;text-decoration:none;font-style:normal}.rss_pi-table{margin-bottom:20px}.rss_pi-table tbody tr.edit-row{display:none}.rss_pi-table tbody tr.edit-row.show{display:table-row}.rss_pi-table tbody tr.edit-row>td{padding:0;border-top:0 none}.rss_pi-table tbody tr.edit-row table{border:0 none;margin:0}.rss_pi-table tbody tr.edit-row table tr td{border:0 none;border-top:1px solid #F0F0F0;background:#fff}.rss_pi-table tbody tr.edit-row table tr td:first-child{background:#F9F9F9;border-right:1px solid #E1E1E1;width:440px}.rss_pi-table tbody tr.edit-row table tr td label{font-weight:700}.rss_pi-table tbody tr.edit-row table tr td p.description{color:#9f9f9f;font-size:.8em;line-height:2em;font-style:normal}.rss_pi-table tbody tr.edit-row table tr td input,.rss_pi-table tbody tr.edit-row table tr td textarea{padding:8px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}.rss_pi-table tbody tr.edit-row table tr td .radiolist li label{font-weight:400;display:inline-block}.rss_pi-table tbody tr.edit-row table tr td .radiolist li label input{display:inline-block;width:auto;margin-right:10px}.rss_pi-table tbody tr.data-row.show td{background:#2a95c5;background:-webkit-gradient(linear,left bottom,left top,color-stop(0,#185571),color-stop(1,#2a95c5));background:-ms-linear-gradient(bottom,#185571,#2a95c5);background:-moz-linear-gradient(center bottom,#185571 0,#2a95c5 100%);background:-o-linear-gradient(#2a95c5,#185571);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#2a95c5', endColorstr='#185571', GradientType=0);border-top:1px solid #2a95c5;color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.5)}.rss_pi-table tbody tr.data-row.show td a{color:#fff;text-shadow:0 1px 1px rgba(0,0,0,.5)}.rss_pi-table tbody tr td{border-bottom:1px solid #E1E1E1;padding:10px}.rss_pi-table tbody tr td .row-options{visibility:hidden}.rss_pi-table tbody tr:hover .row-options{visibility:visible}.rss_pi-table tfoot tr td{padding:10px;text-align:right}.rss_pi-table code{display: block;float: left;clear: both;padding: 3px 5px;font-size: 0.9em;background: none;border: 1px #eaeaea solid;}a.delete-row {color: #a00;}a.delete-row:hover{color: red;}.rss-pi-error{margin: 5px 0 15px;border-left: 4px solid #dd3d36;background: #fff;box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);padding: 1px 12px;} .selectit > input,.tags_container input {
28
  width: 4% !important;
 
29
  }
30
+ label.selectit,.tags_container label {
31
+ color:#555555 !important;
32
+ font-weight: normal !important;
 
 
 
 
 
 
33
  }
34
+ div.category_container,
35
+ div.tags_container {
36
+ max-height: 205px;
37
+ overflow: auto;
 
 
 
38
  }
39
+ div.category_container ul.children {
40
+ margin-bottom: 6px;
41
+ margin-top: 7px;
42
+ }
43
+ .rss_pi_stat_message {
44
+ padding: 20px 0 20px 10px;
45
+ margin: 20px auto;
46
+ width: 90%;
47
+ border-left: 5px solid #0074A2;
48
+ background: #E1F2F9;
49
+ border-radius: 2px;
50
  }
 
51
  .rss_pi_stats_date {
52
+ padding: 20px 0;
53
+ margin: 20px auto;
54
+ width: 90%;
55
  }
 
56
  .rss_filter_heading {
57
+ font-weight: bold;
58
+ }
59
+ .rss_pi_stat_div {
60
+ height: 500px;
61
+ margin: 50px auto;
62
+ max-width: 800px !important;
63
+ }
64
+ #rss_pi-stats-placeholder {
65
+ position: relative;
66
+ min-height: 280px;
67
+ }
68
+ .rss_pi_overlay {
69
+ position: absolute;
70
+ left: 0;
71
+ top: 0;
72
+ bottom: 0;
73
+ right: 0;
74
+ background: #000;
75
+ color: #fff;
76
+ opacity: 0.5;
77
+ filter: alpha(opacity=50);
78
+ text-align: center;
79
+ font-size: 28px;
80
+ padding-top: 20px;
81
+ }
82
+ .rss_pi_overlay p {
83
+ color: #fff;
84
+ }
85
+ .rss_pi_loading {
86
+ width: 120px;
87
+ height: 120px;
88
+ position: absolute;
89
+ /*top: 50%;*/
90
+ top: 60px;
91
+ left: 50%;
92
+ /*margin: -40px 0 0 -60px;*/
93
+ margin: 0 0 0 -60px;
94
+ }
95
+ .rss_no_data_available {
96
+ padding: 20px;
97
+ text-align: center;
98
+ }
app/assets/img/loading.gif ADDED
Binary file
app/assets/js/main.js CHANGED
@@ -1,87 +1,184 @@
1
- jQuery('document').ready(function(){
2
 
3
  // Edit-buttons
4
- jQuery('body').on('click', 'a.toggle-edit', function() {
5
  jQuery('#edit_' + jQuery(this).attr('data-target')).toggleClass('show');
6
  jQuery('#display_' + jQuery(this).attr('data-target')).toggleClass('show');
7
  return false;
8
  });
9
 
10
  // Delete-buttons
11
- jQuery('body').on( 'click', 'a.delete-row', function() {
12
  jQuery('#edit_' + jQuery(this).attr('data-target')).remove();
13
  jQuery('#display_' + jQuery(this).attr('data-target')).remove();
14
  update_ids();
15
  return false;
16
  });
17
 
18
-
19
- jQuery('a.add-row').on('click', function() {
20
  jQuery.ajax({
21
  type: 'POST',
22
  url: rss_pi.ajaxurl,
23
  data: ({
24
  action: 'rss_pi_add_row'
25
  }),
26
- success: function(data) {
27
- jQuery('.rss-rows').append( data );
28
  jQuery('.empty_table').remove();
29
  update_ids();
30
  }
31
  });
32
  return false;
33
  });
34
-
35
- jQuery('#save_and_import').on('click', function() {
36
  jQuery('#save_to_db').val('true');
37
  });
38
-
39
- jQuery('a.load-log').on('click', function() {
40
  jQuery('#main_ui').hide();
41
- jQuery('.ajax_content').html( '<img src="/wp-admin/images/wpspin_light.gif" alt="" class="loader" />' );
42
  jQuery.ajax({
43
  type: 'POST',
44
  url: rss_pi.ajaxurl,
45
  data: ({
46
  action: 'rss_pi_load_log'
47
  }),
48
- success: function(data) {
49
- jQuery('.ajax_content').html( data );
50
  }
51
  });
52
  return false;
53
  });
54
-
55
- jQuery('body').delegate('a.show-main-ui', 'click', function() {
56
  jQuery('#main_ui').show();
57
  jQuery('.ajax_content').html('');
58
  return false;
59
  });
60
-
61
- jQuery('body').delegate('a.clear-log', 'click', function() {
62
  jQuery.ajax({
63
  type: 'POST',
64
  url: rss_pi.ajaxurl,
65
  data: ({
66
  action: 'rss_pi_clear_log'
67
  }),
68
- success: function(data) {
69
- jQuery('.log').html( data );
70
  }
71
  });
72
  return false;
73
  });
74
-
75
- jQuery("#from_date" ).datepicker();
76
- jQuery("#till_date" ).datepicker();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  });
79
 
80
- function update_ids()
81
- {
82
- ids = jQuery('input[name="id"]').map(function() {
83
  return jQuery(this).val();
84
- }).get().join();
85
-
86
  jQuery('#ids').val(ids);
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery('document').ready(function () {
2
 
3
  // Edit-buttons
4
+ jQuery('body').on('click', 'a.toggle-edit', function () {
5
  jQuery('#edit_' + jQuery(this).attr('data-target')).toggleClass('show');
6
  jQuery('#display_' + jQuery(this).attr('data-target')).toggleClass('show');
7
  return false;
8
  });
9
 
10
  // Delete-buttons
11
+ jQuery('body').on('click', 'a.delete-row', function () {
12
  jQuery('#edit_' + jQuery(this).attr('data-target')).remove();
13
  jQuery('#display_' + jQuery(this).attr('data-target')).remove();
14
  update_ids();
15
  return false;
16
  });
17
 
18
+ jQuery('a.add-row').on('click', function () {
 
19
  jQuery.ajax({
20
  type: 'POST',
21
  url: rss_pi.ajaxurl,
22
  data: ({
23
  action: 'rss_pi_add_row'
24
  }),
25
+ success: function (data) {
26
+ jQuery('.rss-rows').append(data);
27
  jQuery('.empty_table').remove();
28
  update_ids();
29
  }
30
  });
31
  return false;
32
  });
33
+
34
+ jQuery('#save_and_import').on('click', function () {
35
  jQuery('#save_to_db').val('true');
36
  });
37
+
38
+ jQuery('a.load-log').on('click', function () {
39
  jQuery('#main_ui').hide();
40
+ jQuery('.ajax_content').html('<img src="/wp-admin/images/wpspin_light.gif" alt="" class="loader" />');
41
  jQuery.ajax({
42
  type: 'POST',
43
  url: rss_pi.ajaxurl,
44
  data: ({
45
  action: 'rss_pi_load_log'
46
  }),
47
+ success: function (data) {
48
+ jQuery('.ajax_content').html(data);
49
  }
50
  });
51
  return false;
52
  });
53
+
54
+ jQuery('body').delegate('a.show-main-ui', 'click', function () {
55
  jQuery('#main_ui').show();
56
  jQuery('.ajax_content').html('');
57
  return false;
58
  });
59
+
60
+ jQuery('body').delegate('a.clear-log', 'click', function () {
61
  jQuery.ajax({
62
  type: 'POST',
63
  url: rss_pi.ajaxurl,
64
  data: ({
65
  action: 'rss_pi_clear_log'
66
  }),
67
+ success: function (data) {
68
+ jQuery('.log').html(data);
69
  }
70
  });
71
  return false;
72
  });
73
+
74
+ jQuery("#from_date").datepicker();
75
+ jQuery("#till_date").datepicker();
76
+
77
+ if ( jQuery("#rss_pi-stats-placeholder").length ) {
78
+ rss_filter_stats = function(form) {
79
+ var data = {
80
+ action: "rss_pi_stats",
81
+ rss_from_date: jQuery("#from_date").val() || "",
82
+ rss_till_date: jQuery("#till_date").val() || ""
83
+ },
84
+ $loading = false;
85
+ if (form && jQuery("#submit-rss_filter_stats").length) {
86
+ data.rss_filter_stats = jQuery("#submit-rss_filter_stats").val();
87
+ } else {
88
+ $loading = jQuery('<div class="rss_pi_overlay"><img class="rss_pi_loading" src="'+rss_pi.pluginurl+'app/assets/img/loading.gif" /><p>Stats are loading. Please wait...</p></div>').appendTo("#rss_pi-stats-placeholder");
89
+ }
90
+ jQuery.ajax({
91
+ type: "POST",
92
+ url: rss_pi.ajaxurl,
93
+ data: data,
94
+ success: function (data) {
95
+ if ($loading) { $loading.remove(); $loading = false; }
96
+ jQuery("#rss_pi-stats-placeholder").empty().append(data);
97
+ drawChart();
98
+ jQuery("#from_date").datepicker();
99
+ jQuery("#till_date").datepicker();
100
+ jQuery("#submit-rss_filter_stats").on("click",function(e){
101
+ e.preventDefault();
102
+ $loading = jQuery('<div class="rss_pi_overlay"><img class="rss_pi_loading" src="'+rss_pi.pluginurl+'app/assets/img/loading.gif" /><p>Stats are loading. Please wait...</p></div>').appendTo("#rss_pi-stats-placeholder");
103
+ rss_filter_stats(true);
104
+ });
105
+ }
106
+ });
107
+ };
108
+ rss_filter_stats();
109
+ }
110
+
111
+ if ( jQuery("#rss_pi_progressbar").length && feeds !== undefined && feeds.count ) {
112
+ var import_feed = function(id) {
113
+ jQuery.ajax({
114
+ type: 'POST',
115
+ url: rss_pi.ajaxurl,
116
+ data: {
117
+ action: 'rss_pi_import',
118
+ feed: id
119
+ },
120
+ success: function (data) {
121
+ var data = data.data || {};
122
+ jQuery("#rss_pi_progressbar").progressbar({
123
+ value: feeds.processed()
124
+ });
125
+ jQuery("#rss_pi_progressbar_label .processed").text(feeds.processed());
126
+ if ( data.count !== undefined ) feeds.imported(data.count);
127
+ if (feeds.left()) {
128
+ jQuery("#rss_pi_progressbar_label .count").text(feeds.imported());
129
+ import_feed(feeds.get());
130
+ } else {
131
+ jQuery("#rss_pi_progressbar_label").html("Import completed. Imported posts: " + feeds.imported());
132
+ }
133
+ }
134
+ });
135
+ }
136
+ jQuery("#rss_pi_progressbar").progressbar({
137
+ value: 0,
138
+ max: feeds.total()
139
+ });
140
+ jQuery("#rss_pi_progressbar_label").html("Import in progres. Processed feeds: <span class='processed'>0</span> of <span class='max'>"+feeds.total()+"</span>. Imported posts so far: <span class='count'>0</span>");
141
+ import_feed(feeds.get());
142
+ }
143
 
144
  });
145
 
146
+ function update_ids() {
147
+
148
+ ids = jQuery('input[name="id"]').map(function () {
149
  return jQuery(this).val();
150
+ }).get().join();
151
+
152
  jQuery('#ids').val(ids);
153
+
154
+ }
155
+
156
+ var feeds = {
157
+ ids: [],
158
+ // ids_cache: <?php echo json_encode($ids); ?>,
159
+ count: 0,
160
+ imported_posts: 0,
161
+ set: function(ids){
162
+ this.ids = ids;
163
+ this.count = ids.length;
164
+ },
165
+ get: function(){
166
+ return this.ids.splice(0,1)[0];
167
+ },
168
+ // has: function(){
169
+ // return !!this.ids.length;
170
+ // },
171
+ left: function(){
172
+ return this.ids.length;
173
+ },
174
+ processed: function(){
175
+ return this.count - this.ids.length;
176
+ },
177
+ total: function(){
178
+ return this.count;
179
+ },
180
+ imported: function(num){
181
+ if ( num !== undefined && !isNaN(parseInt(num)) ) this.imported_posts += parseInt(num);
182
+ return this.imported_posts;
183
+ }
184
+ };
app/class-rss-post-importer.php CHANGED
@@ -1,259 +1,150 @@
1
  <?php
2
 
3
  /**
4
-
5
  * One class to rule them all
6
-
7
  *
8
-
9
  * @author Saurabh Shukla <saurabh@yapapaya.com>
10
-
11
  */
12
-
13
  class rssPostImporter {
14
 
15
-
16
-
17
- /**
18
-
19
- * A var to store the options in
20
-
21
- * @var array
22
-
23
- */
24
-
25
- public $options = array();
26
-
27
-
28
-
29
- /**
30
-
31
- * To initialise the admin and cron classes
32
-
33
- *
34
-
35
- * @var object
36
-
37
- */
38
-
39
- private $admin, $cron;
40
-
41
-
42
-
43
- /**
44
-
45
- * Start
46
-
47
- */
48
-
49
- function __construct() {
50
-
51
-
52
-
53
- // populate the options first
54
-
55
- $this->load_options();
56
-
57
-
58
-
59
- // hook translations
60
-
61
- add_action('plugins_loaded', array($this, 'localize'));
62
-
63
-
64
-
65
- add_filter( 'plugin_action_links_' . RSS_PI_BASENAME, array($this, 'settings_link') );
66
-
67
- }
68
-
69
-
70
-
71
- /**
72
-
73
- * Load options from the db
74
-
75
- */
76
-
77
- public function load_options() {
78
-
79
-
80
-
81
- $default_settings = array(
82
-
83
- 'enable_logging' => false,
84
-
85
- 'feeds_api_key' => false,
86
-
87
- 'frequency' => 0,
88
-
89
- 'post_template' => "{\$content}\nSource: {\$feed_title}",
90
-
91
- 'post_status' => 'publish',
92
-
93
- 'author_id' => 1,
94
-
95
- 'allow_comments' => 'open',
96
-
97
- 'block_indexing' => false,
98
-
99
- 'nofollow_outbound' => true,
100
-
101
- 'keywords' => array(),
102
-
103
- 'import_images_locally' => false
104
-
105
- );
106
-
107
-
108
-
109
- $options = get_option('rss_pi_feeds', array());
110
-
111
-
112
-
113
- if (!isset($options['settings'])) {
114
-
115
- $options['settings'] = array();
116
-
117
- }
118
-
119
-
120
-
121
- $options['settings'] = wp_parse_args($options['settings'], $default_settings);
122
-
123
-
124
-
125
- if (!array_key_exists('imports', $options)) {
126
-
127
- $options['imports'] = 0;
128
-
129
- }
130
-
131
-
132
-
133
- $this->options = $options;
134
-
135
- }
136
-
137
-
138
-
139
- /**
140
-
141
- * Load translations
142
-
143
- */
144
-
145
- public function localize() {
146
-
147
-
148
-
149
- load_plugin_textdomain('rss_pi', false, RSS_PI_PATH . 'app/lang/');
150
-
151
- }
152
-
153
-
154
-
155
- /**
156
-
157
- * Initialise
158
-
159
- */
160
-
161
- public function init() {
162
-
163
-
164
-
165
- // initialise admin and cron
166
-
167
- $this->cron = new rssPICron();
168
-
169
- $this->cron->init();
170
-
171
-
172
-
173
- $this->admin = new rssPIAdmin();
174
-
175
- $this->admin->init();
176
-
177
-
178
-
179
- $this->front = new rssPIFront();
180
-
181
- $this->front->init();
182
-
183
- }
184
-
185
-
186
-
187
- /**
188
-
189
- * Check if a given API key is valid
190
-
191
- *
192
-
193
- * @param string $key
194
-
195
- * @return boolean
196
-
197
- */
198
-
199
- public function is_valid_key($key) {
200
-
201
-
202
-
203
- if (empty($key)) {
204
-
205
- return false;
206
-
207
- }
208
-
209
-
210
-
211
- $url = "http://176.58.108.28/fetch.php?key=$key&url=http://dummyurl.com";
212
-
213
- $content = file_get_contents($url);
214
-
215
-
216
-
217
- if (trim($content) == "A valid key must be supplied") {
218
-
219
- return false;
220
-
221
- }
222
-
223
-
224
-
225
- return true;
226
-
227
- }
228
-
229
-
230
-
231
- /**
232
-
233
- * Adds a settings link
234
-
235
- *
236
-
237
- * @param array $links EXisting links
238
-
239
- * @return type
240
-
241
- */
242
-
243
- public function settings_link($links) {
244
-
245
- $settings_link = array(
246
-
247
- '<a href="' . admin_url('options-general.php?page=rss_pi') . '">Settings</a>',
248
-
249
- );
250
-
251
- return array_merge($settings_link, $links);
252
-
253
- }
254
-
255
-
256
-
257
 
258
  }
259
-
1
  <?php
2
 
3
  /**
 
4
  * One class to rule them all
 
5
  *
 
6
  * @author Saurabh Shukla <saurabh@yapapaya.com>
 
7
  */
 
8
  class rssPostImporter {
9
 
10
+ /**
11
+ * A var to store the options in
12
+ * @var array
13
+ */
14
+ public $options = array();
15
+
16
+ /**
17
+ * A var to store the link to the plugin page
18
+ * @var array
19
+ */
20
+ public $page_link = '';
21
+
22
+ /**
23
+ * To initialise the admin and cron classes
24
+ *
25
+ * @var object
26
+ */
27
+ private $admin, $cron;
28
+
29
+ /**
30
+ * Start
31
+ */
32
+ function __construct() {
33
+
34
+ // populate the options first
35
+ $this->load_options();
36
+
37
+ // setup this plugin options page link
38
+ $this->page_link = admin_url('options-general.php?page=rss_pi');
39
+
40
+ // hook translations
41
+ add_action('plugins_loaded', array($this, 'localize'));
42
+
43
+ add_filter('plugin_action_links_' . RSS_PI_BASENAME, array($this, 'settings_link'));
44
+ }
45
+
46
+ /**
47
+ * Load options from the db
48
+ */
49
+ public function load_options() {
50
+
51
+ $default_settings = array(
52
+ 'enable_logging' => false,
53
+ 'feeds_api_key' => false,
54
+ 'frequency' => 0,
55
+ 'post_template' => "{\$content}\nSource: {\$feed_title}",
56
+ 'post_status' => 'publish',
57
+ 'author_id' => 1,
58
+ 'allow_comments' => 'open',
59
+ 'block_indexing' => false,
60
+ 'nofollow_outbound' => true,
61
+ 'keywords' => array(),
62
+ 'import_images_locally' => false,
63
+ 'disable_thumbnail' => false,
64
+ );
65
+
66
+ $options = get_option('rss_pi_feeds', array());
67
+
68
+ // prepare default options when there is no record in the database
69
+ if (!isset($options['feeds'])) {
70
+ $options['feeds'] = array();
71
+ }
72
+ if (!isset($options['settings'])) {
73
+ $options['settings'] = array();
74
+ }
75
+ if (!isset($options['latest_import'])) {
76
+ $options['latest_import'] = '';
77
+ }
78
+ if (!isset($options['imports'])) {
79
+ $options['imports'] = 0;
80
+ }
81
+
82
+ $options['settings'] = wp_parse_args($options['settings'], $default_settings);
83
+
84
+ if (!array_key_exists('imports', $options)) {
85
+ $options['imports'] = 0;
86
+ }
87
+
88
+ $this->options = $options;
89
+ }
90
+
91
+ /**
92
+ * Load translations
93
+ */
94
+ public function localize() {
95
+
96
+ load_plugin_textdomain('rss_pi', false, RSS_PI_PATH . 'app/lang/');
97
+ }
98
+
99
+ /**
100
+ * Initialise
101
+ */
102
+ public function init() {
103
+
104
+ // initialise admin and cron
105
+ $this->cron = new rssPICron();
106
+ $this->cron->init();
107
+
108
+ $this->admin = new rssPIAdmin();
109
+ $this->admin->init();
110
+
111
+ $this->front = new rssPIFront();
112
+ $this->front->init();
113
+ }
114
+
115
+ /**
116
+ * Check if a given API key is valid
117
+ *
118
+ * @param string $key
119
+ * @return boolean
120
+ */
121
+ public function is_valid_key($key) {
122
+
123
+ if (empty($key)) {
124
+ return false;
125
+ }
126
+
127
+ $url = "http://176.58.108.28/fetch.php?key=$key&url=http://dummyurl.com";
128
+ $content = file_get_contents($url);
129
+
130
+ if (trim($content) == "A valid key must be supplied") {
131
+ return false;
132
+ }
133
+
134
+ return true;
135
+ }
136
+
137
+ /**
138
+ * Adds a settings link
139
+ *
140
+ * @param array $links EXisting links
141
+ * @return type
142
+ */
143
+ public function settings_link($links) {
144
+ $settings_link = array(
145
+ '<a href="' . $this->page_link . '">Settings</a>',
146
+ );
147
+ return array_merge($settings_link, $links);
148
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
 
150
  }
 
app/classes/admin/class-rss-pi-admin-processor.php CHANGED
@@ -1,519 +1,316 @@
1
  <?php
2
 
3
-
4
-
5
  /**
6
-
7
  * Processes the admin screen form submissions
8
-
9
  *
10
-
11
  * @author Saurabh Shukla <saurabh@yapapaya.com>
12
-
13
  */
14
-
15
  class rssPIAdminProcessor {
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
 
 
18
 
19
- /**
20
-
21
- * If we have a valid api key
22
-
23
- *
24
-
25
- * @var boolean
26
-
27
- */
28
-
29
- var $is_key_valid;
30
-
31
-
32
-
33
- /**
34
-
35
- * Process the form result
36
-
37
- *
38
-
39
- * @return null
40
-
41
- */
42
-
43
- function process() {
44
-
45
-
46
-
47
- // if there's nothing for processing or invalid data, bail
48
-
49
- if (!isset($_POST['info_update']) || !wp_verify_nonce($_POST['rss_pi_nonce'], 'settings_page')) {
50
-
51
- return;
52
-
53
- }
54
-
55
-
56
-
57
- // Get ids of feed-rows
58
-
59
- $ids = explode(",", $_POST['ids']);
60
-
61
-
62
-
63
- // formulate the settings array
64
-
65
- $settings = $this->process_settings();
66
-
67
-
68
-
69
- // update cron settings
70
 
71
- $this->update_cron($settings['frequency']);
 
 
72
 
 
 
73
 
 
 
74
 
75
- // formulate the feeds array
 
 
76
 
77
- $feeds = $this->process_feeds($ids);
78
-
79
 
80
- // save and reload the options
 
81
 
82
- $feeds = $this->import_csv($feeds);
83
-
84
 
85
- // save and reload the options
 
 
 
 
 
 
 
 
 
 
 
86
 
87
- $this->save_reload_options($settings, $feeds);
 
88
 
 
 
 
89
 
 
 
 
 
 
 
 
 
90
 
91
- // display a success message
92
 
93
- ?>
 
 
94
 
95
- <div id="message" class="updated">
 
 
 
 
 
 
 
 
 
 
96
 
97
- <p><strong><?php _e('Settings saved.', 'rss_pi') ?></strong></p>
 
 
 
 
 
98
 
99
- </div>
100
 
101
- <?php
102
 
103
- // check if we need to and import feeds
 
 
 
 
 
 
104
 
105
- $this->import();
 
106
 
107
- }
108
 
109
- /**
110
 
111
- * Import CSV function to import CSV file data into database
112
-
113
- * @return array
114
 
115
- */
116
 
117
- private function import_csv($feeds) {
118
-
119
- if(is_uploaded_file($_FILES['import_csv']['tmp_name'])) {
120
- $file = $_FILES['import_csv']['tmp_name'];
121
- $fcount = file($file);
122
- $linescount = count($fcount)-1;
123
- $file_handle = fopen($file,"r");
124
- $t=0;
125
- $titlearray = array();
126
- while($csv_line = fgetcsv($file_handle,1024)) {
127
-
128
- if($t <> 0)
129
- {
130
-
131
- for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
132
- if($i == 0)
133
- $importdata['feeds'][$t-1]['id'] = uniqid("54d4c".$t);
134
-
135
- $importdata['feeds'][$t-1][$titlearray[$i]] = $csv_line[$i];
136
-
137
- }
138
- }
139
- else{
140
- for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
141
- $titlearray[] = $csv_line[$i];
142
- }
143
- }
144
- $t++;
145
- }
146
- fclose($file_handle) or die("can't close file");
147
-
148
-
149
- if(!empty($importdata['feeds']))
150
- {
151
- for($r=0;$r<count($importdata['feeds']);$r++)
152
- {
153
- $importdata['feeds'][$r]['category_id'] = array(1);
154
- $importdata['feeds'][$r]['tags_id'] = "";
155
- $importdata['feeds'][$r]['strip_html'] = "false";
156
-
157
- $check_result = $this->check_feed_exist($feeds,$importdata['feeds'][$r]);
158
-
159
- if($check_result){
160
-
161
- unset($importdata['feeds'][$r]);
162
-
163
- }
164
- else{
165
- array_push($feeds,$importdata['feeds'][$r]);
166
- }
167
-
168
- }
169
-
170
- }
171
  }
172
-
173
- return $feeds;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
-
176
- function check_feed_exist($feeds,$csvlink){
177
- if(!empty($feeds) && !empty($csvlink)){
178
-
179
- for($g=0;$g<count($feeds);$g++)
180
- {
181
-
182
- if($feeds[$g]['url'] == $csvlink['url'])
183
- {
184
-
185
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
186
  }
187
  }
188
- return false;
 
 
 
 
 
 
 
 
 
 
 
189
  }
190
  }
191
 
192
- /**
193
-
194
- * Process submitted data to formulate settings array
195
-
196
- *
197
-
198
- * @global object $rss_post_importer
199
-
200
- * @return array
201
-
202
- */
203
-
204
- private function process_settings() {
205
-
206
-
207
-
208
- // Get selected settings for all imported posts
209
-
210
- $settings = array(
211
-
212
- 'frequency' => $_POST['frequency'],
213
-
214
- 'feeds_api_key' => $_POST['feeds_api_key'],
215
-
216
- 'post_template' => stripslashes_deep($_POST['post_template']),
217
-
218
- 'post_status' => $_POST['post_status'],
219
-
220
- 'author_id' => $_POST['author_id'],
221
-
222
- 'allow_comments' => $_POST['allow_comments'],
223
-
224
- 'block_indexing' => $_POST['block_indexing'],
225
-
226
- 'nofollow_outbound' => $_POST['nofollow_outbound'],
227
-
228
- 'enable_logging' => $_POST['enable_logging'],
229
-
230
- 'import_images_locally' => $_POST['import_images_locally'],
231
-
232
- 'keywords' => array()
233
-
234
- );
235
-
236
-
237
-
238
- global $rss_post_importer;
239
-
240
-
241
-
242
- // check if submitted api key is valid
243
-
244
- $this->is_key_valid = $rss_post_importer->is_valid_key($settings['feeds_api_key']);
245
-
246
-
247
-
248
- // filter the settings and then send them back for saving
249
-
250
- return $this->filter($settings);
251
-
252
- }
253
-
254
-
255
-
256
- /**
257
-
258
- * Update the frequency of the import cron job
259
-
260
- *
261
-
262
- * @param string $frequency
263
-
264
- */
265
-
266
- private function update_cron($frequency) {
267
-
268
-
269
-
270
- // If cron settings have changed
271
-
272
- if (wp_get_schedule('rss_pi_cron') != $frequency) {
273
-
274
-
275
-
276
- // Reset cron
277
-
278
- wp_clear_scheduled_hook('rss_pi_cron');
279
-
280
- wp_schedule_event(time(), $frequency, 'rss_pi_cron');
281
-
282
- }
283
-
284
- }
285
-
286
-
287
-
288
- /**
289
-
290
- * Forms the feeds array from submitted data
291
-
292
- *
293
-
294
- * @param array $ids feeds ids
295
-
296
- * @return array
297
-
298
- */
299
-
300
- private function process_feeds($ids) {
301
-
302
-
303
-
304
- $feeds = array();
305
-
306
-
307
-
308
- foreach ($ids as $id) {
309
-
310
- if ($id) {
311
-
312
- array_push($feeds, array(
313
-
314
- 'id' => $id,
315
-
316
- 'url' => strtolower($_POST[$id . '-url']),
317
-
318
- 'name' => $_POST[$id . '-name'],
319
-
320
- 'max_posts' => $_POST[$id . '-max_posts'],
321
-
322
- // different author ids depending on valid API keys
323
-
324
- 'author_id' => $this->is_key_valid ? $_POST[$id . '-author_id'] : $_POST['author_id'],
325
-
326
- 'category_id' => (isset($_POST[$id . '-category_id']))? $_POST[$id . '-category_id'] : "" ,
327
-
328
- 'tags_id' => (isset($_POST[$id . '-tags_id']))? $_POST[$id . '-tags_id'] : "",
329
-
330
- 'strip_html' => $_POST[$id . '-strip_html']
331
-
332
- ));
333
-
334
- }
335
-
336
- }
337
-
338
-
339
-
340
- return $feeds;
341
-
342
- }
343
-
344
-
345
-
346
- /**
347
-
348
- * Update options and reload global options
349
-
350
- *
351
-
352
- * @global type $rss_post_importer
353
-
354
- * @param array $settings
355
-
356
- * @param array $feeds
357
-
358
- */
359
-
360
- private function save_reload_options($settings, $feeds) {
361
-
362
-
363
-
364
- global $rss_post_importer;
365
-
366
-
367
-
368
- // existing options
369
-
370
- $options = $rss_post_importer->options;
371
-
372
-
373
-
374
- // new data
375
-
376
- $new_options = array(
377
-
378
- 'feeds' => $feeds,
379
-
380
- 'settings' => $settings,
381
-
382
- 'latest_import' => $options['latest_import'],
383
-
384
- 'imports' => $options['imports']
385
-
386
- );
387
-
388
-
389
-
390
- // update in db
391
-
392
- update_option('rss_pi_feeds', $new_options);
393
-
394
-
395
-
396
- // reload so that the new options are used henceforth
397
-
398
- $rss_post_importer->load_options();
399
-
400
- }
401
-
402
-
403
-
404
- /**
405
-
406
- * Import feeds
407
-
408
- *
409
-
410
- * @return null
411
-
412
- */
413
-
414
- private function import() {
415
-
416
-
417
-
418
- // if we don't need to import anything, bail
419
-
420
- if ($_POST['save_to_db'] != 'true') {
421
-
422
- return;
423
-
424
- }
425
-
426
-
427
-
428
- // initialise the engine and import
429
-
430
- $engine = new rssPIEngine();
431
-
432
- $imported = $engine->import_feed();
433
-
434
- ?>
435
-
436
- <div id="message" class="updated">
437
-
438
- <p><strong><?php echo($imported); ?> <?php _e('new posts imported.', 'rss_pi') ?></strong></p>
439
-
440
- </div>
441
-
442
- <?php
443
-
444
- }
445
-
446
-
447
-
448
- /**
449
-
450
- * Filter settings for API key vs non-API key installs
451
-
452
- *
453
-
454
- * @param array $settings
455
-
456
- * @return array
457
-
458
- */
459
-
460
- private function filter($settings) {
461
-
462
-
463
-
464
- // if the key is not fine
465
-
466
- if (!empty($settings['feeds_api_key']) && !$this->is_key_valid) {
467
-
468
-
469
-
470
- // unset from settings
471
-
472
- unset($settings['feeds_api_key']);
473
-
474
- echo '<div class="error">
475
-
476
- <p>' . __('Invalid API key!', 'rss_api') . '</p>
477
-
478
- </div>';
479
-
480
- }
481
-
482
-
483
-
484
- // if the key is valid
485
-
486
- if ($this->is_key_valid) {
487
-
488
-
489
-
490
- // set up keywords (otherwise don't)
491
-
492
- $keyword_str = $_POST['keyword_filter'];
493
-
494
-
495
-
496
- $keywords = array();
497
-
498
-
499
-
500
- if (!empty($keyword_str)) {
501
 
502
- $keywords = explode(',', $keyword_str);
 
 
503
 
504
- }
 
505
 
506
- $settings['keywords'] = $keywords;
 
 
 
 
 
 
507
 
508
- }
 
509
 
 
 
 
 
510
 
 
 
511
 
512
- return $settings;
 
 
513
 
514
- }
515
 
 
 
 
 
 
516
 
 
 
517
 
518
  }
519
-
1
  <?php
2
 
 
 
3
  /**
 
4
  * Processes the admin screen form submissions
 
5
  *
 
6
  * @author Saurabh Shukla <saurabh@yapapaya.com>
 
7
  */
 
8
  class rssPIAdminProcessor {
9
 
10
+ /**
11
+ * If we have a valid api key
12
+ *
13
+ * @var boolean
14
+ */
15
+ var $is_key_valid;
16
+
17
+ /**
18
+ * Process the form result
19
+ *
20
+ * @global object $rss_post_importer
21
+ * @return null
22
+ */
23
+ function process() {
24
+
25
+ // if there's nothing for processing or invalid data, bail
26
+ if (!isset($_POST['info_update']) || !wp_verify_nonce($_POST['rss_pi_nonce'], 'settings_page')) {
27
+ return;
28
+ }
29
 
30
+ // Get ids of feed-rows
31
+ $ids = explode(",", $_POST['ids']);
32
 
33
+ // formulate the settings array
34
+ $settings = $this->process_settings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ // check result for "invalid_key" flag
37
+ $invalid_api_key = isset($settings['invalid_api_key']);
38
+ unset($settings['invalid_api_key']);
39
 
40
+ // update cron settings
41
+ $this->update_cron($settings['frequency']);
42
 
43
+ // formulate the feeds array
44
+ $feeds = $this->process_feeds($ids);
45
 
46
+ // import settings
47
+ if (isset($_FILES['import_csv']))
48
+ $feeds = $this->import_csv($feeds);
49
 
50
+ // save and reload the options
51
+ $this->save_reload_options($settings, $feeds);
52
 
53
+ // // check if we need to and import feeds
54
+ // $imported = $this->import();
55
 
56
+ global $rss_post_importer;
 
57
 
58
+ // wp_redirect(add_query_arg(array('settings-updated'=>'true','imported'=>$imported),$rss_post_importer->page_link));
59
+ // wp_redirect(add_query_arg(array('settings-updated'=>'true','import'=>($_POST['save_to_db']=='true')),$rss_post_importer->page_link));
60
+ wp_redirect(add_query_arg(
61
+ array(
62
+ 'settings-updated' => 'true',
63
+ 'import' => ( $_POST['save_to_db'] == 'true' ),
64
+ 'message' => $invalid_api_key ? 2 : 1
65
+ ),
66
+ $rss_post_importer->page_link
67
+ ));
68
+ exit;
69
+ }
70
 
71
+ /**
72
+ * Import CSV function to import CSV file data into database
73
 
74
+ * @return array
75
+ */
76
+ private function import_csv($feeds) {
77
 
78
+ if (is_uploaded_file($_FILES['import_csv']['tmp_name'])) {
79
+ $file = $_FILES['import_csv']['tmp_name'];
80
+ $fcount = file($file);
81
+ $linescount = count($fcount) - 1;
82
+ $file_handle = fopen($file, "r");
83
+ $t = 0;
84
+ $titlearray = array();
85
+ while ($csv_line = fgetcsv($file_handle, 1024)) {
86
 
87
+ if ($t <> 0) {
88
 
89
+ for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
90
+ if ($i == 0)
91
+ $importdata['feeds'][$t - 1]['id'] = uniqid("54d4c" . $t);
92
 
93
+ $importdata['feeds'][$t - 1][$titlearray[$i]] = $csv_line[$i];
94
+ }
95
+ }
96
+ else {
97
+ for ($i = 0, $j = count($csv_line); $i < $j; $i++) {
98
+ $titlearray[] = $csv_line[$i];
99
+ }
100
+ }
101
+ $t++;
102
+ }
103
+ fclose($file_handle) or die("can't close file");
104
 
105
+ if (!empty($importdata['feeds'])) {
106
+ for ($r = 0; $r < count($importdata['feeds']); $r++) {
107
+ $importdata['feeds'][$r]['category_id'] = array(1);
108
+ $importdata['feeds'][$r]['tags_id'] = "";
109
+ $importdata['feeds'][$r]['keywords'] = "";
110
+ $importdata['feeds'][$r]['strip_html'] = "false";
111
 
112
+ $check_result = $this->check_feed_exist($feeds, $importdata['feeds'][$r]);
113
 
114
+ if ($check_result) {
115
 
116
+ unset($importdata['feeds'][$r]);
117
+ } else {
118
+ array_push($feeds, $importdata['feeds'][$r]);
119
+ }
120
+ }
121
+ }
122
+ }
123
 
124
+ return $feeds;
125
+ }
126
 
127
+ function check_feed_exist($feeds, $csvlink) {
128
 
129
+ if (!empty($feeds) && !empty($csvlink)) {
130
 
131
+ for ($g = 0; $g < count($feeds); $g++) {
 
 
132
 
133
+ if ($feeds[$g]['url'] == $csvlink['url']) {
134
 
135
+ return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  }
137
+ }
138
+ return false;
139
+ }
140
+ }
141
+
142
+ /**
143
+ * Process submitted data to formulate settings array
144
+ *
145
+ * @global object $rss_post_importer
146
+ * @return array
147
+ */
148
+ private function process_settings() {
149
+
150
+ // Get selected settings for all imported posts
151
+ $settings = array(
152
+ 'frequency' => $_POST['frequency'],
153
+ 'feeds_api_key' => $_POST['feeds_api_key'],
154
+ 'post_template' => stripslashes_deep($_POST['post_template']),
155
+ 'post_status' => $_POST['post_status'],
156
+ 'author_id' => $_POST['author_id'],
157
+ 'allow_comments' => $_POST['allow_comments'],
158
+ 'block_indexing' => $_POST['block_indexing'],
159
+ 'nofollow_outbound' => $_POST['nofollow_outbound'],
160
+ 'enable_logging' => $_POST['enable_logging'],
161
+ 'import_images_locally' => $_POST['import_images_locally'],
162
+ 'disable_thumbnail' => $_POST['disable_thumbnail'],
163
+ 'keywords' => array()
164
+ );
165
+
166
+ global $rss_post_importer;
167
+
168
+ // check if submitted api key is valid
169
+ $this->is_key_valid = $rss_post_importer->is_valid_key($settings['feeds_api_key']);
170
+ // save key validity state
171
+ $settings['is_key_valid'] = $this->is_key_valid;
172
+
173
+ // filter the settings and then send them back for saving
174
+ return $this->filter($settings);
175
+ }
176
+
177
+ /**
178
+ * Update the frequency of the import cron job
179
+ *
180
+ * @param string $frequency
181
+ */
182
+ private function update_cron($frequency) {
183
+
184
+ // If cron settings have changed
185
+ if (wp_get_schedule('rss_pi_cron') != $frequency) {
186
+
187
+ // Reset cron
188
+ wp_clear_scheduled_hook('rss_pi_cron');
189
+ wp_schedule_event(time(), $frequency, 'rss_pi_cron');
190
  }
191
+ }
192
+
193
+ /**
194
+ * Forms the feeds array from submitted data
195
+ *
196
+ * @param array $ids feeds ids
197
+ * @return array
198
+ */
199
+ private function process_feeds($ids) {
200
+
201
+ $feeds = array();
202
+
203
+ foreach ($ids as $id) {
204
+ if ($id) {
205
+ $keywords = array();
206
+ // if the key is valid
207
+ if ($this->is_key_valid) {
208
+ // set up keywords (otherwise don't)
209
+ if (isset($_POST[$id . '-keywords'])) {
210
+ $keyword_str = $_POST[$id . '-keywords'];
211
+ }
212
+ if (!empty($keyword_str)) {
213
+ $keywords = explode(',', $keyword_str);
214
  }
215
  }
216
+ array_push($feeds, array(
217
+ 'id' => $id,
218
+ 'url' => $_POST[$id . '-url'],
219
+ 'name' => $_POST[$id . '-name'],
220
+ 'max_posts' => $_POST[$id . '-max_posts'],
221
+ // different author ids depending on valid API keys
222
+ 'author_id' => ($this->is_key_valid && isset($_POST[$id . '-author_id'])) ? $_POST[$id . '-author_id'] : $_POST['author_id'],
223
+ 'category_id' => (isset($_POST[$id . '-category_id'])) ? $_POST[$id . '-category_id'] : '',
224
+ 'tags_id' => (isset($_POST[$id . '-tags_id'])) ? $_POST[$id . '-tags_id'] : '',
225
+ 'keywords' => array_map('trim',$keywords),
226
+ 'strip_html' => $_POST[$id . '-strip_html']
227
+ ));
228
  }
229
  }
230
 
231
+ return $feeds;
232
+ }
233
+
234
+ /**
235
+ * Update options and reload global options
236
+ *
237
+ * @global type $rss_post_importer
238
+ * @param array $settings
239
+ * @param array $feeds
240
+ */
241
+ private function save_reload_options($settings, $feeds) {
242
+
243
+ global $rss_post_importer;
244
+
245
+ // existing options
246
+ $options = $rss_post_importer->options;
247
+
248
+ // new data
249
+ $new_options = array(
250
+ 'feeds' => $feeds,
251
+ 'settings' => $settings,
252
+ 'latest_import' => $options['latest_import'],
253
+ 'imports' => $options['imports']
254
+ );
255
+
256
+ // update in db
257
+ update_option('rss_pi_feeds', $new_options);
258
+
259
+ // reload so that the new options are used henceforth
260
+ $rss_post_importer->load_options();
261
+ }
262
+
263
+ /**
264
+ * Import feeds
265
+ *
266
+ * @return null
267
+ */
268
+ private function import() {
269
+
270
+ // if we don't need to import anything, bail
271
+ if ($_POST['save_to_db'] != 'true') {
272
+ return;
273
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
 
275
+ // initialise the engine and import
276
+ $engine = new rssPIEngine();
277
+ $imported = $engine->import_feed();
278
 
279
+ return $imported;
280
+ }
281
 
282
+ /**
283
+ * Filter settings for API key vs non-API key installs
284
+ *
285
+ * @param array $settings
286
+ * @return array
287
+ */
288
+ private function filter($settings) {
289
 
290
+ // if the key is not fine
291
+ if (!empty($settings['feeds_api_key']) && !$this->is_key_valid) {
292
 
293
+ // unset from settings
294
+ unset($settings['feeds_api_key']);
295
+ $settings['invalid_api_key'] = true;
296
+ }
297
 
298
+ // if the key is valid
299
+ if ($this->is_key_valid) {
300
 
301
+ // set up keywords (otherwise don't)
302
+ if (isset($_POST['keyword_filter']))
303
+ $keyword_str = $_POST['keyword_filter'];
304
 
305
+ $keywords = array();
306
 
307
+ if (!empty($keyword_str)) {
308
+ $keywords = explode(',', $keyword_str);
309
+ }
310
+ $settings['keywords'] = array_map('trim',$keywords);
311
+ }
312
 
313
+ return $settings;
314
+ }
315
 
316
  }
 
app/classes/admin/class-rss-pi-admin.php CHANGED
@@ -7,290 +7,485 @@
7
  */
8
  class rssPIAdmin {
9
 
10
- /**
11
- * Whether the API key is valid
12
- *
13
- * @var boolean
14
- */
15
- var $is_key_valid;
16
-
17
- /**
18
- * The options
19
- *
20
- * @var array
21
- */
22
- var $options;
23
-
24
- /**
25
- * Aprompt for invalid/absent API keys
26
- * @var string
27
- */
28
- var $key_prompt;
29
-
30
- /**
31
- * Start
32
- *
33
- * @global object $rss_post_importer
34
- */
35
- public function __construct() {
36
-
37
- $this->load_options();
38
-
39
- // add a key prompt
40
- $this->key_prompt = __('You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
41
-
42
- $this->key_prompt_multiple_category = __('Multiple Category selection available.You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
43
- $this->key_prompt_multiple_tags = __('Multiple Tags selection available.You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
44
-
45
- // initialise logging
46
- $this->log = new rssPILog();
47
- $this->log->init();
48
-
49
- // load the form processor
50
- $this->processor = new rssPIAdminProcessor();
51
- }
52
-
53
- private function load_options(){
54
- global $rss_post_importer;
55
-
56
- // add options
57
- $this->options = $rss_post_importer->options;
58
-
59
- // check if key is valid
60
- $this->is_key_valid = $rss_post_importer->is_valid_key($this->options['settings']['feeds_api_key']);
61
- }
62
-
63
- /**
64
- * Initialise and hook all actions
65
- */
66
- public function init() {
67
-
68
- // add to admin menu
69
- add_action('admin_menu', array($this, 'admin_menu'));
70
-
71
- // load scripts and styles we need
72
- add_action('admin_enqueue_scripts', array($this, 'enqueue'));
73
-
74
- // the ajax for adding new feeds (table rows)
75
- add_action('wp_ajax_rss_pi_add_row', array($this, 'add_row'));
76
-
77
- // disable the feed author dropdown for invalid/absent API keys
78
- add_filter('wp_dropdown_users', array($this, 'disable_user_dropdown'));
79
-
80
- // Add 10 minutes in frequency.
81
- add_filter('cron_schedules', array($this, 'rss_pi_cron_add'));
82
- }
83
-
84
- /**
85
- * Add to admin menu
86
- */
87
- function admin_menu() {
88
-
89
- add_options_page('Rss Post Importer', 'Rss Post Importer', 'manage_options', 'rss_pi', array($this, 'screen'));
90
- }
91
-
92
- /**
93
- * Enqueue our admin css and js
94
- *
95
- * @param string $hook The current screens hook
96
- * @return null
97
- */
98
- public function enqueue($hook) {
99
-
100
- // don't load if it isn't our screen
101
- if ($hook != 'settings_page_rss_pi') {
102
- return;
103
- }
104
-
105
- // register scripts & styles
106
- wp_enqueue_style('rss-pi', RSS_PI_URL . 'app/assets/css/style.css', array(), RSS_PI_VERSION);
107
-
108
- wp_enqueue_style('rss-pi-jquery-ui-css',
109
- 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css',
110
- false,
111
- RSS_PI_VERSION,
112
- false);
113
-
114
- wp_enqueue_script( 'jquery-ui-core' );
115
-
116
- wp_enqueue_script( 'jquery-ui-datepicker' );
117
-
118
- wp_enqueue_script('rss-pi', RSS_PI_URL . 'app/assets/js/main.js', array('jquery'), RSS_PI_VERSION);
119
-
120
- // localise ajaxuel for use
121
- $localise_args = array(
122
- 'ajaxurl' => admin_url('admin-ajax.php')
123
- );
124
- wp_localize_script('rss-pi', 'rss_pi', $localise_args);
125
- }
126
- function rss_pi_cron_add($schedules){
127
- $schedules['minutes_10'] = array(
128
- 'interval' => 600,
129
- 'display'=> '10 minutes'
130
- );
131
- return $schedules;
132
- }
133
- /**
134
- * Display the screen/ui
135
- */
136
- function screen() {
137
-
138
- // load the form processor first
139
- $this->processor->process();
140
- // it'll process any submitted form data
141
-
142
- // reload the options just in case
143
- $this->load_options();
144
-
145
- // include the template for the ui
146
- include( RSS_PI_PATH . 'app/templates/admin-ui.php');
147
- }
148
-
149
- /**
150
- * Display errors
151
- *
152
- * @param string $error The error message
153
- * @param boolean $inline Whether the error is inline or shown like regular wp errors
154
- */
155
- function key_error($error, $inline = false) {
156
-
157
- $class = ($inline) ? 'rss-pi-error' : 'error';
158
-
159
- echo '<div class="' . $class . '"><p>' . $error . '</p></div>';
160
- }
161
-
162
- /**
163
- * Add a new row for a new feed
164
- */
165
- function add_row() {
166
-
167
- include( RSS_PI_PATH . 'app/templates/feed-table-row.php');
168
- die();
169
- }
170
-
171
- /**
172
- * Disable the user dropdwon for each feed
173
- *
174
- * @param string $output The html of the select dropdown
175
- * @return string
176
- */
177
- function disable_user_dropdown($output) {
178
-
179
- // if we have a valid key we don't need to disable anything
180
- if ($this->is_key_valid) {
181
- return $output;
182
- }
183
-
184
- // check if this is the feed dropdown (and not any other)
185
- preg_match('/rss-pi-specific-feed-author/i', $output, $matched);
186
-
187
- // this is not our dropdown, no need to disable
188
- if (empty($matched)) {
189
- return $output;
190
- }
191
-
192
- // otherwise just disable the dropdown
193
- return str_replace('<select ', '<select disabled="disabled" ', $output);
194
- }
195
- /**
196
- * Walker class function for category multiple checkbox
197
- *
198
- *
199
- *
200
- */
201
- function wp_category_checklist_rss_pi($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true)
202
- {
203
- $cat = "";
204
- if (empty($walker) || !is_a($walker, 'Walker'))
205
- $walker = new Walker_Category_Checklist;
206
- $descendants_and_self = (int) $descendants_and_self;
207
- $args = array();
208
- if (is_array($selected_cats))
209
- $args['selected_cats'] = $selected_cats;
210
- elseif ($post_id)
211
- $args['selected_cats'] = wp_get_post_categories($post_id);
212
- else
213
- $args['selected_cats'] = array();
214
-
215
- if ($descendants_and_self) {
216
- $categories = get_categories("child_of=$descendants_and_self&hierarchical=0&hide_empty=0");
217
- $self = get_category($descendants_and_self);
218
- array_unshift($categories, $self);
219
- } else {
220
- $categories = get_categories('get=all');
221
  }
222
- if ($checked_ontop) {
223
- // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
224
- $checked_categories = array();
225
- $keys = array_keys($categories);
226
- foreach ($keys as $k) {
227
- if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
228
- $checked_categories[] = $categories[$k];
229
- unset($categories[$k]);
230
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  }
232
- // Put checked cats on top
233
- $cat = $cat . call_user_func_array(array(
234
- &$walker,
235
- 'walk'
236
- ), array(
237
- $checked_categories,
238
- 0,
239
- $args
240
- ));
241
  }
242
- // Then the rest of them
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  $cat = $cat . call_user_func_array(array(
244
- &$walker,
245
- 'walk'
246
- ), array(
247
- $categories,
248
- 0,
249
- $args
250
  ));
251
- return $cat;
252
  }
253
-
254
- function rss_pi_tags_dropdown($fid,$seleced_tags){
255
- if ($tags = get_tags( array('orderby' => 'name','hide_empty' => false) ))
256
- {
257
-
258
- echo '<select name="'.$fid.'-tags_id[]" id="tag" class="postform">';
259
-
260
- foreach ($tags as $tag)
261
- {
262
- $strsel = "";
263
- if(!empty($seleced_tags)){
264
-
265
- if($seleced_tags[0] == $tag->term_id){
266
- $strsel = "selected='selected'";
267
-
268
- }
 
 
 
 
 
 
 
 
269
  }
270
- echo '<option value="'.$tag->term_id.'" '.$strsel.'>'.$tag->name.'</option>';
271
-
272
  }
273
- echo '</select> ';
274
-
275
  }
 
276
  }
277
- function rss_pi_tags_checkboxes($fid,$seleced_tags){
278
- $tags = get_tags(array('hide_empty' => false));
279
- if ($tags) {
280
- $checkboxes = "<ul>";
281
-
282
- foreach($tags as $tag) :
283
- $strsel= "";
284
- if(in_array($tag->term_id, $seleced_tags))
285
- $strsel = "checked='checked'";
286
-
287
- $checkboxes .=
288
- '<li><label for="tag-'.$tag->term_id.'">
289
- <input type="checkbox" name="'.$fid.'-tags_id[]" value="'.$tag->term_id.'" id="tag-'.$tag->term_id.'" '.$strsel.' />'.$tag->name.'
 
 
 
290
  </label></li>';
291
- endforeach;
292
- $checkboxes .= "</ul>";
293
- print $checkboxes;
294
- }
295
  }
 
 
296
  }
7
  */
8
  class rssPIAdmin {
9
 
10
+ /**
11
+ * Whether the API key is valid
12
+ *
13
+ * @var boolean
14
+ */
15
+ var $is_key_valid;
16
+
17
+ /**
18
+ * The options
19
+ *
20
+ * @var array
21
+ */
22
+ var $options;
23
+
24
+ /**
25
+ * Aprompt for invalid/absent API keys
26
+ * @var string
27
+ */
28
+ var $key_prompt;
29
+
30
+ /**
31
+ * Start
32
+ *
33
+ * @global object $rss_post_importer
34
+ */
35
+ public function __construct() {
36
+
37
+ $this->load_options();
38
+
39
+ // add a key prompt
40
+ // $this->key_prompt = __('You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
41
+ $this->key_prompt = __('%1$sYou need a <a href="%2$s" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="%2$s" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
42
+
43
+ // now OBSOLETE as of 2.0.18
44
+ $this->key_prompt_multiple_category = __('Multiple Category selection available.You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
45
+ $this->key_prompt_multiple_tags = __('Multiple Tags selection available.You need a <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">Full Text RSS Key</a> to activate this section, please <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank">get one and try it free</a> for the next 14 days to see how it goes.', 'rss_pi');
46
+
47
+ // initialise logging
48
+ $this->log = new rssPILog();
49
+ $this->log->init();
50
+
51
+ // load the form processor
52
+ $this->processor = new rssPIAdminProcessor();
53
+ }
54
+
55
+ private function load_options() {
56
+ global $rss_post_importer;
57
+
58
+ // add options
59
+ $this->options = $rss_post_importer->options;
60
+
61
+ // check for valid key when we don't have it cached
62
+ // actually this populates the settings with our defaults on the first plugin activation
63
+ if ( !isset($this->options['settings']['is_key_valid']) ) {
64
+ // check if key is valid
65
+ $this->is_key_valid = $rss_post_importer->is_valid_key($this->options['settings']['feeds_api_key']);
66
+ $this->options['settings']['is_key_valid'] = $this->is_key_valid;
67
+ // if the key is not fine
68
+ if (!empty($this->options['settings']['feeds_api_key']) && !$this->is_key_valid) {
69
+ // unset from settings
70
+ unset($this->options['settings']['feeds_api_key']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  }
72
+ // update options
73
+ update_option('rss_pi_feeds', array(
74
+ 'feeds' => $this->options['feeds'],
75
+ 'settings' => $this->options['settings'],
76
+ 'latest_import' => $this->options['latest_import'],
77
+ 'imports' => $this->options['imports']
78
+ ));
79
+ } else {
80
+ $this->is_key_valid = $this->options['settings']['is_key_valid'];
81
+ }
82
+ // use our cached key validity
83
+ // $this->is_key_valid = isset($this->options['settings']['is_key_valid']) ? $this->options['settings']['is_key_valid'] : false;
84
+ }
85
+
86
+ /**
87
+ * Initialise and hook all actions
88
+ */
89
+ public function init() {
90
+
91
+ // add to admin menu
92
+ add_action('admin_menu', array($this, 'admin_menu'));
93
+
94
+ // process and save options prior to screen ui display
95
+ add_action('load-settings_page_rss_pi', array($this, 'save_options'));
96
+
97
+ // load scripts and styles we need
98
+ add_action('admin_enqueue_scripts', array($this, 'enqueue'));
99
+
100
+ // the ajax for adding new feeds (table rows)
101
+ add_action('wp_ajax_rss_pi_add_row', array($this, 'add_row'));
102
+
103
+ // the ajax for stats chart
104
+ add_action('wp_ajax_rss_pi_stats', array($this, 'ajax_stats'));
105
+
106
+ // the ajax for importing feeds via admin
107
+ add_action('wp_ajax_rss_pi_import', array($this, 'ajax_import'));
108
+
109
+ // disable the feed author dropdown for invalid/absent API keys
110
+ add_filter('wp_dropdown_users', array($this, 'disable_user_dropdown'));
111
+
112
+ // Add 10 minutes in frequency.
113
+ add_filter('cron_schedules', array($this, 'rss_pi_cron_add'));
114
+ }
115
+
116
+ /**
117
+ * Add to admin menu
118
+ */
119
+ function admin_menu() {
120
+
121
+ add_options_page('Rss Post Importer', 'Rss Post Importer', 'manage_options', 'rss_pi', array($this, 'screen'));
122
+ }
123
+
124
+ /**
125
+ * Enqueue our admin css and js
126
+ *
127
+ * @param string $hook The current screens hook
128
+ * @return null
129
+ */
130
+ public function enqueue($hook) {
131
+
132
+ // don't load if it isn't our screen
133
+ if ($hook != 'settings_page_rss_pi') {
134
+ return;
135
+ }
136
+
137
+ // register scripts & styles
138
+ wp_enqueue_style('rss-pi', RSS_PI_URL . 'app/assets/css/style.css', array(), RSS_PI_VERSION);
139
+
140
+ // wp_enqueue_style('rss-pi-jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/smoothness/jquery-ui.css', false, RSS_PI_VERSION, false);
141
+ wp_enqueue_style('rss-pi-jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/redmond/jquery-ui.css', false, RSS_PI_VERSION, false);
142
+
143
+ wp_enqueue_script('jquery-ui-core');
144
+ wp_enqueue_script('jquery-ui-datepicker');
145
+ wp_enqueue_script('jquery-ui-core');
146
+ wp_enqueue_script('jquery-ui-progressbar');
147
+
148
+ wp_enqueue_script('rss-pi', RSS_PI_URL . 'app/assets/js/main.js', array('jquery'), RSS_PI_VERSION);
149
+
150
+ // localise ajaxuel for use
151
+ $localise_args = array(
152
+ 'ajaxurl' => admin_url('admin-ajax.php'),
153
+ 'pluginurl' => RSS_PI_URL
154
+ );
155
+ wp_localize_script('rss-pi', 'rss_pi', $localise_args);
156
+ }
157
+
158
+ function rss_pi_cron_add($schedules) {
159
+
160
+ $schedules['minutes_10'] = array(
161
+ 'interval' => 600,
162
+ 'display' => '10 minutes'
163
+ );
164
+ return $schedules;
165
+ }
166
+
167
+ /**
168
+ * save any options submitted before the screen/ui get displayed
169
+ */
170
+ function save_options() {
171
+
172
+ // load the form processor
173
+ $this->processor->process();
174
+ }
175
+
176
+ /**
177
+ * Display the screen/ui
178
+ */
179
+ function screen() {
180
+
181
+ // display a success message
182
+ if( isset($_GET['settings-updated']) || isset($_GET['invalid_api_key']) || isset($_GET['import']) && $_GET['settings-updated'] ) {
183
+ ?>
184
+ <div id="message" class="updated">
185
+ <?php
186
+ if( isset($_GET['settings-updated']) && $_GET['settings-updated'] ) {
187
+ ?>
188
+ <p><strong><?php _e('Settings saved.') ?></strong></p>
189
+ <?php
190
+ }
191
+ if( isset($_GET['imported']) && $_GET['imported'] ) {
192
+ $imported = intval($_GET['imported']);
193
+ ?>
194
+ <p><strong><?php printf( _n( '%s new post imported.', '%s new posts imported.', $imported, 'rss_pi' ), $imported ); ?></strong></p>
195
+ <?php
196
+ }
197
+ ?>
198
+ </div>
199
+ <?php
200
+ // import feeds via AJAX
201
+ if( isset($_GET['import']) ) {
202
+ ?>
203
+ <script type="text/javascript">
204
+ <?php
205
+ $ids = array();
206
+ if ( is_array($this->options['feeds']) ) :
207
+ // $ids = array_keys($this->options['feeds'])
208
+ foreach ($this->options['feeds'] as $f) :
209
+ $ids[] = $f['id'];
210
+ endforeach;
211
+ endif;
212
+ ?>
213
+ feeds.set(<?php echo json_encode($ids); ?>);
214
+ </script>
215
+ <?php
216
+ }
217
+ }
218
+
219
+ // display a error message
220
+ if( isset($_GET['message']) && $_GET['message'] > 1 ) {
221
+ ?>
222
+ <div id="message" class="error">
223
+ <?php
224
+ switch ( $_GET['message'] ) {
225
+ case 2:
226
+ {
227
+ ?>
228
+ <p><strong><?php _e('Invalid API key!', 'rss_api'); ?></strong></p>
229
+ <?php
230
  }
231
+ break;
 
 
 
 
 
 
 
 
232
  }
233
+ ?>
234
+ </div>
235
+ <?php
236
+ }
237
+
238
+ // load the form processor first
239
+ // $this->processor->process();
240
+
241
+ // it'll process any submitted form data
242
+ // reload the options just in case
243
+ $this->load_options();
244
+
245
+ global $rss_post_importer;
246
+
247
+ // include the template for the ui
248
+ include( RSS_PI_PATH . 'app/templates/admin-ui.php');
249
+ }
250
+
251
+ /**
252
+ * Display errors
253
+ *
254
+ * @param string $error The error message
255
+ * @param boolean $inline Whether the error is inline or shown like regular wp errors
256
+ */
257
+ function key_error($error, $inline = false) {
258
+
259
+ $class = ($inline) ? 'rss-pi-error' : 'error';
260
+
261
+ echo '<div class="' . $class . '"><p>' . $error . '</p></div>';
262
+ }
263
+
264
+ /**
265
+ * Add a new row for a new feed
266
+ */
267
+ function add_row() {
268
+
269
+ include( RSS_PI_PATH . 'app/templates/feed-table-row.php');
270
+ die();
271
+ }
272
+
273
+ /**
274
+ * Generate stats data and return
275
+ */
276
+ function ajax_stats() {
277
+
278
+ include( RSS_PI_PATH . 'app/templates/stats.php');
279
+ die();
280
+ }
281
+
282
+ /**
283
+ * Import any feeds
284
+ */
285
+ function ajax_import() {
286
+ global $rss_post_importer;
287
+
288
+ // $imported = $this->processor->import();
289
+ // wp_send_json_success(array('imported'=>$imported));
290
+
291
+ // $engine = new rssPIEngine();
292
+ // $imported = $engine->import_feed();
293
+
294
+ // if there's nothing for processing or invalid data, bail
295
+ if ( ! isset($_POST['feed']) ) {
296
+ wp_send_json_error(array('message'=>'no feed provided'));
297
+ }
298
+
299
+ $_found = false;
300
+ foreach ( $this->options['feeds'] as $id => $f ) {
301
+ if ( $f['id'] == $_POST['feed'] ) {
302
+ $_found = $id;
303
+ break;
304
+ }
305
+ }
306
+ if ( $_found === false ) {
307
+ wp_send_json_error(array('message'=>'wrong feed id provided'));
308
+ }
309
+
310
+ // TODO: make this better
311
+ if ( $_found == 0 ) {
312
+ // check for valid key only for the first feed
313
+ $this->is_key_valid = $rss_post_importer->is_valid_key($this->options['settings']['feeds_api_key']);
314
+ $this->options['settings']['is_key_valid'] = $this->is_key_valid;
315
+ // if the key is not fine
316
+ if (!empty($this->options['settings']['feeds_api_key']) && !$this->is_key_valid) {
317
+ // unset from settings
318
+ unset($this->options['settings']['feeds_api_key']);
319
+ }
320
+ // update options
321
+ update_option('rss_pi_feeds', array(
322
+ 'feeds' => $this->options['feeds'],
323
+ 'settings' => $this->options['settings'],
324
+ 'latest_import' => $this->options['latest_import'],
325
+ 'imports' => $this->options['imports']
326
+ ));
327
+ }
328
+
329
+ $post_count = 0;
330
+
331
+ $f = $this->options['feeds'][$_found];
332
+
333
+ $engine = new rssPIEngine();
334
+
335
+ // filter cache lifetime
336
+ add_filter('wp_feed_cache_transient_lifetime', array($engine, 'frequency'));
337
+
338
+ if ( $items = $engine->prepare_import($f) ) {
339
+ $post_count += count($items);
340
+ }
341
+
342
+ remove_filter('wp_feed_cache_transient_lifetime', array($engine, 'frequency'));
343
+
344
+ // reformulate import count
345
+ $imports = intval($this->options['imports']) + $post_count;
346
+
347
+ // update options
348
+ update_option('rss_pi_feeds', array(
349
+ 'feeds' => $this->options['feeds'],
350
+ 'settings' => $this->options['settings'],
351
+ 'latest_import' => date("Y-m-d H:i:s"),
352
+ 'imports' => $imports
353
+ ));
354
+
355
+ global $rss_post_importer;
356
+ // reload options
357
+ $rss_post_importer->load_options();
358
+
359
+ // log this
360
+ rssPILog::log($post_count);
361
+
362
+ wp_send_json_success(array('count'=>$post_count, 'url'=>$f['url']));
363
+
364
+ }
365
+
366
+ /**
367
+ * Disable the user dropdwon for each feed
368
+ *
369
+ * @param string $output The html of the select dropdown
370
+ * @return string
371
+ */
372
+ function disable_user_dropdown($output) {
373
+
374
+ // if we have a valid key we don't need to disable anything
375
+ if ($this->is_key_valid) {
376
+ return $output;
377
+ }
378
+
379
+ // check if this is the feed dropdown (and not any other)
380
+ preg_match('/rss-pi-specific-feed-author/i', $output, $matched);
381
+
382
+ // this is not our dropdown, no need to disable
383
+ if (empty($matched)) {
384
+ return $output;
385
+ }
386
+
387
+ // otherwise just disable the dropdown
388
+ return str_replace('<select ', '<select disabled="disabled" ', $output);
389
+ }
390
+
391
+ /**
392
+ * Walker class function for category multiple checkbox
393
+ *
394
+ *
395
+ *
396
+ */
397
+ function wp_category_checklist_rss_pi($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true) {
398
+
399
+ $cat = "";
400
+ if (empty($walker) || !is_a($walker, 'Walker'))
401
+ $walker = new Walker_Category_Checklist;
402
+ $descendants_and_self = (int) $descendants_and_self;
403
+ $args = array();
404
+ if (is_array($selected_cats))
405
+ $args['selected_cats'] = $selected_cats;
406
+ elseif ($post_id)
407
+ $args['selected_cats'] = wp_get_post_categories($post_id);
408
+ else
409
+ $args['selected_cats'] = array();
410
+
411
+ if ($descendants_and_self) {
412
+ $categories = get_categories("child_of=$descendants_and_self&hierarchical=0&hide_empty=0");
413
+ $self = get_category($descendants_and_self);
414
+ array_unshift($categories, $self);
415
+ } else {
416
+ $categories = get_categories('get=all');
417
+ }
418
+ if ($checked_ontop) {
419
+ // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
420
+ $checked_categories = array();
421
+ $keys = array_keys($categories);
422
+ foreach ($keys as $k) {
423
+ if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
424
+ $checked_categories[] = $categories[$k];
425
+ unset($categories[$k]);
426
+ }
427
+ }
428
+ // Put checked cats on top
429
  $cat = $cat . call_user_func_array(array(
430
+ &$walker,
431
+ 'walk'
432
+ ), array(
433
+ $checked_categories,
434
+ 0,
435
+ $args
436
  ));
 
437
  }
438
+ // Then the rest of them
439
+ $cat = $cat . call_user_func_array(array(
440
+ &$walker,
441
+ 'walk'
442
+ ), array(
443
+ $categories,
444
+ 0,
445
+ $args
446
+ ));
447
+ return $cat;
448
+ }
449
+
450
+ function rss_pi_tags_dropdown($fid, $seleced_tags) {
451
+
452
+ if ($tags = get_tags(array('orderby' => 'name', 'hide_empty' => false))) {
453
+
454
+ echo '<select name="' . $fid . '-tags_id[]" id="tag" class="postform">';
455
+
456
+ foreach ($tags as $tag) {
457
+ $strsel = "";
458
+ if (!empty($seleced_tags)) {
459
+
460
+ if ($seleced_tags[0] == $tag->term_id) {
461
+ $strsel = "selected='selected'";
462
  }
 
 
463
  }
464
+ echo '<option value="' . $tag->term_id . '" ' . $strsel . '>' . $tag->name . '</option>';
 
465
  }
466
+ echo '</select> ';
467
  }
468
+ }
469
+
470
+ function rss_pi_tags_checkboxes($fid, $seleced_tags) {
471
+
472
+ $tags = get_tags(array('hide_empty' => false));
473
+ if ($tags) {
474
+ $checkboxes = "<ul>";
475
+
476
+ foreach ($tags as $tag) :
477
+ $strsel = "";
478
+ if (in_array($tag->term_id, $seleced_tags))
479
+ $strsel = "checked='checked'";
480
+
481
+ $checkboxes .=
482
+ '<li><label for="tag-' . $tag->term_id . '">
483
+ <input type="checkbox" name="' . $fid . '-tags_id[]" value="' . $tag->term_id . '" id="tag-' . $tag->term_id . '" ' . $strsel . ' />' . $tag->name . '
484
  </label></li>';
485
+ endforeach;
486
+ $checkboxes .= "</ul>";
487
+ print $checkboxes;
 
488
  }
489
+ }
490
+
491
  }
app/classes/admin/class-rss-pi-export-to-csv.php CHANGED
@@ -1,55 +1,60 @@
1
- <?php // This include gives us all the WordPress functionality
2
-
3
- $options = get_option('rss_pi_feeds', array());
4
-
5
-
6
- function array2csv(array &$array)
7
- {
8
- if (count($array) == 0) {
9
- return null;
10
- }
11
- ob_start();
12
- $df = fopen("php://output", 'w');
13
- $arrayhead = array_keys(reset($array));
14
- $exclude_data = array('id','category_id','tags_id','strip_html');
15
- $arrayhead = array_diff($arrayhead, array('id','category_id','tags_id','strip_html'));
16
-
17
- fputcsv($df, $arrayhead);
18
-
19
- foreach ($array as $row) {
20
- unset($row['id']);
21
- unset($row['category_id']);
22
- unset($row['tags_id']);
23
- unset($row['strip_html']);
24
- fputcsv($df, $row);
25
- }
26
- fclose($df);
27
- return ob_get_clean();
 
 
28
  }
29
 
30
  function download_send_headers($filename) {
31
- // disable caching
32
- $now = gmdate("D, d M Y H:i:s");
33
- header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
34
- header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
35
- header("Last-Modified: {$now} GMT");
36
-
37
- // force download
38
- header("Content-Type: application/force-download");
39
- header("Content-Type: application/octet-stream");
40
- header("Content-Type: application/download");
41
-
42
- // disposition / encoding on response body
43
- header("Content-Disposition: attachment;filename={$filename}");
44
- header("Content-Transfer-Encoding: binary");
 
45
  }
46
- if(isset($_POST['csv_download'])){
47
- download_send_headers("data_export_" . date("Y-m-d") . ".csv");
48
- echo array2csv($options['feeds']);
49
- die();
 
 
50
  }
51
  /* echo "<pre>";
52
-
53
- print_r($options);
54
- exit;*/
55
  ?>
1
+ <?php
2
+
3
+ // This include gives us all the WordPress functionality
4
+
5
+ $options = get_option('rss_pi_feeds', array());
6
+
7
+ function array2csv(array &$array) {
8
+
9
+ if (count($array) == 0) {
10
+ return null;
11
+ }
12
+ ob_start();
13
+ $df = fopen("php://output", 'w');
14
+ $arrayhead = array_keys(reset($array));
15
+ $exclude_data = array('id', 'category_id', 'tags_id', 'strip_html');
16
+ $arrayhead = array_diff($arrayhead, array('id', 'category_id', 'tags_id', 'strip_html'));
17
+
18
+ fputcsv($df, $arrayhead);
19
+
20
+ foreach ($array as $row) {
21
+ unset($row['id']);
22
+ unset($row['category_id']);
23
+ unset($row['tags_id']);
24
+ unset($row['strip_html']);
25
+ fputcsv($df, $row);
26
+ }
27
+ fclose($df);
28
+
29
+ return ob_get_clean();
30
  }
31
 
32
  function download_send_headers($filename) {
33
+
34
+ // disable caching
35
+ $now = gmdate("D, d M Y H:i:s");
36
+ header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
37
+ header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
38
+ header("Last-Modified: {$now} GMT");
39
+
40
+ // force download
41
+ header("Content-Type: application/force-download");
42
+ header("Content-Type: application/octet-stream");
43
+ header("Content-Type: application/download");
44
+
45
+ // disposition / encoding on response body
46
+ header("Content-Disposition: attachment;filename={$filename}");
47
+ header("Content-Transfer-Encoding: binary");
48
  }
49
+
50
+ if (isset($_POST['csv_download'])) {
51
+
52
+ download_send_headers("data_export_" . date("Y-m-d") . ".csv");
53
+ echo array2csv($options['feeds']);
54
+ die();
55
  }
56
  /* echo "<pre>";
57
+
58
+ print_r($options);
59
+ exit; */
60
  ?>
app/classes/admin/class-rss-pi-stats.php CHANGED
@@ -1,399 +1,418 @@
1
  <?php
2
-
3
  /*
4
  * Calculates and shows graphical stats
5
  *
6
  * @author Pramod Jodhani<mrpramodjodhani@gmail.com>
7
  */
8
-
9
- if(!class_exists("Rss_pi_stats")) {
10
 
11
  class Rss_pi_stats {
12
 
13
-
14
  function show_charts() {
15
 
16
- $feeds = get_option("rss_pi_feeds" , array());
 
 
 
 
 
 
 
 
 
 
17
 
18
- $oldest_post = $this->get_the_oldest_post();
19
- $newest_post = $this->get_the_newest_post();
20
-
21
  $start_time = "";
22
- $end_time = "";
23
- if(
24
- isset($_POST["rss_filter_stats"]) &&
25
- isset($_POST["rss_from_date"]) &&
26
- isset($_POST["rss_till_date"]) ) {
27
-
28
  $start_time = strtotime($_POST["rss_from_date"]);
29
- $end_time = strtotime($_POST["rss_till_date"]);
 
 
 
 
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
- else {
33
- $start_time = get_the_time( "U", $oldest_post );
34
- $end_time = get_the_time( "U", $newest_post );
 
 
 
 
 
35
  }
 
 
36
 
37
- $pie_feeds_data = $this->get_pie_chart_data_between($start_time , $end_time);
38
- $line_feeds_data = $this->get_line_chart_data_between($start_time , $end_time);
39
- $bar_feeds_data = $this->get_bar_chart_data_between($start_time , $end_time);
40
-
41
  ?>
42
- <script type="text/javascript"
43
- src="https://www.google.com/jsapi?autoload={
44
- 'modules':[{
45
- 'name':'visualization',
46
- 'version':'1.1',
47
- 'packages':['corechart' , 'bar']
48
- }]
49
- }"></script>
50
- <script type="text/javascript">
51
- //google.load("visualization", "1.1", {packages:["bar"]});
52
- google.setOnLoadCallback(drawChart);
53
-
54
- function drawChart() {
55
- <?php $this->draw_line_charts_js($line_feeds_data , $feeds ); ?>
56
- <?php $this->draw_pie_chart_js($pie_feeds_data , $feeds ); ?>
57
- <?php $this->draw_bar_chart_js($bar_feeds_data , $feeds ); ?>
58
-
59
-
60
- }
61
-
62
- </script>
63
-
64
- <?php $this->show_date_pickers();?>
65
- <div class="rss_pi_stat_div" id="rsspi_chart_line" style=""></div>
66
- <div class="rss_pi_stat_div" id="rsspi_chart_pie" style=""></div>
67
- <div class="rss_pi_stat_div" id="rsspi_chart_bar" style=""></div>
68
-
69
- <?php
70
-
71
 
72
  }
73
 
74
  /*
75
- * Prints the line chart between two dates
76
- * param $start_time : timestamp
77
- * param $end_time : timestamp
78
- */
79
- function get_line_chart_data_between($start_time, $end_time ) {
80
-
81
- $dates = $this->get_all_dates_between($start_time, $end_time );
82
-
83
- $feeds = get_option("rss_pi_feeds" , array());
84
 
85
  $data = array();
86
-
87
- foreach($feeds["feeds"] as $feed) {
88
  $feedname = $feed["name"];
89
  $feedurl = $feed["url"];
90
- foreach($dates as $date) {
91
 
92
  $key = date("d-m-Y", $date);
93
- $data[$key][$feedname] = $this->get_feedcount_for($feedurl , $date );
94
-
95
  }
96
  }
97
 
98
  return $data;
99
-
100
  }
101
 
102
- function get_feedcount_for($feedurl , $date) {
103
 
104
- $year = date("Y", $date);
105
- $month = date("m", $date);
106
- $day = date("d", $date);
107
 
108
- $parse = parse_url($feedurl);
109
- $url = $parse['host'];
110
 
111
  $args = array(
112
- "date_query" => array(
113
- array(
114
- "year" => $year,
115
- "month" => $month,
116
- "day" => $day,
117
- ),
118
- 'inclusive' => true,
119
- ),
120
- 'meta_query' => array(
121
- array(
122
- 'key' => "rss_pi_source_url",
123
- 'value' => $url,
124
- 'compare' => 'LIKE',
125
- ),
126
- ),
127
- 'posts_per_page' => -1,
128
- );
129
 
130
  $posts = get_posts($args);
131
 
132
  return count($posts);
133
-
134
-
135
  }
136
 
137
- function get_all_dates_between($strDateFrom,$strDateTo)
138
- {
139
 
140
- $aryRange=array();
141
 
142
- if ($strDateTo>=$strDateFrom)
143
- {
144
- $aryRange[] = $strDateFrom; // first entry
145
-
146
- while ($strDateFrom < $strDateTo)
147
- {
148
- $strDateFrom+=86400; // add 24 hours
149
- $aryRange[] = $strDateFrom;
150
- }
151
- }
152
 
153
- return $aryRange;
154
- }
 
 
 
155
 
 
 
156
 
157
  function get_the_oldest_post() {
158
 
159
  $args = array(
160
- "posts_per_page" => 1,
161
- "order" => "ASC",
162
- "orderby" => "date",
163
- "meta_key" => "rss_pi_source_url",
164
- );
 
 
 
 
 
 
 
 
 
 
165
 
166
  $post = get_posts($args);
167
 
168
- return $post[0];
169
-
170
  }
171
 
172
-
173
  function get_the_newest_post() {
174
 
175
  $args = array(
176
- "posts_per_page" => 1,
177
- "order" => "DESC",
178
- "orderby" => "date",
179
- "meta_key" => "rss_pi_source_url",
180
- );
 
 
 
 
 
 
 
 
 
 
181
 
182
  $post = get_posts($args);
183
 
184
- return $post[0];
185
-
186
  }
187
 
 
188
 
189
- function draw_line_charts_js( $feeds_data , $feeds ) {
190
  ?>
191
- var data_line_chart = google.visualization.arrayToDataTable([
192
- <?php
 
 
 
 
193
 
194
- $feednames = "";
195
- foreach($feeds["feeds"] as $feed ) {
196
- $feednames .= "'".$feed["name"]."', ";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  }
 
 
 
 
 
198
 
199
- //Generating the following:
200
- //['Year', 'Sales', 'Expenses'],
201
- echo "[ 'Date' , $feednames ], \n";
202
-
203
- //Generating the following:
204
- //['2004', 1000, 400],
205
- foreach($feeds_data as $date=>$data) {
206
- echo "[ '$date' ,";
207
-
208
- $i = 1;
209
- foreach($data as $d) {
210
-
211
- echo "".$d.",";
212
-
213
- //if last data
214
- if(count($data) == $i) {
215
- echo "], \n";
216
- }
217
- $i++;
218
-
219
- } //foreach $data
220
-
221
- } //foreach $feeds_data
222
-
223
- ?>
224
-
225
-
226
- ]);
227
-
228
- var options_line_chart = {
229
- title: 'Feeds Imported',
230
- curveType: 'none',
231
- legend: { position: 'bottom' }
232
- };
233
-
234
- var chart = new google.visualization.LineChart(document.getElementById('rsspi_chart_line'));
235
 
 
236
  chart.draw(data_line_chart, options_line_chart);
237
- <?php
 
 
238
 
239
- } //draw_line_charts_js
240
 
241
-
242
- function draw_pie_chart_js($pie_feeds_data , $feeds) {
243
-
244
  //$data_pie = get_pie_data();
245
  ?>
246
  var data_pie_chart = google.visualization.arrayToDataTable([
247
- <?php
248
- echo "['Feed', 'Posts imported'], \n";
249
 
250
- foreach($pie_feeds_data as $feed=>$import_count) {
251
- echo "['".$feed."' , $import_count ], \n";
252
- }
253
- ?>
254
  ]);
255
 
256
- var options_pie_chart = {
257
- title: 'Feeds Share',
258
- is3D: true,
259
- };
260
-
261
- var chart = new google.visualization.PieChart(document.getElementById('rsspi_chart_pie'));
262
- chart.draw(data_pie_chart, options_pie_chart);
263
 
 
 
264
  <?php
 
 
265
 
266
- } // draw_pie_chart_js
267
-
268
-
269
 
270
- function get_pie_chart_data_between($start_time , $end_time) {
271
 
272
- $feeds = get_option("rss_pi_feeds" , array());
 
 
273
 
274
- $s_year = date("Y", $start_time);
275
- $s_month = date("m", $start_time);
276
- $s_day = date("d", $start_time);
277
 
278
- $e_year = date("Y", $end_time);
279
- $e_month = date("m", $end_time);
280
- $e_day = date("d", $end_time);
281
 
282
- $data = array();
283
-
284
  //pre($feeds); exit;
285
- foreach($feeds["feeds"] as $feed) {
286
-
287
- $data[$feed["name"]] = 0;
288
-
289
  $domain = $this->get_domain($feed["url"]);
290
-
291
 
292
  $args = array(
293
- "date_query" => array(
294
- "after" => array(
295
- "year" => $s_year,
296
- "month" => $s_month,
297
- "day" => $s_day,
298
- ),
299
- "before" => array(
300
- "year" => $e_year,
301
- "month" => $e_month,
302
- "day" => $e_day,
303
- ),
304
- 'inclusive' => true,
305
-
306
- ),
307
- 'meta_query' => array(
308
- array(
309
- 'key' => "rss_pi_source_url",
310
- 'value' => $domain,
311
- 'compare' => 'LIKE',
312
- ),
313
- ),
314
-
315
- 'posts_per_page' => -1,
316
- );
317
 
318
  $posts = get_posts($args);
319
  $data[$feed["name"]] = count($posts);
320
  }
321
 
322
- return $data;
323
-
324
- } // get_pie_chart_data_between
325
 
326
  function get_domain($url) {
327
- $parse = parse_url($url);
328
- $url = $parse['host'];
329
- return $url;
330
- }
331
 
332
- function get_bar_chart_data_between($start_time , $end_time) {
 
 
 
333
 
334
- $feeds = get_option("rss_pi_feeds" , array());
335
 
336
- $data = array();
337
-
338
- $dates = $this->get_all_dates_between($start_time , $end_time);
339
 
340
- foreach($dates as $date) {
341
 
342
- $year = date("Y", $date);
343
- $month = date("m", $date);
344
- $day = date("d", $date);
345
 
346
- $args = array(
347
- "date_query" => array(
348
- array(
349
- "year" => $year,
350
- "month" => $month,
351
- "day" => $day,
352
- ),
353
- 'inclusive' => true,
354
 
355
- ),
 
 
356
 
357
- "meta_key" => "rss_pi_source_url",
358
- "posts_per_page" => -1,
359
- );
 
 
 
 
 
 
 
 
 
360
 
361
  $posts = get_posts($args);
362
 
363
  $date = date("d-m-Y", $date);
364
 
365
  $data[$date] = count($posts);
366
-
367
-
368
  }
369
 
370
  return $data;
371
  }
372
 
373
-
374
- function draw_bar_chart_js($bar_feeds_data , $feeds ) {
375
  ?>
376
  var data_bar = google.visualization.arrayToDataTable([
377
  ['Date', 'Posts Imported' ],
378
- <?php
379
- foreach($bar_feeds_data as $date=>$count) {
380
- echo "['".$date."', $count], \n";
381
- }
382
- ?>
383
  ]);
384
 
385
- var bar_options = {
386
- chart: {
387
- title: 'Total posts imported everyday',
388
- subtitle: '',
389
- },
390
- bars: 'vertical' // Required for Material Bar Charts.
391
- };
392
-
393
- var bar_chart = new google.charts.Bar(document.getElementById('rsspi_chart_bar'));
394
-
395
- bar_chart.draw(data_bar, bar_options);
396
 
 
 
397
  <?php
398
  }
399
 
@@ -402,15 +421,14 @@ if(!class_exists("Rss_pi_stats")) {
402
  <div class="rss_pi_stats_date">
403
  <div class="rss_filter_heading">Filter results:</div>
404
  <hr>
405
- <label>From: <input type="text" id="from_date" name="rss_from_date" value=<?php echo (isset($_POST["rss_from_date"]))? $_POST["rss_from_date"] : ""; ?> /> </label>
406
- <label>Till: <input type="text" id="till_date" name="rss_till_date" value=<?php echo (isset($_POST["rss_till_date"]))? $_POST["rss_till_date"] : ""; ?> /> </label>
407
- <input type="submit" name="rss_filter_stats" class="button button-primary button-large " value="Filter">
408
  <br>
409
  </div>
410
  <?php
411
  }
412
- } // CLass Rss_pi_stats
413
- }
414
 
415
-
416
- ?>
 
1
  <?php
 
2
  /*
3
  * Calculates and shows graphical stats
4
  *
5
  * @author Pramod Jodhani<mrpramodjodhani@gmail.com>
6
  */
7
+ if (!class_exists("Rss_pi_stats")) {
 
8
 
9
  class Rss_pi_stats {
10
 
 
11
  function show_charts() {
12
 
13
+ $feeds = get_option("rss_pi_feeds", array());
14
+
15
+ $oldest_post = $this->get_the_oldest_post();
16
+ if ($oldest_post == false) {
17
+ // echo 'No Stats';
18
+ ?>
19
+ <div class="rss_pi_stat_message">Sorry, there are no imported posts to show stats for.</div>
20
+ <?php
21
+ return;
22
+ }
23
+ $newest_post = $this->get_the_newest_post();
24
 
 
 
 
25
  $start_time = "";
26
+ $end_time = "";
27
+ if (
28
+ isset($_POST["rss_filter_stats"]) &&
29
+ isset($_POST["rss_from_date"]) &&
30
+ isset($_POST["rss_till_date"]))
31
+ {
32
  $start_time = strtotime($_POST["rss_from_date"]);
33
+ $end_time = strtotime($_POST["rss_till_date"]);
34
+ } else {
35
+ $start_time = get_the_time("U", $oldest_post);
36
+ $end_time = get_the_time("U", $newest_post);
37
+ }
38
 
39
+ if ( isset($_POST["rss_filter_stats"]) && $start_time <= 0 || $end_time <= 0 ) {
40
+ // echo 'Dates problem';
41
+ ?>
42
+ <div class="rss_pi_stat_message">Please enter correct dates.</div>
43
+ <script type="text/javascript">
44
+ function drawChart() {}
45
+ </script>
46
+ <?php $this->show_date_pickers(); ?>
47
+ <?php
48
+ return;
49
+ }
50
+ // limit the stats to a year
51
+ if ( isset($_POST["rss_filter_stats"]) && $end_time - $start_time > 365 * 24 * 60 * 60 ) { // a year
52
+ // echo 'Range problem';
53
+ // return;
54
+ ?>
55
+ <div class="rss_pi_stat_message">Range too long, reduced to a year ago.</div>
56
+ <?php
57
+ $start_time = $end_time - 365 * 24 * 60 * 60;
58
  }
59
+ if ( isset($_POST["rss_filter_stats"]) && $start_time > $end_time ) {
60
+ ?>
61
+ <div class="rss_pi_stat_message">From date were after the Till date, reversed.</div>
62
+ <?php
63
+ // $start_time = $end_time - 1 * 30 * 24 * 60 * 60; // a month
64
+ $_ = $start_time;
65
+ $start_time = $end_time;
66
+ $end_time = $_;
67
  }
68
+ $_POST["rss_from_date"] = date( 'm/d/Y', $start_time);
69
+ $_POST["rss_till_date"] = date( 'm/d/Y', $end_time);
70
 
71
+ if ( isset($feeds["feeds"]) && is_array($feeds["feeds"]) && !empty($feeds["feeds"]) ) {
72
+ $pie_feeds_data = $this->get_pie_chart_data_between($start_time, $end_time);
73
+ $line_feeds_data = $this->get_line_chart_data_between($start_time, $end_time);
74
+ $bar_feeds_data = $this->get_bar_chart_data_between($start_time, $end_time);
75
  ?>
76
+ <script type="text/javascript">
77
+ function drawChart() {
78
+ <?php
79
+ $this->draw_line_charts_js($line_feeds_data, $feeds);
80
+ $this->draw_pie_chart_js($pie_feeds_data, $feeds);
81
+ $this->draw_bar_chart_js($bar_feeds_data, $feeds);
82
+ ?>
83
+ };
84
+ </script>
85
+ <?php
86
+ $this->show_date_pickers();
87
+ ?>
88
+ <div class="rss_pi_stat_div" id="rsspi_chart_line" style=""></div>
89
+ <div class="rss_pi_stat_div" id="rsspi_chart_pie" style=""></div>
90
+ <div class="rss_pi_stat_div" id="rsspi_chart_bar" style=""></div>
91
+ <?php
92
+ } else {
93
+ ?>
94
+ <div class="rss_no_data_available">No data avaibale to be shown.</div>
95
+ <script type="text/javascript">
96
+ function drawChart() {};
97
+ </script>
98
+ <?php
99
+ }
 
 
 
 
 
100
 
101
  }
102
 
103
  /*
104
+ * Prints the line chart between two dates
105
+ * param $start_time : timestamp
106
+ * param $end_time : timestamp
107
+ */
108
+ function get_line_chart_data_between($start_time, $end_time) {
109
+
110
+ $dates = $this->get_all_dates_between($start_time, $end_time);
111
+
112
+ $feeds = get_option("rss_pi_feeds", array());
113
 
114
  $data = array();
115
+
116
+ foreach ($feeds["feeds"] as $feed) {
117
  $feedname = $feed["name"];
118
  $feedurl = $feed["url"];
119
+ foreach ($dates as $date) {
120
 
121
  $key = date("d-m-Y", $date);
122
+ $data[$key][$feedname] = $this->get_feedcount_for($feedurl, $date);
 
123
  }
124
  }
125
 
126
  return $data;
 
127
  }
128
 
129
+ function get_feedcount_for($feedurl, $date) {
130
 
131
+ $year = date("Y", $date);
132
+ $month = date("m", $date);
133
+ $day = date("d", $date);
134
 
135
+ $parse = parse_url($feedurl);
136
+ $url = $parse['host'];
137
 
138
  $args = array(
139
+ "date_query" => array(
140
+ array(
141
+ "year" => $year,
142
+ "month" => $month,
143
+ "day" => $day,
144
+ ),
145
+ 'inclusive' => true,
146
+ ),
147
+ 'meta_query' => array(
148
+ array(
149
+ 'key' => "rss_pi_source_url",
150
+ 'value' => $url,
151
+ 'compare' => 'LIKE',
152
+ ),
153
+ ),
154
+ 'posts_per_page' => -1,
155
+ );
156
 
157
  $posts = get_posts($args);
158
 
159
  return count($posts);
 
 
160
  }
161
 
162
+ function get_all_dates_between($strDateFrom, $strDateTo) {
 
163
 
164
+ $aryRange = array();
165
 
166
+ if ($strDateTo >= $strDateFrom) {
167
+ $aryRange[] = $strDateFrom; // first entry
 
 
 
 
 
 
 
 
168
 
169
+ while ($strDateFrom < $strDateTo) {
170
+ $strDateFrom+=86400; // add 24 hours
171
+ $aryRange[] = $strDateFrom;
172
+ }
173
+ }
174
 
175
+ return $aryRange;
176
+ }
177
 
178
  function get_the_oldest_post() {
179
 
180
  $args = array(
181
+ 'posts_per_page' => 1,
182
+ 'date_query' => array(
183
+ array(
184
+ 'after' => array(
185
+ 'year' => 1970,
186
+ 'month' => 1,
187
+ 'day' => 1,
188
+ ),
189
+ 'inclusive' => false,
190
+ ),
191
+ ),
192
+ 'order' => 'ASC',
193
+ 'orderby' => 'date',
194
+ 'meta_key' => 'rss_pi_source_url',
195
+ );
196
 
197
  $post = get_posts($args);
198
 
199
+ return isset($post[0]) ? $post[0] : false;
 
200
  }
201
 
 
202
  function get_the_newest_post() {
203
 
204
  $args = array(
205
+ 'posts_per_page' => 1,
206
+ 'date_query' => array(
207
+ array(
208
+ 'after' => array(
209
+ 'year' => 1970,
210
+ 'month' => 1,
211
+ 'day' => 1,
212
+ ),
213
+ 'inclusive' => false,
214
+ ),
215
+ ),
216
+ 'order' => 'DESC',
217
+ 'orderby' => 'date',
218
+ 'meta_key' => 'rss_pi_source_url',
219
+ );
220
 
221
  $post = get_posts($args);
222
 
223
+ return isset($post[0]) ? $post[0] : false;
 
224
  }
225
 
226
+ function draw_line_charts_js($feeds_data, $feeds) {
227
 
 
228
  ?>
229
+ var data_line_chart = google.visualization.arrayToDataTable([
230
+ <?php
231
+ $feednames = "";
232
+ foreach ($feeds["feeds"] as $feed) {
233
+ $feednames .= "'" . $feed["name"] . "', ";
234
+ }
235
 
236
+ //Generating the following:
237
+ //['Year', 'Sales', 'Expenses'],
238
+ echo "[ 'Date' , $feednames ], \n";
239
+
240
+ //Generating the following:
241
+ //['2004', 1000, 400],
242
+ foreach ($feeds_data as $date => $data) {
243
+ echo "[ '$date' ,";
244
+
245
+ $i = 1;
246
+ foreach ($data as $d) {
247
+
248
+ echo "" . $d . ",";
249
+
250
+ //if last data
251
+ if (count($data) == $i) {
252
+ echo "], \n";
253
  }
254
+ $i++;
255
+ } //foreach $data
256
+ } //foreach $feeds_data
257
+ ?>
258
+ ]);
259
 
260
+ var options_line_chart = {
261
+ title: 'Feeds Imported',
262
+ curveType: 'none',
263
+ legend: { position: 'bottom' }
264
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
266
+ var chart = new google.visualization.LineChart(document.getElementById('rsspi_chart_line'));
267
  chart.draw(data_line_chart, options_line_chart);
268
+ <?php
269
+ }
270
+ //draw_line_charts_js
271
 
272
+ function draw_pie_chart_js($pie_feeds_data, $feeds) {
273
 
 
 
 
274
  //$data_pie = get_pie_data();
275
  ?>
276
  var data_pie_chart = google.visualization.arrayToDataTable([
277
+ <?php
278
+ echo "['Feed', 'Posts imported'], \n";
279
 
280
+ foreach ($pie_feeds_data as $feed => $import_count) {
281
+ echo "['" . $feed . "' , $import_count ], \n";
282
+ }
283
+ ?>
284
  ]);
285
 
286
+ var options_pie_chart = {
287
+ title: 'Feeds Share',
288
+ is3D: true,
289
+ };
 
 
 
290
 
291
+ var chart = new google.visualization.PieChart(document.getElementById('rsspi_chart_pie'));
292
+ chart.draw(data_pie_chart, options_pie_chart);
293
  <?php
294
+ }
295
+ // draw_pie_chart_js
296
 
297
+ function get_pie_chart_data_between($start_time, $end_time) {
 
 
298
 
299
+ $feeds = get_option("rss_pi_feeds", array());
300
 
301
+ $s_year = date("Y", $start_time);
302
+ $s_month = date("m", $start_time);
303
+ $s_day = date("d", $start_time);
304
 
305
+ $e_year = date("Y", $end_time);
306
+ $e_month = date("m", $end_time);
307
+ $e_day = date("d", $end_time);
308
 
309
+ $data = array();
 
 
310
 
 
 
311
  //pre($feeds); exit;
312
+ foreach ($feeds["feeds"] as $feed) {
313
+
314
+ $data[$feed["name"]] = 0;
315
+
316
  $domain = $this->get_domain($feed["url"]);
317
+
318
 
319
  $args = array(
320
+ "date_query" => array(
321
+ "after" => array(
322
+ "year" => $s_year,
323
+ "month" => $s_month,
324
+ "day" => $s_day,
325
+ ),
326
+ "before" => array(
327
+ "year" => $e_year,
328
+ "month" => $e_month,
329
+ "day" => $e_day,
330
+ ),
331
+ 'inclusive' => true,
332
+ ),
333
+ 'meta_query' => array(
334
+ array(
335
+ 'key' => "rss_pi_source_url",
336
+ 'value' => $domain,
337
+ 'compare' => 'LIKE',
338
+ ),
339
+ ),
340
+ 'posts_per_page' => -1,
341
+ );
 
 
342
 
343
  $posts = get_posts($args);
344
  $data[$feed["name"]] = count($posts);
345
  }
346
 
347
+ return $data;
348
+ }
349
+ // get_pie_chart_data_between
350
 
351
  function get_domain($url) {
 
 
 
 
352
 
353
+ $parse = parse_url($url);
354
+ $url = $parse['host'];
355
+ return $url;
356
+ }
357
 
358
+ function get_bar_chart_data_between($start_time, $end_time) {
359
 
360
+ $feeds = get_option("rss_pi_feeds", array());
 
 
361
 
362
+ $data = array();
363
 
364
+ $dates = $this->get_all_dates_between($start_time, $end_time);
 
 
365
 
366
+ foreach ($dates as $date) {
 
 
 
 
 
 
 
367
 
368
+ $year = date("Y", $date);
369
+ $month = date("m", $date);
370
+ $day = date("d", $date);
371
 
372
+ $args = array(
373
+ "date_query" => array(
374
+ array(
375
+ "year" => $year,
376
+ "month" => $month,
377
+ "day" => $day,
378
+ ),
379
+ 'inclusive' => true,
380
+ ),
381
+ "meta_key" => "rss_pi_source_url",
382
+ "posts_per_page" => -1,
383
+ );
384
 
385
  $posts = get_posts($args);
386
 
387
  $date = date("d-m-Y", $date);
388
 
389
  $data[$date] = count($posts);
 
 
390
  }
391
 
392
  return $data;
393
  }
394
 
395
+ function draw_bar_chart_js($bar_feeds_data, $feeds) {
 
396
  ?>
397
  var data_bar = google.visualization.arrayToDataTable([
398
  ['Date', 'Posts Imported' ],
399
+ <?php
400
+ foreach ($bar_feeds_data as $date => $count) {
401
+ echo "['" . $date . "', $count], \n";
402
+ }
403
+ ?>
404
  ]);
405
 
406
+ var bar_options = {
407
+ chart: {
408
+ title: 'Total posts imported everyday',
409
+ subtitle: ''
410
+ },
411
+ bars: 'vertical' // Required for Material Bar Charts.
412
+ };
 
 
 
 
413
 
414
+ var bar_chart = new google.charts.Bar(document.getElementById('rsspi_chart_bar'));
415
+ bar_chart.draw(data_bar, bar_options);
416
  <?php
417
  }
418
 
421
  <div class="rss_pi_stats_date">
422
  <div class="rss_filter_heading">Filter results:</div>
423
  <hr>
424
+ <label>From: <input type="text" id="from_date" name="rss_from_date" value=<?php echo (isset($_POST["rss_from_date"])) ? $_POST["rss_from_date"] : ""; ?> /> </label>
425
+ <label>Till: <input type="text" id="till_date" name="rss_till_date" value=<?php echo (isset($_POST["rss_till_date"])) ? $_POST["rss_till_date"] : ""; ?> /> </label>
426
+ <input type="submit" id="submit-rss_filter_stats" name="rss_filter_stats" class="button button-primary button-large " value="Filter">
427
  <br>
428
  </div>
429
  <?php
430
  }
 
 
431
 
432
+ }
433
+ // CLass Rss_pi_stats
434
+ }
app/classes/front/class-rss-pi-front.php CHANGED
@@ -1,236 +1,116 @@
1
  <?php
2
 
3
-
4
-
5
  /**
6
-
7
  * The class that handles the front screen
8
-
9
  *
10
-
11
  *
12
-
13
  */
14
-
15
  class rssPIFront {
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
 
 
18
 
19
- /**
20
-
21
- * Whether the API key is valid
22
-
23
- *
24
-
25
- * @var boolean
26
-
27
- */
28
-
29
- var $is_key_valid;
30
-
31
-
32
-
33
- /**
34
-
35
- * The options
36
-
37
- *
38
-
39
- * @var array
40
-
41
- */
42
-
43
- var $options;
44
-
45
-
46
-
47
- /**
48
-
49
- * Aprompt for invalid/absent API keys
50
-
51
- * @var string
52
-
53
- */
54
-
55
- var $key_prompt;
56
-
57
-
58
-
59
- /**
60
-
61
- * Initialise and hook all actions
62
-
63
- */
64
-
65
- public function init() {
66
-
67
- global $post,$rss_post_importer;
68
-
69
- // add noidex to front
70
-
71
- add_action('wp_head', array($this, 'rss_pi_noindex_meta_tag'));
72
-
73
-
74
-
75
- // add options
76
-
77
- $this->options = $rss_post_importer->options;
78
-
79
-
80
-
81
- // Check for block indexing
82
-
83
- if($this->options['settings']['nofollow_outbound'] == 'true'){
84
-
85
- add_filter( 'the_content', array($this, 'rss_pi_url_parse'));
86
-
87
- }
88
-
89
- }
90
-
91
-
92
-
93
-
94
-
95
- function rss_pi_noindex_meta_tag()
96
-
97
- {
98
-
99
- global $post,$rss_post_importer;
100
-
101
- //Add meta tag for UTF-8 character encoding.
102
- echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />';
103
-
104
- // Check if single post
105
- if(is_single())
106
-
107
- {
108
-
109
-
110
-
111
- // Get current post id
112
-
113
- $current_post_id = $post->ID;
114
-
115
-
116
-
117
- // add options
118
-
119
- $this->options = $rss_post_importer->options;
120
-
121
-
122
-
123
- // get value of block indexing
124
-
125
- $block_indexing = $this->options['settings']['block_indexing'];
126
-
127
-
128
-
129
- // Check for block indexing
130
-
131
- if($this->options['settings']['block_indexing'] == 'true'){
132
 
133
- $meta_values = get_post_meta( $current_post_id, 'rss_pi_source_url', false );
 
134
 
135
- // if meta value array is empty it means post is not imported by this plugin.
 
136
 
137
- if(!empty($meta_values)){
 
138
 
139
- echo '<meta name="robots" content="noindex">';
140
-
141
- }
142
 
 
 
 
 
 
 
143
  }
144
-
145
  }
146
-
147
  }
 
148
 
149
-
150
-
151
-
152
-
153
- function rss_pi_url_parse( $content ) {
154
-
155
-
156
-
157
- $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>";
158
-
159
- if(preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {
160
-
161
- if( !empty($matches) ) {
162
-
163
-
164
-
165
- $srcUrl = get_option('home');
166
-
167
- for ($i=0; $i < count($matches); $i++)
168
 
169
- {
 
 
170
 
171
-
 
172
 
173
- $tag = $matches[$i][0];
 
 
174
 
175
- $tag2 = $matches[$i][0];
176
 
177
- $url = $matches[$i][0];
 
 
 
178
 
179
-
180
-
181
- $noFollow = '';
182
-
183
-
184
-
185
- $pattern = '/target\s*=\s*"\s*_blank\s*"/';
186
-
187
- preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
188
-
189
- if( count($match) < 1 )
190
-
191
- $noFollow .= ' target="_blank" ';
192
-
193
-
194
-
195
- $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/';
196
-
197
- preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
198
-
199
- if( count($match) < 1 )
200
-
201
- $noFollow .= ' rel="nofollow" ';
202
-
203
-
204
-
205
- $pos = strpos($url,$srcUrl);
206
-
207
- if ($pos === false) {
208
-
209
- $tag = rtrim ($tag,'>');
210
-
211
- $tag .= $noFollow.'>';
212
-
213
- $content = str_replace($tag2,$tag,$content);
214
-
215
- }
216
 
 
 
 
 
 
217
  }
218
-
219
  }
220
-
221
  }
222
-
223
-
224
-
225
- $content = str_replace(']]>', ']]&gt;', $content);
226
-
227
- return $content;
228
-
229
-
230
-
231
  }
232
 
233
-
 
 
234
 
235
  }
236
-
1
  <?php
2
 
 
 
3
  /**
 
4
  * The class that handles the front screen
 
5
  *
 
6
  *
 
7
  */
 
8
  class rssPIFront {
9
 
10
+ /**
11
+ * Whether the API key is valid
12
+ *
13
+ * @var boolean
14
+ */
15
+ var $is_key_valid;
16
+
17
+ /**
18
+ * The options
19
+ *
20
+ * @var array
21
+ */
22
+ var $options;
23
+
24
+ /**
25
+ * Aprompt for invalid/absent API keys
26
+ * @var string
27
+ */
28
+ var $key_prompt;
29
+
30
+ /**
31
+ * Initialise and hook all actions
32
+ */
33
+ public function init() {
34
+ global $post, $rss_post_importer;
35
+
36
+ // add noidex to front
37
+ add_action('wp_head', array($this, 'rss_pi_noindex_meta_tag'));
38
+
39
+ // add options
40
+ $this->options = $rss_post_importer->options;
41
+
42
+ // Check for block indexing
43
+ if ($this->options['settings']['nofollow_outbound'] == 'true') {
44
+ add_filter('the_content', array($this, 'rss_pi_url_parse'));
45
+ }
46
+ }
47
 
48
+ function rss_pi_noindex_meta_tag() {
49
+ global $post, $rss_post_importer;
50
 
51
+ //Add meta tag for UTF-8 character encoding.
52
+ echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8" />';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
+ // Check if single post
55
+ if (is_single()) {
56
 
57
+ // Get current post id
58
+ $current_post_id = $post->ID;
59
 
60
+ // add options
61
+ $this->options = $rss_post_importer->options;
62
 
63
+ // get value of block indexing
64
+ $block_indexing = $this->options['settings']['block_indexing'];
 
65
 
66
+ // Check for block indexing
67
+ if ($this->options['settings']['block_indexing'] == 'true') {
68
+ $meta_values = get_post_meta($current_post_id, 'rss_pi_source_url', false);
69
+ // if meta value array is empty it means post is not imported by this plugin.
70
+ if (!empty($meta_values)) {
71
+ echo '<meta name="robots" content="noindex">';
72
  }
 
73
  }
 
74
  }
75
+ }
76
 
77
+ function rss_pi_url_parse($content) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
+ $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>";
80
+ if (preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {
81
+ if (!empty($matches)) {
82
 
83
+ $srcUrl = get_option('home');
84
+ for ($i = 0; $i < count($matches); $i++) {
85
 
86
+ $tag = $matches[$i][0];
87
+ $tag2 = $matches[$i][0];
88
+ $url = $matches[$i][0];
89
 
90
+ $noFollow = '';
91
 
92
+ $pattern = '/target\s*=\s*"\s*_blank\s*"/';
93
+ preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
94
+ if (count($match) < 1)
95
+ $noFollow .= ' target="_blank" ';
96
 
97
+ $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/';
98
+ preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE);
99
+ if (count($match) < 1)
100
+ $noFollow .= ' rel="nofollow" ';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ $pos = strpos($url, $srcUrl);
103
+ if ($pos === false) {
104
+ $tag = rtrim($tag, '>');
105
+ $tag .= $noFollow . '>';
106
+ $content = str_replace($tag2, $tag, $content);
107
  }
 
108
  }
 
109
  }
 
 
 
 
 
 
 
 
 
110
  }
111
 
112
+ $content = str_replace(']]>', ']]&gt;', $content);
113
+ return $content;
114
+ }
115
 
116
  }
 
app/classes/helpers/class-rss-pi-featured-image.php CHANGED
@@ -1,232 +1,124 @@
1
  <?php
2
 
3
  /**
4
-
5
  * Sets a featured image
6
-
7
  *
8
-
9
  * @author Saurabh Shukla <saurabh@yapapaya.com>
10
-
11
  */
12
-
13
- if ( !function_exists('download_url') ) {
14
-
15
- require_once(ABSPATH.'/wp-admin/includes/file.php');
16
-
17
  };
18
 
19
-
20
-
21
- if ( !function_exists('media_handle_sideload') ) {
22
-
23
- require_once(ABSPATH . "wp-admin" . '/includes/image.php');
24
-
25
- require_once(ABSPATH . "wp-admin" . '/includes/file.php');
26
-
27
- require_once(ABSPATH . "wp-admin" . '/includes/media.php');
28
-
29
  };
30
 
31
  class rssPIFeaturedImage {
32
 
33
-
34
-
35
- /**
36
-
37
- * Sets featured image
 
 
 
38
 
39
- *
40
 
41
- * @param object $item Feed item
 
 
42
 
43
- * @param int $post_id Post id
 
 
44
 
45
- * @return boolean
 
 
46
 
47
- */
48
 
49
- function _set($item, $post_id) {
50
-
51
-
52
-
53
- $content = $item->get_content() != "" ? $item->get_content() : $item->get_description();
54
-
55
-
56
-
57
-
58
-
59
- // catch base url
60
-
61
- preg_match('/href="(.+?)"/i', $content, $matches);
62
-
63
- $baseref = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
64
-
65
-
66
-
67
- // get the first image from content
68
-
69
- preg_match('/<img.+?src="(.+?)"[^}]+>/i', $content, $matches);
70
-
71
- $img_url = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
72
-
73
-
74
-
75
- if (empty($img_url)) {
76
 
 
77
  return false;
 
78
 
79
- }
80
-
81
-
82
-
83
- $img_host = parse_url($img_url, PHP_URL_HOST);
84
-
85
-
86
-
87
- if (empty($img_host)) {
88
-
89
-
90
-
91
- if (empty($baseref)) {
92
-
93
- return false;
94
-
95
- };
96
-
97
-
98
-
99
- $bc = parse_url($baseref);
100
-
101
- $scheme = (empty($bc["scheme"])) ? "http" : $bc["scheme"];
102
-
103
- $port = $bc["port"];
104
-
105
- $host = $bc["host"];
106
-
107
- if (empty($host)) {
108
-
109
- return false;
110
-
111
- };
112
-
113
-
114
-
115
- $img_url = $scheme . ":" . $port . "//" . $host . $img_url;
116
-
117
- }
118
-
119
-
120
-
121
- // get the first image from content
122
-
123
- /*preg_match('/<img.+?src="(.+?)"[^}]+>/i', $content, $matches);
124
-
125
- $img_url = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
126
-
127
-
128
-
129
- if (empty($img_url)) {
130
-
131
- return false;
132
-
133
- }
134
-
135
- */
136
-
137
- // sideload it
138
-
139
- $featured_id = $this->_sideload($img_url, $post_id, '');
140
-
141
-
142
-
143
- add_action('set_rss_pi_featured_image', $featured_id, $post_id);
144
-
145
-
146
- // set as featured image
147
-
148
- return $meta_id = set_post_thumbnail($post_id, $featured_id);
149
-
150
- }
151
-
152
-
153
-
154
- /**
155
-
156
- * Modification of default media_sideload_image
157
-
158
- *
159
-
160
- * @param type $file
161
-
162
- * @param type $post_id
163
-
164
- * @param type $desc
165
-
166
- * @return type
167
-
168
- */
169
-
170
- private function _sideload($file, $post_id, $desc = null) {
171
-
172
- $id = 0;
173
-
174
-
175
-
176
- if (!empty($file)) {
177
-
178
- // Set variables for storage, fix file filename for query strings.
179
-
180
- preg_match('/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches);
181
-
182
- $file_array = array();
183
-
184
- $file_array['name'] = basename($file);
185
-
186
-
187
-
188
- // Download file to temp location.
189
-
190
- $file_array['tmp_name'] = download_url($file);
191
-
192
-
193
-
194
- // If error storing temporarily, return the error.
195
-
196
- if (is_wp_error($file_array['tmp_name'])) {
197
-
198
- return $file_array['tmp_name'];
199
-
200
- }
201
-
202
-
203
-
204
- // Do the validation and storage stuff.
205
-
206
- $id = media_handle_sideload($file_array, $post_id, $desc);
207
-
208
-
209
-
210
- // If error storing permanently, unlink.
211
-
212
- if (is_wp_error($id)) {
213
-
214
- @unlink($file_array['tmp_name']);
215
-
216
- return $id;
217
-
218
- }
219
-
220
- }
221
-
222
-
223
-
224
- return $id;
225
-
226
- }
227
-
228
-
229
-
230
-
231
-
232
- }
1
  <?php
2
 
3
  /**
 
4
  * Sets a featured image
 
5
  *
 
6
  * @author Saurabh Shukla <saurabh@yapapaya.com>
 
7
  */
8
+ if (!function_exists('download_url')) {
9
+ require_once(ABSPATH . '/wp-admin/includes/file.php');
 
 
 
10
  };
11
 
12
+ if (!function_exists('media_handle_sideload')) {
13
+ require_once(ABSPATH . "wp-admin" . '/includes/image.php');
14
+ require_once(ABSPATH . "wp-admin" . '/includes/file.php');
15
+ require_once(ABSPATH . "wp-admin" . '/includes/media.php');
 
 
 
 
 
 
16
  };
17
 
18
  class rssPIFeaturedImage {
19
 
20
+ /**
21
+ * Sets featured image
22
+ *
23
+ * @param object $item Feed item
24
+ * @param int $post_id Post id
25
+ * @return boolean
26
+ */
27
+ function _set($item, $post_id) {
28
 
29
+ $content = $item->get_content() != "" ? $item->get_content() : $item->get_description();
30
 
31
+ // catch base url
32
+ preg_match('/href="(.+?)"/i', $content, $matches);
33
+ $baseref = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
34
 
35
+ // get the first image from content
36
+ preg_match('/<img.+?src="(.+?)"[^}]+>/i', $content, $matches);
37
+ $img_url = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
38
 
39
+ if (empty($img_url)) {
40
+ return false;
41
+ }
42
 
43
+ $img_host = parse_url($img_url, PHP_URL_HOST);
44
 
45
+ if (empty($img_host)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ if (empty($baseref)) {
48
  return false;
49
+ };
50
 
51
+ $bc = parse_url($baseref);
52
+ $scheme = (empty($bc["scheme"])) ? "http" : $bc["scheme"];
53
+ $port = $bc["port"];
54
+ $host = $bc["host"];
55
+ if (empty($host)) {
56
+ return false;
57
+ };
58
+
59
+ $img_url = $scheme . ":" . $port . "//" . $host . $img_url;
60
+ }
61
+
62
+ // get the first image from content
63
+ /* preg_match('/<img.+?src="(.+?)"[^}]+>/i', $content, $matches);
64
+ $img_url = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
65
+
66
+ if (empty($img_url)) {
67
+ return false;
68
+ }
69
+ */
70
+ // sideload it
71
+ $featured_id = $this->_sideload( $img_url, $post_id, '' );
72
+
73
+ if ( ! is_wp_error($featured_id) ) {
74
+ // add_action('set_rss_pi_featured_image', $featured_id, $post_id);
75
+ do_action( 'set_rss_pi_featured_image', $featured_id, $post_id );
76
+ // set as featured image
77
+ $meta_id = set_post_thumbnail($post_id, $featured_id);
78
+ } else {
79
+ $meta_id = 0;
80
+ }
81
+
82
+ return $meta_id;
83
+ }
84
+
85
+ /**
86
+ * Modification of default media_sideload_image
87
+ *
88
+ * @param type $file
89
+ * @param type $post_id
90
+ * @param type $desc
91
+ * @return type
92
+ */
93
+ private function _sideload($file, $post_id, $desc = null) {
94
+
95
+ $id = 0;
96
+
97
+ if (!empty($file)) {
98
+ // Set variables for storage, fix file filename for query strings.
99
+ preg_match('/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches);
100
+ $file_array = array();
101
+ $file_array['name'] = basename($file);
102
+
103
+ // Download file to temp location.
104
+ $file_array['tmp_name'] = download_url($file);
105
+
106
+ // If error storing temporarily, return the error.
107
+ if (is_wp_error($file_array['tmp_name'])) {
108
+ return $file_array['tmp_name'];
109
+ }
110
+
111
+ // Do the validation and storage stuff.
112
+ $id = media_handle_sideload($file_array, $post_id, $desc);
113
+
114
+ // If error storing permanently, unlink.
115
+ if (is_wp_error($id)) {
116
+ @unlink($file_array['tmp_name']);
117
+ return $id;
118
+ }
119
+ }
120
+
121
+ return $id;
122
+ }
123
+
124
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/classes/helpers/class-rss-pi-log.php CHANGED
@@ -7,71 +7,71 @@
7
  */
8
  class rssPILog {
9
 
10
- /**
11
- * Initialise
12
- */
13
- public function init() {
14
-
15
- // hook ajax for loading and clearing log on admin screen
16
- add_action('wp_ajax_rss_pi_load_log', array($this, 'load_log'));
17
- add_action('wp_ajax_rss_pi_clear_log', array($this, 'clear_log'));
18
- }
19
-
20
- /**
21
- * Loads log contents
22
- */
23
- function load_log() {
24
-
25
- // get the log file's contents
26
- $log = file_get_contents(RSS_PI_LOG_PATH . 'log.txt');
27
-
28
- // include the template to display it
29
- include( RSS_PI_PATH . 'app/templates/log.php');
30
- die();
31
- }
32
-
33
- function clear_log() {
34
-
35
- // get the log file
36
- $log_file = RSS_PI_LOG_PATH . 'log.txt';
37
-
38
- if (!file_exists($log_file)) {
39
- die();
40
- }
41
-
42
- // empty it
43
- file_put_contents($log_file, '');
44
- ?>
45
- <div id="message" class="updated">
46
- <p><strong><?php _e('Log has been cleared.', "rss_pi"); ?></strong></p>
47
- </div>
48
- <?php
49
- die();
50
- }
51
-
52
- /**
53
- * Static method to add log messages
54
- *
55
- * @global object $rss_post_importer Global object
56
- * @param int $post_count Number of posts imported
57
- * @return null
58
- */
59
- static function log($post_count) {
60
-
61
- global $rss_post_importer;
62
-
63
- // if logging is disabled, return early
64
- if ($rss_post_importer->options['settings']['enable_logging'] != 'true') {
65
- return;
66
- }
67
-
68
- // prepare the log entry
69
- $log = date("Y-m-d H:i:s") . "\t Imported " . $post_count . " new posts. \n";
70
-
71
- $log_file = RSS_PI_LOG_PATH . 'log.txt';
72
-
73
- // add it to the log file
74
- file_put_contents($log_file, $log, FILE_APPEND);
75
- }
76
 
77
  }
7
  */
8
  class rssPILog {
9
 
10
+ /**
11
+ * Initialise
12
+ */
13
+ public function init() {
14
+
15
+ // hook ajax for loading and clearing log on admin screen
16
+ add_action('wp_ajax_rss_pi_load_log', array($this, 'load_log'));
17
+ add_action('wp_ajax_rss_pi_clear_log', array($this, 'clear_log'));
18
+ }
19
+
20
+ /**
21
+ * Loads log contents
22
+ */
23
+ function load_log() {
24
+
25
+ // get the log file's contents
26
+ $log = file_get_contents(RSS_PI_LOG_PATH . 'log.txt');
27
+
28
+ // include the template to display it
29
+ include( RSS_PI_PATH . 'app/templates/log.php');
30
+ die();
31
+ }
32
+
33
+ function clear_log() {
34
+
35
+ // get the log file
36
+ $log_file = RSS_PI_LOG_PATH . 'log.txt';
37
+
38
+ if (!file_exists($log_file)) {
39
+ die();
40
+ }
41
+
42
+ // empty it
43
+ file_put_contents($log_file, '');
44
+ ?>
45
+ <div id="message" class="updated">
46
+ <p><strong><?php _e('Log has been cleared.', "rss_pi"); ?></strong></p>
47
+ </div>
48
+ <?php
49
+ die();
50
+ }
51
+
52
+ /**
53
+ * Static method to add log messages
54
+ *
55
+ * @global object $rss_post_importer Global object
56
+ * @param int $post_count Number of posts imported
57
+ * @return null
58
+ */
59
+ static function log($post_count) {
60
+
61
+ global $rss_post_importer;
62
+
63
+ // if logging is disabled, return early
64
+ if ($rss_post_importer->options['settings']['enable_logging'] != 'true') {
65
+ return;
66
+ }
67
+
68
+ // prepare the log entry
69
+ $log = date("Y-m-d H:i:s") . "\t Imported " . $post_count . " new posts. \n";
70
+
71
+ $log_file = RSS_PI_LOG_PATH . 'log.txt';
72
+
73
+ // add it to the log file
74
+ file_put_contents($log_file, $log, FILE_APPEND);
75
+ }
76
 
77
  }
app/classes/helpers/class-rss-pi-parser.php CHANGED
@@ -1,171 +1,88 @@
1
  <?php
2
 
3
  /**
4
-
5
  * Parses content according to settings
6
-
7
  *
8
-
9
  * @author Saurabh Shukla <saurabh@yapapaya.com>
10
-
11
  */
12
-
13
  class rssPIParser {
14
 
15
-
16
-
17
- /**
18
-
19
- * Parse content
20
-
21
- *
22
-
23
- * @global object $rss_post_importer
24
-
25
- * @param object $item Feed item
26
-
27
- * @param string $feed_title Feed title
28
-
29
- * @param boolean $strip_html whether to strio html tags
30
-
31
- * @return type
32
-
33
- */
34
-
35
- function _parse($item, $feed_title, $strip_html) {
36
-
37
-
38
-
39
- global $rss_post_importer;
40
-
41
-
42
- // get the saved template
43
-
44
- $post_template = $rss_post_importer->options['settings']['post_template'];
45
-
46
-
47
-
48
- // get the content
49
-
50
- $c = $item->get_content() != "" ? $item->get_content() : $item->get_description();
51
-
52
-
53
-
54
- $c = apply_filters('pre_rss_pi_parse_content', $c);
55
-
56
-
57
-
58
- $c = $this->escape_backreference($c);
59
-
60
- // do all the replacements
61
-
62
- $parsed_content = preg_replace('/\{\$content\}/i', $c, $post_template);
63
-
64
- $parsed_content = preg_replace('/\{\$feed_title\}/i', $feed_title, $parsed_content);
65
-
66
- $parsed_content = preg_replace('/\{\$title\}/i', $item->get_title(), $parsed_content);
67
-
68
-
69
- // check if we need an excerpt
70
-
71
- $parsed_content = $this->_excerpt($parsed_content,$c);
72
-
73
-
74
- // strip html, if needed
75
-
76
- if ($strip_html == 'true') {
77
 
78
- $parsed_content = strip_tags($parsed_content);
79
 
80
- }
 
81
 
82
-
 
83
 
84
- $parsed_content = preg_replace('/\{\$permalink\}/i', '<a href="' . esc_url($item->get_permalink()) . '" target="_blank">' . $item->get_title() . '</a>', $parsed_content);
85
 
86
-
87
 
 
 
 
 
88
 
 
 
89
 
90
- $parsed_content = apply_filters('after_rss_pi_parse_content', $parsed_content);
91
-
92
-
93
-
94
- return $parsed_content;
95
-
96
- }
97
-
98
-
99
-
100
- /*
101
 
102
- *
103
 
104
- * Escape $n backreferences
105
 
106
- */
107
 
108
-
 
109
 
110
- function escape_backreference($x){
 
 
 
 
111
 
112
  return preg_replace('/\$(\d)/', '\\\$$1', $x);
113
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
 
116
-
117
-
118
-
119
-
120
- /**
121
-
122
- * Checks and creates an excerpts
123
-
124
- *
125
-
126
- * @param string $content Content
127
-
128
- * @return string
129
-
130
- */
131
-
132
- private function _excerpt($content,$c){
133
-
134
-
135
-
136
- // if there's an excerpt placeholder
137
-
138
- preg_match('/\{\$excerpt\:(\d+)\}/i', $content, $matches);
139
-
140
-
141
-
142
- // if there's a wordcount
143
-
144
- $e_size = (is_array($matches) && !empty($matches)) ? $matches[1] : 0;
145
-
146
-
147
-
148
- // cut it down and replace the placeholder
149
-
150
- if ($e_size) {
151
-
152
- $trimmed_c = preg_replace('/<!--(.|\s)*?-->/', '', $c);
153
-
154
- // compulsorily strip html otherwise there'll be broken html all over
155
-
156
- $stripped_c = strip_tags($trimmed_c);
157
-
158
- $content = preg_replace('/\{\$excerpt\:\d+\}/i', wp_trim_words($stripped_c, $e_size), $content);
159
-
160
- }
161
-
162
-
163
-
164
- return $content;
165
-
166
-
167
-
168
- }
169
 
170
  }
171
-
1
  <?php
2
 
3
  /**
 
4
  * Parses content according to settings
 
5
  *
 
6
  * @author Saurabh Shukla <saurabh@yapapaya.com>
 
7
  */
 
8
  class rssPIParser {
9
 
10
+ /**
11
+ * Parse content
12
+ *
13
+ * @global object $rss_post_importer
14
+ * @param object $item Feed item
15
+ * @param string $feed_title Feed title
16
+ * @param boolean $strip_html whether to strio html tags
17
+ * @return type
18
+ */
19
+ function _parse($item, $feed_title, $strip_html) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ global $rss_post_importer;
22
 
23
+ // get the saved template
24
+ $post_template = $rss_post_importer->options['settings']['post_template'];
25
 
26
+ // get the content
27
+ $c = $item->get_content() != "" ? $item->get_content() : $item->get_description();
28
 
29
+ $c = apply_filters('pre_rss_pi_parse_content', $c);
30
 
31
+ $c = $this->escape_backreference($c);
32
 
33
+ // do all the replacements
34
+ $parsed_content = preg_replace('/\{\$content\}/i', $c, $post_template);
35
+ $parsed_content = preg_replace('/\{\$feed_title\}/i', $feed_title, $parsed_content);
36
+ $parsed_content = preg_replace('/\{\$title\}/i', $item->get_title(), $parsed_content);
37
 
38
+ // check if we need an excerpt
39
+ $parsed_content = $this->_excerpt($parsed_content, $c);
40
 
41
+ // strip html, if needed
42
+ if ($strip_html == 'true') {
43
+ $parsed_content = strip_tags($parsed_content);
44
+ }
 
 
 
 
 
 
 
45
 
46
+ $parsed_content = preg_replace('/\{\$permalink\}/i', '<a href="' . esc_url($item->get_permalink()) . '" target="_blank">' . $item->get_title() . '</a>', $parsed_content);
47
 
 
48
 
49
+ $parsed_content = apply_filters('after_rss_pi_parse_content', $parsed_content);
50
 
51
+ return $parsed_content;
52
+ }
53
 
54
+ /*
55
+ *
56
+ * Escape $n backreferences
57
+ */
58
+ function escape_backreference($x) {
59
 
60
  return preg_replace('/\$(\d)/', '\\\$$1', $x);
61
+ }
62
+
63
+ /**
64
+ * Checks and creates an excerpts
65
+ *
66
+ * @param string $content Content
67
+ * @return string
68
+ */
69
+ private function _excerpt($content, $c) {
70
+
71
+ // if there's an excerpt placeholder
72
+ preg_match('/\{\$excerpt\:(\d+)\}/i', $content, $matches);
73
+
74
+ // if there's a wordcount
75
+ $e_size = (is_array($matches) && !empty($matches)) ? $matches[1] : 0;
76
+
77
+ // cut it down and replace the placeholder
78
+ if ($e_size) {
79
+ $trimmed_c = preg_replace('/<!--(.|\s)*?-->/', '', $c);
80
+ // compulsorily strip html otherwise there'll be broken html all over
81
+ $stripped_c = strip_tags($trimmed_c);
82
+ $content = preg_replace('/\{\$excerpt\:\d+\}/i', wp_trim_words($stripped_c, $e_size), $content);
83
  }
84
 
85
+ return $content;
86
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  }
 
app/classes/import/class-rss-pi-cron.php CHANGED
@@ -1,47 +1,41 @@
1
- <?php
2
-
3
- /**
4
- * Handles cron jobs
5
- *
6
- * @author Saurabh Shukla <saurabh@yapapaya.com>
7
- */
8
- class rssPICron {
9
-
10
- /**
11
- * Initialise
12
- */
13
- public function init() {
14
-
15
- // hook up scheduled events
16
- add_action('wp', array(&$this, 'schedule'));
17
-
18
- add_action('rss_pi_cron', array(&$this, 'do_hourly'));
19
-
20
-
21
- }
22
-
23
- /**
24
- * Check and confirm scheduling
25
- */
26
- function schedule() {
27
-
28
- if (!wp_next_scheduled('rss_pi_cron')) {
29
-
30
- wp_schedule_event(time(), 'hourly', 'rss_pi_cron');
31
- }
32
- }
33
-
34
- /**
35
- * Import the feeds on schedule
36
- */
37
- function do_hourly() {
38
-
39
- $engine = new rssPIEngine();
40
- $engine->import_feed();
41
- }
42
-
43
-
44
-
45
-
46
-
47
- }
1
+ <?php
2
+
3
+ /**
4
+ * Handles cron jobs
5
+ *
6
+ * @author Saurabh Shukla <saurabh@yapapaya.com>
7
+ */
8
+ class rssPICron {
9
+
10
+ /**
11
+ * Initialise
12
+ */
13
+ public function init() {
14
+
15
+ // hook up scheduled events
16
+ add_action('wp', array(&$this, 'schedule'));
17
+
18
+ add_action('rss_pi_cron', array(&$this, 'do_hourly'));
19
+ }
20
+
21
+ /**
22
+ * Check and confirm scheduling
23
+ */
24
+ function schedule() {
25
+
26
+ if (!wp_next_scheduled('rss_pi_cron')) {
27
+
28
+ wp_schedule_event(time(), 'hourly', 'rss_pi_cron');
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Import the feeds on schedule
34
+ */
35
+ function do_hourly() {
36
+
37
+ $engine = new rssPIEngine();
38
+ $engine->import_feed();
39
+ }
40
+
41
+ }
 
 
 
 
 
 
app/classes/import/class-rss-pi-engine.php CHANGED
@@ -1,926 +1,540 @@
1
  <?php
2
 
3
-
4
-
5
  /**
6
-
7
  * Main import engine
8
-
9
  *
10
-
11
  * @author Saurabh Shukla <saurabh@yapapaya.com>
12
-
13
  */
14
-
15
  class rssPIEngine {
16
 
17
-
18
-
19
- /**
20
-
21
- * The options
22
-
23
- *
24
-
25
- * @var array
26
-
27
- */
28
-
29
- var $options = array();
30
-
31
-
32
-
33
- /**
34
-
35
- * Start the engine
36
-
37
- *
38
-
39
- * @global type $rss_post_importer
40
-
41
- */
42
-
43
- public function __construct() {
44
-
45
-
46
-
47
- global $rss_post_importer;
48
-
49
-
50
-
51
- // load options
52
-
53
- $this->options = $rss_post_importer->options;
54
-
55
- }
56
-
57
-
58
-
59
- /**
60
-
61
- * Import feeds
62
-
63
- *
64
-
65
- * @return int
66
-
67
- */
68
-
69
- public function import_feed() {
70
-
71
-
72
-
73
- $post_count = 0;
74
-
75
-
76
-
77
- // filter cache lifetime
78
-
79
- add_filter('wp_feed_cache_transient_lifetime', array($this, 'frequency'));
80
-
81
-
82
-
83
- foreach ($this->options['feeds'] as $f) {
84
-
85
-
86
-
87
- // prepare and import each feed
88
-
89
- $items = $this->prepare_import($f);
90
-
91
- $post_count += count($items);
92
-
93
- }
94
-
95
-
96
-
97
- // reformulate import count
98
-
99
- $imports = intval($this->options['imports']) + $post_count;
100
-
101
-
102
-
103
- // update options
104
-
105
- update_option('rss_pi_feeds', array(
106
-
107
- 'feeds' => $this->options['feeds'],
108
-
109
- 'settings' => $this->options['settings'],
110
-
111
- 'latest_import' => date("Y-m-d H:i:s"),
112
-
113
- 'imports' => $imports
114
-
115
- ));
116
-
117
-
118
-
119
- global $rss_post_importer;
120
-
121
- // reload options
122
-
123
- $rss_post_importer->load_options();
124
-
125
-
126
-
127
- remove_filter('wp_feed_cache_transient_lifetime', array($this, 'frequency'));
128
-
129
-
130
-
131
- // log this
132
-
133
- rssPILog::log($post_count);
134
-
135
-
136
-
137
- return $post_count;
138
-
139
- }
140
-
141
-
142
-
143
- /**
144
-
145
- * Dummy function for filtering because we can't use anon ones yet
146
-
147
- * @return string
148
-
149
- */
150
-
151
- public function frequency() {
152
-
153
- return $this->options['settings']['frequency'];
154
-
155
- }
156
-
157
-
158
-
159
- /**
160
-
161
- * Prepares arguments and imports
162
-
163
- *
164
-
165
- * @param array $f feed array
166
-
167
- * @return array
168
-
169
- */
170
-
171
- private function prepare_import($f) {
172
-
173
- $args = array(
174
-
175
- 'feed_title' => $f['name'],
176
-
177
- 'max_posts' => $f['max_posts'],
178
-
179
- 'author_id' => $f['author_id'],
180
-
181
- 'category_id' => $f['category_id'],
182
-
183
- 'tags_id' => $f['tags_id'],
184
-
185
- 'strip_html' => $f['strip_html'],
186
-
187
- 'save_to_db' => true
188
-
189
- );
190
-
191
- return $this->_import($f['url'], $args);
192
-
193
- }
194
-
195
-
196
-
197
- /**
198
-
199
- * Import feeds from url
200
-
201
- *
202
-
203
- * @param string $url The remote feed url
204
-
205
- * @param array $args Arguments for the import
206
-
207
- * @return null|array
208
-
209
- */
210
-
211
- private function _import($url = '', $args = array()) {
212
-
213
-
214
-
215
- if (empty($url)) {
216
-
217
- return;
218
-
219
- }
220
-
221
-
222
-
223
- $defaults = array(
224
-
225
- 'feed_title' => '',
226
-
227
- 'max_posts' => 5,
228
-
229
- 'author_id' => 1,
230
-
231
- 'category_id' => 0,
232
-
233
- 'tags_id' => array(),
234
-
235
- 'strip_html' => true,
236
-
237
- 'save_to_db' => true
238
-
239
- );
240
-
241
-
242
-
243
- $args = wp_parse_args($args, $defaults);
244
-
245
-
246
-
247
- // include the default WP feed processing functions
248
-
249
- include_once( ABSPATH . WPINC . '/feed.php' );
250
-
251
-
252
-
253
- // get the right url for fetching (premium vs free)
254
-
255
- $url = $this->url($url);
256
-
257
-
258
-
259
- // fetch the feed
260
-
261
- $feed = fetch_feed($url);
262
-
263
-
264
-
265
-
266
-
267
- // save as posts
268
-
269
- $posts = $this->save($feed, $args);
270
-
271
-
272
-
273
- return $posts;
274
-
275
- }
276
-
277
-
278
-
279
- /**
280
-
281
- * Formulate the right url
282
-
283
- *
284
-
285
- * @param string $url
286
-
287
- * @return string
288
-
289
- */
290
-
291
- private function url($url) {
292
-
293
-
294
-
295
- $key = $this->options['settings']["feeds_api_key"];
296
-
297
-
298
-
299
- //if api key has been saved by user and is not empty
300
-
301
- if (isset($key) && !empty($key)) {
302
-
303
-
304
-
305
- $api_url = "http://176.58.108.28/fetch.php?key=" . $key . "&url=" . $url;
306
-
307
-
308
-
309
- return $api_url;
310
-
311
- }
312
-
313
-
314
-
315
- return $url;
316
-
317
- }
318
-
319
-
320
-
321
- /**
322
-
323
- * Save the feed
324
-
325
- *
326
-
327
- * @param object $feed The feed object
328
-
329
- * @param array $args The arguments
330
-
331
- * @return boolean
332
-
333
- */
334
-
335
- private function save($feed, $args = array()) {
336
-
337
- if (is_wp_error($feed)) {
338
-
339
- return false;
340
-
341
- }
342
-
343
- // filter the feed and get feed items
344
-
345
- $feed_items = $this->filter($feed, $args);
346
-
347
-
348
-
349
- // if we are saving
350
-
351
- if ($args['save_to_db']) {
352
-
353
- // insert and return
354
-
355
- $saved_posts = $this->insert($feed_items, $args);
356
-
357
- return $saved_posts;
358
-
359
- }
360
-
361
-
362
-
363
- // otherwsie return the feed items
364
-
365
- return $feed_items;
366
-
367
- }
368
-
369
-
370
-
371
- /**
372
-
373
- * Filter the feed based on keywords
374
-
375
- *
376
-
377
- * @param object $feed The feed object
378
-
379
- * @param array $args Arguments
380
-
381
- * @return array
382
-
383
- */
384
-
385
- private function filter($feed, $args) {
386
-
387
-
388
-
389
- // the count of keyword matched items
390
-
391
- $got = 0;
392
-
393
-
394
-
395
- // the current index of the items aray
396
-
397
- $index = 0;
398
-
399
-
400
-
401
- $filtered = array();
402
-
403
-
404
-
405
- // till we have as many as the posts needed
406
-
407
- while ($got < $args['max_posts']) {
408
-
409
-
410
-
411
- // get only one item at the current index
412
-
413
- $feed_item = $feed->get_items($index, 1);
414
-
415
-
416
-
417
- // if this is empty, get out of the while
418
-
419
- if (empty($feed_item)) {
420
-
421
- break;
422
-
423
- }
424
-
425
- // else be in a forever loop
426
-
427
- // get the content
428
-
429
- $content = $feed_item[0]->get_content();
430
-
431
-
432
-
433
- // test it against the keywords
434
-
435
- $tested = $this->test($content);
436
-
437
-
438
-
439
- // if this is good for us
440
-
441
- if ($tested) {
442
-
443
- $got++;
444
-
445
-
446
-
447
- array_push($filtered, $feed_item[0]);
448
-
449
- }
450
-
451
- // shift the index
452
-
453
- $index++;
454
-
455
- }
456
-
457
-
458
-
459
- return $filtered;
460
-
461
- }
462
-
463
-
464
-
465
- /**
466
-
467
- * Test a piece of content against keywords
468
-
469
- *
470
-
471
- * @param string $content
472
-
473
- * @return boolean
474
-
475
- */
476
-
477
- function test($content) {
478
-
479
- $keywords = $this->options['settings']['keywords'];
480
-
481
-
482
-
483
- if (empty($keywords)) {
484
-
485
- return true;
486
-
487
- }
488
-
489
-
490
-
491
- $match = false;
492
-
493
-
494
-
495
- // loop through keywords
496
-
497
- foreach ($keywords as $keyword) {
498
-
499
-
500
-
501
- // if the keyword is not a regex, make it one
502
-
503
- if (!$this->is_regex($keyword)) {
504
-
505
- $keyword = '/' . $keyword . '/i';
506
-
507
- }
508
-
509
-
510
-
511
- // look for keyword in content
512
-
513
- preg_match($keyword, $content, $tested);
514
-
515
-
516
-
517
- // if it's there, we are good
518
-
519
- if (!empty($tested)) {
520
-
521
- $match = true;
522
-
523
- // no need to test anymore
524
-
525
- break;
526
-
527
- }
528
-
529
- }
530
-
531
-
532
-
533
-
534
-
535
- return $match;
536
-
537
- }
538
-
539
-
540
-
541
- /**
542
-
543
- * Check if a string is regex
544
-
545
- *
546
-
547
- * @param string $str The string to check
548
-
549
- * @return boolean
550
-
551
- */
552
-
553
- private function is_regex($str) {
554
-
555
-
556
-
557
- // check regex with a regex!
558
-
559
- $regex = "/^\/[\s\S]+\/$/";
560
-
561
- preg_match($regex, $str, $matched);
562
-
563
- return !empty($matched);
564
-
565
- }
566
-
567
-
568
-
569
- /**
570
-
571
- * Insert feed items as posts
572
-
573
- *
574
-
575
- * @param array $items Fetched feed items
576
-
577
- * @param array $args arguments
578
-
579
- * @return array
580
-
581
- */
582
-
583
- private function insert($items, $args = array()) {
584
-
585
- $saved_posts = array();
586
-
587
-
588
-
589
- // Initialise the content parser
590
-
591
- $parser = new rssPIParser($this->options);
592
-
593
-
594
-
595
- // Featured Image setter
596
-
597
- $thumbnail = new rssPIFeaturedImage();
598
-
599
-
600
-
601
- foreach ($items as $item) {
602
-
603
- if (!$this->post_exists($item)) {
604
-
605
- /* Code to convert tags id array to tag name array **/
606
-
607
- if(!empty($args['tags_id'])){
608
-
609
- foreach($args['tags_id'] as $tagid){
610
-
611
- $tag_name = get_tag($tagid); // <-- your tag ID
612
-
613
- $tags_name[] = $tag_name->name;
614
-
615
- }
616
-
617
- }else{
618
-
619
- $tags_name = array();
620
-
621
- }
622
-
623
- $parser->_parse($item, $args['feed_title'], $args['strip_html']);
624
-
625
- $post = array(
626
-
627
- 'post_title' => $item->get_title(),
628
-
629
- // parse the content
630
-
631
- 'post_content' => $parser->_parse($item, $args['feed_title'], $args['strip_html']),
632
-
633
- 'post_status' => $this->options['settings']['post_status'],
634
-
635
- 'post_author' => $args['author_id'],
636
-
637
- 'post_category' => array($args['category_id']),
638
-
639
- 'tags_input' => $tags_name,
640
-
641
- 'comment_status' => $this->options['settings']['allow_comments'],
642
-
643
- 'post_date' => $item->get_date('Y-m-d H:i:s')
644
-
645
- );
646
-
647
-
648
-
649
- $content = $post["post_content"];
650
-
651
- // // Added header for UTF-8 encoding for imported feeds characters
652
- // header( 'Content-Type: text/html; charset=UTF-8' );
653
-
654
- // catch base url
655
- if (preg_match('/src="\//ui', $content)) {
656
-
657
- preg_match('/href="(.+?)"/ui', $content, $matches);
658
-
659
- $baseref = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
660
-
661
- if (!empty($baseref)) {
662
-
663
- $bc = parse_url($baseref);
664
-
665
- $scheme = (empty($bc["scheme"])) ? "http" : $bc["scheme"];
666
-
667
- $port = $bc["port"];
668
-
669
- $host = $bc["host"];
670
-
671
- if (!empty($host)) {
672
-
673
- $preurl = $scheme . ":" . $port . "//" . $host;
674
-
675
- $post["post_content"] = preg_replace('/(src="\/)/i', 'src="' . $preurl . "/", $content);
676
-
677
- }
678
-
679
- }
680
-
681
- }
682
-
683
-
684
-
685
- //download images and save them locally if setting suggests so
686
- if($this->options['settings']['import_images_locally'] == "true") {
687
-
688
- $post = $this->download_images_locally($post);
689
-
690
- }
691
-
692
-
693
- //elminatins unnecessary characterss
694
- //$post["post_content"] = str_replace("Â", "", $post["post_content"]);
695
-
696
- // insert as post
697
- $post_id = $this->_insert($post, $item->get_permalink());
698
-
699
-
700
- // set thumbnail
701
- $thumbnail->_set($item, $post_id);
702
-
703
-
704
- array_push($saved_posts, $post);
705
-
706
- }
707
-
708
- }
709
-
710
-
711
-
712
- return $saved_posts;
713
-
714
- }
715
-
716
-
717
-
718
- /**
719
-
720
- * Check if a feed ite is alreday imported
721
-
722
- *
723
-
724
- * @param string $permalink
725
-
726
- * @return boolean
727
-
728
- */
729
-
730
- private function post_exists($item) {
731
-
732
- global $wpdb;
733
-
734
- $permalink = $item->get_permalink();
735
- $title = $item->get_title();
736
- $domain_old = $this->get_domain($item->get_permalink());
737
-
738
- $post_exists = 0;
739
-
740
- //checking if post title already exists
741
- if( $posts = $wpdb->get_results("SELECT ID FROM ".$wpdb->prefix."posts WHERE post_title = '" . $title . "' and post_status = 'publish' ", 'ARRAY_A') ) {
742
-
743
- //checking if post source is also same
744
- foreach($posts as $post) {
745
-
746
- $post_id = $post["ID"];
747
- $source_url = get_post_meta($post_id , "rss_pi_source_url" , true);
748
- $domain_new = $this->get_domain($source_url);
749
-
750
- if($domain_new == $domain_old) {
751
- $post_exists = 1;
752
- }
753
-
754
- }
755
-
756
- }
757
-
758
- //check if the post has already been imported and then deleted
759
- $rss_pi_imported_posts = get_option("rss_pi_imported_posts");
760
-
761
- if(is_array($rss_pi_imported_posts) && in_array( $permalink , $rss_pi_imported_posts)) {
762
- $post_exists = 1;
763
- }
764
-
765
-
766
- return $post_exists;
767
-
768
- }
769
-
770
- private function get_domain($url){
771
-
772
- $pieces = parse_url($url);
773
- $domain = isset($pieces['host']) ? $pieces['host'] : '';
774
- if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
775
- return $regs['domain'];
776
- }
777
- return false;
778
-
779
- }
780
-
781
-
782
-
783
- /**
784
-
785
- * Insert feed item as post
786
-
787
- *
788
-
789
- * @param array $post Post array
790
-
791
- * @param string $url source url meta
792
-
793
- * @return int
794
-
795
- */
796
-
797
- private function _insert($post, $url) {
798
-
799
-
800
-
801
- if($post['post_category'][0] == ""){
802
-
803
- $post['post_category'] = array(1);
804
-
805
- }else{
806
-
807
- if(is_array($post['post_category'][0]))
808
-
809
- $post['post_category']= array_values($post['post_category'][0]);
810
-
811
- else
812
-
813
- $post['post_category']= array_values($post['post_category']);
814
-
815
  }
816
 
817
-
818
-
819
- $_post = apply_filters('pre_rss_pi_insert_post', $post);
820
-
821
-
822
-
823
- $post_id = wp_insert_post($_post);
824
-
825
-
826
-
827
- add_action('save_rss_pi_post', $post_id);
828
-
829
-
830
-
831
- add_post_meta($post_id, 'rss_pi_source_url', esc_url($url));
832
-
833
-
834
- //saving each post URL in option table
835
- $rss_pi_imported_posts = get_option("rss_pi_imported_posts");
836
- if( !is_array($rss_pi_imported_posts) ) {
837
- $rss_pi_imported_posts = array();
838
- }
839
- $rss_pi_imported_posts[] = $url;
840
- update_option( "rss_pi_imported_posts" , $rss_pi_imported_posts );
841
-
842
-
843
- return $post_id;
844
-
845
- }
846
-
847
- public function pre($arr) {
848
-
849
- echo "<pre>";
850
- print_r($arr);
851
- echo "</pre>";
852
-
853
- }
854
-
855
-
856
- function download_images_locally($post) {
857
-
858
- $post_content = $post["post_content"];
859
-
860
- // initializing DOMDocument to modify the img source
861
- $dom = new DOMDocument;
862
- libxml_use_internal_errors(true);
863
- $dom->loadHTML( '<?xml encoding="utf-8" ?>'.$post_content );
864
- $xpath = new DOMXPath( $dom );
865
- libxml_clear_errors();
866
-
867
- //get all the src attribs and their values
868
- $doc = $dom->getElementsByTagName("html")->item(0);
869
- $src = $xpath->query(".//@src");
870
-
871
- $count = 1;
872
-
873
- foreach ( $src as $s ) {
874
-
875
- $url = trim($s->nodeValue);
876
- $attachment_id = $this->add_to_media($url , 0 , $post["post_title"]."-media-".$count );
877
- $src = wp_get_attachment_url( $attachment_id );
878
- $s->nodeValue = $src;
879
- $count++;
880
-
881
- }
882
-
883
- $post["post_content"] = $dom->saveXML( $doc );
884
-
885
- return $post;
886
- }
887
-
888
- function add_to_media($url , $associated_with_post , $desc ) {
889
-
890
- $tmp = download_url( $url );
891
-
892
- $post_id = $associated_with_post;
893
- $desc = $desc;
894
- $file_array = array();
895
-
896
- // Set variables for storage
897
- // fix file filename for query strings
898
- preg_match('/[^\?]+\.(jpg|jpe|jpeg|gif|png)/i', $url, $matches);
899
- $file_array['name'] = basename($matches[0]);
900
- $file_array['tmp_name'] = $tmp;
901
-
902
- // If error storing temporarily, unlink
903
- if ( is_wp_error( $tmp ) ) {
904
- @unlink($file_array['tmp_name']);
905
- return false;
906
- }
907
-
908
- // do the validation and storage stuff
909
- $id = media_handle_sideload( $file_array, $post_id, $desc );
910
-
911
- // If error storing permanently, unlink
912
- if ( is_wp_error($id) ) {
913
- @unlink($file_array['tmp_name']);
914
- return false;
915
- }
916
-
917
-
918
- return $id ;
919
 
920
- }
 
921
 
 
 
922
 
 
 
 
 
923
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
924
 
925
  }
926
-
1
  <?php
2
 
 
 
3
  /**
 
4
  * Main import engine
 
5
  *
 
6
  * @author Saurabh Shukla <saurabh@yapapaya.com>
 
7
  */
 
8
  class rssPIEngine {
9
 
10
+ /**
11
+ * Whether the API key is valid
12
+ *
13
+ * @var boolean
14
+ */
15
+ var $is_key_valid;
16
+
17
+ /**
18
+ * The options
19
+ *
20
+ * @var array
21
+ */
22
+ var $options = array();
23
+
24
+ /**
25
+ * Start the engine
26
+ *
27
+ * @global type $rss_post_importer
28
+ */
29
+ public function __construct() {
30
+
31
+ global $rss_post_importer;
32
+
33
+ // load options
34
+ $this->options = $rss_post_importer->options;
35
+ }
36
+
37
+ /**
38
+ * Import feeds
39
+ *
40
+ * @return int
41
+ */
42
+ public function import_feed() {
43
+ global $rss_post_importer;
44
+
45
+ $post_count = 0;
46
+
47
+ // filter cache lifetime
48
+ add_filter('wp_feed_cache_transient_lifetime', array($this, 'frequency'));
49
+
50
+ foreach ($this->options['feeds'] as $i => $f) {
51
+
52
+ // before the first feed, we check for key validity
53
+ if ( $i == 0 ) {
54
+ $this->is_key_valid = $rss_post_importer->is_valid_key($this->options['settings']['feeds_api_key']);
55
+ $this->options['settings']['is_key_valid'] = $this->is_key_valid;
56
+ // if the key is not fine
57
+ if (!empty($this->options['settings']['feeds_api_key']) && !$this->is_key_valid) {
58
+ // unset from settings
59
+ unset($this->options['settings']['feeds_api_key']);
60
+ }
61
+ // update options
62
+ update_option('rss_pi_feeds', array(
63
+ 'feeds' => $this->options['feeds'],
64
+ 'settings' => $this->options['settings'],
65
+ 'latest_import' => $this->options['latest_import'],
66
+ 'imports' => $this->options['imports']
67
+ ));
68
+ }
69
+
70
+ // prepare and import each feed
71
+ $items = $this->prepare_import($f);
72
+ $post_count += count($items);
73
+ }
74
+
75
+ // reformulate import count
76
+ $imports = intval($this->options['imports']) + $post_count;
77
+
78
+ // update options
79
+ update_option('rss_pi_feeds', array(
80
+ 'feeds' => $this->options['feeds'],
81
+ 'settings' => $this->options['settings'],
82
+ 'latest_import' => date("Y-m-d H:i:s"),
83
+ 'imports' => $imports
84
+ ));
85
+
86
+ global $rss_post_importer;
87
+ // reload options
88
+ $rss_post_importer->load_options();
89
+
90
+ remove_filter('wp_feed_cache_transient_lifetime', array($this, 'frequency'));
91
+
92
+ // log this
93
+ rssPILog::log($post_count);
94
+
95
+ return $post_count;
96
+ }
97
+
98
+ /**
99
+ * Dummy function for filtering because we can't use anon ones yet
100
+ * @return string
101
+ */
102
+ public function frequency() {
103
+
104
+ return $this->options['settings']['frequency'];
105
+ }
106
+
107
+ /**
108
+ * Prepares arguments and imports
109
+ *
110
+ * @param array $f feed array
111
+ * @return array
112
+ */
113
+ public function prepare_import($f) {
114
+
115
+ $args = array(
116
+ 'feed_title' => $f['name'],
117
+ 'max_posts' => $f['max_posts'],
118
+ 'author_id' => $f['author_id'],
119
+ 'category_id' => $f['category_id'],
120
+ 'tags_id' => $f['tags_id'],
121
+ 'keywords' => isset($f['keywords']) && is_array($f['keywords']) ? $f['keywords'] : array(),
122
+ 'strip_html' => $f['strip_html'],
123
+ 'save_to_db' => true
124
+ );
125
+ return $this->_import($f['url'], $args);
126
+ }
127
+
128
+ /**
129
+ * Import feeds from url
130
+ *
131
+ * @param string $url The remote feed url
132
+ * @param array $args Arguments for the import
133
+ * @return null|array
134
+ */
135
+ private function _import($url = '', $args = array()) {
136
+
137
+ if (empty($url)) {
138
+ return;
139
+ }
140
+
141
+ $defaults = array(
142
+ 'feed_title' => '',
143
+ 'max_posts' => 5,
144
+ 'author_id' => 1,
145
+ 'category_id' => 0,
146
+ 'tags_id' => array(),
147
+ 'keywords' => array(),
148
+ 'strip_html' => true,
149
+ 'save_to_db' => true
150
+ );
151
+
152
+ $args = wp_parse_args($args, $defaults);
153
+
154
+ // include the default WP feed processing functions
155
+ include_once( ABSPATH . WPINC . '/feed.php' );
156
+
157
+ // get the right url for fetching (premium vs free)
158
+ $url = $this->url($url);
159
+
160
+ // fetch the feed
161
+ $feed = fetch_feed($url);
162
+
163
+ // save as posts
164
+ $posts = $this->save($feed, $args);
165
+
166
+ return $posts;
167
+ }
168
+
169
+ /**
170
+ * Formulate the right url
171
+ *
172
+ * @param string $url
173
+ * @return string
174
+ */
175
+ private function url($url) {
176
+
177
+ $key = $this->options['settings']['feeds_api_key'];
178
+
179
+ //if api key has been saved by user and is not empty
180
+ if (isset($key) && !empty($key)) {
181
+
182
+ $api_url = 'http://176.58.108.28/fetch.php?key=' . $key . '&url=' . $url;
183
+
184
+ return $api_url;
185
+ }
186
+
187
+ return $url;
188
+ }
189
+
190
+ /**
191
+ * Save the feed
192
+ *
193
+ * @param object $feed The feed object
194
+ * @param array $args The arguments
195
+ * @return boolean
196
+ */
197
+ private function save($feed, $args = array()) {
198
+
199
+ if (is_wp_error($feed)) {
200
+ return false;
201
+ }
202
+ // filter the feed and get feed items
203
+ $feed_items = $this->filter($feed, $args);
204
+
205
+ // if we are saving
206
+ if ($args['save_to_db']) {
207
+ // insert and return
208
+ $saved_posts = $this->insert($feed_items, $args);
209
+ return $saved_posts;
210
+ }
211
+
212
+ // otherwsie return the feed items
213
+ return $feed_items;
214
+ }
215
+
216
+ /**
217
+ * Filter the feed based on keywords
218
+ *
219
+ * @param object $feed The feed object
220
+ * @param array $args Arguments
221
+ * @return array
222
+ */
223
+ private function filter($feed, $args) {
224
+
225
+ // the count of keyword matched items
226
+ $got = 0;
227
+
228
+ // the current index of the items aray
229
+ $index = 0;
230
+
231
+ $filtered = array();
232
+
233
+ // till we have as many as the posts needed
234
+ while ($got < $args['max_posts']) {
235
+
236
+ // get only one item at the current index
237
+ $feed_item = $feed->get_items($index, 1);
238
+
239
+ // if this is empty, get out of the while
240
+ if (empty($feed_item)) {
241
+ break;
242
+ }
243
+ // else be in a forever loop
244
+ // get the content
245
+ $content = $feed_item[0]->get_content();
246
+
247
+ // test it against the keywords
248
+ $tested = $this->test($content,$args['keywords']);
249
+
250
+ // if this is good for us
251
+ if ($tested) {
252
+ $got++;
253
+
254
+ array_push($filtered, $feed_item[0]);
255
+ }
256
+ // shift the index
257
+ $index++;
258
+ }
259
+
260
+ return $filtered;
261
+ }
262
+
263
+ /**
264
+ * Test a piece of content against keywords
265
+ *
266
+ * @param string $content
267
+ * @return boolean
268
+ */
269
+ function test($content,$keywords=null) {
270
+
271
+ if ( ! $keywords ) {
272
+ $keywords = $this->options['settings']['keywords'];
273
+ }
274
+
275
+ if ( empty($keywords) || ! is_array($keywords) ) {
276
+ return true;
277
+ }
278
+
279
+ $match = false;
280
+
281
+ // loop through keywords
282
+ foreach ( $keywords as $keyword ) {
283
+
284
+ // if the keyword is not a regex, make it one
285
+ if ( ! $this->is_regex($keyword) ) {
286
+ $keyword = '/' . $keyword . '/i';
287
+ }
288
+
289
+ // look for keyword in content
290
+ preg_match($keyword, $content, $tested);
291
+
292
+ // if it's there, we are good
293
+ if ( ! empty($tested) ) {
294
+ $match = true;
295
+ // no need to test anymore
296
+ break;
297
+ }
298
+ }
299
+
300
+
301
+ return $match;
302
+ }
303
+
304
+ /**
305
+ * Check if a string is regex
306
+ *
307
+ * @param string $str The string to check
308
+ * @return boolean
309
+ */
310
+ private function is_regex($str) {
311
+
312
+ // check regex with a regex!
313
+ $regex = '/^\/[\s\S]+\/$/';
314
+ preg_match($regex, $str, $matched);
315
+ return !empty($matched);
316
+ }
317
+
318
+ /**
319
+ * Insert feed items as posts
320
+ *
321
+ * @param array $items Fetched feed items
322
+ * @param array $args arguments
323
+ * @return array
324
+ */
325
+ private function insert($items, $args = array()) {
326
+
327
+ $saved_posts = array();
328
+
329
+ // Initialise the content parser
330
+ $parser = new rssPIParser($this->options);
331
+
332
+ // Featured Image setter
333
+ $thumbnail = new rssPIFeaturedImage();
334
+
335
+ foreach ($items as $item) {
336
+ if (!$this->post_exists($item)) {
337
+ /* Code to convert tags id array to tag name array * */
338
+ if (!empty($args['tags_id'])) {
339
+ foreach ($args['tags_id'] as $tagid) {
340
+ $tag_name = get_tag($tagid); // <-- your tag ID
341
+ $tags_name[] = $tag_name->name;
342
+ }
343
+ } else {
344
+ $tags_name = array();
345
+ }
346
+ $parser->_parse($item, $args['feed_title'], $args['strip_html']);
347
+ $post = array(
348
+ 'post_title' => $item->get_title(),
349
+ // parse the content
350
+ 'post_content' => $parser->_parse($item, $args['feed_title'], $args['strip_html']),
351
+ 'post_status' => $this->options['settings']['post_status'],
352
+ 'post_author' => $args['author_id'],
353
+ 'post_category' => array($args['category_id']),
354
+ 'tags_input' => $tags_name,
355
+ 'comment_status' => $this->options['settings']['allow_comments'],
356
+ 'post_date' => get_date_from_gmt($item->get_date('Y-m-d H:i:s'))
357
+ );
358
+
359
+ $content = $post['post_content'];
360
+
361
+ // catch base url and replace any img src with it
362
+ if (preg_match('/src="\//ui', $content)) {
363
+ preg_match('/href="(.+?)"/ui', $content, $matches);
364
+ $baseref = (is_array($matches) && !empty($matches)) ? $matches[1] : '';
365
+ if (!empty($baseref)) {
366
+ $bc = parse_url($baseref);
367
+ $scheme = (!isset($bc['scheme']) || empty($bc['scheme'])) ? 'http' : $bc['scheme'];
368
+ $port = isset($bc['port']) ? $bc['port'] : '';
369
+ $host = isset($bc['host']) ? $bc['host'] : '';
370
+ if (!empty($host)) {
371
+ $preurl = $scheme . ( $port ? ':' . $port : '' ) . '//' . $host;
372
+ $post['post_content'] = preg_replace('/(src="\/)/i', 'src="' . $preurl . '/', $content);
373
+ }
374
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  }
376
 
377
+ //download images and save them locally if setting suggests so
378
+ if ($this->options['settings']['import_images_locally'] == 'true') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
 
380
+ $post = $this->download_images_locally($post);
381
+ }
382
 
383
+ // insert as post
384
+ $post_id = $this->_insert($post, $item->get_permalink());
385
 
386
+ // set thumbnail
387
+ if ($this->options['settings']['disable_thumbnail'] == 'false') {
388
+ $thumbnail->_set($item, $post_id);
389
+ }
390
 
391
+ array_push($saved_posts, $post);
392
+ }
393
+ }
394
+
395
+ return $saved_posts;
396
+ }
397
+
398
+ /**
399
+ * Check if a feed ite is alreday imported
400
+ *
401
+ * @param string $permalink
402
+ * @return boolean
403
+ */
404
+ private function post_exists($item) {
405
+
406
+ global $wpdb;
407
+ $permalink = $item->get_permalink();
408
+ $title = $item->get_title();
409
+ $domain_old = $this->get_domain($item->get_permalink());
410
+
411
+ $post_exists = 0;
412
+ //checking if post title already exists
413
+ if ($posts = $wpdb->get_results("SELECT ID FROM " . $wpdb->prefix . "posts WHERE post_title = '" . $title . "' and post_status = 'publish' ", 'ARRAY_A')) {
414
+ //checking if post source is also same
415
+ foreach ($posts as $post) {
416
+ $post_id = $post['ID'];
417
+ $source_url = get_post_meta($post_id, 'rss_pi_source_url', true);
418
+ $domain_new = $this->get_domain($source_url);
419
+
420
+ if ($domain_new == $domain_old) {
421
+ $post_exists = 1;
422
+ }
423
+ }
424
+ }
425
+ //check if the post has already been imported and then deleted
426
+ $rss_pi_imported_posts = get_option('rss_pi_imported_posts');
427
+ if (is_array($rss_pi_imported_posts) && in_array($permalink, $rss_pi_imported_posts)) {
428
+ $post_exists = 1;
429
+ }
430
+
431
+ return $post_exists;
432
+ }
433
+
434
+ private function get_domain($url) {
435
+
436
+ $pieces = parse_url($url);
437
+ $domain = isset($pieces['host']) ? $pieces['host'] : '';
438
+ if (preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i', $domain, $regs)) {
439
+ return $regs['domain'];
440
+ }
441
+ return false;
442
+ }
443
+
444
+ /**
445
+ * Insert feed item as post
446
+ *
447
+ * @param array $post Post array
448
+ * @param string $url source url meta
449
+ * @return int
450
+ */
451
+ private function _insert($post, $url) {
452
+
453
+ if ($post['post_category'][0] == "") {
454
+ $post['post_category'] = array(1);
455
+ } else {
456
+ if (is_array($post['post_category'][0]))
457
+ $post['post_category'] = array_values($post['post_category'][0]);
458
+ else
459
+ $post['post_category'] = array_values($post['post_category']);
460
+ }
461
+
462
+ $_post = apply_filters('pre_rss_pi_insert_post', $post);
463
+
464
+ $post_id = wp_insert_post($_post);
465
+
466
+ add_action('save_rss_pi_post', $post_id);
467
+
468
+ add_post_meta($post_id, 'rss_pi_source_url', esc_url($url));
469
+
470
+ //saving each post URL in option table
471
+ $rss_pi_imported_posts = get_option('rss_pi_imported_posts');
472
+ if (!is_array($rss_pi_imported_posts)) {
473
+ $rss_pi_imported_posts = array();
474
+ }
475
+ $rss_pi_imported_posts[] = $url;
476
+ update_option('rss_pi_imported_posts', $rss_pi_imported_posts);
477
+
478
+ return $post_id;
479
+ }
480
+
481
+ public function pre($arr) {
482
+
483
+ echo '<pre>';
484
+ print_r($arr);
485
+ echo '</pre>';
486
+ }
487
+
488
+ function download_images_locally($post) {
489
+
490
+ $post_content = $post['post_content'];
491
+ // initializing DOMDocument to modify the img source
492
+ $dom = new DOMDocument;
493
+ libxml_use_internal_errors(true);
494
+ $dom->loadHTML('<?xml encoding="utf-8" ?>' . $post_content);
495
+ $xpath = new DOMXPath($dom);
496
+ libxml_clear_errors();
497
+ //get all the src attribs and their values
498
+ $doc = $dom->getElementsByTagName('html')->item(0);
499
+ $src = $xpath->query('.//@src');
500
+ $count = 1;
501
+ foreach ($src as $s) {
502
+ $url = trim($s->nodeValue);
503
+ $attachment_id = $this->add_to_media($url, 0, $post['post_title'] . '-media-' . $count);
504
+ $src = wp_get_attachment_url($attachment_id);
505
+ $s->nodeValue = $src;
506
+ $count++;
507
+ }
508
+ $post['post_content'] = $dom->saveXML($doc);
509
+ return $post;
510
+ }
511
+
512
+ function add_to_media($url, $associated_with_post, $desc) {
513
+ $tmp = download_url($url);
514
+ $post_id = $associated_with_post;
515
+ $desc = $desc;
516
+ $file_array = array();
517
+ // Set variables for storage
518
+ // fix file filename for query strings
519
+ if ( ! preg_match('/[^\?]+\.(jpg|jpe|jpeg|gif|png)/i', $url, $matches) ) {
520
+ return false;
521
+ }
522
+ $file_array['name'] = basename($matches[0]);
523
+ $file_array['tmp_name'] = $tmp;
524
+ // If error storing temporarily, unlink
525
+ if (is_wp_error($tmp)) {
526
+ @unlink($file_array['tmp_name']);
527
+ return false;
528
+ }
529
+ // do the validation and storage stuff
530
+ $id = media_handle_sideload($file_array, $post_id, $desc);
531
+ // If error storing permanently, unlink
532
+ if (is_wp_error($id)) {
533
+ @unlink($file_array['tmp_name']);
534
+ return false;
535
+ }
536
+
537
+ return $id;
538
+ }
539
 
540
  }
 
app/templates/admin-ui.php CHANGED
@@ -1,36 +1,40 @@
1
  <div class="wrap">
2
- <div id="main_ui">
3
-
4
- <h2><?php _e("Rss Post Importer Settings", 'rss_pi'); ?></h2>
5
-
6
- <form method="post" id="" enctype="multipart/form-data">
7
-
8
- <input type="hidden" name="save_to_db" id="save_to_db" />
9
-
10
- <?php wp_nonce_field('settings_page', 'rss_pi_nonce'); ?>
11
-
12
- <div id="poststuff">
13
- <div id="post-body" class="metabox-holder columns-2">
14
-
15
- <div id="postbox-container-1" class="postbox-container">
16
- <?php include_once RSS_PI_PATH. 'app/templates/feed-save-box.php'; ?>
17
- </div>
18
-
19
- <div id="postbox-container-2" class="postbox-container">
20
-
21
- <?php
22
- include_once RSS_PI_PATH. 'app/templates/feed-table.php';
23
- include_once RSS_PI_PATH. 'app/templates/settings-table.php';
24
- include_once RSS_PI_PATH. 'app/templates/stats.php';
25
- ?>
26
- </div>
27
-
28
- </div>
29
- <br class="clear" />
30
- </div>
31
- </form>
32
-
33
- </div>
34
-
35
- <div class="ajax_content"></div>
 
 
 
 
36
  </div>
1
  <div class="wrap">
2
+ <div id="main_ui">
3
+
4
+ <h2><?php _e("Rss Post Importer Settings", 'rss_pi'); ?></h2>
5
+
6
+ <div id="rss_pi_progressbar"></div>
7
+ <div id="rss_pi_progressbar_label"></div>
8
+
9
+ <form method="post" id="" enctype="multipart/form-data" action="<?php echo $rss_post_importer->page_link; ?>">
10
+
11
+ <input type="hidden" name="save_to_db" id="save_to_db" />
12
+
13
+ <?php wp_nonce_field('settings_page', 'rss_pi_nonce'); ?>
14
+
15
+ <div id="poststuff">
16
+ <div id="post-body" class="metabox-holder columns-2">
17
+
18
+ <div id="postbox-container-1" class="postbox-container">
19
+ <?php include_once RSS_PI_PATH . 'app/templates/feed-save-box.php'; ?>
20
+ </div>
21
+
22
+ <div id="postbox-container-2" class="postbox-container">
23
+
24
+ <?php
25
+ include_once RSS_PI_PATH . 'app/templates/feed-table.php';
26
+ include_once RSS_PI_PATH . 'app/templates/settings-table.php';
27
+ // include_once RSS_PI_PATH . 'app/templates/stats.php'; // doing this via AJAX
28
+ include_once RSS_PI_PATH . 'app/templates/stats-placeholder.php';
29
+ ?>
30
+ </div>
31
+
32
+ </div>
33
+ <br class="clear" />
34
+ </div>
35
+ </form>
36
+
37
+ </div>
38
+
39
+ <div class="ajax_content"></div>
40
  </div>
app/templates/feed-save-box.php CHANGED
@@ -1,33 +1,77 @@
1
  <div class="postbox">
2
- <div class="inside">
3
- <div class="misc-pub-section">
4
- <h3 class="version">V. <?php echo RSS_PI_VERSION; ?></h3>
5
- <ul>
6
- <li>
7
- <i class="icon-calendar"></i> <?php _e("Latest import:", 'rss_pi'); ?> <strong><?php echo($this->options['latest_import']); ?></strong>
8
- </li>
9
- <li><i class="icon-eye-open"></i> <a href="#" class="load-log"><?php _e("View the log", 'rss_pi'); ?></a></li>
10
- </ul>
11
- </div>
12
- <div id="major-publishing-actions">
13
- <input class="button button-primary button-large right" type="submit" name="info_update" value="<?php _e('Save', 'rss_pi'); ?>" />
14
- <input class="button button-large" type="submit" name="info_update" value="<?php _e('Save and import', "rss_pi"); ?>" id="save_and_import" />
15
- </div>
16
- </div>
17
  </div>
18
  <?php if ($this->options['imports'] > 10) : ?>
19
- <div class="rate-box">
20
- <h4><?php printf(__('%d posts imported and counting!', "rss_pi"), $this->options['imports']); ?></h4>
21
- <i class="icon-star"></i>
22
- <i class="icon-star"></i>
23
- <i class="icon-star"></i>
24
- <i class="icon-star"></i>
25
- <i class="icon-star"></i>
26
- <p class="description"><a href="http://wordpress.org/plugins/rss-post-importer/" target="_blank">Please support this plugin by rating it!</a></p>
27
- </div>
28
  <?php endif; ?>
29
 
30
  <?php $banner_url = RSS_PI_URL . "app/assets/img/rss-post-importer_280x600.jpg"; ?>
31
  <a target="_blank" href="http://www.feedsapi.com/?utm=rsspostimporter_banner">
32
- <img class='rss_pi_banner_img' src="<?php echo $banner_url; ?>" />
33
- </a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <div class="postbox">
2
+ <div class="inside">
3
+ <div class="misc-pub-section">
4
+ <h3 class="version">V. <?php echo RSS_PI_VERSION; ?></h3>
5
+ <ul>
6
+ <li>
7
+ <i class="icon-calendar"></i> <?php _e("Latest import:", 'rss_pi'); ?> <strong><?php echo $this->options['latest_import'] ? $this->options['latest_import'] : 'never' ; ?></strong>
8
+ </li>
9
+ <li><i class="icon-eye-open"></i> <a href="#" class="load-log"><?php _e("View the log", 'rss_pi'); ?></a></li>
10
+ </ul>
11
+ </div>
12
+ <div id="major-publishing-actions">
13
+ <input class="button button-primary button-large right" type="submit" name="info_update" value="<?php _e('Save', 'rss_pi'); ?>" />
14
+ <input class="button button-large" type="submit" name="info_update" value="<?php _e('Save and import', "rss_pi"); ?>" id="save_and_import" />
15
+ </div>
16
+ </div>
17
  </div>
18
  <?php if ($this->options['imports'] > 10) : ?>
19
+ <div class="rate-box">
20
+ <h4><?php printf(__('%d posts imported and counting!', "rss_pi"), $this->options['imports']); ?></h4>
21
+ <i class="icon-star"></i>
22
+ <i class="icon-star"></i>
23
+ <i class="icon-star"></i>
24
+ <i class="icon-star"></i>
25
+ <i class="icon-star"></i>
26
+ <p class="description"><a href="http://wordpress.org/plugins/rss-post-importer/" target="_blank">Please support this plugin by rating it!</a></p>
27
+ </div>
28
  <?php endif; ?>
29
 
30
  <?php $banner_url = RSS_PI_URL . "app/assets/img/rss-post-importer_280x600.jpg"; ?>
31
  <a target="_blank" href="http://www.feedsapi.com/?utm=rsspostimporter_banner">
32
+ <img class='rss_pi_banner_img' src="<?php echo $banner_url; ?>" />
33
+ </a>
34
+ <!--Start of Zopim Live Chat Script-->
35
+ <script type="text/javascript">
36
+ window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=
37
+ d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set.
38
+ _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8');
39
+ $.src='//v2.zopim.com/?1JkI9crULWPOzNzvAJ6SYbeghH5FjhVV';z.t=+new Date;$.
40
+ type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
41
+ </script>
42
+ <!--End of Zopim Live Chat Script-->
43
+
44
+ <!--Start of Feedback Box-->
45
+
46
+ <script src="http://www.jotform.com/min/?g=feedback2" type="text/javascript"></script>
47
+ <script type="text/javascript">
48
+ new JotformFeedback({
49
+ formId : "50873505454962",
50
+ buttonText : "Get Help!",
51
+ windowTitle : "Mark up the screenshot to describe a problem or suggestion",
52
+ base : "http://jotformpro.com/",
53
+ background : "#F59202",
54
+ fontColor : "#FFFFFF",
55
+ buttonSide : "bottom",
56
+ buttonAlign : "right",
57
+ type : false,
58
+ width : 280,
59
+ height : 420,
60
+ instant : true
61
+ });
62
+ </script>
63
+ <!--End of Feedback Box-->
64
+
65
+ <!--Perfect Audience Start-->
66
+ <script type="text/javascript">
67
+ (function() {
68
+ window._pa = window._pa || {};
69
+ // _pa.orderId = "myOrderId"; // OPTIONAL: attach unique conversion identifier to conversions
70
+ // _pa.revenue = "19.99"; // OPTIONAL: attach dynamic purchase values to conversions
71
+ // _pa.productId = "myProductId"; // OPTIONAL: Include product ID for use with dynamic ads
72
+ var pa = document.createElement('script'); pa.type = 'text/javascript'; pa.async = true;
73
+ pa.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + "//tag.perfectaudience.com/serve/52c8aa7b965728ddac000007.js";
74
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pa, s);
75
+ })();
76
+ </script>
77
+ <!--Perfect Audience End-->
app/templates/feed-table-row.php CHANGED
@@ -1,358 +1,197 @@
1
  <?php
2
-
3
  $show = '';
4
 
5
-
6
-
7
  if (!isset($f)) {
8
-
9
- $f = array(
10
-
11
- 'id' => uniqid(),
12
-
13
- 'name' => 'New feed',
14
-
15
- 'url' => '',
16
-
17
- 'max_posts' => 5,
18
-
19
- 'author_id' => 1,
20
-
21
- 'category_id' => 1,
22
-
23
- 'tags_id' => array(),
24
-
25
- 'strip_html' => 'false'
26
-
27
- );
28
-
29
-
30
-
31
- $show = 'show';
32
-
33
  }
34
 
35
-
36
-
37
- if(is_array($f['tags_id'])){
38
-
39
- if(!empty($f['tags_id'])){
40
-
41
- foreach ( $f['tags_id'] as $tag ) {
42
-
43
  $tagname = get_tag($tag);
44
-
45
  $tagarray[] = $tagname->name;
46
-
47
  }
48
-
49
  $tag = join(',', $tagarray);
50
-
51
- }
52
-
53
- else{
54
-
55
  $tag = array();
56
-
57
  }
58
-
59
-
60
-
61
- }else{
62
-
63
- if(empty($f['tags_id'])){
64
-
65
  $f['tags_id'] = array();
66
-
67
  $tag = '';
68
-
69
- }
70
-
71
- else{
72
-
73
  $f['tags_id'] = array($f['tags_id']);
74
-
75
  $tagname = get_tag(intval($f['tags_id']));
76
-
77
  $tag = $tagname->name;
78
-
79
  }
80
-
81
-
82
-
83
  }
84
 
85
-
86
-
87
- /*echo "<pre>";
88
-
89
- print_r($f);
90
-
91
- exit;*/
92
-
93
- if(is_array($f['category_id'])){
94
-
95
- foreach ( $f['category_id'] as $cat ) {
96
-
97
  $catarray[] = get_cat_name($cat);
98
-
99
  }
100
-
101
  $category = join(',', $catarray);
102
-
103
- }else{
104
-
105
- if(empty($f['category_id'])){
106
-
107
  $f['category_id'] = array(1);
108
-
109
  $category = get_the_category_by_ID(1);
110
-
111
- }
112
-
113
- else{
114
-
115
  $f['category_id'] = array($f['category_id']);
116
-
117
  $category = get_the_category_by_ID(intval($f['category_id']));
118
-
119
  }
120
-
121
-
122
-
123
  }
124
-
125
-
126
-
127
  ?>
128
 
129
-
130
-
131
  <tr id="display_<?php echo ($f['id']); ?>" class="data-row <?php echo $show; ?>">
132
-
133
- <td>
134
-
135
- <strong><a href="#" class="toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php echo $f['name']; ?></a></strong>
136
-
137
- <div class="row-options">
138
-
139
- <a href="#" class="toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php _e('Edit', 'rss_pi'); ?></a> |
140
-
141
- <a href="#" class="delete-row" data-target="<?php echo ($f['id']); ?>"><?php _e('Delete', 'rss_pi'); ?></a>
142
-
143
- </div>
144
-
145
- </td>
146
-
147
- <td><?php echo $f['url']; ?></td>
148
-
149
- <td><?php echo $f['max_posts']; ?></td>
150
-
151
- <!-- <td width="20%"><?php //echo $category; ?></td>-->
152
-
153
  </tr>
154
-
155
  <tr id="edit_<?php echo ($f['id']); ?>" class="edit-row <?php echo $show; ?>">
156
-
157
- <td colspan="4">
158
-
159
- <table class="widefat edit-table">
160
-
161
- <tr>
162
-
163
- <td><label for="<?php echo ($f['id']); ?>-name"><?php _e("Feed name", 'rss_pi'); ?></label></td>
164
-
165
- <td>
166
-
167
- <input type="text" name="<?php echo ($f['id']); ?>-name" id="<?php echo ($f['id']); ?>-name" value="<?php echo ($f['name']); ?>" />
168
-
169
- </td>
170
-
171
- </tr>
172
-
173
- <tr>
174
-
175
- <td>
176
-
177
- <label for="<?php echo ($f['id']); ?>"><?php _e("Feed url", 'rss_pi'); ?></label>
178
-
179
- <p class="description">ie "http://news.google.com/?output=rss"</p>
180
-
181
- </td>
182
-
183
- <td><input type="text" name="<?php echo ($f['id']); ?>-url" id="<?php echo ($f['id']); ?>-url" value="<?php echo ($f['url']); ?>" /></td>
184
-
185
- </tr>
186
-
187
- <tr>
188
-
189
- <td><label for=""><?php _e("Max posts / import", 'rss_pi'); ?></label></td>
190
-
191
- <td><input type="number" name="<?php echo ($f['id']); ?>-max_posts" id="<?php echo ($f['id']); ?>-max_posts" value="<?php echo ($f['max_posts']); ?>" min="1" max="100" /></td>
192
-
193
- </tr>
194
-
195
- <tr>
196
-
197
- <td><label for=""><?php _e("Feed Author", 'rss_pi'); ?></label></td>
198
-
199
- <td>
200
-
201
- <?php
202
-
203
- if(!$this->is_key_valid){
204
-
205
- $this->key_error($this->key_prompt, true);
206
-
207
- }
208
-
209
- $args = array(
210
-
211
- 'id' => $f['id'] . '-author_id',
212
-
213
- 'name' => $f['id'] . '-author_id',
214
-
215
- 'selected' => $f['author_id'],
216
-
217
- 'class' => 'rss-pi-specific-feed-author'
218
-
219
- );
220
-
221
- wp_dropdown_users($args);
222
-
223
- ?>
224
-
225
- </td>
226
-
227
- </tr>
228
-
229
- <tr>
230
-
231
- <td><label for=""><?php _e("Category", 'rss_pi'); ?></label></td>
232
-
233
- <td>
234
-
235
- <?php
236
-
237
- $rss_post_pi_admin = new rssPIAdmin();
238
-
239
- $disabled = '';
240
-
241
- if (!$this->is_key_valid) {
242
-
243
- $this->key_error($this->key_prompt_multiple_category, true);
244
-
245
- wp_dropdown_categories(array('hide_empty' => 0, 'hierarchical' => true, 'id' => $f['id'] . '-category_id', 'name' => $f['id'] . '-category_id', 'selected' => $f['category_id'][0]));
246
-
247
- }
248
-
249
- else{
250
-
251
- ?>
252
-
253
- <div class="category_container">
254
-
255
- <?php
256
-
257
-
258
-
259
- $allcats = $rss_post_pi_admin->wp_category_checklist_rss_pi(0, false,$f['category_id']);
260
-
261
- $allcats = str_replace( 'name="post_category[]"', 'name="'.$f['id'].'-category_id[]"', $allcats );
262
-
263
- echo $allcats;
264
-
265
- ?></div>
266
-
267
- <?php
268
-
269
- }
270
-
271
- ?>
272
-
273
- </td>
274
-
275
- </tr>
276
-
277
- <tr>
278
-
279
- <td><label for=""><?php _e("Tags", 'rss_pi'); ?></label></td>
280
-
281
- <td>
282
-
283
- <?php
284
-
285
- $disabled = '';
286
-
287
- if (!$this->is_key_valid) {
288
-
289
- $this->key_error($this->key_prompt_multiple_tags, true);
290
-
291
- echo $rss_post_pi_admin->rss_pi_tags_dropdown($f['id'],$f['tags_id']);
292
-
293
- }
294
-
295
- else{
296
-
297
- ?>
298
-
299
- <div class="tags_container">
300
-
301
- <?php
302
-
303
- echo $rss_post_pi_admin->rss_pi_tags_checkboxes($f['id'],$f['tags_id']);
304
-
305
- ?></div>
306
-
307
- <?php
308
-
309
- }
310
-
311
- ?>
312
-
313
- </td>
314
-
315
- </tr>
316
-
317
- <tr>
318
-
319
- <td><label for=""><?php _e("Strip html tags", 'rss_pi'); ?></label></td>
320
-
321
- <td>
322
-
323
- <ul class="radiolist">
324
-
325
- <li>
326
-
327
- <label><input type="radio" id="<?php echo($f['id']); ?>-strip_html" name="<?php echo($f['id']); ?>-strip_html" value="true" <?php echo($f['strip_html'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
328
-
329
- </li>
330
-
331
- <li>
332
-
333
- <label><input type="radio" id="<?php echo($f['id']); ?>-strip_html" name="<?php echo($f['id']); ?>-strip_html" value="false" <?php echo($f['strip_html'] == 'false' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
334
-
335
- </li>
336
-
337
- </ul>
338
-
339
- </td>
340
-
341
- </tr>
342
-
343
- <tr>
344
-
345
- <td><input type="hidden" name="id" value="<?php echo($f['id']); ?>" /></td>
346
-
347
- <td><a id="close-edit-table" class="button button-large toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php _e('Close', 'rss_pi'); ?></a></td>
348
-
349
- </tr>
350
-
351
- </table>
352
-
353
-
354
-
355
- </td>
356
-
357
  </tr>
358
-
1
  <?php
 
2
  $show = '';
3
 
 
 
4
  if (!isset($f)) {
5
+ $f = array(
6
+ 'id' => uniqid(),
7
+ 'name' => 'New feed',
8
+ 'url' => '',
9
+ 'max_posts' => 5,
10
+ 'author_id' => 1,
11
+ 'category_id' => 1,
12
+ 'tags_id' => array(),
13
+ 'strip_html' => 'false'
14
+ );
15
+
16
+ $show = 'show';
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
+ if (is_array($f['tags_id'])) {
20
+ if (!empty($f['tags_id'])) {
21
+ foreach ($f['tags_id'] as $tag) {
 
 
 
 
 
22
  $tagname = get_tag($tag);
 
23
  $tagarray[] = $tagname->name;
 
24
  }
 
25
  $tag = join(',', $tagarray);
26
+ } else {
 
 
 
 
27
  $tag = array();
 
28
  }
29
+ } else {
30
+ if (empty($f['tags_id'])) {
 
 
 
 
 
31
  $f['tags_id'] = array();
 
32
  $tag = '';
33
+ } else {
 
 
 
 
34
  $f['tags_id'] = array($f['tags_id']);
 
35
  $tagname = get_tag(intval($f['tags_id']));
 
36
  $tag = $tagname->name;
 
37
  }
 
 
 
38
  }
39
 
40
+ /* echo "<pre>";
41
+ print_r($f);
42
+ exit; */
43
+ if (is_array($f['category_id'])) {
44
+ foreach ($f['category_id'] as $cat) {
 
 
 
 
 
 
 
45
  $catarray[] = get_cat_name($cat);
 
46
  }
 
47
  $category = join(',', $catarray);
48
+ } else {
49
+ if (empty($f['category_id'])) {
 
 
 
50
  $f['category_id'] = array(1);
 
51
  $category = get_the_category_by_ID(1);
52
+ } else {
 
 
 
 
53
  $f['category_id'] = array($f['category_id']);
 
54
  $category = get_the_category_by_ID(intval($f['category_id']));
 
55
  }
 
 
 
56
  }
 
 
 
57
  ?>
58
 
 
 
59
  <tr id="display_<?php echo ($f['id']); ?>" class="data-row <?php echo $show; ?>">
60
+ <td>
61
+ <strong><a href="#" class="toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php echo $f['name']; ?></a></strong>
62
+ <div class="row-options">
63
+ <a href="#" class="toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php _e('Edit', 'rss_pi'); ?></a> |
64
+ <a href="#" class="delete-row" data-target="<?php echo ($f['id']); ?>"><?php _e('Delete', 'rss_pi'); ?></a>
65
+ </div>
66
+ </td>
67
+ <td><?php echo $f['url']; ?></td>
68
+ <td><?php echo $f['max_posts']; ?></td>
69
+ <!-- <td width="20%"><?php //echo $category; ?></td>-->
 
 
 
 
 
 
 
 
 
 
 
70
  </tr>
 
71
  <tr id="edit_<?php echo ($f['id']); ?>" class="edit-row <?php echo $show; ?>">
72
+ <td colspan="4">
73
+ <table class="widefat edit-table">
74
+ <tr>
75
+ <td><label for="<?php echo ($f['id']); ?>-name"><?php _e("Feed name", 'rss_pi'); ?></label></td>
76
+ <td>
77
+ <input type="text" name="<?php echo ($f['id']); ?>-name" id="<?php echo ($f['id']); ?>-name" value="<?php echo ($f['name']); ?>" />
78
+ </td>
79
+ </tr>
80
+ <tr>
81
+ <td>
82
+ <label for="<?php echo ($f['id']); ?>-url"><?php _e("Feed url", 'rss_pi'); ?></label>
83
+ <p class="description">e.g. "http://news.google.com/?output=rss"</p>
84
+ </td>
85
+ <td><input type="text" name="<?php echo ($f['id']); ?>-url" id="<?php echo ($f['id']); ?>-url" value="<?php echo ($f['url']); ?>" /></td>
86
+ </tr>
87
+ <tr>
88
+ <td><label for=""><?php _e("Max posts / import", 'rss_pi'); ?></label></td>
89
+ <td><input type="number" name="<?php echo ($f['id']); ?>-max_posts" id="<?php echo ($f['id']); ?>-max_posts" value="<?php echo ($f['max_posts']); ?>" min="1" max="100" /></td>
90
+ </tr>
91
+ <tr>
92
+ <td><label for=""><?php _e("Feed Author", 'rss_pi'); ?></label></td>
93
+ <td>
94
+ <?php
95
+ if (!$this->is_key_valid) {
96
+ // $this->key_error($this->key_prompt, true);
97
+ $this->key_error( sprintf( $this->key_prompt, '', 'http://www.feedsapi.com/?utm_source=rsspostimporter&utm_medium=upgrade&utm_term=feed-author&utm_content=rsspi-full-rss-key-here&utm_campaign=wordpress' ), true );
98
+ }
99
+ $args = array(
100
+ 'id' => $f['id'] . '-author_id',
101
+ 'name' => $f['id'] . '-author_id',
102
+ 'selected' => $f['author_id'],
103
+ 'class' => 'rss-pi-specific-feed-author'
104
+ );
105
+ wp_dropdown_users($args);
106
+ ?>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <td><label for=""><?php _e("Category", 'rss_pi'); ?></label></td>
111
+ <td>
112
+ <?php
113
+ $rss_post_pi_admin = new rssPIAdmin();
114
+ $disabled = '';
115
+ if (!$this->is_key_valid) {
116
+ // $this->key_error($this->key_prompt_multiple_category, true);
117
+ $this->key_error( sprintf( $this->key_prompt, 'Multiple Category selection available. ', 'http://www.feedsapi.com/?utm_source=rsspostimporter&utm_medium=upgrade&utm_term=multi-category&utm_content=rsspi-full-rss-key-here&utm_campaign=wordpress' ), true );
118
+ wp_dropdown_categories(array('hide_empty' => 0, 'hierarchical' => true, 'id' => $f['id'] . '-category_id', 'name' => $f['id'] . '-category_id', 'selected' => $f['category_id'][0]));
119
+ } else {
120
+ ?>
121
+ <div class="category_container">
122
+ <ul>
123
+ <?php
124
+ $allcats = $rss_post_pi_admin->wp_category_checklist_rss_pi(0, false, $f['category_id']);
125
+ $allcats = str_replace('name="post_category[]"', 'name="' . $f['id'] . '-category_id[]"', $allcats);
126
+ echo $allcats;
127
+ ?>
128
+ </ul>
129
+ </div>
130
+ <?php
131
+ }
132
+ ?>
133
+ </td>
134
+ </tr>
135
+ <tr>
136
+ <td><label for=""><?php _e("Tags", 'rss_pi'); ?></label></td>
137
+ <td>
138
+ <?php
139
+ $disabled = '';
140
+ if (!$this->is_key_valid) {
141
+ // $this->key_error($this->key_prompt_multiple_tags, true);
142
+ $this->key_error( sprintf( $this->key_prompt, 'Multiple Tags selection available. ', 'http://www.feedsapi.com/?utm_source=rsspostimporter&utm_medium=upgrade&utm_term=multi-tags-free&utm_content=rsspi-full-rss-key-here&utm_campaign=wordpress' ), true );
143
+ echo $rss_post_pi_admin->rss_pi_tags_dropdown($f['id'], $f['tags_id']);
144
+ } else {
145
+ ?>
146
+ <div class="tags_container">
147
+ <?php
148
+ echo $rss_post_pi_admin->rss_pi_tags_checkboxes($f['id'], $f['tags_id']);
149
+ ?></div>
150
+ <?php
151
+ }
152
+ ?>
153
+ </td>
154
+ </tr>
155
+ <tr>
156
+ <td>
157
+ <label for="<?php echo ($f['id']); ?>-keywords"><?php _e('Keywords Filter', 'rss_pi'); ?></label>
158
+ <p class="description"><?php _e('Enter keywords and/or regex, separated by commas', "rss_pi"); ?></p>
159
+ <p class="description">
160
+ <?php _e('Only posts matching these keywords/regex will be imported', "rss_pi"); ?>
161
+ </p>
162
+ </td>
163
+ <td>
164
+ <?php
165
+ $disabled = '';
166
+ if (!$this->is_key_valid) {
167
+ $disabled = ' disabled="disabled"';
168
+ // $this->key_error($this->key_prompt, true);
169
+ $this->key_error( sprintf( $this->key_prompt, '', 'http://www.feedsapi.com/?utm_source=rsspostimporter&utm_medium=upgrade&utm_term=keywords-filters&utm_content=rsspi-full-rss-key-here&utm_campaign=wordpress' ), true );
170
+ }
171
+ ?>
172
+ <textarea name="<?php echo ($f['id']); ?>-keywords" id="<?php echo ($f['id']); ?>-keywords" cols="30" rows="<?php echo $disabled ? '3' : '10'; ?>"<?php echo $disabled; ?>><?php
173
+ echo isset($f['keywords']) && !empty($f['keywords']) && is_array($f['keywords']) ? implode(', ', $f['keywords']) : '';
174
+ ?></textarea>
175
+ </td>
176
+ </tr>
177
+ <tr>
178
+ <td><label for=""><?php _e("Strip html tags", 'rss_pi'); ?></label></td>
179
+ <td>
180
+ <ul class="radiolist">
181
+ <li>
182
+ <label><input type="radio" id="<?php echo($f['id']); ?>-strip_html" name="<?php echo($f['id']); ?>-strip_html" value="true" <?php echo($f['strip_html'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
183
+ </li>
184
+ <li>
185
+ <label><input type="radio" id="<?php echo($f['id']); ?>-strip_html" name="<?php echo($f['id']); ?>-strip_html" value="false" <?php echo($f['strip_html'] == 'false' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
186
+ </li>
187
+ </ul>
188
+ </td>
189
+ </tr>
190
+ <tr>
191
+ <td><input type="hidden" name="id" value="<?php echo($f['id']); ?>" /></td>
192
+ <td><a id="close-edit-table" class="button button-large toggle-edit" data-target="<?php echo ($f['id']); ?>"><?php _e('Close', 'rss_pi'); ?></a></td>
193
+ </tr>
194
+ </table>
195
+
196
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  </tr>
 
app/templates/feed-table.php CHANGED
@@ -1,42 +1,42 @@
1
- <table class="widefat rss_pi-table" id="rss_pi-table">
2
- <thead>
3
- <tr>
4
- <th><?php _e("Feed name", 'rss_pi'); ?></th>
5
- <th><?php _e("Feed url", 'rss_pi'); ?></th>
6
- <th><?php _e("Max posts / import", 'rss_pi'); ?></th>
7
- <!--<th><?php _e("Category", 'rss_pi'); ?></th>-->
8
- </tr>
9
- </thead>
10
- <tbody class="rss-rows">
11
- <?php
12
- $saved_ids = array();
13
-
14
- if (is_array($this->options['feeds']) && count($this->options['feeds']) > 0) :
15
- foreach ($this->options['feeds'] as $f) :
16
- $category = get_the_category($f['category_id']);
17
- array_push($saved_ids, $f['id']);
18
-
19
- include( RSS_PI_PATH . 'app/templates/feed-table-row.php');
20
- endforeach;
21
- else :
22
- ?>
23
- <tr>
24
- <td colspan="4" class="empty_table">
25
- <?php _e('You haven\'t specified any feeds to import yet, why don\'t you <a href="#" class="add-row">add one now</a>?', "rss_pi"); ?>
26
- </td>
27
- </tr>
28
- <?php
29
- endif
30
- ?>
31
- </tbody>
32
- <tfoot>
33
- <tr>
34
- <td colspan="4">
35
- <a href="#" class="button button-large button-primary add-row">
36
- <?php _e('Add new feed', "rss_pi"); ?>
37
- </a>
38
- <input type="hidden" name="ids" id="ids" value="<?php echo(join($saved_ids, ',')); ?>" />
39
- </td>
40
- </tr>
41
- </tfoot>
42
  </table>
1
+ <table class="widefat rss_pi-table" id="rss_pi-table">
2
+ <thead>
3
+ <tr>
4
+ <th><?php _e("Feed name", 'rss_pi'); ?></th>
5
+ <th><?php _e("Feed url", 'rss_pi'); ?></th>
6
+ <th><?php _e("Max posts / import", 'rss_pi'); ?></th>
7
+ <!--<th><?php _e("Category", 'rss_pi'); ?></th>-->
8
+ </tr>
9
+ </thead>
10
+ <tbody class="rss-rows">
11
+ <?php
12
+ $saved_ids = array();
13
+
14
+ if (is_array($this->options['feeds']) && count($this->options['feeds']) > 0) :
15
+ foreach ($this->options['feeds'] as $f) :
16
+ $category = get_the_category($f['category_id']);
17
+ array_push($saved_ids, $f['id']);
18
+
19
+ include( RSS_PI_PATH . 'app/templates/feed-table-row.php');
20
+ endforeach;
21
+ else :
22
+ ?>
23
+ <tr>
24
+ <td colspan="4" class="empty_table">
25
+ <?php _e('You haven\'t specified any feeds to import yet, why don\'t you <a href="#" class="add-row">add one now</a>?', "rss_pi"); ?>
26
+ </td>
27
+ </tr>
28
+ <?php
29
+ endif
30
+ ?>
31
+ </tbody>
32
+ <tfoot>
33
+ <tr>
34
+ <td colspan="4">
35
+ <a href="#" class="button button-large button-primary add-row">
36
+ <?php _e('Add new feed', "rss_pi"); ?>
37
+ </a>
38
+ <input type="hidden" name="ids" id="ids" value="<?php echo(join($saved_ids, ',')); ?>" />
39
+ </td>
40
+ </tr>
41
+ </tfoot>
42
  </table>
app/templates/log.php CHANGED
@@ -15,7 +15,7 @@
15
  <a href="#" class="button button-large button-primary show-main-ui"><?php _e("Ok, all done", "rss_pi"); ?></a>
16
  <a href="#" class="button button-large button-warning clear-log"><?php _e("Clear log", "rss_pi"); ?></a>
17
  <div class="log">
18
- <code><?php echo(wpautop( $log, true )); ?></code>
19
  </div>
20
  </div>
21
  </div>
15
  <a href="#" class="button button-large button-primary show-main-ui"><?php _e("Ok, all done", "rss_pi"); ?></a>
16
  <a href="#" class="button button-large button-warning clear-log"><?php _e("Clear log", "rss_pi"); ?></a>
17
  <div class="log">
18
+ <code><?php echo(wpautop($log, true)); ?></code>
19
  </div>
20
  </div>
21
  </div>
app/templates/settings-table.php CHANGED
@@ -1,222 +1,237 @@
1
  <table class="widefat rss_pi-table" id="rss_pi-table">
2
- <thead>
3
- <tr>
4
- <th colspan="5"><?php _e('Settings', 'rss_pi'); ?></th>
5
- </tr>
6
- </thead>
7
- <tbody class="setting-rows">
8
- <tr class="edit-row show">
9
- <td colspan="4">
10
- <table class="widefat edit-table">
11
- <tr>
12
- <td>
13
- <label for="frequency"><?php _e('Frequency', "rss_pi"); ?></label>
14
- <p class="description"><?php _e('How often will the import run.', "rss_pi"); ?></p>
15
- </td>
16
- <td>
17
- <select name="frequency" id="frequency">
18
- <?php $x = wp_get_schedules(); ?>
19
- <?php foreach (array_keys($x) as $interval) : ?>
20
- <option value="<?php echo $interval; ?>" <?php
21
- if ($this->options['settings']['frequency'] == $interval) : echo('selected="selected"');
22
- endif;
23
- ?>><?php echo $x[$interval]['display']; ?></option>
24
- <?php endforeach; ?>
25
- </select>
26
- </td>
27
- </tr>
28
- <tr>
29
- <td>
30
- <label for="feeds_api_key"><?php _e('Full Text RSS Feed API Key', "rss_pi"); ?></label>
31
- <p class="description">
32
- <?php _e('Boost Your traffic with Full RSS Content - ', "rss_pi"); ?>
33
- Request a Free 14 Days <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank"> Full RSS Key Here !</a>
34
- </p>
35
- </td>
36
- <td>
37
- <?php $feeds_api_key = isset($this->options['settings']["feeds_api_key"]) ? $this->options['settings']["feeds_api_key"] : ""; ?>
38
- <input type="text" name="feeds_api_key" id="feeds_api_key" value="<?php echo $feeds_api_key; ?>" />
39
- </td>
40
- </tr>
41
 
42
- <tr>
43
- <td>
44
- <label for="post_template"><?php _e('Template', 'rss_pi'); ?></label>
45
- <p class="description"><?php _e('This is how the post will be formatted.', "rss_pi"); ?></p>
46
- <p class="description">
47
- <?php _e('Available tags:', "rss_pi"); ?>
48
- <dl>
49
- <dt><code>&lcub;$content&rcub;</code></dt>
50
- <dt><code>&lcub;$permalink&rcub;</code></dt>
51
- <dt><code>&lcub;$title&rcub;</code></dt>
52
- <dt><code>&lcub;$feed_title&rcub;</code></dt>
53
- <dt><code>&lcub;$excerpt:n&rcub;</code></dt>
54
- </dl>
55
- </p>
56
- </td>
57
- <td>
58
- <textarea name="post_template" id="post_template" cols="30" rows="10"><?php
59
- $value = (
60
- $this->options['settings']['post_template'] != '' ? $this->options['settings']['post_template'] : '{$content}' . "\nSource: " . '{$feed_title}'
61
- );
62
 
63
- $value = str_replace(array('\r', '\n'), array(chr(13), chr(10)), $value);
64
 
65
- echo stripslashes($value);
66
- ?></textarea>
67
- </td>
68
- </tr>
69
- <tr>
70
- <td>
71
- <label for="post_template"><?php _e('Keywords Filter', 'rss_pi'); ?></label>
72
- <p class="description"><?php _e('Enter keywords and/or regex, separated by commas', "rss_pi"); ?></p>
73
- <p class="description">
74
- <?php _e('Only posts matching these keywords/regex will be imported', "rss_pi"); ?>
75
- </p>
76
- </td>
77
- <td>
78
- <?php
79
- $disabled = '';
80
- if (!$this->is_key_valid) {
81
- $disabled= ' disabled="disabled"';
82
- $this->key_error($this->key_prompt, true);
83
- }
84
- ?>
85
- <textarea name="keyword_filter" id="post_template" cols="30" rows="10"<?php echo $disabled; ?>><?php
86
- echo implode(', ', $this->options['settings']['keywords']);
87
- ?></textarea>
88
- </td>
89
- </tr>
90
- <tr>
91
- <td><label for="post_status"><?php _e('Post status', "rss_pi"); ?></label></td>
92
- <td>
 
93
 
94
- <select name="post_status" id="post_status">
95
- <?php
96
- $statuses = get_post_stati('', 'objects');
97
 
98
- foreach ($statuses as $status) {
99
- ?>
100
- <option value="<?php echo($status->name); ?>" <?php
101
- if ($this->options['settings']['post_status'] == $status->name) : echo('selected="selected"');
102
- endif;
103
- ?>><?php echo($status->label); ?></option>
104
- <?php
105
- }
106
- ?>
107
- </select>
108
- </td>
109
- </tr>
110
- <tr>
111
- <td><?php _e('Author', 'rss_pi'); ?></td>
112
- <td>
113
- <?php
114
- $args = array(
115
- 'id' => 'author_id',
116
- 'name' => 'author_id',
117
- 'selected' => $this->options['settings']['author_id']
118
- );
119
- wp_dropdown_users($args);
120
- ?>
121
- </td>
122
- </tr>
123
- <tr>
124
- <td><?php _e('Allow comments', "rss_pi"); ?></td>
125
- <td>
126
- <ul class="radiolist">
127
- <li>
128
- <label><input type="radio" id="allow_comments" name="allow_comments" value="open" <?php echo($this->options['settings']['allow_comments'] == 'open' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
129
- </li>
130
- <li>
131
- <label><input type="radio" id="allow_comments" name="allow_comments" value="false" <?php echo($this->options['settings']['allow_comments'] == 'false' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
132
- </li>
133
- </ul>
134
- </td>
135
- </tr>
136
- <tr>
137
- <td>
138
- <?php _e('Block search indexing?', "rss_pi"); ?>
139
- <p class="description"><?php _e('Prevent your content from appearing in search results.', "rss_pi"); ?></p>
140
- </td>
141
- <td>
142
- <ul class="radiolist">
143
- <li>
144
- <label><input type="radio" id="block_indexing" name="block_indexing" value="true" <?php echo($this->options['settings']['block_indexing'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
145
- </li>
146
- <li>
147
- <label><input type="radio" id="block_indexing" name="block_indexing" value="false" <?php echo($this->options['settings']['block_indexing'] == 'false' || $this->options['settings']['block_indexing'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
148
- </li>
149
- </ul>
150
- </td>
151
- </tr>
152
- <tr>
153
- <td>
154
- <?php _e('Nofollow option for all outbound links?', "rss_pi"); ?>
155
- <p class="description"><?php _e('Add rel="nofollow" to all outbounded links.', "rss_pi"); ?></p>
156
- </td>
157
- <td>
158
- <ul class="radiolist">
159
- <li>
160
- <label><input type="radio" id="nofollow_outbound" name="nofollow_outbound" value="true" <?php echo($this->options['settings']['nofollow_outbound'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
161
- </li>
162
- <li>
163
- <label><input type="radio" id="nofollow_outbound" name="nofollow_outbound" value="false" <?php echo($this->options['settings']['nofollow_outbound'] == 'false' || $this->options['settings']['nofollow_outbound'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
164
- </li>
165
- </ul>
166
- </td>
167
- </tr>
168
- <tr>
169
- <td>
170
- <?php _e('Enable logging?', "rss_pi"); ?>
171
- <p class="description"><?php _e('The logfile can be found <a href="#" class="load-log">here</a>.', "rss_pi"); ?></p>
172
- </td>
173
- <td>
174
- <ul class="radiolist">
175
- <li>
176
- <label><input type="radio" id="enable_logging" name="enable_logging" value="true" <?php echo($this->options['settings']['enable_logging'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
177
- </li>
178
- <li>
179
- <label><input type="radio" id="enable_logging" name="enable_logging" value="false" <?php echo($this->options['settings']['enable_logging'] == 'false' || $this->options['settings']['enable_logging'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
180
- </li>
181
- </ul>
182
- </td>
183
-
184
- </tr>
185
- <tr>
186
- <td>
187
- <?php _e('Download and save images locally?', "rss_pi"); ?>
188
- <p class="description"><?php _e('Images in the feeds will be downloaded and saved in the WordPress media.', "rss_pi"); ?></p>
189
- </td>
190
- <td>
191
- <ul class="radiolist">
192
- <li>
193
- <label><input type="radio" id="import_images_locally" name="import_images_locally" value="true" <?php echo($this->options['settings']['import_images_locally'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
194
- </li>
195
- <li>
196
- <label><input type="radio" id="import_images_locally" name="import_images_locally" value="false" <?php echo($this->options['settings']['import_images_locally'] == 'false' || $this->options['settings']['enable_logging'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
197
- </li>
198
- </ul>
199
- </td>
200
-
201
- </tr>
202
- <?php
203
- if ($this->is_key_valid) {
204
  ?>
205
-
206
- <tr>
207
- <td>
208
- <?php _e('Export and backup your Feeds and setting as CSV File', "rss_pi"); ?>
209
- <p class="description"><?php _e('This option will help you download a csv file with all your feeds setting , you can upload it back later.', "rss_pi"); ?></p>
210
- </td>
211
- <td>
212
- <input type="submit" value="Export your Feeds and Setting as CSV File" name="csv_download" class="button button-primary button-large right">
213
- </td>
214
-
215
- </tr>
216
- <tr>
217
- <td>
218
- <?php _e('Import your CSV file with your feeds settings', "rss_pi"); ?>
219
- <p class="description"><?php _e('Create and Import a CSV file with your Feeds Setting with the following Structure and heading:<br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
 
221
  url , name, max_posts, author_id <br/>
222
 
@@ -224,17 +239,17 @@ url = your feed url <br/>
224
  name = the name you gives to your feed <br/>
225
  max_posts = the number of posts to simultaneously import <br/>
226
  author_id = your author ID , this is a number.', "rss_pi"); ?></p>
227
- </td>
228
- <td>
229
- <input type="file" name="import_csv" />
230
- </td>
231
-
232
- </tr>
233
- <?php
234
- }
235
- ?>
236
- </table>
237
- </td>
238
- </tr>
239
- </tbody>
240
  </table>
1
  <table class="widefat rss_pi-table" id="rss_pi-table">
2
+ <thead>
3
+ <tr>
4
+ <th colspan="5"><?php _e('Settings', 'rss_pi'); ?></th>
5
+ </tr>
6
+ </thead>
7
+ <tbody class="setting-rows">
8
+ <tr class="edit-row show">
9
+ <td colspan="4">
10
+ <table class="widefat edit-table">
11
+ <tr>
12
+ <td>
13
+ <label for="frequency"><?php _e('Frequency', "rss_pi"); ?></label>
14
+ <p class="description"><?php _e('How often will the import run.', "rss_pi"); ?></p>
15
+ </td>
16
+ <td>
17
+ <select name="frequency" id="frequency">
18
+ <?php $x = wp_get_schedules(); ?>
19
+ <?php foreach (array_keys($x) as $interval) : ?>
20
+ <option value="<?php echo $interval; ?>" <?php
21
+ if ($this->options['settings']['frequency'] == $interval) : echo('selected="selected"');
22
+ endif;
23
+ ?>><?php echo $x[$interval]['display']; ?></option>
24
+ <?php endforeach; ?>
25
+ </select>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td>
30
+ <label for="feeds_api_key"><?php _e('Full Text RSS Feed API Key', "rss_pi"); ?></label>
31
+ <p class="description">
32
+ <?php _e('Boost Your traffic with Full RSS Content - ', "rss_pi"); ?>
33
+ Request a Free 14 Days <a href="http://www.feedsapi.com/?utm_source=rsspi-full-rss-key-here" target="_blank"> Full RSS Key Here !</a>
34
+ </p>
35
+ </td>
36
+ <td>
37
+ <?php $feeds_api_key = isset($this->options['settings']["feeds_api_key"]) ? $this->options['settings']["feeds_api_key"] : ""; ?>
38
+ <input type="text" name="feeds_api_key" id="feeds_api_key" value="<?php echo $feeds_api_key; ?>" />
39
+ </td>
40
+ </tr>
41
 
42
+ <tr>
43
+ <td>
44
+ <label for="post_template"><?php _e('Template', 'rss_pi'); ?></label>
45
+ <p class="description"><?php _e('This is how the post will be formatted.', "rss_pi"); ?></p>
46
+ <p class="description">
47
+ <?php _e('Available tags:', "rss_pi"); ?>
48
+ <dl>
49
+ <dt><code>&lcub;$content&rcub;</code></dt>
50
+ <dt><code>&lcub;$permalink&rcub;</code></dt>
51
+ <dt><code>&lcub;$title&rcub;</code></dt>
52
+ <dt><code>&lcub;$feed_title&rcub;</code></dt>
53
+ <dt><code>&lcub;$excerpt:n&rcub;</code></dt>
54
+ </dl>
55
+ </p>
56
+ </td>
57
+ <td>
58
+ <textarea name="post_template" id="post_template" cols="30" rows="10"><?php
59
+ $value = (
60
+ $this->options['settings']['post_template'] != '' ? $this->options['settings']['post_template'] : '{$content}' . "\nSource: " . '{$feed_title}'
61
+ );
62
 
63
+ $value = str_replace(array('\r', '\n'), array(chr(13), chr(10)), $value);
64
 
65
+ echo stripslashes($value);
66
+ ?></textarea>
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td>
71
+ <label for="post_template"><?php _e('Keywords Filter', 'rss_pi'); ?></label>
72
+ <p class="description"><?php _e('Enter keywords and/or regex, separated by commas', "rss_pi"); ?></p>
73
+ <p class="description">
74
+ <?php _e('Only posts matching these keywords/regex will be imported', "rss_pi"); ?>
75
+ </p>
76
+ </td>
77
+ <td>
78
+ <?php
79
+ $disabled = '';
80
+ if (!$this->is_key_valid) {
81
+ $disabled = ' disabled="disabled"';
82
+ // $this->key_error($this->key_prompt, true);
83
+ $this->key_error( sprintf( $this->key_prompt, '', 'http://www.feedsapi.com/?utm_source=rsspostimporter&utm_medium=upgrade&utm_term=keywords-filters&utm_content=rsspi-full-rss-key-here&utm_campaign=wordpress' ), true );
84
+ }
85
+ ?>
86
+ <textarea name="keyword_filter" id="post_template" cols="30" rows="10"<?php echo $disabled; ?>><?php
87
+ echo implode(', ', $this->options['settings']['keywords']);
88
+ ?></textarea>
89
+ </td>
90
+ </tr>
91
+ <tr>
92
+ <td><label for="post_status"><?php _e('Post status', "rss_pi"); ?></label></td>
93
+ <td>
94
 
95
+ <select name="post_status" id="post_status">
96
+ <?php
97
+ $statuses = get_post_stati('', 'objects');
98
 
99
+ foreach ($statuses as $status) {
100
+ ?>
101
+ <option value="<?php echo($status->name); ?>" <?php
102
+ if ($this->options['settings']['post_status'] == $status->name) : echo('selected="selected"');
103
+ endif;
104
+ ?>><?php echo($status->label); ?></option>
105
+ <?php
106
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ?>
108
+ </select>
109
+ </td>
110
+ </tr>
111
+ <tr>
112
+ <td><?php _e('Author', 'rss_pi'); ?></td>
113
+ <td>
114
+ <?php
115
+ $args = array(
116
+ 'id' => 'author_id',
117
+ 'name' => 'author_id',
118
+ 'selected' => $this->options['settings']['author_id']
119
+ );
120
+ wp_dropdown_users($args);
121
+ ?>
122
+ </td>
123
+ </tr>
124
+ <tr>
125
+ <td><?php _e('Allow comments', "rss_pi"); ?></td>
126
+ <td>
127
+ <ul class="radiolist">
128
+ <li>
129
+ <label><input type="radio" id="allow_comments_open" name="allow_comments" value="open" <?php echo($this->options['settings']['allow_comments'] == 'open' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
130
+ </li>
131
+ <li>
132
+ <label><input type="radio" id="allow_comments_false" name="allow_comments" value="false" <?php echo($this->options['settings']['allow_comments'] == 'false' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
133
+ </li>
134
+ </ul>
135
+ </td>
136
+ </tr>
137
+ <tr>
138
+ <td>
139
+ <?php _e('Block search indexing?', "rss_pi"); ?>
140
+ <p class="description"><?php _e('Prevent your content from appearing in search results.', "rss_pi"); ?></p>
141
+ </td>
142
+ <td>
143
+ <ul class="radiolist">
144
+ <li>
145
+ <label><input type="radio" id="block_indexing_true" name="block_indexing" value="true" <?php echo($this->options['settings']['block_indexing'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
146
+ </li>
147
+ <li>
148
+ <label><input type="radio" id="block_indexing_false" name="block_indexing" value="false" <?php echo($this->options['settings']['block_indexing'] == 'false' || $this->options['settings']['block_indexing'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
149
+ </li>
150
+ </ul>
151
+ </td>
152
+ </tr>
153
+ <tr>
154
+ <td>
155
+ <?php _e('Nofollow option for all outbound links?', "rss_pi"); ?>
156
+ <p class="description"><?php _e('Add rel="nofollow" to all outbounded links.', "rss_pi"); ?></p>
157
+ </td>
158
+ <td>
159
+ <ul class="radiolist">
160
+ <li>
161
+ <label><input type="radio" id="nofollow_outbound_true" name="nofollow_outbound" value="true" <?php echo($this->options['settings']['nofollow_outbound'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
162
+ </li>
163
+ <li>
164
+ <label><input type="radio" id="nofollow_outbound_false" name="nofollow_outbound" value="false" <?php echo($this->options['settings']['nofollow_outbound'] == 'false' || $this->options['settings']['nofollow_outbound'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
165
+ </li>
166
+ </ul>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td>
171
+ <?php _e('Enable logging?', "rss_pi"); ?>
172
+ <p class="description"><?php _e('The logfile can be found <a href="#" class="load-log">here</a>.', "rss_pi"); ?></p>
173
+ </td>
174
+ <td>
175
+ <ul class="radiolist">
176
+ <li>
177
+ <label><input type="radio" id="enable_logging_true" name="enable_logging" value="true" <?php echo($this->options['settings']['enable_logging'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
178
+ </li>
179
+ <li>
180
+ <label><input type="radio" id="enable_logging_false" name="enable_logging" value="false" <?php echo($this->options['settings']['enable_logging'] == 'false' || $this->options['settings']['enable_logging'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
181
+ </li>
182
+ </ul>
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td>
187
+ <?php _e('Download and save images locally?', "rss_pi"); ?>
188
+ <p class="description"><?php _e('Images in the feeds will be downloaded and saved in the WordPress media.', "rss_pi"); ?></p>
189
+ </td>
190
+ <td>
191
+ <ul class="radiolist">
192
+ <li>
193
+ <label><input type="radio" id="import_images_locally_true" name="import_images_locally" value="true" <?php echo($this->options['settings']['import_images_locally'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
194
+ </li>
195
+ <li>
196
+ <label><input type="radio" id="import_images_locally_false" name="import_images_locally" value="false" <?php echo($this->options['settings']['import_images_locally'] == 'false' || $this->options['settings']['enable_logging'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
197
+ </li>
198
+ </ul>
199
+ </td>
200
+ </tr>
201
+ <tr>
202
+ <td>
203
+ <?php _e('Disable the featured image?', "rss_pi"); ?>
204
+ <p class="description"><?php _e('Don\'t set a featured image for the imported posts.', "rss_pi"); ?></p>
205
+ </td>
206
+ <td>
207
+ <ul class="radiolist">
208
+ <li>
209
+ <label><input type="radio" id="disable_thumbnail_true" name="disable_thumbnail" value="true" <?php echo($this->options['settings']['disable_thumbnail'] == 'true' ? 'checked="checked"' : ''); ?> /> <?php _e('Yes', 'rss_pi'); ?></label>
210
+ </li>
211
+ <li>
212
+ <label><input type="radio" id="disable_thumbnail_false" name="disable_thumbnail" value="false" <?php echo($this->options['settings']['disable_thumbnail'] == 'false' || $this->options['settings']['disable_thumbnail'] == '' ? 'checked="checked"' : ''); ?> /> <?php _e('No', 'rss_pi'); ?></label>
213
+ </li>
214
+ </ul>
215
+ </td>
216
+ </tr>
217
+ <?php
218
+ if ($this->is_key_valid) {
219
+ ?>
220
+
221
+ <tr>
222
+ <td>
223
+ <?php _e('Export and backup your Feeds and setting as CSV File', "rss_pi"); ?>
224
+ <p class="description"><?php _e('This option will help you download a csv file with all your feeds setting , you can upload it back later.', "rss_pi"); ?></p>
225
+ </td>
226
+ <td>
227
+ <input type="submit" value="Export your Feeds and Setting as CSV File" name="csv_download" class="button button-primary button-large right">
228
+ </td>
229
+
230
+ </tr>
231
+ <tr>
232
+ <td>
233
+ <?php _e('Import your CSV file with your feeds settings', "rss_pi"); ?>
234
+ <p class="description"><?php _e('Create and Import a CSV file with your Feeds Setting with the following Structure and heading:<br/>
235
 
236
  url , name, max_posts, author_id <br/>
237
 
239
  name = the name you gives to your feed <br/>
240
  max_posts = the number of posts to simultaneously import <br/>
241
  author_id = your author ID , this is a number.', "rss_pi"); ?></p>
242
+ </td>
243
+ <td>
244
+ <input type="file" name="import_csv" />
245
+ </td>
246
+
247
+ </tr>
248
+ <?php
249
+ }
250
+ ?>
251
+ </table>
252
+ </td>
253
+ </tr>
254
+ </tbody>
255
  </table>
app/templates/stats-placeholder.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table class="widefat rss_pi-table" id="rss_pi-table">
2
+ <thead>
3
+ <tr>
4
+ <th><?php _e('Stats', 'rss_pi'); ?></th>
5
+ </tr>
6
+ </thead>
7
+ <tbody class="setting-rows">
8
+ <tr class="edit-row show">
9
+ <td>
10
+ <div id="rss_pi-stats-placeholder">
11
+ <script type="text/javascript"
12
+ src="https://www.google.com/jsapi?autoload={
13
+ 'modules':[{
14
+ 'name':'visualization',
15
+ 'version':'1.1',
16
+ 'packages':['corechart' , 'bar']
17
+ }]
18
+ }"></script>
19
+ </div>
20
+ </td>
21
+ </tr>
22
+ </tbody>
23
+ </table>
app/templates/stats.php CHANGED
@@ -1,22 +1,3 @@
1
- <?php
2
-
3
- $stats = new Rss_pi_stats();
4
-
5
- ?>
6
- <table class="widefat rss_pi-table" id="rss_pi-table">
7
- <thead>
8
- <tr>
9
- <th colspan="5"><?php _e('Stats', 'rss_pi'); ?></th>
10
- </tr>
11
- </thead>
12
- <tbody class="setting-rows">
13
- <tr class="edit-row show">
14
- <td>
15
- <?php
16
- $stats->show_charts();
17
- ?>
18
- </td>
19
- <td></td>
20
- </tr>
21
- </tbody>
22
- </table>
1
+ <?php
2
+ $stats = new Rss_pi_stats();
3
+ $stats->show_charts();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
index.php CHANGED
@@ -5,7 +5,7 @@
5
  Plugin URI: https://wordpress.org/plugins/rss-post-importer/
6
  Description: This plugin lets you set up an import posts from one or several rss-feeds and save them as posts on your site, simple and flexible.
7
  Author: feedsapi
8
- Version: 2.0.17
9
  Author URI: https://www.feedsapi.org/
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,30 +13,29 @@
13
  Domain Path: /lang/
14
  */
15
 
16
-
17
  // define some constants
18
  if (!defined('RSS_PI_PATH')) {
19
- define('RSS_PI_PATH', trailingslashit(plugin_dir_path(__FILE__)));
20
  }
21
 
22
  if (!defined('RSS_PI_URL')) {
23
- define('RSS_PI_URL', trailingslashit(plugin_dir_url(__FILE__)));
24
  }
25
 
26
  if (!defined('RSS_PI_BASENAME')) {
27
- define('RSS_PI_BASENAME', plugin_basename(__FILE__));
28
  }
29
 
30
  if (!defined('RSS_PI_VERSION')) {
31
- define('RSS_PI_VERSION', '2.0.17');
32
  }
33
 
34
  if (!defined('RSS_PI_LOG_PATH')) {
35
- define('RSS_PI_LOG_PATH', trailingslashit(WP_CONTENT_DIR) . 'rsspi-log/');
36
  }
37
 
38
- if(!is_dir(RSS_PI_LOG_PATH)){
39
- mkdir(RSS_PI_LOG_PATH);
40
  }
41
 
42
  // helper classes
@@ -60,7 +59,6 @@ include_once RSS_PI_PATH . 'app/classes/import/class-rss-pi-cron.php';
60
  // the main loader class
61
  include_once RSS_PI_PATH . 'app/class-rss-post-importer.php';
62
 
63
-
64
  // initialise plugin as a global var
65
  global $rss_post_importer;
66
 
@@ -68,6 +66,3 @@ $rss_post_importer = new rssPostImporter();
68
 
69
  $rss_post_importer->init();
70
 
71
-
72
-
73
-
5
  Plugin URI: https://wordpress.org/plugins/rss-post-importer/
6
  Description: This plugin lets you set up an import posts from one or several rss-feeds and save them as posts on your site, simple and flexible.
7
  Author: feedsapi
8
+ Version: 2.1.0
9
  Author URI: https://www.feedsapi.org/
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
  Domain Path: /lang/
14
  */
15
 
 
16
  // define some constants
17
  if (!defined('RSS_PI_PATH')) {
18
+ define('RSS_PI_PATH', trailingslashit(plugin_dir_path(__FILE__)));
19
  }
20
 
21
  if (!defined('RSS_PI_URL')) {
22
+ define('RSS_PI_URL', trailingslashit(plugin_dir_url(__FILE__)));
23
  }
24
 
25
  if (!defined('RSS_PI_BASENAME')) {
26
+ define('RSS_PI_BASENAME', plugin_basename(__FILE__));
27
  }
28
 
29
  if (!defined('RSS_PI_VERSION')) {
30
+ define('RSS_PI_VERSION', '2.1.0');
31
  }
32
 
33
  if (!defined('RSS_PI_LOG_PATH')) {
34
+ define('RSS_PI_LOG_PATH', trailingslashit(WP_CONTENT_DIR) . 'rsspi-log/');
35
  }
36
 
37
+ if (!is_dir(RSS_PI_LOG_PATH)) {
38
+ mkdir(RSS_PI_LOG_PATH);
39
  }
40
 
41
  // helper classes
59
  // the main loader class
60
  include_once RSS_PI_PATH . 'app/class-rss-post-importer.php';
61
 
 
62
  // initialise plugin as a global var
63
  global $rss_post_importer;
64
 
66
 
67
  $rss_post_importer->init();
68
 
 
 
 
readme.txt CHANGED
@@ -1,337 +1,199 @@
1
  === RSS Post Importer ===
2
-
3
  Contributors: feedsapi
4
-
5
  Donate link: https://www.feedsapi.org/
6
-
7
- Tags: rss, feeds, import, feed, autoblog, feed aggregation, rss-feed, aggregation, atom, feed, rss, syndication, FeedWordPress, autoblog aggregator, Autoblogger, autoblogging, feed import, rss multi importer, feed reader, feed to post, multi feed import, multi feed importer, multi import, multi rss feeds, multiple feed import, multiple feeds, multiple rss feeds, rss, rss aggregator, rss feader, RSS import, rss to post, content curation, RSS Retriever, RSS fetch feed, WP RSS Aggregator, AutoPost, RSS Feed to Post,
8
-
9
- RSSImport, yahoo pipes, WP Pipes, Import XML feed , FeedSyndicate, RSSpost, RSS in Page
10
-
11
  Requires at least: 3.5
12
-
13
  Tested up to: 4.1
14
-
15
- Stable tag: 2.0.17
16
-
17
  License: GPLv2 or later
18
-
19
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
20
 
21
-
22
-
23
  RSS Post Importer is the Most Powerful & Easy to use WordPress RSS Aggregator plugin and does exactly what its name suggests: Import Full RSS Posts
24
 
25
 
26
-
27
  == Description ==
28
 
29
 
30
-
31
  **This is the Best WordPress Plugin for Syndicating, Importing, Curating, Merging and Displaying Full Text RSS and Atom feeds on your WordPress Blog. Watch for yourself!**
32
 
33
-
34
  [vimeo https://vimeo.com/117679639]
35
 
36
-
37
-
38
-
39
  **The RSS Post Importer plugin fetchs an RSS feed and publishes the full article content of each Feed Item as stand-alone post.**
40
 
41
-
42
-
43
  Content syndication allows a blogger to import an rss feed from other blogs in his niche, allowing him to share relevant content with his readers, with far less of a time commitment than writing his own posts or scheduling guest bloggers and ghost writers. RSS Post Importer is very easy to install, here's how:
44
 
45
-
46
-
47
  [vimeo https://vimeo.com/113134777]
48
 
49
-
50
-
51
  **RSS Post Importer** handles all of that, it will import and publish Full Text RSS Posts from one or several RSS feeds sources to your WordPress blog on Auto-pilot while you are laying on the beach of doing some other work, making your blogging, content syndication strategy & autoblogging life much more easier!
52
 
53
-
54
-
55
  Not only does this WordPress RSS Aggregator Plugin import a snippet of the rss feed, it automatically imports the entire [**Full Text RSS Feed**](http://www.feedsapi.com) , allowing you to post the entire article on your site if you want. This means you're providing your readers with relevant content on a daily, weekly, or even hourly basis, depending on the top of blog you're running. RSS Post Importer is a great plugin for news aggregators, content syndicator, company blogs, current events bloggers, or deal bloggers, as it keeps the fresh content that your readers love you for, coming on a regular basis!
56
 
57
 
58
-
59
-
60
-
61
  **Features include:**
62
 
63
 
64
-
65
  * Importing feeds automatically using cron.
66
-
67
  * Importing the full text rss feeds content.
68
-
69
  * Display the full content of the articles.
70
-
71
  * Chose to only display the titles of posts.
72
-
73
  * Set number of posts and category per feed.
74
-
75
  * Set what author to assign imported content to.
76
-
77
  * Simple template for formatting imported content.
78
-
79
  * Append prefilled HTML code or text to each published Post.
80
-
81
  * Append the no-follow tag to all outbond links for **better SEO.**
82
-
83
  * Idiot-proof Templating system allowing you to add backlinks and excerpts.
84
-
85
  * Block search indexing to prevent your content from appearing in search results.
86
-
87
  * **Advanced Statistics**: Piechart for feeds items distribution , Bar charts for posts and much more advanced charts
88
 
89
 
90
  **Premium Features include:**
91
 
92
 
93
-
94
  * Full Text RSS Feeds
95
-
96
  * Automated Featured images.
97
-
98
  * Keywords Based Filters and Curation .
99
-
100
  * RegEx Based Filters and Curation.
101
-
102
  * Define the number of Words Your Excerpt should have.
103
-
104
  * Fetch Full Text Articles + Images from Truncated Feeds.
105
-
106
  * Assign Any Imported RSS Feed Stream to a specific Author.
107
-
108
  * Assign Imported Posts to as many Tags as you want , the sky is the limit.
109
-
110
  * Assign Imported Post to as many categories as you want , the sky is the limit.
111
-
112
  * Export/import your Feeds and setting as CSV File.
113
 
114
-
115
  **Don't take my word for it, here's how easy to use it is:**
116
 
117
-
118
-
119
  [vimeo https://vimeo.com/113796278]
120
 
121
 
122
-
123
-
124
-
125
  **You should watch this video tutorial**
126
 
127
 
128
-
129
-
130
-
131
  When you start importing rss feeds as a part of your content backup, autoblogging or blogging strategy, you'll be able to reap the benefits of increased content and a larger fan base, which will translate into more traffic and more revenue or dollars for your business!
132
 
133
-
134
-
135
  **PS**: By the way, this RSS Aggregator plugin is not a shortcode for just displaying a bunch of links from an rss feeds like some of the following plugins:
136
 
137
- WP-o-Matic , WP-o-Matic, RSSImport, FeedWordPress, Syndicate Press, FeedWeb, RSS Just Better, CyberSyn, CSV 2 Post, Simple Feed Copyright, WP Syndicate, HungryFEED, WP Pipes and many other I can't list here. **RSS Post Importer imports data from a feed and saves it as full stand alone posts.**
138
-
139
 
140
 
141
  == Installation ==
142
 
143
 
144
-
145
  1. Upload the files to the `/wp-content/plugins/` directory
146
 
147
- 1. Activate the plugin through the 'Plugins' menu in WordPress
148
-
149
- 1. Set up what feeds to import and when!
150
-
151
 
 
152
 
153
  [vimeo https://vimeo.com/113134777]
154
 
155
 
156
-
157
  == Screenshots ==
158
 
159
 
160
-
161
  1. This is the combined settings- and feed-management-screen.
162
 
163
 
164
-
165
  == Change Log ==
166
 
 
 
 
 
 
 
 
 
167
  = Version 2.0.17 =
168
  * Bug Fixing: Encoding Bugs for Arabic, Russian, German and other languages and special characters fixed
169
 
170
-
171
  = Version 2.0.16 =
172
-
173
  * Added advanced stats
174
 
175
-
176
  = Version 2.0.15 =
177
-
178
  * Duplicate post issue
179
  * Warning messages
180
  * Encoding issue
181
 
182
  = Version 2.0.14 =
183
-
184
  * Added option to import/export settings
185
 
186
-
187
  = Version 2.0.13 =
188
-
189
  * Bug Fixing - API related
190
 
191
  = Version 2.0.12 =
192
-
193
  * Added export/import option to backup/restore feeds and settings.
194
 
195
-
196
  = Version 2.0.11 =
197
-
198
  * Changed API URL
199
 
200
-
201
  = Version 2.0.10 =
202
-
203
  * Added option to download images locally instead of hotlinking.
204
 
205
-
206
  = Version 2.0.9 =
207
-
208
  * Bug fixed and Improvements in code.
209
 
210
-
211
  = Version 2.0.8 =
212
-
213
  * default category always selected issue resolved.
214
-
215
  * {excerpt:n} not working - Fixed.
216
 
217
-
218
  = Version 2.0.7 =
219
-
220
  * Bug fixed and Improvements in code.
221
 
222
-
223
  = Version 2.0.6 =
224
-
225
  * nofollow option for outbound links.
226
-
227
  * Bug fixed($ sign not removing from content when feed importing)
228
-
229
  * Bug fixed and Improvements in code.
230
 
231
-
232
-
233
  = Version 2.0.5 =
234
-
235
  * Broken links to images solved.
236
-
237
  * Added cron option for 10 minutes.
238
-
239
  * Bug fixed and Improvements in code.
240
 
241
-
242
-
243
  = Version 2.0.4 =
244
-
245
  * Added Single tag(Without API key) and Multiple tags(With API key) assigned to imported posts
246
 
247
-
248
-
249
  = Version 2.0.3 =
250
-
251
  * show Category removed from feeds section to prevent UI breaking
252
-
253
  * Comments closed issue solved.
254
 
255
-
256
-
257
  = Version 2.0.2 =
258
-
259
  * Block search indexing
260
-
261
  * Multiple category selection for premium users
262
 
263
-
264
-
265
  = Version 2.0.1 =
266
-
267
  * Fixed cron error
268
-
269
  * Fixed permalink placeholder truncation
270
 
271
-
272
-
273
  = Version 2.0 =
274
-
275
  * Re-factored and rewritten almost all code
276
-
277
  * Fixed featured image and shortcode placeholders
278
-
279
  * Added support for keyword/regex based filtering
280
-
281
  * Added support for per feed author
282
-
283
  * Update readme
284
 
285
-
286
-
287
  = Version 1.0.10 =
288
-
289
  * Fixed replacement shortcodes
290
 
291
-
292
-
293
  = Version 1.0.9 =
294
-
295
  * Added support for excerpts
296
-
297
  * Fixed some warnings and notices
298
 
299
-
300
-
301
  = Version 1.0.6 =
302
-
303
  * Removed a bug causing save to reset and trigger a new cron.
304
 
305
-
306
-
307
  = Version 1.0.5 =
308
-
309
  * Minor improvements.
310
 
311
-
312
-
313
  = Version 1.0.4 =
314
-
315
  * Fixed bug that kept cron from running correctly.
316
 
317
-
318
-
319
  = Version 1.0.3 =
320
-
321
  * Made the log available through UI instead of just over ftp.
322
-
323
  * Design improvements.
324
 
325
-
326
-
327
  = Version 1.0.2 =
328
-
329
  * Fixed bug that caused posts to be duplicated when post status was set to anything but 'Publish'.
330
-
331
  * Added possibility to log each time imports are made in a textfile (for debugging purposes).
332
 
333
-
334
-
335
  = Version 1.0.1 =
336
-
337
- * Fixed some localization issues.
1
  === RSS Post Importer ===
 
2
  Contributors: feedsapi
 
3
  Donate link: https://www.feedsapi.org/
4
+ Tags: rss, feeds, import, feed, autoblog, feed aggregation, rss-feed, aggregation, atom, feed, rss, syndication, FeedWordPress, autoblog aggregator, Autoblogger, autoblogging, feed import, rss multi importer, feed reader, feed to post, multi feed import, multi feed importer, multi import, multi rss feeds, multiple feed import, multiple feeds, multiple rss feeds, rss, rss aggregator, rss feader, RSS import, rss to post, content curation, RSS Retriever, RSS fetch feed, WP RSS Aggregator, AutoPost, RSS Feed to Post, RSSImport, yahoo pipes, WP Pipes, Import XML feed , FeedSyndicate, RSSpost, RSS in Page
 
 
 
 
5
  Requires at least: 3.5
 
6
  Tested up to: 4.1
7
+ Stable tag: 2.1.0
 
 
8
  License: GPLv2 or later
 
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
 
 
11
  RSS Post Importer is the Most Powerful & Easy to use WordPress RSS Aggregator plugin and does exactly what its name suggests: Import Full RSS Posts
12
 
13
 
 
14
  == Description ==
15
 
16
 
 
17
  **This is the Best WordPress Plugin for Syndicating, Importing, Curating, Merging and Displaying Full Text RSS and Atom feeds on your WordPress Blog. Watch for yourself!**
18
 
 
19
  [vimeo https://vimeo.com/117679639]
20
 
 
 
 
21
  **The RSS Post Importer plugin fetchs an RSS feed and publishes the full article content of each Feed Item as stand-alone post.**
22
 
 
 
23
  Content syndication allows a blogger to import an rss feed from other blogs in his niche, allowing him to share relevant content with his readers, with far less of a time commitment than writing his own posts or scheduling guest bloggers and ghost writers. RSS Post Importer is very easy to install, here's how:
24
 
 
 
25
  [vimeo https://vimeo.com/113134777]
26
 
 
 
27
  **RSS Post Importer** handles all of that, it will import and publish Full Text RSS Posts from one or several RSS feeds sources to your WordPress blog on Auto-pilot while you are laying on the beach of doing some other work, making your blogging, content syndication strategy & autoblogging life much more easier!
28
 
 
 
29
  Not only does this WordPress RSS Aggregator Plugin import a snippet of the rss feed, it automatically imports the entire [**Full Text RSS Feed**](http://www.feedsapi.com) , allowing you to post the entire article on your site if you want. This means you're providing your readers with relevant content on a daily, weekly, or even hourly basis, depending on the top of blog you're running. RSS Post Importer is a great plugin for news aggregators, content syndicator, company blogs, current events bloggers, or deal bloggers, as it keeps the fresh content that your readers love you for, coming on a regular basis!
30
 
31
 
 
 
 
32
  **Features include:**
33
 
34
 
 
35
  * Importing feeds automatically using cron.
 
36
  * Importing the full text rss feeds content.
 
37
  * Display the full content of the articles.
 
38
  * Chose to only display the titles of posts.
 
39
  * Set number of posts and category per feed.
 
40
  * Set what author to assign imported content to.
 
41
  * Simple template for formatting imported content.
 
42
  * Append prefilled HTML code or text to each published Post.
 
43
  * Append the no-follow tag to all outbond links for **better SEO.**
 
44
  * Idiot-proof Templating system allowing you to add backlinks and excerpts.
 
45
  * Block search indexing to prevent your content from appearing in search results.
 
46
  * **Advanced Statistics**: Piechart for feeds items distribution , Bar charts for posts and much more advanced charts
47
 
48
 
49
  **Premium Features include:**
50
 
51
 
 
52
  * Full Text RSS Feeds
 
53
  * Automated Featured images.
 
54
  * Keywords Based Filters and Curation .
 
55
  * RegEx Based Filters and Curation.
 
56
  * Define the number of Words Your Excerpt should have.
 
57
  * Fetch Full Text Articles + Images from Truncated Feeds.
 
58
  * Assign Any Imported RSS Feed Stream to a specific Author.
 
59
  * Assign Imported Posts to as many Tags as you want , the sky is the limit.
 
60
  * Assign Imported Post to as many categories as you want , the sky is the limit.
 
61
  * Export/import your Feeds and setting as CSV File.
62
 
 
63
  **Don't take my word for it, here's how easy to use it is:**
64
 
 
 
65
  [vimeo https://vimeo.com/113796278]
66
 
67
 
 
 
 
68
  **You should watch this video tutorial**
69
 
70
 
 
 
 
71
  When you start importing rss feeds as a part of your content backup, autoblogging or blogging strategy, you'll be able to reap the benefits of increased content and a larger fan base, which will translate into more traffic and more revenue or dollars for your business!
72
 
 
 
73
  **PS**: By the way, this RSS Aggregator plugin is not a shortcode for just displaying a bunch of links from an rss feeds like some of the following plugins:
74
 
75
+ WP-o-Matic, WP-o-Matic, RSSImport, FeedWordPress, Syndicate Press, FeedWeb, RSS Just Better, CyberSyn, CSV 2 Post, Simple Feed Copyright, WP Syndicate, HungryFEED, WP Pipes and many other I can't list here. **RSS Post Importer imports data from a feed and saves it as full stand alone posts.**
 
76
 
77
 
78
  == Installation ==
79
 
80
 
 
81
  1. Upload the files to the `/wp-content/plugins/` directory
82
 
83
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
 
 
 
84
 
85
+ 3. Set up what feeds to import and when!
86
 
87
  [vimeo https://vimeo.com/113134777]
88
 
89
 
 
90
  == Screenshots ==
91
 
92
 
 
93
  1. This is the combined settings- and feed-management-screen.
94
 
95
 
 
96
  == Change Log ==
97
 
98
+ = Version 2.1.0 =
99
+ * Ajax implementation
100
+ * Feeds Level Keywords Filters
101
+ * Feeds Level RegEx Filters
102
+ * Insanely faster
103
+ * Improvement of the Charts
104
+ * Disable Duplicated Featured Images for specific templates
105
+
106
  = Version 2.0.17 =
107
  * Bug Fixing: Encoding Bugs for Arabic, Russian, German and other languages and special characters fixed
108
 
 
109
  = Version 2.0.16 =
 
110
  * Added advanced stats
111
 
 
112
  = Version 2.0.15 =
 
113
  * Duplicate post issue
114
  * Warning messages
115
  * Encoding issue
116
 
117
  = Version 2.0.14 =
 
118
  * Added option to import/export settings
119
 
 
120
  = Version 2.0.13 =
 
121
  * Bug Fixing - API related
122
 
123
  = Version 2.0.12 =
 
124
  * Added export/import option to backup/restore feeds and settings.
125
 
 
126
  = Version 2.0.11 =
 
127
  * Changed API URL
128
 
 
129
  = Version 2.0.10 =
 
130
  * Added option to download images locally instead of hotlinking.
131
 
 
132
  = Version 2.0.9 =
 
133
  * Bug fixed and Improvements in code.
134
 
 
135
  = Version 2.0.8 =
 
136
  * default category always selected issue resolved.
 
137
  * {excerpt:n} not working - Fixed.
138
 
 
139
  = Version 2.0.7 =
 
140
  * Bug fixed and Improvements in code.
141
 
 
142
  = Version 2.0.6 =
 
143
  * nofollow option for outbound links.
 
144
  * Bug fixed($ sign not removing from content when feed importing)
 
145
  * Bug fixed and Improvements in code.
146
 
 
 
147
  = Version 2.0.5 =
 
148
  * Broken links to images solved.
 
149
  * Added cron option for 10 minutes.
 
150
  * Bug fixed and Improvements in code.
151
 
 
 
152
  = Version 2.0.4 =
 
153
  * Added Single tag(Without API key) and Multiple tags(With API key) assigned to imported posts
154
 
 
 
155
  = Version 2.0.3 =
 
156
  * show Category removed from feeds section to prevent UI breaking
 
157
  * Comments closed issue solved.
158
 
 
 
159
  = Version 2.0.2 =
 
160
  * Block search indexing
 
161
  * Multiple category selection for premium users
162
 
 
 
163
  = Version 2.0.1 =
 
164
  * Fixed cron error
 
165
  * Fixed permalink placeholder truncation
166
 
 
 
167
  = Version 2.0 =
 
168
  * Re-factored and rewritten almost all code
 
169
  * Fixed featured image and shortcode placeholders
 
170
  * Added support for keyword/regex based filtering
 
171
  * Added support for per feed author
 
172
  * Update readme
173
 
 
 
174
  = Version 1.0.10 =
 
175
  * Fixed replacement shortcodes
176
 
 
 
177
  = Version 1.0.9 =
 
178
  * Added support for excerpts
 
179
  * Fixed some warnings and notices
180
 
 
 
181
  = Version 1.0.6 =
 
182
  * Removed a bug causing save to reset and trigger a new cron.
183
 
 
 
184
  = Version 1.0.5 =
 
185
  * Minor improvements.
186
 
 
 
187
  = Version 1.0.4 =
 
188
  * Fixed bug that kept cron from running correctly.
189
 
 
 
190
  = Version 1.0.3 =
 
191
  * Made the log available through UI instead of just over ftp.
 
192
  * Design improvements.
193
 
 
 
194
  = Version 1.0.2 =
 
195
  * Fixed bug that caused posts to be duplicated when post status was set to anything but 'Publish'.
 
196
  * Added possibility to log each time imports are made in a textfile (for debugging purposes).
197
 
 
 
198
  = Version 1.0.1 =
199
+ * Fixed some localization issues.
 
uninstall.php CHANGED
@@ -2,24 +2,24 @@
2
 
3
  //if uninstall not called from WordPress exit
4
  if (!defined('WP_UNINSTALL_PLUGIN')) {
5
- exit();
6
  }
7
 
8
  $option_name = 'rss_pi_feeds';
9
 
10
  // For Single site
11
  if (!is_multisite()) {
12
- delete_option($option_name);
13
- wp_clear_scheduled_hook('rss_pi_cron');
14
  } else {
15
- // For Multisite
16
- global $wpdb;
17
- $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
18
- $original_blog_id = get_current_blog_id();
19
- foreach ($blog_ids as $blog_id) {
20
- switch_to_blog($blog_id);
21
- delete_site_option($option_name);
22
- wp_clear_scheduled_hook('rss_pi_cron');
23
- }
24
- switch_to_blog($original_blog_id);
25
- }
2
 
3
  //if uninstall not called from WordPress exit
4
  if (!defined('WP_UNINSTALL_PLUGIN')) {
5
+ exit();
6
  }
7
 
8
  $option_name = 'rss_pi_feeds';
9
 
10
  // For Single site
11
  if (!is_multisite()) {
12
+ delete_option($option_name);
13
+ wp_clear_scheduled_hook('rss_pi_cron');
14
  } else {
15
+ // For Multisite
16
+ global $wpdb;
17
+ $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
18
+ $original_blog_id = get_current_blog_id();
19
+ foreach ($blog_ids as $blog_id) {
20
+ switch_to_blog($blog_id);
21
+ delete_site_option($option_name);
22
+ wp_clear_scheduled_hook('rss_pi_cron');
23
+ }
24
+ switch_to_blog($original_blog_id);
25
+ }