├── .gitignore ├── README.md ├── _build ├── build.config.sample.php ├── build.transport.php ├── data │ ├── properties │ │ └── samplepackage.snippet.properties.php │ ├── transport.chunks.php │ ├── transport.events.php │ ├── transport.mediasources.php │ ├── transport.menu.php │ ├── transport.plugins.php │ ├── transport.settings.php │ └── transport.snippets.php ├── includes │ ├── builder │ │ ├── category.attributes.php │ │ ├── category.php │ │ ├── chunks.php │ │ ├── eula.php │ │ ├── lexicon.php │ │ ├── mediasources.php │ │ ├── menu.php │ │ ├── namespace.php │ │ ├── plugins.php │ │ ├── resolver.register.wrapper.php │ │ ├── resolver.tables.wrapper.php │ │ ├── snippets.php │ │ ├── system.events.php │ │ └── system.settings.php │ └── functions.php ├── options │ └── options.setup.php └── resolvers │ ├── resolver.register.php │ ├── resolver.sources.php │ └── resolver.tables.php ├── assets └── components │ └── modxreact │ ├── .gitignore │ └── connectors │ └── connector.php ├── core └── components │ └── modxreact │ ├── controllers │ ├── mgr │ │ ├── index.class.php │ │ └── indexpanel │ │ │ └── index.class.php │ └── smarty │ │ └── base.php │ ├── docs │ ├── changelog.txt │ ├── license.txt │ └── readme.txt │ ├── elements │ ├── chunks │ │ └── samplepackage.chunk.tpl │ ├── plugins │ │ └── samplepackage.plugin.php │ └── snippets │ │ └── react.snippet.php │ ├── lexicon │ └── en │ │ └── properties.inc.php │ ├── model │ └── modxReact │ │ └── .gitignore │ └── templates │ └── default │ └── index.tpl ├── examples └── basic-example │ └── template.tpl ├── manager └── components │ └── modxreact │ └── .gitignore └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | _build/build.config.php 2 | .git -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | modx-react 2 | =========== 3 | 4 | React server side rendering for MODX Revo 5 | 6 | ## Main goal 7 | Allow to render markup based on [React](https://github.com/facebook/react) on server. 8 | 9 | ## Dependencies 10 | This module needs [node-react](https://github.com/proxyfabio/node-react) module to work properly. 11 | 12 | ## Run 13 | 1. First of all you have to install `modx-react` via package manager 14 | 2. There is `modxreact.assets` option at module config. It's the path to you public assets. 15 | Cause i'm usually use `modxsite` for work the path is relative to it. But you can manage by your own 16 | 3. React don't like foreign whitespace at the markup. If you are using `modxSmarty` that [`template controller`](https://github.com/proxyfabio/modx-react/blob/master/core/components/modxreact/controllers/smarty/base.php) will help 17 | 4. Run `node-react` at you server 18 | 5. Now you can render your React components via [`snippet`](https://github.com/proxyfabio/modx-react/tree/master/examples/basic-example/template.tpl#L7) 19 | -------------------------------------------------------------------------------- /_build/build.config.sample.php: -------------------------------------------------------------------------------- 1 | $root, 20 | 'build' => $root . '_build/', 21 | 'source_core' => $root . 'core/components/'.PKG_PATH.'/', 22 | 'source_assets' => $root . 'assets/components/'.PKG_PATH.'/', 23 | 'source_manager' => $root . 'manager/components/'.PKG_PATH.'/', 24 | ); 25 | $sources = array_merge($sources,array( 26 | 'includes' => $sources['build'] .'includes/', 27 | 'builder_includes' => $sources['build'] .'includes/builder/', 28 | 'data' => $sources['build'] .'data/', 29 | 'properties' => $sources['build'] .'data/properties/', 30 | 'options' => $sources['build'] .'options/', 31 | 'resolvers' => $sources['build'] .'resolvers/', 32 | 'chunks' => $sources['source_core'] .'elements/chunks/', 33 | 'snippets' => $sources['source_core'] .'elements/snippets/', 34 | 'plugins' => $sources['source_core'] .'elements/plugins/', 35 | 'templates' => $sources['source_core'] .'elements/templates/', 36 | 'lexicon' => $sources['source_core'] .'lexicon/', 37 | 'docs' => $sources['source_core'] .'docs/', 38 | 'model' => $sources['source_core'] .'model/', 39 | )); 40 | unset($root); 41 | 42 | require_once MODX_CORE_PATH . 'model/modx/modx.class.php'; 43 | require_once $sources['includes'] . 'functions.php'; 44 | 45 | $modx= new modX(); 46 | $modx->initialize('mgr'); -------------------------------------------------------------------------------- /_build/build.transport.php: -------------------------------------------------------------------------------- 1 | '; 26 | require_once dirname(__FILE__). '/build.config.php'; 27 | 28 | /* 29 | * Set log Params 30 | */ 31 | $modx->setLogLevel(modX::LOG_LEVEL_INFO); 32 | $modx->setLogTarget('ECHO'); echo '
'; flush(); 33 | 34 | /* 35 | * Create Builder 36 | */ 37 | $modx->loadClass('transport.modPackageBuilder','',false, true); 38 | $builder = new modPackageBuilder($modx); 39 | 40 | /* 41 | * Create Package 42 | */ 43 | $builder->createPackage(PKG_NAME_LOWER,PKG_VERSION,PKG_RELEASE); 44 | $builder->registerNamespace(PKG_NAME_LOWER,false,true,'{core_path}components/'.PKG_NAME_LOWER.'/'); 45 | 46 | /* 47 | * Load lexicon 48 | */ 49 | # include_once $sources['builder_includes'] . 'lexicon.php'; 50 | 51 | /* 52 | * Add Namespace 53 | */ 54 | include_once $sources['builder_includes'] . 'namespace.php'; 55 | 56 | /* 57 | * Add mediasources 58 | */ 59 | # include_once $sources['builder_includes'] . 'mediasources.php'; 60 | 61 | /* 62 | * Create system settings via vehicle 63 | */ 64 | include_once $sources['builder_includes'] . 'system.settings.php'; 65 | 66 | /* 67 | * Create custom system settings via vehicle 68 | */ 69 | # include_once $sources['builder_includes'] . 'system.events.php'; 70 | 71 | /* 72 | * Create Category 73 | */ 74 | include_once $sources['builder_includes'] . 'category.php'; 75 | 76 | /* add plugins */ 77 | # include_once $sources['builder_includes'] . 'plugins.php'; 78 | 79 | /* add snippets */ 80 | include_once $sources['builder_includes'] . 'snippets.php'; 81 | 82 | /* add chunks */ 83 | # include_once $sources['builder_includes'] . 'chunks.php'; 84 | 85 | /* 86 | * Create category vehicle 87 | */ 88 | include_once $sources['builder_includes'] . 'category.attributes.php'; 89 | $vehicle = $builder->createVehicle($category,$attr); 90 | // eof Create Category 91 | 92 | /* 93 | * Adding sources (3 sources by default) 94 | */ 95 | include_once $sources['resolvers'] . 'resolver.sources.php'; 96 | 97 | /* 98 | * Adding resolvers 99 | */ 100 | $modx->log(modX::LOG_LEVEL_INFO,'Adding in PHP resolvers...'); flush(); 101 | # include_once $sources['builder_includes'] . 'resolver.tables.wrapper.php'; 102 | # include_once $sources['builder_includes'] . 'resolver.register.wrapper.php'; 103 | // eof adding resolvers 104 | 105 | $builder->putVehicle($vehicle); 106 | 107 | /* 108 | * Load Menu 109 | */ 110 | # include_once $sources['builder_includes'] . 'menu.php'; 111 | 112 | /* now pack in the license file, readme and setup options */ 113 | include_once $sources['builder_includes'] . 'eula.php'; 114 | 115 | 116 | $modx->log(modX::LOG_LEVEL_INFO,'Packing...'); flush(); 117 | $builder->pack(); 118 | 119 | $mtime= microtime(); 120 | $mtime= explode(" ", $mtime); 121 | $mtime= $mtime[1] + $mtime[0]; 122 | $tend= $mtime; 123 | 124 | $totalTime= ($tend - $tstart); 125 | $totalTime= sprintf("%2.4f s", $totalTime); 126 | 127 | $modx->log(modX::LOG_LEVEL_INFO,"\n
Package Built.
\nExecution time: {$totalTime}\n"); 128 | 129 | exit (); 130 | -------------------------------------------------------------------------------- /_build/data/properties/samplepackage.snippet.properties.php: -------------------------------------------------------------------------------- 1 | "{$snippetName}_prop", 9 | 'desc' => "prop_{$pkgName}.{$snippetName}_prop_desc", 10 | 'type' => 'textfield', 11 | 'options' => '', 12 | 'value' => "{$snippetName}_value", 13 | 'lexicon' => "{$pkgName}:properties", 14 | ), 15 | array( 16 | 'name' => "{$snippetName}_list", 17 | 'desc' => "prop_{$pkgName}.{$snippetName}_list_desc", 18 | 'type' => 'list', 19 | 'options' => array( 20 | array('text' => "prop_{$pkgName}.{$snippetName}_asc",'value' => 'ASC'), 21 | array('text' => "prop_{$pkgName}.{$snippetName}_desc",'value' => 'DESC'), 22 | ), 23 | 'value' => 'DESC', 24 | 'lexicon' => "{$pkgName}:properties", 25 | ), 26 | ); 27 | 28 | return $properties; -------------------------------------------------------------------------------- /_build/data/transport.chunks.php: -------------------------------------------------------------------------------- 1 | newObject('modChunk', array( 9 | 'name' => $chunk_name, 10 | 'description' => $chunk_name.'_desc', 11 | 'snippet' => $content, 12 | )); 13 | $chunks[] = $chunk; 14 | }*/ 15 | 16 | $list = array(PKG_NAME_LOWER); 17 | 18 | foreach($list as $v){ 19 | 20 | $chunk_name = $v; 21 | $content = getSnippetContent($sources['chunks'] . $chunk_name . '.chunk.tpl'); 22 | if(!empty($content)){ 23 | $chunk = $modx->newObject('modChunk', array( 24 | 'name' => $chunk_name, 25 | 'description' => $chunk_name.'_desc', 26 | 'snippet' => $content, 27 | )); 28 | $chunks[] = $chunk; 29 | } 30 | 31 | } 32 | 33 | unset($chunk,$chunk_name,$content); 34 | return $chunks; -------------------------------------------------------------------------------- /_build/data/transport.events.php: -------------------------------------------------------------------------------- 1 | newObject('modEvent', array( 6 | 'service' => 1, 7 | 'groupname' => PKG_NAME, 8 | )); 9 | $event->set('name', "{$event_name}"); 10 | $events[] = $event; 11 | 12 | unset($event,$event_name); 13 | 14 | return $events; -------------------------------------------------------------------------------- /_build/data/transport.mediasources.php: -------------------------------------------------------------------------------- 1 | array( 7 | "name" => "basePath", 8 | "desc" => "prop_file.basePath_desc", 9 | "type" => "textfield", 10 | "options" => Array(), 11 | "value" => 'core/components/'.PKG_PATH.'/', 12 | "lexicon" => "core:source", 13 | ), 14 | "baseUrl" => Array 15 | ( 16 | "name" => "baseUrl", 17 | "desc" => "prop_file.baseUrl_desc", 18 | "type" => "textfield", 19 | "options" => Array(), 20 | "value" => 'core/components/'.PKG_PATH.'/', 21 | "lexicon" => "core:source", 22 | ) 23 | ); 24 | 25 | $mediaSource = $modx->newObject('sources.modMediaSource', array( 26 | 'name' => PKG_NAME_LOWER.'_core', 27 | 'class_key' => 'sources.modFileMediaSource', 28 | 'description' => 'core/components/'.PKG_PATH.'/',//PKG_NAME_LOWER.' Core Source', 29 | 'properties' => $params, 30 | )); 31 | 32 | $mediaSources[] = $mediaSource; 33 | unset($mediaSource); 34 | 35 | $params = array( 36 | "basePath" => array( 37 | "name" => "basePath", 38 | "desc" => "prop_file.basePath_desc", 39 | "type" => "textfield", 40 | "options" => Array(), 41 | "value" => 'assets/components/'.PKG_PATH.'/', 42 | "lexicon" => "core:source", 43 | ), 44 | "baseUrl" => Array 45 | ( 46 | "name" => "baseUrl", 47 | "desc" => "prop_file.baseUrl_desc", 48 | "type" => "textfield", 49 | "options" => Array(), 50 | "value" => 'assets/components/'.PKG_PATH.'/', 51 | "lexicon" => "core:source", 52 | ) 53 | ); 54 | 55 | $mediaSource = $modx->newObject('sources.modMediaSource', array( 56 | 'name' => PKG_NAME_LOWER.'_assets', 57 | 'class_key' => 'sources.modFileMediaSource', 58 | 'description' => 'assets/components/'.PKG_PATH.'/',//PKG_NAME_LOWER.' Assets Source', 59 | 'properties' => $params, 60 | )); 61 | 62 | $mediaSources[] = $mediaSource; 63 | unset($mediaSource); 64 | 65 | $params = array( 66 | "basePath" => array( 67 | "name" => "basePath", 68 | "desc" => "prop_file.basePath_desc", 69 | "type" => "textfield", 70 | "options" => Array(), 71 | "value" => 'manager/components/'.PKG_PATH.'/', 72 | "lexicon" => "core:source", 73 | ), 74 | "baseUrl" => Array 75 | ( 76 | "name" => "baseUrl", 77 | "desc" => "prop_file.baseUrl_desc", 78 | "type" => "textfield", 79 | "options" => Array(), 80 | "value" => 'manager/components/'.PKG_PATH.'/', 81 | "lexicon" => "core:source", 82 | ) 83 | ); 84 | 85 | $mediaSource = $modx->newObject('sources.modMediaSource', array( 86 | 'name' => PKG_NAME_LOWER.'_manager', 87 | 'class_key' => 'sources.modFileMediaSource', 88 | 'description' => 'manager/components/'.PKG_PATH.'/',//PKG_NAME_LOWER.' Manager Source', 89 | 'properties' => $params, 90 | )); 91 | 92 | $mediaSources[] = $mediaSource; 93 | unset($mediaSource); 94 | 95 | 96 | return $mediaSources; 97 | 98 | ?> -------------------------------------------------------------------------------- /_build/data/transport.menu.php: -------------------------------------------------------------------------------- 1 | newObject('modAction'); 6 | $action->fromArray(array( 7 | 'id' => 1, 8 | 'namespace' => NAMESPACE_NAME, 9 | 'parent' => 0, 10 | 'controller' => 'controllers/mgr/indexpanel', 11 | 'haslayout' => true, 12 | 'lang_topics' => NAMESPACE_NAME.':default', 13 | 'assets' => '', 14 | ),'',true,true); 15 | 16 | $menu = $modx->newObject('modMenu'); 17 | $menu->fromArray(array( 18 | 'text' => NAMESPACE_NAME, 19 | 'parent' => 'components', 20 | 'description' => NAMESPACE_NAME.'.module_desc', 21 | 'icon' => 'images/icons/plugin.gif', 22 | 'menuindex' => 0, 23 | 'params' => '', 24 | 'handler' => '', 25 | 'permissions' => '', 26 | 'namespace' => NAMESPACE_NAME, 27 | ),'',true,true); 28 | 29 | $menu->addOne($action); 30 | unset($action); 31 | 32 | $menus[] = $menu; 33 | 34 | return $menus; -------------------------------------------------------------------------------- /_build/data/transport.plugins.php: -------------------------------------------------------------------------------- 1 | newObject('modPlugin'); 16 | $plugin->set('id', 1); 17 | $plugin->set('name', $plugin_name ); 18 | $plugin->set('description', $plugin_name.'_desc'); 19 | $plugin->set('plugincode', $content ); 20 | 21 | 22 | /* add plugin events */ 23 | $events = array(); 24 | 25 | $events['OnHandleRequest'] = $modx->newObject('modPluginEvent'); 26 | $events['OnHandleRequest'] -> fromArray(array( 27 | 'event' => 'OnHandleRequest', 28 | 'priority' => 0, 29 | 'propertyset' => 0, 30 | ),'',true,true); 31 | 32 | $plugin->addMany($events, 'PluginEvents'); 33 | 34 | $modx->log(xPDO::LOG_LEVEL_INFO,'Packaged in '.count($events).' Plugin Events.'); flush(); 35 | 36 | $plugins[] = $plugin; 37 | } 38 | 39 | unset($plugin,$events,$plugin_name,$content); 40 | return $plugins; -------------------------------------------------------------------------------- /_build/data/transport.settings.php: -------------------------------------------------------------------------------- 1 | newObject('modSystemSetting'); 7 | $setting->fromArray(array( 8 | 'key' => $setting_name, 9 | 'value' => '{assets_path}components/modxsite/templates/bundle/', 10 | 'xtype' => 'textfield', 11 | 'namespace' => NAMESPACE_NAME, 12 | 'area' => 'default', 13 | ),'',true,true); 14 | 15 | $settings[] = $setting; 16 | 17 | $setting_name = PKG_NAME_LOWER.'.host'; 18 | $setting = $modx->newObject('modSystemSetting'); 19 | $setting->fromArray(array( 20 | 'key' => $setting_name, 21 | 'value' => '127.0.0.1:6969', 22 | 'xtype' => 'textfield', 23 | 'namespace' => NAMESPACE_NAME, 24 | 'area' => 'default', 25 | ),'',true,true); 26 | 27 | $settings[] = $setting; 28 | 29 | unset($setting,$setting_name); 30 | return $settings; 31 | -------------------------------------------------------------------------------- /_build/data/transport.snippets.php: -------------------------------------------------------------------------------- 1 | newObject('modSnippet'); 16 | $snippet->fromArray(array( 17 | 'name' => $snippet_name, 18 | 'description' => $snippet_name.'_desc', 19 | 'snippet' => $content, 20 | 'source' => 1, 21 | 'static' => true, 22 | 'static_file' => str_replace($sources['root'],'',$sources['snippets'] . $snippet_name . '.snippet.php') 23 | ),'',true,true); 24 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.$snippet_name.' snippet.'); flush(); 25 | 26 | $path = $sources['properties']."{$snippet_name}.snippet.properties.php"; 27 | if(is_file($path)){ 28 | $properties = include $path; 29 | $snippet->setProperties($properties); 30 | $modx->log(modX::LOG_LEVEL_INFO,'Adding properties for '.$snippet_name.' snippet.'); flush(); 31 | } 32 | 33 | $snippets[] = $snippet; 34 | } 35 | 36 | } 37 | 38 | unset($properties,$snippet,$path,$snippet_name,$content,$list); 39 | return $snippets; 40 | -------------------------------------------------------------------------------- /_build/includes/builder/category.attributes.php: -------------------------------------------------------------------------------- 1 | 'category', 4 | xPDOTransport::PRESERVE_KEYS => false, 5 | xPDOTransport::UPDATE_OBJECT => true, 6 | xPDOTransport::RELATED_OBJECTS => true, 7 | xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( 8 | 'Snippets' => array( 9 | xPDOTransport::PRESERVE_KEYS => false, 10 | xPDOTransport::UPDATE_OBJECT => true, 11 | xPDOTransport::UNIQUE_KEY => 'name', 12 | ), 13 | 'Chunks' => array( 14 | xPDOTransport::PRESERVE_KEYS => false, 15 | xPDOTransport::UPDATE_OBJECT => true, 16 | xPDOTransport::UNIQUE_KEY => 'name', 17 | ), 18 | 'Plugins' => array( 19 | xPDOTransport::PRESERVE_KEYS => false, 20 | xPDOTransport::UPDATE_OBJECT => true, 21 | xPDOTransport::UNIQUE_KEY => 'name', 22 | xPDOTransport::RELATED_OBJECTS => true, 23 | xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( 24 | 'PluginEvents' => array( 25 | xPDOTransport::PRESERVE_KEYS => true, 26 | xPDOTransport::UPDATE_OBJECT => false, 27 | xPDOTransport::UNIQUE_KEY => array('pluginid','event'), 28 | ), 29 | ), 30 | ), 31 | ) 32 | ); -------------------------------------------------------------------------------- /_build/includes/builder/category.php: -------------------------------------------------------------------------------- 1 | newObject('modCategory'); 3 | $category->set('id',1); 4 | $category->set('category',PKG_NAME); 5 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in category.'); flush(); -------------------------------------------------------------------------------- /_build/includes/builder/chunks.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_ERROR,'Could not package in chunks.'); 6 | } else { 7 | $category->addMany($chunks); 8 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($chunks).' chunks.'); 9 | } 10 | 11 | unset($chunks); -------------------------------------------------------------------------------- /_build/includes/builder/eula.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_INFO,'Adding package attributes and setup options...'); flush(); 3 | 4 | $builder->setPackageAttributes(array( 5 | 'license' => file_get_contents($sources['docs'] . 'license.txt'), 6 | 'readme' => file_get_contents($sources['docs'] . 'readme.txt'), 7 | 'changelog' => file_get_contents($sources['docs'] . 'changelog.txt'), 8 | # 'setup-options' => array( 9 | # 'source' => $sources['options'].'options.setup.php', 10 | # ), 11 | )); -------------------------------------------------------------------------------- /_build/includes/builder/lexicon.php: -------------------------------------------------------------------------------- 1 | getService('lexicon','modLexicon'); 3 | $modx->lexicon->load(PKG_NAME_LOWER.':properties'); -------------------------------------------------------------------------------- /_build/includes/builder/mediasources.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_ERROR,'Adding MediaSources failed.'); } 6 | else{ 7 | $vehicleParams = array( 8 | xPDOTransport::PRESERVE_KEYS => false, 9 | xPDOTransport::UPDATE_OBJECT => false, 10 | xPDOTransport::UNIQUE_KEY => 'name', 11 | xPDOTransport::RELATED_OBJECTS => true, 12 | xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( 13 | 'Snippets' => array( 14 | xPDOTransport::PRESERVE_KEYS => false, 15 | xPDOTransport::UPDATE_OBJECT => true, 16 | xPDOTransport::UNIQUE_KEY => 'name', 17 | ), 18 | 'Chunks' => array( 19 | xPDOTransport::PRESERVE_KEYS => false, 20 | xPDOTransport::UPDATE_OBJECT => true, 21 | xPDOTransport::UNIQUE_KEY => 'name', 22 | ), 23 | ), 24 | ); 25 | 26 | foreach($mediaSources as & $mediaSource){ 27 | $vehicle = $builder->createVehicle($mediaSource, $vehicleParams); 28 | $builder->putVehicle($vehicle); 29 | } 30 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($mediaSources).' MediaSources.'); flush(); 31 | } 32 | unset($mediaSources,$vehicle,$vehicleParams); 33 | -------------------------------------------------------------------------------- /_build/includes/builder/menu.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_INFO,'Packaging in menu...'); flush(); 4 | 5 | $menus = include $sources['data'].'transport.menu.php'; 6 | 7 | if (!is_array($menus)){ 8 | 9 | $modx->log(modX::LOG_LEVEL_ERROR,'Could not package in menu.'); 10 | 11 | }else{ 12 | $attributes = array ( 13 | xPDOTransport::PRESERVE_KEYS => true, 14 | xPDOTransport::UPDATE_OBJECT => true, 15 | xPDOTransport::UNIQUE_KEY => 'text', 16 | xPDOTransport::RELATED_OBJECTS => true, 17 | xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array ( 18 | 'Action' => array ( 19 | xPDOTransport::PRESERVE_KEYS => false, 20 | xPDOTransport::UPDATE_OBJECT => true, 21 | xPDOTransport::UNIQUE_KEY => array ('namespace','controller'), 22 | ), 23 | ), 24 | ); 25 | 26 | foreach($menus as $menu){ 27 | $vehicle= $builder->createVehicle($menu, $attributes); 28 | $builder->putVehicle($vehicle); 29 | $modx->log(modX::LOG_LEVEL_INFO,"Packaged in ".$menu->text." menu."); 30 | } 31 | unset($vehicle,$action); 32 | } 33 | -------------------------------------------------------------------------------- /_build/includes/builder/namespace.php: -------------------------------------------------------------------------------- 1 | newObject('modNamespace'); 3 | $namespace->set('name', NAMESPACE_NAME); 4 | $namespace->set('path',"{core_path}components/".PKG_NAME_LOWER."/"); 5 | $namespace->set('assets_path',"{assets_path}components/".PKG_NAME_LOWER."/"); 6 | 7 | $vehicle = $builder->createVehicle($namespace,array( 8 | xPDOTransport::UNIQUE_KEY => 'name', 9 | xPDOTransport::PRESERVE_KEYS => true, 10 | xPDOTransport::UPDATE_OBJECT => true, 11 | )); 12 | 13 | $builder->putVehicle($vehicle); 14 | 15 | $modx->log(modX::LOG_LEVEL_INFO,"Packaged in ".NAMESPACE_NAME." namespace."); flush(); 16 | 17 | unset($vehicle,$namespace); -------------------------------------------------------------------------------- /_build/includes/builder/plugins.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_FATAL,'Adding plugins failed.'); 7 | } 8 | else{ 9 | $category->addMany($plugins); 10 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($plugins).' plugins.'); flush(); 11 | } 12 | 13 | unset($plugins); -------------------------------------------------------------------------------- /_build/includes/builder/resolver.register.wrapper.php: -------------------------------------------------------------------------------- 1 | resolve('php',array( 3 | 'source' => $sources['resolvers'] . 'resolver.register.php', 4 | )); 5 | 6 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in register resolver.'); flush(); -------------------------------------------------------------------------------- /_build/includes/builder/resolver.tables.wrapper.php: -------------------------------------------------------------------------------- 1 | resolve('php',array( 4 | 'source' => $sources['resolvers'] . 'resolver.tables.php', 5 | )); 6 | 7 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in table resolver.'); flush(); -------------------------------------------------------------------------------- /_build/includes/builder/snippets.php: -------------------------------------------------------------------------------- 1 | log(modX::LOG_LEVEL_ERROR,'Could not package in snippets.'); 6 | } else { 7 | $category->addMany($snippets); 8 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($snippets).' snippets.'); 9 | } 10 | 11 | unset($snippets); -------------------------------------------------------------------------------- /_build/includes/builder/system.events.php: -------------------------------------------------------------------------------- 1 | 'name', 7 | xPDOTransport::PRESERVE_KEYS => true, 8 | xPDOTransport::UPDATE_OBJECT => false, 9 | ); 10 | 11 | if (!is_array($events)) { 12 | $modx->log(modX::LOG_LEVEL_ERROR,'Adding events failed.'); 13 | } 14 | foreach ($events as $event) { 15 | $vehicle = $builder->createVehicle($event,$attributes); 16 | $builder->putVehicle($vehicle); 17 | } 18 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($events).' system events.'); flush(); 19 | unset($events,$event,$attributes); -------------------------------------------------------------------------------- /_build/includes/builder/system.settings.php: -------------------------------------------------------------------------------- 1 | 'key', 6 | xPDOTransport::PRESERVE_KEYS => true, 7 | xPDOTransport::UPDATE_OBJECT => false, 8 | ); 9 | 10 | if (!is_array($settings)) { 11 | $modx->log(modX::LOG_LEVEL_ERROR,'Adding settings failed.'); 12 | } 13 | foreach ($settings as $setting) { 14 | $vehicle = $builder->createVehicle($setting,$attributes); 15 | $builder->putVehicle($vehicle); 16 | } 17 | 18 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($settings).' system settings.'); flush(); 19 | unset($settings,$setting,$attributes); -------------------------------------------------------------------------------- /_build/includes/functions.php: -------------------------------------------------------------------------------- 1 | 6 | * 7 | * modExtra 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 | * modExtra 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 | * modExtra; if not, write to the Free Software Foundation, Inc., 59 Temple 18 | * Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * @package modextra 21 | */ 22 | /** 23 | * Helper method for grabbing files 24 | * 25 | * @package modextra 26 | * @subpackage build 27 | */ 28 | 29 | /** 30 | * @param string $filename 31 | * @return mixed|string 32 | */ 33 | function getSnippetContent($filename) { 34 | global $modx; 35 | 36 | // print "
Try to open file: {$filename}
\n"; 37 | if(!is_file($filename)){ 38 | $modx->log(modX::LOG_LEVEL_ERROR,"Element doesn't exist! ({$filename})."); 39 | return ''; 40 | } 41 | 42 | $o = file_get_contents($filename); 43 | $o = str_replace('','',$o); 45 | $o = trim($o); 46 | return $o; 47 | } -------------------------------------------------------------------------------- /_build/options/options.setup.php: -------------------------------------------------------------------------------- 1 | SamplePackage Installer'; 6 | break; 7 | case xPDOTransport::ACTION_UPGRADE: 8 | case xPDOTransport::ACTION_UNINSTALL: 9 | break; 10 | } 11 | 12 | return $output; -------------------------------------------------------------------------------- /_build/resolvers/resolver.register.php: -------------------------------------------------------------------------------- 1 | xpdo) { 6 | $modx =& $object->xpdo; 7 | $modelPath = $modx->getOption("{$pkgNameLower}.core_path",null,$modx->getOption('core_path')."components/{$pkgNameLower}/").'model/'; 8 | 9 | switch ($options[xPDOTransport::PACKAGE_ACTION]) { 10 | case xPDOTransport::ACTION_INSTALL: 11 | case xPDOTransport::ACTION_UPGRADE: 12 | if ($modx instanceof modX) { 13 | $modx->addExtensionPackage($pkgName, "[[++core_path]]components/{$pkgNameLower}model/", array( 14 | 'serviceName' => $pkgName, 15 | 'serviceClass' => $pkgName, 16 | )); 17 | $modx->log(xPDO::LOG_LEVEL_INFO, 'Adding ext package'); 18 | } 19 | break; 20 | 21 | case xPDOTransport::ACTION_UNINSTALL: 22 | if ($modx instanceof modX) { 23 | $modx->removeExtensionPackage($pkgName); 24 | } 25 | break; 26 | } 27 | } 28 | return true; -------------------------------------------------------------------------------- /_build/resolvers/resolver.sources.php: -------------------------------------------------------------------------------- 1 | resolve('file',array( 4 | 'source' => $sources['source_core'], 5 | 'target' => "return MODX_CORE_PATH . 'components/';", 6 | )); 7 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in CorePath'); flush(); 8 | 9 | // Add assets source 10 | $vehicle->resolve('file',array( 11 | 'source' => $sources['source_assets'], 12 | 'target' => "return MODX_ASSETS_PATH . 'components/';", 13 | )); 14 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in AssetsPath'); flush(); 15 | 16 | // Add manager source 17 | $vehicle->resolve('file',array( 18 | 'source' => $sources['source_manager'], 19 | 'target' => "return MODX_MANAGER_PATH . 'components/';", 20 | )); 21 | $modx->log(modX::LOG_LEVEL_INFO,'Packaged in ManagerPath'); flush(); 22 | 23 | // Add site base path source 24 | # $vehicle->resolve('file',array( 25 | # 'source' => $sources['root'], 26 | # 'target' => "return MODX_BASE_PATH . 'samplepackage/';", 27 | # )); 28 | # $modx->log(modX::LOG_LEVEL_INFO,'Packaged in MibewPath'); flush(); -------------------------------------------------------------------------------- /_build/resolvers/resolver.tables.php: -------------------------------------------------------------------------------- 1 | xpdo) { 6 | switch ($options[xPDOTransport::PACKAGE_ACTION]) { 7 | case xPDOTransport::ACTION_INSTALL: 8 | $modx =& $object->xpdo; 9 | $modelPath = $modx->getOption("{$pkgNameLower}.core_path",null,$modx->getOption('core_path')."components/{$pkgNameLower}/").'model/'; 10 | $modx->addPackage($pkgName,$modelPath); 11 | 12 | $manager = $modx->getManager(); 13 | $modx->setLogLevel(modX::LOG_LEVEL_ERROR); 14 | 15 | // adding xpdo objects 16 | # $manager->createObjectContainer('SamplePackageObject'); 17 | 18 | $modx->setLogLevel(modX::LOG_LEVEL_INFO); 19 | 20 | break; 21 | case xPDOTransport::ACTION_UPGRADE: 22 | break; 23 | } 24 | } 25 | return true; -------------------------------------------------------------------------------- /assets/components/modxreact/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rogaldh/modx-react/2b340d5b8ac0491054336f98cdcec933049b486e/assets/components/modxreact/.gitignore -------------------------------------------------------------------------------- /assets/components/modxreact/connectors/connector.php: -------------------------------------------------------------------------------- 1 | user->getUserToken($modx->context->get('key')); 13 | 14 | $location = ''; 15 | $pkgName = 'samplepackage'; 16 | 17 | /* handle request */ 18 | if(!$path = $modx->getOption("{$pkgName}.core_path")){ 19 | $path = $modx->getOption('core_path')."components/{$pkgName}/"; 20 | } 21 | $path .= 'processors/'; 22 | 23 | $modx->request->handleRequest(array( 24 | 'processors_path' => $path, 25 | 'location' => $location, 26 | 'action' => "web/public/action", 27 | )); -------------------------------------------------------------------------------- /core/components/modxreact/controllers/mgr/index.class.php: -------------------------------------------------------------------------------- 1 | config['namespace_assets_path'] = $modx->call('modNamespace','translatePath',array(&$modx, $this->config['namespace_assets_path'])); 11 | $this->config['manager_url'] = $modx->getOption("{$this->module}.manager_url", null, $modx->getOption('manager_url')."components/{$this->module}/"); 12 | $this->config['connectorsUrl'] = $this->config['manager_url'].'connectors/'; 13 | } 14 | 15 | public static function getInstance(modX &$modx, $className, array $config = array()) { 16 | return parent::getInstance($modx, __CLASS__ , $config); 17 | } 18 | 19 | public function getOption($key, $options = null, $default = null, $skipEmpty = false){ 20 | $options = array_merge($this->config, (array)$options); 21 | return $this->modx->getOption($key, $options, $default, $skipEmpty); 22 | } 23 | 24 | public function getLanguageTopics() { 25 | return array("{$this->module_name}:default"); 26 | } 27 | 28 | public function initialize() { 29 | $assets_url = $this->modx->getOption('manager_url')."components/{$this->module}/"; 30 | $this->config = array_merge($this->config, array( 31 | 'assets_url' => $assets_url, 32 | )); 33 | return parent::initialize(); 34 | } 35 | 36 | 37 | function loadCustomCssJs(){ 38 | parent::loadCustomCssJs(); 39 | # $this->addJavascript($this->getOption('assets_url').'js/samplepackage.js'); 40 | 41 | $this->addHtml(''); 44 | 45 | return; 46 | } 47 | 48 | public function getTemplatesPaths($coreOnly = false) { 49 | $paths = parent::getTemplatesPaths($coreOnly); 50 | $paths[] = $this->config['namespace_path']."templates/default/"; 51 | return $paths; 52 | } 53 | 54 | public function getTemplateFile() { 55 | return 'index.tpl'; 56 | } 57 | } -------------------------------------------------------------------------------- /core/components/modxreact/controllers/mgr/indexpanel/index.class.php: -------------------------------------------------------------------------------- 1 | module_name}:manager")); 13 | } 14 | 15 | public function initialize(){ 16 | $this->modx->getVersionData(); 17 | $modxVersion = $this->modx->version['full_version']; 18 | 19 | if (!version_compare($modxVersion, '2.2.6', '>=')) { 20 | return $this->failure("MODX 2.2.6 or highter required"); 21 | } 22 | return parent::initialize(); 23 | } 24 | 25 | public function loadCustomCssJs() { 26 | parent::loadCustomCssJs(); 27 | 28 | $assets_url = $this->getOption('manager_url'); 29 | 30 | # include your libs here 31 | # $this->addJavascript($assets_url.'js/misc/functions.js'); 32 | 33 | 34 | return; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /core/components/modxreact/controllers/smarty/base.php: -------------------------------------------------------------------------------- 1 | resource->getOne('Template')->getProperties(); 4 | 5 | if(!empty($properties['tpl'])){ 6 | $tpl = $properties['tpl']; 7 | } 8 | else{ 9 | $tpl = 'index.tpl'; 10 | } 11 | 12 | if ($modx->resource->cacheable != '1') { 13 | $modx->smarty->caching = false; 14 | } 15 | 16 | return preg_replace("/[ |\\r\\n]{2,}/","",$modx->smarty->fetch("tpl/{$tpl}")); 17 | -------------------------------------------------------------------------------- /core/components/modxreact/docs/changelog.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rogaldh/modx-react/2b340d5b8ac0491054336f98cdcec933049b486e/core/components/modxreact/docs/changelog.txt -------------------------------------------------------------------------------- /core/components/modxreact/docs/license.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | -------------------------- 4 | 5 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 6 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 7 | 8 | Everyone is permitted to copy and distribute verbatim copies 9 | of this license document, but changing it is not allowed. 10 | 11 | Preamble 12 | -------- 13 | 14 | The licenses for most software are designed to take away your 15 | freedom to share and change it. By contrast, the GNU General Public 16 | License is intended to guarantee your freedom to share and change free 17 | software--to make sure the software is free for all its users. This 18 | General Public License applies to most of the Free Software 19 | Foundation's software and to any other program whose authors commit to 20 | using it. (Some other Free Software Foundation software is covered by 21 | the GNU Library General Public License instead.) You can apply it to 22 | your programs, too. 23 | 24 | When we speak of free software, we are referring to freedom, not 25 | price. Our General Public Licenses are designed to make sure that you 26 | have the freedom to distribute copies of free software (and charge for 27 | this service if you wish), that you receive source code or can get it 28 | if you want it, that you can change the software or use pieces of it 29 | in new free programs; and that you know you can do these things. 30 | 31 | To protect your rights, we need to make restrictions that forbid 32 | anyone to deny you these rights or to ask you to surrender the rights. 33 | These restrictions translate to certain responsibilities for you if you 34 | distribute copies of the software, or if you modify it. 35 | 36 | For example, if you distribute copies of such a program, whether 37 | gratis or for a fee, you must give the recipients all the rights that 38 | you have. You must make sure that they, too, receive or can get the 39 | source code. And you must show them these terms so they know their 40 | rights. 41 | 42 | We protect your rights with two steps: (1) copyright the software, and 43 | (2) offer you this license which gives you legal permission to copy, 44 | distribute and/or modify the software. 45 | 46 | Also, for each author's protection and ours, we want to make certain 47 | that everyone understands that there is no warranty for this free 48 | software. If the software is modified by someone else and passed on, we 49 | want its recipients to know that what they have is not the original, so 50 | that any problems introduced by others will not reflect on the original 51 | authors' reputations. 52 | 53 | Finally, any free program is threatened constantly by software 54 | patents. We wish to avoid the danger that redistributors of a free 55 | program will individually obtain patent licenses, in effect making the 56 | program proprietary. To prevent this, we have made it clear that any 57 | patent must be licensed for everyone's free use or not licensed at all. 58 | 59 | The precise terms and conditions for copying, distribution and 60 | modification follow. 61 | 62 | 63 | GNU GENERAL PUBLIC LICENSE 64 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 65 | --------------------------------------------------------------- 66 | 67 | 0. This License applies to any program or other work which contains 68 | a notice placed by the copyright holder saying it may be distributed 69 | under the terms of this General Public License. The "Program", below, 70 | refers to any such program or work, and a "work based on the Program" 71 | means either the Program or any derivative work under copyright law: 72 | that is to say, a work containing the Program or a portion of it, 73 | either verbatim or with modifications and/or translated into another 74 | language. (Hereinafter, translation is included without limitation in 75 | the term "modification".) Each licensee is addressed as "you". 76 | 77 | Activities other than copying, distribution and modification are not 78 | covered by this License; they are outside its scope. The act of 79 | running the Program is not restricted, and the output from the Program 80 | is covered only if its contents constitute a work based on the 81 | Program (independent of having been made by running the Program). 82 | Whether that is true depends on what the Program does. 83 | 84 | 1. You may copy and distribute verbatim copies of the Program's 85 | source code as you receive it, in any medium, provided that you 86 | conspicuously and appropriately publish on each copy an appropriate 87 | copyright notice and disclaimer of warranty; keep intact all the 88 | notices that refer to this License and to the absence of any warranty; 89 | and give any other recipients of the Program a copy of this License 90 | along with the Program. 91 | 92 | You may charge a fee for the physical act of transferring a copy, and 93 | you may at your option offer warranty protection in exchange for a fee. 94 | 95 | 2. You may modify your copy or copies of the Program or any portion 96 | of it, thus forming a work based on the Program, and copy and 97 | distribute such modifications or work under the terms of Section 1 98 | above, provided that you also meet all of these conditions: 99 | 100 | a) You must cause the modified files to carry prominent notices 101 | stating that you changed the files and the date of any change. 102 | 103 | b) You must cause any work that you distribute or publish, that in 104 | whole or in part contains or is derived from the Program or any 105 | part thereof, to be licensed as a whole at no charge to all third 106 | parties under the terms of this License. 107 | 108 | c) If the modified program normally reads commands interactively 109 | when run, you must cause it, when started running for such 110 | interactive use in the most ordinary way, to print or display an 111 | announcement including an appropriate copyright notice and a 112 | notice that there is no warranty (or else, saying that you provide 113 | a warranty) and that users may redistribute the program under 114 | these conditions, and telling the user how to view a copy of this 115 | License. (Exception: if the Program itself is interactive but 116 | does not normally print such an announcement, your work based on 117 | the Program is not required to print an announcement.) 118 | 119 | These requirements apply to the modified work as a whole. If 120 | identifiable sections of that work are not derived from the Program, 121 | and can be reasonably considered independent and separate works in 122 | themselves, then this License, and its terms, do not apply to those 123 | sections when you distribute them as separate works. But when you 124 | distribute the same sections as part of a whole which is a work based 125 | on the Program, the distribution of the whole must be on the terms of 126 | this License, whose permissions for other licensees extend to the 127 | entire whole, and thus to each and every part regardless of who wrote it. 128 | 129 | Thus, it is not the intent of this section to claim rights or contest 130 | your rights to work written entirely by you; rather, the intent is to 131 | exercise the right to control the distribution of derivative or 132 | collective works based on the Program. 133 | 134 | In addition, mere aggregation of another work not based on the Program 135 | with the Program (or with a work based on the Program) on a volume of 136 | a storage or distribution medium does not bring the other work under 137 | the scope of this License. 138 | 139 | 3. You may copy and distribute the Program (or a work based on it, 140 | under Section 2) in object code or executable form under the terms of 141 | Sections 1 and 2 above provided that you also do one of the following: 142 | 143 | a) Accompany it with the complete corresponding machine-readable 144 | source code, which must be distributed under the terms of Sections 145 | 1 and 2 above on a medium customarily used for software interchange; or, 146 | 147 | b) Accompany it with a written offer, valid for at least three 148 | years, to give any third party, for a charge no more than your 149 | cost of physically performing source distribution, a complete 150 | machine-readable copy of the corresponding source code, to be 151 | distributed under the terms of Sections 1 and 2 above on a medium 152 | customarily used for software interchange; or, 153 | 154 | c) Accompany it with the information you received as to the offer 155 | to distribute corresponding source code. (This alternative is 156 | allowed only for noncommercial distribution and only if you 157 | received the program in object code or executable form with such 158 | an offer, in accord with Subsection b above.) 159 | 160 | The source code for a work means the preferred form of the work for 161 | making modifications to it. For an executable work, complete source 162 | code means all the source code for all modules it contains, plus any 163 | associated interface definition files, plus the scripts used to 164 | control compilation and installation of the executable. However, as a 165 | special exception, the source code distributed need not include 166 | anything that is normally distributed (in either source or binary 167 | form) with the major components (compiler, kernel, and so on) of the 168 | operating system on which the executable runs, unless that component 169 | itself accompanies the executable. 170 | 171 | If distribution of executable or object code is made by offering 172 | access to copy from a designated place, then offering equivalent 173 | access to copy the source code from the same place counts as 174 | distribution of the source code, even though third parties are not 175 | compelled to copy the source along with the object code. 176 | 177 | 4. You may not copy, modify, sublicense, or distribute the Program 178 | except as expressly provided under this License. Any attempt 179 | otherwise to copy, modify, sublicense or distribute the Program is 180 | void, and will automatically terminate your rights under this License. 181 | However, parties who have received copies, or rights, from you under 182 | this License will not have their licenses terminated so long as such 183 | parties remain in full compliance. 184 | 185 | 5. You are not required to accept this License, since you have not 186 | signed it. However, nothing else grants you permission to modify or 187 | distribute the Program or its derivative works. These actions are 188 | prohibited by law if you do not accept this License. Therefore, by 189 | modifying or distributing the Program (or any work based on the 190 | Program), you indicate your acceptance of this License to do so, and 191 | all its terms and conditions for copying, distributing or modifying 192 | the Program or works based on it. 193 | 194 | 6. Each time you redistribute the Program (or any work based on the 195 | Program), the recipient automatically receives a license from the 196 | original licensor to copy, distribute or modify the Program subject to 197 | these terms and conditions. You may not impose any further 198 | restrictions on the recipients' exercise of the rights granted herein. 199 | You are not responsible for enforcing compliance by third parties to 200 | this License. 201 | 202 | 7. If, as a consequence of a court judgment or allegation of patent 203 | infringement or for any other reason (not limited to patent issues), 204 | conditions are imposed on you (whether by court order, agreement or 205 | otherwise) that contradict the conditions of this License, they do not 206 | excuse you from the conditions of this License. If you cannot 207 | distribute so as to satisfy simultaneously your obligations under this 208 | License and any other pertinent obligations, then as a consequence you 209 | may not distribute the Program at all. For example, if a patent 210 | license would not permit royalty-free redistribution of the Program by 211 | all those who receive copies directly or indirectly through you, then 212 | the only way you could satisfy both it and this License would be to 213 | refrain entirely from distribution of the Program. 214 | 215 | If any portion of this section is held invalid or unenforceable under 216 | any particular circumstance, the balance of the section is intended to 217 | apply and the section as a whole is intended to apply in other 218 | circumstances. 219 | 220 | It is not the purpose of this section to induce you to infringe any 221 | patents or other property right claims or to contest validity of any 222 | such claims; this section has the sole purpose of protecting the 223 | integrity of the free software distribution system, which is 224 | implemented by public license practices. Many people have made 225 | generous contributions to the wide range of software distributed 226 | through that system in reliance on consistent application of that 227 | system; it is up to the author/donor to decide if he or she is willing 228 | to distribute software through any other system and a licensee cannot 229 | impose that choice. 230 | 231 | This section is intended to make thoroughly clear what is believed to 232 | be a consequence of the rest of this License. 233 | 234 | 8. If the distribution and/or use of the Program is restricted in 235 | certain countries either by patents or by copyrighted interfaces, the 236 | original copyright holder who places the Program under this License 237 | may add an explicit geographical distribution limitation excluding 238 | those countries, so that distribution is permitted only in or among 239 | countries not thus excluded. In such case, this License incorporates 240 | the limitation as if written in the body of this License. 241 | 242 | 9. The Free Software Foundation may publish revised and/or new versions 243 | of the General Public License from time to time. Such new versions will 244 | be similar in spirit to the present version, but may differ in detail to 245 | address new problems or concerns. 246 | 247 | Each version is given a distinguishing version number. If the Program 248 | specifies a version number of this License which applies to it and "any 249 | later version", you have the option of following the terms and conditions 250 | either of that version or of any later version published by the Free 251 | Software Foundation. If the Program does not specify a version number of 252 | this License, you may choose any version ever published by the Free Software 253 | Foundation. 254 | 255 | 10. If you wish to incorporate parts of the Program into other free 256 | programs whose distribution conditions are different, write to the author 257 | to ask for permission. For software which is copyrighted by the Free 258 | Software Foundation, write to the Free Software Foundation; we sometimes 259 | make exceptions for this. Our decision will be guided by the two goals 260 | of preserving the free status of all derivatives of our free software and 261 | of promoting the sharing and reuse of software generally. 262 | 263 | NO WARRANTY 264 | ----------- 265 | 266 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 267 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 268 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 269 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 270 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 271 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 272 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 273 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 274 | REPAIR OR CORRECTION. 275 | 276 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 277 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 278 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 279 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 280 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 281 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 282 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 283 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 284 | POSSIBILITY OF SUCH DAMAGES. 285 | 286 | --------------------------- 287 | END OF TERMS AND CONDITIONS 288 | -------------------------------------------------------------------------------- /core/components/modxreact/docs/readme.txt: -------------------------------------------------------------------------------- 1 | -------------------- 2 | Extra: modx-react 3 | -------------------- 4 | Version: 0.1.0 5 | Created: March 14th, 2015 6 | Author: proxyfabio7 | License: GNU GPLv2 (or later at your option) 8 | 9 | About: React server side rendering for MODX Revo 10 | -------------------------------------------------------------------------------- /core/components/modxreact/elements/chunks/samplepackage.chunk.tpl: -------------------------------------------------------------------------------- 1 | samplepackage -------------------------------------------------------------------------------- /core/components/modxreact/elements/plugins/samplepackage.plugin.php: -------------------------------------------------------------------------------- 1 | setLogTarget('FILE'); 3 | if(!$modx->rest){ 4 | 5 | $properties = array_merge(array($scriptProperties['properties']),array( 6 | 'followLocation' => false, // due to open_basedir restrictions 7 | 'freshConnect' => true, 8 | 'timeout'=>4, 9 | )); 10 | 11 | $modx->getService('rest','rest.modRest',null,$properties); 12 | if(!$modx->rest){ 13 | $modx->log(1,'Couldn\'t load rest client. It seems modRest hasn\'t been installed on the system'); 14 | return; 15 | } 16 | } 17 | 18 | if(!$cmp = $scriptProperties['cmp']){ 19 | $modx->log(1,'Component wasn\'t specified'); 20 | return $scriptProperties['cmp']; 21 | } 22 | 23 | 24 | $_props = $scriptProperties; 25 | foreach(array('url','cmp') as $k){ 26 | if($_props[$k]) unset($_props[$k]); 27 | } 28 | 29 | $url = ($url = $scriptProperties['url']) ? $url : $modx->getOption('modxreact.host'); 30 | $response = $modx->rest->post($url, array( 31 | 'params' => json_encode($_props), 32 | 'assets' => $modx->getOption('modxreact.assets'), 33 | 'static' => ($static = $scriptProperties['static']) ? $static : false, 34 | 'cmp' => $cmp 35 | )); 36 | 37 | if($response->responseError || $response->responseInfo->scalar != 200){ 38 | $modx->log(1,"cURL request fail"); 39 | $modx->log(1,"Error code " . $response->responseInfo->scalar ); 40 | $modx->log(1,"Error " . $response->responseError); 41 | $modx->log(1,"Body:" . print_r($response->responseBody,1) ); 42 | return $scriptProperties['cmp']; 43 | } 44 | 45 | return $response->responseBody; -------------------------------------------------------------------------------- /core/components/modxreact/lexicon/en/properties.inc.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {$modx->runSnippet('react',[ "cmp"=>'./basic-example/src/cmp2.jsx', "text"=>123 ])} 8 | 9 | 10 |