WP RSS Aggregator - Version 3.4.3

Version Description

(2013-10-20) = * Fixed bug: Removed anonymous functions for backwards PHP compatibility * Bug fix: Added suppress_filters in feed-display.php to prevent a user reported error * Bug fix: Missing

  • in certain feed displays
  • Download this release

    Release Info

    Developer jeangalea
    Plugin Icon 128x128 WP RSS Aggregator
    Version 3.4.3
    Comparing to
    See all releases

    Version 3.4.3

    Files changed (60) hide show
    1. changelog.txt +135 -0
    2. css/admin-styles.css +218 -0
    3. css/colorbox.css +93 -0
    4. css/styles.css +18 -0
    5. images/colorbox/border.png +0 -0
    6. images/colorbox/controls.png +0 -0
    7. images/colorbox/ie6/borderBottomCenter.png +0 -0
    8. images/colorbox/ie6/borderBottomLeft.png +0 -0
    9. images/colorbox/ie6/borderBottomRight.png +0 -0
    10. images/colorbox/ie6/borderMiddleLeft.png +0 -0
    11. images/colorbox/ie6/borderMiddleRight.png +0 -0
    12. images/colorbox/ie6/borderTopCenter.png +0 -0
    13. images/colorbox/ie6/borderTopLeft.png +0 -0
    14. images/colorbox/ie6/borderTopRight.png +0 -0
    15. images/colorbox/loading.gif +0 -0
    16. images/colorbox/loading_background.png +0 -0
    17. images/colorbox/overlay.png +0 -0
    18. images/facebook.png +0 -0
    19. images/icon-adminmenu16-sprite.png +0 -0
    20. images/icon-adminpage32.png +0 -0
    21. images/twitter.png +0 -0
    22. includes/admin-ajax-notice.php +130 -0
    23. includes/admin-dashboard.php +98 -0
    24. includes/admin-debugging.php +111 -0
    25. includes/admin-display.php +284 -0
    26. includes/admin-editor.php +60 -0
    27. includes/admin-import-export.php +162 -0
    28. includes/admin-metaboxes.php +353 -0
    29. includes/admin-options.php +626 -0
    30. includes/admin-welcome.php +121 -0
    31. includes/admin.php +110 -0
    32. includes/cron-jobs.php +80 -0
    33. includes/custom-feed.php +101 -0
    34. includes/custom-post-types.php +102 -0
    35. includes/deprecated-functions.php +83 -0
    36. includes/feed-display.php +277 -0
    37. includes/feed-processing.php +570 -0
    38. includes/libraries/WP_Logging.php +360 -0
    39. includes/libraries/browser.php +1082 -0
    40. includes/misc-functions.php +30 -0
    41. includes/opml-importer.php +231 -0
    42. includes/opml.php +126 -0
    43. includes/roles-capabilities.php +107 -0
    44. includes/scripts.php +120 -0
    45. includes/shortcodes.php +20 -0
    46. includes/system-info.php +140 -0
    47. includes/update.php +219 -0
    48. js/admin-addon-ajax.js +28 -0
    49. js/admin-custom.js +78 -0
    50. js/custom.js +7 -0
    51. js/editor.js +32 -0
    52. js/jquery.colorbox-min.js +7 -0
    53. languages/default.mo +0 -0
    54. languages/default.po +272 -0
    55. languages/it.mo +0 -0
    56. languages/it.po +274 -0
    57. readme.txt +242 -0
    58. templates/wprss.css +9 -0
    59. uninstall.php +15 -0
    60. wp-rss-aggregator.php +274 -0
    changelog.txt ADDED
    @@ -0,0 +1,135 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + 3.4.3 (2013-10-20)
    2
    + Fixed bug: Removed anonymous functions for backwards PHP compatibility
    3
    + Bug fix: Added suppress_filters in feed-display.php to prevent a user reported error
    4
    + Bug fix: Missing <li> in certain feed displays
    5
    +
    6
    + 3.4.2 (2013-9-19)
    7
    + Enhanced: Added some hooks for Feed to Post compatibility
    8
    + Enhanced: Moved date settings to a more appropriate location
    9
    +
    10
    + 3.4.1 (2013-9-16)
    11
    + Fixed Bug: Minor issue with options page - PHP notice
    12
    +
    13
    + 3.4 (2013-9-15)
    14
    + New Feature: Saving/Updating a feed source triggers an update for that source's feed items.
    15
    + New Feature: Option to change Youtube, Vimeo and Dailymotion feed item URLs to embedded video players URLs
    16
    + New Feature: Facebook Pages URLs are automatically detected and changed into Atom Feed URLs using FB's Graph
    17
    + Enhanced: Updated jQuery Colorbox library to 1.4.29
    18
    + Fixed Bug: Some settings did not have a default value set, and were throwing an 'Undefined Index' error
    19
    + Fixed Bug: Admin notices do not disappear immediately when dismissed.
    20
    +
    21
    + 3.3.3 (2013-09-08)
    22
    + Fixed bug: Better function handling on uninstall, should remove uninstall issues
    23
    +
    24
    + 3.3.2 (2013-09-07)
    25
    + New feature: Added exclude parameter to shortcode
    26
    + Enhanced: Added metabox links to documentation and add-ons
    27
    + Fixed bug: Custom feed linking to post on user site rather than original source
    28
    + Fixed bug: Custom post types issues when activitating the plugin
    29
    +
    30
    + 3.3.1 (2013-08-09)
    31
    + Fixed bug: Roles and Capabilities file had not been included
    32
    + Fixed bug: Error on install, function not found
    33
    +
    34
    + 3.3 (2013-08-08)
    35
    + New feature: OPML importer
    36
    + New feature: Feed item limits for individual Feed Sources
    37
    + New feature: Custom feed URL
    38
    + New feature: Feed limit on custom feed
    39
    + New feature: New 'Fetch feed items' action for each Feed Source in listing display
    40
    + New feature: Option to enable link to source
    41
    + Enhanced: Date strings now change according to locale being used (i.e. compatible with WPML)
    42
    + Enhanced: Capabilities implemented
    43
    + Enhanced: Feed Sources row action 'View' removed
    44
    + Fixed Bug: Proxy feed URLs resulting in the permalink: example.com/url
    45
    +
    46
    + 3.2 (2013-07-06)
    47
    + New feature: Parameter to limit number of feeds displayed
    48
    + New feature: Paramter to limit feeds displayed to particular sources (via ID)
    49
    + New feature: Now handles licensing for add-ons
    50
    + Enhanced: Better feed import handling to handle large number of feed sources
    51
    +
    52
    + 3.1.1 (2013-06-06)
    53
    + Fixed bug: Incompatibility with some other plugins due to function missing namespace
    54
    +
    55
    + 3.1 (2013-06-06)
    56
    + New feature: Option to set the number of feed items imported from every feed (default 5)
    57
    + New feature: Import and Export aggregator settings and feed sources
    58
    + New feature: Debugging page allowing manual feed refresh and feed reset
    59
    + Enhanced: Faster handling of restoring sources from trash when feed limit is 0
    60
    + Fixed bug: Limiter on number of overall feeds stored not working
    61
    + Fixed bug: Incompatibility issue with Foobox plugin fixed
    62
    + Fixed bug: Duplicate feeds sometimes imported
    63
    +
    64
    + 3.0 (2013-03-16)
    65
    + New feature: Option to select cron frequency
    66
    + New feature: Code extensibility added to be compatible with add-ons
    67
    + New feature: Option to set a limit to the number of feeds stored (previously 50, hard coded)
    68
    + New feature: Option to define the format of the date shown below each feed item
    69
    + New feature: Option to show or hide source of feed item
    70
    + New feature: Option to show or hide publish date of feed item
    71
    + New feature: Option to set text preceding publish date
    72
    + New feature: Option to set text preceding source of feed item
    73
    + New feature: Option to link title or not
    74
    + New feature: Limit of 5 items imported for each source instead of 10
    75
    + Enhanced: Performance improvement when publishing new feeds in admin
    76
    + Enhanced: Query tuning for better performance
    77
    + Enhanced: Major code rewrite, refactoring and inclusion of hooks
    78
    + Enhanced: Updated Colorbox to v1.4.1
    79
    + Enhanced: Better security implementations
    80
    + Enhanced: Better feed preview display
    81
    + Fixed bug: Deletion of items upon source deletion not working properly
    82
    + Requires: WordPress 3.3
    83
    +
    84
    + 2.2.3 (2012-11-01)
    85
    + Fixed bug: Tab navigation preventing typing in input boxes
    86
    + Removed: Feeds showing up in internal linking pop up
    87
    +
    88
    + 2.2.2 (2012-10-30)
    89
    + Removed: Feeds showing up in site search results
    90
    + Enhanced: Better tab button navigation when adding a new feed
    91
    + Enhanced: Better guidance when a feed URL is invalid
    92
    +
    93
    + 2.2.1 (2012-10-17)
    94
    + Fixed bug: wprss_feed_source_order assumes everyone is an admin
    95
    +
    96
    + 2.2 (2012-10-01)
    97
    + New feature: Italian translation added
    98
    + Enhanced: Feed source order changed to alphabetical
    99
    + Fixed bug: repeated entries when having a non-valid feed source
    100
    + Fixed bug: all imported feeds deleted upon trashing a single feed source
    101
    +
    102
    + 2.1 (2012-09-27)
    103
    + New feature: Now localised for translations
    104
    + Fixed bug: with date string
    105
    + Fixed bug: $link_before and $link_after, now working
    106
    + Enhanced: Added backwards compatibility for wp_rss_aggregator() function
    107
    +
    108
    + 2.0 (2012-09-21)
    109
    + Bulk of code rewritten and refactored
    110
    + Added install and upgrade functions
    111
    + Added DB version setting
    112
    + Feed sources now stored as Custom Post Types
    113
    + Feed source list sortable ascending or descending by name
    114
    + Removed days subsections in feed display
    115
    + Ability to limit total number of feeds displayed
    116
    + Feeds now fetched via Cron
    117
    + Cron job to delete old feed items, keeps max of 50 items in DB
    118
    + Now requires WordPress 3.2
    119
    + updated colorbox to v1.3.20.1
    120
    + Limit of 15 items max imported for each source
    121
    + Fixed issue of page content displaying incorrectly after feeds
    122
    +
    123
    + 1.1 (2012-08-13)
    124
    + Now requires WordPress 3.0
    125
    + More flexible fetching of images directory
    126
    + Has its own top level menu item
    127
    + Added settings section
    128
    + Ability to open in lightbox, new window or default browser behaviour
    129
    + Ability to set links as follow or no follow
    130
    + Using constants for oftenly used locations
    131
    + Code refactoring
    132
    + Changes in file and folder structure
    133
    +
    134
    + 1.0 (2012-01-06)
    135
    + First release
    css/admin-styles.css ADDED
    @@ -0,0 +1,218 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + .wprss-input {
    2
    + background: none repeat scroll 0 0 #EAF2FA;
    3
    + margin-bottom: 20px;
    4
    + padding-bottom: 10px;
    5
    + padding-left: 10px;
    6
    + padding-top: 10px;
    7
    + width: 600px;
    8
    + }
    9
    +
    10
    + .wprss-input p { line-height: 28px; }
    11
    +
    12
    + .wprss-input label {
    13
    + float: left;
    14
    + width: 95px !important;
    15
    + }
    16
    +
    17
    + .wprss-input input {
    18
    + height: 28px;
    19
    + margin-bottom: 0;
    20
    + padding: 0 0 0 5px;
    21
    + width: 400px;
    22
    + }
    23
    +
    24
    + #icon-wprss-aggregator {
    25
    + background: transparent url( '../images/icon-adminpage32.png' ) no-repeat !important;
    26
    + }
    27
    +
    28
    + body.post-type-wprss_feed #titlediv div.inside { display: none !important; }
    29
    +
    30
    + #misc-publishing-actions,
    31
    + #minor-publishing-actions { display: none; }
    32
    +
    33
    + #custom_meta_box .form-table th { width: 100px; }
    34
    +
    35
    + body.post-type-wprss_feed_item .add-new-h2,
    36
    + body.post-type-wprss_feed_item .tablenav select[name="m"],
    37
    + body.post-type-wprss_feed_item #post-query-submit
    38
    + { display: none; }
    39
    +
    40
    + body.post-type-wprss_feed_item a.row-title {
    41
    + cursor: default;
    42
    + font-weight: normal;
    43
    + color: #555;
    44
    + }
    45
    +
    46
    + #latest-news-cpac-settings li {
    47
    + list-style: none;
    48
    + line-height: 16px;
    49
    + }
    50
    +
    51
    + li.twitter a {
    52
    + background: transparent url('../images/twitter.png') no-repeat 0;
    53
    + padding-left: 20px;
    54
    + }
    55
    +
    56
    + li.facebook a {
    57
    + background: transparent url('../images/facebook.png') no-repeat 0;
    58
    + padding-left: 20px;
    59
    + }
    60
    +
    61
    + li.donate_link a:hover {
    62
    + color: darkGreen;
    63
    + }
    64
    +
    65
    + #preview_meta_box ul {
    66
    + list-style: disc;
    67
    + margin-left: 16px;
    68
    + }
    69
    +
    70
    + #preview_meta_box .invalid-feed-url {
    71
    + color: red;
    72
    + }
    73
    +
    74
    + #preview_meta_box .rss-date {
    75
    + color: #666;
    76
    +
    77
    + }
    78
    +
    79
    + /*.rss-aggregator_page_wprss-aggregator-settings .form-table th { width: 80px; }*/
    80
    +
    81
    +
    82
    + /* For excerpts and thumbnails admin screens */
    83
    + .wprss_feed_page_wprss-aggregator-settings input,
    84
    + .wprss_feed_page_wprss-aggregator-settings input[type="checkbox"],
    85
    + .wprss_feed_page_wprss-aggregator-settings input[type="radio"] {
    86
    + margin-right: 8px;
    87
    + }
    88
    +
    89
    + input#default-thumbnail,
    90
    + input#wprss-et-license-key,
    91
    + input#wprss-c-license-key,
    92
    + input#wprss-kf-license-key,
    93
    + input#wprss-ftp-license-key {
    94
    + width: 300px;
    95
    + }
    96
    +
    97
    + input#thumbnails-height,
    98
    + input#thumbnails-width {
    99
    + /*width: 29px;*/
    100
    + }
    101
    +
    102
    +
    103
    + /* Red Button */
    104
    +
    105
    + .wp-core-ui .button-red {
    106
    + background-color: #9B2124;
    107
    + background-image: -webkit-gradient(linear, left top, left bottom, from(#C5292E), to(#9B2124));
    108
    + background-image: -webkit-linear-gradient(top, #C5292E, #9B2124);
    109
    + background-image: -moz-linear-gradient(top, #C5292E, #9B2124);
    110
    + background-image: -ms-linear-gradient(top, #C5292E, #9B2124);
    111
    + background-image: -o-linear-gradient(top, #C5292E, #9B2124);
    112
    + background-image: linear-gradient(to bottom, #C5292E, #9B2124);
    113
    + border-color: #9B2124;
    114
    + border-bottom-color: #8D1F21;
    115
    + -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
    116
    + box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
    117
    + color: #fff;
    118
    + text-decoration: none;
    119
    + text-shadow: 0 1px 0 rgba(0,0,0,0.1);
    120
    + /*float: right;*/
    121
    + }
    122
    +
    123
    + .wp-core-ui .button-red.hover,
    124
    + .wp-core-ui .button-red:hover,
    125
    + .wp-core-ui .button-red.focus,
    126
    + .wp-core-ui .button-red:focus {
    127
    + background-color: #B72629;
    128
    + background-image: -webkit-gradient(linear, left top, left bottom, from(#D22E30), to(#9B2124));
    129
    + background-image: -webkit-linear-gradient(top, #D22E30, #9B2124);
    130
    + background-image: -moz-linear-gradient(top, #D22E30, #9B2124);
    131
    + background-image: -ms-linear-gradient(top, #D22E30, #9B2124);
    132
    + background-image: -o-linear-gradient(top, #D22E30, #9B2124);
    133
    + background-image: linear-gradient(to bottom, #D22E30, #9B2124);
    134
    + border-color: #7F1C1F;
    135
    + -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
    136
    + box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
    137
    + color: #fff;
    138
    + text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
    139
    + }
    140
    +
    141
    + .wp-core-ui .button-red.focus,
    142
    + .wp-core-ui .button-red:focus {
    143
    + border-color: #500F0E;
    144
    + -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
    145
    + box-shadow: inset 0 1px 0 rgba(120,200,230,0.6), 1px 1px 2px rgba(0,0,0,0.4);
    146
    + }
    147
    +
    148
    + .wp-core-ui .button-red.active,
    149
    + .wp-core-ui .button-red.active:hover,
    150
    + .wp-core-ui .button-red.active:focus,
    151
    + .wp-core-ui .button-red:active {
    152
    + background: #7F1C1F;
    153
    + background-image: -webkit-gradient(linear, left top, left bottom, from(#9B2124), to(#B72629));
    154
    + background-image: -webkit-linear-gradient(top, #9B2124, #B72629);
    155
    + background-image: -moz-linear-gradient(top, #9B2124, #B72629);
    156
    + background-image: -ms-linear-gradient(top, #9B2124, #B72629);
    157
    + background-image: -o-linear-gradient(top, #9B2124, #B72629);
    158
    + background-image: linear-gradient(to bottom, #9B2124, #B72629);
    159
    + border-color: #601312 #AE2426 #AE2426 #AE2426;
    160
    + color: rgba(255,255,255,0.95);
    161
    + -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
    162
    + box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
    163
    + text-shadow: 0 1px 0 rgba(0,0,0,0.1);
    164
    + }
    165
    +
    166
    + .wp-core-ui .button-red[disabled],
    167
    + .wp-core-ui .button-red:disabled,
    168
    + .wp-core-ui .button-red-disabled {
    169
    + color: #E79496 !important;
    170
    + background: #BA292B !important;
    171
    + border-color: #7F1C1F !important;
    172
    + -webkit-box-shadow: none !important;
    173
    + box-shadow: none !important;
    174
    + text-shadow: 0 -1px 0 rgba(0,0,0,0.1) !important;
    175
    + cursor: default;
    176
    + }
    177
    +
    178
    + #system-info-textarea {
    179
    + width: 800px;
    180
    + height: 400px;
    181
    + font-family: Menlo, Monaco, monospace;
    182
    + background: none;
    183
    + white-space: pre;
    184
    + overflow: auto;
    185
    + display: block;
    186
    + }
    187
    +
    188
    +
    189
    + /* Number Roller for Feed Source Limit */
    190
    + .wprss-number-roller {
    191
    + width: 75px;
    192
    + }
    193
    +
    194
    + /* Welcome Screen */
    195
    + .about-wrap ul {
    196
    + list-style: disc;
    197
    + padding-left: 30px;
    198
    + }
    199
    +
    200
    + /* Excerpts and Thumbnails */
    201
    +
    202
    + input#thumbnails-height,
    203
    + input#thumbnails-width {
    204
    + margin-right: 2px;
    205
    + }
    206
    +
    207
    + label[for=thumbnails-height],
    208
    + label[for=thumbnails-width] {
    209
    + margin-left: 8px;
    210
    + }
    211
    +
    212
    + .wp-list-table > thead > tr > th#thumbnail[scope="col"] {
    213
    + width: 95px;
    214
    + }
    215
    +
    216
    + select + label.description {
    217
    + margin-left: 8px;
    218
    + }
    css/colorbox.css ADDED
    @@ -0,0 +1,93 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + /*
    2
    + ColorBox Core Style:
    3
    + The following CSS is consistent between example themes and should not be altered.
    4
    + */
    5
    + #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
    6
    + #cboxOverlay{position:fixed; width:100%; height:100%;}
    7
    + #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
    8
    + #cboxContent{position:relative;}
    9
    + #cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
    10
    + #cboxTitle{margin:0;}
    11
    + #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
    12
    + #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
    13
    + .cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none;}
    14
    + .cboxIframe{width:100%; height:100%; display:block; border:0;}
    15
    + #colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
    16
    +
    17
    + /*
    18
    + User Style:
    19
    + Change the following styles to modify the appearance of ColorBox. They are
    20
    + ordered & tabbed in a way that represents the nesting of the generated HTML.
    21
    + */
    22
    + #cboxOverlay{background:url(../images/colorbox/overlay.png) repeat 0 0;}
    23
    + #colorbox{outline:0;}
    24
    + #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px 0;}
    25
    + #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px 0;}
    26
    + #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px -29px;}
    27
    + #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px -29px;}
    28
    + #cboxMiddleLeft{width:21px; background:url(../images/colorbox/controls.png) left top repeat-y;}
    29
    + #cboxMiddleRight{width:21px; background:url(../images/colorbox/controls.png) right top repeat-y;}
    30
    + #cboxTopCenter{height:21px; background:url(../images/colorbox/border.png) 0 0 repeat-x;}
    31
    + #cboxBottomCenter{height:21px; background:url(../images/colorbox/border.png) 0 -29px repeat-x;}
    32
    + #cboxContent{background:#fff; overflow:hidden;}
    33
    + .cboxIframe{background:#fff;}
    34
    + #cboxError{padding:50px; border:1px solid #ccc;}
    35
    + #cboxLoadedContent{margin-bottom:28px;}
    36
    + #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
    37
    + #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
    38
    + #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;}
    39
    + #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;}
    40
    +
    41
    + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
    42
    + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
    43
    +
    44
    + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
    45
    + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
    46
    +
    47
    + #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
    48
    + #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../images/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
    49
    + #cboxPrevious:hover{background-position:-75px -25px;}
    50
    + #cboxNext{position:absolute; bottom:0; left:27px; background:url(../images/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
    51
    + #cboxNext:hover{background-position:-50px -25px;}
    52
    + #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
    53
    + #cboxClose:hover{background-position:-25px -25px;}
    54
    +
    55
    + /*
    56
    + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
    57
    + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
    58
    + See: http://jacklmoore.com/notes/ie-transparency-problems/
    59
    + */
    60
    + .cboxIE #cboxTopLeft,
    61
    + .cboxIE #cboxTopCenter,
    62
    + .cboxIE #cboxTopRight,
    63
    + .cboxIE #cboxBottomLeft,
    64
    + .cboxIE #cboxBottomCenter,
    65
    + .cboxIE #cboxBottomRight,
    66
    + .cboxIE #cboxMiddleLeft,
    67
    + .cboxIE #cboxMiddleRight {
    68
    + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
    69
    + }
    70
    +
    71
    + /*
    72
    + The following provides PNG transparency support for IE6
    73
    + Feel free to remove this and the /ie6/ directory if you have dropped IE6 support.
    74
    + */
    75
    + .cboxIE6 #cboxTopLeft{background:url(../images/colorbox/ie6/borderTopLeft.png);}
    76
    + .cboxIE6 #cboxTopCenter{background:url(../images/colorbox/ie6/borderTopCenter.png);}
    77
    + .cboxIE6 #cboxTopRight{background:url(../images/colorbox/ie6/borderTopRight.png);}
    78
    + .cboxIE6 #cboxBottomLeft{background:url(../images/colorbox/ie6/borderBottomLeft.png);}
    79
    + .cboxIE6 #cboxBottomCenter{background:url(../images/colorbox/ie6/borderBottomCenter.png);}
    80
    + .cboxIE6 #cboxBottomRight{background:url(../images/colorbox/ie6/borderBottomRight.png);}
    81
    + .cboxIE6 #cboxMiddleLeft{background:url(../images/colorbox/ie6/borderMiddleLeft.png);}
    82
    + .cboxIE6 #cboxMiddleRight{background:url(../images/colorbox/ie6/borderMiddleRight.png);}
    83
    +
    84
    + .cboxIE6 #cboxTopLeft,
    85
    + .cboxIE6 #cboxTopCenter,
    86
    + .cboxIE6 #cboxTopRight,
    87
    + .cboxIE6 #cboxBottomLeft,
    88
    + .cboxIE6 #cboxBottomCenter,
    89
    + .cboxIE6 #cboxBottomRight,
    90
    + .cboxIE6 #cboxMiddleLeft,
    91
    + .cboxIE6 #cboxMiddleRight {
    92
    + _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
    93
    + }
    css/styles.css ADDED
    @@ -0,0 +1,18 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + li.feed-item { margin-bottom: 10px; }
    2
    +
    3
    + .thumbnail-excerpt {
    4
    + overflow:hidden;
    5
    + margin-bottom: 5px;
    6
    + }
    7
    +
    8
    + .thumbnail-excerpt img {
    9
    + max-width:100%; float:left; margin-top: 0.5em; margin-right:10px;
    10
    + }
    11
    +
    12
    + div.source-date { clear: both; }
    13
    +
    14
    + span.feed-source { font-size: 90%; }
    15
    +
    16
    + .green {
    17
    + color: #0BD600;
    18
    + }
    images/colorbox/border.png ADDED
    Binary file
    images/colorbox/controls.png ADDED
    Binary file
    images/colorbox/ie6/borderBottomCenter.png ADDED
    Binary file
    images/colorbox/ie6/borderBottomLeft.png ADDED
    Binary file
    images/colorbox/ie6/borderBottomRight.png ADDED
    Binary file
    images/colorbox/ie6/borderMiddleLeft.png ADDED
    Binary file
    images/colorbox/ie6/borderMiddleRight.png ADDED
    Binary file
    images/colorbox/ie6/borderTopCenter.png ADDED
    Binary file
    images/colorbox/ie6/borderTopLeft.png ADDED
    Binary file
    images/colorbox/ie6/borderTopRight.png ADDED
    Binary file
    images/colorbox/loading.gif ADDED
    Binary file
    images/colorbox/loading_background.png ADDED
    Binary file
    images/colorbox/overlay.png ADDED
    Binary file
    images/facebook.png ADDED
    Binary file
    images/icon-adminmenu16-sprite.png ADDED
    Binary file
    images/icon-adminpage32.png ADDED
    Binary file
    images/twitter.png ADDED
    Binary file
    includes/admin-ajax-notice.php ADDED
    @@ -0,0 +1,130 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * Serves up a notice to leave a review for this plugin
    5
    + *
    6
    + * @link http://wp.tutsplus.com/tutorials/creative-coding/a-primer-on-ajax-in-the-wordpress-dashboard-requesting-and-responding/
    7
    + * @link http://wptheming.com/2011/08/admin-notices-in-wordpress/
    8
    + *
    9
    + * @since 3.0
    10
    + *
    11
    + */
    12
    +
    13
    +
    14
    + add_action( 'admin_init', 'wprss_admin_notice' );
    15
    + /**
    16
    + * Serves up a notice to leave a review for this plugin
    17
    + *
    18
    + * @since 3.0
    19
    + */
    20
    + function wprss_admin_notice() {
    21
    + global $pagenow, $typenow;
    22
    + if ( empty( $typenow ) && !empty( $_GET['post'] ) ) {
    23
    + $post = get_post( $_GET['post'] );
    24
    + $typenow = $post->post_type;
    25
    + }
    26
    + $notices_settings = get_option( 'wprss_settings_notices' );
    27
    +
    28
    + // Display the admin notice only if it hasn't been hidden and we are on a screen of WP RSS Aggregator
    29
    + if ( ( false == $notices_settings ) && ( ( $typenow == 'wprss_feed' ) || ( $typenow == 'wprss_feed_item' ) ) ) {
    30
    + add_action( 'admin_notices', 'wprss_display_admin_notice' );
    31
    + }
    32
    +
    33
    + }
    34
    +
    35
    +
    36
    + /**
    37
    + * Renders the administration notice. Also renders a hidden nonce used for security when processing the Ajax request.
    38
    + *
    39
    + * @since 3.0
    40
    + */
    41
    + function wprss_display_admin_notice() {
    42
    +
    43
    + $html = '<div id="ajax-notification" class="updated">';
    44
    + $html .= '<p>';
    45
    + $html .= __( 'Did you know that you can get more RSS features? Excerpts, thumbnails, keyword filtering, importing into posts and more... Check out the <a target="_blank" href="http://www.wprssaggregator.com/extensions"><strong>extensions</strong></a> page.
    46
    + <a href="javascript:;" id="dismiss-ajax-notification" style="float:right;">Dismiss this notification</a>', 'wprss' );
    47
    + $html .= '</p>';
    48
    + $html .= '<span id="ajax-notification-nonce" class="hidden">' . wp_create_nonce( 'ajax-notification-nonce' ) . '</span>';
    49
    + $html .= '</div><!-- /.updated -->';
    50
    +
    51
    + echo $html;
    52
    + }
    53
    +
    54
    +
    55
    + add_action( 'wp_ajax_wprss_hide_admin_notification', 'wprss_hide_admin_notification' );
    56
    + /**
    57
    + * JavaScript callback used to hide the administration notice when the 'Dismiss' anchor is clicked on the front end.
    58
    + *
    59
    + * @since 3.0
    60
    + */
    61
    + function wprss_hide_admin_notification() {
    62
    +
    63
    + // First, check the nonce to make sure it matches what we created when displaying the message.
    64
    + // If not, we won't do anything.
    65
    + if( wp_verify_nonce( $_REQUEST['nonce'], 'ajax-notification-nonce' ) ) {
    66
    +
    67
    + // If the update to the option is successful, send 1 back to the browser;
    68
    + // Otherwise, send 0.
    69
    + $general_settings = get_option( 'wprss_settings_notices' );
    70
    + $general_settings = true;
    71
    +
    72
    + if( update_option( 'wprss_settings_notices', $general_settings ) ) {
    73
    + die( '1' );
    74
    + } else {
    75
    + die( '0' );
    76
    + }
    77
    + }
    78
    + }
    79
    +
    80
    +
    81
    +
    82
    + /**
    83
    + * Checks if the addon notices option exists in the database, and creates it
    84
    + * if it does not.
    85
    + *
    86
    + * @return The addon notices option
    87
    + * @since 3.4.2
    88
    + */
    89
    + function wprss_check_addon_notice_option() {
    90
    + $option = get_option( 'wprss_addon_notices' );
    91
    + if ( $option === FALSE ) {
    92
    + update_option( 'wprss_addon_notices', array() );
    93
    + return array();
    94
    + }
    95
    + return $option;
    96
    + }
    97
    +
    98
    +
    99
    +
    100
    + /**
    101
    + * This function is called through AJAX to dismiss a particular addon notification.
    102
    + *
    103
    + * @since 3.4.2
    104
    + */
    105
    + function wprss_dismiss_addon_notice() {
    106
    + $addon = ( isset( $_POST['addon'] ) === TRUE )? $_POST['addon'] : null;
    107
    + if ( $addon === null ) {
    108
    + echo 'false';
    109
    + die();
    110
    + }
    111
    + $notice = ( isset( $_POST['notice'] ) === TRUE )? $_POST['notice'] : null;
    112
    + if ( $notice === null ){
    113
    + echo 'false';
    114
    + die();
    115
    + }
    116
    +
    117
    + $notices = wprss_check_addon_notice_option();
    118
    + if ( isset( $notices[$addon] ) === FALSE ) {
    119
    + $notices[$addon] = array();
    120
    + }
    121
    + if ( isset( $notices[$addon][$addon] ) === FALSE ) {
    122
    + $notices[$addon][$notice] = '1';
    123
    + }
    124
    + update_option( 'wprss_addon_notices', $notices );
    125
    + echo 'true';
    126
    +
    127
    + die();
    128
    + }
    129
    +
    130
    + add_action( 'wp_ajax_wprss_dismiss_addon_notice', 'wprss_dismiss_addon_notice' );
    includes/admin-dashboard.php ADDED
    @@ -0,0 +1,98 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Adds a dashboard page for the admin
    4
    + * It is triggered on plugin activation and upon
    5
    + * update.
    6
    + *
    7
    + * @since 3.3
    8
    + */
    9
    +
    10
    +
    11
    + // Exit if the page is accessed directly
    12
    + if ( ! defined( 'ABSPATH' ) ) exit;
    13
    +
    14
    +
    15
    + add_action( 'admin_menu', 'wprss_admin_menu' );
    16
    + /**
    17
    + * Adds a dashboard page.
    18
    + * Usde to add the Welcome Page to the dashboard.
    19
    + *
    20
    + * @since 3.3
    21
    + */
    22
    + function wprss_admin_menu() {
    23
    + // Welcome Page
    24
    + add_dashboard_page(
    25
    + __( 'Welcome to WP RSS Aggregator', 'wprss' ),
    26
    + __( 'Welcome to WP RSS Aggregator', 'wprss' ),
    27
    + 'manage_options',
    28
    + 'wprss-welcome',
    29
    + 'wprss_show_welcome_screen'
    30
    + );
    31
    + }
    32
    +
    33
    +
    34
    + /**
    35
    + * Callback for the Welcome Dashboard page.
    36
    + * It merely includes the contents of the admin-welcome.php file,
    37
    + * which contains the markup for the welcome screen.
    38
    + *
    39
    + * @since 3.3
    40
    + */
    41
    + function wprss_show_welcome_screen() {
    42
    + include_once( 'admin-welcome.php' );
    43
    + }
    44
    +
    45
    +
    46
    + add_action( 'admin_init', 'wprss_welcome' );
    47
    + /**
    48
    + * Detects an activation and redirects the user to
    49
    + * the welcome page.
    50
    + *
    51
    + * @since 3.3
    52
    + */
    53
    + function wprss_welcome() {
    54
    + // Bail if no activation redirect
    55
    + if ( ! get_transient( '_wprss_activation_redirect' ) )
    56
    + return;
    57
    +
    58
    + // Delete the redirect transient
    59
    + delete_transient( '_wprss_activation_redirect' );
    60
    +
    61
    + // Bail if activating from network, or bulk
    62
    + if ( is_network_admin() || isset( $_GET['activate-multi'] ) )
    63
    + return;
    64
    +
    65
    + wp_safe_redirect( admin_url( 'index.php?page=wprss-welcome' ) );
    66
    + exit;
    67
    + }
    68
    +
    69
    +
    70
    + add_action( 'admin_head', 'wprss_admin_head' );
    71
    + /**
    72
    + * Removes the dashboard welcome page from the dashboard
    73
    + * menu, and adds some styles for the welcome page.
    74
    + *
    75
    + * @since 3.3
    76
    + */
    77
    + function wprss_admin_head() {
    78
    + remove_submenu_page( 'index.php', 'wprss-welcome' );
    79
    + ?>
    80
    + <style type="text/css" media="screen">
    81
    + /*<![CDATA[*/
    82
    +
    83
    + /*.wprss-welcome-table > tbody > tr > td {
    84
    + line-height: 30px;
    85
    + }
    86
    + .wprss-welcome-table > tbody > tr {
    87
    + font-size: 1.3em;
    88
    + font-weight: normal;
    89
    + }
    90
    + .wprss-welcome-table > thead > tr > th{
    91
    + font-size: 2em;
    92
    + border-bottom: 8px solid #999;
    93
    + }*/
    94
    +
    95
    + /*]]>*/
    96
    + </style>
    97
    + <?php
    98
    + }
    includes/admin-debugging.php ADDED
    @@ -0,0 +1,111 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Plugin debugging
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + * @subpackage Includes
    7
    + * @since 3.0
    8
    + * @author Jean Galea <info@jeangalea.com>
    9
    + * @copyright Copyright(c) 2012-2013, Jean Galea
    10
    + * @link http://www.wpmayor.com
    11
    + * @license http://www.gnu.org/licenses/gpl.html
    12
    + */
    13
    +
    14
    + /*
    15
    + //allow redirection, even if my theme starts to send output to the browser
    16
    + add_action( 'admin_init', 'wprss_do_output_buffer' );
    17
    + function wprss_do_output_buffer() {
    18
    + //ob_start();
    19
    + }*/
    20
    +
    21
    +
    22
    + add_action( 'init', 'wprss_debug_operations' );
    23
    + /**
    24
    + * Performs debug operations, depending on the POST request.
    25
    + *
    26
    + * @since 3.3
    27
    + */
    28
    + function wprss_debug_operations(){
    29
    + // If page loading after having clicked 'Update all fields'
    30
    + if ( isset( $_POST['update-feeds'] ) && check_admin_referer( 'wprss-update-feed-items' ) ) {
    31
    + wprss_fetch_insert_all_feed_items();
    32
    + wp_redirect( "edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=1" );
    33
    + }
    34
    +
    35
    + // If page loading after having clicked 'Delete and re-import all fields'
    36
    + else if ( isset( $_POST['reimport-feeds'] ) && check_admin_referer( 'wprss-delete-import-feed-items' ) ) {
    37
    + wprss_feed_reset();
    38
    + wp_redirect( "edit.php?post_type=wprss_feed&page=wprss-debugging&debug_message=2" );
    39
    + }
    40
    + }
    41
    +
    42
    + /**
    43
    + * Build the debugging page
    44
    + *
    45
    + * @since 3.0
    46
    + */
    47
    + function wprss_debugging_page_display() {
    48
    + ?>
    49
    +
    50
    + <div class="wrap">
    51
    + <?php screen_icon( 'wprss-aggregator' ); ?>
    52
    +
    53
    + <h2><?php _e( 'Debugging', 'wprss' ); ?></h2>
    54
    + <?php
    55
    + if ( isset( $_GET['debug_message'] )) {//&& ( check_admin_referer( 'wprss-delete-import-feed-items' ) || check_admin_referer( 'wprss-update-feed-items' ) ) ) {
    56
    + $message = $_GET['debug_message'];
    57
    +
    58
    + switch ( $message ) {
    59
    + case 1 :
    60
    + wprss_debugging_admin_notice_update_feeds();
    61
    + break;
    62
    + case 2 :
    63
    + wprss_debugging_admin_notice_reimport_feeds();
    64
    + break;
    65
    + }
    66
    + } ?>
    67
    + <h3><?php _e( 'Update All Feeds Now', 'wprss' ); ?></h3>
    68
    + <p><?php _e( 'Click the blue button to update all feed items now. This will check all feed sources for any new feed items.', 'wprss' ); ?>
    69
    + <br><?php _e( 'Existing feed items will not be modified.', 'wprss' ); ?>
    70
    + </p>
    71
    + <p><?php _e( '<strong>Note:</strong> This might take more than a few seconds if you have many feed sources.', 'wprss' ); ?></p>
    72
    +
    73
    + <form action="edit.php?post_type=wprss_feed&page=wprss-debugging" method="post">
    74
    +
    75
    + <?php wp_nonce_field( 'wprss-update-feed-items' );
    76
    + submit_button( __( 'Update all feeds', 'wprss' ), 'primary', 'update-feeds', true ); ?>
    77
    +
    78
    + </form>
    79
    +
    80
    + <h3><?php _e( 'Delete and Re-import Feeds', 'wprss' ); ?></h3>
    81
    + <p><?php _e( 'Click the red button to delete all imported feed items and re-import them.', 'wprss' ); ?></p>
    82
    + <p><?php _e( '<em><strong>Note:</strong> This is a server-intensive process and should only be used when instructed to by support staff.</em>', 'wprss' ); ?></p>
    83
    +
    84
    + <form action="edit.php?post_type=wprss_feed&page=wprss-debugging" method="post">
    85
    +
    86
    + <?php wp_nonce_field( 'wprss-delete-import-feed-items' );
    87
    + submit_button( __( 'Delete and Re-import all feeds', 'wprss' ), 'button-red', 'reimport-feeds', true ); ?>
    88
    +
    89
    + </form>
    90
    + <?php wprss_system_info(); ?>
    91
    + </div>
    92
    + <?php
    93
    + }
    94
    +
    95
    + /**
    96
    + * Output admin notice that feeds have been updated successfully
    97
    + *
    98
    + * @since 3.0
    99
    + */
    100
    + function wprss_debugging_admin_notice_update_feeds() {
    101
    + echo '<div class="updated"><p>Feeds are being updated in the background.</p></div>';
    102
    + }
    103
    +
    104
    + /**
    105
    + * Output admin notice that feeds have been deleted and re-imported successfully
    106
    + *
    107
    + * @since 3.0
    108
    + */
    109
    + function wprss_debugging_admin_notice_reimport_feeds() {
    110
    + echo '<div class="updated"><p>Feeds deleted and are being re-imported in the background.</p></div>';
    111
    + }
    includes/admin-display.php ADDED
    @@ -0,0 +1,284 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + add_filter( 'manage_edit-wprss_feed_columns', 'wprss_set_feed_custom_columns');
    4
    + /**
    5
    + * Set up the custom columns for the wprss_feed list
    6
    + *
    7
    + * @since 2.0
    8
    + */
    9
    + function wprss_set_feed_custom_columns( $columns ) {
    10
    +
    11
    + $columns = array(
    12
    + 'cb' => '<input type="checkbox" />',
    13
    + 'title' => __( 'Name', 'wprss' ),
    14
    + 'url' => __( 'URL', 'wprss' ),
    15
    + 'description' => __( 'Description', 'wprss' )
    16
    + );
    17
    + $columns = apply_filters( 'wprss_set_feed_custom_columns', $columns );
    18
    + $columns['id'] = __( 'ID', 'wprss' );
    19
    + return $columns;
    20
    + }
    21
    +
    22
    +
    23
    + add_action( "manage_wprss_feed_posts_custom_column", "wprss_show_custom_columns", 10, 2 );
    24
    + /**
    25
    + * Show up the custom columns for the wprss_feed list
    26
    + *
    27
    + * @since 2.0
    28
    + */
    29
    + function wprss_show_custom_columns( $column, $post_id ) {
    30
    +
    31
    + switch ( $column ) {
    32
    + case 'url':
    33
    + $url = get_post_meta( $post_id, 'wprss_url', true);
    34
    + echo '<a href="' . esc_url($url) . '">' . esc_url($url) . '</a>';
    35
    + break;
    36
    + case 'description':
    37
    + $description = get_post_meta( $post_id, 'wprss_description', true);
    38
    + echo esc_html( $description );
    39
    + break;
    40
    + case 'id':
    41
    + echo esc_html( $post_id );
    42
    + break;
    43
    + }
    44
    + }
    45
    +
    46
    +
    47
    + /**
    48
    + * Make the custom columns sortable for wprss_feed post type
    49
    + *
    50
    + * @since 2.0
    51
    + */
    52
    + function wprss_feed_sortable_columns() {
    53
    + $sortable_columns = array(
    54
    + // meta column id => sortby value used in query
    55
    + 'title' => 'title',
    56
    + );
    57
    + return apply_filters( 'wprss_feed_sortable_columns', $sortable_columns );
    58
    + }
    59
    +
    60
    +
    61
    + add_action( 'pre_get_posts', 'wprss_feed_source_order' );
    62
    + /**
    63
    + * Change order of feed sources to alphabetical ascending according to feed name
    64
    + *
    65
    + * @since 2.2
    66
    + */
    67
    + function wprss_feed_source_order( $query ) {
    68
    + if ( ! is_admin() ) {
    69
    + return;
    70
    + }
    71
    +
    72
    + $post_type = $query->get('post_type');
    73
    +
    74
    + if ( $post_type == 'wprss_feed' ) {
    75
    + /* Post Column: e.g. title */
    76
    + if ( $query->get( 'orderby' ) == '' ) {
    77
    + $query->set( 'orderby', 'title' );
    78
    + }
    79
    + /* Post Order: ASC / DESC */
    80
    + if( $query->get( 'order' ) == '' ){
    81
    + $query->set( 'order', 'ASC' );
    82
    + }
    83
    + }
    84
    + }
    85
    +
    86
    +
    87
    + add_filter( 'manage_edit-wprss_feed_item_columns', 'wprss_set_feed_item_custom_columns');
    88
    + /**
    89
    + * Set up the custom columns for the wprss_feed source list
    90
    + *
    91
    + * @since 2.0
    92
    + */
    93
    + function wprss_set_feed_item_custom_columns( $columns ) {
    94
    +
    95
    + $columns = array (
    96
    + 'cb' => '<input type="checkbox" />',
    97
    + 'title' => __( 'Name', 'wprss' ),
    98
    + 'permalink' => __( 'Permalink', 'wprss' ),
    99
    + 'publishdate' => __( 'Date published', 'wprss' ),
    100
    + 'source' => __( 'Source', 'wprss' )
    101
    + );
    102
    + return apply_filters( 'wprss_set_feed_item_custom_columns', $columns );
    103
    + }
    104
    +
    105
    +
    106
    + add_action( "manage_wprss_feed_item_posts_custom_column", "wprss_show_feed_item_custom_columns", 10, 2 );
    107
    + /**
    108
    + * Show up the custom columns for the wprss_feed list
    109
    + *
    110
    + * @since 2.0
    111
    + */
    112
    + function wprss_show_feed_item_custom_columns( $column, $post_id ) {
    113
    +
    114
    + switch ( $column ) {
    115
    + case "permalink":
    116
    + $url = get_post_meta( $post_id, 'wprss_item_permalink', true);
    117
    + echo '<a href="' . $url . '">' . $url. '</a>';
    118
    + break;
    119
    +
    120
    + case "publishdate":
    121
    + $publishdate = date( 'Y-m-d H:i:s', get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) ;
    122
    + echo $publishdate;
    123
    + break;
    124
    +
    125
    + case "source":
    126
    + $query = new WP_Query();
    127
    + $source = '<a href="' . get_edit_post_link( get_post_meta( $post_id, 'wprss_feed_id', true ) ) . '">' . get_the_title( get_post_meta( $post_id, 'wprss_feed_id', true ) ) . '</a>';
    128
    + echo $source;
    129
    + break;
    130
    + }
    131
    + }
    132
    +
    133
    +
    134
    + add_filter( "manage_edit-wprss_feed_item_sortable_columns", "wprss_feed_item_sortable_columns" );
    135
    + /**
    136
    + * Make the custom columns sortable
    137
    + *
    138
    + * @since 2.0
    139
    + */
    140
    + function wprss_feed_item_sortable_columns() {
    141
    + $sortable_columns = array(
    142
    + // meta column id => sortby value used in query
    143
    + 'publishdate' => 'publishdate',
    144
    + 'source' => 'source'
    145
    + );
    146
    + return apply_filters( 'wprss_feed_item_sortable_columns', $sortable_columns );
    147
    + }
    148
    +
    149
    +
    150
    + add_action( 'pre_get_posts', 'wprss_feed_item_orderby' );
    151
    + /**
    152
    + * Change ordering of posts on wprss_feed_item screen
    153
    + *
    154
    + * @since 2.0
    155
    + */
    156
    + function wprss_feed_item_orderby( $query ) {
    157
    + if( ! is_admin() )
    158
    + return;
    159
    +
    160
    + $post_type = $query->get('post_type');
    161
    +
    162
    + // If we're on the feed listing admin page
    163
    + if ( $post_type == 'wprss_feed_item') {
    164
    + // Set general orderby to date the feed item was published
    165
    + $query->set('orderby','publishdate');
    166
    + // If user clicks on the reorder link, implement reordering
    167
    + $orderby = $query->get( 'orderby');
    168
    + if( 'publishdate' == $orderby ) {
    169
    + $query->set( 'meta_key', 'wprss_item_date' );
    170
    + $query->set( 'orderby', 'meta_value_num' );
    171
    + }
    172
    + }
    173
    + }
    174
    +
    175
    +
    176
    + add_filter( 'post_updated_messages', 'wprss_feed_updated_messages' );
    177
    + /**
    178
    + * Change default notification message when new feed is added or updated
    179
    + *
    180
    + * @since 2.0
    181
    + */
    182
    + function wprss_feed_updated_messages( $messages ) {
    183
    + global $post, $post_ID;
    184
    +
    185
    + $messages[ 'wprss_feed' ] = array(
    186
    + 0 => '', // Unused. Messages start at index 1.
    187
    + 1 => __( 'Feed source updated. ', 'wprss' ),
    188
    + 2 => __( 'Custom field updated.', 'wprss' ),
    189
    + 3 => __( 'Custom field deleted.', 'wprss' ),
    190
    + 4 => __( 'Feed source updated.', 'wprss' ),
    191
    + 5 => '',
    192
    + 6 => __( 'Feed source saved.', 'wprss' ),
    193
    + 7 => __( 'Feed source saved.', 'wprss' ),
    194
    + 8 => __( 'Feed source submitted.', 'wprss' ),
    195
    + 9 => '',
    196
    + 10 => __( 'Feed source updated.', 'wprss' )
    197
    + );
    198
    +
    199
    + return apply_filters( 'wprss_feed_updated_messages', $messages );
    200
    + }
    201
    +
    202
    +
    203
    + add_filter( 'post_row_actions', 'wprss_remove_row_actions', 10, 1 );
    204
    + /**
    205
    + * Remove actions row for imported feed items, we don't want them to be editable or viewable
    206
    + *
    207
    + * @since 2.0
    208
    + */
    209
    + function wprss_remove_row_actions( $actions )
    210
    + {
    211
    + if ( get_post_type() === 'wprss_feed_item' ) {
    212
    + unset( $actions[ 'edit' ] );
    213
    + unset( $actions[ 'view' ] );
    214
    + //unset( $actions[ 'trash' ] );
    215
    + unset( $actions[ 'inline hide-if-no-js' ] );
    216
    + }
    217
    + elseif ( get_post_type() === 'wprss_feed' ) {
    218
    + unset( $actions[ 'view'] );
    219
    + if ( get_post_status( get_the_ID() ) !== 'trash' ) {
    220
    + $actions[ 'fetch' ] = '<a href="javascript:;" class="wprss_ajax_action" pid="'. get_the_ID() .'" purl="'.home_url().'/wp-admin/admin-ajax.php" title="'. esc_attr( __( 'Fetch Latest Feed Items', 'wprss' ) ) .'" >' . __( 'Fetch Latest Feed Items', 'wprss' ) . '</a>';
    221
    + }
    222
    + }
    223
    + return apply_filters( 'wprss_remove_row_actions', $actions );
    224
    + }
    225
    +
    226
    +
    227
    + add_action( 'wp_ajax_wprss_fetch_feeds_action', 'wprss_fetch_feeds_action_hook' );
    228
    + /**
    229
    + * The AJAX function for the 'Fetch Feed Items' row action on the
    230
    + * 'All Feed Sources' page.
    231
    + *
    232
    + * @since 3.3
    233
    + */
    234
    + function wprss_fetch_feeds_action_hook() {
    235
    + if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
    236
    + wprss_fetch_insert_single_feed_items( $_POST['id'] );
    237
    + die();
    238
    + }
    239
    + }
    240
    +
    241
    +
    242
    + add_filter( 'bulk_actions-edit-wprss_feed_item', 'wprss_custom_feed_item_bulk_actions' );
    243
    + /**
    244
    + * Remove bulk action link to edit imported feed items
    245
    + *
    246
    + * @since 2.0
    247
    + */
    248
    + function wprss_custom_feed_item_bulk_actions( $actions ){
    249
    + unset( $actions[ 'edit' ] );
    250
    + return apply_filters( 'wprss_custom_feed_item_bulk_actions', $actions );
    251
    + }
    252
    +
    253
    +
    254
    + add_action( 'admin_footer-edit.php', 'wprss_remove_a_from_feed_title' );
    255
    + /**
    256
    + * Remove hyperlink from imported feed titles in list posts screen
    257
    + *
    258
    + * @since 2.0
    259
    + */
    260
    + function wprss_remove_a_from_feed_title() {
    261
    + if ( 'edit-wprss_feed_item' !== get_current_screen()->id )
    262
    + return;
    263
    + ?>
    264
    +
    265
    + <script type="text/javascript">
    266
    + jQuery('table.wp-list-table a.row-title').contents().unwrap();
    267
    + </script>
    268
    + <?php
    269
    + }
    270
    +
    271
    +
    272
    + add_filter( 'gettext', 'wprss_change_publish_button_text', 10, 2 );
    273
    + /**
    274
    + * Modify 'Publish' button text when adding a new feed source
    275
    + *
    276
    + * @since 2.0
    277
    + */
    278
    + function wprss_change_publish_button_text( $translation, $text ) {
    279
    + if ( 'wprss_feed' == get_post_type()) {
    280
    + if ( $text == 'Publish' )
    281
    + return __( 'Publish Feed', 'wprss' );
    282
    + }
    283
    + return apply_filters( 'wprss_change_publish_button_text', $translation );
    284
    + }
    includes/admin-editor.php ADDED
    @@ -0,0 +1,60 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * This file contains code related to the custom button added to Wordpress' TinyMCE editor.
    4
    + *
    5
    + * @since 3.5
    6
    + */
    7
    +
    8
    +
    9
    +
    10
    + add_action('init', 'wprss_add_editor_button');
    11
    + /**
    12
    + * Adds the WPRSS button to WordPress' editor
    13
    + *
    14
    + * @since 3.5
    15
    + */
    16
    + function wprss_add_editor_button() {
    17
    + if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) )
    18
    + return;
    19
    + if ( get_user_option( 'rich_editing' ) == 'true') {
    20
    + add_filter('mce_external_plugins', 'wprss_register_tinymce_plugin');
    21
    + add_filter('mce_buttons', 'wprss_register_tinymce_button');
    22
    + }
    23
    + }
    24
    +
    25
    +
    26
    + /**
    27
    + * Adds a separator and the wprss button to the buttons array.
    28
    + *
    29
    + * @since 3.5
    30
    + */
    31
    + function wprss_register_tinymce_button($buttons) {
    32
    + array_push( $buttons, "|", "wprss" );
    33
    + return $buttons;
    34
    + }
    35
    +
    36
    +
    37
    + /**
    38
    + * Adds the button action JS file to TinyMCE's plugin list
    39
    + *
    40
    + * @since 3.5
    41
    + */
    42
    + function wprss_register_tinymce_plugin($plugin_array) {
    43
    + $plugin_array['wprss'] = WPRSS_JS . 'editor.js';
    44
    + return $plugin_array;
    45
    + }
    46
    +
    47
    +
    48
    + add_filter( 'tiny_mce_version', 'wprss_tinymce_version');
    49
    + /**
    50
    + * Intercepts TinyMCE's version check and increments its version by 3.
    51
    + *
    52
    + * This is a hack used to work around TinyMCE's caching, that might prevent the
    53
    + * new wprss button from appearing on the editor.
    54
    + *
    55
    + * @since 3.5
    56
    + */
    57
    + function wprss_tinymce_version($ver) {
    58
    + $ver += 3;
    59
    + return $ver;
    60
    + }
    includes/admin-import-export.php ADDED
    @@ -0,0 +1,162 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Build the import/export settings page, used to import and export the plugin's settings
    4
    + * Based on http://wp.tutsplus.com/tutorials/creative-coding/creating-a-simple-backuprestore-settings-feature/
    5
    + *
    6
    + * @since 3.1
    7
    + */
    8
    +
    9
    +
    10
    + add_action( 'admin_init', 'wp_rss_aggregator_export', 1 );
    11
    +
    12
    + /**
    13
    + * Handles exporting of aggregator settings
    14
    + *
    15
    + * @since 3.1
    16
    + */
    17
    + function wp_rss_aggregator_export() {
    18
    + if ( isset( $_POST['export'] ) && check_admin_referer( 'wprss-settings-export' ) ) {
    19
    + $blogname = str_replace( " ", "", get_option( 'blogname' ) );
    20
    + $date = date( "m-d-Y" );
    21
    + $json_name = $blogname . "-" . $date; // Naming the filename that will be generated.
    22
    +
    23
    + header( 'Content-Description: File Transfer' );
    24
    + header( "Content-Type: text/json; charset=" . get_option( 'blog_charset' ) );
    25
    + header( "Content-Disposition: attachment; filename=$json_name.json" );
    26
    + wp_rss_set_export_data();
    27
    + die();
    28
    + }
    29
    + }
    30
    +
    31
    +
    32
    + /**
    33
    + * Gathers relevant options, encodes them in Json and echoes the file
    34
    + *
    35
    + * @since 3.1
    36
    + */
    37
    + function wp_rss_set_export_data() {
    38
    + $options = apply_filters(
    39
    + 'wprss_fields_export',
    40
    + array( 'wprss_settings_general' => get_option( 'wprss_settings_general' ) )
    41
    + );
    42
    + $json_file = json_encode( $options );
    43
    +
    44
    + foreach ( $options as $key => $value ) {
    45
    + $value = maybe_unserialize( $value );
    46
    + $need_options[ $key ] = $value;
    47
    + }
    48
    + $json_file = json_encode( $need_options ); // Encode data into json data
    49
    + echo $json_file;
    50
    + die();
    51
    + }
    52
    +
    53
    +
    54
    + /**
    55
    + * Notice for a successful export
    56
    + *
    57
    + * @since 3.1
    58
    + */
    59
    + function wp_rss_aggregator_export_notice() {
    60
    + echo '<div class="updated"><p>All options are export successfully.</p></div>';
    61
    +
    62
    + }
    63
    +
    64
    +
    65
    + /**
    66
    + * Notice for a successful import
    67
    + *
    68
    + * @since 3.1
    69
    + */
    70
    + function wp_rss_aggregator_import_notice1() {
    71
    + echo '<div class="updated"><p>' . __( 'All options are restored successfully.', 'wprss' ) . '</p></div>';
    72
    +
    73
    + }
    74
    +
    75
    +
    76
    + /**
    77
    + * Notice for an unsuccessful import
    78
    + *
    79
    + * @since 3.1
    80
    + */
    81
    + function wp_rss_aggregator_import_notice2() {
    82
    + echo '<div class="error"><p>' . __( 'Invalid file or file size too big.', 'wprss' ) . '</p></div>';
    83
    +
    84
    + }
    85
    +
    86
    +
    87
    + add_action( 'admin_init', 'wp_rss_aggregator_import' );
    88
    + /**
    89
    + * Handles the importing of settings
    90
    + *
    91
    + * @since 3.1
    92
    + */
    93
    + function wp_rss_aggregator_import(){
    94
    + global $pagenow;
    95
    + if( $pagenow == 'admin.php' ) {
    96
    + //Hope this plugin don't use admin.php for anything
    97
    + return;
    98
    + }
    99
    + if ( isset( $_FILES['import'] ) && check_admin_referer( 'wprss-settings-import' ) ) {
    100
    + if ( $_FILES['import']['error'] > 0) {
    101
    + wp_die( "Error during import" );
    102
    + } else {
    103
    + $file_name = $_FILES['import']['name'];
    104
    + $file_ext = strtolower( end( explode( ".", $file_name ) ) );
    105
    + $file_size = $_FILES['import']['size'];
    106
    + if ( ( $file_ext == "json" ) && ( $file_size < 500000 ) ) {
    107
    + $encode_options = file_get_contents( $_FILES['import']['tmp_name'] );
    108
    + $options = json_decode( $encode_options, true );
    109
    + foreach ( $options as $key => $value ) {
    110
    + update_option( $key, $value );
    111
    + }
    112
    + add_action( 'admin_notices', 'wp_rss_aggregator_import_notice1' );
    113
    + }
    114
    + else {
    115
    + add_action( 'admin_notices', 'wp_rss_aggregator_import_notice2' );
    116
    + }
    117
    + }
    118
    + }
    119
    + }
    120
    +
    121
    +
    122
    + /**
    123
    + * Handles the import/export page display
    124
    + *
    125
    + * @since 3.1
    126
    + */
    127
    + function wprss_import_export_settings_page_display() {
    128
    + if ( !isset( $_POST['export'] ) ) { ?>
    129
    + <div class="wrap">
    130
    + <?php screen_icon( 'wprss-aggregator' ); ?>
    131
    + <h2><?php _e( 'Import & Export Settings', 'wprss' ); ?></h2>
    132
    +
    133
    + <h3><?php _e( 'Export Settings', 'wprss' ); ?></h3>
    134
    + <p><?php _e( 'Click the <strong>Export Settings</strong> button to generate a file containing all the settings used by WP RSS Aggregator', 'wprss' ); ?></p>
    135
    + <p><?php _e( 'After exporting, you can either use the backup file to restore your settings to this site or to another WordPress site.</p>', 'wprss' ); ?></p>
    136
    + <form method="post">
    137
    + <p class="submit">
    138
    + <?php wp_nonce_field( 'wprss-settings-export' ); ?>
    139
    + <input type="submit" name="export" value="<?php _e( 'Export Settings', 'wprss' ); ?>" class="button" />
    140
    + </p>
    141
    + </form>
    142
    +
    143
    + <h3><?php _e( 'Import Settings', 'wprss' ); ?></h3>
    144
    + <p><?php _e( 'Click the <strong>Choose file</strong> button and choose a backup file.', 'wprss' ); ?></p>
    145
    + <p><?php _e( 'Press the <strong>Import Settings</strong> button, and WordPress will do the rest for you.', 'wprss' ); ?></p>
    146
    + <form method='post' enctype='multipart/form-data'>
    147
    + <p class="submit">
    148
    + <?php wp_nonce_field( 'wprss-settings-import' ); ?>
    149
    + <input type='file' name='import' />
    150
    + <input type='submit' name='import' value="<?php _e( 'Import Settings', 'wprss' ); ?>" class="button" />
    151
    + </p>
    152
    + </form>
    153
    +
    154
    + <h3><?php _e( 'Importing/Exporting Feed Sources', 'wprss' ); ?></h3>
    155
    + <p><?php _e( 'To import/export your feed sources, please use the standard WordPress <a href="' . get_admin_url() . 'import.php">Import</a> and <a href="' . get_admin_url() . 'export.php">Export</a> functionality.', 'wprss' ); ?></p>
    156
    + <p><?php _e( 'On the <a href="' . get_admin_url() . 'export.php">Export</a> page, check the <strong>Feed Sources</strong> radio button and click the <strong>Download Export File</strong> button. WordPress will then create an XML file containing all the feed sources.', 'wprss' ); ?></p>
    157
    + <p><?php _e( 'On the <a href="' . get_admin_url() . 'import.php">Import</a> page, choose the previously created file and click the <strong>Upload file and import</strong> button.', 'wprss' ); ?></p>
    158
    +
    159
    + </div>
    160
    + <?php
    161
    + }
    162
    + }
    includes/admin-metaboxes.php ADDED
    @@ -0,0 +1,353 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + add_action( 'add_meta_boxes', 'wprss_add_meta_boxes');
    4
    + /**
    5
    + * Set up the input boxes for the wprss_feed post type
    6
    + *
    7
    + * @since 2.0
    8
    + */
    9
    + function wprss_add_meta_boxes() {
    10
    + global $wprss_meta_fields;
    11
    +
    12
    + // Remove the default WordPress Publish box, because we will be using custom ones
    13
    + remove_meta_box( 'submitdiv', 'wprss_feed', 'side' );
    14
    +
    15
    + add_meta_box(
    16
    + 'submitdiv', // $id
    17
    + __( 'Save Feed Source', 'wprss' ), // $title
    18
    + 'post_submit_meta_box', // $callback
    19
    + 'wprss_feed', // $page
    20
    + 'side', // $context
    21
    + 'high' // $priority
    22
    + );
    23
    +
    24
    + add_meta_box(
    25
    + 'custom_meta_box',
    26
    + __( 'Feed Source Details', 'wprss' ),
    27
    + 'wprss_show_meta_box_callback',
    28
    + 'wprss_feed',
    29
    + 'normal',
    30
    + 'high'
    31
    + );
    32
    +
    33
    + add_meta_box(
    34
    + 'wprss-help-meta',
    35
    + __( 'WP RSS Aggregator Help', 'wprss' ),
    36
    + 'wprss_help_meta_box_callback',
    37
    + 'wprss_feed',
    38
    + 'side',
    39
    + 'low'
    40
    + );
    41
    +
    42
    + add_meta_box(
    43
    + 'wprss-like-meta',
    44
    + __( 'Like this plugin?', 'wprss' ),
    45
    + 'wprss_like_meta_box_callback',
    46
    + 'wprss_feed',
    47
    + 'side',
    48
    + 'low'
    49
    + );
    50
    +
    51
    + add_meta_box(
    52
    + 'wprss-follow-meta',
    53
    + __( 'Follow us', 'wprss' ),
    54
    + 'wprss_follow_meta_box_callback',
    55
    + 'wprss_feed',
    56
    + 'side',
    57
    + 'low'
    58
    + );
    59
    +
    60
    + add_meta_box(
    61
    + 'preview_meta_box',
    62
    + __( 'Feed Preview', 'wprss' ),
    63
    + 'wprss_preview_meta_box_callback',
    64
    + 'wprss_feed',
    65
    + 'normal',
    66
    + 'low'
    67
    + );
    68
    + }
    69
    +
    70
    +
    71
    + /**
    72
    + * Set up fields for the meta box for the wprss_feed post type
    73
    + *
    74
    + * @since 2.0
    75
    + */
    76
    + function wprss_get_custom_fields() {
    77
    + $prefix = 'wprss_';
    78
    +
    79
    + // Field Array
    80
    + $wprss_meta_fields[ 'url' ] = array(
    81
    + 'label' => __( 'URL', 'wprss' ),
    82
    + 'desc' => __( 'Enter feed URL (including http://)', 'wprss' ),
    83
    + 'id' => $prefix .'url',
    84
    + 'type' => 'text'
    85
    + );
    86
    +
    87
    + $wprss_meta_fields[ 'description' ] = array(
    88
    + 'label' => __( 'Description', 'wprss' ),
    89
    + 'desc' => __( 'A short description about this feed source (optional)', 'wprss' ),
    90
    + 'id' => $prefix .'description',
    91
    + 'type' => 'textarea'
    92
    + );
    93
    +
    94
    + $wprss_meta_fields[ 'limit' ] = array(
    95
    + 'label' => __( 'Limit', 'wprss' ),
    96
    + 'desc' => __( 'Enter a feed item import/display limit. Leave blank to use the default setting.', 'wprss' ),
    97
    + 'id' => $prefix . 'limit',
    98
    + 'type' => 'number'
    99
    + );
    100
    +
    101
    + // for extensibility, allows more meta fields to be added
    102
    + return apply_filters( 'wprss_fields', $wprss_meta_fields );
    103
    + }
    104
    +
    105
    +
    106
    + /**
    107
    + * Set up the meta box for the wprss_feed post type
    108
    + *
    109
    + * @since 2.0
    110
    + */
    111
    + function wprss_show_meta_box_callback() {
    112
    + global $post;
    113
    + $meta_fields = wprss_get_custom_fields();
    114
    +
    115
    + // Use nonce for verification
    116
    + wp_nonce_field( basename( __FILE__ ), 'wprss_meta_box_nonce' );
    117
    +
    118
    + // Begin the field table and loop
    119
    + echo '<table class="form-table">';
    120
    +
    121
    + foreach ( $meta_fields as $field ) {
    122
    +
    123
    + // get value of this field if it exists for this post
    124
    + $meta = get_post_meta( $post->ID, $field['id'], true );
    125
    + // begin a table row with
    126
    + echo '<tr>
    127
    + <th><label for="' . $field['id'] . '">' . $field['label'] . '</label></th>
    128
    + <td>';
    129
    +
    130
    + switch( $field['type'] ) {
    131
    +
    132
    + // text
    133
    + case 'text':
    134
    + echo '<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'. esc_attr( $meta ) .'" size="55" />
    135
    + <br><span class="description">'.$field['desc'].'</span>';
    136
    + break;
    137
    +
    138
    + // textarea
    139
    + case 'textarea':
    140
    + echo '<textarea name="'.$field['id'].'" id="'.$field['id'].'" cols="60" rows="4">'. esc_attr( $meta ) .'</textarea>
    141
    + <br><span class="description">'.$field['desc'].'</span>';
    142
    + break;
    143
    +
    144
    + // checkbox
    145
    + case 'checkbox':
    146
    + echo '<input type="checkbox" name="'.$field['id'].'" id="'.$field['id'].'" ', esc_attr( $meta ) ? ' checked="checked"' : '','/>
    147
    + <label for="'.$field['id'].'">'.$field['desc'].'</label>';
    148
    + break;
    149
    +
    150
    + // select
    151
    + case 'select':
    152
    + echo '<select name="'.$field['id'].'" id="'.$field['id'].'">';
    153
    + foreach ($field['options'] as $option) {
    154
    + echo '<option', $meta == $option['value'] ? ' selected="selected"' : '', ' value="'.$option['value'].'">'.$option['label'].'</option>';
    155
    + }
    156
    + echo '</select><br><span class="description">'.$field['desc'].'</span>';
    157
    + break;
    158
    +
    159
    + // number
    160
    + case 'number':
    161
    + echo '<input class="wprss-number-roller" type="number" placeholder="Default" min="0" name="'.$field['id'].'" id="'.$field['id'].'" value="'.esc_attr( $meta ).'" />
    162
    + <label for="'.$field['id'].'"><span class="description">'.$field['desc'].'</span></label>';
    163
    +
    164
    + break;
    165
    +
    166
    + } //end switch
    167
    + echo '</td></tr>';
    168
    + } // end foreach
    169
    + echo '</table>'; // end table
    170
    + }
    171
    +
    172
    +
    173
    + add_action( 'save_post', 'wprss_save_custom_fields', 10, 2 );
    174
    + /**
    175
    + * Save the custom fields
    176
    + *
    177
    + * @since 2.0
    178
    + */
    179
    + function wprss_save_custom_fields( $post_id, $post ) {
    180
    + $meta_fields = wprss_get_custom_fields();
    181
    +
    182
    + /* Verify the nonce before proceeding. */
    183
    + if ( !isset( $_POST['wprss_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['wprss_meta_box_nonce'], basename( __FILE__ ) ) )
    184
    + return $post_id;
    185
    +
    186
    + /* Get the post type object. */
    187
    + $post_type = get_post_type_object( $post->post_type );
    188
    +
    189
    + /* Check if the current user has permission to edit the post. */
    190
    + if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
    191
    + return $post_id;
    192
    +
    193
    + /* // Stop WP from clearing custom fields on autosave - maybe not needed
    194
    + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
    195
    + return;
    196
    +
    197
    + // Prevent quick edit from clearing custom fields - maybe not needed
    198
    + if (defined('DOING_AJAX') && DOING_AJAX)
    199
    + return; */
    200
    +
    201
    + /** Bail out if running an autosave, ajax or a cron */
    202
    + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
    203
    + return;
    204
    + if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
    205
    + return;
    206
    + if ( defined( 'DOING_CRON' ) && DOING_CRON )
    207
    + return;
    208
    +
    209
    + // loop through fields and save the data
    210
    + foreach ( $meta_fields as $field ) {
    211
    + $old = get_post_meta( $post_id, $field[ 'id' ], true );
    212
    + $new = $_POST[ $field[ 'id' ] ];
    213
    + if ( $new && $new != $old ) {
    214
    + update_post_meta( $post_id, $field[ 'id' ], $new );
    215
    + } elseif ( '' == $new && $old ) {
    216
    + delete_post_meta( $post_id, $field[ 'id' ], $old );
    217
    + }
    218
    + } // end foreach
    219
    +
    220
    + wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( $post_id ) );
    221
    + }
    222
    +
    223
    +
    224
    + /**
    225
    + * Generate a preview of the latest 5 posts from the feed source being added/edited
    226
    + *
    227
    + * @since 2.0
    228
    + */
    229
    + function wprss_preview_meta_box_callback() {
    230
    + global $post;
    231
    + $feed_url = get_post_meta( $post->ID, 'wprss_url', true );
    232
    +
    233
    + if( ! empty( $feed_url ) ) {
    234
    + $feed = fetch_feed( $feed_url );
    235
    + if ( ! is_wp_error( $feed ) ) {
    236
    + $items = $feed->get_items();
    237
    + // Figure out how many total items there are, but limit it to 5.
    238
    + $maxitems = $feed->get_item_quantity(5);
    239
    +
    240
    + // Build an array of all the items, starting with element 0 (first element).
    241
    + $items = $feed->get_items( 0, $maxitems );
    242
    + echo '<h4>Latest 5 feeds available from ' . get_the_title() . '</h4>';
    243
    + echo '<ul>';
    244
    + foreach ( $items as $item ) {
    245
    + // Get human date (comment if you want to use non human date)
    246
    + $item_date = human_time_diff( $item->get_date('U'), current_time('timestamp')).' '.__( 'ago', 'rc_mdm' );
    247
    + // Start displaying item content within a <li> tag
    248
    + echo '<li>';
    249
    + // create item link
    250
    + //echo '<a href="'.esc_url( $item->get_permalink() ).'" title="'.$item_date.'">';
    251
    + // Get item title
    252
    + echo esc_html( $item->get_title() );
    253
    + //echo '</a>';
    254
    + // Display date
    255
    + echo ' <div class="rss-date"><small>'.$item_date.'</small></div>';
    256
    + // End <li> tag
    257
    + echo '</li>';
    258
    + }
    259
    + echo '</ul>';
    260
    + }
    261
    + else _e( '<span class="invalid-feed-url"><strong>Invalid feed URL</strong> - Double check the feed source URL setting above.</span>
    262
    + <p>Not sure where to find the RSS feed on a website?
    263
    + <a target="_blank" href="http://webtrends.about.com/od/webfeedsyndicationrss/ss/rss_howto.htm">Click here</a> for a visual guide' , 'wprss' );
    264
    + }
    265
    +
    266
    + else _e( 'No feed URL defined yet', 'wprss' );
    267
    + }
    268
    +
    269
    +
    270
    + /**
    271
    + * Generate Help meta box
    272
    + *
    273
    + * @since 2.0
    274
    + *
    275
    + */
    276
    + function wprss_help_meta_box_callback() {
    277
    + echo '<p><a href="http://www.wprssaggregator.com/documentation/">View the documentation</p>';
    278
    + echo '<p><strong>';
    279
    + _e( 'Need help?', 'wprss' );
    280
    + echo '</strong> <a target="_blank" href="http://wordpress.org/support/plugin/wp-rss-aggregator">';
    281
    + _e( 'Check out the support forum', 'wprss' );
    282
    + echo '</a></p>';
    283
    + echo '</strong> <a target="_blank" href="http://www.wprssaggregator.com/feature-requests/">';
    284
    + _e( 'Suggest a new feature', 'wprss' );
    285
    + echo '</a></p>';
    286
    + }
    287
    +
    288
    + /**
    289
    + * Generate Like this plugin meta box
    290
    + *
    291
    + * @since 2.0
    292
    + *
    293
    + */
    294
    + function wprss_like_meta_box_callback() { ?>
    295
    + <p><?php _e( 'Why not do any or all of the following', 'wprss' ) ?>:</p>
    296
    + <ul>
    297
    + <li><a href="http://wordpress.org/extend/plugins/wp-rss-aggregator/"><?php _e( 'Give it a 5 star rating on WordPress.org.', 'wprss' ) ?></a></li>
    298
    + <li class="donate_link"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ"><?php _e('Donate a token of your appreciation.', 'wprss' ); ?></a></li>
    299
    + </ul>
    300
    + <?php
    301
    + echo '<p><strong>';
    302
    + _e( 'Check out the premium add-ons:', 'wprss' );
    303
    + echo '</strong>'; ?>
    304
    + <ul>
    305
    + <li><a href="http://www.wprssaggregator.com/extension/feed-to-post/"><?php echo 'Feed to Post'; ?></a></li>
    306
    + <li><a href="http://www.wprssaggregator.com/extension/excerpts-thumbnails/"><?php echo 'Excerpts & Thumbnails'; ?></a></li>
    307
    + <li><a href="http://www.wprssaggregator.com/extension/categories/"><?php echo 'Categories'; ?></a></li>
    308
    + <li><a href="http://www.wprssaggregator.com/extension/keyword-filtering/"><?php echo 'Keyword Filtering'; ?></a></li>
    309
    + </ul>
    310
    + </p>
    311
    + <?php }
    312
    +
    313
    +
    314
    + /**
    315
    + * Generate Follow us plugin meta box
    316
    + *
    317
    + * @since 2.0
    318
    + *
    319
    + */
    320
    + function wprss_follow_meta_box_callback() {
    321
    + ?>
    322
    + <ul>
    323
    + <li class="twitter"><a href="http://twitter.com/wpmayor"><?php _e( 'Follow WP Mayor on Twitter.', 'wprss' ) ?></a></li>
    324
    + <li class="facebook"><a href="https://www.facebook.com/wpmayor"><?php _e( 'Like WP Mayor on Facebook.', 'wprss' ) ?></a></li>
    325
    + </ul>
    326
    + <?php }
    327
    +
    328
    +
    329
    + add_action( 'add_meta_boxes', 'wprss_remove_meta_boxes', 100 );
    330
    + /**
    331
    + * Remove unneeded meta boxes from add feed source screen
    332
    + *
    333
    + * @since 2.0
    334
    + */
    335
    + function wprss_remove_meta_boxes() {
    336
    + if ( 'wprss_feed' !== get_current_screen()->id ) return;
    337
    + // Remove meta boxes of other plugins that tend to appear on all posts
    338
    + remove_meta_box( 'wpseo_meta', 'wprss_feed' ,'normal' );
    339
    + remove_meta_box( 'postpsp', 'wprss_feed' ,'normal' );
    340
    + remove_meta_box( 'su_postmeta', 'wprss_feed' ,'normal' );
    341
    + remove_meta_box( 'woothemes-settings', 'wprss_feed' ,'normal' );
    342
    + remove_meta_box( 'wpcf-post-relationship', 'wprss_feed' ,'normal' );
    343
    + remove_meta_box( 'wpar_plugin_meta_box ', 'wprss_feed' ,'normal' );
    344
    + remove_meta_box( 'sharing_meta', 'wprss_feed' ,'advanced' );
    345
    + remove_meta_box( 'content-permissions-meta-box', 'wprss_feed' ,'advanced' );
    346
    + remove_meta_box( 'theme-layouts-post-meta-box', 'wprss_feed' ,'side' );
    347
    + remove_meta_box( 'post-stylesheets', 'wprss_feed' ,'side' );
    348
    + remove_meta_box( 'hybrid-core-post-template', 'wprss_feed' ,'side' );
    349
    + remove_meta_box( 'wpcf-marketing', 'wprss_feed' ,'side' );
    350
    + remove_meta_box( 'trackbacksdiv22', 'wprss_feed' ,'advanced' );
    351
    + remove_meta_box( 'aiosp', 'wprss_feed' ,'advanced' );
    352
    + remove_action( 'post_submitbox_start', 'fpp_post_submitbox_start_action' );
    353
    + }
    includes/admin-options.php ADDED
    @@ -0,0 +1,626 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Plugin settings related functions
    4
    + *
    5
    + * Note: Wording of options and settings is confusing, due to the plugin originally only having
    6
    + * an 'options' page to enter feed sources, and now needing two screens, one for feed sources and one for
    7
    + * general settings. Might implement something cleaner in the future.
    8
    + *
    9
    + * @package WP PRSS Aggregator
    10
    + */
    11
    +
    12
    + add_action( 'admin_init', 'wprss_admin_init' );
    13
    + /**
    14
    + * Register and define options and settings
    15
    + * @since 2.0
    16
    + * @todo add option for cron frequency
    17
    + *
    18
    + * Note: In the future might change to
    19
    + * the way EDD builds the settings pages, cleaner method.
    20
    + */
    21
    + function wprss_admin_init() {
    22
    +
    23
    + register_setting(
    24
    + 'wprss_settings_general', // A settings group name.
    25
    + 'wprss_settings_general', // The name of an option to sanitize and save.
    26
    + 'wprss_settings_general_validate' // A callback function that sanitizes the option's value.
    27
    + );
    28
    +
    29
    + // Licensing of add-ons
    30
    + register_setting(
    31
    + 'wprss_settings_license_keys',
    32
    + 'wprss_settings_license_keys',
    33
    + ''
    34
    + );
    35
    +
    36
    +
    37
    + $sections = apply_filters(
    38
    + 'wprss_settings_sections_array',
    39
    + array(
    40
    + 'general' => __( 'General plugin settings', 'wprss' ),
    41
    + 'display' => __( 'Display settings', 'wprss' ),
    42
    + 'styles' => __( 'Styles', 'wprss' ),
    43
    + )
    44
    + );
    45
    +
    46
    + // Define the settings per section
    47
    + $settings = apply_filters(
    48
    + 'wprss_settings_array',
    49
    + array(
    50
    + 'general' => array(
    51
    + 'limit-feed-items-db' => array(
    52
    + 'label' => __( 'Limit feed items stored', 'wprss' ),
    53
    + 'callback' => 'wprss_setting_limit_feed_items_callback'
    54
    + ),
    55
    + 'limit-feed-items-imported' => array(
    56
    + 'label' => __( 'Limit feed items per feed', 'wprss' ),
    57
    + 'callback' => 'wprss_setting_limit_feed_items_imported_callback'
    58
    + ),
    59
    + 'cron-interval' => array(
    60
    + 'label' => __( 'Cron interval', 'wprss' ),
    61
    + 'callback' => 'wprss_setting_cron_interval_callback'
    62
    + ),
    63
    + 'custom-feed-url' => array(
    64
    + 'label' => __( 'Custom feed URL', 'wprss' ),
    65
    + 'callback' => 'wprss_setings_custom_feed_url_callback'
    66
    + ),
    67
    + 'custom-feed-limit' => array(
    68
    + 'label' => __( 'Custom feed limit', 'wprss' ),
    69
    + 'callback' => 'wprss_setings_custom_feed_limit_callback'
    70
    + ),
    71
    + ),
    72
    +
    73
    + 'display' => array(
    74
    + 'open-dd' => array(
    75
    + 'label' => __( 'Open links behaviour', 'wprss' ),
    76
    + 'callback' => 'wprss_setting_open_dd_callback'
    77
    + ),
    78
    + 'follow-dd' => array(
    79
    + 'label' => __( 'Set links as', 'wprss' ),
    80
    + 'callback' => 'wprss_setting_follow_dd_callback'
    81
    + ),
    82
    + 'video-links' => array(
    83
    + 'label' => __( 'For video feed items use', 'wprss' ),
    84
    + 'callback' => 'wprss_setting_video_links_callback'
    85
    + ),
    86
    + 'feed-limit' => array(
    87
    + 'label' => __( 'Feed display limit', 'wprss' ),
    88
    + 'callback' => 'wprss_setting_feed_limit_callback'
    89
    + ),
    90
    + 'date-enable' => array(
    91
    + 'label' => __( 'Show Date', 'wprss' ),
    92
    + 'callback' => 'wprss_setting_date_enable_callback'
    93
    + ),
    94
    + 'date-format' => array(
    95
    + 'label' => __( 'Date format', 'wprss' ),
    96
    + 'callback' => 'wprss_setting_date_format_callback'
    97
    + ),
    98
    + 'text-preceding-date' => array(
    99
    + 'label' => __( 'Text preceding date', 'wprss' ),
    100
    + 'callback' => 'wprss_setting_text_preceding_date_callback'
    101
    + ),
    102
    +
    103
    + 'link-enable' => array(
    104
    + 'label' => __( 'Link Title', 'wprss' ),
    105
    + 'callback' => 'wprss_setting_title_link_callback'
    106
    + ),
    107
    + 'source-enable' => array(
    108
    + 'label' => __( 'Show source', 'wprss' ),
    109
    + 'callback' => 'wprss_setting_source_enable_callback'
    110
    + ),
    111
    + 'source-link' => array(
    112
    + 'label' => __( 'Link source', 'wprss' ),
    113
    + 'callback' => 'wprss_setting_source_link_callback'
    114
    + ),
    115
    + 'text-preceding-source' => array(
    116
    + 'label' => __( 'Text preceding source', 'wprss' ),
    117
    + 'callback' => 'wprss_setting_text_preceding_source_callback'
    118
    + ),
    119
    + ),
    120
    +
    121
    + 'styles' => array(
    122
    + 'styles-disable' => array(
    123
    + 'label' => __( 'Disable Styles', 'wprss' ),
    124
    + 'callback' => 'wprss_setting_styles_disable_callback'
    125
    + )
    126
    + )
    127
    + )
    128
    + );
    129
    +
    130
    +
    131
    + // Loop through each setting field and register it
    132
    + foreach( $settings as $section => $fields ) {
    133
    + if ( count( $fields ) > 0 ) {
    134
    + $section_desc = $sections[ $section ];
    135
    + add_settings_section(
    136
    + "wprss_settings_${section}_section",
    137
    + $section_desc,
    138
    + "wprss_settings_${section}_callback",
    139
    + 'wprss_settings_general'
    140
    + );
    141
    +
    142
    + foreach ( $fields as $id => $data ) {
    143
    +
    144
    + add_settings_field(
    145
    + 'wprss-settings-' . $id,
    146
    + $data['label'],
    147
    + $data['callback'],
    148
    + 'wprss_settings_general',
    149
    + "wprss_settings_${section}_section"
    150
    + );
    151
    +
    152
    + }
    153
    + }
    154
    + }
    155
    +
    156
    + do_action( 'wprss_admin_init' );
    157
    + }
    158
    +
    159
    +
    160
    + /**
    161
    + * Build the plugin settings page, used to save general settings like whether a link should be follow or no follow
    162
    + * @since 1.1
    163
    + */
    164
    + function wprss_settings_page_display() {
    165
    + ?>
    166
    + <div class="wrap">
    167
    + <?php screen_icon( 'wprss-aggregator' ); ?>
    168
    +
    169
    + <h2><?php _e( 'WP RSS Aggregator Settings', 'wprss' ); ?></h2>
    170
    +
    171
    + <?php settings_errors(); ?>
    172
    +
    173
    + <?php $active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general_settings'; ?>
    174
    +
    175
    + <?php
    176
    +
    177
    + $default_tabs = array(
    178
    + 'general' => array(
    179
    + 'label' => __( 'General', 'wprss' ),
    180
    + 'slug' => 'general_settings',
    181
    + ),
    182
    + 'licenses' => array(
    183
    + 'label' => __( 'Licenses', 'wprss' ),
    184
    + 'slug' => 'licenses_settings'
    185
    + )
    186
    + );
    187
    +
    188
    + $addon_tabs = apply_filters( 'wprss_options_tabs', array() );
    189
    +
    190
    + $tabs = array_merge( array( $default_tabs['general'] ), $addon_tabs , array( $default_tabs['licenses'] ) );
    191
    +
    192
    + $show_tabs = ( count( $addon_tabs ) > 0 ) || apply_filters( 'wprss_show_settings_tabs_condition', FALSE );
    193
    +
    194
    + if ( $show_tabs ) { ?>
    195
    + <h2 class="nav-tab-wrapper">
    196
    + <?php
    197
    + foreach ( $tabs as $tab => $tab_property ) { ?>
    198
    + <a href="?post_type=wprss_feed&page=wprss-aggregator-settings&tab=<?php echo esc_attr( $tab_property['slug'] ); ?>"
    199
    + class="nav-tab <?php echo $active_tab == $tab_property['slug'] ? 'nav-tab-active' : ''; ?>"><?php echo esc_html( $tab_property['label'] ); ?></a>
    200
    + <?php } ?>
    201
    + <?php } ?>
    202
    + </h2>
    203
    +
    204
    + <form action="options.php" method="post">
    205
    +
    206
    + <?php
    207
    +
    208
    + if ( $active_tab === 'general_settings' ) {
    209
    + settings_fields( 'wprss_settings_general' );
    210
    + do_settings_sections( 'wprss_settings_general' );
    211
    + }
    212
    + elseif ( $show_tabs ) {
    213
    +
    214
    + if ( $active_tab === 'licenses_settings' ) {
    215
    + settings_fields( 'wprss_settings_license_keys' );
    216
    + do_settings_sections( 'wprss_settings_license_keys' );
    217
    + }
    218
    +
    219
    + do_action( 'wprss_add_settings_fields_sections', $active_tab );
    220
    + }
    221
    +
    222
    + submit_button( __( 'Save Settings', 'wprss' ) );
    223
    +
    224
    + ?>
    225
    + </form>
    226
    + </div>
    227
    + <?php
    228
    + }
    229
    +
    230
    +
    231
    + /**
    232
    + * General settings section header
    233
    + * @since 3.0
    234
    + */
    235
    + function wprss_settings_general_callback() {
    236
    + echo '<p>' . __( 'These are the general settings for WP RSS Aggregator.', 'wprss' ) . '</p>';
    237
    + }
    238
    +
    239
    +
    240
    + /**
    241
    + * General settings section header
    242
    + * @since 3.5
    243
    + */
    244
    + function wprss_settings_display_callback() {
    245
    + echo '<p>' . __( 'In this section you can find the options that control how the feed items are displayed.', 'wprss' ) . '</p>';
    246
    + }
    247
    +
    248
    +
    249
    + /**
    250
    + * General settings section header
    251
    + * @since 3.0
    252
    + */
    253
    + function wprss_settings_styles_callback() {
    254
    + echo '<p>' . __( 'If you would like to disable all styles used in this plugin, tick the checkbox.', 'wprss' ) . '</p>';
    255
    + }
    256
    +
    257
    +
    258
    + /**
    259
    + * Follow or No Follow dropdown
    260
    + * @since 1.1
    261
    + */
    262
    + function wprss_setting_follow_dd_callback() {
    263
    + $options = get_option( 'wprss_settings_general' );
    264
    + $items = array(
    265
    + __( 'No follow', 'wprss' ),
    266
    + __( 'Follow', 'wprss' )
    267
    + );
    268
    + echo "<select id='follow-dd' name='wprss_settings_general[follow_dd]'>";
    269
    + foreach( $items as $item ) {
    270
    + $selected = ( $options['follow_dd'] == $item) ? 'selected="selected"' : '';
    271
    + echo "<option value='$item' $selected>$item</option>";
    272
    + }
    273
    + echo "</select>";
    274
    + }
    275
    +
    276
    +
    277
    + /**
    278
    + * Use original video link, or embedded video links dropwdown
    279
    + * @since 3.4
    280
    + */
    281
    + function wprss_setting_video_links_callback() {
    282
    + $options = get_option( 'wprss_settings_general' );
    283
    + $video_link = ( isset($options['video_link']) )? $options['video_link'] : 'false';
    284
    + $items = array(
    285
    + 'false' => __( 'Original page link', 'wprss' ),
    286
    + 'true' => __( 'Embedded video player link', 'wprss' )
    287
    + );
    288
    + echo "<select id='video-link' name='wprss_settings_general[video_link]'>";
    289
    + foreach ( $items as $boolean => $text ) {
    290
    + $selected = ( $video_link === $boolean )? 'selected="selected"' : '';
    291
    + echo "<option value='$boolean' $selected>$text</option>";
    292
    + }
    293
    + echo "</select>";
    294
    + echo "<label class='description' for='video-link'>This will not affect already imported feed items.</label>";
    295
    + }
    296
    +
    297
    +
    298
    + /**
    299
    + * Link open setting dropdown
    300
    + * @since 1.1
    301
    + */
    302
    + function wprss_setting_open_dd_callback() {
    303
    + $options = get_option( 'wprss_settings_general' );
    304
    + $items = array(
    305
    + __( 'Lightbox', 'wprss' ),
    306
    + __( 'New window', 'wprss' ),
    307
    + __( 'None', 'wprss' )
    308
    + );
    309
    + echo "<select id='open-dd' name='wprss_settings_general[open_dd]'>";
    310
    + foreach( $items as $item ) {
    311
    + $selected = ( $options['open_dd'] == $item ) ? 'selected="selected"' : '';
    312
    + echo "<option value='$item' $selected>$item</option>";
    313
    + }
    314
    + echo "</select>";
    315
    + }
    316
    +
    317
    +
    318
    + /**
    319
    + * Set limit for feeds on frontend
    320
    + * @since 2.0
    321
    + */
    322
    + function wprss_setting_feed_limit_callback() {
    323
    + $options = get_option( 'wprss_settings_general' );
    324
    + echo "<input id='feed-limit' name='wprss_settings_general[feed_limit]' type='text' value='{$options['feed_limit']}' />";
    325
    + echo "<label class='description' for='feed-limit'>Enter the number of feeds to display on the front end</label>";
    326
    + }
    327
    +
    328
    +
    329
    + /**
    330
    + * Set date format
    331
    + * @since 3.0
    332
    + */
    333
    + function wprss_setting_date_format_callback() {
    334
    + $options = get_option( 'wprss_settings_general' );
    335
    + echo "<input id='date-format' name='wprss_settings_general[date_format]' type='text' value='{$options['date_format']}' />";
    336
    + echo "<label class='description' for='date-format'>Date formatting, using the <a href='http://codex.wordpress.org/Formatting_Date_and_Time'>PHP date formats</a></label>";
    337
    + }
    338
    +
    339
    +
    340
    +
    341
    + /**
    342
    + * Enable linked title
    343
    + * @since 3.0
    344
    + */
    345
    + function wprss_setting_title_link_callback( $args ) {
    346
    + $options = get_option( 'wprss_settings_general' );
    347
    + echo "<input id='title-link' name='wprss_settings_general[title_link]' type='checkbox' value='1' " . checked( 1, $options['title_link'], false ) . " />";
    348
    + echo "<label class='description' for='title-link'>Check this box to enable linked titles</label>";
    349
    + }
    350
    +
    351
    +
    352
    + /**
    353
    + * Enable source
    354
    + * @since 3.0
    355
    + */
    356
    + function wprss_setting_source_enable_callback( $args ) {
    357
    + $options = get_option( 'wprss_settings_general' );
    358
    + echo "<input id='source-enable' name='wprss_settings_general[source_enable]' type='checkbox' value='1' " . checked( 1, $options['source_enable'], false ) . " />";
    359
    + echo "<label class='description' for='source-enable'>Check this box to enable feed source display</label>";
    360
    + }
    361
    +
    362
    + /**
    363
    + * Enable linked title
    364
    + * @since 3.0
    365
    + */
    366
    + function wprss_setting_source_link_callback( $args ) {
    367
    + $options = get_option( 'wprss_settings_general' );
    368
    + echo "<input id='source-link' name='wprss_settings_general[source_link]' type='checkbox' value='1' " . checked( 1, $options['source_link'], false ) . " />";
    369
    + echo "<label class='description' for='source-link'>Check this box to enable linked sources</label>";
    370
    + }
    371
    +
    372
    +
    373
    + /**
    374
    + * Set text preceding source
    375
    + * @since 3.0
    376
    + */
    377
    + function wprss_setting_text_preceding_source_callback() {
    378
    + $options = get_option( 'wprss_settings_general' );
    379
    + echo "<input id='text-preceding-source' name='wprss_settings_general[text_preceding_source]' type='text' value='{$options['text_preceding_source']}' />";
    380
    + echo "<label class='description' for='text-preceding-source'>Enter the text you want shown before the feed item's source</label>";
    381
    + }
    382
    + /**
    383
    + * Enable date
    384
    + * @since 3.0
    385
    + */
    386
    + function wprss_setting_date_enable_callback( $args ) {
    387
    + $options = get_option( 'wprss_settings_general' );
    388
    + echo "<input id='date-enable' name='wprss_settings_general[date_enable]' type='checkbox' value='1' " . checked( 1, $options['date_enable'], false ) . " />";
    389
    + echo "<label class='description' for='date-enable'>Check this box to enable display of date published</label>";
    390
    + }
    391
    +
    392
    + /**
    393
    + * Set text preceding date
    394
    + * @since 3.0
    395
    + */
    396
    + function wprss_setting_text_preceding_date_callback() {
    397
    + $options = get_option( 'wprss_settings_general' );
    398
    + echo "<input id='text-preceding-date' name='wprss_settings_general[text_preceding_date]' type='text' value='{$options['text_preceding_date']}' />";
    399
    + echo "<label class='description' for='text-preceding-date'>Enter the text you want shown before the feed item's publish date</label>";
    400
    + }
    401
    +
    402
    +
    403
    +
    404
    + /**
    405
    + * Limit number of feed items stored
    406
    + * @since 3.0
    407
    + */
    408
    + function wprss_setting_limit_feed_items_callback() {
    409
    + $options = get_option( 'wprss_settings_general' );
    410
    + echo "<input id='limit-feed-items-db' name='wprss_settings_general[limit_feed_items_db]' type='text' value='{$options['limit_feed_items_db']}' />";
    411
    + echo "<label class='description' for='limit-feed-items-db'>Enter the maximum number of feeds to store in the database; enter 0 for unlimited feed items</label>";
    412
    + }
    413
    +
    414
    +
    415
    + /**
    416
    + * Limit number of feed items imported per feed
    417
    + * @since 3.1
    418
    + */
    419
    + function wprss_setting_limit_feed_items_imported_callback() {
    420
    + $options = get_option( 'wprss_settings_general' );
    421
    + echo "<input id='limit-feed-items-imported' name='wprss_settings_general[limit_feed_items_imported]' type='text' value='{$options['limit_feed_items_imported']}' />";
    422
    + echo "<label class='description' for='limit-feed-items-imported'>Enter the maximum number of feeds to import per feed source; enter 0 for unlimited feed items</label>";
    423
    + }
    424
    +
    425
    +
    426
    + /**
    427
    + * Gets a sorted (according to interval) list of the cron schedules
    428
    + * @since 3.0
    429
    + */
    430
    + function wprss_get_schedules() {
    431
    + $schedules = wp_get_schedules();
    432
    + uasort( $schedules, create_function( '$a,$b', 'return $a["interval"]-$b["interval"];' ) );
    433
    + return $schedules;
    434
    + }
    435
    +
    436
    +
    437
    + /**
    438
    + * Cron interval dropdown callback
    439
    + * @since 3.0
    440
    + */
    441
    + function wprss_setting_cron_interval_callback() {
    442
    + $options = get_option( 'wprss_settings_general' );
    443
    + $current = $options['cron_interval'];
    444
    +
    445
    + $schedules = wprss_get_schedules();
    446
    + // Set the allowed Cron schedules, we don't want any intervals that can lead to issues with server load
    447
    + $wprss_schedules = apply_filters(
    448
    + 'wprss_schedules',
    449
    + array( 'fifteen_min', 'thirty_min', 'hourly', 'two_hours', 'twicedaily', 'daily' )
    450
    + );
    451
    + echo "<select id='cron-interval' name='wprss_settings_general[cron_interval]'>";
    452
    + foreach( $schedules as $schedule_name => $schedule_data ) {
    453
    + if ( in_array( $schedule_name, $wprss_schedules ) ) { ?>
    454
    + <option value="<?php echo $schedule_name; ?>" <?php selected( $current, $schedule_name ); ?> >
    455
    + <?php echo $schedule_data['display']; ?> (<?php echo wprss_interval( $schedule_data['interval'] ); ?>)
    456
    + </option>
    457
    + <?php } ?>
    458
    + <?php } ?>
    459
    + </select><?php
    460
    + }
    461
    +
    462
    + /**
    463
    + * Sets the custom feed URL
    464
    + * @since 3.3
    465
    + */
    466
    + function wprss_setings_custom_feed_url_callback() {
    467
    + $options = get_option( 'wprss_settings_general' );
    468
    + echo "<input id='custom_feed_url' name='wprss_settings_general[custom_feed_url]' type='text' value='{$options['custom_feed_url']}' />";
    469
    + echo "<label class='description' for='custom_feed_url'>" . __( 'Custom feed URL', 'wprss' ) . "</label>";
    470
    + }
    471
    +
    472
    + /**
    473
    + * Sets the custom feed limit
    474
    + * @since 3.3
    475
    + */
    476
    + function wprss_setings_custom_feed_limit_callback() {
    477
    + $options = get_option( 'wprss_settings_general' );
    478
    + echo "<input id='custom_feed_limit' name='wprss_settings_general[custom_feed_limit]' placeholder='Default' min='0' class='wprss-number-roller' type='number' value='{$options['custom_feed_limit']}' />";
    479
    + echo "<label class='description' for='custom_feed_limit'>" . __( 'Custom feed limit', 'wprss' ) . "</label>";
    480
    + }
    481
    +
    482
    + /**
    483
    + * Disable styles
    484
    + * @since 3.0
    485
    + */
    486
    + function wprss_setting_styles_disable_callback( $args ) {
    487
    + $options = get_option( 'wprss_settings_general' );
    488
    + echo "<input id='styles-disable' name='wprss_settings_general[styles_disable]' type='checkbox' value='1' " . checked( 1, $options['styles_disable'], false ) . " />";
    489
    + echo "<label class='description' for='styles-disable'>Check this box to disable all plugin styles</label>";
    490
    + echo "<p class='description'>You will then be responsible for providing your own CSS styles.</p>";
    491
    + }
    492
    +
    493
    +
    494
    + /**
    495
    + * Pretty-prints the difference in two times.
    496
    + *
    497
    + * @since 3.0
    498
    + * @param time $older_date
    499
    + * @param time $newer_date
    500
    + * @return string The pretty time_since value
    501
    + * @link http://wordpress.org/extend/plugins/wp-crontrol/
    502
    + */
    503
    + function wprss_time_since( $older_date, $newer_date ) {
    504
    + return wprss_interval( $newer_date - $older_date );
    505
    + }
    506
    +
    507
    + /**
    508
    + * Calculates difference between times
    509
    + *
    510
    + * Taken from the WP-Crontrol plugin
    511
    + * @link http://wordpress.org/extend/plugins/wp-crontrol/
    512
    + * @since 3.0
    513
    + *
    514
    + */
    515
    + function wprss_interval( $since ) {
    516
    + // array of time period chunks
    517
    + $chunks = array(
    518
    + array(60 * 60 * 24 * 365 , _n_noop('%s year', '%s years', 'crontrol')),
    519
    + array(60 * 60 * 24 * 30 , _n_noop('%s month', '%s months', 'crontrol')),
    520
    + array(60 * 60 * 24 * 7, _n_noop('%s week', '%s weeks', 'crontrol')),
    521
    + array(60 * 60 * 24 , _n_noop('%s day', '%s days', 'crontrol')),
    522
    + array(60 * 60 , _n_noop('%s hour', '%s hours', 'crontrol')),
    523
    + array(60 , _n_noop('%s minute', '%s minutes', 'crontrol')),
    524
    + array( 1 , _n_noop('%s second', '%s seconds', 'crontrol')),
    525
    + );
    526
    +
    527
    +
    528
    + if( $since <= 0 ) {
    529
    + return __( 'now', 'wprss' );
    530
    + }
    531
    +
    532
    + // we only want to output two chunks of time here, eg:
    533
    + // x years, xx months
    534
    + // x days, xx hours
    535
    + // so there's only two bits of calculation below:
    536
    +
    537
    + // step one: the first chunk
    538
    + for ($i = 0, $j = count($chunks); $i < $j; $i++)
    539
    + {
    540
    + $seconds = $chunks[$i][0];
    541
    + $name = $chunks[$i][1];
    542
    +
    543
    + // finding the biggest chunk (if the chunk fits, break)
    544
    + if (($count = floor($since / $seconds)) != 0)
    545
    + {
    546
    + break;
    547
    + }
    548
    + }
    549
    +
    550
    + // set output var
    551
    + $output = sprintf(_n($name[0], $name[1], $count, 'wprss'), $count);
    552
    +
    553
    + // step two: the second chunk
    554
    + if ($i + 1 < $j)
    555
    + {
    556
    + $seconds2 = $chunks[$i + 1][0];
    557
    + $name2 = $chunks[$i + 1][1];
    558
    +
    559
    + if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0)
    560
    + {
    561
    + // add to output var
    562
    + $output .= ' '.sprintf(_n($name2[0], $name2[1], $count2, 'wprss'), $count2);
    563
    + }
    564
    + }
    565
    +
    566
    + return $output;
    567
    + }
    568
    +
    569
    +
    570
    + /**
    571
    + * Validate inputs from the general settings page
    572
    + * @since 3.0
    573
    + */
    574
    + function wprss_settings_general_validate( $input ) {
    575
    + $options = get_option( 'wprss_settings_general' );
    576
    + $current_cron_interval = $options['cron_interval'];
    577
    +
    578
    + // Create our array for storing the validated options
    579
    + $output = array();
    580
    +
    581
    + // Loop through each of the incoming options
    582
    + foreach( $input as $key => $value ) {
    583
    +
    584
    + // Check to see if the current option has a value. If so, process it.
    585
    + if( isset( $input[ $key ] ) ) {
    586
    +
    587
    + // Strip all HTML and PHP tags and properly handle quoted strings
    588
    + $output[ $key ] = strip_tags( stripslashes( $input[ $key ] ) );
    589
    +
    590
    + } // end if
    591
    +
    592
    + } // end foreach
    593
    +
    594
    + if ( ! isset( $input['title_link'] ) || $input['title_link'] != '1' )
    595
    + $output['title_link'] = 0;
    596
    + else
    597
    + $output['title_link'] = 1;
    598
    +
    599
    + if ( ! isset( $input['source_enable'] ) || $input['source_enable'] != '1' )
    600
    + $output['source_enable'] = 0;
    601
    + else
    602
    + $output['source_enable'] = 1;
    603
    +
    604
    + if ( ! isset( $input['date_enable'] ) || $input['date_enable'] != '1' )
    605
    + $output['date_enable'] = 0;
    606
    + else
    607
    + $output['date_enable'] = 1;
    608
    +
    609
    + if ( ! isset( $input['styles_disable'] ) || $input['styles_disable'] != '1' )
    610
    + $output['styles_disable'] = 0;
    611
    + else
    612
    + $output['styles_disable'] = 1;
    613
    +
    614
    + if ( ! isset( $input['video_link'] ) || strtolower( $input['video_link'] ) !== 'true' )
    615
    + $output['video_link'] = 'false';
    616
    + else
    617
    + $output['video_link'] = 'true';
    618
    +
    619
    + if ( $input['cron_interval'] != $current_cron_interval ) {
    620
    + wp_clear_scheduled_hook( 'wprss_fetch_all_feeds_hook' );
    621
    + wp_schedule_event( time(), $input['cron_interval'], 'wprss_fetch_all_feeds_hook' );
    622
    + }
    623
    +
    624
    + // Return the array processing any additional functions filtered by this action
    625
    + return apply_filters( 'wprss_settings_general_validate', $output, $input );
    626
    + }
    includes/admin-welcome.php ADDED
    @@ -0,0 +1,121 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * @todo Localize
    5
    + */
    6
    +
    7
    + // Exit if the page is accessed directly
    8
    + if ( ! defined( 'ABSPATH' ) ) exit;
    9
    +
    10
    +
    11
    + // The tabs to be shown
    12
    + $tabs = array(
    13
    + /* 'cat' => 'Categories',
    14
    + 'et' => 'Excerpts &amp; Thumbnails',
    15
    + 'kf' => 'Keyword Filtering'*/
    16
    + );
    17
    +
    18
    + // Determine the tab currently being shown
    19
    + $tab = null;
    20
    + if ( isset( $_GET['tab'] ) && !empty( $_GET['tab'] ) ) {
    21
    + $tab = $_GET['tab'];
    22
    + }
    23
    +
    24
    + ?>
    25
    +
    26
    + <div class="wrap about-wrap">
    27
    + <h1><?php printf( __( 'Welcome to WP RSS Aggregator %s !', 'wprss' ), WPRSS_VERSION ); ?></h1>
    28
    + <div class="about-text">
    29
    + Thank you for upgrading to the latest version!
    30
    + </div>
    31
    + <!-- <div class="wprss-badge">Version</div>-->
    32
    +
    33
    + <!-- TAB WRAPPER -->
    34
    + <h2 class="nav-tab-wrapper">
    35
    + <a class="nav-tab <?php if ( $tab === null ) echo 'nav-tab-active'; ?>"
    36
    + href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wprss-welcome' ), 'index.php' ) ) ); ?>">
    37
    + Overview
    38
    + </a>
    39
    +
    40
    + <!-- SHOW ALL TABS -->
    41
    + <?php foreach ($tabs as $slug => $title) : ?>
    42
    +
    43
    + <a class="nav-tab <?php if ( $tab === $slug ) echo 'nav-tab-active'; ?>"
    44
    + href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wprss-welcome', 'tab' => $slug ), 'index.php' ) ) ); ?>">
    45
    + <?php echo $title; ?>
    46
    + </a>
    47
    +
    48
    + <?php endforeach; ?>
    49
    +
    50
    + </h2>
    51
    +
    52
    + <!-- TAB CONTENT -->
    53
    + <?php
    54
    + /* Show content depending on the current tab */
    55
    + switch( $tab ) {
    56
    +
    57
    + // Default tab. ( when tab = null )
    58
    + default: ?>
    59
    +
    60
    + <p class="about-description">
    61
    + Check out our add-ons:</p>
    62
    +
    63
    + <ul>
    64
    + <li><strong><a href="http://www.wprssaggregator.com/extension/feed-post/" target="wprss_ftp">Feed to Post</a> <span style="color: green;">*New*</span></strong></li>
    65
    + <li><strong><a href="http://www.wprssaggregator.com/extension/excerpts-thumbnails/" target="wprss_et">Excerpts &amp; Thumbnails</a></strong></li>
    66
    + <li><strong><a href="http://www.wprssaggregator.com/extension/categories/" target="wprss_cat">Categories</a></strong></li>
    67
    + <li><strong><a href="http://www.wprssaggregator.com/extension/keyword-filtering/" target="wprss_kf">Keyword Filtering</a></strong></li>
    68
    + </ul>
    69
    + </p>
    70
    + <p>Plus we've got some other add-ons already being developed!</p>
    71
    + <p>More information about add-ons can be found on our new website <a href="http://www.wprssaggregator.com">www.wprssaggregator.com</a></p>
    72
    +
    73
    + <h3>Change log v3.4.3 (2013-10-20)</h3>
    74
    + <ul>
    75
    + <li>Fixed bug: Removed anonymous functions for backwards PHP compatibility</li>
    76
    + <li>Bug fix: Added suppress_filters in feed-display.php to prevent a user reported error</li>
    77
    + <li>Bug fix: Missing &#60;li&#62; in certain feed displays</li>
    78
    + </ul>
    79
    +
    80
    + </p>
    81
    +
    82
    + <?php
    83
    + break;
    84
    +
    85
    + // Excerpts and Thumbnails tab
    86
    + case 'et': ?>
    87
    +
    88
    + <p class="about-description">
    89
    + Fetch RSS feed excerpts to your blog and add thumbnails! Perfect for adding some life and color to your feeds.
    90
    + </p>
    91
    +
    92
    + <?php
    93
    + break;
    94
    +
    95
    + // Categories Tab
    96
    + case 'cat': ?>
    97
    +
    98
    + <p class="about-description">
    99
    + Organize your feeds into custom categories. Filter feed items by category and make custom WordPress feeds for specific categories.
    100
    + </p>
    101
    +
    102
    + <?php
    103
    + break;
    104
    +
    105
    + // Keyword Filtering tab
    106
    + case 'kf': ?>
    107
    +
    108
    + <p class="about-description">
    109
    + Import and store feeds that contain specific keywords in either the title or their content. Control what gets imported to your blog.
    110
    + </p>
    111
    +
    112
    + <?php
    113
    + break;
    114
    + }
    115
    + ?>
    116
    +
    117
    + <hr/>
    118
    +
    119
    + <p><a href="<?php echo admin_url( 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings'); ?>">Go to WP RSS Aggregator settings</a></p>
    120
    +
    121
    + </div>
    includes/admin.php ADDED
    @@ -0,0 +1,110 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Plugin administration related functions
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    + add_action( 'admin_head', 'wprss_custom_post_type_icon' );
    9
    + /**
    10
    + * Custom Post Type Icon for Admin Menu & Post Screen
    11
    + * @since 2.0
    12
    + */
    13
    + function wprss_custom_post_type_icon() {
    14
    + ?>
    15
    + <style>
    16
    + /* Post Screen - 32px */
    17
    + .icon32-posts-wprss_feed {
    18
    + background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
    19
    + }
    20
    + /* Post Screen - 32px */
    21
    + .icon32-posts-wprss_feed_item {
    22
    + background: transparent url( <?php echo WPRSS_IMG . 'icon-adminpage32.png'; ?> ) no-repeat left top !important;
    23
    + }
    24
    + </style>
    25
    + <?php }
    26
    +
    27
    +
    28
    + add_action( 'admin_menu', 'wprss_register_menu_pages' );
    29
    + /**
    30
    + * Register menu and submenus
    31
    + * @since 2.0
    32
    + */
    33
    +
    34
    + // Add the admin options pages as submenus to the Feed CPT
    35
    + function wprss_register_menu_pages() {
    36
    +
    37
    + //create submenu items
    38
    + add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'WP RSS Aggregator Settings', 'wprss' ), __( 'Settings', 'wprss' ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-aggregator-settings', 'wprss_settings_page_display' );
    39
    + add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Export & Import Settings', 'wprss' ), __( 'Import & Export', 'wprss' ), apply_filters( 'wprss_capability', 'manage_feed_settings' ), 'wprss-import-export-settings', 'wprss_import_export_settings_page_display' );
    40
    + add_submenu_page( 'edit.php?post_type=wprss_feed', __( 'Debugging', 'wprss' ), __( 'Debugging', 'wprss' ), apply_filters( 'wprss_capability', 'manage_feed_settings'), 'wprss-debugging', 'wprss_debugging_page_display' );
    41
    + }
    42
    +
    43
    +
    44
    + add_filter('admin_body_class', 'wprss_base_admin_body_class');
    45
    + /**
    46
    + * Set body class for admin screens
    47
    + * http://www.kevinleary.net/customizing-wordpress-admin-css-javascript/
    48
    + * @since 2.0
    49
    + */
    50
    + function wprss_base_admin_body_class( $classes )
    51
    + {
    52
    + // Current action
    53
    + if ( is_admin() && isset($_GET['action']) ) {
    54
    + $classes .= 'action-'.$_GET['action'];
    55
    + }
    56
    + // Current post ID
    57
    + if ( is_admin() && isset($_GET['post']) ) {
    58
    + $classes .= ' ';
    59
    + $classes .= 'post-'.$_GET['post'];
    60
    + }
    61
    + // New post type & listing page
    62
    + if ( isset($_GET['post_type']) ) $post_type = $_GET['post_type'];
    63
    + if ( isset($post_type) ) {
    64
    + $classes .= ' ';
    65
    + $classes .= 'post-type-'.$post_type;
    66
    + }
    67
    + // Editting a post type
    68
    + if ( isset( $_GET['post'] ) ) {
    69
    + $post_query = $_GET['post'];
    70
    + }
    71
    + if ( isset($post_query) ) {
    72
    + $current_post_edit = get_post($post_query);
    73
    + $current_post_type = $current_post_edit->post_type;
    74
    + if ( !empty($current_post_type) ) {
    75
    + $classes .= ' ';
    76
    + $classes .= 'post-type-'.$current_post_type;
    77
    + }
    78
    + }
    79
    + // Return the $classes array
    80
    + return $classes;
    81
    + }
    82
    +
    83
    +
    84
    + /**
    85
    + * Change title on wprss_feed post type screen
    86
    + *
    87
    + * @since 2.0
    88
    + * @return void
    89
    + */
    90
    + function wprss_change_title_text() {
    91
    + return __( 'Enter feed name here (e.g. WP Mayor)', 'wprss' );
    92
    + }
    93
    +
    94
    +
    95
    + add_filter( 'plugin_action_links', 'wprss_plugin_action_links', 10, 2 );
    96
    + /**
    97
    + * Add Settings action link in plugin listing
    98
    + *
    99
    + * @since 3.0
    100
    + * @param array $action_links
    101
    + * @param string $plugin_file
    102
    + * @return array
    103
    + */
    104
    + function wprss_plugin_action_links( $action_links, $plugin_file ) {
    105
    + if ( $plugin_file == plugin_basename( __FILE__ ) ) {
    106
    + $settings_link = '<a href="' . get_admin_url() . 'edit.php?post_type=wprss_feed&page=wprss-aggregator-settings">' . __("Settings") . '</a>';
    107
    + array_unshift( $action_links, $settings_link );
    108
    + }
    109
    + return $action_links;
    110
    + }
    includes/cron-jobs.php ADDED
    @@ -0,0 +1,80 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Contains all the cron jobs in use by WP RSS Aggregator
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    +
    9
    + add_action( 'init', 'wprss_schedule_fetch_all_feeds_cron' );
    10
    + /**
    11
    + * Creates the cron to fetch feeds every hour
    12
    + *
    13
    + * @since 2.0
    14
    + */
    15
    + function wprss_schedule_fetch_all_feeds_cron() {
    16
    +
    17
    + $options = get_option( 'wprss_settings_general' );
    18
    +
    19
    + $cron_interval = $options['cron_interval'];
    20
    +
    21
    + // verify event has not been scheduled
    22
    + if ( ! wp_next_scheduled( 'wprss_fetch_all_feeds_hook' ) ) {
    23
    + // Schedule to run hourly
    24
    + wp_schedule_event( time(), $cron_interval, 'wprss_fetch_all_feeds_hook' );
    25
    + }
    26
    +
    27
    + add_action( 'wprss_fetch_all_feeds_hook', 'wprss_fetch_insert_all_feed_items' );
    28
    + }
    29
    +
    30
    +
    31
    + add_action( 'init', 'wprss_schedule_truncate_posts_cron' );
    32
    + /**
    33
    + * Creates the cron to truncate wprss_feed_item posts daily
    34
    + *
    35
    + * @since 2.0
    36
    + */
    37
    + function wprss_schedule_truncate_posts_cron() {
    38
    +
    39
    + // verify event has not been scheduled
    40
    + if ( ! wp_next_scheduled( 'wprss_truncate_posts_hook') ) {
    41
    + // Schedule to run daily
    42
    + wp_schedule_event( time(), 'daily', 'wprss_truncate_posts_hook' );
    43
    + }
    44
    +
    45
    + add_action( 'wprss_truncate_posts_hook', 'wprss_truncate_posts' );
    46
    + }
    47
    +
    48
    +
    49
    + // filter to add new possible frequencies to the cron
    50
    + add_filter( 'cron_schedules', 'wprss_filter_cron_schedules' );
    51
    + /**
    52
    + * Adding a few more handy cron schedules to the default ones
    53
    + * @since 3.0
    54
    + */
    55
    + function wprss_filter_cron_schedules( $schedules) {
    56
    + $frequencies = array(
    57
    + 'five_min' => array(
    58
    + 'interval' => 5 * MINUTE_IN_SECONDS,
    59
    + 'display' => __( 'Once every five minutes', 'wprss' )
    60
    + ),
    61
    + 'ten_min' => array(
    62
    + 'interval' => 10 * MINUTE_IN_SECONDS,
    63
    + 'display' => __( 'Once every ten minutes', 'wprss' )
    64
    + ),
    65
    + 'fifteen_min' => array(
    66
    + 'interval' => 15 * MINUTE_IN_SECONDS,
    67
    + 'display' => __( 'Once every fifteen minutes', 'wprss' )
    68
    + ),
    69
    + 'thirty_min' => array(
    70
    + 'interval' => 30 * MINUTE_IN_SECONDS,
    71
    + 'display' => __( 'Once every thirty minutes', 'wprss' )
    72
    + ),
    73
    + 'two_hours' => array(
    74
    + 'interval' => 2 * HOUR_IN_SECONDS,
    75
    + 'display' => __( 'Once every two hours', 'wprss' )
    76
    + ),
    77
    + );
    78
    +
    79
    + return array_merge( $schedules, $frequencies );
    80
    + }
    includes/custom-feed.php ADDED
    @@ -0,0 +1,101 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Function to create a custom feed with the latest imported feed items
    4
    + *
    5
    + * @package WP RSS Aggregator
    6
    + */
    7
    +
    8
    +
    9
    + add_filter( 'init', 'wprss_addfeed_add_feed' );
    10
    + /**
    11
    + * Adds feed named 'wprss'
    12
    + *
    13
    + * @since 3.3
    14
    + */
    15
    + function wprss_addfeed_add_feed() {
    16
    + $general_settings = get_option( 'wprss_settings_general', 'wprss' );
    17
    + if ( !empty( $general_settings ) && isset( $general_settings['custom_feed_url'] ) ) {
    18
    + $url = $general_settings['custom_feed_url'];
    19
    + }
    20
    + else $url = 'wprss';
    21
    + add_feed( $url, 'wprss_addfeed_do_feed' );
    22
    + }
    23
    +
    24
    +
    25
    + /**
    26
    + * Generate the feed
    27
    + *
    28
    + * @since 3.3
    29
    + */
    30
    + function wprss_addfeed_do_feed( $in ) {
    31
    +
    32
    + // Prepare the post query
    33
    + $wprss_custom_feed_query = apply_filters(
    34
    + 'wprss_custom_feed_query',
    35
    + array(
    36
    + 'post_type' => 'wprss_feed_item',
    37
    + 'post_status' => 'publish',
    38
    + 'cache_results' => false, // disable caching
    39
    + )
    40
    +
    41
    + );
    42
    +
    43
    + // Get options
    44
    + $options = get_option( 'wprss_settings_general' );
    45
    + if ( $options !== FALSE ) {
    46
    + // If options exist, get the limit
    47
    + $limit = $options['custom_feed_limit'];
    48
    + if ( $limit !== FALSE ) {
    49
    + // if limit exists, set the query limit
    50
    + $wprss_custom_feed_query['posts_per_page'] = $limit;
    51
    + }
    52
    + }
    53
    +
    54
    + // Submit the query to get latest feed items
    55
    + query_posts( $wprss_custom_feed_query );
    56
    +
    57
    + // Send content header and start ATOM output
    58
    + header('Content-Type: application/atom+xml');
    59
    + // Disabling caching
    60
    + header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
    61
    + header('Pragma: no-cache'); // HTTP 1.0.
    62
    + header('Expires: 0'); // Proxies.
    63
    + echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
    64
    + ?>
    65
    + <feed xmlns="http://www.w3.org/2005/Atom">
    66
    + <title type="text">Latest imported feed items on <?php bloginfo_rss('name'); ?></title>
    67
    + <?php
    68
    + // Start the Loop
    69
    + while ( have_posts() ) : the_post();
    70
    + $permalink = get_post_meta( get_the_ID(), 'wprss_item_permalink', true );
    71
    + ?>
    72
    + <entry>
    73
    + <title><![CDATA[<?php the_title_rss(); ?>]]></title>
    74
    + <link href="<?php echo $permalink; ?>" />
    75
    + <?php // Enable below to link to post on our site rather than original source ?>
    76
    + <!--<link href="<?php the_permalink_rss(); ?>" />-->
    77
    + <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z' ); ?></published>
    78
    + <content type="html"><![CDATA[<?php the_content(); ?>]]></content>
    79
    + </entry>
    80
    + <?php
    81
    + // End of the Loop
    82
    + endwhile;
    83
    + ?>
    84
    + </feed>
    85
    + <?php
    86
    + }
    87
    +
    88
    +
    89
    + add_filter( 'post_limits', 'wprss_custom_feed_limits' );
    90
    + /**
    91
    + * Set a different limit to our custom feeds
    92
    + *
    93
    + * @since 3.3
    94
    + */
    95
    + function wprss_custom_feed_limits( $limit ) {
    96
    + if ( is_feed( ) ) {
    97
    + // return 'LIMIT 0, 3';
    98
    + return $limit;
    99
    + }
    100
    + return $limit;
    101
    + }
    includes/custom-post-types.php ADDED
    @@ -0,0 +1,102 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Contains all custom post type related functions
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    +
    9
    + add_action( 'init', 'wprss_register_post_types' );
    10
    + /**
    11
    + * Create Custom Post Types wprss_feed and wprss_feed_item
    12
    + *
    13
    + * @since 2.0
    14
    + */
    15
    + function wprss_register_post_types() {
    16
    +
    17
    + // Set up labels for the 'wprss_feed' post type
    18
    + $labels = apply_filters(
    19
    + 'wprss_feed_post_type_labels',
    20
    + array(
    21
    + 'name' => __( 'Feed Sources', 'wprss' ),
    22
    + 'singular_name' => __( 'Feed', 'wprss' ),
    23
    + 'add_new' => __( 'Add New Feed Source', 'wprss' ),
    24
    + 'all_items' => __( 'All Feed Sources', 'wprss' ),
    25
    + 'add_new_item' => __( 'Add New Feed Source', 'wprss' ),
    26
    + 'edit_item' => __( 'Edit Feed Source', 'wprss' ),
    27
    + 'new_item' => __( 'New Feed Source', 'wprss' ),
    28
    + 'view_item' => __( 'View Feed Source', 'wprss' ),
    29
    + 'search_items' => __( 'Search Feeds', 'wprss' ),
    30
    + 'not_found' => __( 'No Feed Sources Found', 'wprss' ),
    31
    + 'not_found_in_trash' => __( 'No Feed Sources Found In Trash', 'wprss' ),
    32
    + 'menu_name' => __( 'RSS Aggregator', 'wprss' )
    33
    + )
    34
    + );
    35
    +
    36
    + // Set up the arguments for the 'wprss_feed' post type
    37
    + $feed_args = apply_filters(
    38
    + 'wprss_feed_post_type_args',
    39
    + array(
    40
    + 'exclude_from_search' => true,
    41
    + 'publicly_querable' => false,
    42
    + 'show_in_nav_menus' => false,
    43
    + 'show_in_admin_bar' => true,
    44
    + 'public' => true,
    45
    + 'show_ui' => true,
    46
    + 'query_var' => 'feed_source',
    47
    + 'menu_position' => 100,
    48
    + 'menu_icon' => WPRSS_IMG . 'icon-adminmenu16-sprite.png',
    49
    + 'show_in_menu' => true,
    50
    + 'show_in_admin_bar' => false,
    51
    + 'rewrite' => array(
    52
    + 'slug' => 'feeds',
    53
    + 'with_front' => false
    54
    + ),
    55
    + 'capability_type' => 'feed',
    56
    + 'supports' => array( 'title' ),
    57
    + 'labels' => $labels
    58
    + )
    59
    + );
    60
    +
    61
    + // Register the 'wprss_feed' post type
    62
    + register_post_type( 'wprss_feed', $feed_args );
    63
    +
    64
    + // Set up labels for the 'wprss_feed_item' post type
    65
    + $labels = apply_filters(
    66
    + 'wprss_feed_item_post_type_labels',
    67
    + array(
    68
    + 'name' => __( 'Imported Feeds', 'wprss' ),
    69
    + 'singular_name' => __( 'Imported Feed', 'wprss' ),
    70
    + 'all_items' => __( 'Imported Feeds', 'wprss' ),
    71
    + 'view_item' => __( 'View Imported Feed', 'wprss' ),
    72
    + 'search_items' => __( 'Search Imported Feeds', 'wprss' ),
    73
    + 'not_found' => __( 'No Imported Feeds Found', 'wprss' ),
    74
    + 'not_found_in_trash' => __( 'No Imported Feeds Found In Trash', 'wprss' )
    75
    + )
    76
    + );
    77
    +
    78
    + // Set up the arguments for the 'wprss_feed_item' post type
    79
    + $feed_item_args = apply_filters(
    80
    + 'wprss_feed_item_post_type_args',
    81
    + array(
    82
    + 'exclude_from_search' => true,
    83
    + 'publicly_querable' => false,
    84
    + 'show_in_nav_menus' => false,
    85
    + 'show_in_admin_bar' => true,
    86
    + 'public' => true,
    87
    + 'show_ui' => true,
    88
    + 'query_var' => 'feed_item',
    89
    + 'show_in_menu' => 'edit.php?post_type=wprss_feed',
    90
    + 'show_in_admin_bar' => false,
    91
    + 'rewrite' => array(
    92
    + 'slug' => 'feeds/items',
    93
    + 'with_front' => false,
    94
    + ),
    95
    + 'capability_type' => 'feed_source',
    96
    + 'labels' => $labels
    97
    + )
    98
    + );
    99
    +
    100
    + // Register the 'feed_item' post type
    101
    + register_post_type( 'wprss_feed_item', $feed_item_args );
    102
    + }
    includes/deprecated-functions.php ADDED
    @@ -0,0 +1,83 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * Fetches feed items from sources provided
    5
    + * DEPRECATED - JUST FOR REFERENCE
    6
    + *
    7
    + * @since 2.0
    8
    + * @deprecated 3.0
    9
    + */
    10
    + function wprss_fetch_all_feed_items( ) {
    11
    +
    12
    + // Get all feed sources
    13
    + $feed_sources = new WP_Query( array(
    14
    + 'post_type' => 'wprss_feed',
    15
    + 'post_status' => 'publish',
    16
    + 'posts_per_page' => -1,
    17
    + ) );
    18
    +
    19
    + if( $feed_sources->have_posts() ) {
    20
    + /* Start by getting one feed source, we will cycle through them one by one,
    21
    + fetching feed items and adding them to the database in each pass */
    22
    + while ( $feed_sources->have_posts() ) {
    23
    + $feed_sources->the_post();
    24
    +
    25
    + $feed_ID = get_the_ID();
    26
    + $feed_url = get_post_meta( get_the_ID(), 'wprss_url', true );
    27
    +
    28
    + // Use the URL custom field to fetch the feed items for this source
    29
    + if( !empty( $feed_url ) ) {
    30
    +
    31
    + add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
    32
    + //$feed = fetch_feed( $feed_url );
    33
    + $feed = wprss_fetch_feed( $feed_url );
    34
    + remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_return_7200' );
    35
    +
    36
    + // $feed->strip_htmltags( array_merge( $feed->strip_htmltags, array('h1', 'a', 'img') ) );
    37
    +
    38
    + if ( !is_wp_error( $feed ) ) {
    39
    + // Figure out how many total items there are, but limit it to 10.
    40
    + $maxitems = $feed->get_item_quantity(10);
    41
    +
    42
    + // Build an array of all the items, starting with element 0 (first element).
    43
    + $items = $feed->get_items( 0, $maxitems );
    44
    + }
    45
    + else { return; }
    46
    + }
    47
    +
    48
    + if ( ! empty( $items ) ) {
    49
    + // Gather the permalinks of existing feed item's related to this feed source
    50
    + global $wpdb;
    51
    + $existing_permalinks = $wpdb->get_col(
    52
    + "SELECT meta_value
    53
    + FROM $wpdb->postmeta
    54
    + WHERE meta_key = 'wprss_item_permalink'
    55
    + AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID)
    56
    + ");
    57
    +
    58
    + foreach ( $items as $item ) {
    59
    + // Check if newly fetched item already present in existing feed item item,
    60
    + // if not insert it into wp_posts and insert post meta.
    61
    + if ( ! ( in_array( $item->get_permalink(), $existing_permalinks ) ) ) {
    62
    + // Create post object
    63
    + $feed_item = array(
    64
    + 'post_title' => $item->get_title(),
    65
    + 'post_content' => '',
    66
    + 'post_status' => 'publish',
    67
    + 'post_type' => 'wprss_feed_item'
    68
    + );
    69
    + $inserted_ID = wp_insert_post( $feed_item );
    70
    + wprss_items_create_post_meta( $inserted_ID, $item, $feed_ID );
    71
    + } //end if
    72
    + } //end foreach
    73
    + } // end if
    74
    + } // end $feed_sources while loop
    75
    + wp_reset_postdata(); // Restore the $post global to the current post in the main query
    76
    + // } // end if
    77
    + } // end if
    78
    + }
    79
    +
    80
    + // For testing query speed
    81
    + // $time_start = microtime( true );
    82
    + // wp_die(number_format( microtime( true ) - $time_start, 10 ));
    83
    +
    includes/feed-display.php ADDED
    @@ -0,0 +1,277 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Feed display related functions
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    +
    9
    + /**
    10
    + * Retrieve settings and prepare them for use in the display function
    11
    + *
    12
    + * @since 3.0
    13
    + */
    14
    + function wprss_get_display_settings( $settings ) {
    15
    +
    16
    + switch ( $settings['open_dd'] ) {
    17
    +
    18
    + case 'Lightbox' :
    19
    + $display_settings['open'] = 'class="colorbox"';
    20
    + break;
    21
    +
    22
    + case 'New window' :
    23
    + $display_settings['open'] = 'target="_blank"';
    24
    + break;
    25
    + }
    26
    +
    27
    + switch ( $settings['follow_dd'] ) {
    28
    +
    29
    + case 'No follow' :
    30
    + $display_settings['follow'] = 'rel="nofollow"';
    31
    + break;
    32
    + }
    33
    +
    34
    + do_action( 'wprss_get_settings' );
    35
    +
    36
    + return $display_settings;
    37
    + }
    38
    +
    39
    +
    40
    + /**
    41
    + * Merges the default arguments with the user set arguments
    42
    + *
    43
    + * @since 3.0
    44
    + */
    45
    + function wprss_get_shortcode_default_args( $args ) {
    46
    + // Default shortcode/function arguments for displaying feed items
    47
    + $shortcode_args = apply_filters(
    48
    + 'wprss_shortcode_args',
    49
    + array(
    50
    + 'links_before' => '<ul class="rss-aggregator">',
    51
    + 'links_after' => '</ul>',
    52
    + 'link_before' => '<li class="feed-item">',
    53
    + 'link_after' => '</li>'
    54
    + )
    55
    + );
    56
    +
    57
    + // Parse incoming $args into an array and merge it with $shortcode_args
    58
    + $args = wp_parse_args( $args, $shortcode_args );
    59
    +
    60
    + return $args;
    61
    + }
    62
    +
    63
    +
    64
    + /**
    65
    + * Prepares and builds the query for fetching the feed items
    66
    + *
    67
    + * @since 3.0
    68
    + */
    69
    + function wprss_get_feed_items_query( $settings ) {
    70
    + $feed_items_args = array(
    71
    + 'post_type' => 'wprss_feed_item',
    72
    + 'posts_per_page' => $settings['feed_limit'],
    73
    + 'orderby' => 'meta_value',
    74
    + 'meta_key' => 'wprss_item_date',
    75
    + 'order' => 'DESC',
    76
    + 'suppress_filters' => true
    77
    + );
    78
    +
    79
    + // If either the source or exclude arguments are set (but not both), prepare a meta query
    80
    + if ( isset( $settings['source'] ) xor isset( $settings['exclude'] ) ) {
    81
    + // Set the appropriate setting and operator
    82
    + $setting = 'source';
    83
    + $operator = 'IN';
    84
    + if ( isset( $settings['exclude'] ) ) {
    85
    + $setting = 'exclude';
    86
    + $operator = 'NOT IN';
    87
    + }
    88
    + $feeds = array_filter( array_map( 'intval', explode( ',', $settings[$setting] ) ) );
    89
    + foreach ( $feeds as $feed )
    90
    + trim( $feed );
    91
    + if ( !empty( $feeds ) ) {
    92
    + $feed_items_args['meta_query'] = array(
    93
    + array(
    94
    + 'key' => 'wprss_feed_id',
    95
    + 'value' => $feeds,
    96
    + 'type' => 'numeric',
    97
    + 'compare' => $operator,
    98
    + ),
    99
    + );
    100
    + }
    101
    + }
    102
    +
    103
    + // Arguments for the next query to fetch all feed items
    104
    + $feed_items_args = apply_filters( 'wprss_display_feed_items_query', $feed_items_args, $settings );
    105
    +
    106
    + // Query to get all feed items for display
    107
    + $feed_items = new WP_Query( $feed_items_args );
    108
    +
    109
    + return $feed_items;
    110
    + }
    111
    +
    112
    +
    113
    + add_action( 'wprss_display_template', 'wprss_default_display_template', 10, 3 );
    114
    + /**
    115
    + * Default template for feed items display
    116
    + *
    117
    + * @since 3.0
    118
    + */
    119
    + function wprss_default_display_template( $display_settings, $args, $feed_items ) {
    120
    +
    121
    + $general_settings = get_option( 'wprss_settings_general' );
    122
    + $excerpts_settings = get_option( 'wprss_settings_excerpts' );
    123
    + $thumbnails_settings = get_option( 'wprss_settings_thumbnails' );
    124
    +
    125
    + $source_link = $general_settings['source_link'];
    126
    + // Declare each item in $args as its own variable
    127
    + extract( $args, EXTR_SKIP );
    128
    +
    129
    + $output = '';
    130
    +
    131
    + if( $feed_items->have_posts() ) {
    132
    +
    133
    + $output .= "$links_before";
    134
    +
    135
    + while ( $feed_items->have_posts() ) {
    136
    + $feed_items->the_post();
    137
    + $permalink = get_post_meta( get_the_ID(), 'wprss_item_permalink', true );
    138
    + $feed_source_id = get_post_meta( get_the_ID(), 'wprss_feed_id', true );
    139
    + $source_name = get_the_title( $feed_source_id );
    140
    + $source_url = get_post_meta( $feed_source_id, 'wprss_url', true );
    141
    +
    142
    + do_action( 'wprss_get_post_data' );
    143
    +
    144
    + // convert from Unix timestamp
    145
    + $date = date_i18n( $general_settings['date_format'], intval( get_post_meta( get_the_ID(), 'wprss_item_date', true ) ) );
    146
    +
    147
    + if ( $general_settings['title_link'] == 1 ) {
    148
    + $output .= "$link_before" . '<a ' . $display_settings['open'] . ' ' . $display_settings['follow'] . ' href="'. $permalink . '">'. get_the_title(). '</a>';
    149
    + }
    150
    + else {
    151
    + $output .= get_the_title();
    152
    + }
    153
    +
    154
    + if ( ( $general_settings['source_enable'] == 1 ) && ( $general_settings['date_enable'] == 1 ) ) {
    155
    + $output .= '<div class="source-date"><span class="feed-source">' .
    156
    + ( !empty( $general_settings['text_preceding_source'] ) ? $general_settings['text_preceding_source'] . ' ' : '' );
    157
    +
    158
    + if ( $source_link == 1 ) {
    159
    + $output .= '<a href="' . $source_url . '">' . $source_name . "</a>";
    160
    + }
    161
    + else $output .= $source_name;
    162
    +
    163
    + $output .= ' | ' .
    164
    + ( !empty( $general_settings['text_preceding_date'] ) ? $general_settings['text_preceding_date'] . ' ' : '' ) . $date .
    165
    + '</span></div>' . "$link_after";
    166
    + }
    167
    +
    168
    + else if ( ( $general_settings['source_enable'] == 1 ) && ( $general_settings['date_enable'] == 0 ) ) {
    169
    + $output .= '<div class="source-date"><span class="feed-source">' .
    170
    + ( !empty( $general_settings['text_preceding_source'] ) ? $general_settings['text_preceding_source'] . ' ' : '' );
    171
    +
    172
    + if ( $source_link == 1 ) {
    173
    + $output .= '<a href="' . $source_url . '">' . $source_name . "</a>";
    174
    + }
    175
    + else $output .= $source_name;
    176
    +
    177
    + $output .= '</span></div>' . "$link_after";
    178
    + }
    179
    +
    180
    + else if ( ( $general_settings['source_enable'] == 0 ) && ( $general_settings['date_enable'] == 1 ) ) {
    181
    + $output .= '<div class="source-date"><span class="feed-source">' .
    182
    + ( !empty( $general_settings['text_preceding_date'] ) ? $general_settings['text_preceding_date'] . ' ' : '' ) . $date .
    183
    + '</span></div>' . "$link_after";
    184
    + }
    185
    +
    186
    + // No source, no date
    187
    + else { $output .= "$link_after"; }
    188
    +
    189
    +
    190
    + }
    191
    + $output .= "$links_after";
    192
    + $output = apply_filters( 'feed_output', $output );
    193
    +
    194
    + echo $output;
    195
    +
    196
    + // echo paginate_links();
    197
    +
    198
    + wp_reset_postdata();
    199
    +
    200
    + } else {
    201
    + $output = apply_filters( 'no_feed_items_found', __( 'No feed items found.', 'wprss' ) );
    202
    + echo $output;
    203
    + }
    204
    + }
    205
    +
    206
    +
    207
    + /**
    208
    + * Display feed items on the front end (via shortcode or function)
    209
    + *
    210
    + * @since 2.0
    211
    + */
    212
    + function wprss_display_feed_items( $args = array() ) {
    213
    + $settings = get_option( 'wprss_settings_general' );
    214
    + $display_settings = wprss_get_display_settings( $settings );
    215
    + $args = wprss_get_shortcode_default_args( $args );
    216
    +
    217
    + $args = apply_filters( 'wprss_shortcode_args', $args );
    218
    +
    219
    + $query_args = $settings;
    220
    + if ( isset( $args['limit'] ) ) {
    221
    + $query_args['feed_limit'] = filter_var( $args['limit'], FILTER_VALIDATE_INT, array(
    222
    + 'options' => array(
    223
    + 'min_range' => 1,
    224
    + 'default' => $query_args['feed_limit'],
    225
    + ),
    226
    + ) );
    227
    + }
    228
    +
    229
    + if ( isset( $args['source'] ) ) {
    230
    + $query_args['source'] = $args['source'];
    231
    + }
    232
    + elseif ( isset( $args['exclude'] ) ) {
    233
    + $query_args['exclude'] = $args['exclude'];
    234
    + }
    235
    +
    236
    + $feed_items = wprss_get_feed_items_query( $query_args );
    237
    +
    238
    + do_action( 'wprss_display_template', $display_settings, $args, $feed_items );
    239
    + }
    240
    +
    241
    +
    242
    + /**
    243
    + * Redirects to wprss_display_feed_items
    244
    + * It is used for backwards compatibility to versions < 2.0
    245
    + *
    246
    + * @since 2.1
    247
    + */
    248
    + function wp_rss_aggregator( $args = array() ) {
    249
    + wprss_display_feed_items( $args );
    250
    + }
    251
    +
    252
    +
    253
    + /**
    254
    + * Limits a phrase/content to a defined number of words
    255
    + *
    256
    + * NOT BEING USED as we're using the native WP function, although the native one strips tags, so I'll
    257
    + * probably revisit this one again soon.
    258
    + *
    259
    + * @since 3.0
    260
    + * @param string $words
    261
    + * @param integer $limit
    262
    + * @param string $append
    263
    + * @return string
    264
    + */
    265
    + function wprss_limit_words( $words, $limit, $append = '' ) {
    266
    + /* Add 1 to the specified limit becuase arrays start at 0 */
    267
    + $limit = $limit + 1;
    268
    + /* Store each individual word as an array element
    269
    + up to the limit */
    270
    + $words = explode( ' ', $words, $limit );
    271
    + /* Shorten the array by 1 because that final element will be the sum of all the words after the limit */
    272
    + array_pop( $words );
    273
    + /* Implode the array for output, and append an ellipse */
    274
    + $words = implode( ' ', $words ) . $append;
    275
    + /* Return the result */
    276
    + return rtrim( $words );
    277
    + }
    includes/feed-processing.php ADDED
    @@ -0,0 +1,570 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Feed processing related functions
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    +
    9
    + /**
    10
    + * Change the default feed cache recreation period to 2 hours
    11
    + *
    12
    + * Probably not needed since we are now disabling caching altogether
    13
    + *
    14
    + * @since 2.1
    15
    + */
    16
    + function wprss_feed_cache_lifetime( $seconds )
    17
    + {
    18
    + return 1; // one second
    19
    + }
    20
    +
    21
    +
    22
    + /**
    23
    + * Disable caching of feeds in transients, we don't need it as we are storing them in the wp_posts table
    24
    + *
    25
    + * @since 3.0
    26
    + */
    27
    + function wprss_do_not_cache_feeds( &$feed ) {
    28
    + $feed->enable_cache( false );
    29
    + }
    30
    +
    31
    +
    32
    + /**
    33
    + * Parameters for query to get all feed sources
    34
    + *
    35
    + * @since 3.0
    36
    + */
    37
    + function wprss_get_all_feed_sources() {
    38
    + // Get all feed sources
    39
    + $feed_sources = new WP_Query( apply_filters(
    40
    + 'wprss_get_all_feed_sources',
    41
    + array(
    42
    + 'post_type' => 'wprss_feed',
    43
    + 'post_status' => 'publish',
    44
    + 'cache_results' => false, // Disable caching, used for one-off queries
    45
    + 'no_found_rows' => true, // We don't need pagination, so disable it
    46
    + 'posts_per_page' => -1
    47
    + )
    48
    + ) );
    49
    + return $feed_sources;
    50
    + }
    51
    +
    52
    +
    53
    + /**
    54
    + * Parameters for query to get feed sources
    55
    + *
    56
    + * @since 3.0
    57
    + */
    58
    + function wprss_get_feed_source() {
    59
    + // Get all feed sources
    60
    + $feed_sources = new WP_Query( apply_filters(
    61
    + 'wprss_get_all_feed_sources',
    62
    + array(
    63
    + 'post_type' => 'wprss_feed',
    64
    + 'post_status' => 'publish',
    65
    + 'cache_results' => false, // Disable caching, used for one-off queries
    66
    + 'no_found_rows' => true, // We don't need pagination, so disable it
    67
    + 'posts_per_page' => -1
    68
    + )
    69
    + ) );
    70
    + return $feed_sources;
    71
    + }
    72
    +
    73
    +
    74
    + /**
    75
    + * Database query to get existing permalinks
    76
    + *
    77
    + * @since 3.0
    78
    + */
    79
    + function get_existing_permalinks( $feed_ID ) {
    80
    + global $wpdb;
    81
    +
    82
    + $existing_permalinks = $wpdb->get_col(
    83
    + "SELECT meta_value
    84
    + FROM $wpdb->postmeta
    85
    + WHERE meta_key = 'wprss_item_permalink'
    86
    + AND post_id IN ( SELECT post_id FROM $wpdb->postmeta WHERE meta_value = $feed_ID )"
    87
    + );
    88
    +
    89
    + return $existing_permalinks;
    90
    + }
    91
    +
    92
    +
    93
    + /**
    94
    + * Fetch the feeds from a feed item url
    95
    + *
    96
    + * @since 3.0
    97
    + */
    98
    + function wprss_get_feed_items( $feed_url ) {
    99
    + $general_settings = get_option( 'wprss_settings_general' );
    100
    + $feed_item_limit = $general_settings['limit_feed_items_imported'];
    101
    +
    102
    + // Don't fetch the feed if feed item limit is 0, there's no need, huge speed improvement
    103
    + if ( $feed_item_limit == 0 ) return;
    104
    +
    105
    + add_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
    106
    +
    107
    + /* Disable caching of feeds */
    108
    + add_action( 'wp_feed_options', 'wprss_do_not_cache_feeds' );
    109
    + /* Fetch the feed from the soure URL specified */
    110
    + $feed = fetch_feed( $feed_url );
    111
    + //$feed = new SimplePie();
    112
    + //$feed->set_feed_url( $feed_url );
    113
    + //$feed->init();
    114
    + /* Remove action here because we only don't want it active feed imports outside of our plugin */
    115
    + remove_action( 'wp_feed_options', 'wprss_do_not_cache_feeds' );
    116
    +
    117
    + //$feed = wprss_fetch_feed( $feed_url );
    118
    + remove_filter( 'wp_feed_cache_transient_lifetime' , 'wprss_feed_cache_lifetime' );
    119
    +
    120
    + if ( !is_wp_error( $feed ) ) {
    121
    +
    122
    + // Figure out how many total items there are, but limit it to the number of items set in options.
    123
    + $maxitems = $feed->get_item_quantity( $feed_item_limit );
    124
    +
    125
    + if ( $maxitems == 0 ) { return; }
    126
    +
    127
    + // Build an array of all the items, starting with element 0 (first element).
    128
    + $items = $feed->get_items( 0, $maxitems );
    129
    + return $items;
    130
    + }
    131
    +
    132
    + else { return; }
    133
    + }
    134
    +
    135
    +
    136
    + /**
    137
    + * Insert a WPRSS feed item post
    138
    + *
    139
    + * @since 3.0
    140
    + */
    141
    + function wprss_items_insert_post( $items, $feed_ID ) {
    142
    +
    143
    + // Gather the permalinks of existing feed item's related to this feed source
    144
    + $existing_permalinks = get_existing_permalinks( $feed_ID );
    145
    +
    146
    + foreach ( $items as $item ) {
    147
    +
    148
    + // normalize permalink to pass through feed proxy URL
    149
    + $permalink = $item->get_permalink();
    150
    +
    151
    + // CHECK PERMALINK FOR VIDEO HOSTS : YOUTUBE, VIMEO AND DAILYMOTION
    152
    + $found_video_host = preg_match( '/http[s]?:\/\/(www\.)?(youtube|dailymotion|vimeo)\.com\/(.*)/i', $permalink, $matches );
    153
    +
    154
    + // If video host was found
    155
    + if ( $found_video_host !== 0 && $found_video_host !== FALSE ) {
    156
    +
    157
    + // Get general options
    158
    + $options = get_option( 'wprss_settings_general' );
    159
    + // Get the video link option entry, or false if it does not exist
    160
    + $video_link = ( isset($options['video_link']) )? $options['video_link'] : 'false';
    161
    +
    162
    + // If the video link option is true, change the video URL to its repective host's embedded
    163
    + // video player URL. Otherwise, leave the permalink as is.
    164
    + if ( strtolower( $video_link ) === 'true' ) {
    165
    + $host = $matches[2];
    166
    + switch( $host ) {
    167
    + case 'youtube':
    168
    + preg_match( '/(&|\?)v=([^&]+)/', $permalink, $yt_matches );
    169
    + $permalink = 'http://www.youtube.com/embed/' . $yt_matches[2];
    170
    + break;
    171
    + case 'vimeo':
    172
    + preg_match( '/(\d*)$/i', $permalink, $vim_matches );
    173
    + $permalink = 'http://player.vimeo.com/video/' . $vim_matches[0];
    174
    + break;
    175
    + case 'dailymotion':
    176
    + preg_match( '/(\.com\/)(video\/)(.*)/i', $permalink, $dm_matches );
    177
    + $permalink = 'http://www.dailymotion.com/embed/video/' . $dm_matches[3];
    178
    + break;
    179
    + }
    180
    + }
    181
    + }
    182
    +
    183
    +
    184
    + /*
    185
    + $response = wp_remote_head( $permalink );
    186
    + if ( !is_wp_error( $response ) && isset( $response['headers']['location'] ) ) {
    187
    + $permalink = current( explode( '?', $response['headers']['location'] ) );
    188
    + }*/
    189
    +
    190
    + // Check if newly fetched item already present in existing feed items,
    191
    + // if not insert it into wp_posts and insert post meta.
    192
    + if ( ! ( in_array( $permalink, $existing_permalinks ) ) ) {
    193
    +
    194
    + // Apply filters that determine if the feed item should be inserted into the DB or not.
    195
    + $item = apply_filters( 'wprss_insert_post_item_conditionals', $item, $feed_ID, $permalink );
    196
    +
    197
    + // If the item is not NULL, continue to inserting the feed item post into the DB
    198
    + if ( $item !== NULL ) {
    199
    +
    200
    + $feed_item = apply_filters(
    201
    + 'wprss_populate_post_data',
    202
    + array(
    203
    + 'post_title' => $item->get_title(),
    204
    + 'post_content' => '',
    205
    + 'post_status' => 'publish',
    206
    + 'post_type' => 'wprss_feed_item',
    207
    + ),
    208
    + $item
    209
    + );
    210
    +
    211
    + // Create and insert post object into the DB
    212
    + $inserted_ID = wp_insert_post( $feed_item );
    213
    +
    214
    + // Create and insert post meta into the DB
    215
    + wprss_items_insert_post_meta( $inserted_ID, $item, $feed_ID, $permalink );
    216
    +
    217
    + // Remember newly added permalink
    218
    + $existing_permalinks[] = $permalink;
    219
    + }
    220
    + }
    221
    + }
    222
    + }
    223
    +
    224
    +
    225
    + /**
    226
    + * Creates meta entries for feed items while they are being imported
    227
    + *
    228
    + * @since 2.3
    229
    + */
    230
    + function wprss_items_insert_post_meta( $inserted_ID, $item, $feed_ID, $feed_url) {
    231
    +
    232
    + update_post_meta( $inserted_ID, 'wprss_item_permalink', $feed_url );
    233
    + update_post_meta( $inserted_ID, 'wprss_item_description', $item->get_description() );
    234
    + update_post_meta( $inserted_ID, 'wprss_item_date', $item->get_date( 'U' ) ); // Save as Unix timestamp format
    235
    + update_post_meta( $inserted_ID, 'wprss_feed_id', $feed_ID);
    236
    + do_action( 'wprss_items_create_post_meta', $inserted_ID, $item, $feed_ID );
    237
    + }
    238
    +
    239
    +
    240
    + add_action( 'publish_wprss_feed', 'wprss_fetch_insert_feed_items', 10 );
    241
    + /**
    242
    + * Fetches feed items from source provided and inserts into db
    243
    + *
    244
    + * This function is used when inserting or untrashing a new feed source, it only gets feeds from that particular source
    245
    + *
    246
    + * @since 3.0
    247
    + */
    248
    + function wprss_fetch_insert_feed_items( $post_id ) {
    249
    + wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( $post_id ) );
    250
    + }
    251
    +
    252
    +
    253
    + add_action( 'post_updated', 'wprss_updated_feed_source', 10, 3 );
    254
    + /**
    255
    + * This function is triggered just after a post is updated.
    256
    + * It checks if the updated post is a feed source, and carries out any
    257
    + * updating necassary.
    258
    + *
    259
    + * @since 3.3
    260
    + */
    261
    + function wprss_updated_feed_source( $post_ID, $post_after, $post_before ) {
    262
    + // Check if the post is a feed source and is published
    263
    +
    264
    + if ( ( $post_after->post_type == 'wprss_feed' ) && ( $post_after->post_status == 'publish' ) ) {
    265
    +
    266
    + if ( isset( $_POST['wprss_limit'] ) && !empty( $_POST['wprss_limit'] ) ) {
    267
    + // Checking feed limit change
    268
    + // Get the limit currently saved in db, and limit in POST request
    269
    + //$limit = get_post_meta( $post_ID, 'wprss_limit', true );
    270
    + $limit = $_POST['wprss_limit'];
    271
    + // Get all feed items for this source
    272
    + $feed_sources = new WP_Query(
    273
    + array(
    274
    + 'post_type' => 'wprss_feed_item',
    275
    + 'post_status' => 'publish',
    276
    + 'cache_results' => false, // Disable caching, used for one-off queries
    277
    + 'no_found_rows' => true, // We don't need pagination, so disable it
    278
    + 'posts_per_page' => -1,
    279
    + 'orderby' => 'date',
    280
    + 'order' => 'ASC',
    281
    + 'meta_query' => array(
    282
    + array(
    283
    + 'key' => 'wprss_feed_id',
    284
    + 'value' => $post_ID,
    285
    + 'compare' => 'LIKE'
    286
    + )
    287
    + )
    288
    + )
    289
    + );
    290
    + // If the limit is smaller than the number of found posts, delete the feed items
    291
    + // and re-import, to ensure that most recent feed items are present.
    292
    + $difference = intval( $feed_sources->post_count ) - intval( $limit );
    293
    + if ( $difference > 0 ) {
    294
    + // Loop and delete the excess feed items
    295
    + while ( $feed_sources->have_posts() && $difference > 0 ) {
    296
    + $feed_sources->the_post();
    297
    + wp_delete_post( get_the_ID(), true );
    298
    + $difference--;
    299
    + }
    300
    + }
    301
    + }
    302
    + }
    303
    + }
    304
    +
    305
    +
    306
    +
    307
    + add_action( 'wprss_fetch_single_feed_hook', 'wprss_fetch_insert_single_feed_items' );
    308
    + /**
    309
    + * Fetches feed items from source provided and inserts into db
    310
    + *
    311
    + * @since 3.2
    312
    + */
    313
    + function wprss_fetch_insert_single_feed_items( $feed_ID ) {
    314
    +
    315
    + // Get the URL and Feed Limit post meta data
    316
    + $feed_url = get_post_meta( $feed_ID, 'wprss_url', true );
    317
    + $feed_limit = get_post_meta( $feed_ID, 'wprss_limit', true );
    318
    +
    319
    + $feed_url = apply_filters( 'wprss_feed_source_url', $feed_url, $feed_ID );
    320
    +
    321
    + // Use the URL custom field to fetch the feed items for this source
    322
    + if ( filter_var( $feed_url, FILTER_VALIDATE_URL ) ) {
    323
    + $items = wprss_get_feed_items( $feed_url );
    324
    +
    325
    + // If the feed has its own meta limit,
    326
    + // slice the items array using the feed meta limit
    327
    + if ( !empty( $feed_limit ) )
    328
    + $items_to_insert = array_slice($items, 0, $feed_limit);
    329
    + else $items_to_insert = $items;
    330
    +
    331
    + // Insert the items into the db
    332
    + if ( !empty( $items_to_insert ) ) {
    333
    + wprss_items_insert_post( $items_to_insert, $feed_ID );
    334
    + }
    335
    + }
    336
    + }
    337
    +
    338
    +
    339
    + /**
    340
    + * Fetches all feed items from sources provided and inserts into db
    341
    + *
    342
    + * This function is used by the cron job or the debugging functions to get all feeds from all feed sources
    343
    + *
    344
    + * @since 3.0
    345
    + */
    346
    + function wprss_fetch_insert_all_feed_items() {
    347
    +
    348
    + // Get all feed sources
    349
    + $feed_sources = wprss_get_all_feed_sources();
    350
    +
    351
    + if( $feed_sources->have_posts() ) {
    352
    + // Start by getting one feed source, we will cycle through them one by one,
    353
    + // fetching feed items and adding them to the database in each pass
    354
    + while ( $feed_sources->have_posts() ) {
    355
    + $feed_sources->the_post();
    356
    + wp_schedule_single_event( time(), 'wprss_fetch_single_feed_hook', array( get_the_ID() ) );
    357
    + }
    358
    + wp_reset_postdata(); // Restore the $post global to the current post in the main query
    359
    + }
    360
    + }
    361
    +
    362
    +
    363
    +
    364
    + add_action( 'updated_post_meta', 'wprss_update_feed_meta', 10, 4 );
    365
    + /**
    366
    + * This function is run whenever a post is saved or updated.
    367
    + *
    368
    + * @since 3.4
    369
    + */
    370
    + function wprss_update_feed_meta( $meta_id, $post_id, $meta_key, $meta_value ) {
    371
    + $post = get_post( $post_id );
    372
    + if ( $post->post_status === 'publish' && $post->post_type === 'wprss_feed' ) {
    373
    + if ( $meta_key === 'wprss_url' )
    374
    + wprss_change_fb_url( $post_id, $meta_value );
    375
    + }
    376
    + }
    377
    +
    378
    +
    379
    + function wprss_change_fb_url( $post_id, $url ) {
    380
    + # Check if url begins with a known facebook hostname.
    381
    + if ( stripos( $url, 'http://facebook.com' ) === 0
    382
    + || stripos( $url, 'http://www.facebook.com' ) === 0
    383
    + || stripos( $url, 'https://facebook.com' ) === 0
    384
    + || stripos( $url, 'https://www.facebook.com' ) === 0
    385
    + ) {
    386
    + # Generate the new URL to FB Graph
    387
    + $com_index = stripos( $url, '.com' );
    388
    + $fb_page = substr( $url, $com_index + 4 ); # 4 = length of ".com"
    389
    + $fb_graph_url = 'http://graph.facebook.com' . $fb_page;
    390
    + # Contact FB Graph and get data
    391
    + $response = wp_remote_get( $fb_graph_url );
    392
    + # If the repsonse successful and has a body
    393
    + if ( !is_wp_error( $response ) && isset( $response['body'] ) ) {
    394
    + # Parse the body as a JSON string
    395
    + $json = json_decode( $response['body'], true );
    396
    + # If an id is present ...
    397
    + if ( isset( $json['id'] ) ) {
    398
    + # Generate the final URL for this feed and update the post meta
    399
    + $final_url = "http://www.facebook.com/feeds/page.php?format=atom10&id=" . $json['id'];
    400
    + update_post_meta( $post_id, 'wprss_url', $final_url, $url );
    401
    + }
    402
    + }
    403
    + }
    404
    + }
    405
    +
    406
    +
    407
    + add_action( 'trash_wprss_feed', 'wprss_delete_feed_items' ); // maybe use wp_trash_post action? wp_trash_wprss_feed
    408
    + /**
    409
    + * Delete feed items on trashing of corresponding feed source
    410
    + *
    411
    + * @since 2.0
    412
    + */
    413
    + function wprss_delete_feed_items( $postid ) {
    414
    +
    415
    + $args = array(
    416
    + 'post_type' => 'wprss_feed_item',
    417
    + // Next 3 parameters for performance, see http://thomasgriffinmedia.com/blog/2012/10/optimize-wordpress-queries
    418
    + 'cache_results' => false, // Disable caching, used for one-off queries
    419
    + 'no_found_rows' => true, // We don't need pagination, so disable it
    420
    + 'fields' => 'ids', // Returns post IDs only
    421
    + 'posts_per_page'=> -1,
    422
    + 'meta_query' => array(
    423
    + array(
    424
    + 'key' => 'wprss_feed_id',
    425
    + 'value' => $postid,
    426
    + 'compare' => 'LIKE'
    427
    + )
    428
    + )
    429
    + );
    430
    +
    431
    + $feed_item_ids = get_posts( $args );
    432
    + foreach( $feed_item_ids as $feed_item_id ) {
    433
    + $purge = wp_delete_post( $feed_item_id, true ); // delete the feed item, skipping trash
    434
    + }
    435
    + wp_reset_postdata();
    436
    + }
    437
    +
    438
    +
    439
    + /**
    440
    + * Delete all feed items
    441
    + *
    442
    + * @since 3.0
    443
    + */
    444
    + function wprss_delete_all_feed_items() {
    445
    + $args = array(
    446
    + 'post_type' => 'wprss_feed_item',
    447
    + 'cache_results' => false, // Disable caching, used for one-off queries
    448
    + 'no_found_rows' => true, // We don't need pagination, so disable it
    449
    + 'fields' => 'ids', // Returns post IDs only
    450
    + 'posts_per_page' => -1,
    451
    + );
    452
    +
    453
    + //$feed_items = new WP_Query( $args );
    454
    +
    455
    + $feed_item_ids = get_posts( $args );
    456
    + foreach( $feed_item_ids as $feed_item_id ) {
    457
    + $purge = wp_delete_post( $feed_item_id, true ); // delete the feed item, skipping trash
    458
    + }
    459
    + wp_reset_postdata();
    460
    + }
    461
    +
    462
    +
    463
    + /**
    464
    + * Returns the given parameter as a string. Used in wprss_truncate_posts()
    465
    + *
    466
    + * @return string The given parameter as a string
    467
    + * @since 3.5.1
    468
    + */
    469
    + function wprss_return_as_string( $item ) {
    470
    + return "'$item'";
    471
    + }
    472
    +
    473
    + /**
    474
    + * Delete old feed items from the database to avoid bloat
    475
    + *
    476
    + * @since 2.0
    477
    + */
    478
    + function wprss_truncate_posts() {
    479
    + global $wpdb;
    480
    + $general_settings = get_option( 'wprss_settings_general' );
    481
    +
    482
    + if ( $general_settings['limit_feed_items_db'] == 0 ) {
    483
    + return;
    484
    + }
    485
    +
    486
    + // Set your threshold of max posts and post_type name
    487
    + $threshold = $general_settings['limit_feed_items_db'];
    488
    + $post_types = apply_filters( 'wprss_truncation_post_types', array( 'wprss_feed_item' ) );
    489
    + $post_types_str = array_map( 'wprss_return_as_string', $post_types );
    490
    +
    491
    + $post_type_list = implode( ',' , $post_types_str );
    492
    +
    493
    + // Query post type
    494
    + // $wpdb query allows me to select specific columns instead of grabbing the entire post object.
    495
    + $query = "
    496
    + SELECT ID, post_title FROM $wpdb->posts
    497
    + WHERE post_type IN ($post_type_list)
    498
    + AND post_status = 'publish'
    499
    + ORDER BY post_modified DESC
    500
    + ";
    501
    +
    502
    + $results = $wpdb->get_results( $query );
    503
    +
    504
    + // Check if there are any results
    505
    + if ( count( $results ) ){
    506
    + foreach ( $results as $post ) {
    507
    + $i++;
    508
    +
    509
    + // Skip any posts within our threshold
    510
    + if ( $i <= $threshold )
    511
    + continue;
    512
    +
    513
    + // Let the WordPress API do the heavy lifting for cleaning up entire post trails
    514
    + $purge = wp_delete_post( $post->ID, true );
    515
    + }
    516
    + }
    517
    + }
    518
    +
    519
    +
    520
    + /**
    521
    + * Custom version of the WP fetch_feed() function, since we want custom sanitization of a feed
    522
    + *
    523
    + * Not being used at the moment, until we decide whether we can still use fetch_feed and modify its handling of sanitization
    524
    + *
    525
    + * @since 3.0
    526
    + *
    527
    + */
    528
    + /*function wprss_fetch_feed($url) {
    529
    + require_once (ABSPATH . WPINC . '/class-feed.php');
    530
    +
    531
    + $feed = new SimplePie();
    532
    +
    533
    + // $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
    534
    + // We must manually overwrite $feed->sanitize because SimplePie's
    535
    + // constructor sets it before we have a chance to set the sanitization class
    536
    + // $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
    537
    +
    538
    + $feed->set_cache_class( 'WP_Feed_Cache' );
    539
    + $feed->set_file_class( 'WP_SimplePie_File' );
    540
    +
    541
    + $feed->set_feed_url($url);
    542
    + $feed->strip_htmltags(array_merge($feed->strip_htmltags, array( 'h1', 'h2', 'h3', 'h4', 'h5', 'a' )));
    543
    + $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
    544
    + do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
    545
    + $feed->init();
    546
    + $feed->handle_content_type();
    547
    +
    548
    + if ( $feed->error() )
    549
    + return new WP_Error('simplepie-error', $feed->error());
    550
    +
    551
    + return $feed;
    552
    + }*/
    553
    +
    554
    +
    555
    + /**
    556
    + * Deletes all imported feeds and re-imports everything
    557
    + *
    558
    + * @since 3.0
    559
    + */
    560
    + function wprss_feed_reset() {
    561
    + wprss_delete_all_feed_items();
    562
    + wprss_fetch_insert_all_feed_items();
    563
    + }
    564
    +
    565
    + /* add_action( 'wp_feed_options', 'wprss_feed_options' );
    566
    + function wprss_feed_options( $feed) {
    567
    + $feed->strip_htmltags(array_merge($feed->strip_htmltags, array('h1', 'a', 'img','em')));
    568
    + }
    569
    +
    570
    + */
    includes/libraries/WP_Logging.php ADDED
    @@ -0,0 +1,360 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * Class for logging events and errors
    5
    + *
    6
    + * @package WP Logging Class
    7
    + * @copyright Copyright (c) 2012, Pippin Williamson
    8
    + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
    9
    + */
    10
    +
    11
    + class WP_Logging {
    12
    +
    13
    +
    14
    + /**
    15
    + * Class constructor.
    16
    + *
    17
    + * @since 1.0
    18
    + *
    19
    + * @access public
    20
    + * @return void
    21
    + */
    22
    + function __construct() {
    23
    +
    24
    + // create the log post type
    25
    + add_action( 'init', array( $this, 'register_post_type' ) );
    26
    +
    27
    + // create types taxonomy and default types
    28
    + add_action( 'init', array( $this, 'register_taxonomy' ) );
    29
    +
    30
    + }
    31
    +
    32
    +
    33
    + /**
    34
    + * Log types
    35
    + *
    36
    + * Sets up the default log types and allows for new ones to be created
    37
    + *
    38
    + * @access private
    39
    + * @since 1.0
    40
    + *
    41
    + * @return array
    42
    + */
    43
    +
    44
    + private function log_types() {
    45
    + $terms = array(
    46
    + 'error', 'event'
    47
    + );
    48
    +
    49
    + return apply_filters( 'wp_log_types', $terms );
    50
    + }
    51
    +
    52
    +
    53
    + /**
    54
    + * Registers the wp_log Post Type
    55
    + *
    56
    + * @access public
    57
    + * @since 1.0
    58
    + *
    59
    + * @uses register_post_type()
    60
    + *
    61
    + * @return void
    62
    + */
    63
    +
    64
    + public function register_post_type() {
    65
    +
    66
    + /* logs post type */
    67
    +
    68
    + $log_args = array(
    69
    + 'labels' => array( 'name' => __( 'Logs', 'wp-logging' ) ),
    70
    + 'public' => false,
    71
    + 'query_var' => false,
    72
    + 'rewrite' => false,
    73
    + 'capability_type' => 'post',
    74
    + 'supports' => array( 'title', 'editor' ),
    75
    + 'can_export' => false
    76
    + );
    77
    + register_post_type( 'wp_log', apply_filters( 'wp_logging_post_type_args', $log_args ) );
    78
    +
    79
    + }
    80
    +
    81
    +
    82
    + /**
    83
    + * Registers the Type Taxonomy
    84
    + *
    85
    + * The Type taxonomy is used to determine the type of log entry
    86
    + *
    87
    + * @access public
    88
    + * @since 1.0
    89
    + *
    90
    + * @uses register_taxonomy()
    91
    + * @uses term_exists()
    92
    + * @uses wp_insert_term()
    93
    + *
    94
    + * @return void
    95
    + */
    96
    +
    97
    + public function register_taxonomy() {
    98
    +
    99
    + register_taxonomy( 'wp_log_type', 'wp_log' );
    100
    +
    101
    + $types = self::log_types();
    102
    +
    103
    + foreach ( $types as $type ) {
    104
    + if( ! term_exists( $type, 'wp_log_type' ) ) {
    105
    + wp_insert_term( $type, 'wp_log_type' );
    106
    + }
    107
    + }
    108
    + }
    109
    +
    110
    +
    111
    + /**
    112
    + * Check if a log type is valid
    113
    + *
    114
    + * Checks to see if the specified type is in the registered list of types
    115
    + *
    116
    + * @access private
    117
    + * @since 1.0
    118
    + *
    119
    + *
    120
    + * @return array
    121
    + */
    122
    +
    123
    + private function valid_type( $type ) {
    124
    + return in_array( $type, self::log_types() );
    125
    + }
    126
    +
    127
    +
    128
    + /**
    129
    + * Create new log entry
    130
    + *
    131
    + * This is just a simple and fast way to log something. Use self::insert_log()
    132
    + * if you need to store custom meta data
    133
    + *
    134
    + * @access private
    135
    + * @since 1.0
    136
    + *
    137
    + * @uses self::insert_log()
    138
    + *
    139
    + * @return int The ID of the new log entry
    140
    + */
    141
    +
    142
    + public static function add( $title = '', $message = '', $parent = 0, $type = null ) {
    143
    +
    144
    + $log_data = array(
    145
    + 'post_title' => $title,
    146
    + 'post_content' => $message,
    147
    + 'post_parent' => $parent,
    148
    + 'log_type' => $type
    149
    + );
    150
    +
    151
    + return self::insert_log( $log_data );
    152
    +
    153
    + }
    154
    +
    155
    +
    156
    + /**
    157
    + * Stores a log entry
    158
    + *
    159
    + * @access private
    160
    + * @since 1.0
    161
    + *
    162
    + * @uses wp_parse_args()
    163
    + * @uses wp_insert_post()
    164
    + * @uses update_post_meta()
    165
    + * @uses wp_set_object_terms()
    166
    + * @uses sanitize_key()
    167
    + *
    168
    + * @return int The ID of the newly created log item
    169
    + */
    170
    +
    171
    + public static function insert_log( $log_data = array(), $log_meta = array() ) {
    172
    +
    173
    + $defaults = array(
    174
    + 'post_type' => 'wp_log',
    175
    + 'post_status' => 'publish',
    176
    + 'post_parent' => 0,
    177
    + 'post_content' => '',
    178
    + 'log_type' => false
    179
    + );
    180
    +
    181
    + $args = wp_parse_args( $log_data, $defaults );
    182
    +
    183
    + do_action( 'wp_pre_insert_log' );
    184
    +
    185
    + // store the log entry
    186
    + $log_id = wp_insert_post( $args );
    187
    +
    188
    + // set the log type, if any
    189
    + if( $log_data['log_type'] && self::valid_type( $log_data['log_type'] ) ) {
    190
    + wp_set_object_terms( $log_id, $log_data['log_type'], 'wp_log_type', false );
    191
    + }
    192
    +
    193
    +
    194
    + // set log meta, if any
    195
    + if( $log_id && ! empty( $log_meta ) ) {
    196
    + foreach( (array) $log_meta as $key => $meta ) {
    197
    + update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
    198
    + }
    199
    + }
    200
    +
    201
    + do_action( 'wp_post_insert_log', $log_id );
    202
    +
    203
    + return $log_id;
    204
    +
    205
    + }
    206
    +
    207
    +
    208
    + /**
    209
    + * Update and existing log item
    210
    + *
    211
    + * @access private
    212
    + * @since 1.0
    213
    + *
    214
    + * @uses wp_parse_args()
    215
    + * @uses wp_update_post()
    216
    + * @uses update_post_meta()
    217
    + *
    218
    + * @return bool True if successful, false otherwise
    219
    + */
    220
    + public static function update_log( $log_data = array(), $log_meta = array() ) {
    221
    +
    222
    + do_action( 'wp_pre_update_log', $log_id );
    223
    +
    224
    + $defaults = array(
    225
    + 'post_type' => 'wp_log',
    226
    + 'post_status' => 'publish',
    227
    + 'post_parent' => 0
    228
    + );
    229
    +
    230
    + $args = wp_parse_args( $log_data, $defaults );
    231
    +
    232
    + // store the log entry
    233
    + $log_id = wp_update_post( $args );
    234
    +
    235
    + if( $log_id && ! empty( $log_meta ) ) {
    236
    + foreach( (array) $log_meta as $key => $meta ) {
    237
    + if( ! empty( $meta ) )
    238
    + update_post_meta( $log_id, '_wp_log_' . sanitize_key( $key ), $meta );
    239
    + }
    240
    + }
    241
    +
    242
    + do_action( 'wp_post_update_log', $log_id );
    243
    +
    244
    + }
    245
    +
    246
    +
    247
    + /**
    248
    + * Easily retrieves log items for a particular object ID
    249
    + *
    250
    + * @access private
    251
    + * @since 1.0
    252
    + *
    253
    + * @uses self::get_connected_logs()
    254
    + *
    255
    + * @return array
    256
    + */
    257
    +
    258
    + public static function get_logs( $object_id = 0, $type = null, $paged = null ) {
    259
    + return self::get_connected_logs( array( 'post_parent' => $object_id, 'paged' => $paged, 'log_type' => $type ) );
    260
    +
    261
    + }
    262
    +
    263
    +
    264
    + /**
    265
    + * Retrieve all connected logs
    266
    + *
    267
    + * Used for retrieving logs related to particular items, such as a specific purchase.
    268
    + *
    269
    + * @access private
    270
    + * @since 1.0
    271
    + *
    272
    + * @uses wp_parse_args()
    273
    + * @uses get_posts()
    274
    + * @uses get_query_var()
    275
    + * @uses self::valid_type()
    276
    + *
    277
    + * @return array / false
    278
    + */
    279
    +
    280
    + public static function get_connected_logs( $args = array() ) {
    281
    +
    282
    + $defaults = array(
    283
    + 'post_parent' => 0,
    284
    + 'post_type' => 'wp_log',
    285
    + 'posts_per_page' => 10,
    286
    + 'post_status' => 'publish',
    287
    + 'paged' => get_query_var( 'paged' ),
    288
    + 'log_type' => false
    289
    + );
    290
    +
    291
    + $query_args = wp_parse_args( $args, $defaults );
    292
    +
    293
    + if( $query_args['log_type'] && self::valid_type( $query_args['log_type'] ) ) {
    294
    +
    295
    + $query_args['tax_query'] = array(
    296
    + array(
    297
    + 'taxonomy' => 'wp_log_type',
    298
    + 'field' => 'slug',
    299
    + 'terms' => $query_args['log_type']
    300
    + )
    301
    + );
    302
    +
    303
    + }
    304
    +
    305
    + $logs = get_posts( $query_args );
    306
    +
    307
    + if( $logs )
    308
    + return $logs;
    309
    +
    310
    + // no logs found
    311
    + return false;
    312
    +
    313
    + }
    314
    +
    315
    +
    316
    + /**
    317
    + * Retrieves number of log entries connected to particular object ID
    318
    + *
    319
    + * @access private
    320
    + * @since 1.0
    321
    + *
    322
    + * @uses WP_Query()
    323
    + * @uses self::valid_type()
    324
    + *
    325
    + * @return int
    326
    + */
    327
    +
    328
    + public static function get_log_count( $object_id = 0, $type = null, $meta_query = null ) {
    329
    +
    330
    + $query_args = array(
    331
    + 'post_parent' => $object_id,
    332
    + 'post_type' => 'wp_log',
    333
    + 'posts_per_page' => -1,
    334
    + 'post_status' => 'publish'
    335
    + );
    336
    +
    337
    + if( ! empty( $type ) && self::valid_type( $type ) ) {
    338
    +
    339
    + $query_args['tax_query'] = array(
    340
    + array(
    341
    + 'taxonomy' => 'wp_log_type',
    342
    + 'field' => 'slug',
    343
    + 'terms' => $type
    344
    + )
    345
    + );
    346
    +
    347
    + }
    348
    +
    349
    + if( ! empty( $meta_query ) ) {
    350
    + $query_args['meta_query'] = $meta_query;
    351
    + }
    352
    +
    353
    + $logs = new WP_Query( $query_args );
    354
    +
    355
    + return (int) $logs->post_count;
    356
    +
    357
    + }
    358
    +
    359
    + }
    360
    + $GLOBALS['wp_logs'] = new WP_Logging();
    includes/libraries/browser.php ADDED
    @@ -0,0 +1,1082 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Modified to remove var
    4
    + * Chris Christoff on 12/26/2012
    5
    + * Changes: Changes vars to publics
    6
    + *
    7
    + * Modified to work for EDD by
    8
    + * Chris Christoff on 12/23/2012
    9
    + * Changes: Removed the browser string return and added spacing. Also removed return HTML formatting.
    10
    + *
    11
    + * Modified to add formatted User Agent string for EDD System Info by
    12
    + * Chris Christoff on 12/23/2012
    13
    + * Changes: Split user string and add formatting so we can print a nicely
    14
    + * formatted user agent string on the EDD System Info
    15
    + *
    16
    + * File: Browser.php
    17
    + * Author: Chris Schuld (http://chrisschuld.com/)
    18
    + * Last Modified: August 20th, 2010
    19
    + * @version 1.9
    20
    + * @package PegasusPHP
    21
    + *
    22
    + * Copyright (C) 2008-2010 Chris Schuld (chris@chrisschuld.com)
    23
    + *
    24
    + * This program is free software; you can redistribute it and/or
    25
    + * modify it under the terms of the GNU General Public License as
    26
    + * published by the Free Software Foundation; either version 2 of
    27
    + * the License, or (at your option) any later version.
    28
    + *
    29
    + * This program is distributed in the hope that it will be useful,
    30
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    31
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    32
    + * GNU General Public License for more details at:
    33
    + * http://www.gnu.org/copyleft/gpl.html
    34
    + *
    35
    + *
    36
    + * Typical Usage:
    37
    + *
    38
    + * $browser = new Browser();
    39
    + * if( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) {
    40
    + * echo 'You have FireFox version 2 or greater';
    41
    + * }
    42
    + *
    43
    + * User Agents Sampled from: http://www.useragentstring.com/
    44
    + *
    45
    + * This implementation is based on the original work from Gary White
    46
    + * http://apptools.com/phptools/browser/
    47
    + *
    48
    + * UPDATES:
    49
    + *
    50
    + * 2010-08-20 (v1.9):
    51
    + * + Added MSN Explorer Browser (legacy)
    52
    + * + Added Bing/MSN Robot (Thanks Rob MacDonald)
    53
    + * + Added the Android Platform (PLATFORM_ANDROID)
    54
    + * + Fixed issue with Android 1.6/2.2 (Thanks Tom Hirashima)
    55
    + *
    56
    + * 2010-04-27 (v1.8):
    57
    + * + Added iPad Support
    58
    + *
    59
    + * 2010-03-07 (v1.7):
    60
    + * + *MAJOR* Rebuild (preg_match and other "slow" routine removal(s))
    61
    + * + Almost allof Gary's original code has been replaced
    62
    + * + Large PHPUNIT testing environment created to validate new releases and additions
    63
    + * + Added FreeBSD Platform
    64
    + * + Added OpenBSD Platform
    65
    + * + Added NetBSD Platform
    66
    + * + Added SunOS Platform
    67
    + * + Added OpenSolaris Platform
    68
    + * + Added support of the Iceweazel Browser
    69
    + * + Added isChromeFrame() call to check if chromeframe is in use
    70
    + * + Moved the Opera check in front of the Firefox check due to legacy Opera User Agents
    71
    + * + Added the __toString() method (Thanks Deano)
    72
    + *
    73
    + * 2009-11-15:
    74
    + * + Updated the checkes for Firefox
    75
    + * + Added the NOKIA platform
    76
    + * + Added Checks for the NOKIA brower(s)
    77
    + *
    78
    + * 2009-11-08:
    79
    + * + PHP 5.3 Support
    80
    + * + Added support for BlackBerry OS and BlackBerry browser
    81
    + * + Added support for the Opera Mini browser
    82
    + * + Added additional documenation
    83
    + * + Added support for isRobot() and isMobile()
    84
    + * + Added support for Opera version 10
    85
    + * + Added support for deprecated Netscape Navigator version 9
    86
    + * + Added support for IceCat
    87
    + * + Added support for Shiretoko
    88
    + *
    89
    + * 2010-04-27 (v1.8):
    90
    + * + Added iPad Support
    91
    + *
    92
    + * 2009-08-18:
    93
    + * + Updated to support PHP 5.3 - removed all deprecated function calls
    94
    + * + Updated to remove all double quotes (") -- converted to single quotes (')
    95
    + *
    96
    + * 2009-04-27:
    97
    + * + Updated the IE check to remove a typo and bug (thanks John)
    98
    + *
    99
    + * 2009-04-22:
    100
    + * + Added detection for GoogleBot
    101
    + * + Added detection for the W3C Validator.
    102
    + * + Added detection for Yahoo! Slurp
    103
    + *
    104
    + * 2009-03-14:
    105
    + * + Added detection for iPods.
    106
    + * + Added Platform detection for iPhones
    107
    + * + Added Platform detection for iPods
    108
    + *
    109
    + * 2009-02-16: (Rick Hale)
    110
    + * + Added version detection for Android phones.
    111
    + *
    112
    + * 2008-12-09:
    113
    + * + Removed unused constant
    114
    + *
    115
    + * 2008-11-07:
    116
    + * + Added Google's Chrome to the detection list
    117
    + * + Added isBrowser(string) to the list of functions special thanks to
    118
    + * Daniel 'mavrick' Lang for the function concept (http://mavrick.id.au)
    119
    + *
    120
    + *
    121
    + * Gary White noted: "Since browser detection is so unreliable, I am
    122
    + * no longer maintaining this script. You are free to use and or
    123
    + * modify/update it as you want, however the author assumes no
    124
    + * responsibility for the accuracy of the detected values."
    125
    + *
    126
    + * Anyone experienced with Gary's script might be interested in these notes:
    127
    + *
    128
    + * Added class constants
    129
    + * Added detection and version detection for Google's Chrome
    130
    + * Updated the version detection for Amaya
    131
    + * Updated the version detection for Firefox
    132
    + * Updated the version detection for Lynx
    133
    + * Updated the version detection for WebTV
    134
    + * Updated the version detection for NetPositive
    135
    + * Updated the version detection for IE
    136
    + * Updated the version detection for OmniWeb
    137
    + * Updated the version detection for iCab
    138
    + * Updated the version detection for Safari
    139
    + * Updated Safari to remove mobile devices (iPhone)
    140
    + * Added detection for iPhone
    141
    + * Added detection for robots
    142
    + * Added detection for mobile devices
    143
    + * Added detection for BlackBerry
    144
    + * Removed Netscape checks (matches heavily with firefox & mozilla)
    145
    + *
    146
    + */
    147
    +
    148
    + class Browser {
    149
    + public $_agent = '';
    150
    + public $_browser_name = '';
    151
    + public $_version = '';
    152
    + public $_platform = '';
    153
    + public $_os = '';
    154
    + public $_is_aol = false;
    155
    + public $_is_mobile = false;
    156
    + public $_is_robot = false;
    157
    + public $_aol_version = '';
    158
    +
    159
    + public $BROWSER_UNKNOWN = 'unknown';
    160
    + public $VERSION_UNKNOWN = 'unknown';
    161
    +
    162
    + public $BROWSER_OPERA = 'Opera'; // Http://www.opera.com/
    163
    + public $BROWSER_OPERA_MINI = 'Opera Mini'; // Http://www.opera.com/mini/
    164
    + public $BROWSER_WEBTV = 'WebTV'; // Http://www.webtv.net/pc/
    165
    + public $BROWSER_IE = 'Internet Explorer'; // Http://www.microsoft.com/ie/
    166
    + public $BROWSER_POCKET_IE = 'Pocket Internet Explorer'; // Http://en.wikipedia.org/wiki/Internet_Explorer_Mobile
    167
    + public $BROWSER_KONQUEROR = 'Konqueror'; // Http://www.konqueror.org/
    168
    + public $BROWSER_ICAB = 'iCab'; // Http://www.icab.de/
    169
    + public $BROWSER_OMNIWEB = 'OmniWeb'; // Http://www.omnigroup.com/applications/omniweb/
    170
    + public $BROWSER_FIREBIRD = 'Firebird'; // Http://www.ibphoenix.com/
    171
    + public $BROWSER_FIREFOX = 'Firefox'; // Http://www.mozilla.com/en-US/firefox/firefox.html
    172
    + public $BROWSER_ICEWEASEL = 'Iceweasel'; // Http://www.geticeweasel.org/
    173
    + public $BROWSER_SHIRETOKO = 'Shiretoko'; // Http://wiki.mozilla.org/Projects/shiretoko
    174
    + public $BROWSER_MOZILLA = 'Mozilla'; // Http://www.mozilla.com/en-US/
    175
    + public $BROWSER_AMAYA = 'Amaya'; // Http://www.w3.org/Amaya/
    176
    + public $BROWSER_LYNX = 'Lynx'; // Http://en.wikipedia.org/wiki/Lynx
    177
    + public $BROWSER_SAFARI = 'Safari'; // Http://apple.com
    178
    + public $BROWSER_IPHONE = 'iPhone'; // Http://apple.com
    179
    + public $BROWSER_IPOD = 'iPod'; // Http://apple.com
    180
    + public $BROWSER_IPAD = 'iPad'; // Http://apple.com
    181
    + public $BROWSER_CHROME = 'Chrome'; // Http://www.google.com/chrome
    182
    + public $BROWSER_ANDROID = 'Android'; // Http://www.android.com/
    183
    + public $BROWSER_GOOGLEBOT = 'GoogleBot'; // Http://en.wikipedia.org/wiki/Googlebot
    184
    + public $BROWSER_SLURP = 'Yahoo! Slurp'; // Http://en.wikipedia.org/wiki/Yahoo!_Slurp
    185
    + public $BROWSER_W3CVALIDATOR = 'W3C Validator'; // Http://validator.w3.org/
    186
    + public $BROWSER_BLACKBERRY = 'BlackBerry'; // Http://www.blackberry.com/
    187
    + public $BROWSER_ICECAT = 'IceCat'; // Http://en.wikipedia.org/wiki/GNU_IceCat
    188
    + public $BROWSER_NOKIA_S60 = 'Nokia S60 OSS Browser'; // Http://en.wikipedia.org/wiki/Web_Browser_for_S60
    189
    + public $BROWSER_NOKIA = 'Nokia Browser'; // * all other WAP-based browsers on the Nokia Platform
    190
    + public $BROWSER_MSN = 'MSN Browser'; // Http://explorer.msn.com/
    191
    + public $BROWSER_MSNBOT = 'MSN Bot'; // Http://search.msn.com/msnbot.htm
    192
    + // Http://en.wikipedia.org/wiki/Msnbot (used for Bing as well)
    193
    +
    194
    + public $BROWSER_NETSCAPE_NAVIGATOR = 'Netscape Navigator'; // Http://browser.netscape.com/ (DEPRECATED)
    195
    + public $BROWSER_GALEON = 'Galeon'; // Http://galeon.sourceforge.net/ (DEPRECATED)
    196
    + public $BROWSER_NETPOSITIVE = 'NetPositive'; // Http://en.wikipedia.org/wiki/NetPositive (DEPRECATED)
    197
    + public $BROWSER_PHOENIX = 'Phoenix'; // Http://en.wikipedia.org/wiki/History_of_Mozilla_Firefox (DEPRECATED)
    198
    +
    199
    + public $PLATFORM_UNKNOWN = 'unknown';
    200
    + public $PLATFORM_WINDOWS = 'Windows';
    201
    + public $PLATFORM_WINDOWS_CE = 'Windows CE';
    202
    + public $PLATFORM_APPLE = 'Apple';
    203
    + public $PLATFORM_LINUX = 'Linux';
    204
    + public $PLATFORM_OS2 = 'OS/2';
    205
    + public $PLATFORM_BEOS = 'BeOS';
    206
    + public $PLATFORM_IPHONE = 'iPhone';
    207
    + public $PLATFORM_IPOD = 'iPod';
    208
    + public $PLATFORM_IPAD = 'iPad';
    209
    + public $PLATFORM_BLACKBERRY = 'BlackBerry';
    210
    + public $PLATFORM_NOKIA = 'Nokia';
    211
    + public $PLATFORM_FREEBSD = 'FreeBSD';
    212
    + public $PLATFORM_OPENBSD = 'OpenBSD';
    213
    + public $PLATFORM_NETBSD = 'NetBSD';
    214
    + public $PLATFORM_SUNOS = 'SunOS';
    215
    + public $PLATFORM_OPENSOLARIS = 'OpenSolaris';
    216
    + public $PLATFORM_ANDROID = 'Android';
    217
    +
    218
    + public $OPERATING_SYSTEM_UNKNOWN = 'unknown';
    219
    +
    220
    + function Browser($useragent="") {
    221
    + $this->reset();
    222
    + if( $useragent != "" ) {
    223
    + $this->setUserAgent($useragent);
    224
    + }
    225
    + else {
    226
    + $this->determine();
    227
    + }
    228
    + }
    229
    +
    230
    + /**
    231
    + * Reset all properties
    232
    + */
    233
    + function reset() {
    234
    + $this->_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
    235
    + $this->_browser_name = $this->BROWSER_UNKNOWN;
    236
    + $this->_version = $this->VERSION_UNKNOWN;
    237
    + $this->_platform = $this->PLATFORM_UNKNOWN;
    238
    + $this->_os = $this->OPERATING_SYSTEM_UNKNOWN;
    239
    + $this->_is_aol = false;
    240
    + $this->_is_mobile = false;
    241
    + $this->_is_robot = false;
    242
    + $this->_aol_version = $this->VERSION_UNKNOWN;
    243
    + }
    244
    +
    245
    + /**
    246
    + * Check to see if the specific browser is valid
    247
    + * @param string $browserName
    248
    + * @return True if the browser is the specified browser
    249
    + */
    250
    + function isBrowser($browserName) { return( 0 == strcasecmp($this->_browser_name, trim($browserName))); }
    251
    +
    252
    + /**
    253
    + * The name of the browser. All return types are from the class contants
    254
    + * @return string Name of the browser
    255
    + */
    256
    + function getBrowser() { return $this->_browser_name; }
    257
    + /**
    258
    + * Set the name of the browser
    259
    + * @param $browser The name of the Browser
    260
    + */
    261
    + function setBrowser($browser) { return $this->_browser_name = $browser; }
    262
    + /**
    263
    + * The name of the platform. All return types are from the class contants
    264
    + * @return string Name of the browser
    265
    + */
    266
    + function getPlatform() { return $this->_platform; }
    267
    + /**
    268
    + * Set the name of the platform
    269
    + * @param $platform The name of the Platform
    270
    + */
    271
    + function setPlatform($platform) { return $this->_platform = $platform; }
    272
    + /**
    273
    + * The version of the browser.
    274
    + * @return string Version of the browser (will only contain alpha-numeric characters and a period)
    275
    + */
    276
    + function getVersion() { return $this->_version; }
    277
    + /**
    278
    + * Set the version of the browser
    279
    + * @param $version The version of the Browser
    280
    + */
    281
    + function setVersion($version) { $this->_version = preg_replace('/[^0-9,.,a-z,A-Z-]/','',$version); }
    282
    + /**
    283
    + * The version of AOL.
    284
    + * @return string Version of AOL (will only contain alpha-numeric characters and a period)
    285
    + */
    286
    + function getAolVersion() { return $this->_aol_version; }
    287
    + /**
    288
    + * Set the version of AOL
    289
    + * @param $version The version of AOL
    290
    + */
    291
    + function setAolVersion($version) { $this->_aol_version = preg_replace('/[^0-9,.,a-z,A-Z]/','',$version); }
    292
    + /**
    293
    + * Is the browser from AOL?
    294
    + * @return boolean True if the browser is from AOL otherwise false
    295
    + */
    296
    + function isAol() { return $this->_is_aol; }
    297
    + /**
    298
    + * Is the browser from a mobile device?
    299
    + * @return boolean True if the browser is from a mobile device otherwise false
    300
    + */
    301
    + function isMobile() { return $this->_is_mobile; }
    302
    + /**
    303
    + * Is the browser from a robot (ex Slurp,GoogleBot)?
    304
    + * @return boolean True if the browser is from a robot otherwise false
    305
    + */
    306
    + function isRobot() { return $this->_is_robot; }
    307
    + /**
    308
    + * Set the browser to be from AOL
    309
    + * @param $isAol
    310
    + */
    311
    + function setAol($isAol) { $this->_is_aol = $isAol; }
    312
    + /**
    313
    + * Set the Browser to be mobile
    314
    + * @param boolean $value is the browser a mobile brower or not
    315
    + */
    316
    + function setMobile($value=true) { $this->_is_mobile = $value; }
    317
    + /**
    318
    + * Set the Browser to be a robot
    319
    + * @param boolean $value is the browser a robot or not
    320
    + */
    321
    + function setRobot($value=true) { $this->_is_robot = $value; }
    322
    + /**
    323
    + * Get the user agent value in use to determine the browser
    324
    + * @return string The user agent from the HTTP header
    325
    + */
    326
    + function getUserAgent() { return $this->_agent; }
    327
    + /**
    328
    + * Set the user agent value (the construction will use the HTTP header value - this will overwrite it)
    329
    + * @param $agent_string The value for the User Agent
    330
    + */
    331
    + function setUserAgent($agent_string) {
    332
    + $this->reset();
    333
    + $this->_agent = $agent_string;
    334
    + $this->determine();
    335
    + }
    336
    + /**
    337
    + * Used to determine if the browser is actually "chromeframe"
    338
    + * @since 1.7
    339
    + * @return boolean True if the browser is using chromeframe
    340
    + */
    341
    + function isChromeFrame() {
    342
    + return( strpos($this->_agent,"chromeframe") !== false );
    343
    + }
    344
    + /**
    345
    + * Returns a formatted string with a summary of the details of the browser.
    346
    + * @return string formatted string with a summary of the browser
    347
    + */
    348
    + function __toString() {
    349
    + $text1 = $this->getUserAgent(); //grabs the UA (user agent) string
    350
    + $UAline1 = substr($text1, 0, 32); //the first line we print should only be the first 32 characters of the UA string
    351
    + $text2 = $this->getUserAgent();//now we grab it again and save it to a string
    352
    + $towrapUA = str_replace($UAline1, '', $text2);//the rest of the printoff (other than first line) is equivolent
    353
    + // To the whole string minus the part we printed off. IE
    354
    + // User Agent: thefirst32charactersfromUAline1
    355
    + // the rest of it is now stored in
    356
    + // $text2 to be printed off
    357
    + // But we need to add spaces before each line that is split other than line 1
    358
    + $space = '';
    359
    + for($i = 0; $i < 25; $i++) {
    360
    + $space .= ' ';
    361
    + }
    362
    + // Now we split the remaining string of UA ($text2) into lines that are prefixed by spaces for formatting
    363
    + $wordwrapped = chunk_split($towrapUA, 32, "\n $space");
    364
    + return "Platform: {$this->getPlatform()} \n".
    365
    + "Browser Name: {$this->getBrowser()} \n" .
    366
    + "Browser Version: {$this->getVersion()} \n" .
    367
    + "User Agent String: $UAline1 \n\t\t\t " .
    368
    + "$wordwrapped";
    369
    + }
    370
    + /**
    371
    + * Protected routine to calculate and determine what the browser is in use (including platform)
    372
    + */
    373
    + function determine() {
    374
    + $this->checkPlatform();
    375
    + $this->checkBrowsers();
    376
    + $this->checkForAol();
    377
    + }
    378
    + /**
    379
    + * Protected routine to determine the browser type
    380
    + * @return boolean True if the browser was detected otherwise false
    381
    + */
    382
    + function checkBrowsers() {
    383
    + return (
    384
    + // Well-known, well-used
    385
    + // Special Notes:
    386
    + // (1) Opera must be checked before FireFox due to the odd
    387
    + // user agents used in some older versions of Opera
    388
    + // (2) WebTV is strapped onto Internet Explorer so we must
    389
    + // check for WebTV before IE
    390
    + // (3) (deprecated) Galeon is based on Firefox and needs to be
    391
    + // tested before Firefox is tested
    392
    + // (4) OmniWeb is based on Safari so OmniWeb check must occur
    393
    + // before Safari
    394
    + // (5) Netscape 9+ is based on Firefox so Netscape checks
    395
    + // before FireFox are necessary
    396
    + $this->checkBrowserWebTv() ||
    397
    + $this->checkBrowserInternetExplorer() ||
    398
    + $this->checkBrowserOpera() ||
    399
    + $this->checkBrowserGaleon() ||
    400
    + $this->checkBrowserNetscapeNavigator9Plus() ||
    401
    + $this->checkBrowserFirefox() ||
    402
    + $this->checkBrowserChrome() ||
    403
    + $this->checkBrowserOmniWeb() ||
    404
    +
    405
    + // Common mobile
    406
    + $this->checkBrowserAndroid() ||
    407
    + $this->checkBrowseriPad() ||
    408
    + $this->checkBrowseriPod() ||
    409
    + $this->checkBrowseriPhone() ||
    410
    + $this->checkBrowserBlackBerry() ||
    411
    + $this->checkBrowserNokia() ||
    412
    +
    413
    + // Common bots
    414
    + $this->checkBrowserGoogleBot() ||
    415
    + $this->checkBrowserMSNBot() ||
    416
    + $this->checkBrowserSlurp() ||
    417
    +
    418
    + // WebKit base check (post mobile and others)
    419
    + $this->checkBrowserSafari() ||
    420
    +
    421
    + // Everyone else
    422
    + $this->checkBrowserNetPositive() ||
    423
    + $this->checkBrowserFirebird() ||
    424
    + $this->checkBrowserKonqueror() ||
    425
    + $this->checkBrowserIcab() ||
    426
    + $this->checkBrowserPhoenix() ||
    427
    + $this->checkBrowserAmaya() ||
    428
    + $this->checkBrowserLynx() ||
    429
    +
    430
    + $this->checkBrowserShiretoko() ||
    431
    + $this->checkBrowserIceCat() ||
    432
    + $this->checkBrowserW3CValidator() ||
    433
    + $this->checkBrowserMozilla() /* Mozilla is such an open standard that you must check it last */
    434
    + );
    435
    + }
    436
    +
    437
    + /**
    438
    + * Determine if the user is using a BlackBerry (last updated 1.7)
    439
    + * @return boolean True if the browser is the BlackBerry browser otherwise false
    440
    + */
    441
    + function checkBrowserBlackBerry() {
    442
    + if( stripos($this->_agent,'blackberry') !== false ) {
    443
    + $aresult = explode("/",stristr($this->_agent,"BlackBerry"));
    444
    + $aversion = explode(' ',$aresult[1]);
    445
    + $this->setVersion($aversion[0]);
    446
    + $this->_browser_name = $this->BROWSER_BLACKBERRY;
    447
    + $this->setMobile(true);
    448
    + return true;
    449
    + }
    450
    + return false;
    451
    + }
    452
    +
    453
    + /**
    454
    + * Determine if the user is using an AOL User Agent (last updated 1.7)
    455
    + * @return boolean True if the browser is from AOL otherwise false
    456
    + */
    457
    + function checkForAol() {
    458
    + $this->setAol(false);
    459
    + $this->setAolVersion($this->VERSION_UNKNOWN);
    460
    +
    461
    + if( stripos($this->_agent,'aol') !== false ) {
    462
    + $aversion = explode(' ',stristr($this->_agent, 'AOL'));
    463
    + $this->setAol(true);
    464
    + $this->setAolVersion(preg_replace('/[^0-9\.a-z]/i', '', $aversion[1]));
    465
    + return true;
    466
    + }
    467
    + return false;
    468
    + }
    469
    +
    470
    + /**
    471
    + * Determine if the browser is the GoogleBot or not (last updated 1.7)
    472
    + * @return boolean True if the browser is the GoogletBot otherwise false
    473
    + */
    474
    + function checkBrowserGoogleBot() {
    475
    + if( stripos($this->_agent,'googlebot') !== false ) {
    476
    + $aresult = explode('/',stristr($this->_agent,'googlebot'));
    477
    + $aversion = explode(' ',$aresult[1]);
    478
    + $this->setVersion(str_replace(';','',$aversion[0]));
    479
    + $this->_browser_name = $this->BROWSER_GOOGLEBOT;
    480
    + $this->setRobot(true);
    481
    + return true;
    482
    + }
    483
    + return false;
    484
    + }
    485
    +
    486
    + /**
    487
    + * Determine if the browser is the MSNBot or not (last updated 1.9)
    488
    + * @return boolean True if the browser is the MSNBot otherwise false
    489
    + */
    490
    + function checkBrowserMSNBot() {
    491
    + if( stripos($this->_agent,"msnbot") !== false ) {
    492
    + $aresult = explode("/",stristr($this->_agent,"msnbot"));
    493
    + $aversion = explode(" ",$aresult[1]);
    494
    + $this->setVersion(str_replace(";","",$aversion[0]));
    495
    + $this->_browser_name = $this->BROWSER_MSNBOT;
    496
    + $this->setRobot(true);
    497
    + return true;
    498
    + }
    499
    + return false;
    500
    + }
    501
    +
    502
    + /**
    503
    + * Determine if the browser is the W3C Validator or not (last updated 1.7)
    504
    + * @return boolean True if the browser is the W3C Validator otherwise false
    505
    + */
    506
    + function checkBrowserW3CValidator() {
    507
    + if( stripos($this->_agent,'W3C-checklink') !== false ) {
    508
    + $aresult = explode('/',stristr($this->_agent,'W3C-checklink'));
    509
    + $aversion = explode(' ',$aresult[1]);
    510
    + $this->setVersion($aversion[0]);
    511
    + $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
    512
    + return true;
    513
    + }
    514
    + else if( stripos($this->_agent,'W3C_Validator') !== false ) {
    515
    + // Some of the Validator versions do not delineate w/ a slash - add it back in
    516
    + $ua = str_replace("W3C_Validator ", "W3C_Validator/", $this->_agent);
    517
    + $aresult = explode('/',stristr($ua,'W3C_Validator'));
    518
    + $aversion = explode(' ',$aresult[1]);
    519
    + $this->setVersion($aversion[0]);
    520
    + $this->_browser_name = $this->BROWSER_W3CVALIDATOR;
    521
    + return true;
    522
    + }
    523
    + return false;
    524
    + }
    525
    +
    526
    + /**
    527
    + * Determine if the browser is the Yahoo! Slurp Robot or not (last updated 1.7)
    528
    + * @return boolean True if the browser is the Yahoo! Slurp Robot otherwise false
    529
    + */
    530
    + function checkBrowserSlurp() {
    531
    + if( stripos($this->_agent,'slurp') !== false ) {
    532
    + $aresult = explode('/',stristr($this->_agent,'Slurp'));
    533
    + $aversion = explode(' ',$aresult[1]);
    534
    + $this->setVersion($aversion[0]);
    535
    + $this->_browser_name = $this->BROWSER_SLURP;
    536
    + $this->setRobot(true);
    537
    + $this->setMobile(false);
    538
    + return true;
    539
    + }
    540
    + return false;
    541
    + }
    542
    +
    543
    + /**
    544
    + * Determine if the browser is Internet Explorer or not (last updated 1.7)
    545
    + * @return boolean True if the browser is Internet Explorer otherwise false
    546
    + */
    547
    + function checkBrowserInternetExplorer() {
    548
    +
    549
    + // Test for v1 - v1.5 IE
    550
    + if( stripos($this->_agent,'microsoft internet explorer') !== false ) {
    551
    + $this->setBrowser($this->BROWSER_IE);
    552
    + $this->setVersion('1.0');
    553
    + $aresult = stristr($this->_agent, '/');
    554
    + if( preg_match('/308|425|426|474|0b1/i', $aresult) ) {
    555
    + $this->setVersion('1.5');
    556
    + }
    557
    + return true;
    558
    + }
    559
    + // Test for versions > 1.5
    560
    + else if( stripos($this->_agent,'msie') !== false && stripos($this->_agent,'opera') === false ) {
    561
    + // See if the browser is the odd MSN Explorer
    562
    + if( stripos($this->_agent,'msnb') !== false ) {
    563
    + $aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'MSN'));
    564
    + $this->setBrowser( $this->BROWSER_MSN );
    565
    + $this->setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
    566
    + return true;
    567
    + }
    568
    + $aresult = explode(' ',stristr(str_replace(';','; ',$this->_agent),'msie'));
    569
    + $this->setBrowser( $this->BROWSER_IE );
    570
    + $this->setVersion(str_replace(array('(',')',';'),'',$aresult[1]));
    571
    + return true;
    572
    + }
    573
    + // Test for Pocket IE
    574
    + else if( stripos($this->_agent,'mspie') !== false || stripos($this->_agent,'pocket') !== false ) {
    575
    + $aresult = explode(' ',stristr($this->_agent,'mspie'));
    576
    + $this->setPlatform( $this->PLATFORM_WINDOWS_CE );
    577
    + $this->setBrowser( $this->BROWSER_POCKET_IE );
    578
    + $this->setMobile(true);
    579
    +
    580
    + if( stripos($this->_agent,'mspie') !== false ) {
    581
    + $this->setVersion($aresult[1]);
    582
    + }
    583
    + else {
    584
    + $aversion = explode('/',$this->_agent);
    585
    + $this->setVersion($aversion[1]);
    586
    + }
    587
    + return true;
    588
    + }
    589
    + return false;
    590
    + }
    591
    +
    592
    + /**
    593
    + * Determine if the browser is Opera or not (last updated 1.7)
    594
    + * @return boolean True if the browser is Opera otherwise false
    595
    + */
    596
    + function checkBrowserOpera() {
    597
    + if( stripos($this->_agent,'opera mini') !== false ) {
    598
    + $resultant = stristr($this->_agent, 'opera mini');
    599
    + if( preg_match('/\//',$resultant) ) {
    600
    + $aresult = explode('/',$resultant);
    601
    + $aversion = explode(' ',$aresult[1]);
    602
    + $this->setVersion($aversion[0]);
    603
    + }
    604
    + else {
    605
    + $aversion = explode(' ',stristr($resultant,'opera mini'));
    606
    + $this->setVersion($aversion[1]);
    607
    + }
    608
    + $this->_browser_name = $this->BROWSER_OPERA_MINI;
    609
    + $this->setMobile(true);
    610
    + return true;
    611
    + }
    612
    + else if( stripos($this->_agent,'opera') !== false ) {
    613
    + $resultant = stristr($this->_agent, 'opera');
    614
    + if( preg_match('/Version\/(10.*)$/',$resultant,$matches) ) {
    615
    + $this->setVersion($matches[1]);
    616
    + }
    617
    + else if( preg_match('/\//',$resultant) ) {
    618
    + $aresult = explode('/',str_replace("("," ",$resultant));
    619
    + $aversion = explode(' ',$aresult[1]);
    620
    + $this->setVersion($aversion[0]);
    621
    + }
    622
    + else {
    623
    + $aversion = explode(' ',stristr($resultant,'opera'));
    624
    + $this->setVersion(isset($aversion[1])?$aversion[1]:"");
    625
    + }
    626
    + $this->_browser_name = $this->BROWSER_OPERA;
    627
    + return true;
    628
    + }
    629
    + return false;
    630
    + }
    631
    +
    632
    + /**
    633
    + * Determine if the browser is Chrome or not (last updated 1.7)
    634
    + * @return boolean True if the browser is Chrome otherwise false
    635
    + */
    636
    + function checkBrowserChrome() {
    637
    + if( stripos($this->_agent,'Chrome') !== false ) {
    638
    + $aresult = explode('/',stristr($this->_agent,'Chrome'));
    639
    + $aversion = explode(' ',$aresult[1]);
    640
    + $this->setVersion($aversion[0]);
    641
    + $this->setBrowser($this->BROWSER_CHROME);
    642
    + return true;
    643
    + }
    644
    + return false;
    645
    + }
    646
    +
    647
    +
    648
    + /**
    649
    + * Determine if the browser is WebTv or not (last updated 1.7)
    650
    + * @return boolean True if the browser is WebTv otherwise false
    651
    + */
    652
    + function checkBrowserWebTv() {
    653
    + if( stripos($this->_agent,'webtv') !== false ) {
    654
    + $aresult = explode('/',stristr($this->_agent,'webtv'));
    655
    + $aversion = explode(' ',$aresult[1]);
    656
    + $this->setVersion($aversion[0]);
    657
    + $this->setBrowser($this->BROWSER_WEBTV);
    658
    + return true;
    659
    + }
    660
    + return false;
    661
    + }
    662
    +
    663
    + /**
    664
    + * Determine if the browser is NetPositive or not (last updated 1.7)
    665
    + * @return boolean True if the browser is NetPositive otherwise false
    666
    + */
    667
    + function checkBrowserNetPositive() {
    668
    + if( stripos($this->_agent,'NetPositive') !== false ) {
    669
    + $aresult = explode('/',stristr($this->_agent,'NetPositive'));
    670
    + $aversion = explode(' ',$aresult[1]);
    671
    + $this->setVersion(str_replace(array('(',')',';'),'',$aversion[0]));
    672
    + $this->setBrowser($this->BROWSER_NETPOSITIVE);
    673
    + return true;
    674
    + }
    675
    + return false;
    676
    + }
    677
    +
    678
    + /**
    679
    + * Determine if the browser is Galeon or not (last updated 1.7)
    680
    + * @return boolean True if the browser is Galeon otherwise false
    681
    + */
    682
    + function checkBrowserGaleon() {
    683
    + if( stripos($this->_agent,'galeon') !== false ) {
    684
    + $aresult = explode(' ',stristr($this->_agent,'galeon'));
    685
    + $aversion = explode('/',$aresult[0]);
    686
    + $this->setVersion($aversion[1]);
    687
    + $this->setBrowser($this->BROWSER_GALEON);
    688
    + return true;
    689
    + }
    690
    + return false;
    691
    + }
    692
    +
    693
    + /**
    694
    + * Determine if the browser is Konqueror or not (last updated 1.7)
    695
    + * @return boolean True if the browser is Konqueror otherwise false
    696
    + */
    697
    + function checkBrowserKonqueror() {
    698
    + if( stripos($this->_agent,'Konqueror') !== false ) {
    699
    + $aresult = explode(' ',stristr($this->_agent,'Konqueror'));
    700
    + $aversion = explode('/',$aresult[0]);
    701
    + $this->setVersion($aversion[1]);
    702
    + $this->setBrowser($this->BROWSER_KONQUEROR);
    703
    + return true;
    704
    + }
    705
    + return false;
    706
    + }
    707
    +
    708
    + /**
    709
    + * Determine if the browser is iCab or not (last updated 1.7)
    710
    + * @return boolean True if the browser is iCab otherwise false
    711
    + */
    712
    + function checkBrowserIcab() {
    713
    + if( stripos($this->_agent,'icab') !== false ) {
    714
    + $aversion = explode(' ',stristr(str_replace('/',' ',$this->_agent),'icab'));
    715
    + $this->setVersion($aversion[1]);
    716
    + $this->setBrowser($this->BROWSER_ICAB);
    717
    + return true;
    718
    + }
    719
    + return false;
    720
    + }
    721
    +
    722
    + /**
    723
    + * Determine if the browser is OmniWeb or not (last updated 1.7)
    724
    + * @return boolean True if the browser is OmniWeb otherwise false
    725
    + */
    726
    + function checkBrowserOmniWeb() {
    727
    + if( stripos($this->_agent,'omniweb') !== false ) {
    728
    + $aresult = explode('/',stristr($this->_agent,'omniweb'));
    729
    + $aversion = explode(' ',isset($aresult[1])?$aresult[1]:"");
    730
    + $this->setVersion($aversion[0]);
    731
    + $this->setBrowser($this->BROWSER_OMNIWEB);
    732
    + return true;
    733
    + }
    734
    + return false;
    735
    + }
    736
    +
    737
    + /**
    738
    + * Determine if the browser is Phoenix or not (last updated 1.7)
    739
    + * @return boolean True if the browser is Phoenix otherwise false
    740
    + */
    741
    + function checkBrowserPhoenix() {
    742
    + if( stripos($this->_agent,'Phoenix') !== false ) {
    743
    + $aversion = explode('/',stristr($this->_agent,'Phoenix'));
    744
    + $this->setVersion($aversion[1]);
    745
    + $this->setBrowser($this->BROWSER_PHOENIX);
    746
    + return true;
    747
    + }
    748
    + return false;
    749
    + }
    750
    +
    751
    + /**
    752
    + * Determine if the browser is Firebird or not (last updated 1.7)
    753
    + * @return boolean True if the browser is Firebird otherwise false
    754
    + */
    755
    + function checkBrowserFirebird() {
    756
    + if( stripos($this->_agent,'Firebird') !== false ) {
    757
    + $aversion = explode('/',stristr($this->_agent,'Firebird'));
    758
    + $this->setVersion($aversion[1]);
    759
    + $this->setBrowser($this->BROWSER_FIREBIRD);
    760
    + return true;
    761
    + }
    762
    + return false;
    763
    + }
    764
    +
    765
    + /**
    766
    + * Determine if the browser is Netscape Navigator 9+ or not (last updated 1.7)
    767
    + * NOTE: (http://browser.netscape.com/ - Official support ended on March 1st, 2008)
    768
    + * @return boolean True if the browser is Netscape Navigator 9+ otherwise false
    769
    + */
    770
    + function checkBrowserNetscapeNavigator9Plus() {
    771
    + if( stripos($this->_agent,'Firefox') !== false && preg_match('/Navigator\/([^ ]*)/i',$this->_agent,$matches) ) {
    772
    + $this->setVersion($matches[1]);
    773
    + $this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR);
    774
    + return true;
    775
    + }
    776
    + else if( stripos($this->_agent,'Firefox') === false && preg_match('/Netscape6?\/([^ ]*)/i',$this->_agent,$matches) ) {
    777
    + $this->setVersion($matches[1]);
    778
    + $this->setBrowser($this->BROWSER_NETSCAPE_NAVIGATOR);
    779
    + return true;
    780
    + }
    781
    + return false;
    782
    + }
    783
    +
    784
    + /**
    785
    + * Determine if the browser is Shiretoko or not (https://wiki.mozilla.org/Projects/shiretoko) (last updated 1.7)
    786
    + * @return boolean True if the browser is Shiretoko otherwise false
    787
    + */
    788
    + function checkBrowserShiretoko() {
    789
    + if( stripos($this->_agent,'Mozilla') !== false && preg_match('/Shiretoko\/([^ ]*)/i',$this->_agent,$matches) ) {
    790
    + $this->setVersion($matches[1]);
    791
    + $this->setBrowser($this->BROWSER_SHIRETOKO);
    792
    + return true;
    793
    + }
    794
    + return false;
    795
    + }
    796
    +
    797
    + /**
    798
    + * Determine if the browser is Ice Cat or not (http://en.wikipedia.org/wiki/GNU_IceCat) (last updated 1.7)
    799
    + * @return boolean True if the browser is Ice Cat otherwise false
    800
    + */
    801
    + function checkBrowserIceCat() {
    802
    + if( stripos($this->_agent,'Mozilla') !== false && preg_match('/IceCat\/([^ ]*)/i',$this->_agent,$matches) ) {
    803
    + $this->setVersion($matches[1]);
    804
    + $this->setBrowser($this->BROWSER_ICECAT);
    805
    + return true;
    806
    + }
    807
    + return false;
    808
    + }
    809
    +
    810
    + /**
    811
    + * Determine if the browser is Nokia or not (last updated 1.7)
    812
    + * @return boolean True if the browser is Nokia otherwise false
    813
    + */
    814
    + function checkBrowserNokia() {
    815
    + if( preg_match("/Nokia([^\/]+)\/([^ SP]+)/i",$this->_agent,$matches) ) {
    816
    + $this->setVersion($matches[2]);
    817
    + if( stripos($this->_agent,'Series60') !== false || strpos($this->_agent,'S60') !== false ) {
    818
    + $this->setBrowser($this->BROWSER_NOKIA_S60);
    819
    + }
    820
    + else {
    821
    + $this->setBrowser( $this->BROWSER_NOKIA );
    822
    + }
    823
    + $this->setMobile(true);
    824
    + return true;
    825
    + }
    826
    + return false;
    827
    + }
    828
    +
    829
    + /**
    830
    + * Determine if the browser is Firefox or not (last updated 1.7)
    831
    + * @return boolean True if the browser is Firefox otherwise false
    832
    + */
    833
    + function checkBrowserFirefox() {
    834
    + if( stripos($this->_agent,'safari') === false ) {
    835
    + if( preg_match("/Firefox[\/ \(]([^ ;\)]+)/i",$this->_agent,$matches) ) {
    836
    + $this->setVersion($matches[1]);
    837
    + $this->setBrowser($this->BROWSER_FIREFOX);
    838
    + return true;
    839
    + }
    840
    + else if( preg_match("/Firefox$/i",$this->_agent,$matches) ) {
    841
    + $this->setVersion("");
    842
    + $this->setBrowser($this->BROWSER_FIREFOX);
    843
    + return true;
    844
    + }
    845
    + }
    846
    + return false;
    847
    + }
    848
    +
    849
    + /**
    850
    + * Determine if the browser is Firefox or not (last updated 1.7)
    851
    + * @return boolean True if the browser is Firefox otherwise false
    852
    + */
    853
    + function checkBrowserIceweasel() {
    854
    + if( stripos($this->_agent,'Iceweasel') !== false ) {
    855
    + $aresult = explode('/',stristr($this->_agent,'Iceweasel'));
    856
    + $aversion = explode(' ',$aresult[1]);
    857
    + $this->setVersion($aversion[0]);
    858
    + $this->setBrowser($this->BROWSER_ICEWEASEL);
    859
    + return true;
    860
    + }
    861
    + return false;
    862
    + }
    863
    + /**
    864
    + * Determine if the browser is Mozilla or not (last updated 1.7)
    865
    + * @return boolean True if the browser is Mozilla otherwise false
    866
    + */
    867
    + function checkBrowserMozilla() {
    868
    + if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent) && stripos($this->_agent,'netscape') === false) {
    869
    + $aversion = explode(' ',stristr($this->_agent,'rv:'));
    870
    + preg_match('/rv:[0-9].[0-9][a-b]?/i',$this->_agent,$aversion);
    871
    + $this->setVersion(str_replace('rv:','',$aversion[0]));
    872
    + $this->setBrowser($this->BROWSER_MOZILLA);
    873
    + return true;
    874
    + }
    875
    + else if( stripos($this->_agent,'mozilla') !== false && preg_match('/rv:[0-9]\.[0-9]/i',$this->_agent) && stripos($this->_agent,'netscape') === false ) {
    876
    + $aversion = explode('',stristr($this->_agent,'rv:'));
    877
    + $this->setVersion(str_replace('rv:','',$aversion[0]));
    878
    + $this->setBrowser($this->BROWSER_MOZILLA);
    879
    + return true;
    880
    + }
    881
    + else if( stripos($this->_agent,'mozilla') !== false && preg_match('/mozilla\/([^ ]*)/i',$this->_agent,$matches) && stripos($this->_agent,'netscape') === false ) {
    882
    + $this->setVersion($matches[1]);
    883
    + $this->setBrowser($this->BROWSER_MOZILLA);
    884
    + return true;
    885
    + }
    886
    + return false;
    887
    + }
    888
    +
    889
    + /**
    890
    + * Determine if the browser is Lynx or not (last updated 1.7)
    891
    + * @return boolean True if the browser is Lynx otherwise false
    892
    + */
    893
    + function checkBrowserLynx() {
    894
    + if( stripos($this->_agent,'lynx') !== false ) {
    895
    + $aresult = explode('/',stristr($this->_agent,'Lynx'));
    896
    + $aversion = explode(' ',(isset($aresult[1])?$aresult[1]:""));
    897
    + $this->setVersion($aversion[0]);
    898
    + $this->setBrowser($this->BROWSER_LYNX);
    899
    + return true;
    900
    + }
    901
    + return false;
    902
    + }
    903
    +
    904
    + /**
    905
    + * Determine if the browser is Amaya or not (last updated 1.7)
    906
    + * @return boolean True if the browser is Amaya otherwise false
    907
    + */
    908
    + function checkBrowserAmaya() {
    909
    + if( stripos($this->_agent,'amaya') !== false ) {
    910
    + $aresult = explode('/',stristr($this->_agent,'Amaya'));
    911
    + $aversion = explode(' ',$aresult[1]);
    912
    + $this->setVersion($aversion[0]);
    913
    + $this->setBrowser($this->BROWSER_AMAYA);
    914
    + return true;
    915
    + }
    916
    + return false;
    917
    + }
    918
    +
    919
    + /**
    920
    + * Determine if the browser is Safari or not (last updated 1.7)
    921
    + * @return boolean True if the browser is Safari otherwise false
    922
    + */
    923
    + function checkBrowserSafari() {
    924
    + if( stripos($this->_agent,'Safari') !== false && stripos($this->_agent,'iPhone') === false && stripos($this->_agent,'iPod') === false ) {
    925
    + $aresult = explode('/',stristr($this->_agent,'Version'));
    926
    + if( isset($aresult[1]) ) {
    927
    + $aversion = explode(' ',$aresult[1]);
    928
    + $this->setVersion($aversion[0]);
    929
    + }
    930
    + else {
    931
    + $this->setVersion($this->VERSION_UNKNOWN);
    932
    + }
    933
    + $this->setBrowser($this->BROWSER_SAFARI);
    934
    + return true;
    935
    + }
    936
    + return false;
    937
    + }
    938
    +
    939
    + /**
    940
    + * Determine if the browser is iPhone or not (last updated 1.7)
    941
    + * @return boolean True if the browser is iPhone otherwise false
    942
    + */
    943
    + function checkBrowseriPhone() {
    944
    + if( stripos($this->_agent,'iPhone') !== false ) {
    945
    + $aresult = explode('/',stristr($this->_agent,'Version'));
    946
    + if( isset($aresult[1]) ) {
    947
    + $aversion = explode(' ',$aresult[1]);
    948
    + $this->setVersion($aversion[0]);
    949
    + }
    950
    + else {
    951
    + $this->setVersion($this->VERSION_UNKNOWN);
    952
    + }
    953
    + $this->setMobile(true);
    954
    + $this->setBrowser($this->BROWSER_IPHONE);
    955
    + return true;
    956
    + }
    957
    + return false;
    958
    + }
    959
    +
    960
    + /**
    961
    + * Determine if the browser is iPod or not (last updated 1.7)
    962
    + * @return boolean True if the browser is iPod otherwise false
    963
    + */
    964
    + function checkBrowseriPad() {
    965
    + if( stripos($this->_agent,'iPad') !== false ) {
    966
    + $aresult = explode('/',stristr($this->_agent,'Version'));
    967
    + if( isset($aresult[1]) ) {
    968
    + $aversion = explode(' ',$aresult[1]);
    969
    + $this->setVersion($aversion[0]);
    970
    + }
    971
    + else {
    972
    + $this->setVersion($this->VERSION_UNKNOWN);
    973
    + }
    974
    + $this->setMobile(true);
    975
    + $this->setBrowser($this->BROWSER_IPAD);
    976
    + return true;
    977
    + }
    978
    + return false;
    979
    + }
    980
    +
    981
    + /**
    982
    + * Determine if the browser is iPod or not (last updated 1.7)
    983
    + * @return boolean True if the browser is iPod otherwise false
    984
    + */
    985
    + function checkBrowseriPod() {
    986
    + if( stripos($this->_agent,'iPod') !== false ) {
    987
    + $aresult = explode('/',stristr($this->_agent,'Version'));
    988
    + if( isset($aresult[1]) ) {
    989
    + $aversion = explode(' ',$aresult[1]);
    990
    + $this->setVersion($aversion[0]);
    991
    + }
    992
    + else {
    993
    + $this->setVersion($this->VERSION_UNKNOWN);
    994
    + }
    995
    + $this->setMobile(true);
    996
    + $this->setBrowser($this->BROWSER_IPOD);
    997
    + return true;
    998
    + }
    999
    + return false;
    1000
    + }
    1001
    +
    1002
    + /**
    1003
    + * Determine if the browser is Android or not (last updated 1.7)
    1004
    + * @return boolean True if the browser is Android otherwise false
    1005
    + */
    1006
    + function checkBrowserAndroid() {
    1007
    + if( stripos($this->_agent,'Android') !== false ) {
    1008
    + $aresult = explode(' ',stristr($this->_agent,'Android'));
    1009
    + if( isset($aresult[1]) ) {
    1010
    + $aversion = explode(' ',$aresult[1]);
    1011
    + $this->setVersion($aversion[0]);
    1012
    + }
    1013
    + else {
    1014
    + $this->setVersion($this->VERSION_UNKNOWN);
    1015
    + }
    1016
    + $this->setMobile(true);
    1017
    + $this->setBrowser($this->BROWSER_ANDROID);
    1018
    + return true;
    1019
    + }
    1020
    + return false;
    1021
    + }
    1022
    +
    1023
    + /**
    1024
    + * Determine the user's platform (last updated 1.7)
    1025
    + */
    1026
    + function checkPlatform() {
    1027
    + if( stripos($this->_agent, 'windows') !== false ) {
    1028
    + $this->_platform = $this->PLATFORM_WINDOWS;
    1029
    + }
    1030
    + else if( stripos($this->_agent, 'iPad') !== false ) {
    1031
    + $this->_platform = $this->PLATFORM_IPAD;
    1032
    + }
    1033
    + else if( stripos($this->_agent, 'iPod') !== false ) {
    1034
    + $this->_platform = $this->PLATFORM_IPOD;
    1035
    + }
    1036
    + else if( stripos($this->_agent, 'iPhone') !== false ) {
    1037
    + $this->_platform = $this->PLATFORM_IPHONE;
    1038
    + }
    1039
    + elseif( stripos($this->_agent, 'mac') !== false ) {
    1040
    + $this->_platform = $this->PLATFORM_APPLE;
    1041
    + }
    1042
    + elseif( stripos($this->_agent, 'android') !== false ) {
    1043
    + $this->_platform = $this->PLATFORM_ANDROID;
    1044
    + }
    1045
    + elseif( stripos($this->_agent, 'linux') !== false ) {
    1046
    + $this->_platform = $this->PLATFORM_LINUX;
    1047
    + }
    1048
    + else if( stripos($this->_agent, 'Nokia') !== false ) {
    1049
    + $this->_platform = $this->PLATFORM_NOKIA;
    1050
    + }
    1051
    + else if( stripos($this->_agent, 'BlackBerry') !== false ) {
    1052
    + $this->_platform = $this->PLATFORM_BLACKBERRY;
    1053
    + }
    1054
    + elseif( stripos($this->_agent,'FreeBSD') !== false ) {
    1055
    + $this->_platform = $this->PLATFORM_FREEBSD;
    1056
    + }
    1057
    + elseif( stripos($this->_agent,'OpenBSD') !== false ) {
    1058
    + $this->_platform = $this->PLATFORM_OPENBSD;
    1059
    + }
    1060
    + elseif( stripos($this->_agent,'NetBSD') !== false ) {
    1061
    + $this->_platform = $this->PLATFORM_NETBSD;
    1062
    + }
    1063
    + elseif( stripos($this->_agent, 'OpenSolaris') !== false ) {
    1064
    + $this->_platform = $this->PLATFORM_OPENSOLARIS;
    1065
    + }
    1066
    + elseif( stripos($this->_agent, 'SunOS') !== false ) {
    1067
    + $this->_platform = $this->PLATFORM_SUNOS;
    1068
    + }
    1069
    + elseif( stripos($this->_agent, 'OS\/2') !== false ) {
    1070
    + $this->_platform = $this->PLATFORM_OS2;
    1071
    + }
    1072
    + elseif( stripos($this->_agent, 'BeOS') !== false ) {
    1073
    + $this->_platform = $this->PLATFORM_BEOS;
    1074
    + }
    1075
    + elseif( stripos($this->_agent, 'win') !== false ) {
    1076
    + $this->_platform = $this->PLATFORM_WINDOWS;
    1077
    + }
    1078
    +
    1079
    + }
    1080
    + }
    1081
    +
    1082
    + ?>
    includes/misc-functions.php ADDED
    @@ -0,0 +1,30 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * WPRSS Let To Num
    4
    + *
    5
    + * Does Size Conversions
    6
    + *
    7
    + * @since 3.1
    8
    + * @author Chris Christoff
    9
    + * @return $ret
    10
    + */
    11
    + function wprss_let_to_num( $v ) {
    12
    + $l = substr( $v, -1 );
    13
    + $ret = substr( $v, 0, -1 );
    14
    +
    15
    + switch ( strtoupper( $l ) ) {
    16
    + case 'P':
    17
    + $ret *= 1024;
    18
    + case 'T':
    19
    + $ret *= 1024;
    20
    + case 'G':
    21
    + $ret *= 1024;
    22
    + case 'M':
    23
    + $ret *= 1024;
    24
    + case 'K':
    25
    + $ret *= 1024;
    26
    + break;
    27
    + }
    28
    +
    29
    + return $ret;
    30
    + }
    includes/opml-importer.php ADDED
    @@ -0,0 +1,231 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * Define the WPRSS OPML Importer to set up the Import OPML Page
    5
    + * and parse uploaded OPML files and import them into WPRSS'
    6
    + * custom post types.
    7
    + *
    8
    + * @since 3.3
    9
    + * @package WPRSSAggregator
    10
    + */
    11
    +
    12
    +
    13
    +
    14
    + /*
    15
    + * Check if the WP_Importer Class is already loaded.
    16
    + * If not, load it.
    17
    + */
    18
    + if ( !class_exists( 'WP_Importer' ) ) {
    19
    + $class_wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
    20
    + if ( file_exists( $class_wp_importer ) )
    21
    + require $class_wp_importer;
    22
    + }
    23
    +
    24
    + /**
    25
    + * WPRSS_OPML_Importer Class handles the OPML Import Page and
    26
    + * OPML file upload. It also constructs a WPRSS_OPML object
    27
    + * for the uploaded file, which parses the file, and then
    28
    + * imports it into WPRSS' custom post types.
    29
    + *
    30
    + * @since 3.3
    31
    + */
    32
    + class WPRSS_OPML_Importer extends WP_Importer {
    33
    +
    34
    + /**
    35
    + * The static Singleton Instance of the importer
    36
    + */
    37
    + public static $singleton;
    38
    +
    39
    + /**
    40
    + * The ID of the uploaded file to import
    41
    + */
    42
    + private $id;
    43
    +
    44
    +
    45
    + /**
    46
    + * Constructor: Prepares the Importer
    47
    + */
    48
    + public function __contruct() {
    49
    + parent::__contruct();
    50
    + }
    51
    +
    52
    +
    53
    +
    54
    + /**
    55
    + * Shows The Import Page and import form for step 1.
    56
    + * Calls the parsing and importing function for step 2.
    57
    + *
    58
    + * @since 3.3
    59
    + * @return void
    60
    + */
    61
    + public function opml_import() {
    62
    + // Show the Icon and Title
    63
    + echo '<div class="wrap">';
    64
    + screen_icon();
    65
    + echo '<h2>Import OPML</h2>';
    66
    +
    67
    + // Get the current step from URL query string
    68
    + $step = empty( $_GET['step'] ) ? 0 : (int) $_GET['step'];
    69
    +
    70
    + // Check the current step
    71
    + switch ( $step ) {
    72
    + default :
    73
    + case 0 :
    74
    + // Show the Import Message and the import upload form
    75
    + echo '<p>' . __( 'Howdy! Import your feeds here from an OPML (.xml) export file.', 'wprss' ) . '</p>';
    76
    + echo '<p>' . __( "Click the button below, choose your file, and click 'Upload'.", 'wprss' ) . '</p>';
    77
    + echo '<p>' . __( 'We will take care of the rest.', 'wprss' ) . '</p>';
    78
    +
    79
    + // Show an import upload form that submits to the same page, with GET parameter step=1
    80
    + wp_import_upload_form( 'admin.php?import=wprss_opml_importer&amp;step=1' );
    81
    + break;
    82
    +
    83
    + case 1:
    84
    + // Check referer
    85
    + check_admin_referer( 'import-upload' );
    86
    + // If the handle_upload function returns true
    87
    + if ( $this->handle_upload() ) {
    88
    + // Get the uploaded file
    89
    + $file = get_attached_file( $this->id );
    90
    + set_time_limit(0);
    91
    + // Parse the File and Import the feeds
    92
    + $this->parse_and_import( $file );
    93
    + }
    94
    + break;
    95
    + }
    96
    +
    97
    + echo '</div>';
    98
    + }
    99
    +
    100
    +
    101
    +
    102
    + private function handle_upload() {
    103
    + // Get the upload file
    104
    + $file = wp_import_handle_upload();
    105
    +
    106
    + // If the 'error' property is set, show the error message and return FALSE
    107
    + if ( isset( $file['error'] ) ) {
    108
    + echo '<p><strong>' . __( 'Sorry, an error has been encountered.', 'wprss' ) . '</strong><br />';
    109
    + echo esc_html( $file['error'] ) . '</p>';
    110
    + return false;
    111
    + // If the file does not exist, then show the error message and return FALSE
    112
    + } else if ( ! file_exists( $file['file'] ) ) {
    113
    + echo '<p><strong>' . __( 'Sorry, it seems your uploaded file has been misplaced!', 'wprss' ) . '</strong><br />';
    114
    + echo __( 'The uploaded file could not be found at ', 'wprss') . '<code>' . esc_html( $file['file'] ) . '</code>';
    115
    + echo __( 'It is likely that this was caused by a permissions problem.' , 'wprss' );
    116
    + echo '</p>';
    117
    + return false;
    118
    + }
    119
    +
    120
    +
    121
    + $this->id = (int) $file['id'];
    122
    + return true;
    123
    + }
    124
    +
    125
    +
    126
    + /**
    127
    + * Imports the give <outline> OPML element as a wprss_feed
    128
    + *
    129
    + * @since 3.3
    130
    + * @param $outline The outline OPML element
    131
    + */
    132
    + private function import_opml_feed( $outline ) {
    133
    + // Create an associative array, with the feed's properties
    134
    + $feed = array(
    135
    + 'post_title' => $outline['title'],
    136
    + 'post_content' => '',
    137
    + 'post_status' => 'publish',
    138
    + 'post_type' => 'wprss_feed'
    139
    + );
    140
    + // Insert the post into the database and store the inserted ID
    141
    + $inserted_id = wp_insert_post( $feed );
    142
    + // Update the post's meta
    143
    + update_post_meta( $inserted_id, 'wprss_url', $outline['xmlUrl'] );
    144
    + // Return inserted ID
    145
    + return $inserted_id;
    146
    + }
    147
    +
    148
    +
    149
    + /**
    150
    + * Attempts to parse the given file as an OPML construct, and
    151
    + * import each found feed.
    152
    + *
    153
    + * @since 3.3
    154
    + * @param file The OPML file to parse and import
    155
    + * @return void
    156
    + * @todo Use the parsed $opml object to import the feeds AND remove var_dump
    157
    + */
    158
    + private function parse_and_import( $file ) {
    159
    + try {
    160
    + $opml = new WPRSS_OPML( $file );
    161
    +
    162
    + // Show Success Message
    163
    + echo '<h3>Feeds were imported successfully!</h3>';
    164
    +
    165
    + // Show imported feeds
    166
    + ?>
    167
    + <table class="widefat">
    168
    + <thead>
    169
    + <tr>
    170
    + <th>ID</th>
    171
    + <th>Title</th>
    172
    + <th>URL</th>
    173
    + </tr>
    174
    + </thead>
    175
    +
    176
    + <tbody>
    177
    + <?php
    178
    + foreach ( $opml->body as $opml_feed ) :
    179
    + $inserted_id = $this->import_opml_feed( $opml_feed );
    180
    + ?>
    181
    + <tr>
    182
    + <td><?php echo $inserted_id; ?></td>
    183
    + <td><?php echo $opml_feed['title']; ?> </td>
    184
    + <td><?php echo $opml_feed['xmlUrl']; ?></td>
    185
    + </tr>
    186
    + <?php endforeach; ?>
    187
    + </tbody>
    188
    +
    189
    + <tfoot>
    190
    + <tr>
    191
    + <th>ID</th>
    192
    + <th>Title</th>
    193
    + <th>URL</th>
    194
    + </tr>
    195
    + </tfoot>
    196
    +
    197
    + </table>
    198
    + <?php
    199
    +
    200
    + } catch (Exception $e) {
    201
    + // Show Error Message
    202
    + echo '<div class="error"><p>' . $e->getMessage() . '</p></div>';
    203
    + }
    204
    + }
    205
    +
    206
    + }
    207
    +
    208
    +
    209
    + /* Initialize the Singleton Instance of the Importer */
    210
    + WPRSS_OPML_Importer::$singleton = new WPRSS_OPML_Importer();
    211
    +
    212
    +
    213
    +
    214
    + add_action( 'admin_init', 'wprss_opml_register_import' );
    215
    + /**
    216
    + * Initializes and registers the OPML Importer
    217
    + * @since 3.3
    218
    + */
    219
    + function wprss_opml_register_import() {
    220
    +
    221
    + register_importer(
    222
    + 'wprss_opml_importer',
    223
    + 'WP RSS OPML',
    224
    + 'Import Feeds from an OPML file into WP RSS Aggregator',
    225
    + array( WPRSS_OPML_Importer::$singleton ,'opml_import' )
    226
    + );
    227
    +
    228
    + }
    229
    +
    230
    +
    231
    + ?>
    includes/opml.php ADDED
    @@ -0,0 +1,126 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * The WPRSS_OPML Class represents an OPML document.
    5
    + * It is constructed using a file, which it parses upon creation.
    6
    + *
    7
    + * @since 3.3
    8
    + * @package WPRSSAggregator
    9
    + */
    10
    + class WPRSS_OPML {
    11
    +
    12
    +
    13
    + public $file;
    14
    + public $head;
    15
    + public $body;
    16
    +
    17
    + /**
    18
    + * Constructor: Parses the given XML file as an OPML
    19
    + *
    20
    + * @since 3.3
    21
    + * @param $file The file to be parsed into a WPRSS_OPML object
    22
    + */
    23
    + public function __construct( $file ) {
    24
    + // Initialize Properties
    25
    + $this->file = $file;
    26
    + $this->head = array();
    27
    + $this->body = array();
    28
    + // Begin Parsing
    29
    + try {
    30
    + // Wrap file data in a SimpleXMLElement
    31
    + $xml = simplexml_load_file( $this->file );
    32
    +
    33
    + // Check if the head section exists before parsing it
    34
    + if ( $xml->head )
    35
    + $this->head = WPRSS_OPML::parse_opml_head( $xml->head->children() );
    36
    + // Check if the body section exists before parsing it
    37
    + if ( $xml->body )
    38
    + $this->body = WPRSS_OPML::parse_opml_body_element( $xml->body->outline );
    39
    +
    40
    + } catch (Exception $e) {
    41
    + // If an exception is caught. Throw an error message
    42
    + throw new Exception( __( 'An error occured: The file might not be a valid OPML file or is corrrupt. ', 'wprss' ), 1);
    43
    + }
    44
    + }
    45
    +
    46
    +
    47
    + /**
    48
    + * Parses the given variable as an OPML head section
    49
    + *
    50
    + * @since 3.3
    51
    + * @param $head The head section of an OPML file ( SimpleXMLElement )
    52
    + * @return array An associative array containing SimpleXMLElements for each tag in the given head section.
    53
    + */
    54
    + private static function parse_opml_head( $head ) {
    55
    + $parsed_data = array();
    56
    +
    57
    + foreach ( $head as $property ) {
    58
    + $parsed_data[ $property->getName() ] = $property;
    59
    + }
    60
    +
    61
    + return $parsed_data;
    62
    + }
    63
    +
    64
    +
    65
    + /**
    66
    + * Iterates through the elements given OPML/XML data and parses
    67
    + * each element, and recurses where necessary, into an associative
    68
    + * array that mimics OPML structure.
    69
    + * @since 1.0
    70
    + * @return array The Parsed OPML as an associative array
    71
    + */
    72
    + private static function parse_opml_body_element( $element ) {
    73
    + $parsed_data = array();
    74
    +
    75
    + // Iterates through each child element in the given element
    76
    + foreach ( $element as $child_element ) {
    77
    +
    78
    + // If child element has type attribute set to 'rss' or has the 'xmlUrl' attribute
    79
    + if ( $child_element['type'] === 'rss' || isset( $child_element['xmlUrl'] ) ) {
    80
    + // Parse the child element and add it to the parsed data array
    81
    + $parsed_data[] = WPRSS_OPML::SimpleXMLElement_to_OPMLElement( $child_element );
    82
    + }
    83
    + // Otherwise, if the child element has children 'outline' elements
    84
    + elseif ( $child_element->outline ) {
    85
    + // Recurse using this child element as parameter, and add the result to the parsed data array
    86
    + $parsed_data[ (string) $child_element['text'] ] = WPRSS_OPML::parse_opml_body_element( $child_element->outline );
    87
    + }
    88
    +
    89
    + }
    90
    +
    91
    + return $parsed_data;
    92
    + }
    93
    +
    94
    +
    95
    + /**
    96
    + * Parses a SimpleXMLElement Object into an OPML element compliant
    97
    + * associative array.
    98
    + * @since 1.0
    99
    + * @return array An array in OPML element format
    100
    + */
    101
    + private static function SimpleXMLElement_to_OPMLElement( $element ) {
    102
    + // Copy attribute data from $element to a new associative array
    103
    + $result = array(
    104
    + 'text' => (string) $element['text'],
    105
    + 'title' => (string) $element['title'],
    106
    + 'htmlUrl' => (string) $element['htmlUrl'],
    107
    + 'xmlUrl' => (string) $element['xmlUrl'],
    108
    + 'description' => (string) $element['description']
    109
    + );
    110
    +
    111
    + /*
    112
    + * Check for existence of htmlUrl and xmlUrl.
    113
    + * If not found, use lowercased attribute names.
    114
    + */
    115
    + if ( !isset( $element['htmlUrl'] ) )
    116
    + $result['htmlUrl'] = $element['htmlurl'];
    117
    + if ( !isset( $element['xmlUrl'] ) )
    118
    + $result['xmlUrl'] = $element['xmlurl'];
    119
    +
    120
    + // Return the result OPML Element
    121
    + return $result;
    122
    + }
    123
    +
    124
    + }
    125
    +
    126
    + ?>
    includes/roles-capabilities.php ADDED
    @@ -0,0 +1,107 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    +
    3
    + /**
    4
    + * Contains all roles and capabilities functions
    5
    + *
    6
    + * @package WPRSSAggregator
    7
    + */
    8
    +
    9
    +
    10
    + add_action('init', 'wprss_add_caps');
    11
    + /**
    12
    + * Add feed aggregator-specific capabilities
    13
    + *
    14
    + * @since 3.3
    15
    + */
    16
    + function wprss_add_caps() {
    17
    + global $wp_roles;
    18
    +
    19
    + if ( class_exists('WP_Roles') )
    20
    + if ( ! isset( $wp_roles ) )
    21
    + $wp_roles = new WP_Roles();
    22
    +
    23
    + if ( is_object( $wp_roles ) ) {
    24
    +
    25
    + $wp_roles->add_cap( 'administrator', 'manage_feed_settings' );
    26
    + $wp_roles->add_cap( 'editor', 'manage_feed_settings' );
    27
    +
    28
    + // Add the main post type capabilities
    29
    + $capabilities = wprss_get_core_caps();
    30
    + foreach ( $capabilities as $cap_group ) {
    31
    + foreach ( $cap_group as $cap ) {
    32
    + $wp_roles->add_cap( 'administrator', $cap );
    33
    + $wp_roles->add_cap( 'editor', $cap );
    34
    + }
    35
    + }
    36
    + }
    37
    + }
    38
    +
    39
    +
    40
    + /**
    41
    + * Gets the core post type capabilties
    42
    + *
    43
    + * @since 3.3
    44
    + */
    45
    + function wprss_get_core_caps() {
    46
    + $capabilities = array();
    47
    +
    48
    + $capability_types = array( 'feed', 'feed_source' );
    49
    +
    50
    + foreach ( $capability_types as $capability_type ) {
    51
    + $capabilities[ $capability_type ] = array(
    52
    + // Post type
    53
    + "edit_{$capability_type}",
    54
    + "read_{$capability_type}",
    55
    + "delete_{$capability_type}",
    56
    + "edit_{$capability_type}s",
    57
    + "edit_others_{$capability_type}s",
    58
    + "publish_{$capability_type}s",
    59
    + "read_private_{$capability_type}s",
    60
    + "delete_{$capability_type}s",
    61
    + "delete_private_{$capability_type}s",
    62
    + "delete_published_{$capability_type}s",
    63
    + "delete_others_{$capability_type}s",
    64
    + "edit_private_{$capability_type}s",
    65
    + "edit_published_{$capability_type}s",
    66
    +
    67
    + // Terms
    68
    + "manage_{$capability_type}_terms",
    69
    + "edit_{$capability_type}_terms",
    70
    + "delete_{$capability_type}_terms",
    71
    + "assign_{$capability_type}_terms"
    72
    + );
    73
    + }
    74
    +
    75
    + return $capabilities;
    76
    + }
    77
    +
    78
    +
    79
    + /**
    80
    + * Remove core post type capabilities (called on uninstall)
    81
    + *
    82
    + * @since 3.3
    83
    + * @return void
    84
    + */
    85
    + function wprss_remove_caps() {
    86
    + if ( class_exists( 'WP_Roles' ) )
    87
    + if ( ! isset( $wp_roles ) )
    88
    + $wp_roles = new WP_Roles();
    89
    +
    90
    + if ( is_object( $wp_roles ) ) {
    91
    +
    92
    + /** Site Administrator Capabilities */
    93
    + $wp_roles->remove_cap( 'administrator', 'manage_feed_settings' );
    94
    + /** Editor Capabilities */
    95
    + $wp_roles->remove_cap( 'editor', 'manage_feed_settings' );
    96
    +
    97
    + /** Remove the Main Post Type Capabilities */
    98
    + $capabilities = $this->get_core_caps();
    99
    +
    100
    + foreach ( $capabilities as $cap_group ) {
    101
    + foreach ( $cap_group as $cap ) {
    102
    + $wp_roles->remove_cap( 'administrator', $cap );
    103
    + $wp_roles->remove_cap( 'editor', $cap );
    104
    + }
    105
    + }
    106
    + }
    107
    + }
    includes/scripts.php ADDED
    @@ -0,0 +1,120 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Scripts
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + */
    7
    +
    8
    +
    9
    + add_action( 'admin_enqueue_scripts', 'wprss_admin_scripts_styles' );
    10
    + /**
    11
    + * Insert required scripts, styles and filters on the admin side
    12
    + *
    13
    + * @since 2.0
    14
    + */
    15
    + function wprss_admin_scripts_styles() {
    16
    +
    17
    + // Only load scripts if we are on this plugin's options or settings pages (admin)
    18
    + if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wprss-aggregator' || $_GET['page'] == 'wprss-aggregator-settings'
    19
    + || $_GET['page'] == 'wprss-import-export-settings' || $_GET['page'] == 'wprss-debugging' ) ) {
    20
    + wp_enqueue_style( 'styles', WPRSS_CSS . 'admin-styles.css' );
    21
    + }
    22
    +
    23
    + $screen = get_current_screen();
    24
    +
    25
    + wp_enqueue_script( 'admin-addon-ajax', WPRSS_JS .'admin-addon-ajax.js', array('jquery') );
    26
    + if ( ( 'post' === $screen->base || 'edit' === $screen->base || 'wprss-debugging' === $screen->base ) &&
    27
    + ( 'wprss_feed' === $screen->post_type || 'wprss_feed_item' === $screen->post_type ) || ( isset( $_GET['page'] ) &&
    28
    + ( $_GET['page'] == 'wprss-aggregator-settings' ) ) ) {
    29
    + wp_enqueue_style( 'admin-styles', WPRSS_CSS . 'admin-styles.css' );
    30
    + wp_enqueue_script( 'admin-custom', WPRSS_JS .'admin-custom.js', array('jquery') );
    31
    + if ( 'post' === $screen->base && 'wprss_feed' === $screen->post_type ) {
    32
    + // Change text on post screen from 'Enter title here' to 'Enter feed name here'
    33
    + add_filter( 'enter_title_here', 'wprss_change_title_text' );
    34
    + }
    35
    + }
    36
    +
    37
    + else if ( 'dashboard_page_wprss-welcome' === $screen->base ) {
    38
    + wp_enqueue_style( 'admin-styles', WPRSS_CSS . 'admin-styles.css' );
    39
    + }
    40
    +
    41
    + do_action( 'wprss_admin_scripts_styles' );
    42
    + } // end wprss_admin_scripts_styles
    43
    +
    44
    +
    45
    + add_action( 'wp_enqueue_scripts', 'wprss_load_scripts' );
    46
    + /**
    47
    + * Enqueues the required scripts.
    48
    + *
    49
    + * @since 3.0
    50
    + */
    51
    + function wprss_load_scripts() {
    52
    + wp_enqueue_script( 'jquery.colorbox-min', WPRSS_JS . 'jquery.colorbox-min.js', array( 'jquery' ) );
    53
    + wp_enqueue_script( 'custom', WPRSS_JS . 'custom.js', array( 'jquery', 'jquery.colorbox-min' ) );
    54
    + do_action( 'wprss_register_scripts' );
    55
    + } // end wprss_head_scripts_styles
    56
    +
    57
    +
    58
    + /**
    59
    + * Returns the path to the WPRSS templates directory
    60
    + *
    61
    + * @since 3.0
    62
    + * @return string
    63
    + */
    64
    + function wprss_get_templates_dir() {
    65
    + return WPRSS_DIR . 'templates';
    66
    + }
    67
    +
    68
    +
    69
    + /**
    70
    + * Returns the URL to the WPRSS templates directory
    71
    + *
    72
    + * @since 3.0
    73
    + * @return string
    74
    + */
    75
    + function wprss_get_templates_uri() {
    76
    + return WPRSS_URI . 'templates';
    77
    + }
    78
    +
    79
    +
    80
    + add_action( 'wp_enqueue_scripts', 'wprss_register_styles' );
    81
    + /**
    82
    + * Register front end CSS styling files
    83
    + * Inspiration from Easy Digital Downloads
    84
    + *
    85
    + * @since 3.0
    86
    + */
    87
    + function wprss_register_styles() {
    88
    +
    89
    + $general_settings = get_option( 'wprss_settings_general' );
    90
    +
    91
    + if( $general_settings['styles_disable'] == 1 )
    92
    + return;
    93
    + wp_enqueue_style( 'colorbox', WPRSS_CSS . 'colorbox.css', array(), '1.4.1' );
    94
    + wp_enqueue_style( 'styles', WPRSS_CSS . 'styles.css', array(), '' );
    95
    +
    96
    + /* If using DISABLE CSS option:
    97
    + global $edd_options;
    98
    +
    99
    + if( isset( $edd_options['disable_styles'] ) )
    100
    + return;
    101
    +
    102
    + */
    103
    +
    104
    + /* $file = 'wprss.css';
    105
    +
    106
    + // Check child theme first
    107
    + if ( file_exists( trailingslashit( get_stylesheet_directory() ) . 'wprss_templates/' . $file ) ) {
    108
    + $url = trailingslashit( get_stylesheet_directory_uri() ) . 'wprss_templates/' . $file;
    109
    +
    110
    + // Check parent theme next
    111
    + } elseif ( file_exists( trailingslashit( get_template_directory() ) . 'wprss_templates/' . $file ) ) {
    112
    + $url = trailingslashit( get_template_directory_uri() ) . 'wprss_templates/' . $file;
    113
    +
    114
    + // Check theme compatibility last
    115
    + } elseif ( file_exists( trailingslashit( wprss_get_templates_dir() ) . $file ) ) {
    116
    + $url = trailingslashit( wprss_get_templates_uri() ) . $file;
    117
    + }
    118
    +
    119
    + wp_enqueue_style( 'wprss-styles', $url, WPRSS_VERSION );*/
    120
    + }
    includes/shortcodes.php ADDED
    @@ -0,0 +1,20 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Set up shortcodes and call the main function for output
    4
    + *
    5
    + * @since 1.0
    6
    + */
    7
    + function wprss_shortcode( $atts ) {
    8
    + if ( !empty ($atts) ) {
    9
    + foreach ( $atts as $key => &$val ) {
    10
    + $val = html_entity_decode($val);
    11
    + }
    12
    + }
    13
    + ob_start(); //start an output buffer to output of the following function
    14
    + wprss_display_feed_items( $atts );
    15
    + return ob_get_clean(); //return the current buffer and clear it
    16
    + }
    17
    +
    18
    + // Register shortcodes
    19
    + add_shortcode( 'wp_rss_aggregator', 'wprss_shortcode');
    20
    + add_shortcode( 'wp-rss-aggregator', 'wprss_shortcode');
    includes/system-info.php ADDED
    @@ -0,0 +1,140 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * System information
    4
    + *
    5
    + * @package WPRSSAggregator
    6
    + * @subpackage Includes
    7
    + * @since 3.1
    8
    + * @author Jean Galea <info@jeangalea.com>
    9
    + * @copyright Copyright(c) 2012-2013, Jean Galea. Adapted from Easy Digital Downloads by Pippin Williamson
    10
    + * @link http://www.wpmayor.com
    11
    + * @license http://www.gnu.org/licenses/gpl.html
    12
    + */
    13
    +
    14
    + /**
    15
    + * Generate the system information
    16
    + *
    17
    + * @since 3.1
    18
    + */
    19
    + function wprss_system_info() {
    20
    + global $wpdb;
    21
    +
    22
    + if ( ! class_exists( 'Browser' ) )
    23
    + require_once WPRSS_DIR . 'includes/libraries/browser.php';
    24
    +
    25
    + $browser = new Browser();
    26
    + ?>
    27
    + <h3><?php _e( 'System Information', 'wprss' ) ?></h3>
    28
    + <form action="<?php echo esc_url( admin_url( 'edit.php?post_type=wprss_feed&page=wprss-debugging' ) ); ?>" method="post">
    29
    + <textarea readonly="readonly" onclick="this.focus();this.select()" id="system-info-textarea" name="wprss-sysinfo" title="<?php _e( 'To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'wprss' ); ?>">
    30
    + ### Begin System Info ###
    31
    +
    32
    + ## Please include this information when posting support requests ##
    33
    +
    34
    + Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?>
    35
    +
    36
    + SITE_URL: <?php echo site_url() . "\n"; ?>
    37
    + HOME_URL: <?php echo home_url() . "\n"; ?>
    38
    +
    39
    + Plugin Version: <?php echo WPRSS_VERSION . "\n"; ?>
    40
    + WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?>
    41
    +
    42
    + <?php echo $browser ; ?>
    43
    +
    44
    + PHP Version: <?php echo PHP_VERSION . "\n"; ?>
    45
    + MySQL Version: <?php echo mysql_get_server_info() . "\n"; ?>
    46
    + Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?>
    47
    +
    48
    + PHP Safe Mode: <?php echo ini_get( 'safe_mode' ) ? "Yes" : "No\n"; ?>
    49
    + PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?>
    50
    + PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?>
    51
    + PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?>
    52
    +
    53
    + WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?>
    54
    +
    55
    + WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo " Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?>
    56
    +
    57
    + Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?>
    58
    + Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?>
    59
    + Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?>
    60
    +
    61
    + Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?>
    62
    + Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?>
    63
    + Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?>
    64
    + Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?>
    65
    + Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
    66
    + Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?>
    67
    +
    68
    + UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) echo ( wprss_let_to_num( ini_get( 'upload_max_filesize' ) )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
    69
    + POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) echo ( wprss_let_to_num( ini_get( 'post_max_size' ) )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
    70
    + WordPress Memory Limit: <?php echo ( wprss_let_to_num( WP_MEMORY_LIMIT )/( 1024*1024 ) )."MB"; ?><?php echo "\n"; ?>
    71
    + DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?>
    72
    + FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'wprss' ) : __( 'Your server does not support fsockopen.', 'wprss' ); ?><?php echo "\n"; ?>
    73
    +
    74
    + ACTIVE PLUGINS:
    75
    +
    76
    + <?php
    77
    + $plugins = get_plugins();
    78
    + $active_plugins = get_option( 'active_plugins', array() );
    79
    +
    80
    + foreach ( $plugins as $plugin_path => $plugin ):
    81
    + // If the plugin isn't active, don't show it.
    82
    + if ( ! in_array( $plugin_path, $active_plugins ) ) {
    83
    + $inactive_plugins[] = $plugin;
    84
    + continue;
    85
    + }
    86
    +
    87
    + echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n";
    88
    +
    89
    + endforeach; ?>
    90
    +
    91
    + DEACTIVATED PLUGINS:
    92
    +
    93
    + <?php
    94
    +
    95
    + foreach ( $inactive_plugins as $inactive_plugin ):
    96
    +
    97
    + echo $inactive_plugin['Name']; ?>: <?php echo $inactive_plugin['Version'] ."\n";
    98
    +
    99
    + endforeach; ?>
    100
    +
    101
    + CURRENT THEME:
    102
    +
    103
    + <?php
    104
    + if ( get_bloginfo( 'version' ) < '3.4' ) {
    105
    + $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
    106
    + echo $theme_data['Name'] . ': ' . $theme_data['Version'];
    107
    + } else {
    108
    + $theme_data = wp_get_theme();
    109
    + echo $theme_data->Name . ': ' . $theme_data->Version;
    110
    + }
    111
    + ?>
    112
    +
    113
    +
    114
    + ### End System Info ###
    115
    + </textarea>
    116
    + <p class="submit">
    117
    + <input type="hidden" name="wprss-action" value="download_sysinfo" />
    118
    + <?php submit_button( __( 'Download System Info File', 'wprss' ), 'primary', 'wprss-download-sysinfo', false ); ?>
    119
    + </p>
    120
    + </form>
    121
    +
    122
    + <?php
    123
    + }
    124
    +
    125
    + /**
    126
    + * Generates the System Info Download File
    127
    + *
    128
    + * @since 3.1
    129
    + * @return void
    130
    + */
    131
    + function wprss_generate_sysinfo_download() {
    132
    + nocache_headers();
    133
    +
    134
    + header( "Content-type: text/plain" );
    135
    + header( 'Content-Disposition: attachment; filename="wprss-system-info.txt"' );
    136
    +
    137
    + echo wp_strip_all_tags( $_POST['wprss-sysinfo'] );
    138
    + exit;
    139
    + }
    140
    + add_action( 'wprss_download_sysinfo', 'wprss_generate_sysinfo_download' );
    includes/update.php ADDED
    @@ -0,0 +1,219 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /**
    3
    + * Contains all the functions related to updating the plugin from
    4
    + * one version to another
    5
    + *
    6
    + * @package WP RSS Aggregator
    7
    + */
    8
    +
    9
    + add_action( 'init', 'wprss_version_check' );
    10
    + /**
    11
    + * Checks the version number and runs install or update functions if needed.
    12
    + *
    13
    + * @since 2.0
    14
    + */
    15
    + function wprss_version_check() {
    16
    +
    17
    + // Get the old database version.
    18
    + $old_db_version = get_option( 'wprss_db_version' );
    19
    +
    20
    + // Get the plugin settings.
    21
    + $settings = get_option( 'wprss_settings' );
    22
    +
    23
    + // Get the plugin options
    24
    + $options = get_option( 'wprss_options' );
    25
    +
    26
    + // For fresh installs
    27
    + // If there is no old database version and no settings, run the install.
    28
    + if ( empty( $old_db_version ) && false === $settings && false === $options ) {
    29
    + wprss_install();
    30
    + }
    31
    +
    32
    + // For version 1.0 to 3.0
    33
    + // If there is no old database version and no settings, but only options
    34
    + elseif ( empty( $old_db_version ) && false === $settings && !empty( $options ) ) {
    35
    + wp_clear_scheduled_hook( 'wprss_generate_hook' );
    36
    + wprss_install();
    37
    + wprss_migrate();
    38
    + wprss_fetch_insert_all_feed_items();
    39
    + }
    40
    +
    41
    + // For version 1.1 to 3.0
    42
    + // If there is no old database version, but only settings and options
    43
    + elseif ( empty( $old_db_version ) && !empty( $settings ) && !empty( $options ) ) {
    44
    + wp_clear_scheduled_hook( 'wprss_generate_hook' );
    45
    + wprss_update();
    46
    + wprss_migrate();
    47
    + wprss_fetch_insert_all_feed_items();
    48
    + }
    49
    +
    50
    + // For version 2+ to 3.0
    51
    + // We check if wprss_settings option exists, as this only exists prior to version 3.0
    52
    + // Settings field changed, and another added
    53
    + elseif ( intval( $old_db_version ) < intval( WPRSS_DB_VERSION ) && ( FALSE != get_option( 'wprss_settings' ) ) ) {
    54
    + wprss_upgrade_30();
    55
    + wprss_update();
    56
    + wprss_fetch_insert_all_feed_items();
    57
    + }
    58
    +
    59
    + // For any future versions where DB changes
    60
    + // If the old version is less than the new version, run the update.
    61
    + elseif ( intval( $old_db_version ) < intval( WPRSS_DB_VERSION ) ) {
    62
    + wprss_update();
    63
    + wprss_fetch_insert_all_feed_items();
    64
    + }
    65
    +
    66
    + }
    67
    +
    68
    +
    69
    + /**
    70
    + * Adds the plugin settings on install.
    71
    + *
    72
    + * @since 2.0
    73
    + */
    74
    + function wprss_install() {
    75
    +
    76
    + // Add the database version setting.
    77
    + add_option( 'wprss_db_version', WPRSS_DB_VERSION );
    78
    +
    79
    + // Add the default plugin settings.
    80
    + add_option( 'wprss_settings_general', wprss_get_default_settings_general() );
    81
    + }
    82
    +
    83
    +
    84
    + /**
    85
    + * Update settings of plugin to reflect new version
    86
    + *
    87
    + * @since 2.0
    88
    + */
    89
    + function wprss_update() {
    90
    +
    91
    + // Update the database version setting.
    92
    + update_option( 'wprss_db_version', WPRSS_DB_VERSION );
    93
    + // Initialize settings
    94
    + wprss_settings_initialize();
    95
    + }
    96
    +
    97
    +
    98
    + /**
    99
    + * Initialize settings to default ones if they are not yet set
    100
    + *
    101
    + * @since 3.0
    102
    + */
    103
    + function wprss_settings_initialize() {
    104
    + // Get the settings from the new field in the database
    105
    + $settings = get_option( 'wprss_settings_general' );
    106
    +
    107
    + // Get the default plugin settings.
    108
    + $default_settings = wprss_get_default_settings_general();
    109
    +
    110
    + // Loop through each of the default plugin settings.
    111
    + foreach ( $default_settings as $setting_key => $setting_value ) {
    112
    +
    113
    + // If the setting didn't previously exist, add the default value to the $settings array.
    114
    + if ( ! isset( $settings[ $setting_key ] ) )
    115
    + $settings[ $setting_key ] = $setting_value;
    116
    + }
    117
    +
    118
    + // Update the plugin settings.
    119
    + update_option( 'wprss_settings_general', $settings );
    120
    + }
    121
    +
    122
    +
    123
    + /**
    124
    + * Takes care of cron and DB changes between versions 2+ and 3
    125
    + *
    126
    + * @since 3.0
    127
    + */
    128
    + function wprss_upgrade_30() {
    129
    + wp_clear_scheduled_hook( 'wprss_fetch_feeds_hook' );
    130
    +
    131
    + // Get the settings from the database.
    132
    + $settings = get_option( 'wprss_settings' );
    133
    +
    134
    + // Put them into our new field
    135
    + update_option( 'wprss_settings_general', $settings );
    136
    +
    137
    + // Remove old options field, we are now using wprss_settings_general
    138
    + delete_option( 'wprss_settings' );
    139
    + }
    140
    +
    141
    +
    142
    + /**
    143
    + * Migrates the feed sources from the wprss_options field to the wp_posts table (for older versions)
    144
    + *
    145
    + * @since 2.0
    146
    + */
    147
    + function wprss_migrate() {
    148
    +
    149
    + // Get the plugin options
    150
    + $options = get_option( 'wprss_options' );
    151
    +
    152
    + $feed_sources = array_chunk( $options, 2 );
    153
    +
    154
    + foreach ( $feed_sources as $feed_source ) {
    155
    + $feed_title = $feed_source[0];
    156
    + $feed_url = $feed_source[1];
    157
    +
    158
    + // Create post object
    159
    + $feed_item = array(
    160
    + 'post_title' => $feed_title,
    161
    + 'post_content' => '',
    162
    + 'post_status' => 'publish',
    163
    + 'post_type' => 'wprss_feed'
    164
    + );
    165
    +
    166
    + $inserted_ID = wp_insert_post( $feed_item, $wp_error );
    167
    + // insert post meta
    168
    + update_post_meta( $inserted_ID, 'wprss_url', $feed_url );
    169
    + }
    170
    + // delete unneeded option
    171
    + delete_option( 'wprss_options' );
    172
    + }
    173
    +
    174
    +
    175
    + /**
    176
    + * Returns an array of the default plugin settings. These are only used on initial setup.
    177
    + *
    178
    + * @since 2.0
    179
    + */
    180
    + function wprss_get_default_settings_general() {
    181
    +
    182
    + // Set up the default plugin settings
    183
    + $settings = apply_filters(
    184
    + 'wprss_default_settings_general',
    185
    + array(
    186
    + // from version 1.1
    187
    + 'open_dd' => __( 'New window' ),
    188
    + 'follow_dd' => __( 'No follow' ),
    189
    +
    190
    + // from version 2.0
    191
    + 'feed_limit' => 15,
    192
    +
    193
    + // from version 3.0
    194
    + 'date_format' => 'Y-m-d',
    195
    + 'limit_feed_items_db' => 200,
    196
    + 'cron_interval' => 'hourly',
    197
    + 'styles_disable' => 0,
    198
    + 'title_link' => 1,
    199
    + 'source_enable' => 1,
    200
    + 'text_preceding_source' => 'Source:',
    201
    + 'date_enable' => 1,
    202
    + 'text_preceding_date' => 'Published on',
    203
    +
    204
    + // from version 3.1
    205
    + 'limit_feed_items_imported' => 200,
    206
    +
    207
    + // from version 3.3
    208
    + 'custom_feed_url' => 'wprss',
    209
    + 'custom_feed_limit' => '',
    210
    + 'source_link' => 0,
    211
    +
    212
    + // from version 3.4
    213
    + 'video_link' => 'false'
    214
    + )
    215
    + );
    216
    +
    217
    + // Return the default settings
    218
    + return $settings;
    219
    + }
    js/admin-addon-ajax.js ADDED
    @@ -0,0 +1,28 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + jQuery( document ).ready( function($) {
    2
    +
    3
    + $('.ajax-close-addon-notice').click( function() {
    4
    + addon = $(this).attr( 'data-addon' );
    5
    + notice = $(this).attr( 'data-notice' );
    6
    + element = $(this).parent().parent();
    7
    + if ( addon !== false && typeof addon !== 'undefined' && notice !== false && typeof notice !== 'undefined' ) {
    8
    + $.ajax({
    9
    + url: ajaxurl,
    10
    + type: 'POST',
    11
    + data: {
    12
    + action: 'wprss_dismiss_addon_notice',
    13
    + addon: addon,
    14
    + notice: notice,
    15
    + },
    16
    + success: function( data, status, jqXHR) {
    17
    + if ( data === 'true' ) {
    18
    + element.slideUp( 'fast', function(){
    19
    + element.remove();
    20
    + });
    21
    + }
    22
    + }
    23
    + });
    24
    + $(this).text('Please wait ...');
    25
    + }
    26
    + });
    27
    +
    28
    + });
    js/admin-custom.js ADDED
    @@ -0,0 +1,78 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + jQuery( document ).ready( function() {
    2
    +
    3
    + // On TAB pressed when on title input field, go to URL input field
    4
    + jQuery('input#title').on( 'keydown', function( event ) {
    5
    +
    6
    + if ( event.which == 9 ) {
    7
    + event.preventDefault();
    8
    + jQuery('input#wprss_url').focus();
    9
    + }
    10
    + }
    11
    + );
    12
    +
    13
    + // On TAB pressed when on description textarea field, go to Publish submit button
    14
    + jQuery('textarea#wprss_description').on( 'keydown', function( event ) {
    15
    +
    16
    + if ( event.which == 9 ) {
    17
    + event.preventDefault();
    18
    + jQuery('input#publish').focus();
    19
    + }
    20
    + }
    21
    + );
    22
    +
    23
    + // jQuery for 'Fetch Feed Items' Row Action in 'All Feed Sources' page
    24
    + jQuery('.wprss_ajax_action').click( function(){
    25
    + action_link = jQuery(this);
    26
    + id = action_link.attr('pid');
    27
    + url = action_link.attr('purl');
    28
    + jQuery.post(
    29
    + url,
    30
    + {
    31
    + 'action': 'wprss_fetch_feeds_action',
    32
    + 'id': id
    33
    + },
    34
    + function(response){
    35
    + action_link.text('Feed items imported!');
    36
    + }
    37
    + );
    38
    + action_link.text('Please wait ...');
    39
    + action_link.unbind('click');
    40
    + });
    41
    +
    42
    + // Make the number rollers change their value to empty string when value is 0, making
    43
    + // them use the placeholder.
    44
    + jQuery('.wprss-number-roller').on('change', function(){
    45
    + if ( jQuery(this).val() == 0 )
    46
    + jQuery(this).val('');
    47
    + });
    48
    + });
    49
    +
    50
    +
    51
    + /* JS for admin notice - Leave a review */
    52
    +
    53
    + jQuery(window).load( function(){
    54
    + // Check to see if the Ajax Notification is visible
    55
    + if ( jQuery('#dismiss-ajax-notification').length > 0 ) {
    56
    + NOTIFICATION = jQuery('#ajax-notification');
    57
    + NOTIFICATION_DISMISS = jQuery('#dismiss-ajax-notification');
    58
    + NOTIFICATION_DISMISS.click( function(evt){
    59
    + evt.preventDefault();
    60
    + evt.stopPropagation();
    61
    +
    62
    + jQuery.post(ajaxurl, {
    63
    + // The name of the function to fire on the server
    64
    + action: 'wprss_hide_admin_notification',
    65
    + // The nonce value to send for the security check
    66
    + nonce: jQuery.trim( jQuery('#ajax-notification-nonce').text() )
    67
    + }, function (response) {
    68
    + // If the response was successful (that is, 1 was returned), hide the notification;
    69
    + // Otherwise, we'll change the class name of the notification
    70
    + if ( response !== '1' ) {
    71
    + NOTIFICATION.removeClass('updated').addClass('error');
    72
    + } // end if
    73
    + });
    74
    +
    75
    + NOTIFICATION.fadeOut(400);
    76
    + });
    77
    + }
    78
    + })
    js/custom.js ADDED
    @@ -0,0 +1,7 @@
     
     
     
     
     
     
     
    1
    + jQuery( document ).ready( function() {
    2
    + if(jQuery.fn.colorbox) {
    3
    + jQuery( 'a.colorbox' ).colorbox(
    4
    + {iframe:true, width:'80%', height:'80%'}
    5
    + );
    6
    + }
    7
    + });
    js/editor.js ADDED
    @@ -0,0 +1,32 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + var WPRSS_TMCE_PLUGIN_ID = 'wprss';
    2
    +
    3
    + (function() {
    4
    + tinymce.create( 'tinymce.plugins.' + WPRSS_TMCE_PLUGIN_ID, {
    5
    + init : function( ed, url ) {
    6
    + ed.addButton( WPRSS_TMCE_PLUGIN_ID, {
    7
    + title : 'WPRSS Aggregator shortcode',
    8
    + image : url + '/../images/icon-adminpage32.png',
    9
    + onclick : function() {
    10
    + idPattern = /(?:(?:[^v]+)+v.)?([^&=]{11})(?=&|$)/;
    11
    + var vidId = prompt("WP RSS Aggregator Video", "Choose feed source");
    12
    + var m = idPattern.exec(vidId);
    13
    + if (m != null && m != 'undefined')
    14
    + ed.execCommand('mceInsertContent', false, '[wprss source="'+m[1]+'"]');
    15
    + }
    16
    + });
    17
    + },
    18
    + createControl : function( n, cm ) {
    19
    + return null;
    20
    + },
    21
    + getInfo : function() {
    22
    + return {
    23
    + longname : "WPRSS Aggregator Shortcode",
    24
    + author : 'John Galea',
    25
    + authorurl : 'http://profiles.wordpress.org/jeangalea/',
    26
    + infourl : 'http://www.wprssaggregator.com/',
    27
    + version : "1.0"
    28
    + };
    29
    + }
    30
    + });
    31
    + tinymce.PluginManager.add( WPRSS_TMCE_PLUGIN_ID, tinymce.plugins.wprss );
    32
    + })();
    js/jquery.colorbox-min.js ADDED
    @@ -0,0 +1,7 @@
     
     
     
     
     
     
     
    1
    + /*!
    2
    + Colorbox v1.4.29 - 2013-09-10
    3
    + jQuery lightbox and modal window plugin
    4
    + (c) 2013 Jack Moore - http://www.jacklmoore.com/colorbox
    5
    + license: http://www.opensource.org/licenses/mit-license.php
    6
    + */
    7
    + (function(t,e,i){function o(i,o,n){var r=e.createElement(i);return o&&(r.id=Z+o),n&&(r.style.cssText=n),t(r)}function n(){return i.innerHeight?i.innerHeight:t(i).height()}function r(t){var e=k.length,i=(A+t)%e;return 0>i?e+i:i}function h(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():n())/100:1)*parseInt(t,10))}function l(t,e){return t.photo||t.photoRegex.test(e)}function s(t,e){return t.retinaUrl&&i.devicePixelRatio>1?e.replace(t.photoRegex,t.retinaSuffix):e}function a(t){"contains"in g[0]&&!g[0].contains(t.target)&&(t.stopPropagation(),g.focus())}function d(){var e,i=t.data(z,Y);null==i?(B=t.extend({},X),console&&console.log&&console.log("Error: cboxElement missing settings object")):B=t.extend({},i);for(e in B)t.isFunction(B[e])&&"on"!==e.slice(0,2)&&(B[e]=B[e].call(z));B.rel=B.rel||z.rel||t(z).data("rel")||"nofollow",B.href=B.href||t(z).attr("href"),B.title=B.title||z.title,"string"==typeof B.href&&(B.href=t.trim(B.href))}function c(i,o){t(e).trigger(i),le.trigger(i),t.isFunction(o)&&o.call(z)}function u(i){q||(z=i,d(),k=t(z),A=0,"nofollow"!==B.rel&&(k=t("."+te).filter(function(){var e,i=t.data(this,Y);return i&&(e=t(this).data("rel")||i.rel||this.rel),e===B.rel}),A=k.index(z),-1===A&&(k=k.add(z),A=k.length-1)),w.css({opacity:parseFloat(B.opacity),cursor:B.overlayClose?"pointer":"auto",visibility:"visible"}).show(),J&&g.add(w).removeClass(J),B.className&&g.add(w).addClass(B.className),J=B.className,B.closeButton?K.html(B.close).appendTo(y):K.appendTo("<div/>"),U||(U=$=!0,g.css({visibility:"hidden",display:"block"}),H=o(se,"LoadedContent","width:0; height:0; overflow:hidden"),y.css({width:"",height:""}).append(H),O=x.height()+C.height()+y.outerHeight(!0)-y.height(),_=b.width()+T.width()+y.outerWidth(!0)-y.width(),D=H.outerHeight(!0),N=H.outerWidth(!0),B.w=h(B.initialWidth,"x"),B.h=h(B.initialHeight,"y"),H.css({width:"",height:B.h}),Q.position(),c(ee,B.onOpen),P.add(L).hide(),g.focus(),B.trapFocus&&e.addEventListener&&(e.addEventListener("focus",a,!0),le.one(re,function(){e.removeEventListener("focus",a,!0)})),B.returnFocus&&le.one(re,function(){t(z).focus()})),m())}function f(){!g&&e.body&&(V=!1,E=t(i),g=o(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),w=o(se,"Overlay").hide(),F=t([o(se,"LoadingOverlay")[0],o(se,"LoadingGraphic")[0]]),v=o(se,"Wrapper"),y=o(se,"Content").append(L=o(se,"Title"),S=o(se,"Current"),I=t('<button type="button"/>').attr({id:Z+"Previous"}),R=t('<button type="button"/>').attr({id:Z+"Next"}),M=o("button","Slideshow"),F),K=t('<button type="button"/>').attr({id:Z+"Close"}),v.append(o(se).append(o(se,"TopLeft"),x=o(se,"TopCenter"),o(se,"TopRight")),o(se,!1,"clear:left").append(b=o(se,"MiddleLeft"),y,T=o(se,"MiddleRight")),o(se,!1,"clear:left").append(o(se,"BottomLeft"),C=o(se,"BottomCenter"),o(se,"BottomRight"))).find("div div").css({"float":"left"}),W=o(se,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),P=R.add(I).add(S).add(M),t(e.body).append(w,g.append(v,W)))}function p(){function i(t){t.which>1||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey||(t.preventDefault(),u(this))}return g?(V||(V=!0,R.click(function(){Q.next()}),I.click(function(){Q.prev()}),K.click(function(){Q.close()}),w.click(function(){B.overlayClose&&Q.close()}),t(e).bind("keydown."+Z,function(t){var e=t.keyCode;U&&B.escKey&&27===e&&(t.preventDefault(),Q.close()),U&&B.arrowKey&&k[1]&&!t.altKey&&(37===e?(t.preventDefault(),I.click()):39===e&&(t.preventDefault(),R.click()))}),t.isFunction(t.fn.on)?t(e).on("click."+Z,"."+te,i):t("."+te).live("click."+Z,i)),!0):!1}function m(){var n,r,a,u=Q.prep,f=++ae;$=!0,j=!1,z=k[A],d(),c(he),c(ie,B.onLoad),B.h=B.height?h(B.height,"y")-D-O:B.innerHeight&&h(B.innerHeight,"y"),B.w=B.width?h(B.width,"x")-N-_:B.innerWidth&&h(B.innerWidth,"x"),B.mw=B.w,B.mh=B.h,B.maxWidth&&(B.mw=h(B.maxWidth,"x")-N-_,B.mw=B.w&&B.w<B.mw?B.w:B.mw),B.maxHeight&&(B.mh=h(B.maxHeight,"y")-D-O,B.mh=B.h&&B.h<B.mh?B.h:B.mh),n=B.href,G=setTimeout(function(){F.show()},100),B.inline?(a=o(se).hide().insertBefore(t(n)[0]),le.one(he,function(){a.replaceWith(H.children())}),u(t(n))):B.iframe?u(" "):B.html?u(B.html):l(B,n)?(n=s(B,n),j=e.createElement("img"),t(j).addClass(Z+"Photo").bind("error",function(){B.title=!1,u(o(se,"Error").html(B.imgError))}).one("load",function(){var e;f===ae&&(j.alt=t(z).attr("alt")||t(z).attr("data-alt")||"",B.retinaImage&&i.devicePixelRatio>1&&(j.height=j.height/i.devicePixelRatio,j.width=j.width/i.devicePixelRatio),B.scalePhotos&&(r=function(){j.height-=j.height*e,j.width-=j.width*e},B.mw&&j.width>B.mw&&(e=(j.width-B.mw)/j.width,r()),B.mh&&j.height>B.mh&&(e=(j.height-B.mh)/j.height,r())),B.h&&(j.style.marginTop=Math.max(B.mh-j.height,0)/2+"px"),k[1]&&(B.loop||k[A+1])&&(j.style.cursor="pointer",j.onclick=function(){Q.next()}),j.style.width=j.width+"px",j.style.height=j.height+"px",setTimeout(function(){u(j)},1))}),setTimeout(function(){j.src=n},1)):n&&W.load(n,B.data,function(e,i){f===ae&&u("error"===i?o(se,"Error").html(B.xhrError):t(this).contents())})}var w,g,v,y,x,b,T,C,k,E,H,W,F,L,S,M,R,I,K,P,B,O,_,D,N,z,A,j,U,$,q,G,Q,J,V,X={transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",open:!1,returnFocus:!0,trapFocus:!0,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0},Y="colorbox",Z="cbox",te=Z+"Element",ee=Z+"_open",ie=Z+"_load",oe=Z+"_complete",ne=Z+"_cleanup",re=Z+"_closed",he=Z+"_purge",le=t("<a/>"),se="div",ae=0,de={},ce=function(){function t(){clearTimeout(h)}function e(){(B.loop||k[A+1])&&(t(),h=setTimeout(Q.next,B.slideshowSpeed))}function i(){M.html(B.slideshowStop).unbind(s).one(s,o),le.bind(oe,e).bind(ie,t),g.removeClass(l+"off").addClass(l+"on")}function o(){t(),le.unbind(oe,e).unbind(ie,t),M.html(B.slideshowStart).unbind(s).one(s,function(){Q.next(),i()}),g.removeClass(l+"on").addClass(l+"off")}function n(){r=!1,M.hide(),t(),le.unbind(oe,e).unbind(ie,t),g.removeClass(l+"off "+l+"on")}var r,h,l=Z+"Slideshow_",s="click."+Z;return function(){r?B.slideshow||(le.unbind(ne,n),n()):B.slideshow&&k[1]&&(r=!0,le.one(ne,n),B.slideshowAuto?i():o(),M.show())}}();t.colorbox||(t(f),Q=t.fn[Y]=t[Y]=function(e,i){var o=this;if(e=e||{},f(),p()){if(t.isFunction(o))o=t("<a/>"),e.open=!0;else if(!o[0])return o;i&&(e.onComplete=i),o.each(function(){t.data(this,Y,t.extend({},t.data(this,Y)||X,e))}).addClass(te),(t.isFunction(e.open)&&e.open.call(o)||e.open)&&u(o[0])}return o},Q.position=function(e,i){function o(){x[0].style.width=C[0].style.width=y[0].style.width=parseInt(g[0].style.width,10)-_+"px",y[0].style.height=b[0].style.height=T[0].style.height=parseInt(g[0].style.height,10)-O+"px"}var r,l,s,a=0,d=0,c=g.offset();if(E.unbind("resize."+Z),g.css({top:-9e4,left:-9e4}),l=E.scrollTop(),s=E.scrollLeft(),B.fixed?(c.top-=l,c.left-=s,g.css({position:"fixed"})):(a=l,d=s,g.css({position:"absolute"})),d+=B.right!==!1?Math.max(E.width()-B.w-N-_-h(B.right,"x"),0):B.left!==!1?h(B.left,"x"):Math.round(Math.max(E.width()-B.w-N-_,0)/2),a+=B.bottom!==!1?Math.max(n()-B.h-D-O-h(B.bottom,"y"),0):B.top!==!1?h(B.top,"y"):Math.round(Math.max(n()-B.h-D-O,0)/2),g.css({top:c.top,left:c.left,visibility:"visible"}),v[0].style.width=v[0].style.height="9999px",r={width:B.w+N+_,height:B.h+D+O,top:a,left:d},e){var u=0;t.each(r,function(t){return r[t]!==de[t]?(u=e,void 0):void 0}),e=u}de=r,e||g.css(r),g.dequeue().animate(r,{duration:e||0,complete:function(){o(),$=!1,v[0].style.width=B.w+N+_+"px",v[0].style.height=B.h+D+O+"px",B.reposition&&setTimeout(function(){E.bind("resize."+Z,Q.position)},1),i&&i()},step:o})},Q.resize=function(t){var e;U&&(t=t||{},t.width&&(B.w=h(t.width,"x")-N-_),t.innerWidth&&(B.w=h(t.innerWidth,"x")),H.css({width:B.w}),t.height&&(B.h=h(t.height,"y")-D-O),t.innerHeight&&(B.h=h(t.innerHeight,"y")),t.innerHeight||t.height||(e=H.scrollTop(),H.css({height:"auto"}),B.h=H.height()),H.css({height:B.h}),e&&H.scrollTop(e),Q.position("none"===B.transition?0:B.speed))},Q.prep=function(i){function n(){return B.w=B.w||H.width(),B.w=B.mw&&B.mw<B.w?B.mw:B.w,B.w}function h(){return B.h=B.h||H.height(),B.h=B.mh&&B.mh<B.h?B.mh:B.h,B.h}if(U){var a,d="none"===B.transition?0:B.speed;H.empty().remove(),H=o(se,"LoadedContent").append(i),H.hide().appendTo(W.show()).css({width:n(),overflow:B.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(y),W.hide(),t(j).css({"float":"none"}),a=function(){function i(){t.support.opacity===!1&&g[0].style.removeAttribute("filter")}var n,h,a=k.length,u="frameBorder",f="allowTransparency";U&&(h=function(){clearTimeout(G),F.hide(),c(oe,B.onComplete)},L.html(B.title).add(H).show(),a>1?("string"==typeof B.current&&S.html(B.current.replace("{current}",A+1).replace("{total}",a)).show(),R[B.loop||a-1>A?"show":"hide"]().html(B.next),I[B.loop||A?"show":"hide"]().html(B.previous),ce(),B.preloading&&t.each([r(-1),r(1)],function(){var i,o,n=k[this],r=t.data(n,Y);r&&r.href?(i=r.href,t.isFunction(i)&&(i=i.call(n))):i=t(n).attr("href"),i&&l(r,i)&&(i=s(r,i),o=e.createElement("img"),o.src=i)})):P.hide(),B.iframe?(n=o("iframe")[0],u in n&&(n[u]=0),f in n&&(n[f]="true"),B.scrolling||(n.scrolling="no"),t(n).attr({src:B.href,name:(new Date).getTime(),"class":Z+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",h).appendTo(H),le.one(he,function(){n.src="//about:blank"}),B.fastIframe&&t(n).trigger("load")):h(),"fade"===B.transition?g.fadeTo(d,1,i):i())},"fade"===B.transition?g.fadeTo(d,0,function(){Q.position(0,a)}):Q.position(d,a)}},Q.next=function(){!$&&k[1]&&(B.loop||k[A+1])&&(A=r(1),u(k[A]))},Q.prev=function(){!$&&k[1]&&(B.loop||A)&&(A=r(-1),u(k[A]))},Q.close=function(){U&&!q&&(q=!0,U=!1,c(ne,B.onCleanup),E.unbind("."+Z),w.fadeTo(B.fadeOut||0,0),g.stop().fadeTo(B.fadeOut||0,0,function(){g.add(w).css({opacity:1,cursor:"auto"}).hide(),c(he),H.empty().remove(),setTimeout(function(){q=!1,c(re,B.onClosed)},1)}))},Q.remove=function(){g&&(g.stop(),t.colorbox.close(),g.stop().remove(),w.remove(),q=!1,g=null,t("."+te).removeData(Y).removeClass(te),t(e).unbind("click."+Z))},Q.element=function(){return t(z)},Q.settings=X)})(jQuery,document,window);
    languages/default.mo ADDED
    Binary file
    languages/default.po ADDED
    @@ -0,0 +1,272 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + msgid ""
    2
    + msgstr ""
    3
    + "Project-Id-Version: wprss\n"
    4
    + "POT-Creation-Date: 2012-09-25 12:09+0100\n"
    5
    + "PO-Revision-Date: 2012-09-25 13:52+0100\n"
    6
    + "Last-Translator: \n"
    7
    + "Language-Team: \n"
    8
    + "MIME-Version: 1.0\n"
    9
    + "Content-Type: text/plain; charset=UTF-8\n"
    10
    + "Content-Transfer-Encoding: 8bit\n"
    11
    + "X-Generator: Poedit 1.5.3\n"
    12
    + "X-Poedit-KeywordsList: _;__;_e\n"
    13
    + "X-Poedit-Basepath: ../\n"
    14
    + "X-Poedit-SearchPath-0: .\n"
    15
    +
    16
    + #: wp-rss-aggregator.php:152
    17
    + msgid "Enter feed name here (e.g. WP Mayor)"
    18
    + msgstr ""
    19
    +
    20
    + #: wp-rss-aggregator.php:394
    21
    + msgid "No feed items found"
    22
    + msgstr ""
    23
    +
    24
    + #: inc/activation.php:11
    25
    + msgid "This plugin requires WordPress version 3.2 or higher."
    26
    + msgstr ""
    27
    +
    28
    + #: inc/admin-options.php:45 inc/admin-options.php:88
    29
    + msgid "WP RSS Aggregator Settings"
    30
    + msgstr ""
    31
    +
    32
    + #: inc/admin-options.php:45
    33
    + msgid "Settings"
    34
    + msgstr ""
    35
    +
    36
    + #: inc/admin-options.php:67
    37
    + msgid "Open links behaviour"
    38
    + msgstr ""
    39
    +
    40
    + #: inc/admin-options.php:70
    41
    + msgid "Set links as"
    42
    + msgstr ""
    43
    +
    44
    + #: inc/admin-options.php:73
    45
    + msgid "Feed limit"
    46
    + msgstr ""
    47
    +
    48
    + #: inc/admin-options.php:93
    49
    + msgid "Save Settings"
    50
    + msgstr ""
    51
    +
    52
    + #: inc/admin-options.php:113
    53
    + msgid "No follow"
    54
    + msgstr ""
    55
    +
    56
    + #: inc/admin-options.php:114
    57
    + msgid "Follow"
    58
    + msgstr ""
    59
    +
    60
    + #: inc/admin-options.php:132
    61
    + msgid "Lightbox"
    62
    + msgstr ""
    63
    +
    64
    + #: inc/admin-options.php:133
    65
    + msgid "New window"
    66
    + msgstr ""
    67
    +
    68
    + #: inc/admin-options.php:134
    69
    + msgid "None"
    70
    + msgstr ""
    71
    +
    72
    + #: inc/cron-jobs.php:53
    73
    + msgid "Once Weekly"
    74
    + msgstr ""
    75
    +
    76
    + #: inc/custom-post-types.php:30
    77
    + msgid "Feed Sources"
    78
    + msgstr ""
    79
    +
    80
    + #: inc/custom-post-types.php:31
    81
    + msgid "Feed"
    82
    + msgstr ""
    83
    +
    84
    + #: inc/custom-post-types.php:32 inc/custom-post-types.php:34
    85
    + msgid "Add New Feed Source"
    86
    + msgstr ""
    87
    +
    88
    + #: inc/custom-post-types.php:33
    89
    + msgid "All Feed Sources"
    90
    + msgstr ""
    91
    +
    92
    + #: inc/custom-post-types.php:35
    93
    + msgid "Edit Feed Source"
    94
    + msgstr ""
    95
    +
    96
    + #: inc/custom-post-types.php:36
    97
    + msgid "New Feed Source"
    98
    + msgstr ""
    99
    +
    100
    + #: inc/custom-post-types.php:37
    101
    + msgid "View Feed Source"
    102
    + msgstr ""
    103
    +
    104
    + #: inc/custom-post-types.php:38
    105
    + msgid "Search Feeds"
    106
    + msgstr ""
    107
    +
    108
    + #: inc/custom-post-types.php:39
    109
    + msgid "No Feed Sources Found"
    110
    + msgstr ""
    111
    +
    112
    + #: inc/custom-post-types.php:40
    113
    + msgid "No Feed Sources Found In Trash"
    114
    + msgstr ""
    115
    +
    116
    + #: inc/custom-post-types.php:41
    117
    + msgid "RSS Aggregator"
    118
    + msgstr ""
    119
    +
    120
    + #: inc/custom-post-types.php:58 inc/custom-post-types.php:60
    121
    + msgid "Imported Feeds"
    122
    + msgstr ""
    123
    +
    124
    + #: inc/custom-post-types.php:59
    125
    + msgid "Imported Feed"
    126
    + msgstr ""
    127
    +
    128
    + #: inc/custom-post-types.php:61
    129
    + msgid "View Imported Feed"
    130
    + msgstr ""
    131
    +
    132
    + #: inc/custom-post-types.php:62
    133
    + msgid "Search Imported Feeds"
    134
    + msgstr ""
    135
    +
    136
    + #: inc/custom-post-types.php:63
    137
    + msgid "No Imported Feeds Found"
    138
    + msgstr ""
    139
    +
    140
    + #: inc/custom-post-types.php:64
    141
    + msgid "No Imported Feeds Found In Trash"
    142
    + msgstr ""
    143
    +
    144
    + #: inc/custom-post-types.php:83 inc/custom-post-types.php:135
    145
    + msgid "Name"
    146
    + msgstr ""
    147
    +
    148
    + #: inc/custom-post-types.php:84 inc/custom-post-types.php:306
    149
    + msgid "URL"
    150
    + msgstr ""
    151
    +
    152
    + #: inc/custom-post-types.php:85 inc/custom-post-types.php:313
    153
    + msgid "Description"
    154
    + msgstr ""
    155
    +
    156
    + #: inc/custom-post-types.php:136
    157
    + msgid "Permalink"
    158
    + msgstr ""
    159
    +
    160
    + #: inc/custom-post-types.php:137
    161
    + msgid "Date published"
    162
    + msgstr ""
    163
    +
    164
    + #: inc/custom-post-types.php:138
    165
    + msgid "Source"
    166
    + msgstr ""
    167
    +
    168
    + #: inc/custom-post-types.php:226
    169
    + msgid "Save Feed Source"
    170
    + msgstr ""
    171
    +
    172
    + #: inc/custom-post-types.php:252
    173
    + msgid "WP RSS Aggregator Help"
    174
    + msgstr ""
    175
    +
    176
    + #: inc/custom-post-types.php:261
    177
    + msgid "Like this plugin?"
    178
    + msgstr ""
    179
    +
    180
    + #: inc/custom-post-types.php:270
    181
    + msgid "Follow us"
    182
    + msgstr ""
    183
    +
    184
    + #: inc/custom-post-types.php:279
    185
    + msgid "Feed Source Details"
    186
    + msgstr ""
    187
    +
    188
    + #: inc/custom-post-types.php:288
    189
    + msgid "Feed Preview"
    190
    + msgstr ""
    191
    +
    192
    + #: inc/custom-post-types.php:307
    193
    + msgid "Enter feed URL (including http://)"
    194
    + msgstr ""
    195
    +
    196
    + #: inc/custom-post-types.php:314
    197
    + msgid "A short description about this feed source (optional)"
    198
    + msgstr ""
    199
    +
    200
    + #: inc/custom-post-types.php:438
    201
    + msgid "Delete Permanently"
    202
    + msgstr ""
    203
    +
    204
    + #: inc/custom-post-types.php:440
    205
    + msgid "Move to Trash"
    206
    + msgstr ""
    207
    +
    208
    + #: inc/custom-post-types.php:471
    209
    + msgid ""
    210
    + "<strong>Invalid feed URL</strong> - Double check the feed source URL setting "
    211
    + "above."
    212
    + msgstr ""
    213
    +
    214
    + #: inc/custom-post-types.php:474
    215
    + msgid "No feed URL defined yet"
    216
    + msgstr ""
    217
    +
    218
    + #: inc/custom-post-types.php:486
    219
    + msgid "Need help?"
    220
    + msgstr ""
    221
    +
    222
    + #: inc/custom-post-types.php:488
    223
    + msgid "Check out the support forum"
    224
    + msgstr ""
    225
    +
    226
    + #: inc/custom-post-types.php:499
    227
    + msgid "Why not do any or all of the following"
    228
    + msgstr ""
    229
    +
    230
    + #: inc/custom-post-types.php:501
    231
    + msgid "Give it a 5 star rating on WordPress.org."
    232
    + msgstr ""
    233
    +
    234
    + #: inc/custom-post-types.php:502
    235
    + msgid "Donate a token of your appreciation."
    236
    + msgstr ""
    237
    +
    238
    + #: inc/custom-post-types.php:517
    239
    + msgid "Follow WP Mayor on Twitter."
    240
    + msgstr ""
    241
    +
    242
    + #: inc/custom-post-types.php:518
    243
    + msgid "Like WP Mayor on Facebook."
    244
    + msgstr ""
    245
    +
    246
    + #: inc/custom-post-types.php:535
    247
    + msgid "Feed source updated. "
    248
    + msgstr ""
    249
    +
    250
    + #: inc/custom-post-types.php:536
    251
    + msgid "Custom field updated."
    252
    + msgstr ""
    253
    +
    254
    + #: inc/custom-post-types.php:537
    255
    + msgid "Custom field deleted."
    256
    + msgstr ""
    257
    +
    258
    + #: inc/custom-post-types.php:538 inc/custom-post-types.php:544
    259
    + msgid "Feed source updated."
    260
    + msgstr ""
    261
    +
    262
    + #: inc/custom-post-types.php:540 inc/custom-post-types.php:541
    263
    + msgid "Feed source saved."
    264
    + msgstr ""
    265
    +
    266
    + #: inc/custom-post-types.php:542
    267
    + msgid "Feed source submitted."
    268
    + msgstr ""
    269
    +
    270
    + #: inc/custom-post-types.php:628
    271
    + msgid "Publish Feed"
    272
    + msgstr ""
    languages/it.mo ADDED
    Binary file
    languages/it.po ADDED
    @@ -0,0 +1,274 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + msgid ""
    2
    + msgstr ""
    3
    + "Project-Id-Version: wprss\n"
    4
    + "POT-Creation-Date: 2012-09-25 12:09+0100\n"
    5
    + "PO-Revision-Date: 2012-09-30 11:18+0100\n"
    6
    + "Last-Translator: Davide De Maestri <davide.demaestri@gmail.com>\n"
    7
    + "Language-Team: \n"
    8
    + "MIME-Version: 1.0\n"
    9
    + "Content-Type: text/plain; charset=UTF-8\n"
    10
    + "Content-Transfer-Encoding: 8bit\n"
    11
    + "X-Generator: Poedit 1.5.3\n"
    12
    + "X-Poedit-KeywordsList: _;__;_e\n"
    13
    + "X-Poedit-Basepath: ../\n"
    14
    + "X-Poedit-SearchPath-0: .\n"
    15
    +
    16
    + #: wp-rss-aggregator.php:152
    17
    + msgid "Enter feed name here (e.g. WP Mayor)"
    18
    + msgstr "Inserisci il nome del feed qui (es: WP Mayor)"
    19
    +
    20
    + #: wp-rss-aggregator.php:394
    21
    + msgid "No feed items found"
    22
    + msgstr "Nessun feed trovato"
    23
    +
    24
    + #: inc/activation.php:11
    25
    + msgid "This plugin requires WordPress version 3.2 or higher."
    26
    + msgstr "Questo plugin richiede la versione di WordPress 3.2 o superiore"
    27
    +
    28
    + #: inc/admin-options.php:45 inc/admin-options.php:88
    29
    + msgid "WP RSS Aggregator Settings"
    30
    + msgstr "Impostazioni WP RSS Aggregator"
    31
    +
    32
    + #: inc/admin-options.php:45
    33
    + msgid "Settings"
    34
    + msgstr "Impostazioni"
    35
    +
    36
    + #: inc/admin-options.php:67
    37
    + msgid "Open links behaviour"
    38
    + msgstr "Comportamento di apertura dei links"
    39
    +
    40
    + #: inc/admin-options.php:70
    41
    + msgid "Set links as"
    42
    + msgstr "Imposta links come"
    43
    +
    44
    + #: inc/admin-options.php:73
    45
    + msgid "Feed limit"
    46
    + msgstr "Limite Feed"
    47
    +
    48
    + #: inc/admin-options.php:93
    49
    + msgid "Save Settings"
    50
    + msgstr "Salva impostazioni"
    51
    +
    52
    + #: inc/admin-options.php:113
    53
    + msgid "No follow"
    54
    + msgstr "No follow"
    55
    +
    56
    + #: inc/admin-options.php:114
    57
    + msgid "Follow"
    58
    + msgstr "Follow"
    59
    +
    60
    + #: inc/admin-options.php:132
    61
    + msgid "Lightbox"
    62
    + msgstr "Lightbox"
    63
    +
    64
    + #: inc/admin-options.php:133
    65
    + msgid "New window"
    66
    + msgstr "Nuova finestra"
    67
    +
    68
    + #: inc/admin-options.php:134
    69
    + msgid "None"
    70
    + msgstr "Nessuno"
    71
    +
    72
    + #: inc/cron-jobs.php:53
    73
    + msgid "Once Weekly"
    74
    + msgstr "Una volta alla settimana"
    75
    +
    76
    + #: inc/custom-post-types.php:30
    77
    + msgid "Feed Sources"
    78
    + msgstr "Sorgenti Feed"
    79
    +
    80
    + #: inc/custom-post-types.php:31
    81
    + msgid "Feed"
    82
    + msgstr "Feed"
    83
    +
    84
    + #: inc/custom-post-types.php:32 inc/custom-post-types.php:34
    85
    + msgid "Add New Feed Source"
    86
    + msgstr "Aggiungi nuova sorgente Feed"
    87
    +
    88
    + #: inc/custom-post-types.php:33
    89
    + msgid "All Feed Sources"
    90
    + msgstr "Tutte le sorgenti feed"
    91
    +
    92
    + #: inc/custom-post-types.php:35
    93
    + msgid "Edit Feed Source"
    94
    + msgstr "Modifica sorgente feed"
    95
    +
    96
    + #: inc/custom-post-types.php:36
    97
    + msgid "New Feed Source"
    98
    + msgstr "Nuova sorgente feed"
    99
    +
    100
    + #: inc/custom-post-types.php:37
    101
    + msgid "View Feed Source"
    102
    + msgstr "Visualizza sorgente feed"
    103
    +
    104
    + #: inc/custom-post-types.php:38
    105
    + msgid "Search Feeds"
    106
    + msgstr "Cerca feeds"
    107
    +
    108
    + #: inc/custom-post-types.php:39
    109
    + msgid "No Feed Sources Found"
    110
    + msgstr "Nessuna sorgente di feed trovata"
    111
    +
    112
    + #: inc/custom-post-types.php:40
    113
    + msgid "No Feed Sources Found In Trash"
    114
    + msgstr "Nessuna sorgente di feed trovata nel cestino"
    115
    +
    116
    + #: inc/custom-post-types.php:41
    117
    + msgid "RSS Aggregator"
    118
    + msgstr "Aggregatore RSS"
    119
    +
    120
    + #: inc/custom-post-types.php:58 inc/custom-post-types.php:60
    121
    + msgid "Imported Feeds"
    122
    + msgstr "Feeds importati"
    123
    +
    124
    + #: inc/custom-post-types.php:59
    125
    + msgid "Imported Feed"
    126
    + msgstr "Feed importato"
    127
    +
    128
    + #: inc/custom-post-types.php:61
    129
    + msgid "View Imported Feed"
    130
    + msgstr "Visualizza feed importato"
    131
    +
    132
    + #: inc/custom-post-types.php:62
    133
    + msgid "Search Imported Feeds"
    134
    + msgstr "Cerca feeds importati"
    135
    +
    136
    + #: inc/custom-post-types.php:63
    137
    + msgid "No Imported Feeds Found"
    138
    + msgstr "Nessun feed importato trovato"
    139
    +
    140
    + #: inc/custom-post-types.php:64
    141
    + msgid "No Imported Feeds Found In Trash"
    142
    + msgstr "Nessun feed importato trovato nel cestino"
    143
    +
    144
    + #: inc/custom-post-types.php:83 inc/custom-post-types.php:135
    145
    + msgid "Name"
    146
    + msgstr "Nome"
    147
    +
    148
    + #: inc/custom-post-types.php:84 inc/custom-post-types.php:306
    149
    + msgid "URL"
    150
    + msgstr "URL"
    151
    +
    152
    + #: inc/custom-post-types.php:85 inc/custom-post-types.php:313
    153
    + msgid "Description"
    154
    + msgstr "Descrizione"
    155
    +
    156
    + #: inc/custom-post-types.php:136
    157
    + msgid "Permalink"
    158
    + msgstr "Permalink"
    159
    +
    160
    + #: inc/custom-post-types.php:137
    161
    + msgid "Date published"
    162
    + msgstr "Data di pubblicazione"
    163
    +
    164
    + #: inc/custom-post-types.php:138
    165
    + msgid "Source"
    166
    + msgstr "Sorgente"
    167
    +
    168
    + #: inc/custom-post-types.php:226
    169
    + msgid "Save Feed Source"
    170
    + msgstr "Salva sorgente feed"
    171
    +
    172
    + #: inc/custom-post-types.php:252
    173
    + msgid "WP RSS Aggregator Help"
    174
    + msgstr "Aiuto WP RSS Aggregator"
    175
    +
    176
    + #: inc/custom-post-types.php:261
    177
    + msgid "Like this plugin?"
    178
    + msgstr "Ti piace questo plugin?"
    179
    +
    180
    + #: inc/custom-post-types.php:270
    181
    + msgid "Follow us"
    182
    + msgstr "Seguici"
    183
    +
    184
    + #: inc/custom-post-types.php:279
    185
    + msgid "Feed Source Details"
    186
    + msgstr "Dettagli sorgente feed"
    187
    +
    188
    + #: inc/custom-post-types.php:288
    189
    + msgid "Feed Preview"
    190
    + msgstr "Anteprima Feed"
    191
    +
    192
    + #: inc/custom-post-types.php:307
    193
    + msgid "Enter feed URL (including http://)"
    194
    + msgstr "Inserisci l'URL del feed (includi http://)"
    195
    +
    196
    + #: inc/custom-post-types.php:314
    197
    + msgid "A short description about this feed source (optional)"
    198
    + msgstr "Una breve descrizione di questa sorgente feed (opzionale)"
    199
    +
    200
    + #: inc/custom-post-types.php:438
    201
    + msgid "Delete Permanently"
    202
    + msgstr "Elimina permanentemente"
    203
    +
    204
    + #: inc/custom-post-types.php:440
    205
    + msgid "Move to Trash"
    206
    + msgstr "Sposta nel cestino"
    207
    +
    208
    + #: inc/custom-post-types.php:471
    209
    + msgid ""
    210
    + "<strong>Invalid feed URL</strong> - Double check the feed source URL setting "
    211
    + "above."
    212
    + msgstr ""
    213
    + "<strong>URL del feed non valido</strong> - Ricontrolla l'URL della sorgente "
    214
    + "del feed nelle impostazioni sopra."
    215
    +
    216
    + #: inc/custom-post-types.php:474
    217
    + msgid "No feed URL defined yet"
    218
    + msgstr "Nessun URL del feed ancora definito"
    219
    +
    220
    + #: inc/custom-post-types.php:486
    221
    + msgid "Need help?"
    222
    + msgstr "Hai bisogno di aiuto?"
    223
    +
    224
    + #: inc/custom-post-types.php:488
    225
    + msgid "Check out the support forum"
    226
    + msgstr "Controlla il forum di supporto"
    227
    +
    228
    + #: inc/custom-post-types.php:499
    229
    + msgid "Why not do any or all of the following"
    230
    + msgstr "Perchè non fare alcuna o tutte delle seguenti cose"
    231
    +
    232
    + #: inc/custom-post-types.php:501
    233
    + msgid "Give it a 5 star rating on WordPress.org."
    234
    + msgstr "Dare 5 stelle su WordPress.org"
    235
    +
    236
    + #: inc/custom-post-types.php:502
    237
    + msgid "Donate a token of your appreciation."
    238
    + msgstr "Donare una moneta come ringraziamento."
    239
    +
    240
    + #: inc/custom-post-types.php:517
    241
    + msgid "Follow WP Mayor on Twitter."
    242
    + msgstr "Segui WP Mayor su Twitter"
    243
    +
    244
    + #: inc/custom-post-types.php:518
    245
    + msgid "Like WP Mayor on Facebook."
    246
    + msgstr "Segui WP Mayor su Facebook"
    247
    +
    248
    + #: inc/custom-post-types.php:535
    249
    + msgid "Feed source updated. "
    250
    + msgstr "Sorgente feed aggiornata."
    251
    +
    252
    + #: inc/custom-post-types.php:536
    253
    + msgid "Custom field updated."
    254
    + msgstr "Campo personalizzato aggiornato."
    255
    +
    256
    + #: inc/custom-post-types.php:537
    257
    + msgid "Custom field deleted."
    258
    + msgstr "Campo personalizzato cancellato."
    259
    +
    260
    + #: inc/custom-post-types.php:538 inc/custom-post-types.php:544
    261
    + msgid "Feed source updated."
    262
    + msgstr "Sorgente feed aggiornata."
    263
    +
    264
    + #: inc/custom-post-types.php:540 inc/custom-post-types.php:541
    265
    + msgid "Feed source saved."
    266
    + msgstr "Sorgente feed salvata."
    267
    +
    268
    + #: inc/custom-post-types.php:542
    269
    + msgid "Feed source submitted."
    270
    + msgstr "Sorgente feed inviata."
    271
    +
    272
    + #: inc/custom-post-types.php:628
    273
    + msgid "Publish Feed"
    274
    + msgstr "Pubblica Feed"
    readme.txt ADDED
    @@ -0,0 +1,242 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + === WP RSS Aggregator ===
    2
    + Contributors: jeangalea
    3
    + Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9GP6BL4BLXBJ
    4
    + Plugin URI: http://www.wprssaggregator.com
    5
    + Tags: rss, feeds, aggregation, aggregator, import, feed aggregator, rss aggregator, multiple rss feeds, multi rss feeds, multi rss, rss import, feed import, feed import, multiple feed import, feed aggregation, rss feader, feed reader, feed to post, multiple feeds, multi feed importer, multi feed import, multi import, autoblog, autoblogging, autoblogger
    6
    + Requires at least: 3.3
    7
    + Tested up to: 3.7
    8
    + Stable tag: 3.4.3
    9
    + Imports and aggregates multiple RSS Feeds using SimplePie. Outputs feeds sorted by date (latest first).
    10
    +
    11
    + == Description ==
    12
    +
    13
    + WP RSS Aggregator lets you create a feed reader/aggregator on your WordPress site.
    14
    +
    15
    + It works in a similar fashion to RSS readers like for example Google Reader. You can add any number of feeds through an administration panel, the plugin will then pull feed items from these sites, merge them and sort them by date.
    16
    +
    17
    + The plugin uses SimplePie for the feed operations. You can call the function from within your theme or even use a shortcode with parameters.
    18
    +
    19
    + Since the plugin uses Custom Post Types to store the imported feeds, you are also free to display them in any way you want, in a similar fashion as you would with other post types such as Posts or Pages.
    20
    +
    21
    + WP RSS Aggregator can also be used to display feed items from a particular feed source anywhere you want on your site.
    22
    +
    23
    + = Premium Add-Ons =
    24
    + Add-Ons that add more functionality to the core plugin are now [available for purchase](http://www.wprssaggregator.com/extensions/).
    25
    +
    26
    + The add-ons let you do things like excerpts and thumbnails, keyword filtering, categorisation and even importing feeds to posts and other custom posts types of your choice.
    27
    +
    28
    + = Demo =
    29
    + The plugin can be seen in use on the [WPMayor.com WordPress News page](http://www.wpmayor.com/wordpress-news/).
    30
    +
    31
    + = Documentation =
    32
    + Instructions for plugin usage are available on the plugin's [documentation page](http://www.wprssaggregator.com/documentation/).
    33
    +
    34
    + = Credit =
    35
    + Created by Jean Galea from [WP Mayor](http://www.wpmayor.com)
    36
    +
    37
    + = Translations =
    38
    + Italian - Davide De Maestri
    39
    +
    40
    + == Installation ==
    41
    +
    42
    + 1. Upload the `wp-rss-aggregator` folder to the `/wp-content/plugins/` directory
    43
    + 2. Activate the WP RSS Aggregator plugin through the 'Plugins' menu in WordPress
    44
    + 3. Configure the plugin by going to the `RSS Aggregator` menu item that appears in your dashboard menu.
    45
    + 3. Use the shortcode in your posts or pages: `[wp-rss-aggregator]`
    46
    +
    47
    + The parameters accepted are:
    48
    +
    49
    + * links_before
    50
    + * links_after
    51
    + * link_before
    52
    + * link_after
    53
    + * limit
    54
    + * source
    55
    +
    56
    + An example of a shortcode with parameters:
    57
    + `[wp_rss_aggregator link_before='<li class="feed-link">' link_after='</li>']`
    58
    + It is advisable to use the 'HTML' view of the editor when inserting the shortcode with paramters.
    59
    +
    60
    + An example of a function call from within the template files:
    61
    + `
    62
    + <?php
    63
    + wprss_display_feed_items( $args = array(
    64
    + 'links_before' => '<ul>',
    65
    + 'links_after' => '</ul>',
    66
    + 'link_before' => '<li>',
    67
    + 'link_after' => '</li>',
    68
    + 'limit' => '8',
    69
    + 'source' => '5,9'
    70
    + ));
    71
    + ?>
    72
    + `
    73
    +
    74
    + OR
    75
    +
    76
    + `<?php do_shortcode('[wp-rss-aggregator]'); ?>`
    77
    +
    78
    + You can also set whether the feed links should open in a new window, current window or even a lightbox, via the settings panel.
    79
    +
    80
    + The settings panel also has an option to set links as nofollow for SEO purposes.
    81
    +
    82
    + Since version 2.0 you can also specify the number of feed items shown on the frontend via the settings panel.
    83
    +
    84
    + == Frequently Asked Questions ==
    85
    + = How can I output the feeds in my theme? =
    86
    +
    87
    + You can either call the function directly within the theme:
    88
    + `<?php wprss_display_feed_items(); ?>`
    89
    +
    90
    + Or use the shortcode in your posts and pages:
    91
    + [wp-rss-aggregator]
    92
    +
    93
    + == Screenshots ==
    94
    +
    95
    + 1. The output of this plugin on the frontend, as seen on www.wpmayor.com.
    96
    +
    97
    + 2. Feed sources list.
    98
    +
    99
    + 3. Adding a new feed source.
    100
    +
    101
    + 4. Imported feeds.
    102
    +
    103
    + 5. Plugin settings page.
    104
    +
    105
    + == Changelog ==
    106
    +
    107
    + = 3.4.3 (2013-10-20) =
    108
    + * Fixed bug: Removed anonymous functions for backwards PHP compatibility
    109
    + * Bug fix: Added suppress_filters in feed-display.php to prevent a user reported error
    110
    + * Bug fix: Missing <li> in certain feed displays
    111
    +
    112
    + = 3.4.2 (2013-9-19) =
    113
    + * Enhanced: Added some hooks for Feed to Post compatibility
    114
    + * Enhanced: Moved date settings to a more appropriate location
    115
    +
    116
    + = 3.4.1 (2013-9-16) =
    117
    + * Fixed Bug: Minor issue with options page - PHP notice
    118
    +
    119
    + = 3.4 (2013-9-15) =
    120
    + * New Feature: Saving/Updating a feed source triggers an update for that source's feed items.
    121
    + * New Feature: Option to change Youtube, Vimeo and Dailymotion feed item URLs to embedded video players URLs
    122
    + * New Feature: Facebook Pages URLs are automatically detected and changed into Atom Feed URLs using FB's Graph
    123
    + * Enhanced: Updated jQuery Colorbox library to 1.4.29
    124
    + * Fixed Bug: Some settings did not have a default value set, and were throwing an 'Undefined Index' error
    125
    + * Fixed Bug: Admin notices do not disappear immediately when dismissed.
    126
    +
    127
    + = Version 3.3.3 (2013-09-08) =
    128
    + * Fixed bug: Better function handling on uninstall, should remove uninstall issues
    129
    +
    130
    + = Version 3.3.2 (2013-09-07) =
    131
    + * New feature: Added exclude parameter to shortcode
    132
    + * Enhanced: Added metabox links to documentation and add-ons
    133
    + * Fixed bug: Custom feed linking to post on user site rather than original source
    134
    + * Fixed bug: Custom post types issues when activitating the plugin
    135
    +
    136
    + = Version 3.3.1 (2013-08-09) =
    137
    + * Fixed Bug: Roles and Capabilities file had not been included
    138
    + * Fixed Bug: Error on install, function not found
    139
    +
    140
    + = Version 3.3 (2013-08-08) =
    141
    + * New feature: OPML importer
    142
    + * New feature: Feed item limits for individual Feed Sources
    143
    + * New feature: Custom feed URL
    144
    + * New feature: Feed limit on custom feed
    145
    + * New feature: New 'Fetch feed items' action for each Feed Source in listing display
    146
    + * New feature: Option to enable link to source
    147
    + * Enhanced: Date strings now change according to locale being used (i.e. compatible with WPML)
    148
    + * Enhanced: Capabilities implemented
    149
    + * Enhanced: Feed Sources row action 'View' removed
    150
    + * Fixed Bug: Proxy feed URLs resulting in the permalink: example.com/url
    151
    +
    152
    + = Version 3.2 (2013-07-06) =
    153
    + * New feature: Parameter to limit number of feeds displayed
    154
    + * New feature: Paramter to limit feeds displayed to particular sources (via ID)
    155
    + * Enhanced: Better feed import handling to handle large number of feed sources
    156
    +
    157
    + = Version 3.1.1 (2013-06-06) =
    158
    + * Fixed bug: Incompatibility with some other plugins due to function missing namespace
    159
    +
    160
    + = Version 3.1 (2013-06-06) =
    161
    + * New feature: Option to set the number of feed items imported from every feed (default 5)
    162
    + * New feature: Import and Export aggregator settings and feed sources
    163
    + * New feature: Debugging page allowing manual feed refresh and feed reset
    164
    + * Enhanced: Faster handling of restoring sources from trash when feed limit is 0
    165
    + * Fixed bug: Limiter on number of overall feeds stored not working
    166
    + * Fixed bug: Incompatibility issue with Foobox plugin fixed
    167
    + * Fixed bug: Duplicate feeds sometimes imported
    168
    +
    169
    + = Version 3.0 (2013-03-16) =
    170
    + * New feature: Option to select cron frequency
    171
    + * New feature: Code extensibility added to be compatible with add-ons
    172
    + * New feature: Option to set a limit to the number of feeds stored (previously 50, hard coded)
    173
    + * New feature: Option to define the format of the date shown below each feed item
    174
    + * New feature: Option to show or hide source of feed item
    175
    + * New feature: Option to show or hide publish date of feed item
    176
    + * New feature: Option to set text preceding publish date
    177
    + * New feature: Option to set text preceding source of feed item
    178
    + * New feature: Option to link title or not
    179
    + * New feature: Limit of 5 items imported for each source instead of 10
    180
    + * Enhanced: Performance improvement when publishing * New feeds in admin
    181
    + * Enhanced: Query tuning for better performance
    182
    + * Enhanced: Major code rewrite, refactoring and inclusion of hooks
    183
    + * Enhanced: Updated Colorbox to v1.4.1
    184
    + * Enhanced: Better security implementations
    185
    + * Enhanced: Better feed preview display
    186
    + * Fixed bug: Deletion of items upon source deletion not working properly
    187
    + * Requires: WordPress 3.3
    188
    +
    189
    + = Version 2.2.3 (2012-11-01) =
    190
    + * Fixed bug: Tab navigation preventing typing in input boxes
    191
    + * Removed: Feeds showing up in internal linking pop up
    192
    +
    193
    + = Version 2.2.2 (2012-10-30) =
    194
    + * Removed: Feeds showing up in site search results
    195
    + * Enhanced: Better tab button navigation when adding a new feed
    196
    + * Enhanced: Better guidance when a feed URL is invalid
    197
    +
    198
    + = Version 2.2.1 (2012-10-17) =
    199
    + * Fixed bug: wprss_feed_source_order assumes everyone is an admin
    200
    +
    201
    + = Version 2.2 (2012-10-01) =
    202
    + * Italian translation added
    203
    + * Feed source order changed to alphabetical
    204
    + * Fixed bug - repeated entries when having a non-valid feed source
    205
    + * Fixed bug - all imported feeds deleted upon trashing a single feed source
    206
    +
    207
    + = Version 2.1 (2012-09-27) =
    208
    + * Now localised for translations
    209
    + * Fixed bug with date string
    210
    + * Fixed $link_before and $link_after, now working
    211
    + * Added backwards compatibility for wp_rss_aggregator() function
    212
    +
    213
    + = Version 2.0 (2012-09-21) =
    214
    + * Bulk of code rewritten and refactored
    215
    + * Added install and upgrade functions
    216
    + * Added DB version setting
    217
    + * Feed sources now stored as Custom Post Types
    218
    + * Feed source list sortable ascending or descending by name
    219
    + * Removed days subsections in feed display
    220
    + * Ability to limit total number of feeds displayed
    221
    + * Feeds now fetched via Cron
    222
    + * Cron job to delete old feed items, keeps max of 50 items in DB
    223
    + * Now requires WordPress 3.2
    224
    + * Updated colorbox to v1.3.20.1
    225
    + * Limit of 15 items max imported for each source
    226
    + * Fixed issue of page content displaying incorrectly after feeds
    227
    +
    228
    +
    229
    + = Version 1.1 (2012-08-13) =
    230
    + * Now requires WordPress 3.0
    231
    + * More flexible fetching of images directory
    232
    + * Has its own top level menu item
    233
    + * Added settings section
    234
    + * Ability to open in lightbox, new window or default browser behaviour
    235
    + * Ability to set links as follow or no follow
    236
    + * Using constants for oftenly used locations
    237
    + * Code refactoring
    238
    + * Changes in file and folder structure
    239
    +
    240
    +
    241
    + = Version 1.0 (2012-01-06) =
    242
    + * Initial release.
    templates/wprss.css ADDED
    @@ -0,0 +1,9 @@
     
     
     
     
     
     
     
     
     
    1
    + /**
    2
    + * WP RSS Aggregator Styles
    3
    + *
    4
    + * @package WP RSS Aggregator
    5
    + * @subpackage CSS
    6
    + * @copyright Copyright (c) 2013, Jean Galea
    7
    + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
    8
    + */
    9
    +
    uninstall.php ADDED
    @@ -0,0 +1,15 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + // If uninstall not called from WordPress exit
    3
    + if( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
    4
    + exit ();
    5
    +
    6
    + // Remove capabilities
    7
    + if ( function_exists( 'wprss_remove_caps' ) )
    8
    + wprss_remove_caps();
    9
    +
    10
    + // Delete option from options table
    11
    + delete_option( 'wprss_options' );
    12
    + delete_option( 'wprss_settings' );
    13
    + delete_option( 'wprss_settings_general' );
    14
    + delete_option( 'wprss_db_version' );
    15
    + delete_option( 'wprss_settings_notices' );
    wp-rss-aggregator.php ADDED
    @@ -0,0 +1,274 @@
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    1
    + <?php
    2
    + /*
    3
    + Plugin Name: WP RSS Aggregator
    4
    + Plugin URI: http://www.wprssaggregator.com
    5
    + Description: Imports and aggregates multiple RSS Feeds using SimplePie
    6
    + Version: 3.4.3
    7
    + Author: Jean Galea
    8
    + Author URI: http://www.wprssaggregator.com
    9
    + License: GPLv3
    10
    + */
    11
    +
    12
    + /*
    13
    + Copyright 2012-2013 Jean Galea (email : info@jeangalea.com)
    14
    + This program is free software; you can redistribute it and/or modify
    15
    + it under the terms of the GNU General Public License as published by
    16
    + the Free Software Foundation; either version 2 of the License, or
    17
    + (at your option) any later version.
    18
    +
    19
    + This program is distributed in the hope that it will be useful,
    20
    + but WITHOUT ANY WARRANTY; without even the implied warranty of
    21
    + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    22
    + GNU General Public License for more details.
    23
    +
    24
    + You should have received a copy of the GNU General Public License
    25
    + along with this program; if not, write to the Free Software
    26
    + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    27
    + */
    28
    +
    29
    + /**
    30
    + * @package WPRSSAggregator
    31
    + * @version 3.4.3
    32
    + * @since 1.0
    33
    + * @author Jean Galea <info@jeangalea.com>
    34
    + * @copyright Copyright (c) 2012-2013, Jean Galea
    35
    + * @link http://www.wpmayor.com/
    36
    + * @license http://www.gnu.org/licenses/gpl.html
    37
    + */
    38
    +
    39
    + /**
    40
    + * Define constants used by the plugin.
    41
    + */
    42
    +
    43
    + // Set the version number of the plugin.
    44
    + if( !defined( 'WPRSS_VERSION' ) )
    45
    + define( 'WPRSS_VERSION', '3.4.3', true );
    46
    +
    47
    + // Set the database version number of the plugin.
    48
    + if( !defined( 'WPRSS_DB_VERSION' ) )
    49
    + define( 'WPRSS_DB_VERSION', 8 );
    50
    +
    51
    + // Set the plugin prefix
    52
    + if( !defined( 'WPRSS_PREFIX' ) )
    53
    + define( 'WPRSS_PREFIX', 'wprss', true );
    54
    +
    55
    + // Set constant path to the plugin directory.
    56
    + if( !defined( 'WPRSS_DIR' ) )
    57
    + define( 'WPRSS_DIR', plugin_dir_path( __FILE__ ) );
    58
    +
    59
    + // Set constant URI to the plugin URL.
    60
    + if( !defined( 'WPRSS_URI' ) )
    61
    + define( 'WPRSS_URI', plugin_dir_url( __FILE__ ) );
    62
    +
    63
    + // Set the constant path to the plugin's javascript directory.
    64
    + if( !defined( 'WPRSS_JS' ) )
    65
    + define( 'WPRSS_JS', WPRSS_URI . trailingslashit( 'js' ), true );
    66
    +
    67
    + // Set the constant path to the plugin's CSS directory.
    68
    + if( !defined( 'WPRSS_CSS' ) )
    69
    + define( 'WPRSS_CSS', WPRSS_URI . trailingslashit( 'css' ), true );
    70
    +
    71
    + // Set the constant path to the plugin's images directory.
    72
    + if( !defined( 'WPRSS_IMG' ) )
    73
    + define( 'WPRSS_IMG', WPRSS_URI . trailingslashit( 'images' ), true );
    74
    +
    75
    + // Set the constant path to the plugin's includes directory.
    76
    + if( !defined( 'WPRSS_INC' ) )
    77
    + define( 'WPRSS_INC', WPRSS_DIR . trailingslashit( 'includes' ), true );
    78
    +
    79
    +
    80
    + /**
    81
    + * Load required files.
    82
    + */
    83
    +
    84
    + /* Load install, upgrade and migration code. */
    85
    + require_once ( WPRSS_INC . 'update.php' );
    86
    +
    87
    + /* Load the shortcodes functions file. */
    88
    + require_once ( WPRSS_INC . 'shortcodes.php' );
    89
    +
    90
    + /* Load the custom post types and taxonomies. */
    91
    + require_once ( WPRSS_INC . 'custom-post-types.php' );
    92
    +
    93
    + /* Load the file for setting capabilities of our post types */
    94
    + require_once ( WPRSS_INC . 'roles-capabilities.php' );
    95
    +
    96
    + /* Load the feed processing functions file */
    97
    + require_once ( WPRSS_INC . 'feed-processing.php' );
    98
    +
    99
    + /* Load the feed display functions file */
    100
    + require_once ( WPRSS_INC . 'feed-display.php' );
    101
    +
    102
    + /* Load the custom feed file */
    103
    + require_once ( WPRSS_INC . 'custom-feed.php' );
    104
    +
    105
    + /* Load the cron job scheduling functions. */
    106
    + require_once ( WPRSS_INC . 'cron-jobs.php' );
    107
    +
    108
    + /* Load the admin functions file. */
    109
    + require_once ( WPRSS_INC . 'admin.php' );
    110
    +
    111
    + /* Load the admin options functions file. */
    112
    + require_once ( WPRSS_INC . 'admin-options.php' );
    113
    +
    114
    + /* Load the settings import/export file */
    115
    + require_once ( WPRSS_INC . 'admin-import-export.php' );
    116
    +
    117
    + /* Load the debugging file */
    118
    + require_once ( WPRSS_INC . 'system-info.php' );
    119
    +
    120
    + /* Load the miscellaneous functions file */
    121
    + require_once ( WPRSS_INC . 'misc-functions.php' );
    122
    +
    123
    + /* Load the OPML Class file */
    124
    + require_once ( WPRSS_INC . 'opml.php' );
    125
    +
    126
    + /* Load the OPML Importer file */
    127
    + require_once ( WPRSS_INC . 'opml-importer.php' );
    128
    +
    129
    + /* Load the system info file */
    130
    + require_once ( WPRSS_INC . 'admin-debugging.php' );
    131
    +
    132
    + /* Load the admin display-related functions */
    133
    + require_once ( WPRSS_INC . 'admin-display.php' );
    134
    +
    135
    + /* Load the admin metaboxes functions */
    136
    + require_once ( WPRSS_INC . 'admin-metaboxes.php' );
    137
    +
    138
    + /* Load the scripts loading functions file */
    139
    + require_once ( WPRSS_INC . 'scripts.php' );
    140
    +
    141
    + /* Load the Ajax notification file */
    142
    + require_once ( WPRSS_INC . 'admin-ajax-notice.php' );
    143
    +
    144
    + /* Load the dashboard welcome screen file */
    145
    + require_once ( WPRSS_INC . 'admin-dashboard.php' );
    146
    +
    147
    + /* Load the logging class */
    148
    + require_once ( WPRSS_INC . 'roles-capabilities.php' );
    149
    +
    150
    + /* Load the logging class */
    151
    + require_once ( WPRSS_INC . 'libraries/WP_Logging.php' );
    152
    + require_once ( WPRSS_INC . 'admin-editor.php' );
    153
    +
    154
    +
    155
    + register_activation_hook( __FILE__ , 'wprss_activate' );
    156
    + register_deactivation_hook( __FILE__ , 'wprss_deactivate' );
    157
    +
    158
    +
    159
    + add_action( 'init', 'wprss_init' );
    160
    + /**
    161
    + * Initialise the plugin
    162
    + *
    163
    + * @since 1.0
    164
    + * @return void
    165
    + */
    166
    + function wprss_init() {
    167
    + do_action( 'wprss_init' );
    168
    + }
    169
    +
    170
    +
    171
    + /**
    172
    + * Plugin activation procedure
    173
    + *
    174
    + * @since 1.0
    175
    + * @return void
    176
    + */
    177
    + function wprss_activate() {
    178
    + /* Prevents activation of plugin if compatible version of WordPress not found */
    179
    + if ( version_compare( get_bloginfo( 'version' ), '3.3', '<' ) ) {
    180
    + deactivate_plugins ( basename( __FILE__ )); // Deactivate plugin
    181
    + wp_die( __( 'This plugin requires WordPress version 3.3 or higher.' ), 'WP RSS Aggregator', array( 'back_link' => true ) );
    182
    + }
    183
    + wprss_settings_initialize();
    184
    + flush_rewrite_rules();
    185
    + wprss_schedule_fetch_all_feeds_cron();
    186
    + // Sets a transient to trigger a redirect upon completion of activation procedure
    187
    + set_transient( '_wprss_activation_redirect', true, 30 );
    188
    + }
    189
    +
    190
    +
    191
    + /**
    192
    + * Plugin deactivation procedure
    193
    + *
    194
    + * @since 1.0
    195
    + */
    196
    + function wprss_deactivate() {
    197
    + // on deactivation remove the cron job
    198
    + if ( wp_next_scheduled( 'wprss_fetch_all_feeds_hook' ) ) {
    199
    + wp_clear_scheduled_hook( 'wprss_fetch_all_feeds_hook' );
    200
    + }
    201
    + flush_rewrite_rules();
    202
    + }
    203
    +
    204
    +
    205
    + add_action( 'plugins_loaded', 'wprss_load_textdomain' );
    206
    + /**
    207
    + * Loads the plugin's translated strings.
    208
    + *
    209
    + * @since 2.1
    210
    + * @return void
    211
    + */
    212
    + function wprss_load_textdomain() {
    213
    + load_plugin_textdomain( 'wprss', false, plugin_dir_path( __FILE__ ) . '/languages/' );
    214
    + }
    215
    +
    216
    +
    217
    + // PressTrends WordPress Action
    218
    + add_action( 'admin_init', 'wprss_presstrends_plugin' );
    219
    + /**
    220
    + * Track plugin usage using PressTrends
    221
    + *
    222
    + * @since 3.5
    223
    + * @return void
    224
    + */
    225
    + function wprss_presstrends_plugin() {
    226
    + // PressTrends Account API Key
    227
    + $api_key = 'znggu7vk7x2ddsiigkerzsca9q22xu1j53hp';
    228
    + $auth = '';
    229
    + // Start of Metrics
    230
    + global $wpdb;
    231
    + $data = get_transient( 'presstrends_cache_data' );
    232
    + if ( !$data || $data == '' ) {
    233
    + $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update?auth=';
    234
    + $url = $api_base . $auth . '&api=' . $api_key . '';
    235
    + $count_posts = wp_count_posts();
    236
    + $count_pages = wp_count_posts( 'page' );
    237
    + $comments_count = wp_count_comments();
    238
    + if ( function_exists( 'wp_get_theme' ) ) {
    239
    + $theme_data = wp_get_theme();
    240
    + $theme_name = urlencode( $theme_data->Name );
    241
    + } else {
    242
    + $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' );
    243
    + $theme_name = $theme_data['Name'];
    244
    + }
    245
    + $plugin_name = '&';
    246
    + foreach ( get_plugins() as $plugin_info ) {
    247
    + $plugin_name .= $plugin_info['Name'] . '&';
    248
    + }
    249
    + // CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE
    250
    + $plugin_data = get_plugin_data( __FILE__ );
    251
    + $posts_with_comments = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0" );
    252
    + $data = array(
    253
    + 'url' => base64_encode(site_url()),
    254
    + 'posts' => $count_posts->publish,
    255
    + 'pages' => $count_pages->publish,
    256
    + 'comments' => $comments_count->total_comments,
    257
    + 'approved' => $comments_count->approved,
    258
    + 'spam' => $comments_count->spam,
    259
    + 'pingbacks' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ),
    260
    + 'post_conversion' => ( $count_posts->publish > 0 && $posts_with_comments > 0 ) ? number_format( ( $posts_with_comments / $count_posts->publish ) * 100, 0, '.', '' ) : 0,
    261
    + 'theme_version' => $plugin_data['Version'],
    262
    + 'theme_name' => $theme_name,
    263
    + 'site_name' => str_replace( ' ', '', get_bloginfo( 'name' ) ),
    264
    + 'plugins' => count( get_option( 'active_plugins' ) ),
    265
    + 'plugin' => urlencode( $plugin_name ),
    266
    + 'wpversion' => get_bloginfo( 'version' ),
    267
    + );
    268
    + foreach ( $data as $k => $v ) {
    269
    + $url .= '&' . $k . '=' . $v . '';
    270
    + }
    271
    + wp_remote_get( $url );
    272
    + set_transient( 'presstrends_cache_data', $data, 60 * 60 * 24 );
    273
    + }
    274
    + }