├── .gitignore ├── _build ├── build.config.sample.php ├── build.schema.php ├── build.transport.php ├── config.json ├── data │ ├── events │ │ └── events.articles.php │ ├── transport.chunks.php │ ├── transport.plugins.php │ ├── transport.settings.php │ ├── transport.snippets.php │ ├── transport.subpackages.php │ ├── transport.templates.php │ └── transport.tvs.php ├── includes │ └── functions.php ├── resolvers │ ├── dbfields.resolver.php │ ├── extpack.resolver.php │ ├── packages │ │ ├── resolve.archivist.php │ │ ├── resolve.getpage.php │ │ ├── resolve.getresources.php │ │ ├── resolve.quip.php │ │ └── resolve.taglister.php │ └── tvs.resolver.php ├── subpackages │ ├── archivist-1.2.4-pl.transport.zip │ ├── getpage-1.2.3-pl.transport.zip │ ├── getresources-1.6.0-pl.transport.zip │ ├── quip-2.3.3-pl.transport.zip │ └── taglister-1.1.7-pl.transport.zip └── validators │ ├── validate.archivist.php │ ├── validate.getpage.php │ ├── validate.getresources.php │ ├── validate.quip.php │ └── validate.taglister.php ├── assets └── components │ └── articles │ ├── connector.php │ ├── css │ └── mgr.css │ ├── images │ ├── comments-icon-w.png │ ├── comments-icon.png │ └── cup.png │ ├── js │ ├── article │ │ ├── create.js │ │ └── update.js │ ├── articles.js │ ├── container │ │ ├── articles.import.window.js │ │ ├── container.articles.grid.js │ │ ├── container.common.js │ │ ├── create.js │ │ └── update.js │ └── extras │ │ ├── combo.js │ │ └── tagfield.js │ ├── themes │ └── default │ │ ├── images │ │ ├── bg.gif │ │ ├── border.gif │ │ ├── content-bg.gif │ │ ├── dots.gif │ │ ├── facebook.gif │ │ ├── feed.png │ │ ├── firefox-gray.jpg │ │ ├── gravatar.jpg │ │ ├── header-image.gif │ │ ├── header-search.gif │ │ ├── image.gif │ │ ├── left-tab.gif │ │ ├── quote.gif │ │ ├── right-tab.gif │ │ ├── rss-icon.jpg │ │ ├── search.gif │ │ ├── sh │ │ │ ├── help.png │ │ │ ├── magnifier.png │ │ │ ├── page_white_code.png │ │ │ ├── page_white_copy.png │ │ │ └── printer.png │ │ ├── thumb.jpg │ │ └── twitter.png │ │ └── style.css │ └── twitter.auth.php ├── core └── components │ └── articles │ ├── controllers │ ├── article │ │ ├── create.class.php │ │ └── update.class.php │ └── container │ │ ├── create.class.php │ │ └── update.class.php │ ├── docs │ ├── changelog.txt │ ├── license.txt │ └── readme.txt │ ├── elements │ ├── chunks │ │ ├── archivegroupbyyear.chunk.tpl │ │ ├── articlerow.chunk.tpl │ │ ├── articleslatestpost.chunk.tpl │ │ ├── articlesrss.chunk.tpl │ │ ├── articlesrsscategorynode.chunk.tpl │ │ └── articlesrssitem.chunk.tpl │ ├── plugins │ │ └── articles.plugin.php │ ├── snippets │ │ ├── snippet.articles.php │ │ └── snippet.articlesstringsplitter.php │ └── templates │ │ ├── articlescontainertemplate.tpl │ │ └── articletemplate.tpl │ ├── lexicon │ ├── cs │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── de │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── en │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── fr │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── it │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── nl │ │ ├── default.inc.php │ │ └── frontend.inc.php │ └── ru │ │ ├── default.inc.php │ │ └── frontend.inc.php │ ├── model │ ├── articles │ │ ├── article.class.php │ │ ├── articlescontainer.class.php │ │ ├── articlesrouter.class.php │ │ ├── articlesservice.class.php │ │ ├── import │ │ │ ├── articlesimport.class.php │ │ │ ├── articlesimportblogger.class.php │ │ │ ├── articlesimportmodx.class.php │ │ │ └── articlesimportwordpress.class.php │ │ ├── metadata.mysql.php │ │ ├── mysql │ │ │ ├── article.class.php │ │ │ ├── article.map.inc.php │ │ │ ├── articlescontainer.class.php │ │ │ └── articlescontainer.map.inc.php │ │ ├── notification │ │ │ ├── articlesnotification.class.php │ │ │ ├── articlesnotificationtwitter.class.php │ │ │ ├── lib.oauth.php │ │ │ └── lib.twitteroauth.php │ │ └── update │ │ │ ├── articlespingomatic.class.php │ │ │ └── articlesupdateservice.class.php │ └── schema │ │ └── articles.mysql.schema.xml │ └── processors │ ├── article │ ├── deletemultiple.class.php │ ├── getlist.class.php │ ├── ping.class.php │ ├── publishmultiple.class.php │ ├── undeletemultiple.class.php │ └── unpublishmultiple.class.php │ ├── container │ └── import.class.php │ └── extras │ └── gettags.class.php └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | _build/build.config.php 2 | config.core.php 3 | .idea 4 | nbproject 5 | .DS_Store -------------------------------------------------------------------------------- /_build/build.config.sample.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | define('MODX_BASE_PATH', '/path/to/modx/'); 23 | define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); 24 | define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); 25 | define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); 26 | define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); 27 | 28 | define('MODX_BASE_URL','/modx/'); 29 | define('MODX_CORE_URL', MODX_BASE_URL . 'core/'); 30 | define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/'); 31 | define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/'); 32 | define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/'); -------------------------------------------------------------------------------- /_build/build.schema.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * Build Schema script 24 | * 25 | * @package articles 26 | * @subpackage build 27 | */ 28 | $mtime = microtime(); 29 | $mtime = explode(" ", $mtime); 30 | $mtime = $mtime[1] + $mtime[0]; 31 | $tstart = $mtime; 32 | set_time_limit(0); 33 | 34 | /* define package name */ 35 | define('PKG_NAME','Articles'); 36 | define('PKG_NAME_LOWER',strtolower(PKG_NAME)); 37 | 38 | /* define sources */ 39 | $root = dirname(dirname(__FILE__)).'/'; 40 | $sources = array( 41 | 'root' => $root, 42 | 'core' => $root.'core/components/'.PKG_NAME_LOWER.'/', 43 | 'model' => $root.'core/components/'.PKG_NAME_LOWER.'/model/', 44 | 'assets' => $root.'assets/components/'.PKG_NAME_LOWER.'/', 45 | ); 46 | 47 | /* load modx and configs */ 48 | require_once dirname(__FILE__) . '/build.config.php'; 49 | include_once MODX_CORE_PATH . 'model/modx/modx.class.php'; 50 | $modx= new modX(); 51 | $modx->initialize('mgr'); 52 | $modx->loadClass('transport.modPackageBuilder','',false, true); 53 | echo '
'; /* used for nice formatting of log messages */
54 | $modx->setLogLevel(modX::LOG_LEVEL_INFO);
55 | $modx->setLogTarget('ECHO');
56 | 
57 | $manager= $modx->getManager();
58 | $generator= $manager->getGenerator();
59 | 
60 | $generator->classTemplate= <<
67 | EOD;
68 | $generator->platformTemplate= <<
76 | EOD;
77 | $generator->mapHeader= <<parseSchema($sources['model'] . 'schema/'.PKG_NAME_LOWER.'.mysql.schema.xml', $sources['model']);
84 | 
85 | 
86 | $mtime= microtime();
87 | $mtime= explode(" ", $mtime);
88 | $mtime= $mtime[1] + $mtime[0];
89 | $tend= $mtime;
90 | $totalTime= ($tend - $tstart);
91 | $totalTime= sprintf("%2.4f s", $totalTime);
92 | 
93 | echo "\nExecution time: {$totalTime}\n";
94 | 
95 | exit ();


--------------------------------------------------------------------------------
/_build/config.json:
--------------------------------------------------------------------------------
  1 | {
  2 |     "name": "Articles"
  3 |     ,"lowCaseName": "articles"
  4 |     ,"description": ""
  5 |     ,"author": "Shaun McCormick"
  6 |     ,"version": "1.7.2"
  7 |     ,"package":{
  8 |         "elements": {
  9 |             "plugins": [{
 10 |                 "name": "ArticlesPlugin"
 11 |                 ,"file": "articles.plugin.php"
 12 |                 ,"events": ["OnPageNotFound", "OnManagerPageInit", "OnDocPublished", "OnDocUnPublished"]
 13 |             }]
 14 |             ,"chunks": [{
 15 |                 "name": "sample.ArticlesLatestPostTpl"
 16 |                 ,"file": "articleslatestpost.chunk.tpl"
 17 |             },{
 18 |                 "name": "sample.ArticleRowTpl"
 19 |                 ,"file": "articlerow.chunk.tpl"
 20 |             },{
 21 |                 "name": "sample.ArticlesRss"
 22 |                 ,"file": "articlesrss.chunk.tpl"
 23 |             },{
 24 |                 "name": "sample.ArticlesRssItem"
 25 |                 ,"file": "articlesrssitem.chunk.tpl"
 26 |             },{
 27 |                 "name": "sample.ArchiveGroupByYear"
 28 |                 ,"file": "archivegroupbyyear.chunk.tpl"
 29 |             },{
 30 |                 "name": "sample.ArticlesRssCategoryNode"
 31 |                 ,"file": "articlesrsscategorynode.chunk.tpl"
 32 |             }]
 33 |             ,"snippets": [{
 34 |                 "name": "ArticlesStringSplitter"
 35 |                 ,"file": "snippet.articlesstringsplitter.php"
 36 |             },{
 37 |                 "name": "Articles"
 38 |                 ,"file": "snippet.articles.php"
 39 |             }]
 40 |             ,"templates": [{
 41 |                 "name": "sample.ArticlesContainerTemplate"
 42 |                 ,"file": "articlescontainertemplate.tpl"
 43 |             },{
 44 |                 "name": "sample.ArticleTemplate"
 45 |                 ,"file": "articletemplate.tpl"
 46 |             }]
 47 |             ,"tvs": [{
 48 |                 "caption": "articlestags"
 49 |                 ,"name": "articlestags"
 50 |                 ,"type": "hidden"
 51 |                 ,"description": ""
 52 |                 ,"templates": ["sample.ArticlesContainerTemplate", "sample.ArticleTemplate"]
 53 |             }]
 54 |         }
 55 |         ,"systemSettings": [{
 56 |             "key": "container_ids"
 57 |             ,"type": "textfield"
 58 |             ,"area": "furls"
 59 |             ,"value": ""
 60 |         },{
 61 |             "key": "default_container_template"
 62 |             ,"type": "modx-combo-template"
 63 |             ,"area": "site"
 64 |             ,"value": "0"
 65 |         },{
 66 |             "key": "default_article_template"
 67 |             ,"type": "modx-combo-template"
 68 |             ,"area": "site"
 69 |             ,"value": "0"
 70 |         },{
 71 |             "key": "default_article_sort_field"
 72 |             ,"type": "textfield"
 73 |             ,"area": "site"
 74 |             ,"value": "createdon"
 75 |         },{
 76 |             "key": "article_show_longtitle"
 77 |             ,"type": "combo-boolean"
 78 |             ,"area": "site"
 79 |             ,"value": "false"
 80 |         },{
 81 |             "key": "mgr_date_format"
 82 |             ,"type": "textfield"
 83 |             ,"area": "site"
 84 |             ,"value": "%b %d"
 85 |         },{
 86 |             "key": "mgr_time_format"
 87 |             ,"type": "textfield"
 88 |             ,"area": "site"
 89 |             ,"value": "%H:%I %p"
 90 |         },{
 91 |             "key": "container_ids"
 92 |             ,"type": "textfield"
 93 |             ,"area": "furls"
 94 |             ,"value": ""
 95 |         },{
 96 |             "key": "container_ids"
 97 |             ,"type": "textfield"
 98 |             ,"area": "furls"
 99 |             ,"value": ""
100 |         }]
101 |     }
102 |     ,"extensionPackage": {}
103 | }
104 | 


--------------------------------------------------------------------------------
/_build/data/events/events.articles.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Adds events to Articles plugin
24 |  *
25 |  * @var modX $modx
26 |  * @package articles
27 |  * @subpackage build
28 |  */
29 | $events = array();
30 | 
31 | $events['OnPageNotFound']= $modx->newObject('modPluginEvent');
32 | $events['OnPageNotFound']->fromArray(array(
33 |     'event' => 'OnPageNotFound',
34 |     'priority' => 0,
35 |     'propertyset' => 0,
36 | ),'',true,true);
37 | 
38 | $events['OnManagerPageInit']= $modx->newObject('modPluginEvent');
39 | $events['OnManagerPageInit']->fromArray(array(
40 |     'event' => 'OnManagerPageInit',
41 |     'priority' => 0,
42 |     'propertyset' => 0,
43 | ),'',true,true);
44 | 
45 | $events['OnDocPublished']= $modx->newObject('modPluginEvent');
46 | $events['OnDocPublished']->fromArray(array(
47 |     'event' => 'OnDocPublished',
48 |     'priority' => 0,
49 |     'propertyset' => 0,
50 | ),'',true,true);
51 | 
52 | $events['OnDocUnPublished']= $modx->newObject('modPluginEvent');
53 | $events['OnDocUnPublished']->fromArray(array(
54 |     'event' => 'OnDocUnPublished',
55 |     'priority' => 0,
56 |     'propertyset' => 0,
57 | ),'',true,true);
58 | 
59 | return $events;


--------------------------------------------------------------------------------
/_build/data/transport.chunks.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @var modX $modx
24 |  * @var array $sources
25 |  * @package articles
26 |  * @subpackage build
27 |  */
28 | $chunks = array();
29 | 
30 | $chunks[1]= $modx->newObject('modChunk');
31 | $chunks[1]->fromArray(array(
32 |     'id' => 1,
33 |     'name' => 'sample.ArticlesLatestPostTpl',
34 |     'description' => 'The tpl row for the latest post. Duplicate this to override it.',
35 |     'snippet' => file_get_contents($sources['chunks'].'articleslatestpost.chunk.tpl'),
36 | ));
37 | 
38 | $chunks[2]= $modx->newObject('modChunk');
39 | $chunks[2]->fromArray(array(
40 |     'id' => 2,
41 |     'name' => 'sample.ArticleRowTpl',
42 |     'description' => 'The tpl row for each post when listed on the main Articles Container page. Duplicate this to override it.',
43 |     'snippet' => file_get_contents($sources['chunks'].'articlerow.chunk.tpl'),
44 | ));
45 | 
46 | $chunks[3]= $modx->newObject('modChunk');
47 | $chunks[3]->fromArray(array(
48 |     'id' => 3,
49 |     'name' => 'sample.ArticlesRss',
50 |     'description' => 'The tpl for the RSS feed. Duplicate this to override it.',
51 |     'snippet' => file_get_contents($sources['chunks'].'articlesrss.chunk.tpl'),
52 | ));
53 | 
54 | $chunks[4]= $modx->newObject('modChunk');
55 | $chunks[4]->fromArray(array(
56 |     'id' => 4,
57 |     'name' => 'sample.ArticlesRssItem',
58 |     'description' => 'The tpl row for each RSS feed item. Duplicate this to override it.',
59 |     'snippet' => file_get_contents($sources['chunks'].'articlesrssitem.chunk.tpl'),
60 | ));
61 | 
62 | $chunks[5]= $modx->newObject('modChunk');
63 | $chunks[5]->fromArray(array(
64 |     'id' => 5,
65 |     'name' => 'sample.ArchiveGroupByYear',
66 |     'description' => 'The tpl wrapper for archives when grouped by year.',
67 |     'snippet' => file_get_contents($sources['chunks'].'archivegroupbyyear.chunk.tpl'),
68 | ));
69 | 
70 | $chunks[6]= $modx->newObject('modChunk');
71 | $chunks[6]->fromArray(array(
72 |     'id' => 6,
73 |     'name' => 'sample.ArticlesRssCategoryNode',
74 |     'description' => 'The tpl for each RSS category node for tagging.',
75 |     'snippet' => file_get_contents($sources['chunks'].'articlesrsscategorynode.chunk.tpl'),
76 | ));
77 | return $chunks;


--------------------------------------------------------------------------------
/_build/data/transport.plugins.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Package in plugins
24 |  *
25 |  * @var modX $modx
26 |  * @var array $sources
27 |  * 
28 |  * @package articles
29 |  * @subpackage build
30 |  */
31 | $plugins = array();
32 | 
33 | /* create the plugin object */
34 | $plugins[0] = $modx->newObject('modPlugin');
35 | $plugins[0]->set('id',1);
36 | $plugins[0]->set('name','ArticlesPlugin');
37 | $plugins[0]->set('description','Handles FURLs for Articles.');
38 | $plugins[0]->set('plugincode', getSnippetContent($sources['plugins'] . 'articles.plugin.php'));
39 | $plugins[0]->set('category', 0);
40 | 
41 | $events = include $sources['events'].'events.articles.php';
42 | if (is_array($events) && !empty($events)) {
43 |     $plugins[0]->addMany($events);
44 |     $modx->log(xPDO::LOG_LEVEL_INFO,'Packaged in '.count($events).' Plugin Events for ArticlesPlugin.'); flush();
45 | } else {
46 |     $modx->log(xPDO::LOG_LEVEL_ERROR,'Could not find plugin events for ArticlesPlugin!');
47 | }
48 | unset($events);
49 | 
50 | return $plugins;


--------------------------------------------------------------------------------
/_build/data/transport.settings.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @var modX $modx
24 |  * @package articles
25 |  * @subpackage build
26 |  */
27 | $settings = array();
28 | $settings['articles.container_ids']= $modx->newObject('modSystemSetting');
29 | $settings['articles.container_ids']->fromArray(array(
30 |     'key' => 'articles.container_ids',
31 |     'value' => '',
32 |     'xtype' => 'textfield',
33 |     'namespace' => 'articles',
34 |     'area' => 'furls',
35 | ),'',true,true);
36 | $settings['articles.default_container_template']= $modx->newObject('modSystemSetting');
37 | $settings['articles.default_container_template']->fromArray(array(
38 |     'key' => 'articles.default_container_template',
39 |     'value' => 0,
40 |     'xtype' => 'modx-combo-template',
41 |     'namespace' => 'articles',
42 |     'area' => 'site',
43 | ),'',true,true);
44 | $settings['articles.default_article_template']= $modx->newObject('modSystemSetting');
45 | $settings['articles.default_article_template']->fromArray(array(
46 |     'key' => 'articles.default_article_template',
47 |     'value' => 0,
48 |     'xtype' => 'modx-combo-template',
49 |     'namespace' => 'articles',
50 |     'area' => 'site',
51 | ),'',true,true);
52 | $settings['articles.default_article_sort_field']= $modx->newObject('modSystemSetting');
53 | $settings['articles.default_article_sort_field']->fromArray(array(
54 |     'key' => 'articles.default_article_sort_field',
55 |     'value' => 'createdon',
56 |     'xtype' => 'textfield',
57 |     'namespace' => 'articles',
58 |     'area' => 'site',
59 | ),'',true,true);
60 | $settings['articles.article_show_longtitle']= $modx->newObject('modSystemSetting');
61 | $settings['articles.article_show_longtitle']->fromArray(array(
62 |     'key' => 'articles.article_show_longtitle',
63 |     'value' => false,
64 |     'xtype' => 'combo-boolean',
65 |     'namespace' => 'articles',
66 |     'area' => 'site',
67 | ),'',true,true);
68 | $settings['articles.mgr_date_format']= $modx->newObject('modSystemSetting');
69 | $settings['articles.mgr_date_format']->fromArray(array(
70 |     'key' => 'articles.mgr_date_format',
71 |     'value' => '%b %d',
72 |     'xtype' => 'textfield',
73 |     'namespace' => 'articles',
74 |     'area' => 'site',
75 | ),'',true,true);
76 | $settings['articles.mgr_time_format']= $modx->newObject('modSystemSetting');
77 | $settings['articles.mgr_time_format']->fromArray(array(
78 |     'key' => 'articles.mgr_time_format',
79 |     'value' => '%H:%I %p',
80 |     'xtype' => 'textfield',
81 |     'namespace' => 'articles',
82 |     'area' => 'site',
83 | ),'',true,true);
84 | 
85 | return $settings;


--------------------------------------------------------------------------------
/_build/data/transport.snippets.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @var modX $modx
24 |  * @var array $sources
25 |  * @package articles
26 |  * @subpackage build
27 |  */
28 | $snippets = array();
29 | 
30 | $snippets[1]= $modx->newObject('modSnippet');
31 | $snippets[1]->fromArray(array(
32 |     'id' => 1,
33 |     'name' => 'ArticlesStringSplitter',
34 |     'description' => 'Utility snippet for Articles; splits strings by a delimiter and chunkifys the result.',
35 |     'snippet' => file_get_contents($sources['snippets'].'snippet.articlesstringsplitter.php'),
36 | ));
37 | 
38 | $snippets[2]= $modx->newObject('modSnippet');
39 | $snippets[2]->fromArray(array(
40 |     'id' => 2,
41 |     'name' => 'Articles',
42 |     'description' => 'Displays Articles for a Container anywhere on your MODX site.',
43 |     'snippet' => file_get_contents($sources['snippets'].'snippet.articles.php'),
44 | ));
45 | return $snippets;


--------------------------------------------------------------------------------
/_build/data/transport.subpackages.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Package in subpackages
24 |  *
25 |  * @var modX $modx
26 |  * @var modPackageBuilder $builder
27 |  * @var array $sources
28 |  * @package articles
29 |  */
30 | $subpackages = array(
31 |     'archivist'      => 'archivist-1.2.4-pl',
32 |     'getpage'        => 'getpage-1.2.3-pl',
33 |     'getresources'   => 'getresources-1.6.0-pl',
34 |     'quip'           => 'quip-2.3.3-pl',
35 |     'taglister'      => 'taglister-1.1.7-pl',
36 | );
37 | $spAttr = array('vehicle_class' => 'xPDOTransportVehicle');
38 | 
39 | foreach ($subpackages as $name => $signature) {
40 |     $vehicle = $builder->createVehicle(array(
41 |         'source' => $sources['subpackages'] . $signature.'.transport.zip',
42 |         'target' => "return MODX_CORE_PATH . 'packages/';",
43 |     ),$spAttr);
44 |     $vehicle->validate('php',array(
45 |         'source' => $sources['validators'].'validate.'.$name.'.php'
46 |     ));
47 |     $vehicle->resolve('php',array(
48 |         'source' => $sources['resolvers'].'packages/resolve.'.$name.'.php'
49 |     ));
50 |     $builder->putVehicle($vehicle);
51 | }
52 | return true;


--------------------------------------------------------------------------------
/_build/data/transport.templates.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @var modX $modx
24 |  * @var array $sources
25 |  * @package articles
26 |  * @subpackage build
27 |  */
28 | $templates = array();
29 | 
30 | $templates[1]= $modx->newObject('modTemplate');
31 | $templates[1]->fromArray(array(
32 |     'id' => 1,
33 |     'templatename' => 'sample.ArticlesContainerTemplate',
34 |     'description' => 'The default Template for the Articles Container. Duplicate this to override it.',
35 |     'content' => file_get_contents($sources['templates'].'articlescontainertemplate.tpl'),
36 | ));
37 | 
38 | $templates[2]= $modx->newObject('modTemplate');
39 | $templates[2]->fromArray(array(
40 |     'id' => 2,
41 |     'templatename' => 'sample.ArticleTemplate',
42 |     'description' => 'The default Template for an Article. Duplicate this to override it.',
43 |     'content' => file_get_contents($sources['templates'].'articletemplate.tpl'),
44 | ));
45 | 
46 | return $templates;


--------------------------------------------------------------------------------
/_build/data/transport.tvs.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @var modX $modx
24 |  * @var array $sources
25 |  * @package articles
26 |  * @subpackage build
27 |  */
28 | $tvs = array();
29 | 
30 | $tvs[1]= $modx->newObject('modTemplateVar');
31 | $tvs[1]->fromArray(array(
32 |     'id' => 1,
33 |     'name' => 'articlestags',
34 |     'description' => 'The default tags TV for Articles. Do not delete!',
35 |     'caption' => 'articlestags',
36 |     'type' => 'hidden',
37 | ));
38 | 
39 | return $tvs;


--------------------------------------------------------------------------------
/_build/includes/functions.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * @package articles
24 |  * @subpackage build
25 |  */
26 | 
27 | /**
28 |  * @param string $filename
29 |  * @return mixed|string
30 |  */
31 | function getSnippetContent($filename) {
32 |     $o = file_get_contents($filename);
33 |     $o = str_replace('','',$o);
35 |     $o = trim($o);
36 |     return $o;
37 | }


--------------------------------------------------------------------------------
/_build/resolvers/dbfields.resolver.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Handles adding custom fields to modResource table
24 |  *
25 |  * @var xPDOObject $object
26 |  * @var array $options
27 |  * @package articles
28 |  * @subpackage build
29 |  */
30 | if ($object->xpdo) {
31 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
32 |         case xPDOTransport::ACTION_INSTALL:
33 |         case xPDOTransport::ACTION_UPGRADE:
34 |             /** @var modX $modx */
35 |             $modx =& $object->xpdo;
36 |             $modelPath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/').'model/';
37 |             $modx->addPackage('articles',$modelPath);
38 | 
39 |             /** @var xPDOManager $manager */
40 |             $manager = $modx->getManager();
41 | 
42 |             /** @var modSystemSetting $setting */
43 |             $setting = $modx->getObject('modSystemSetting',array('key' => 'articles.properties_migration'));
44 |             if (!$setting || $setting->get('value') == false) {
45 |                 $c = $modx->newQuery('ArticlesContainer');
46 |                 $c->select(array(
47 |                     'id',
48 |                     'articles_container_settings',
49 |                 ));
50 |                 $c->where(array(
51 |                     'class_key' => 'ArticlesContainer',
52 |                 ));
53 |                 $c->construct();
54 |                 $sql = $c->toSql();
55 |                 $stmt = $modx->query($sql);
56 |                 if ($stmt) {
57 |                     while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
58 |                         $settings = $row['articles_container_settings'];
59 |                         $settings = is_array($settings) ? $settings : $modx->fromJSON($settings);
60 |                         $settings = !empty($settings) ? $settings : array();
61 |                         /** @var modResource $resource */
62 |                         $resource = $modx->getObject('modResource',$row['id']);
63 |                         if ($resource) {
64 |                             $resource->setProperties($settings,'articles');
65 |                             $resource->save();
66 |                         }
67 |                     }
68 |                     $stmt->closeCursor();
69 |                 }
70 |                 $manager->removeField('Article','articles_container');
71 |                 $manager->removeField('Article','articles_container_settings');
72 |                 if (!$setting) {
73 |                     $setting = $modx->newObject('modSystemSetting');
74 |                     $setting->set('key','articles.properties_migration');
75 |                     $setting->set('xtype','combo-boolean');
76 |                     $setting->set('namespace','articles');
77 |                     $setting->set('area','system');
78 |                 }
79 |                 $setting->set('value',true);
80 |                 $setting->save();
81 |             }
82 |             break;
83 |     }
84 | }
85 | return true;


--------------------------------------------------------------------------------
/_build/resolvers/extpack.resolver.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Handles adding Articles to Extension Packages
24 |  *
25 |  * @var xPDOObject $object
26 |  * @var array $options
27 |  * @package articles
28 |  * @subpackage build
29 |  */
30 | if ($object->xpdo) {
31 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
32 |         case xPDOTransport::ACTION_INSTALL:
33 |         case xPDOTransport::ACTION_UPGRADE:
34 |             /** @var modX $modx */
35 |             $modx =& $object->xpdo;
36 |             $modelPath = $modx->getOption('articles.core_path');
37 |             if (empty($modelPath)) {
38 |                 $modelPath = '[[++core_path]]components/articles/model/';
39 |             }
40 |             if ($modx instanceof modX) {
41 |                 $modx->addExtensionPackage('articles',$modelPath);
42 |             }
43 |             break;
44 |         case xPDOTransport::ACTION_UNINSTALL:
45 |             $modx =& $object->xpdo;
46 |             $modelPath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/').'model/';
47 |             if ($modx instanceof modX) {
48 |                 $modx->removeExtensionPackage('articles');
49 |             }
50 |             break;
51 |     }
52 | }
53 | return true;


--------------------------------------------------------------------------------
/_build/resolvers/packages/resolve.archivist.php:
--------------------------------------------------------------------------------
 1 | xpdo) {
12 |     $signature = 'archivist-1.2.4-pl';
13 |     $modx =& $transport->xpdo;
14 |     $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
15 |     
16 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
17 |         case xPDOTransport::ACTION_INSTALL:
18 |         case xPDOTransport::ACTION_UPGRADE:
19 |             /* define version */
20 |             $sig = explode('-',$signature);
21 |             $versionSignature = explode('.',$sig[1]);
22 | 
23 |             /* add in the package as an object so it can be upgraded */
24 |             /** @var modTransportPackage $package */
25 |             $package = $modx->newObject('transport.modTransportPackage');
26 |             $package->set('signature',$signature);
27 | 
28 |             /* make silly assumptions */
29 |             $provider = 1;
30 | 
31 |             /* little more effort */
32 |             $defaultProvider = $modx->getObject('transport.modTransportProvider', array('name' => 'modx.com'));
33 | 
34 |             if ($defaultProvider) $provider = $defaultProvider->get('id');
35 |             else $modx->logManagerAction('package_install','transport.modTransportPackage','Unable to find modx.com provider, setting to 1');
36 |             
37 |             $package->fromArray(array(
38 |                 'created' => date('Y-m-d h:i:s'),
39 |                 'updated' => date('Y-m-d h:i:s'),
40 |                 'installed' => strftime('%Y-%m-%d %H:%M:%S'),
41 |                 'state' => 1,
42 |                 'workspace' => 1,
43 |                 'provider' => $provider,
44 |                 'disabled' => false,
45 |                 'source' => $transport->signature . '/' . $this->payload['class'] . '/' . $this->payload['signature'] . '/' . $signature.'.transport.zip',
46 |                 'manifest' => null,
47 |                 'package_name' => $sig[0],
48 |                 'version_major' => $versionSignature[0],
49 |                 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
50 |                 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
51 |             ));
52 |             if (!empty($sig[2])) {
53 |                 $r = preg_split('/([0-9]+)/',$sig[2],-1,PREG_SPLIT_DELIM_CAPTURE);
54 |                 if (is_array($r) && !empty($r)) {
55 |                     $package->set('release',$r[0]);
56 |                     $package->set('release_index',(isset($r[1]) ? $r[1] : '0'));
57 |                 } else {
58 |                     $package->set('release',$sig[2]);
59 |                 }
60 |             }
61 |             $success = $package->save();
62 |             $modx->logManagerAction('package_install','transport.modTransportPackage',$package->get('id'));
63 |         break;
64 |         
65 |         case xPDOTransport::ACTION_UNINSTALL:
66 |             /* remove the package on uninstall */
67 |             $package = $modx->getObject('transport.modTransportPackage',array('signature' => $signature));
68 |             if ($package) {
69 |                 if ($package->uninstall()) {
70 |                     /** @var modCacheManager $cacheManager */
71 |                     $cacheManager= $modx->getCacheManager();
72 |                     $cacheManager->refresh();
73 |                     $modx->logManagerAction('package_uninstall','transport.modTransportPackage',$package->get('id'));
74 |                 }
75 |             }
76 |         break;
77 |     }
78 | }
79 | 
80 | return $success;


--------------------------------------------------------------------------------
/_build/resolvers/packages/resolve.getpage.php:
--------------------------------------------------------------------------------
 1 | xpdo) {
12 |     $signature = 'getpage-1.2.3-pl';
13 |     $modx =& $transport->xpdo;
14 |     $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
15 |     
16 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
17 |         case xPDOTransport::ACTION_INSTALL:
18 |         case xPDOTransport::ACTION_UPGRADE:
19 |             /* define version */
20 |             $sig = explode('-',$signature);
21 |             $versionSignature = explode('.',$sig[1]);
22 | 
23 |             /* add in the package as an object so it can be upgraded */
24 |             /** @var modTransportPackage $package */
25 |             $package = $modx->newObject('transport.modTransportPackage');
26 |             $package->set('signature',$signature);
27 | 
28 |             /* make silly assumptions */
29 |             $provider = 1;
30 | 
31 |             /* little more effort */
32 |             $defaultProvider = $modx->getObject('transport.modTransportProvider', array('name' => 'modx.com'));
33 | 
34 |             if ($defaultProvider) $provider = $defaultProvider->get('id');
35 |             else $modx->logManagerAction('package_install','transport.modTransportPackage','Unable to find modx.com provider, setting to 1');
36 | 
37 |             $package->fromArray(array(
38 |                 'created' => date('Y-m-d h:i:s'),
39 |                 'updated' => date('Y-m-d h:i:s'),
40 |                 'installed' => strftime('%Y-%m-%d %H:%M:%S'),
41 |                 'state' => 1,
42 |                 'workspace' => 1,
43 |                 'provider' => $provider,
44 |                 'disabled' => false,
45 |                 'source' => $transport->signature . '/' . $this->payload['class'] . '/' . $this->payload['signature'] . '/' . $signature.'.transport.zip',
46 |                 'manifest' => null,
47 |                 'package_name' => $sig[0],
48 |                 'version_major' => $versionSignature[0],
49 |                 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
50 |                 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
51 |             ));
52 |             if (!empty($sig[2])) {
53 |                 $r = preg_split('/([0-9]+)/',$sig[2],-1,PREG_SPLIT_DELIM_CAPTURE);
54 |                 if (is_array($r) && !empty($r)) {
55 |                     $package->set('release',$r[0]);
56 |                     $package->set('release_index',(isset($r[1]) ? $r[1] : '0'));
57 |                 } else {
58 |                     $package->set('release',$sig[2]);
59 |                 }
60 |             }
61 |             $success = $package->save();
62 |             $modx->logManagerAction('package_install','transport.modTransportPackage',$package->get('id'));
63 |         break;
64 |         
65 |         case xPDOTransport::ACTION_UNINSTALL:
66 |             /* remove the package on uninstall */
67 |             $package = $modx->getObject('transport.modTransportPackage',array('signature' => $signature));
68 |             if ($package) {
69 |                 if ($package->uninstall()) {
70 |                     /** @var modCacheManager $cacheManager */
71 |                     $cacheManager= $modx->getCacheManager();
72 |                     $cacheManager->refresh();
73 |                     $modx->logManagerAction('package_uninstall','transport.modTransportPackage',$package->get('id'));
74 |                 }
75 |             }
76 |         break;
77 |     }
78 | }
79 | 
80 | return $success;


--------------------------------------------------------------------------------
/_build/resolvers/packages/resolve.getresources.php:
--------------------------------------------------------------------------------
 1 | xpdo) {
12 |     $signature = 'getresources-1.6.0-pl';
13 |     $modx =& $transport->xpdo;
14 |     $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
15 |     
16 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
17 |         case xPDOTransport::ACTION_INSTALL:
18 |         case xPDOTransport::ACTION_UPGRADE:
19 |             /* define version */
20 |             $sig = explode('-',$signature);
21 |             $versionSignature = explode('.',$sig[1]);
22 | 
23 |             /* add in the package as an object so it can be upgraded */
24 |             /** @var modTransportPackage $package */
25 |             $package = $modx->newObject('transport.modTransportPackage');
26 |             $package->set('signature',$signature);
27 | 
28 |             /* make silly assumptions */
29 |             $provider = 1;
30 | 
31 |             /* little more effort */
32 |             $defaultProvider = $modx->getObject('transport.modTransportProvider', array('name' => 'modx.com'));
33 | 
34 |             if ($defaultProvider) $provider = $defaultProvider->get('id');
35 |             else $modx->logManagerAction('package_install','transport.modTransportPackage','Unable to find modx.com provider, setting to 1');
36 | 
37 |             $package->fromArray(array(
38 |                 'created' => date('Y-m-d h:i:s'),
39 |                 'updated' => date('Y-m-d h:i:s'),
40 |                 'installed' => strftime('%Y-%m-%d %H:%M:%S'),
41 |                 'state' => 1,
42 |                 'workspace' => 1,
43 |                 'provider' => $provider,
44 |                 'disabled' => false,
45 |                 'source' => $transport->signature . '/' . $this->payload['class'] . '/' . $this->payload['signature'] . '/' . $signature.'.transport.zip',
46 |                 'manifest' => null,
47 |                 'package_name' => $sig[0],
48 |                 'version_major' => $versionSignature[0],
49 |                 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
50 |                 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
51 |             ));
52 |             if (!empty($sig[2])) {
53 |                 $r = preg_split('/([0-9]+)/',$sig[2],-1,PREG_SPLIT_DELIM_CAPTURE);
54 |                 if (is_array($r) && !empty($r)) {
55 |                     $package->set('release',$r[0]);
56 |                     $package->set('release_index',(isset($r[1]) ? $r[1] : '0'));
57 |                 } else {
58 |                     $package->set('release',$sig[2]);
59 |                 }
60 |             }
61 |             $success = $package->save();
62 |             $modx->logManagerAction('package_install','transport.modTransportPackage',$package->get('id'));
63 |         break;
64 |         
65 |         case xPDOTransport::ACTION_UNINSTALL:
66 |             /* remove the package on uninstall */
67 |             $package = $modx->getObject('transport.modTransportPackage',array('signature' => $signature));
68 |             if ($package) {
69 |                 if ($package->uninstall()) {
70 |                     /** @var modCacheManager $cacheManager */
71 |                     $cacheManager= $modx->getCacheManager();
72 |                     $cacheManager->refresh();
73 |                     $modx->logManagerAction('package_uninstall','transport.modTransportPackage',$package->get('id'));
74 |                 }
75 |             }
76 |         break;
77 |     }
78 | }
79 | 
80 | return $success;
81 | 


--------------------------------------------------------------------------------
/_build/resolvers/packages/resolve.quip.php:
--------------------------------------------------------------------------------
 1 | xpdo) {
12 |     $signature = 'quip-2.3.3-pl';
13 |     $modx =& $transport->xpdo;
14 |     $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
15 |     
16 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
17 |         case xPDOTransport::ACTION_INSTALL:
18 |         case xPDOTransport::ACTION_UPGRADE:
19 |             /* define version */
20 |             $sig = explode('-',$signature);
21 |             $versionSignature = explode('.',$sig[1]);
22 | 
23 |             /* add in the package as an object so it can be upgraded */
24 |             /** @var modTransportPackage $package */
25 |             $package = $modx->newObject('transport.modTransportPackage');
26 |             $package->set('signature',$signature);
27 | 
28 |             /* make silly assumptions */
29 |             $provider = 1;
30 | 
31 |             /* little more effort */
32 |             $defaultProvider = $modx->getObject('transport.modTransportProvider', array('name' => 'modx.com'));
33 | 
34 |             if ($defaultProvider) $provider = $defaultProvider->get('id');
35 |             else $modx->logManagerAction('package_install','transport.modTransportPackage','Unable to find modx.com provider, setting to 1');
36 | 
37 |             $package->fromArray(array(
38 |                 'created' => date('Y-m-d h:i:s'),
39 |                 'updated' => date('Y-m-d h:i:s'),
40 |                 'installed' => strftime('%Y-%m-%d %H:%M:%S'),
41 |                 'state' => 1,
42 |                 'workspace' => 1,
43 |                 'provider' => $provider,
44 |                 'disabled' => false,
45 |                 'source' => $transport->signature . '/' . $this->payload['class'] . '/' . $this->payload['signature'] . '/' . $signature.'.transport.zip',
46 |                 'manifest' => null,
47 |                 'package_name' => $sig[0],
48 |                 'version_major' => $versionSignature[0],
49 |                 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
50 |                 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
51 |             ));
52 |             if (!empty($sig[2])) {
53 |                 $r = preg_split('/([0-9]+)/',$sig[2],-1,PREG_SPLIT_DELIM_CAPTURE);
54 |                 if (is_array($r) && !empty($r)) {
55 |                     $package->set('release',$r[0]);
56 |                     $package->set('release_index',(isset($r[1]) ? $r[1] : '0'));
57 |                 } else {
58 |                     $package->set('release',$sig[2]);
59 |                 }
60 |             }
61 |             $success = $package->save();
62 |             $modx->logManagerAction('package_install','transport.modTransportPackage',$package->get('id'));
63 |         break;
64 |         
65 |         case xPDOTransport::ACTION_UNINSTALL:
66 |             /* remove the package on uninstall */
67 |             $package = $modx->getObject('transport.modTransportPackage',array('signature' => $signature));
68 |             if ($package) {
69 |                 if ($package->uninstall()) {
70 |                     /** @var modCacheManager $cacheManager */
71 |                     $cacheManager= $modx->getCacheManager();
72 |                     $cacheManager->refresh();
73 |                     $modx->logManagerAction('package_uninstall','transport.modTransportPackage',$package->get('id'));
74 |                 }
75 |             }
76 |         break;
77 |     }
78 | }
79 | 
80 | return $success;


--------------------------------------------------------------------------------
/_build/resolvers/packages/resolve.taglister.php:
--------------------------------------------------------------------------------
 1 | xpdo) {
12 |     $signature = 'taglister-1.1.7-pl';
13 |     $modx =& $transport->xpdo;
14 |     $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
15 |     
16 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
17 |         case xPDOTransport::ACTION_INSTALL:
18 |         case xPDOTransport::ACTION_UPGRADE:
19 |             /* define version */
20 |             $sig = explode('-',$signature);
21 |             $versionSignature = explode('.',$sig[1]);
22 | 
23 |             /* add in the package as an object so it can be upgraded */
24 |             /** @var modTransportPackage $package */
25 |             $package = $modx->newObject('transport.modTransportPackage');
26 |             $package->set('signature',$signature);
27 | 
28 |             /* make silly assumptions */
29 |             $provider = 1;
30 | 
31 |             /* little more effort */
32 |             $defaultProvider = $modx->getObject('transport.modTransportProvider', array('name' => 'modx.com'));
33 | 
34 |             if ($defaultProvider) $provider = $defaultProvider->get('id');
35 |             else $modx->logManagerAction('package_install','transport.modTransportPackage','Unable to find modx.com provider, setting to 1');
36 | 
37 |             $package->fromArray(array(
38 |                 'created' => date('Y-m-d h:i:s'),
39 |                 'updated' => date('Y-m-d h:i:s'),
40 |                 'installed' => strftime('%Y-%m-%d %H:%M:%S'),
41 |                 'state' => 1,
42 |                 'workspace' => 1,
43 |                 'provider' => $provider,
44 |                 'disabled' => false,
45 |                 'source' => $transport->signature . '/' . $this->payload['class'] . '/' . $this->payload['signature'] . '/' . $signature.'.transport.zip',
46 |                 'manifest' => null,
47 |                 'package_name' => $sig[0],
48 |                 'version_major' => $versionSignature[0],
49 |                 'version_minor' => !empty($versionSignature[1]) ? $versionSignature[1] : 0,
50 |                 'version_patch' => !empty($versionSignature[2]) ? $versionSignature[2] : 0,
51 |             ));
52 |             if (!empty($sig[2])) {
53 |                 $r = preg_split('/([0-9]+)/',$sig[2],-1,PREG_SPLIT_DELIM_CAPTURE);
54 |                 if (is_array($r) && !empty($r)) {
55 |                     $package->set('release',$r[0]);
56 |                     $package->set('release_index',(isset($r[1]) ? $r[1] : '0'));
57 |                 } else {
58 |                     $package->set('release',$sig[2]);
59 |                 }
60 |             }
61 |             $success = $package->save();
62 |             $modx->logManagerAction('package_install','transport.modTransportPackage',$package->get('id'));
63 |         break;
64 |         
65 |         case xPDOTransport::ACTION_UNINSTALL:
66 |             /* remove the package on uninstall */
67 |             $package = $modx->getObject('transport.modTransportPackage',array('signature' => $signature));
68 |             if ($package) {
69 |                 if ($package->uninstall()) {
70 |                     /** @var modCacheManager $cacheManager */
71 |                     $cacheManager= $modx->getCacheManager();
72 |                     $cacheManager->refresh();
73 |                     $modx->logManagerAction('package_uninstall','transport.modTransportPackage',$package->get('id'));
74 |                 }
75 |             }
76 |         break;
77 |     }
78 | }
79 | 
80 | return $success;


--------------------------------------------------------------------------------
/_build/resolvers/tvs.resolver.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Handles adding Articles to Extension Packages
24 |  *
25 |  * @var xPDOObject $object
26 |  * @var array $options
27 |  * @package articles
28 |  * @subpackage build
29 |  */
30 | if ($object->xpdo) {
31 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
32 |         case xPDOTransport::ACTION_INSTALL:
33 |         case xPDOTransport::ACTION_UPGRADE:
34 |             /** @var modX $modx */
35 |             $modx =& $object->xpdo;
36 |             $modelPath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/').'model/';
37 | 
38 |             /** @var modTemplateVar $tv */
39 |             $tv = $modx->getObject('modTemplateVar',array(
40 |                 'name' => 'articlestags',
41 |             ));
42 |             if ($tv) {
43 |                 $templates = array('sample.ArticlesContainerTemplate','sample.ArticleTemplate');
44 |                 foreach ($templates as $templateName) {
45 |                     /** @var modTemplate $template */
46 |                     $template = $modx->getObject('modTemplate',array('templatename' => $templateName));
47 |                     if ($template) {
48 |                         /** @var modTemplateVarTemplate $templateVarTemplate */
49 |                         $templateVarTemplate = $modx->getObject('modTemplateVarTemplate',array(
50 |                             'templateid' => $template->get('id'),
51 |                             'tmplvarid' => $tv->get('id'),
52 |                         ));
53 |                         if (!$templateVarTemplate) {
54 |                             $templateVarTemplate = $modx->newObject('modTemplateVarTemplate');
55 |                             $templateVarTemplate->set('templateid',$template->get('id'));
56 |                             $templateVarTemplate->set('tmplvarid',$tv->get('id'));
57 |                             $templateVarTemplate->save();
58 |                         }
59 |                     }
60 |                 }
61 |             }
62 |             break;
63 |     }
64 | }
65 | return true;


--------------------------------------------------------------------------------
/_build/subpackages/archivist-1.2.4-pl.transport.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/_build/subpackages/archivist-1.2.4-pl.transport.zip


--------------------------------------------------------------------------------
/_build/subpackages/getpage-1.2.3-pl.transport.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/_build/subpackages/getpage-1.2.3-pl.transport.zip


--------------------------------------------------------------------------------
/_build/subpackages/getresources-1.6.0-pl.transport.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/_build/subpackages/getresources-1.6.0-pl.transport.zip


--------------------------------------------------------------------------------
/_build/subpackages/quip-2.3.3-pl.transport.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/_build/subpackages/quip-2.3.3-pl.transport.zip


--------------------------------------------------------------------------------
/_build/subpackages/taglister-1.1.7-pl.transport.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/_build/subpackages/taglister-1.1.7-pl.transport.zip


--------------------------------------------------------------------------------
/_build/validators/validate.archivist.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Verify Archivist is latest or equal in version
24 |  *
25 |  * @var modX $modx
26 |  * @var xPDOTransport $transport
27 |  * @var array $options
28 |  * @package articles
29 |  */
30 | $newer= true;
31 | if ($transport && $transport->xpdo) {
32 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
33 |         case xPDOTransport::ACTION_INSTALL:
34 |         case xPDOTransport::ACTION_UPGRADE:
35 |             $modx =& $transport->xpdo;
36 | 
37 |             /* define Archivist version */
38 |             $newVersion = '1.2.4-pl';
39 |             $newVersionMajor = '1';
40 |             $name = 'archivist';
41 | 
42 |             /* now loop through packages and check for newer versions
43 |              * Do not install if newer or equal versions are found */
44 |             $newer = true;
45 |             $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
46 |             $c = $modx->newQuery('transport.modTransportPackage');
47 |             $c->where(array(
48 |                 'package_name' => $name,
49 |                 'version_major:>=' => $newVersionMajor,
50 |             ));
51 |             $packages = $modx->getCollection('transport.modTransportPackage',$c);
52 |             /** @var modTransportPackage $package */
53 |             foreach ($packages as $package) {
54 |                 if ($package->compareVersion($newVersion)) {
55 |                     $newer = false;
56 |                     break;
57 |                 }
58 |             }
59 |             break;
60 |     }
61 | }
62 | 
63 | return $newer;


--------------------------------------------------------------------------------
/_build/validators/validate.getpage.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Verify getPage is latest or equal in version
24 |  *
25 |  * @var modX $modx
26 |  * @var xPDOTransport $transport
27 |  * @var array $options
28 |  * @package articles
29 |  */
30 | $newer= true;
31 | if ($transport && $transport->xpdo) {
32 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
33 |         case xPDOTransport::ACTION_INSTALL:
34 |         case xPDOTransport::ACTION_UPGRADE:
35 |             $modx =& $transport->xpdo;
36 | 
37 |             /* define getPage version */
38 |             $newVersion = '1.2.3-pl';
39 |             $newVersionMajor = '1';
40 |             $name = 'getpage';
41 | 
42 |             /* now loop through packages and check for newer versions
43 |              * Do not install if newer or equal versions are found */
44 |             $newer = true;
45 |             $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
46 |             $c = $modx->newQuery('transport.modTransportPackage');
47 |             $c->where(array(
48 |                 'package_name' => $name,
49 |                 'version_major:>=' => $newVersionMajor,
50 |             ));
51 |             $packages = $modx->getCollection('transport.modTransportPackage',$c);
52 | 
53 |             foreach ($packages as $package) {
54 |                 if ($package->compareVersion($newVersion)) {
55 |                     $newer = false;
56 |                     break;
57 |                 }
58 |             }
59 |             break;
60 |     }
61 | }
62 | 
63 | return $newer;


--------------------------------------------------------------------------------
/_build/validators/validate.getresources.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Verify getResources is latest or equal in version
24 |  *
25 |  * @var modX $modx
26 |  * @var xPDOTransport $transport
27 |  * @var array $options
28 |  * @package articles
29 |  */
30 | $newer= true;
31 | if ($transport && $transport->xpdo) {
32 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
33 |         case xPDOTransport::ACTION_INSTALL:
34 |         case xPDOTransport::ACTION_UPGRADE:
35 |             $modx =& $transport->xpdo;
36 | 
37 |             /* define getResources version */
38 |             $newVersion = '1.5.0-pl';
39 |             $newVersionMajor = '1';
40 |             $name = 'getresources';
41 | 
42 |             /* now loop through packages and check for newer versions
43 |              * Do not install if newer or equal versions are found */
44 |             $newer = true;
45 |             $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
46 |             $c = $modx->newQuery('transport.modTransportPackage');
47 |             $c->where(array(
48 |                 'package_name' => $name,
49 |                 'version_major:>=' => $newVersionMajor,
50 |             ));
51 |             $packages = $modx->getCollection('transport.modTransportPackage',$c);
52 | 
53 |             foreach ($packages as $package) {
54 |                 if ($package->compareVersion($newVersion)) {
55 |                     $newer = false;
56 |                     break;
57 |                 }
58 |             }
59 |             break;
60 |     }
61 | }
62 | 
63 | return $newer;


--------------------------------------------------------------------------------
/_build/validators/validate.quip.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Verify Quip is latest or equal in version
24 |  *
25 |  * @var modX $modx
26 |  * @var xPDOTransport $transport
27 |  * @var array $options
28 |  * @package articles
29 |  */
30 | $newer= true;
31 | if ($transport && $transport->xpdo) {
32 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
33 |         case xPDOTransport::ACTION_INSTALL:
34 |         case xPDOTransport::ACTION_UPGRADE:
35 |             $modx =& $transport->xpdo;
36 | 
37 |             /* define Quip version */
38 |             $newVersion = '2.3.2-pl';
39 |             $newVersionMajor = '2';
40 |             $name = 'quip';
41 | 
42 |             /* now loop through packages and check for newer versions
43 |              * Do not install if newer or equal versions are found */
44 |             $newer = true;
45 |             $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
46 |             $c = $modx->newQuery('transport.modTransportPackage');
47 |             $c->where(array(
48 |                 'package_name' => $name,
49 |                 'version_major:>=' => $newVersionMajor,
50 |             ));
51 |             $packages = $modx->getCollection('transport.modTransportPackage',$c);
52 | 
53 |             foreach ($packages as $package) {
54 |                 if ($package->compareVersion($newVersion)) {
55 |                     $newer = false;
56 |                     break;
57 |                 }
58 |             }
59 |             break;
60 |     }
61 | }
62 | 
63 | return $newer;


--------------------------------------------------------------------------------
/_build/validators/validate.taglister.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Verify tagLister is latest or equal in version
24 |  *
25 |  * @var modX $modx
26 |  * @var xPDOTransport $transport
27 |  * @var array $options
28 |  * @package articles
29 |  */
30 | $newer= true;
31 | if ($transport && $transport->xpdo) {
32 |     switch ($options[xPDOTransport::PACKAGE_ACTION]) {
33 |         case xPDOTransport::ACTION_INSTALL:
34 |         case xPDOTransport::ACTION_UPGRADE:
35 |             $modx =& $transport->xpdo;
36 | 
37 |             /* define tagLister version */
38 |             $newVersion = '1.1.7-pl';
39 |             $newVersionMajor = '1';
40 |             $name = 'taglister';
41 | 
42 |             /* now loop through packages and check for newer versions
43 |              * Do not install if newer or equal versions are found */
44 |             $newer = true;
45 |             $modx->addPackage('modx.transport',$modx->getOption('core_path').'model/');
46 |             $c = $modx->newQuery('transport.modTransportPackage');
47 |             $c->where(array(
48 |                 'package_name' => $name,
49 |                 'version_major:>=' => $newVersionMajor,
50 |             ));
51 |             $packages = $modx->getCollection('transport.modTransportPackage',$c);
52 |             /** @var modTransportPackage $package */
53 |             foreach ($packages as $package) {
54 |                 if ($package->compareVersion($newVersion)) {
55 |                     $newer = false;
56 |                     break;
57 |                 }
58 |             }
59 |             break;
60 |     }
61 | }
62 | 
63 | return $newer;


--------------------------------------------------------------------------------
/assets/components/articles/connector.php:
--------------------------------------------------------------------------------
 1 | 
 6 |  *
 7 |  * Articles is free software; you can redistribute it and/or modify it under the
 8 |  * terms of the GNU General Public License as published by the Free Software
 9 |  * Foundation; either version 2 of the License, or (at your option) any later
10 |  * version.
11 |  *
12 |  * Articles is distributed in the hope that it will be useful, but WITHOUT ANY
13 |  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 |  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 |  *
16 |  * You should have received a copy of the GNU General Public License along with
17 |  * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple
18 |  * Place, Suite 330, Boston, MA 02111-1307 USA
19 |  *
20 |  * @package articles
21 |  */
22 | /**
23 |  * Articles Connector
24 |  *
25 |  * @package articles
26 |  */
27 | require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php';
28 | require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
29 | require_once MODX_CONNECTORS_PATH.'index.php';
30 | 
31 | $corePath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/');
32 | require_once $corePath.'model/articles/articlesservice.class.php';
33 | $modx->articles = new ArticlesService($modx);
34 | 
35 | $modx->lexicon->load('articles:default');
36 | 
37 | /* handle request */
38 | $path = $modx->getOption('processorsPath',$modx->articles->config,$corePath.'processors/');
39 | $modx->request->handleRequest(array(
40 |     'processors_path' => $path,
41 |     'location' => '',
42 | ));


--------------------------------------------------------------------------------
/assets/components/articles/css/mgr.css:
--------------------------------------------------------------------------------
  1 | .icon-articlescontainer .x-tree-node-icon {
  2 |     background-image: url(../images/cup.png) !important;
  3 | }
  4 | 
  5 | 
  6 | .articles-grid-date {
  7 |   color:#a0a0a0;
  8 |   font-family:arial, Helvetica, sans-serif;
  9 |   font-size:20px;
 10 |   font-weight:bold;
 11 |   letter-spacing:-1px;
 12 |   line-height:1;
 13 |   padding-right:10px;
 14 |   text-align:right;
 15 |   margin-top: -4px;
 16 | }
 17 | .articles-grid-date .articles-grid-time {
 18 |   display:block;
 19 |   font-size:10px;
 20 |   font-weight:normal;
 21 |   margin-top:5px;
 22 | }
 23 | 
 24 | .articles-grid-comments {
 25 |     background: url(../images/comments-icon.png) top left no-repeat !important;
 26 |     height: 22px;
 27 |     width: 24px;
 28 |     padding: 3px 0 0 3px;
 29 |     text-align: center;
 30 | }
 31 | .articles-grid-comments span {
 32 |     font-size: 11px;
 33 |     font-weight: bold;
 34 |     line-height: 1.3em;
 35 |     display: inline-block;
 36 |     color: white;
 37 |     text-align: center;
 38 | }
 39 | .articles-comments-col-header {
 40 |     margin-left:7px;
 41 | }
 42 | .main-column a {
 43 |   color:#485319;
 44 |   line-height:1;
 45 |   text-decoration:none;
 46 | }
 47 | .main-column a:hover {
 48 |   color:#7a8f23;
 49 |   text-decoration:none;
 50 | }
 51 | .articles-grid .x-grid3-cell-inner {
 52 |   color:#808080;
 53 | }
 54 | 
 55 | 
 56 | .articles-panel-spacer .x-panel-body { background: transparent !important; }
 57 | .actions a {
 58 |   -moz-border-radius:3px;
 59 |   -webkit-border-radius:3px;
 60 |   -o-border-radius:3px;
 61 |   -ms-border-radius:3px;
 62 |   -khtml-border-radius:3px;
 63 |   border-radius:3px;
 64 |   background:#dcdcdc;
 65 |   background:-moz-linear-gradient(center bottom,#dcdcdc 0%,#fcfcfc 100%) repeat scroll 0 0 transparent;
 66 |   background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fcfcfc),color-stop(100%,#dcdcdc));
 67 |   background:-webkit-linear-gradient(center bottom,#dcdcdc 0%,#fcfcfc 100%);
 68 |   background:-o-linear-gradient(center bottom,#dcdcdc 0%,#fcfcfc 100%);
 69 |   background:-ms-linear-gradient(center bottom,#dcdcdc 0%,#fcfcfc 100%);
 70 |   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#fcfcfc,endColorstr=#dcdcdc,GradientType=0);
 71 |   background:linear-gradient(center bottom,#dcdcdc 0%,#fcfcfc 100%);
 72 |   text-shadow:0 1px 0 #ffffff;
 73 |   border:1px solid #cccccc;
 74 |   color:#888888;
 75 |   display:block;
 76 |   font-size:11px;
 77 |   font-weight:bold;
 78 |   font-family:helvetica, arial, freesans, clean, sans-serif;
 79 |   padding:6px 8px;
 80 |   text-decoration:none;
 81 |   cursor:pointer;
 82 | }
 83 | .actions a:hover {
 84 |   background:#e0e0e0;
 85 |   background:-moz-linear-gradient(center bottom,#e0e0e0 0%,#fcfcfc 100%) repeat scroll 0 0 transparent;
 86 |   background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fcfcfc),color-stop(100%,#e0e0e0));
 87 |   background:-webkit-linear-gradient(center bottom,#e0e0e0 0%,#fcfcfc 100%);
 88 |   background:-o-linear-gradient(center bottom,#e0e0e0 0%,#fcfcfc 100%);
 89 |   background:-ms-linear-gradient(center bottom,#e0e0e0 0%,#fcfcfc 100%);
 90 |   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#fcfcfc,endColorstr=#e0e0e0,GradientType=0);
 91 |   background:linear-gradient(center bottom,#e0e0e0 0%,#fcfcfc 100%);
 92 |   color:#5b7a98;
 93 | }
 94 | .actions a:active {
 95 |   -moz-box-shadow:0 0 3px #aaaaaa inset;
 96 |   -webkit-box-shadow:0 0 3px #aaaaaa inset;
 97 |   -o-box-shadow:0 0 3px #aaaaaa inset;
 98 |   box-shadow:0 0 3px #aaaaaa inset;
 99 |   background-color:#ffffff;
100 |   background-image:none;
101 | }
102 | .actions a.orange {
103 |   background:#febb4a;
104 |   background:-moz-linear-gradient(center bottom,#febb4a 0%,#feda71 100%) repeat scroll 0 0 transparent;
105 |   background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#feda71),color-stop(100%,#febb4a));
106 |   background:-webkit-linear-gradient(center bottom,#febb4a 0%,#feda71 100%);
107 |   background:-o-linear-gradient(center bottom,#febb4a 0%,#feda71 100%);
108 |   background:-ms-linear-gradient(center bottom,#febb4a 0%,#feda71 100%);
109 |   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#feda71,endColorstr=#febb4a,GradientType=0);
110 |   background:linear-gradient(center bottom,#febb4a 0%,#feda71 100%);
111 |   border-color:#f5b74e #e7a93f #dfa138;
112 |   color:#996633;
113 |   text-shadow:0 1px 0 #fee1a0;
114 | }
115 | .actions a.orange:hover {
116 |   background:#fec95b;
117 |   background:-moz-linear-gradient(center bottom,#fec95b 0%,#fee1a0 100%) repeat scroll 0 0 transparent;
118 |   background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fee1a0),color-stop(100%,#fec95b));
119 |   background:-webkit-linear-gradient(center bottom,#fec95b 0%,#fee1a0 100%);
120 |   background:-o-linear-gradient(center bottom,#fec95b 0%,#fee1a0 100%);
121 |   background:-ms-linear-gradient(center bottom,#fec95b 0%,#fee1a0 100%);
122 |   filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#fee1a0,endColorstr=#fec95b,GradientType=0);
123 |   background:linear-gradient(center bottom,#fec95b 0%,#fee1a0 100%);
124 | }
125 | 
126 | .articles-import-intro {
127 |     font-size: 11px;
128 |     color: #777;
129 |     background-color: #fafafa !important;
130 |     padding: 0 5px;
131 | }
132 | 
133 | .articles-grid .article-id {
134 |     font-size: 11px;
135 |     font-weight: normal;
136 |     display: block;
137 |     margin-bottom: 3px;
138 |     padding-left: 5px;
139 |     float: left;
140 |     color: #aaa;
141 | }
142 | .articles-grid .main-column a {
143 |     float: left;
144 | }
145 | .articles-grid .article-title-column ul {
146 |     clear: both;
147 | }
148 | 
149 | .ext-strict .x-form-field-trigger-wrap .x-form-text, .ext-strict .x-small-editor .x-form-field-trigger-wrap .x-form-text {
150 | text-shadow:none !important;
151 | }
152 | 
153 | .bxr-field-tags .bxr-field-wrapper {
154 |     margin-bottom:8px;
155 |     padding-right:47px;
156 |     position:relative;
157 | }
158 | 
159 | .bxr-field-tags .bxr-field-wrapper:before, .bxr-field-tags .bxr-field-wrapper:after {
160 |     content: "\0020";
161 |     display: block;
162 |     height: 0;
163 |     overflow: hidden;
164 | }
165 | 
166 | .bxr-field-tags .bxr-field-wrapper:after { clear: both; }
167 | 
168 | .bxr-field-tags {
169 |     width:auto !important;
170 | }
171 | 
172 | .bxr-field-tags .x-form-field-wrap {
173 |     background:none;
174 | }
175 | 
176 | .bxr-field-tags input.x-form-text.x-form-field {
177 |     width: 100% !important;
178 |     height:100% !important;
179 |     -webkit-box-sizing:border-box;
180 |     -moz-box-sizing:border-box;
181 |     box-sizing:border-box;
182 |     font-weight:normal;
183 | }
184 | 
185 | .bxr-field-tags button {
186 |     margin:0 0 0 4px;
187 |     padding:0 8px;
188 |     height:32px;
189 |     float:left;
190 |     color:#53595f;
191 |     font:bold 11px tahoma, verdana, helvetica, sans-serif;
192 |     border-color:#D5D5D5;
193 |     position:absolute;
194 |     top:0;
195 |     right:0;
196 | }
197 | 
198 | .bxr-field-tags .x-btn:focus {
199 |     border-color:#668f16;
200 | }
201 | 
202 | .bxr-field-tags .x-form-field-wrap {
203 |     width: 100% !important;
204 |     min-width:120px;
205 |     float:left;
206 | }
207 | 
208 | .bxr-field-tags .inserted-tags {
209 |     margin-top:3px;
210 | }
211 | 
212 | .bxr-field-tags .inserted-tags li {
213 |     float:left;
214 |     margin:0 4px 4px 0;
215 | }
216 | 
217 | .bxr-field-tags .inserted-tags li:last-of-type {
218 |     margin-right:0;
219 | }


--------------------------------------------------------------------------------
/assets/components/articles/images/comments-icon-w.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/images/comments-icon-w.png


--------------------------------------------------------------------------------
/assets/components/articles/images/comments-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/images/comments-icon.png


--------------------------------------------------------------------------------
/assets/components/articles/images/cup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/images/cup.png


--------------------------------------------------------------------------------
/assets/components/articles/js/articles.js:
--------------------------------------------------------------------------------
 1 | var Articles = function(config) {
 2 |     config = config || {};
 3 |     Articles.superclass.constructor.call(this,config);
 4 | };
 5 | Ext.extend(Articles,Ext.Component,{
 6 |     page:{},window:{},grid:{},tree:{},panel:{},combo:{},config: {},view: {},extra: {}
 7 |     ,connector_url: ''
 8 | });
 9 | Ext.reg('Articles',Articles);
10 | 
11 | Articles = new Articles();
12 | 
13 | 
14 | Articles.combo.PublishStatus = function(config) {
15 |     config = config || {};
16 |     Ext.applyIf(config,{
17 |         store: [[1,_('published')],[0,_('unpublished')]]
18 |         ,name: 'published'
19 |         ,hiddenName: 'published'
20 |         ,triggerAction: 'all'
21 |         ,editable: false
22 |         ,selectOnFocus: false
23 |         ,preventRender: true
24 |         ,forceSelection: true
25 |         ,enableKeyEvents: true
26 |     });
27 |     Articles.combo.PublishStatus.superclass.constructor.call(this,config);
28 | };
29 | Ext.extend(Articles.combo.PublishStatus,MODx.combo.ComboBox);
30 | Ext.reg('articles-combo-publish-status',Articles.combo.PublishStatus);
31 | 
32 | Articles.combo.FilterStatus = function(config) {
33 |     config = config || {};
34 |     Ext.applyIf(config,{
35 |         store: [['',_('articles.all')],['published',_('published')],['unpublished',_('unpublished')],['deleted',_('deleted')]]
36 |         ,name: 'filter'
37 |         ,hiddenName: 'filter'
38 |         ,triggerAction: 'all'
39 |         ,editable: false
40 |         ,selectOnFocus: false
41 |         ,preventRender: true
42 |         ,forceSelection: true
43 |         ,enableKeyEvents: true
44 |         ,emptyText: _('articles.filter_ellipsis')
45 |     });
46 |     Articles.combo.FilterStatus.superclass.constructor.call(this,config);
47 | };
48 | Ext.extend(Articles.combo.FilterStatus,MODx.combo.ComboBox);
49 | Ext.reg('articles-combo-filter-status',Articles.combo.FilterStatus);
50 | 
51 | Articles.PanelSpacer = { html: '
' ,border: false, cls: 'articles-panel-spacer' }; -------------------------------------------------------------------------------- /assets/components/articles/js/container/create.js: -------------------------------------------------------------------------------- 1 | 2 | Articles.page.CreateArticlesContainer = function(config) { 3 | config = config || {record:{}}; 4 | config.record = config.record || {}; 5 | Ext.applyIf(config,{ 6 | panelXType: 'articles-panel-container' 7 | }); 8 | config.canDuplicate = false; 9 | config.canDelete = false; 10 | Articles.page.CreateArticlesContainer.superclass.constructor.call(this,config); 11 | }; 12 | Ext.extend(Articles.page.CreateArticlesContainer,MODx.page.CreateResource,{ 13 | 14 | }); 15 | Ext.reg('articles-page-articles-container-create',Articles.page.CreateArticlesContainer); 16 | 17 | 18 | 19 | Articles.panel.Container = function(config) { 20 | config = config || {}; 21 | Articles.panel.Container.superclass.constructor.call(this,config); 22 | }; 23 | Ext.extend(Articles.panel.Container,MODx.panel.Resource,{ 24 | getFields: function(config) { 25 | var it = []; 26 | it.push({ 27 | title: _('articles.container') 28 | ,id: 'modx-resource-settings' 29 | ,cls: 'modx-resource-tab' 30 | ,layout: 'form' 31 | ,labelAlign: 'top' 32 | ,labelSeparator: '' 33 | ,bodyCssClass: 'tab-panel-wrapper main-wrapper' 34 | ,autoHeight: true 35 | ,defaults: { 36 | border: false 37 | ,msgTarget: 'side' 38 | ,width: 400 39 | } 40 | ,items: this.getMainFields(config) 41 | }); 42 | it.push({ 43 | title: _('articles.template') 44 | ,id: 'modx-articles-template' 45 | ,cls: 'modx-resource-tab' 46 | ,layout: 'form' 47 | ,labelAlign: 'top' 48 | ,labelSeparator: '' 49 | ,bodyCssClass: 'tab-panel-wrapper main-wrapper' 50 | ,autoHeight: true 51 | ,defaults: { 52 | border: false 53 | ,msgTarget: 'side' 54 | ,width: 400 55 | } 56 | ,items: this.getTemplateSettings(config) 57 | }); 58 | it.push({ 59 | title: _('articles.advanced_settings') 60 | ,id: 'modx-articles-advanced-settings' 61 | ,cls: 'modx-resource-tab' 62 | ,labelAlign: 'top' 63 | ,labelSeparator: '' 64 | ,bodyCssClass: 'tab-panel-wrapper form-with-labels' 65 | ,autoHeight: true 66 | ,items: this.getBlogSettings(config) 67 | }); 68 | if (config.show_tvs && MODx.config.tvs_below_content != 1) { 69 | it.push(this.getTemplateVariablesPanel(config)); 70 | } 71 | if (MODx.perm.resourcegroup_resource_list == 1) { 72 | it.push(this.getAccessPermissionsTab(config)); 73 | } 74 | var its = []; 75 | its.push(this.getPageHeader(config),{ 76 | id:'modx-resource-tabs' 77 | ,xtype: 'modx-tabs' 78 | ,forceLayout: true 79 | ,deferredRender: false 80 | ,collapsible: true 81 | ,itemId: 'tabs' 82 | ,items: it 83 | }); 84 | if (MODx.config.tvs_below_content == 1) { 85 | var tvs = this.getTemplateVariablesPanel(config); 86 | tvs.style = 'margin-top: 10px'; 87 | its.push(tvs); 88 | } 89 | return its; 90 | } 91 | ,getPageHeader: function(config) { 92 | config = config || {record:{}}; 93 | return { 94 | html: '

'+_('articles.container_new')+'

' 95 | ,id: 'modx-resource-header' 96 | ,cls: 'modx-page-header' 97 | ,border: false 98 | ,forceLayout: true 99 | ,anchor: '100%' 100 | }; 101 | } 102 | 103 | 104 | ,getTemplateSettings: function(config) { 105 | return [{ 106 | xtype: 'articles-tab-template-settings' 107 | ,record: config.record 108 | }]; 109 | } 110 | 111 | ,getBlogSettings: function(config) { 112 | return [{ 113 | xtype: 'articles-tab-advanced-settings' 114 | ,record: config.record 115 | }]; 116 | } 117 | 118 | 119 | ,getMainLeftFields: function(config) { 120 | config = config || {record:{}}; 121 | var createPage = MODx.action ? MODx.action['resource/create'] : 'resource/create'; 122 | return [{ 123 | xtype: 'textfield' 124 | ,fieldLabel: _('articles.container_title')+'*' 125 | ,description: MODx.expandHelp ? '' : '[[*pagetitle]]
'+_('articles.container_title_desc') 126 | ,name: 'pagetitle' 127 | ,id: 'modx-resource-pagetitle' 128 | ,maxLength: 255 129 | ,anchor: '100%' 130 | ,allowBlank: false 131 | ,enableKeyEvents: true 132 | ,listeners: { 133 | 'keyup': {scope:this,fn:function(f,e) { 134 | var titlePrefix = MODx.request.a == createPage ? _('new_document') : _('document'); 135 | var title = Ext.util.Format.stripTags(f.getValue()); 136 | Ext.getCmp('modx-resource-header').getEl().update('

'+title+'

'); 137 | }} 138 | } 139 | },{ 140 | xtype: MODx.expandHelp ? 'label' : 'hidden' 141 | ,forId: 'modx-resource-pagetitle' 142 | ,html: _('articles.container_title_desc') 143 | ,cls: 'desc-under' 144 | 145 | },{ 146 | xtype: 'textfield' 147 | ,fieldLabel: _('articles.container_alias') 148 | ,description: '[[*alias]]
'+_('articles.container_alias_desc') 149 | ,name: 'alias' 150 | ,id: 'modx-resource-alias' 151 | ,maxLength: 100 152 | ,anchor: '100%' 153 | ,value: config.record.alias || '' 154 | },{ 155 | xtype: MODx.expandHelp ? 'label' : 'hidden' 156 | ,forId: 'modx-resource-alias' 157 | ,html: _('articles.container_alias_desc') 158 | ,cls: 'desc-under' 159 | 160 | },{ 161 | xtype: 'textarea' 162 | ,fieldLabel: _('articles.container_description') 163 | ,description: '[[*description]]
'+_('articles.container_description_desc') 164 | ,name: 'description' 165 | ,id: 'modx-resource-description' 166 | ,maxLength: 255 167 | ,anchor: '100%' 168 | ,value: config.record.description || '' 169 | },{ 170 | xtype: MODx.expandHelp ? 'label' : 'hidden' 171 | ,forId: 'modx-resource-description' 172 | ,html: _('articles.container_description_desc') 173 | ,cls: 'desc-under' 174 | 175 | },{ 176 | xtype: 'hidden' 177 | ,name: 'class_key' 178 | ,id: 'modx-resource-class-key' 179 | ,value: 'ArticlesContainer' 180 | }]; 181 | } 182 | 183 | ,getMainRightFields: function(config) { 184 | config = config || {}; 185 | return [{ 186 | xtype: 'textfield' 187 | ,fieldLabel: _('resource_menutitle') 188 | ,description: MODx.expandHelp ? '' : '[[*menutitle]]
'+_('articles.container_menutitle_desc') 189 | ,name: 'menutitle' 190 | ,id: 'modx-resource-menutitle' 191 | ,maxLength: 255 192 | ,anchor: '100%' 193 | ,value: config.record.menutitle || '' 194 | },{ 195 | xtype: MODx.expandHelp ? 'label' : 'hidden' 196 | ,forId: 'modx-resource-menutitle' 197 | ,html: _('articles.container_menutitle_desc') 198 | ,cls: 'desc-under' 199 | 200 | },{ 201 | xtype: 'textfield' 202 | ,fieldLabel: _('resource_link_attributes') 203 | ,description: MODx.expandHelp ? '' : '[[*link_attributes]]
'+_('resource_link_attributes_help') 204 | ,name: 'link_attributes' 205 | ,id: 'modx-resource-link-attributes' 206 | ,maxLength: 255 207 | ,anchor: '100%' 208 | ,value: config.record.link_attributes || '' 209 | },{ 210 | xtype: MODx.expandHelp ? 'label' : 'hidden' 211 | ,forId: 'modx-resource-link-attributes' 212 | ,html: _('resource_link_attributes_help') 213 | ,cls: 'desc-under' 214 | 215 | },{ 216 | xtype: 'xcheckbox' 217 | ,boxLabel: _('resource_hide_from_menus') 218 | ,hideLabel: true 219 | ,description: '[[*hidemenu]]
'+_('resource_hide_from_menus_help') 220 | ,name: 'hidemenu' 221 | ,id: 'modx-resource-hidemenu' 222 | ,inputValue: 1 223 | ,checked: parseInt(config.record.hidemenu) || false 224 | 225 | },{ 226 | xtype: 'xcheckbox' 227 | ,boxLabel: _('resource_published') 228 | ,hideLabel: true 229 | ,description: '[[*published]]
'+_('resource_published_help') 230 | ,name: 'published' 231 | ,id: 'modx-resource-published' 232 | ,inputValue: 1 233 | ,checked: parseInt(config.record.published) 234 | }] 235 | } 236 | 237 | 238 | }); 239 | Ext.reg('articles-panel-container',Articles.panel.Container); -------------------------------------------------------------------------------- /assets/components/articles/js/extras/combo.js: -------------------------------------------------------------------------------- 1 | Articles.combo.Tag = function(config, getStore) { 2 | config = config || {}; 3 | Ext.applyIf(config,{ 4 | name: 'fake_tags' 5 | ,hiddenName: 'fake_tags' 6 | ,displayField: 'tag' 7 | ,valueField: 'tag' 8 | ,fields: ['tag'] 9 | ,mode: 'remote' 10 | ,allowAddNewData: true 11 | ,addNewDataOnBlur : false 12 | ,itemDelimiterKey: 188 13 | ,triggerAction: 'all' 14 | ,typeAheadDelay: 50 15 | ,minChars: 1 16 | ,typeAhead: true 17 | ,editable: true 18 | ,forceSelection: false 19 | ,pageSize: 20 20 | ,url: Articles.connector_url 21 | ,baseParams: {action: 'extras/gettags'} 22 | }); 23 | Ext.applyIf(config,{ 24 | store: new Ext.data.JsonStore({ 25 | url: config.url 26 | ,root: 'results' 27 | ,totalProperty: 'total' 28 | ,fields: config.fields 29 | ,errorReader: MODx.util.JSONReader 30 | ,baseParams: config.baseParams || {} 31 | ,remoteSort: config.remoteSort || false 32 | ,autoDestroy: true 33 | }) 34 | }); 35 | if (getStore === true) { 36 | config.store.load(); 37 | return config.store; 38 | } 39 | Articles.combo.Tag.superclass.constructor.call(this,config); 40 | 41 | this.on('newitem', function(bs,v,f){ 42 | v = v.split(','); 43 | Ext.each(v, function(item){ 44 | item = item.replace(/^\s+|\s+$/g, ''); 45 | var newObj = { 46 | tag: item 47 | }; 48 | bs.addNewItem(newObj); 49 | }); 50 | }); 51 | 52 | this.on('removeitem', function(combo){ 53 | combo.lastQuery = ''; 54 | MODx.fireResourceFormChange(); 55 | }); 56 | 57 | this.on('blur', function(combo){ 58 | if(combo.lastQuery){ 59 | var v = combo.lastQuery.split(','); 60 | Ext.each(v, function(item){ 61 | item = item.replace(/^\s+|\s+$/g, ''); 62 | var newObj = { 63 | tag: item 64 | }; 65 | combo.addNewItem(newObj); 66 | }); 67 | } 68 | }); 69 | 70 | this.config = config; 71 | return this; 72 | }; 73 | Ext.extend(Articles.combo.Tag,Ext.ux.form.SuperBoxSelect,{ 74 | setValue : function(value){ 75 | if(!this.rendered){ 76 | this.value = value; 77 | return; 78 | } 79 | 80 | this.removeAllItems().resetStore(); 81 | this.remoteLookup = []; 82 | 83 | if(Ext.isEmpty(value)){ 84 | return; 85 | } 86 | 87 | var values = value; 88 | if(!Ext.isArray(value)){ 89 | value = '' + value; 90 | values = value.split(this.valueDelimiter); 91 | } 92 | 93 | Ext.each(values,function(val){ 94 | val = val.replace(/^\s+|\s+$/g, ''); 95 | var record = this.findRecord(this.valueField, val); 96 | if(record){ 97 | this.addRecord(record); 98 | }else if(this.mode === 'remote'){ 99 | this.remoteLookup.push(val); 100 | } 101 | },this); 102 | 103 | if(this.mode === 'remote'){ 104 | var q = this.remoteLookup.join(this.queryValuesDelimiter); 105 | this.doQuery(q,false, true); //3rd param to specify a values query 106 | } 107 | 108 | } 109 | }); 110 | Ext.reg('articles-combo-tag',Articles.combo.Tag); -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/bg.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/border.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/border.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/content-bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/content-bg.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/dots.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/dots.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/facebook.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/facebook.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/feed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/feed.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/firefox-gray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/firefox-gray.jpg -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/gravatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/gravatar.jpg -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/header-image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/header-image.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/header-search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/header-search.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/image.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/image.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/left-tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/left-tab.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/quote.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/quote.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/right-tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/right-tab.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/rss-icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/rss-icon.jpg -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/search.gif -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/sh/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/sh/help.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/sh/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/sh/magnifier.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/sh/page_white_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/sh/page_white_code.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/sh/page_white_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/sh/page_white_copy.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/sh/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/sh/printer.png -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/thumb.jpg -------------------------------------------------------------------------------- /assets/components/articles/themes/default/images/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/assets/components/articles/themes/default/images/twitter.png -------------------------------------------------------------------------------- /assets/components/articles/twitter.auth.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once dirname(dirname(dirname(dirname(__FILE__)))).'/config.core.php'; 23 | require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php'; 24 | require_once MODX_CONNECTORS_PATH.'index.php'; 25 | /** 26 | * Sends the user to the Twitter authentication page to authenticate Articles to allow it to post to Twitter 27 | * 28 | * @var modX $modx 29 | * @var array $scriptProperties 30 | * 31 | * @package articles 32 | * @subpackage twitter 33 | */ 34 | $corePath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/'); 35 | require_once $corePath.'model/articles/articlesservice.class.php'; 36 | $articles = new ArticlesService($modx); 37 | $modx->lexicon->load('articles:default'); 38 | 39 | $oAuthPath = $corePath.'model/articles/notification/lib.twitteroauth.php'; 40 | require_once $oAuthPath; 41 | 42 | if (empty($_REQUEST['container'])) die('No container!'); 43 | /** @var ArticlesContainer $container */ 44 | $container = $modx->getObject('ArticlesContainer',$_REQUEST['container']); 45 | if (empty($container)) die('Container not found!'); 46 | 47 | $keys = $container->getTwitterKeys(); 48 | $settings = $container->getProperties('articles'); 49 | define('CONSUMER_KEY',$keys['consumer_key']); 50 | define('CONSUMER_SECRET',$keys['consumer_key_secret']); 51 | 52 | $https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false; 53 | $selfUrl= (!$https || strtolower($https) != 'on') ? 'http://' : 'https://'; 54 | $selfUrl .= $_SERVER['HTTP_HOST']; 55 | if ($_SERVER['SERVER_PORT'] != 80) $selfUrl= str_replace(':' . $_SERVER['SERVER_PORT'], '', $selfUrl); 56 | $selfUrl .= ($_SERVER['SERVER_PORT'] == 80 || ($https !== false || strtolower($https) == 'on')) ? '' : ':' . $_SERVER['SERVER_PORT']; 57 | $selfUrl .= $_SERVER['PHP_SELF']; 58 | 59 | if (empty($_REQUEST['oauth_token']) || empty($_REQUEST['oauth_verifier'])) { 60 | $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); 61 | $selfUrl .= '?container='.$container->get('id'); 62 | $requestToken = $connection->getRequestToken($selfUrl); 63 | if (empty($requestToken)) die('Could not get Request Token.'); 64 | $redirectUrl = $connection->getAuthorizeURL($requestToken); 65 | if (empty($redirectUrl)) die('Could not get redirect to auth page URL.'); 66 | $modx->sendRedirect($redirectUrl); 67 | } else { 68 | $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,$_REQUEST['oauth_token'],$_REQUEST['oauth_verifier']); 69 | $tokenCredentials = $connection->getAccessToken($_REQUEST['oauth_verifier']); 70 | if (empty($tokenCredentials) || empty($tokenCredentials['oauth_token'])) die('Error occurred while trying to get access token.'); 71 | $settings = $container->getProperties('articles'); 72 | $settings['notifyTwitterAccessToken'] = $container->encrypt($tokenCredentials['oauth_token']); 73 | $settings['notifyTwitterAccessTokenSecret'] = $container->encrypt($tokenCredentials['oauth_token_secret']); 74 | $settings['notifyTwitterUsername'] = $tokenCredentials['screen_name']; 75 | $settings['notifyTwitterUserId'] = $tokenCredentials['user_id']; 76 | $container->setProperties($settings,'articles'); 77 | $container->save(); 78 | echo ''; 79 | die(); 80 | } 81 | 82 | return ''; -------------------------------------------------------------------------------- /core/components/articles/controllers/article/create.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/create.class.php'; 23 | /** 24 | * @package articles 25 | */ 26 | class ArticleCreateManagerController extends ResourceCreateManagerController { 27 | 28 | public function loadCustomCssJs() { 29 | $articlesAssetsUrl = $this->modx->getOption('articles.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/articles/'); 30 | $connectorUrl = $articlesAssetsUrl.'connector.php'; 31 | $articlesJsUrl = $articlesAssetsUrl.'js/'; 32 | $mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL); 33 | $this->addJavascript($mgrUrl.'assets/modext/util/datetime.js'); 34 | $this->addJavascript($mgrUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); 35 | $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.grid.resource.security.js'); 36 | $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js'); 37 | $this->addJavascript($mgrUrl.'assets/modext/widgets/resource/modx.panel.resource.js'); 38 | $this->addJavascript($mgrUrl.'assets/modext/sections/resource/create.js'); 39 | $this->addJavascript($articlesJsUrl.'articles.js'); 40 | $this->addJavascript($articlesJsUrl.'extras/combo.js'); 41 | $this->addJavascript($articlesJsUrl.'extras/tagfield.js'); 42 | $this->addLastJavascript($articlesJsUrl.'article/create.js'); 43 | $this->addHtml(' 44 | '); 63 | /* load RTE */ 64 | if (!empty($this->resourceArray['richtext'])) { 65 | $this->loadRichTextEditor(); 66 | } 67 | } 68 | 69 | public function getLanguageTopics() { 70 | return array('resource','articles:default'); 71 | } 72 | 73 | 74 | public function process(array $scriptProperties = array()) { 75 | $placeholders = parent::process($scriptProperties); 76 | $this->resourceArray['published'] = 0; 77 | $this->getDefaultContainerSettings(); 78 | return $placeholders; 79 | } 80 | 81 | public function getDefaultContainerSettings() { 82 | /** @var ArticlesContainer $container */ 83 | $container = $this->modx->getObject('ArticlesContainer',array( 84 | 'id' => $this->parent->get('id'), 85 | )); 86 | if ($container) { 87 | $settings = $container->getProperties('articles'); 88 | $this->resourceArray['template'] = $this->modx->getOption('articleTemplate',$settings,0); 89 | $this->resourceArray['richtext'] = $this->modx->getOption('articlesRichtext',$settings,1); 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /core/components/articles/controllers/article/update.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/update.class.php'; 23 | /** 24 | * @package articles 25 | */ 26 | class ArticleUpdateManagerController extends ResourceUpdateManagerController { 27 | /** @var Article $resource */ 28 | public $resource; 29 | 30 | public function loadCustomCssJs() { 31 | $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig); 32 | $articlesAssetsUrl = $this->modx->getOption('articles.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/articles/'); 33 | $quipAssetsUrl = $this->modx->getOption('quip.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/quip/'); 34 | $connectorUrl = $articlesAssetsUrl.'connector.php'; 35 | $articlesJsUrl = $articlesAssetsUrl.'js/'; 36 | $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); 37 | $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); 38 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.grid.resource.security.js'); 39 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js'); 40 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.js'); 41 | $this->addJavascript($managerUrl.'assets/modext/sections/resource/update.js'); 42 | $this->addJavascript($articlesJsUrl.'articles.js'); 43 | $this->addJavascript($articlesJsUrl.'extras/combo.js'); 44 | $this->addJavascript($articlesJsUrl.'extras/tagfield.js'); 45 | 46 | $this->addCss($quipAssetsUrl.'css/mgr.css'); 47 | $this->addJavascript($quipAssetsUrl.'js/quip.js'); 48 | $this->addJavascript($quipAssetsUrl.'js/widgets/comments.grid.js'); 49 | $this->addHtml(''); 56 | $this->addLastJavascript($articlesJsUrl.'article/update.js'); 57 | $this->addHtml(' 58 | '); 85 | /* load RTE */ 86 | $this->loadRichTextEditor(); 87 | } 88 | public function getLanguageTopics() { 89 | return array('resource','articles:default','quip:default'); 90 | } 91 | 92 | 93 | public function process(array $scriptProperties = array()) { 94 | $placeholders = parent::process($scriptProperties); 95 | $this->getTagsTV(); 96 | 97 | $settings = $this->resource->getContainerSettings(); 98 | $this->resourceArray['commentsEnabled'] = $this->modx->getOption('commentsEnabled',$settings,true); 99 | //$this->resourceArray['richtext'] = $this->modx->getOption('articlesRichtext',$settings,1); 100 | 101 | return $placeholders; 102 | } 103 | 104 | public function getTagsTV() { 105 | /** @var modTemplateVar $tv */ 106 | $tv = $this->modx->getObject('modTemplateVar',array( 107 | 'name' => 'articlestags', 108 | )); 109 | if ($tv) { 110 | $this->resourceArray['tags'] = $this->resource->getTVValue('articlestags'); 111 | $this->resourceArray['tagsId'] = $tv->get('id'); 112 | } 113 | return $tv; 114 | } 115 | } -------------------------------------------------------------------------------- /core/components/articles/controllers/container/create.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/create.class.php'; 23 | /** 24 | * @package articles 25 | */ 26 | class ArticlesContainerCreateManagerController extends ResourceCreateManagerController { 27 | /** @var ArticlesContainer $resource */ 28 | public $resource; 29 | public function loadCustomCssJs() { 30 | $this->prepareResource(); 31 | $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig); 32 | $articlesAssetsUrl = $this->modx->getOption('articles.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/articles/'); 33 | $connectorUrl = $articlesAssetsUrl.'connector.php'; 34 | $articlesJsUrl = $articlesAssetsUrl.'js/'; 35 | $this->resourceArray['articles_container_settings'] = $this->resource->getContainerSettings(); 36 | $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); 37 | $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); 38 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.grid.resource.security.js'); 39 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js'); 40 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.js'); 41 | $this->addJavascript($managerUrl.'assets/modext/sections/resource/create.js'); 42 | $this->addJavascript($articlesJsUrl.'articles.js'); 43 | $this->addJavascript($articlesJsUrl.'container/container.common.js'); 44 | $this->addJavascript($articlesJsUrl.'container/container.articles.grid.js'); 45 | $this->addLastJavascript($articlesJsUrl.'container/create.js'); 46 | $this->addHtml(' 47 | '); 71 | /* load RTE */ 72 | $this->loadRichTextEditor(); 73 | } 74 | public function getLanguageTopics() { 75 | return array('resource','articles:default'); 76 | } 77 | 78 | /** 79 | * Used to set values on the resource record sent to the template for derivative classes 80 | * 81 | * @return void 82 | */ 83 | public function prepareResource() { 84 | $settings = $this->resource->getProperties('articles'); 85 | if (empty($settings)) $settings = array(); 86 | 87 | $defaultContainerTemplate = $this->modx->getOption('articles.default_container_template',$settings,false); 88 | if (empty($defaultContainerTemplate)) { 89 | /** @var modTemplate $template */ 90 | $template = $this->modx->getObject('modTemplate',array('templatename' => 'sample.ArticlesContainerTemplate')); 91 | if ($template) { 92 | $defaultContainerTemplate = $template->get('id'); 93 | } 94 | } 95 | $this->resourceArray['template'] = $defaultContainerTemplate; 96 | 97 | $defaultArticleTemplate = $this->modx->getOption('articles.default_article_template',$settings,false); 98 | if (empty($defaultArticleTemplate)) { 99 | /** @var modTemplate $template */ 100 | $template = $this->modx->getObject('modTemplate',array('templatename' => 'sample.ArticleTemplate')); 101 | if ($template) { 102 | $defaultArticleTemplate = $template->get('id'); 103 | } 104 | } 105 | $this->resourceArray['setting_articleTemplate'] = $defaultArticleTemplate; 106 | 107 | foreach ($settings as $k => $v) { 108 | $this->resourceArray['setting_'.$k] = $v; 109 | } 110 | } 111 | /** 112 | * Return the pagetitle 113 | * 114 | * @return string 115 | */ 116 | public function getPageTitle() { 117 | return $this->modx->lexicon('articles.container_new'); 118 | } 119 | } -------------------------------------------------------------------------------- /core/components/articles/controllers/container/update.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @var modX $modx 24 | */ 25 | require_once $modx->getOption('manager_path',null,MODX_MANAGER_PATH).'controllers/default/resource/update.class.php'; 26 | /** 27 | * @package articles 28 | */ 29 | class ArticlesContainerUpdateManagerController extends ResourceUpdateManagerController { 30 | /** @var ArticlesContainer $resource */ 31 | public $resource; 32 | public function loadCustomCssJs() { 33 | $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig); 34 | $articlesAssetsUrl = $this->modx->getOption('articles.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/articles/'); 35 | $quipAssetsUrl = $this->modx->getOption('quip.assets_url',null,$this->modx->getOption('assets_url',null,MODX_ASSETS_URL).'components/quip/'); 36 | $connectorUrl = $articlesAssetsUrl.'connector.php'; 37 | $articlesJsUrl = $articlesAssetsUrl.'js/'; 38 | $this->addJavascript($managerUrl.'assets/modext/util/datetime.js'); 39 | $this->addJavascript($managerUrl.'assets/modext/widgets/element/modx.panel.tv.renders.js'); 40 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.grid.resource.security.js'); 41 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.tv.js'); 42 | $this->addJavascript($managerUrl.'assets/modext/widgets/resource/modx.panel.resource.js'); 43 | $this->addJavascript($managerUrl.'assets/modext/sections/resource/update.js'); 44 | $this->addJavascript($articlesJsUrl.'articles.js'); 45 | $this->addJavascript($articlesJsUrl.'container/container.common.js'); 46 | $this->addJavascript($articlesJsUrl.'container/container.articles.grid.js'); 47 | $this->addJavascript($articlesJsUrl.'container/articles.import.window.js'); 48 | $this->addLastJavascript($articlesJsUrl.'container/update.js'); 49 | 50 | 51 | $this->addCss($quipAssetsUrl.'css/mgr.css'); 52 | $this->addJavascript($quipAssetsUrl.'js/quip.js'); 53 | $this->addJavascript($quipAssetsUrl.'js/widgets/comments.grid.js'); 54 | $this->addHtml(''); 61 | $settings = $this->resource->getContainerSettings(); 62 | $this->resourceArray['articles_container_settings'] = $settings; 63 | 64 | $this->addHtml(' 65 | '); 93 | /* load RTE */ 94 | $this->loadRichTextEditor(); 95 | } 96 | public function getLanguageTopics() { 97 | return array('resource','articles:default','quip:default'); 98 | } 99 | 100 | /** 101 | * Used to set values on the resource record sent to the template for derivative classes 102 | * 103 | * @return void 104 | */ 105 | public function prepareResource() { 106 | $settings = $this->resource->getProperties('articles'); 107 | if (is_array($settings) && !empty($settings)) { 108 | foreach ($settings as $k => $v) { 109 | $this->resourceArray['setting_'.$k] = $v; 110 | } 111 | } 112 | } 113 | } -------------------------------------------------------------------------------- /core/components/articles/docs/readme.txt: -------------------------------------------------------------------------------- 1 | -------------------- 2 | Articles - 1.7 3 | -------------------- 4 | 5 | First Released: November 29th, 2011 6 | Author: Shaun McCormick 7 | License: GNU GPLv2 (or later at your option) 8 | 9 | This component is a Custom Resource Class for MODX 2.2+. It allows you to easily create Article containers (such as 10 | a Blog, News section, or Events section) on your site, complete with a custom UI for managing them and Articles. 11 | It automatically handles URL archiving, RSS feeds, comments, tags and more. 12 | 13 | Please read the official documentation at: 14 | http://rtfm.modx.com/display/ADDON/Articles 15 | 16 | Thanks for using Articles! 17 | Shaun McCormick 18 | shaun+articles@modx.com -------------------------------------------------------------------------------- /core/components/articles/elements/chunks/archivegroupbyyear.chunk.tpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /core/components/articles/elements/chunks/articlerow.chunk.tpl: -------------------------------------------------------------------------------- 1 |
2 |

[[+pagetitle]]

3 | 4 |
5 |

[[+introtext:default=`[[+content:ellipsis=`400`]]`]]

6 |
7 | 14 |
-------------------------------------------------------------------------------- /core/components/articles/elements/chunks/articleslatestpost.chunk.tpl: -------------------------------------------------------------------------------- 1 |
  • 2 | [[+pagetitle]] 3 | [[+publishedon:notempty=`
    - [[+publishedon:strtotime:date=`%b %d, %Y`]]`]] 4 |
  • -------------------------------------------------------------------------------- /core/components/articles/elements/chunks/articlesrss.chunk.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | [[++site_name]] 5 | [[~[[*id]]?scheme=`full`]] 6 | [[*description:cdata]] 7 | en 8 | Copyright [[+year]] by [[++site_admin]]. All Rights Reserved. 9 | 120 10 | [[+content]] 11 | 12 | -------------------------------------------------------------------------------- /core/components/articles/elements/chunks/articlesrsscategorynode.chunk.tpl: -------------------------------------------------------------------------------- 1 | [[+item]] -------------------------------------------------------------------------------- /core/components/articles/elements/chunks/articlesrssitem.chunk.tpl: -------------------------------------------------------------------------------- 1 | 2 | [[+pagetitle]] 3 | [[~[[+id]]?scheme=`full`]] 4 | [[+introtext:default=`[[+content:ellipsis=`400`]]`:cdata]] 5 | [[+publishedon:strtotime:date=`%a, %d %b %Y %H:%M:%S %z`]] 6 | [[~[[+id]]?scheme=`full`]] 7 | [[+createdby:userinfo=`email`]] ([[+createdby:userinfo=`fullname`]]) 8 | [[!ArticlesStringSplitter? &string=`[[+tv.articlestags]]` &tpl=`sample.ArticlesRssCategoryNode`]] 9 | 10 | -------------------------------------------------------------------------------- /core/components/articles/elements/plugins/articles.plugin.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @var modX $modx 24 | * @var array $scriptProperties 25 | */ 26 | switch ($modx->event->name) { 27 | case 'OnManagerPageInit': 28 | $cssFile = $modx->getOption('articles.assets_url',null,$modx->getOption('assets_url').'components/articles/').'css/mgr.css'; 29 | $modx->regClientCSS($cssFile); 30 | break; 31 | case 'OnPageNotFound': 32 | $corePath = $modx->getOption('articles.core_path',null,$modx->getOption('core_path').'components/articles/'); 33 | require_once $corePath.'model/articles/articlesrouter.class.php'; 34 | $router = new ArticlesRouter($modx); 35 | $router->route(); 36 | return; 37 | case 'OnDocPublished': 38 | /** @var Article $resource */ 39 | $resource =& $scriptProperties['resource']; 40 | if ($resource instanceof Article) { 41 | $resource->setArchiveUri(); 42 | $resource->save(); 43 | $modx->cacheManager->refresh(array( 44 | 'db' => array(), 45 | 'auto_publish' => array('contexts' => array($resource->get('context_key'))), 46 | 'context_settings' => array('contexts' => array($resource->get('context_key'))), 47 | 'resource' => array('contexts' => array($resource->get('context_key'))), 48 | )); 49 | $resource->notifyUpdateServices(); 50 | $resource->sendNotifications(); 51 | } 52 | break; 53 | case 'OnDocUnPublished': 54 | $resource =& $scriptProperties['resource']; 55 | break; 56 | 57 | } 58 | return; -------------------------------------------------------------------------------- /core/components/articles/elements/snippets/snippet.articles.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * Displays a list of posts for a container 24 | * 25 | * @var modX $modx 26 | * @var array $scriptProperties 27 | * 28 | * @package articles 29 | */ 30 | $modx->lexicon->load('articles:frontend'); 31 | 32 | $container = $modx->getOption('container',$scriptProperties,0); 33 | if (empty($container)) return ''; 34 | /** @var ArticlesContainer $container */ 35 | $container = $modx->getObject('ArticlesContainer',$container); 36 | if (empty($container)) return ''; 37 | 38 | $placeholderPrefix = $modx->getOption('placeholderPrefix',$scriptProperties,''); 39 | 40 | $container->getPostListingCall($placeholderPrefix); 41 | $container->getArchivistCall($placeholderPrefix); 42 | $container->getTagListerCall($placeholderPrefix); 43 | $container->getLatestPostsCall($placeholderPrefix); 44 | $settings = $container->getContainerSettings(); 45 | if ($modx->getOption('commentsEnabled',$settings,true)) { 46 | $container->getLatestCommentsCall($placeholderPrefix); 47 | $modx->setPlaceholder($placeholderPrefix.'comments_enabled',1); 48 | } else { 49 | $modx->setPlaceholder($placeholderPrefix.'comments_enabled',0); 50 | } 51 | return ''; -------------------------------------------------------------------------------- /core/components/articles/elements/snippets/snippet.articlesstringsplitter.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @var modX $modx 24 | * @var array $scriptProperties 25 | */ 26 | $string = $modx->getOption('string',$scriptProperties,''); 27 | $delimiter = $modx->getOption('delimiter',$scriptProperties,','); 28 | $tpl = $modx->getOption('tpl',$scriptProperties,'articlerssitem'); 29 | $outputSeparator = $modx->getOption('outputSeparator',$scriptProperties,"\n"); 30 | $outputSeparator = str_replace('\\n',"\n",$outputSeparator); 31 | $toPlaceholder = $modx->getOption('toPlaceholder',$scriptProperties,''); 32 | 33 | $items = explode($delimiter,$string); 34 | $items = array_unique($items); 35 | $list = array(); 36 | foreach ($items as $item) { 37 | $list[] = $modx->getChunk($tpl,array( 38 | 'item' => $item, 39 | )); 40 | } 41 | 42 | $output = implode($outputSeparator,$list); 43 | if (!empty($toPlaceholder)) { 44 | $modx->setPlaceholder($toPlaceholder,$output); 45 | return ''; 46 | } 47 | return $output; -------------------------------------------------------------------------------- /core/components/articles/elements/templates/articlescontainertemplate.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Articles - [[*pagetitle]] 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 | 34 |
    35 | 36 |
    37 | 38 | 39 |
    40 | [[*content]] 41 |
    42 | 43 | 44 | 45 | 46 |
    47 |
    48 | 49 |
    50 |

    Latest Posts

    51 |
      52 | [[+latest_posts]] 53 |
    54 |
    55 | 56 | [[+comments_enabled:is=`1`:then=` 57 |
    58 |

    Latest Comments

    59 |
      60 | [[+latest_comments]] 61 |
    62 |
    63 | `]] 64 | 65 | 66 |
    67 | 68 |
    69 | 70 | 71 |
    72 | 73 | 74 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /core/components/articles/elements/templates/articletemplate.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Articles - [[*pagetitle]] 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 | 33 |
    34 | 35 |
    36 | 37 | 38 |
    39 |

    [[*pagetitle]]

    40 | 47 |
    48 |

    [[*introtext]]

    49 |
    50 | [[*content]] 51 |
    52 | 53 |
    54 | 55 |
    56 | [[+comments]] 57 |
    58 |

    Add a Comment

    59 | [[+comments_form]] 60 |
    61 |
    62 | 63 |
    64 |
    65 | 66 |
    67 |

    Latest Posts

    68 |
      69 | [[+latest_posts]] 70 |
    71 |
    72 | 73 | [[+comments_enabled:is=`1`:then=` 74 |
    75 |

    Latest Comments

    76 |
      77 | [[+latest_comments]] 78 |
    79 |
    80 | `]] 81 |
    82 | 83 |
    84 | 85 | 86 | 87 |
    88 | 89 | 90 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /core/components/articles/lexicon/cs/frontend.inc.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/core/components/articles/lexicon/cs/frontend.inc.php -------------------------------------------------------------------------------- /core/components/articles/lexicon/de/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | * @subpackage lexicon 22 | * 23 | * @language de 24 | * Articles translated to German by Jan-Christoph Ihrens (enigmatic_user, enigma@lunamail.de) 25 | */ 26 | $_lang['articles.comments'] = 'Kommentare'; 27 | $_lang['articles.posted_by'] = 'Gepostet von'; 28 | $_lang['articles.read_more'] = 'Lesen Sie mehr'; 29 | $_lang['articles.tags'] = 'Tags'; -------------------------------------------------------------------------------- /core/components/articles/lexicon/en/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | $_lang['articles.comments'] = 'Comments'; 23 | $_lang['articles.posted_by'] = 'Posted by'; 24 | $_lang['articles.read_more'] = 'Read more'; 25 | $_lang['articles.tags'] = 'Tags'; -------------------------------------------------------------------------------- /core/components/articles/lexicon/fr/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | $_lang['articles.comments'] = 'Commentaires'; 23 | $_lang['articles.posted_by'] = 'Posté par'; 24 | $_lang['articles.read_more'] = 'Lire la suite'; 25 | $_lang['articles.tags'] = 'Tags'; -------------------------------------------------------------------------------- /core/components/articles/lexicon/it/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | * @subpackage lexicon 22 | * 23 | * @language it 24 | * Articles translated to Italian by tillilab 25 | */ 26 | $_lang['articles.comments'] = 'Commenti'; 27 | $_lang['articles.posted_by'] = 'Autore:'; 28 | $_lang['articles.read_more'] = 'Leggi tutto'; 29 | $_lang['articles.tags'] = 'Tags'; -------------------------------------------------------------------------------- /core/components/articles/lexicon/nl/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | $_lang['articles.comments'] = 'Reacties'; 23 | $_lang['articles.posted_by'] = 'Gepost door'; 24 | $_lang['articles.read_more'] = 'Meer'; 25 | $_lang['articles.tags'] = 'Tags (komma-gescheiden)'; -------------------------------------------------------------------------------- /core/components/articles/lexicon/ru/frontend.inc.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | * 22 | * @language ru 23 | * Articles translated to Russian by Ivan Klimchuk (Alroniks, ivan@klimchuk.com) 24 | */ 25 | $_lang['articles.comments'] = 'Комментарии'; 26 | $_lang['articles.posted_by'] = 'Опубликовано'; 27 | $_lang['articles.read_more'] = 'Читать дальше'; 28 | $_lang['articles.tags'] = 'Теги'; -------------------------------------------------------------------------------- /core/components/articles/model/articles/articlesrouter.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | class ArticlesRouter { 23 | /** @var modX $modx */ 24 | public $modx; 25 | /** @var array $config */ 26 | public $config = array(); 27 | 28 | function __construct(modX &$modx,array $config = array()) { 29 | $this->modx =& $modx; 30 | $this->config = array_merge(array( 31 | 32 | ),$config); 33 | } 34 | 35 | /** 36 | * Route the URL request based on the container IDs 37 | * @return boolean 38 | */ 39 | public function route() { 40 | $containerIds = $this->modx->getOption('articles.container_ids',null,''); 41 | if (empty($containerIds)) return false; 42 | $containerIds = explode(',',$containerIds); 43 | 44 | /* handle redirects */ 45 | $search = $_SERVER['REQUEST_URI']; 46 | $base_url = $this->modx->getOption('base_url'); 47 | if ($base_url != '/') { 48 | $search = str_replace($base_url,'',$search); 49 | } 50 | $search = trim($search, '/'); 51 | 52 | /* get resource to redirect to */ 53 | $resourceId = false; 54 | $prefix = 'arc_'; 55 | foreach ($containerIds as $archive) { 56 | $archive = explode(':',$archive); 57 | $archiveId = $archive[0]; 58 | if(is_array($this->modx->aliasMap)) { 59 | $alias = array_search($archiveId,$this->modx->aliasMap); 60 | if ($alias && strpos($search,$alias) !== false) { 61 | $search = str_replace($alias,'',$search); 62 | $resourceId = $archiveId; 63 | if (isset($archive[1])) $prefix = $archive[1]; 64 | } 65 | } 66 | } 67 | if (!$resourceId) return false; 68 | 69 | /* figure out archiving */ 70 | $params = explode('/', $search); 71 | if (count($params) < 1) return false; 72 | 73 | /* tag handling! */ 74 | if ($params[0] == 'tags') { 75 | $_GET['tag'] = $params[1]; 76 | /* author based */ 77 | } else if ($params[0] == 'user' || $params[0] == 'author') { 78 | $_GET[$prefix.'author'] = $params[1]; 79 | 80 | /* numeric "archives/1234" */ 81 | } else if ($params[0] == 'archives' && !empty($params[1])) { 82 | $resourceId = intval(trim(trim($params[1]),'/')); 83 | if (!empty($resourceId)) { 84 | $this->modx->sendForward($resourceId); 85 | } 86 | 87 | /* normal yyyy/mm/dd or yyyy/mm */ 88 | } else { 89 | /* set Archivist parameters for date-based archives */ 90 | $_GET[$prefix.'year'] = $params[0]; 91 | if (isset($params[1])) $_GET[$prefix.'month'] = $params[1]; 92 | if (isset($params[2])) $_GET[$prefix.'day'] = $params[2]; 93 | } 94 | 95 | /* forward */ 96 | $this->modx->sendForward($resourceId); 97 | return true; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /core/components/articles/model/articles/articlesservice.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * The base service class for Articles. 24 | * 25 | * @package articles 26 | */ 27 | class ArticlesService { 28 | /** 29 | * A reference to the modX instance 30 | * @var modX $modx 31 | */ 32 | public $modx; 33 | /** 34 | * An array of configuration properties 35 | * @var array $config 36 | */ 37 | public $config; 38 | /** 39 | * An array of cached chunks used for faster processing 40 | * 41 | * @var array $chunks 42 | */ 43 | public $chunks; 44 | 45 | /** 46 | * Create an instance of ArticlesService. 47 | * 48 | * @param modX $modx A reference to the modX object 49 | * @param array $config A configuration array 50 | */ 51 | function __construct(modX &$modx,array $config = array()) { 52 | $this->modx =& $modx; 53 | 54 | $corePath = $this->modx->getOption('articles.core_path',$config,$this->modx->getOption('core_path').'components/articles/'); 55 | $assetsUrl = $this->modx->getOption('articles.assets_url',$config,$this->modx->getOption('assets_url').'components/articles/'); 56 | $connectorUrl = $assetsUrl.'connector.php'; 57 | 58 | $this->config = array_merge(array( 59 | 'assetsUrl' => $assetsUrl, 60 | 'cssUrl' => $assetsUrl.'css/', 61 | 'jsUrl' => $assetsUrl.'js/', 62 | 'imagesUrl' => $assetsUrl.'images/', 63 | 64 | 'connectorUrl' => $connectorUrl, 65 | 66 | 'corePath' => $corePath, 67 | 'modelPath' => $corePath.'model/', 68 | 'elementsPath' => $corePath.'elements/', 69 | 'snippetsPath' => $corePath.'elements/snippets/', 70 | 'tvsPath' => $corePath.'elements/tvs/', 71 | 'chunksPath' => $corePath.'elements/chunks/', 72 | 'chunkSuffix' => '.chunk.tpl', 73 | 'processorsPath' => $corePath.'processors/', 74 | ),$config); 75 | $this->modx->lexicon->load('articles:default'); 76 | } 77 | 78 | /** 79 | * Gets a Chunk and caches it; also falls back to file-based templates 80 | * for easier debugging. 81 | * 82 | * @access public 83 | * @param string $name The name of the Chunk 84 | * @param array $properties The properties for the Chunk 85 | * @return string The processed content of the Chunk 86 | */ 87 | public function getChunk($name,array $properties = array()) { 88 | $chunk = null; 89 | if (!isset($this->chunks[$name])) { 90 | $chunk = $this->modx->getObject('modChunk',array('name' => $name),true); 91 | if (empty($chunk)) { 92 | $chunk = $this->_getTplChunk($name,$this->config['chunkSuffix']); 93 | if ($chunk == false) return false; 94 | } 95 | $this->chunks[$name] = $chunk->getContent(); 96 | } else { 97 | $o = $this->chunks[$name]; 98 | $chunk = $this->modx->newObject('modChunk'); 99 | $chunk->setContent($o); 100 | } 101 | $chunk->setCacheable(false); 102 | return $chunk->process($properties); 103 | } 104 | 105 | /** 106 | * Returns a modChunk object from a template file. 107 | * 108 | * @access private 109 | * @param string $name The name of the Chunk. Will parse to name.chunk.tpl by default. 110 | * @param string $suffix The suffix to add to the chunk filename. 111 | * @return modChunk/boolean Returns the modChunk object if found, otherwise 112 | * false. 113 | */ 114 | private function _getTplChunk($name,$suffix = '.chunk.tpl') { 115 | $chunk = false; 116 | $f = $this->config['chunksPath'].strtolower($name).$suffix; 117 | if (file_exists($f)) { 118 | $o = file_get_contents($f); 119 | /** @var modChunk $chunk */ 120 | $chunk = $this->modx->newObject('modChunk'); 121 | $chunk->set('name',$name); 122 | $chunk->setContent($o); 123 | } 124 | return $chunk; 125 | } 126 | 127 | public static function arrayUnique($arr){ 128 | return array_keys(array_flip($arr)); 129 | } 130 | 131 | } -------------------------------------------------------------------------------- /core/components/articles/model/articles/import/articlesimport.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @abstract 24 | * @package articles 25 | * @subpackage import 26 | */ 27 | abstract class ArticlesImport { 28 | /** @var modX $xpdo */ 29 | public $modx; 30 | /** @var ArticlesService $articles */ 31 | public $articles; 32 | /** @var array $config */ 33 | public $config = array(); 34 | /** @var boolean $debug */ 35 | public $debug = false; 36 | /** @var ContainerImportProcessor $processor */ 37 | public $processor; 38 | 39 | function __construct(ArticlesService $articles,ContainerImportProcessor $processor,array $config = array()) { 40 | $this->articles =& $articles; 41 | $this->processor =& $processor; 42 | $this->modx =& $articles->modx; 43 | $this->config = array_merge(array( 44 | 45 | ),$config); 46 | if (!empty($this->config['id'])) { 47 | $this->config['id'] = trim(trim($this->config['id'],'#')); 48 | } 49 | 50 | $this->initialize(); 51 | } 52 | 53 | /** 54 | * Initialize the importer and load the Quip package 55 | */ 56 | public function initialize() { 57 | @set_time_limit(0); 58 | @ini_set('memory_limit','1024M'); 59 | $quipPath = $this->modx->getOption('quip.core_path',null,$this->modx->getOption('core_path').'components/quip/'); 60 | $this->modx->addPackage('quip',$quipPath.'model/'); 61 | } 62 | 63 | /** 64 | * Abstract method that is called to import from a specific service. 65 | * @abstract 66 | * @return boolean 67 | */ 68 | abstract public function import(); 69 | 70 | /** 71 | * Add an error to the response 72 | * @param string $field 73 | * @param string $message 74 | * @return mixed 75 | */ 76 | public function addError($field,$message = '') { 77 | return $this->processor->addFieldError($field,$message); 78 | } 79 | } -------------------------------------------------------------------------------- /core/components/articles/model/articles/import/articlesimportmodx.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once (dirname(__FILE__).'/articlesimport.class.php'); 23 | /** 24 | * @package articles 25 | * @subpackage import 26 | */ 27 | class ArticlesImportMODX extends ArticlesImport { 28 | /** @var ArticlesContainer $container */ 29 | public $container; 30 | 31 | public function import() { 32 | $imported = false; 33 | $this->container = $this->modx->getObject('ArticlesContainer',$this->config['id']); 34 | 35 | $c = $this->getQuery(); 36 | if ($c === false) return $imported; 37 | 38 | $resources = $this->modx->getIterator('modResource',$c); 39 | if (empty($resources)) { 40 | $this->processor->addFieldError('parents','No resources found!'); 41 | return false; 42 | } 43 | foreach ($resources as $resource) { 44 | $imported = $this->importResource($resource); 45 | } 46 | return $imported; 47 | } 48 | 49 | public function getQuery() { 50 | $c = $this->modx->newQuery('modResource'); 51 | $c->select($this->modx->getSelectColumns('modResource','modResource')); 52 | $where = array(); 53 | 54 | /* parents */ 55 | $ids = array(); 56 | if (!empty($this->config['modx-parents'])) { 57 | $parents = is_array($this->config['modx-parents']) ? $this->config['modx-parents'] : explode(',',$this->config['modx-parents']); 58 | foreach ($parents as $parent) { 59 | /** @var modResource $parentResource */ 60 | $parentResource = $this->modx->getObject('modResource',$parent); 61 | if (!$parentResource) continue; 62 | 63 | $children = $this->modx->getChildIds($parent,10,array( 64 | 'context' => $parentResource->get('context_key'), 65 | )); 66 | $ids = array_merge($ids,$children); 67 | } 68 | } 69 | 70 | /* specific resources */ 71 | $exclude = array(); 72 | $include = array(); 73 | if (!empty($this->config['modx-resources'])) { 74 | $resources = is_array($this->config['modx-resources']) ? $this->config['modx-resources'] : explode(',',$this->config['modx-resources']); 75 | foreach ($resources as $resourceId) { 76 | if (strpos($resourceId,'-') === 0) { 77 | $exclude[] = intval(substr($resourceId,1)); 78 | } else { 79 | $include[] = intval($resourceId); 80 | } 81 | } 82 | } 83 | $ids = array_merge($ids,$include); 84 | sort($ids); 85 | $ids = array_unique($ids); 86 | if (!empty($ids)) { 87 | $where['id:IN'] = $ids; 88 | } 89 | 90 | $exclude = array_unique($exclude); 91 | if (!empty($exclude)) { 92 | $where['id:NOT IN'] = $exclude; 93 | } 94 | 95 | /* template */ 96 | if (!empty($this->config['modx-template'])) { 97 | $where['template'] = $this->config['modx-template']; 98 | } 99 | 100 | if (isset($this->config['modx-unpublished']) && empty($this->config['modx-unpublished'])) { 101 | $where['published'] = 1; 102 | } 103 | 104 | if (isset($this->config['modx-hidemenu']) && empty($this->config['modx-hidemenu'])) { 105 | $where['hidemenu'] = 0; 106 | } 107 | 108 | if (empty($where)) { 109 | $this->addError('modx-parents',$this->modx->lexicon('articles.import_modx_err_no_criteria')); 110 | return false; 111 | } 112 | 113 | /* dont let them get the site start */ 114 | $where['id:!='] = array((int)$this->modx->getOption('site_start',null,1)); 115 | 116 | $where['isfolder'] = false; 117 | $where['class_key:!='] = 'Article'; 118 | $c->where($where); 119 | 120 | if (!empty($this->config['modx-tagsField'])) { 121 | $this->getTagsQuery($c); 122 | } 123 | return $c; 124 | } 125 | 126 | /** 127 | * Get the nice little query to get the tags field 128 | * @param xPDOQuery $c 129 | */ 130 | public function getTagsQuery(xPDOQuery &$c) { 131 | $tagsField = $this->config['modx-tagsField']; 132 | $isTV = true; 133 | if (intval($tagsField) > 0) { 134 | $tagsField = array('id' => $tagsField); 135 | } else { 136 | if (strpos($tagsField,'tv.') === 0) { 137 | $tagsField = array('name' => str_replace('tv.','',$tagsField)); 138 | } else { 139 | $isTV = false; 140 | } 141 | } 142 | 143 | if ($isTV) { 144 | /** @var modTemplateVar $tv */ 145 | $tv = $this->modx->getObject('modTemplateVar',$tagsField); 146 | if ($tv) { 147 | $c->leftJoin('modTemplateVarResource','Tags',array( 148 | 'Tags.contentid = modResource.id', 149 | 'Tags.tmplvarid' => $tv->get('id'), 150 | )); 151 | $c->select(array( 152 | 'tags' => 'Tags.value', 153 | )); 154 | } 155 | } else { 156 | $c->select(array( 157 | 'tags' => $tagsField, 158 | )); 159 | } 160 | } 161 | 162 | /** 163 | * Import the Resource into Articles 164 | * 165 | * @param modResource $resource 166 | * @return boolean 167 | */ 168 | public function importResource(modResource $resource) { 169 | $resource->set('searchable',true); 170 | $resource->set('richtext',true); 171 | $resource->set('isfolder',false); 172 | $resource->set('cacheable',true); 173 | $resource->set('class_key','Article'); 174 | $resource->set('parent',$this->container->get('id')); 175 | $settings = $this->container->getProperties('articles'); 176 | $resource->setProperties($settings,'articles'); 177 | 178 | if (!empty($this->config['modx-change-template'])) { 179 | $resource->set('template',$settings['articleTemplate']); 180 | } 181 | 182 | $this->setResourceUri($resource); 183 | if (!empty($this->config['modx-commentsThreadNameFormat'])) { 184 | $this->importComments($resource); 185 | } 186 | 187 | $saved = true; 188 | if (!$this->debug) { 189 | $saved = $resource->save(); 190 | if ($saved) { 191 | $resource->setTVValue('articlestags',$resource->get('tags')); 192 | } 193 | } 194 | 195 | return $saved; 196 | } 197 | 198 | /** 199 | * Set the new Articles-based URI 200 | * @param modResource $resource 201 | */ 202 | public function setResourceUri(modResource &$resource) { 203 | $date = $resource->get('published') ? $resource->get('publishedon') : $resource->get('createdon'); 204 | $year = date('Y',strtotime($date)); 205 | $month = date('m',strtotime($date)); 206 | $day = date('d',strtotime($date)); 207 | 208 | $containerUri = $this->container->get('uri'); 209 | if (empty($containerUri)) { 210 | $containerUri = $this->container->get('alias'); 211 | } 212 | $uri = rtrim($containerUri,'/').'/'.$year.'/'.$month.'/'.$day.'/'.$resource->get('alias'); 213 | 214 | $resource->set('uri',rtrim($uri,'/').'/'); 215 | $resource->set('uri_override',true); 216 | } 217 | 218 | /** 219 | * If set, import any comments from Quip 220 | * @param modResource $resource 221 | * @return boolean 222 | */ 223 | public function importComments(modResource &$resource) { 224 | $threadFormat = $this->config['modx-commentsThreadNameFormat']; 225 | if (empty($threadFormat)) return true; 226 | 227 | $imported = true; 228 | $threadFormat = str_replace(array('[[*id]]','[[+id]]'),$resource->get('id'),$threadFormat); 229 | /** @var quipThread $thread */ 230 | $thread = $this->modx->getObject('quipThread',array('name' => $threadFormat)); 231 | if ($thread) { 232 | $newThreadName = 'article-b'.$this->container->get('id').'-'.$resource->get('id'); 233 | 234 | $sql = 'UPDATE '.$this->modx->getTableName('quipComment') 235 | .' SET '.$this->modx->escape('thread').' = "'.$newThreadName.'"' 236 | .' WHERE '.$this->modx->escape('thread').' = "'.$thread->get('name').'"'; 237 | if (!$this->debug) { 238 | $this->modx->exec($sql); 239 | } 240 | 241 | $sql = 'UPDATE '.$this->modx->getTableName('quipThread') 242 | .' SET '.$this->modx->escape('name').' = "'.$newThreadName.'"' 243 | .' WHERE '.$this->modx->escape('name').' = "'.$thread->get('name').'"'; 244 | if (!$this->debug) { 245 | $this->modx->exec($sql); 246 | } 247 | $imported = true; 248 | } else { 249 | $this->modx->log(modX::LOG_LEVEL_ERROR,'[Articles] Could not find Quip Thread with thread name: '.$threadFormat); 250 | } 251 | return $imported; 252 | } 253 | } -------------------------------------------------------------------------------- /core/components/articles/model/articles/import/articlesimportwordpress.class.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/splittingred/Articles/b4628c316651cf15514f7860b5966ead020628c3/core/components/articles/model/articles/import/articlesimportwordpress.class.php -------------------------------------------------------------------------------- /core/components/articles/model/articles/metadata.mysql.php: -------------------------------------------------------------------------------- 1 | 5 | array ( 6 | 0 => 'ArticlesContainer', 7 | 1 => 'Article', 8 | ), 9 | ); -------------------------------------------------------------------------------- /core/components/articles/model/articles/mysql/article.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | */ 25 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/article.class.php'); 26 | class Article_mysql extends Article {} -------------------------------------------------------------------------------- /core/components/articles/model/articles/mysql/article.map.inc.php: -------------------------------------------------------------------------------- 1 | 'Articles', 7 | 'aggregates' => 8 | array ( 9 | 'Container' => 10 | array ( 11 | 'class' => 'ArticlesContainer', 12 | 'local' => 'parent', 13 | 'foreign' => 'id', 14 | 'cardinality' => 'one', 15 | 'owner' => 'foreign', 16 | ), 17 | ), 18 | ); 19 | -------------------------------------------------------------------------------- /core/components/articles/model/articles/mysql/articlescontainer.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | */ 25 | require_once (strtr(realpath(dirname(dirname(__FILE__))), '\\', '/') . '/articlescontainer.class.php'); 26 | class ArticlesContainer_mysql extends ArticlesContainer {} -------------------------------------------------------------------------------- /core/components/articles/model/articles/mysql/articlescontainer.map.inc.php: -------------------------------------------------------------------------------- 1 | 'Articles', 7 | 'composites' => 8 | array ( 9 | 'Articles' => 10 | array ( 11 | 'class' => 'Article', 12 | 'local' => 'id', 13 | 'foreign' => 'parent', 14 | 'cardinality' => 'many', 15 | 'owner' => 'local', 16 | ), 17 | ), 18 | ); 19 | -------------------------------------------------------------------------------- /core/components/articles/model/articles/notification/articlesnotification.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * Base abstract class for notification senders 24 | * 25 | * @package articles 26 | * @subpackage notifications 27 | */ 28 | abstract class ArticlesNotification { 29 | /** @var modX $xpdo */ 30 | public $modx; 31 | /** @var Article $article */ 32 | public $article; 33 | /** @var array $config */ 34 | public $config = array(); 35 | 36 | function __construct(Article $article,array $config = array()) { 37 | $this->article =& $article; 38 | $this->modx =& $article->xpdo; 39 | $this->config = array_merge(array( 40 | 41 | ),$config); 42 | } 43 | 44 | /** 45 | * @abstract 46 | * @param string $title The title of the Article 47 | * @param string $url The full URL of the Article 48 | * @return boolean 49 | */ 50 | abstract public function send($title,$url); 51 | } -------------------------------------------------------------------------------- /core/components/articles/model/articles/notification/lib.twitteroauth.php: -------------------------------------------------------------------------------- 1 | http_status; } 54 | function lastAPICall() { return $this->last_api_call; } 55 | 56 | /** 57 | * construct TwitterOAuth object 58 | */ 59 | function __construct($consumer_key, $consumer_secret, $oauth_token = NULL, $oauth_token_secret = NULL) { 60 | $this->sha1_method = new OAuthSignatureMethod_HMAC_SHA1(); 61 | $this->consumer = new OAuthConsumer($consumer_key, $consumer_secret); 62 | if (!empty($oauth_token) && !empty($oauth_token_secret)) { 63 | $this->token = new OAuthConsumer($oauth_token, $oauth_token_secret); 64 | } else { 65 | $this->token = NULL; 66 | } 67 | } 68 | 69 | 70 | /** 71 | * Get a request_token from Twitter 72 | * 73 | * @returns a key/value array containing oauth_token and oauth_token_secret 74 | */ 75 | function getRequestToken($oauth_callback = NULL) { 76 | $parameters = array(); 77 | if (!empty($oauth_callback)) { 78 | $parameters['oauth_callback'] = $oauth_callback; 79 | } 80 | $request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters); 81 | $token = OAuthUtil::parse_parameters($request); 82 | $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); 83 | return $token; 84 | } 85 | 86 | /** 87 | * Get the authorize URL 88 | * 89 | * @returns a string 90 | */ 91 | function getAuthorizeURL($token, $sign_in_with_twitter = TRUE) { 92 | if (is_array($token)) { 93 | $token = $token['oauth_token']; 94 | } 95 | if (empty($sign_in_with_twitter)) { 96 | return $this->authorizeURL() . "?oauth_token={$token}"; 97 | } else { 98 | return $this->authenticateURL() . "?oauth_token={$token}"; 99 | } 100 | } 101 | 102 | /** 103 | * Exchange request token and secret for an access token and 104 | * secret, to sign API calls. 105 | * 106 | * @returns array("oauth_token" => "the-access-token", 107 | * "oauth_token_secret" => "the-access-secret", 108 | * "user_id" => "9436992", 109 | * "screen_name" => "abraham") 110 | */ 111 | function getAccessToken($oauth_verifier = FALSE) { 112 | $parameters = array(); 113 | if (!empty($oauth_verifier)) { 114 | $parameters['oauth_verifier'] = $oauth_verifier; 115 | } 116 | $request = $this->oAuthRequest($this->accessTokenURL(), 'GET', $parameters); 117 | $token = OAuthUtil::parse_parameters($request); 118 | $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); 119 | return $token; 120 | } 121 | 122 | /** 123 | * One time exchange of username and password for access token and secret. 124 | * 125 | * @returns array("oauth_token" => "the-access-token", 126 | * "oauth_token_secret" => "the-access-secret", 127 | * "user_id" => "9436992", 128 | * "screen_name" => "abraham", 129 | * "x_auth_expires" => "0") 130 | */ 131 | function getXAuthToken($username, $password) { 132 | $parameters = array(); 133 | $parameters['x_auth_username'] = $username; 134 | $parameters['x_auth_password'] = $password; 135 | $parameters['x_auth_mode'] = 'client_auth'; 136 | $request = $this->oAuthRequest($this->accessTokenURL(), 'POST', $parameters); 137 | $token = OAuthUtil::parse_parameters($request); 138 | $this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']); 139 | return $token; 140 | } 141 | 142 | /** 143 | * GET wrapper for oAuthRequest. 144 | */ 145 | function get($url, $parameters = array()) { 146 | $response = $this->oAuthRequest($url, 'GET', $parameters); 147 | if ($this->format === 'json' && $this->decode_json) { 148 | return json_decode($response); 149 | } 150 | return $response; 151 | } 152 | 153 | /** 154 | * POST wrapper for oAuthRequest. 155 | */ 156 | function post($url, $parameters = array()) { 157 | $response = $this->oAuthRequest($url, 'POST', $parameters); 158 | if ($this->format === 'json' && $this->decode_json) { 159 | return json_decode($response); 160 | } 161 | return $response; 162 | } 163 | 164 | /** 165 | * DELETE wrapper for oAuthReqeust. 166 | */ 167 | function delete($url, $parameters = array()) { 168 | $response = $this->oAuthRequest($url, 'DELETE', $parameters); 169 | if ($this->format === 'json' && $this->decode_json) { 170 | return json_decode($response); 171 | } 172 | return $response; 173 | } 174 | 175 | /** 176 | * Format and sign an OAuth / API request 177 | */ 178 | function oAuthRequest($url, $method, $parameters) { 179 | if (strrpos($url, 'https://') !== 0 && strrpos($url, 'http://') !== 0) { 180 | $url = "{$this->host}{$url}.{$this->format}"; 181 | } 182 | $request = OAuthRequest::from_consumer_and_token($this->consumer, $this->token, $method, $url, $parameters); 183 | $request->sign_request($this->sha1_method, $this->consumer, $this->token); 184 | switch ($method) { 185 | case 'GET': 186 | return $this->http($request->to_url(), 'GET'); 187 | default: 188 | return $this->http($request->get_normalized_http_url(), $method, $request->to_postdata()); 189 | } 190 | } 191 | 192 | /** 193 | * Make an HTTP request 194 | * 195 | * @return API results 196 | */ 197 | function http($url, $method, $postfields = NULL) { 198 | $this->http_info = array(); 199 | $ci = curl_init(); 200 | /* Curl settings */ 201 | curl_setopt($ci, CURLOPT_USERAGENT, $this->useragent); 202 | curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, $this->connecttimeout); 203 | curl_setopt($ci, CURLOPT_TIMEOUT, $this->timeout); 204 | curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE); 205 | curl_setopt($ci, CURLOPT_HTTPHEADER, array('Expect:')); 206 | curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, $this->ssl_verifypeer); 207 | curl_setopt($ci, CURLOPT_HEADERFUNCTION, array($this, 'getHeader')); 208 | curl_setopt($ci, CURLOPT_HEADER, FALSE); 209 | 210 | switch ($method) { 211 | case 'POST': 212 | curl_setopt($ci, CURLOPT_POST, TRUE); 213 | if (!empty($postfields)) { 214 | curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields); 215 | } 216 | break; 217 | case 'DELETE': 218 | curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'DELETE'); 219 | if (!empty($postfields)) { 220 | $url = "{$url}?{$postfields}"; 221 | } 222 | } 223 | 224 | curl_setopt($ci, CURLOPT_URL, $url); 225 | $response = curl_exec($ci); 226 | $this->http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE); 227 | $this->http_info = array_merge($this->http_info, curl_getinfo($ci)); 228 | $this->url = $url; 229 | curl_close ($ci); 230 | return $response; 231 | } 232 | 233 | /** 234 | * Get the header info to store. 235 | */ 236 | function getHeader($ch, $header) { 237 | $i = strpos($header, ':'); 238 | if (!empty($i)) { 239 | $key = str_replace('-', '_', strtolower(substr($header, 0, $i))); 240 | $value = trim(substr($header, $i + 2)); 241 | $this->http_header[$key] = $value; 242 | } 243 | return strlen($header); 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /core/components/articles/model/articles/update/articlespingomatic.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | require_once (dirname(__FILE__).'/articlesupdateservice.class.php'); 23 | /** 24 | * @package articles 25 | * @subpackage updateservices 26 | */ 27 | class ArticlesPingomatic extends ArticlesUpdateService { 28 | public $ch; 29 | 30 | public function notify($title,$url) { 31 | $request=''. 32 | ''. 33 | ' weblogUpdates.ping'. 34 | ' '. 35 | ' '. 36 | ' '.$title.''. 37 | ' '. 38 | ' '. 39 | ' '.$url.''. 40 | ' '. 41 | ' '. 42 | ''; 43 | $this->prepareQuery($request); 44 | $result = $this->query(); 45 | if (empty($result)) { 46 | $this->modx->log(modX::LOG_LEVEL_ERROR,'Could not connect to pingomatic!'); 47 | return false; 48 | } 49 | return $this->processResult($result,$title,$url); 50 | } 51 | 52 | public function prepareQuery($request) { 53 | $server = $this->modx->getOption('articles.pingomatic_server',null,'http://rpc.pingomatic.com/'); 54 | $this->ch = curl_init(); 55 | curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true); 56 | curl_setopt($this->ch, CURLOPT_URL, $server); 57 | curl_setopt($this->ch, CURLOPT_HTTPHEADER, 58 | array( 59 | 'Content-type: text/xml', 60 | 'Content-length: '.strlen($request), 61 | 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5 (.NET CLR 3.5.30729', 62 | ) 63 | ); 64 | curl_setopt($this->ch, CURLOPT_POST, true); 65 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request); 66 | return $this->ch; 67 | } 68 | 69 | public function query() { 70 | return curl_exec($this->ch); 71 | } 72 | 73 | public function processResult($result,$title,$url) { 74 | $success = false; 75 | try { 76 | /** @var SimpleXMLElement $xml */ 77 | $xml = simplexml_load_string($result); 78 | if ($xml->params && $xml->params->param && $xml->params->param->value && $xml->params->param->value->struct && $xml->params->param->value->struct->member && $xml->params->param->value->struct->member[0]) { 79 | $errorCode = $xml->params->param->value->struct->member[0]; 80 | $errorMessage = $xml->params->param->value->struct->member[1]; 81 | if ((string)$errorCode->value->boolean == '1') { 82 | $this->modx->log(modX::LOG_LEVEL_ERROR,'[Articles] Pingomatic error: '.$errorMessage->value->string); 83 | } else { 84 | $this->modx->log(modX::LOG_LEVEL_INFO,'[Articles] Sent Ping-o-matic request for "'.$title.'" at URL: '.$url); 85 | $success = true; 86 | } 87 | } 88 | } catch (Exception $e) { 89 | $this->modx->log(modX::LOG_LEVEL_ERROR,'[Articles] '.$e->getMessage()); 90 | } 91 | return $success; 92 | } 93 | } -------------------------------------------------------------------------------- /core/components/articles/model/articles/update/articlesupdateservice.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage updateservices 25 | */ 26 | abstract class ArticlesUpdateService { 27 | /** @var modX $xpdo */ 28 | public $modx; 29 | /** @var Article $article */ 30 | public $article; 31 | /** @var array $config */ 32 | public $config = array(); 33 | 34 | function __construct(Article $article,array $config = array()) { 35 | $this->article =& $article; 36 | $this->modx =& $article->xpdo; 37 | $this->config = array_merge(array( 38 | 39 | ),$config); 40 | } 41 | 42 | /** 43 | * @abstract 44 | * @param string $title The title of the Article 45 | * @param string $url The full URL of the Article 46 | */ 47 | abstract public function notify($title,$url); 48 | } -------------------------------------------------------------------------------- /core/components/articles/model/schema/articles.mysql.schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /core/components/articles/processors/article/deletemultiple.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ArticleDeleteMultipleProcessor extends modObjectProcessor { 27 | public $classKey = 'Article'; 28 | public $objectType = 'article'; 29 | public $languageTopics = array('resource','articles:default'); 30 | 31 | public function process() { 32 | $ids = $this->getProperty('ids',null); 33 | if (empty($ids)) { 34 | return $this->failure($this->modx->lexicon('articles.articles_err_ns_multiple')); 35 | } 36 | $ids = is_array($ids) ? $ids : explode(',',$ids); 37 | 38 | foreach ($ids as $id) { 39 | if (empty($id)) continue; 40 | $this->modx->runProcessor('resource/delete',array( 41 | 'id' => $id, 42 | )); 43 | } 44 | return $this->success(); 45 | } 46 | } 47 | return 'ArticleDeleteMultipleProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/article/getlist.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ArticleGetListProcessor extends modObjectGetListProcessor { 27 | public $classKey = 'Article'; 28 | public $defaultSortField = 'createdon'; 29 | public $defaultSortDirection = 'DESC'; 30 | public $checkListPermission = true; 31 | public $objectType = 'article'; 32 | public $languageTopics = array('resource','articles:default'); 33 | 34 | /** @var modAction $editAction */ 35 | public $editAction; 36 | /** @var modTemplateVar $tvTags */ 37 | public $tvTags; 38 | /** @var ArticlesContainer $container */ 39 | public $container; 40 | /** @var boolean $commentsEnabled */ 41 | public $commentsEnabled = false; 42 | 43 | public function initialize() { 44 | $this->editAction = $this->modx->getObject('modAction',array( 45 | 'namespace' => 'core', 46 | 'controller' => 'resource/update', 47 | )); 48 | $this->defaultSortField = $this->modx->getOption('articles.default_article_sort_field',null,'createdon'); 49 | 50 | if ($this->getParentContainer()) { 51 | $settings = $this->container->getContainerSettings(); 52 | if ($this->modx->getOption('commentsEnabled',$settings,true)) { 53 | $quipCorePath = $this->modx->getOption('quip.core_path',null,$this->modx->getOption('core_path',null,MODX_CORE_PATH).'components/quip/'); 54 | if ($this->modx->addPackage('quip',$quipCorePath.'model/')) { 55 | $this->commentsEnabled = true; 56 | } 57 | } 58 | } 59 | return parent::initialize(); 60 | } 61 | 62 | public function getTagsTV() { 63 | $this->tvTags = $this->modx->getObject('modTemplateVar',array('name' => 'articlestags')); 64 | if (!$this->tvTags && $this->getProperty('sort') == 'tags') { 65 | $this->setProperty('sort','createdon'); 66 | } 67 | return $this->tvTags; 68 | } 69 | 70 | public function getParentContainer() { 71 | $parent = $this->getProperty('parent'); 72 | if (!empty($parent)) { 73 | $this->container = $this->modx->getObject('ArticlesContainer',$parent); 74 | } 75 | return $this->container; 76 | } 77 | 78 | public function prepareQueryBeforeCount(xPDOQuery $c) { 79 | $c->leftJoin('modUser','CreatedBy'); 80 | 81 | if ($this->getTagsTV()) { 82 | $c->leftJoin('modTemplateVarResource','Tags',array( 83 | 'Tags.tmplvarid' => $this->tvTags->get('id'), 84 | 'Tags.contentid = Article.id', 85 | )); 86 | } 87 | 88 | $parent = $this->getProperty('parent',null); 89 | if (!empty($parent)) { 90 | $c->where(array( 91 | 'parent' => $parent, 92 | )); 93 | } 94 | $query = $this->getProperty('query',null); 95 | if (!empty($query)) { 96 | $queryWhere = array( 97 | 'pagetitle:LIKE' => '%'.$query.'%', 98 | 'OR:description:LIKE' => '%'.$query.'%', 99 | 'OR:introtext:LIKE' => '%'.$query.'%', 100 | ); 101 | if ($this->tvTags) { 102 | $queryWhere['OR:Tags.value:LIKE'] = '%'.$query.'%'; 103 | } 104 | $c->where($queryWhere); 105 | } 106 | $filter = $this->getProperty('filter',''); 107 | switch ($filter) { 108 | case 'published': 109 | $c->where(array( 110 | 'published' => 1, 111 | 'deleted' => 0, 112 | )); 113 | break; 114 | case 'unpublished': 115 | $c->where(array( 116 | 'published' => 0, 117 | 'deleted' => 0, 118 | )); 119 | break; 120 | case 'deleted': 121 | $c->where(array( 122 | 'deleted' => 1, 123 | )); 124 | break; 125 | default: 126 | $c->where(array( 127 | 'deleted' => 0, 128 | )); 129 | break; 130 | } 131 | 132 | $c->where(array( 133 | 'class_key' => 'Article', 134 | )); 135 | return $c; 136 | } 137 | 138 | public function getSortClassKey() { 139 | $classKey = 'Article'; 140 | switch ($this->getProperty('sort')) { 141 | case 'tags': 142 | $classKey = 'modTemplateVarResource'; 143 | break; 144 | } 145 | return $classKey; 146 | } 147 | 148 | public function prepareQueryAfterCount(xPDOQuery $c) { 149 | $c->select($this->modx->getSelectColumns('Article','Article')); 150 | $c->select(array( 151 | 'createdby_username' => 'CreatedBy.username', 152 | )); 153 | if ($this->tvTags) { 154 | $c->select(array( 155 | 'tags' => 'Tags.value', 156 | )); 157 | } 158 | if ($this->commentsEnabled) { 159 | $commentsQuery = $this->modx->newQuery('quipComment'); 160 | $commentsQuery->innerJoin('quipThread','Thread'); 161 | $commentsQuery->where(array( 162 | 'Thread.resource = Article.id', 163 | )); 164 | $commentsQuery->select(array( 165 | 'COUNT('.$this->modx->getSelectColumns('quipComment','quipComment','',array('id')).')', 166 | )); 167 | $commentsQuery->construct(); 168 | $c->select(array( 169 | '('.$commentsQuery->toSQL().') AS '.$this->modx->escape('comments'), 170 | )); 171 | } 172 | return $c; 173 | } 174 | 175 | /** 176 | * @param xPDOObject|Article $object 177 | * @return array 178 | */ 179 | public function prepareRow(xPDOObject $object) { 180 | $resourceArray = parent::prepareRow($object); 181 | 182 | if (!empty($resourceArray['publishedon'])) { 183 | $publishedon = strtotime($resourceArray['publishedon']); 184 | $resourceArray['publishedon_date'] = strftime($this->modx->getOption('articles.mgr_date_format',null,'%b %d'),$publishedon); 185 | $resourceArray['publishedon_time'] = strftime($this->modx->getOption('articles.mgr_time_format',null,'%H:%I %p'),$publishedon); 186 | $resourceArray['publishedon'] = strftime('%b %d, %Y %H:%I %p',$publishedon); 187 | } 188 | $resourceArray['action_edit'] = '?a='.$this->editAction->get('id').'&action=post/update&id='.$resourceArray['id']; 189 | if (!array_key_exists('comments',$resourceArray)) $resourceArray['comments'] = 0; 190 | 191 | $this->modx->getContext($resourceArray['context_key']); 192 | $resourceArray['preview_url'] = $this->modx->makeUrl($resourceArray['id'],$resourceArray['context_key']); 193 | 194 | $trimLength = $this->modx->getOption('articles.mgr_article_content_preview_length',null,300); 195 | $resourceArray['content'] = strip_tags($this->ellipsis($object->getContent(),$trimLength)); 196 | 197 | $resourceArray['actions'] = array(); 198 | $resourceArray['actions'][] = array( 199 | 'className' => 'edit', 200 | 'text' => $this->modx->lexicon('edit'), 201 | ); 202 | $resourceArray['actions'][] = array( 203 | 'className' => 'view', 204 | 'text' => $this->modx->lexicon('view'), 205 | ); 206 | if (!empty($resourceArray['deleted'])) { 207 | $resourceArray['actions'][] = array( 208 | 'className' => 'undelete', 209 | 'text' => $this->modx->lexicon('undelete'), 210 | ); 211 | } else { 212 | $resourceArray['actions'][] = array( 213 | 'className' => 'delete', 214 | 'text' => $this->modx->lexicon('delete'), 215 | ); 216 | } 217 | if (!empty($resourceArray['published'])) { 218 | $resourceArray['actions'][] = array( 219 | 'className' => 'unpublish', 220 | 'text' => $this->modx->lexicon('unpublish'), 221 | ); 222 | } else { 223 | $resourceArray['actions'][] = array( 224 | 'className' => 'publish orange', 225 | 'text' => $this->modx->lexicon('publish'), 226 | ); 227 | } 228 | return $resourceArray; 229 | } 230 | 231 | public function ellipsis($string,$length = 300) { 232 | if (strlen($string) > $length) { 233 | $string = substr($string,0,$length).'...'; 234 | } 235 | return $string; 236 | } 237 | } 238 | return 'ArticleGetListProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/article/ping.class.php: -------------------------------------------------------------------------------- 1 | getProperty('id',null); 13 | if (empty($id)) { return $this->modx->lexicon('articles.articles_err_ns'); } 14 | $this->object = $this->modx->getObject('Article',$id); 15 | if (empty($this->object)) return $this->modx->lexicon('articles.article_err_nf'); 16 | return $initialized; 17 | } 18 | public function process() { 19 | if ($this->object->notifyUpdateServices()) { 20 | return $this->success(); 21 | } else { 22 | return $this->failure(); 23 | } 24 | } 25 | } 26 | return 'ArticlePingProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/article/publishmultiple.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ArticlePublishMultipleProcessor extends modObjectProcessor { 27 | public $classKey = 'Article'; 28 | public $objectType = 'article'; 29 | public $languageTopics = array('resource','articles:default'); 30 | 31 | public function process() { 32 | $ids = $this->getProperty('ids',null); 33 | if (empty($ids)) { 34 | return $this->failure($this->modx->lexicon('articles.articles_err_ns_multiple')); 35 | } 36 | $ids = is_array($ids) ? $ids : explode(',',$ids); 37 | 38 | foreach ($ids as $id) { 39 | if (empty($id)) continue; 40 | $this->modx->runProcessor('resource/publish',array( 41 | 'id' => $id, 42 | )); 43 | } 44 | return $this->success(); 45 | } 46 | } 47 | return 'ArticlePublishMultipleProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/article/undeletemultiple.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ArticleUnDeleteMultipleProcessor extends modObjectProcessor { 27 | public $classKey = 'Article'; 28 | public $objectType = 'article'; 29 | public $languageTopics = array('resource','articles:default'); 30 | 31 | public function process() { 32 | $ids = $this->getProperty('ids',null); 33 | if (empty($ids)) { 34 | return $this->failure($this->modx->lexicon('articles.articles_err_ns_multiple')); 35 | } 36 | $ids = is_array($ids) ? $ids : explode(',',$ids); 37 | 38 | foreach ($ids as $id) { 39 | if (empty($id)) continue; 40 | $this->modx->runProcessor('resource/undelete',array( 41 | 'id' => $id, 42 | )); 43 | } 44 | return $this->success(); 45 | } 46 | } 47 | return 'ArticleUnDeleteMultipleProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/article/unpublishmultiple.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ArticleUnPublishMultipleProcessor extends modObjectProcessor { 27 | public $classKey = 'Article'; 28 | public $objectType = 'article'; 29 | public $languageTopics = array('resource','articles:default'); 30 | 31 | public function process() { 32 | $ids = $this->getProperty('ids',null); 33 | if (empty($ids)) { 34 | return $this->failure($this->modx->lexicon('articles.articles_err_ns_multiple')); 35 | } 36 | $ids = is_array($ids) ? $ids : explode(',',$ids); 37 | 38 | foreach ($ids as $id) { 39 | if (empty($id)) continue; 40 | $this->modx->runProcessor('resource/unpublish',array( 41 | 'id' => $id, 42 | )); 43 | } 44 | return $this->success(); 45 | } 46 | } 47 | return 'ArticleUnPublishMultipleProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/container/import.class.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * Articles is free software; you can redistribute it and/or modify it under the 8 | * terms of the GNU General Public License as published by the Free Software 9 | * Foundation; either version 2 of the License, or (at your option) any later 10 | * version. 11 | * 12 | * Articles is distributed in the hope that it will be useful, but WITHOUT ANY 13 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 14 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along with 17 | * Articles; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package articles 21 | */ 22 | /** 23 | * @package articles 24 | * @subpackage processors 25 | */ 26 | class ContainerImportProcessor extends modObjectProcessor { 27 | public $classKey = 'Article'; 28 | public $objectType = 'article'; 29 | public $languageTopics = array('resource','articles:default'); 30 | /** @var Article $object */ 31 | public $object; 32 | /** @var ArticlesImport $service */ 33 | public $service; 34 | 35 | public function initialize() { 36 | $initialized = parent::initialize(); 37 | $id = $this->getProperty('id',null); 38 | if (empty($id)) { return $this->modx->lexicon('articles.container_err_ns'); } 39 | $this->object = $this->modx->getObject('ArticlesContainer',$id); 40 | if (empty($this->object)) return $this->modx->lexicon('articles.container_err_nf'); 41 | return $initialized; 42 | } 43 | 44 | /** 45 | * Import data into Articles 46 | * {@inheritDoc} 47 | * @return array|string 48 | */ 49 | public function process() { 50 | $this->getImportService(); 51 | if (empty($this->service)) { 52 | return $this->failure('[Articles] Could not load import service!'); 53 | } 54 | 55 | $success = $this->service->import(); 56 | 57 | if ($success) { 58 | $this->clearCache(); 59 | return $this->success(); 60 | } else { 61 | return $this->failure(); 62 | } 63 | } 64 | 65 | /** 66 | * Get the specified import service 67 | * @return ArticlesImport 68 | */ 69 | public function getImportService() { 70 | $serviceName = $this->getProperty('service','WordPress'); 71 | 72 | $modelPath = $this->modx->getOption('articles.core_path',null,$this->modx->getOption('core_path').'components/articles/').'model/articles/'; 73 | $servicePath = $modelPath.'import/articlesimport'.strtolower($serviceName).'.class.php'; 74 | if (file_exists($servicePath)) { 75 | require_once $servicePath; 76 | $className = 'ArticlesImport'.$serviceName; 77 | $this->service = new $className($this->modx->articles,$this,$this->getProperties()); 78 | } 79 | 80 | return $this->service; 81 | } 82 | 83 | /** 84 | * Clear the site cache to properly refresh the URIs 85 | */ 86 | public function clearCache() { 87 | $this->modx->cacheManager->refresh(array( 88 | 'db' => array(), 89 | 'auto_publish' => array('contexts' => array($this->object->get('context_key'))), 90 | 'context_settings' => array('contexts' => array($this->object->get('context_key'))), 91 | 'resource' => array('contexts' => array($this->object->get('context_key'))), 92 | )); 93 | } 94 | } 95 | return 'ContainerImportProcessor'; -------------------------------------------------------------------------------- /core/components/articles/processors/extras/gettags.class.php: -------------------------------------------------------------------------------- 1 | getProperty('container', false); 12 | if(!$container){ 13 | return false; 14 | } 15 | 16 | $parent = $this->modx->getObject('modResource', $container); 17 | if(!$parent){ 18 | return false; 19 | } 20 | 21 | $articles = $parent->getMany('Children',array('deleted' => 0)); 22 | $articleIDs = array(); 23 | foreach($articles as $article){ 24 | $articleIDs[] = $article->id; 25 | } 26 | 27 | $templateVariable = $this->modx->getObject('modTemplateVar', array('name' => 'articlestags')); 28 | if(!$templateVariable){ 29 | return false; 30 | } 31 | 32 | $c = $this->modx->newQuery('modTemplateVarResource'); 33 | 34 | $c->where(array( 35 | 'tmplvarid' => $templateVariable->id, 36 | 'contentid:IN' => $articleIDs 37 | )); 38 | 39 | $tagsObject = $this->modx->getCollection('modTemplateVarResource', $c); 40 | $tags = array(); 41 | 42 | foreach($tagsObject as $tagObject){ 43 | $addTags = explode(',',$tagObject->value); 44 | foreach($addTags as &$addTag){ 45 | $addTag = trim($addTag); 46 | } 47 | $tags = array_merge($tags, $addTags); 48 | } 49 | 50 | $tags = ArticlesService::arrayUnique($tags); 51 | sort($tags); 52 | $returnArray = array(); 53 | foreach($tags as $tag){ 54 | $returnArray[] = array($tag); 55 | } 56 | 57 | return $this->success('', $returnArray); 58 | } 59 | 60 | } 61 | return 'ArticleExtrasGetTagsProcessor'; -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Articles 2 | 3 | Articles is currently maintained at [modxcms/Articles](http://github.com/modxcms/Articles). Please [go there](http://github.com/modxcms/Articles). 4 | --------------------------------------------------------------------------------