Compare commits

...

43 Commits

Author SHA1 Message Date
4cead46ac4 Fixed gh-75 to insure the column names are loaded as before. Fix gh-76 by adding more checks to insure that the correct date is used in the getLastModifiedDate method. 2017-05-04 23:34:28 +01:00
25c632065a updated the readme 2017-04-26 17:30:09 +01:00
ea1edebc05 Resolves gh-71 bug, so that admin views that has no fields are still accessible. Fixed gh-72 to insure all components on Joomla version 3.7.0 works and looks correctly. Please just recompile your components for Joomla v3.7.0 2017-04-26 09:56:17 +01:00
498c75dfcf Next stable release with improvments and fixes 2017-04-08 22:58:53 +01:00
f39a877db2 fixed double // in file path when exporting a component and its images 2017-04-08 21:52:51 +01:00
7afbb131ce fixes gh-68 where the wrong name is used in searching for the alias, it must be the table name, and this is not always the same as the view. 2017-04-08 19:52:09 +01:00
6bba258fec Improved the import feature to insure that we don't have language conflicts with multiple strings for one language. 2017-04-08 14:44:41 +01:00
1cf259a54d Resolves gh-60 with complete implementation of the language manager/translator feature. Added a purge function the clear unused language strings from the database and unlike them from the related component during compilation. 2017-04-07 21:33:35 +01:00
d113d7b91b Added the new language feature to the export and import of Components, so that their related translations can also be linked to the exported package. 2017-04-06 22:40:22 +01:00
dev
2f90f9359c fixed typo 2017-04-06 09:51:46 +01:00
dev
b1d9b672ab Added the global switch to set the percentage a language should be translated before it is automatically added to the component during compilation. Force language to be added when the debug lines are set to be added. 2017-04-06 09:47:51 +01:00
dev
d9b2e51f8c Fix redirect during creation of new language from translation view. 2017-04-05 21:14:29 +01:00
dev
2caaa1a1e3 added the translation to the component view, also adding lang tags of ready translated languages 2017-04-05 17:26:17 +01:00
dev
1b3cb2bfdd fixed the search in translation view 2017-04-05 16:21:56 +01:00
dev
5a6ef33c5b removed button for now 2017-04-05 15:07:48 +01:00
dev
7eb5a2473c include fix for the a.* error 2017-04-05 14:49:11 +01:00
dev
34d14ed95d gh-60 language translation component added, basic implementation 2017-04-05 14:21:10 +01:00
d31b0b6c0c fixed gh-53 the database error call on a.*, very strange 2017-04-05 07:27:39 +01:00
dev
f3f91f492f added the UI for the new Language Manager gh-60 2017-04-03 11:58:41 +01:00
bd0febd92c Resolves gh-63 to prevent repeateble field from being created a second time. Resolves gh-62 to insure full encryption of JCB packages. 2017-04-01 15:59:54 +02:00
b294af2e7d Stable release of component mapped export and import feature 2017-03-31 23:39:20 +02:00
82fd08cf57 Resolves gh-59 the repeatable field id problem. Also improved the export and import to insure snippets and linked admin views are re-mapped on import of the component. Also fixed the target and match field conditions in admin views to re-map the ids correctly. 2017-03-31 23:28:16 +02:00
5dc3f97f15 Export any component completely mapped in JCB and import into another JCB with owner control 2017-03-31 10:18:33 +02:00
cca07258d6 Added owner and key control to export & import of components, also added buy and package link building to global options gh-53 2017-03-30 23:19:12 +02:00
f61bb46073 Resolves gh-53 with stable export & import of fully mapped components. Key export & import encryption and forced update switch, with error and waring messages has been added. 2017-03-28 16:57:59 +02:00
8b522f44d9 Further gh-53 implementation of the export and import of complete components as JCB packages. Fixes gh-56 2017-03-27 14:38:51 +02:00
63b1bac955 Expanded the export feature of gh-53 to bundle the data into package. 2017-03-21 00:07:14 +02:00
3c610acb31 Merge pull request #55 from ro-ot/staging
Development of the export feature of JCB components mapping.
2017-03-19 10:30:09 +02:00
dev
cfd9b33b30 added the custom code search and more to gh-53 2017-03-19 00:55:34 +02:00
dev
952d26f1f8 added the getData method of the component smart export feature 2017-03-18 22:17:15 +02:00
dev
b0ad2ddffc Added the basic code for controller and model for gh-53 2017-03-18 13:16:07 +02:00
7534aed01d Fixed #54 2017-03-18 04:53:27 +02:00
28198e9b9e Next stable release 2017-03-12 14:23:42 +02:00
dev
3953df845c impoved the request linking options, fixed few bugs in compiler (#52) 2017-03-08 06:49:54 +02:00
30e37dcfde Improved category integration, adapted the fields generator to allow one field to be used multiple times in the same view 2017-03-06 14:08:12 +02:00
bc9e5495d7 fixed #43 to insure fields are sorted in the correct order. Added the noticeboard to the compiler page, to insure all our notices gets viewed by all those who use the JCB 2017-03-03 23:53:18 +02:00
4d47f8292f added another fields to admin view to target list controller and model. Also improve compiler to add these new custom script to correct areas 2017-03-02 02:55:04 +02:00
a1ff74f157 Resolves #43 to insure that fields are sorted by tab once save, thanks to @Peeripapo 2017-02-24 16:57:40 +02:00
dc1217e6d1 Resolved #42 to insure the strpos always returns the correct data type. Improvements to some of the UI surrounding the custom code area. Added an edit button for the component being compiled on the complier page. 2017-02-23 02:29:37 +02:00
f2e4df6ecb Improved the custom code by adding the feature that shows where the manual custom code is used, including better placeholder information. Added component information to the compiler view. 2017-02-17 20:35:18 +02:00
a197f503a9 changed component table name to joomla-component to add history/version tracking back to components 2017-02-16 16:02:23 +02:00
79ab3164a6 few changes in comments, descriptions and fields. Included JS files to custom code engine 2017-02-14 02:33:24 +02:00
290a51dd5a Further improved #37 to ensure language strings are set and reversed, also add extra buttons to the compiler page. Major restructure of custom code implementation to make it more stable. Resolved #40 by updating the default field sql values. 2017-02-14 01:24:38 +02:00
508 changed files with 25065 additions and 9069 deletions

View File

@ -1,4 +1,4 @@
# Component Builder (2.3.2)
# Component Builder (2.4.5)
This is a [Joomla 3.x](http://www.joomla.org/) component.
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.4.5) with **ALL** its features and **ALL** concepts totally open-source and free!
Once installed upgrades are quick and easy via the default Joomla upgrade area.
@ -70,16 +70,19 @@ Once installed upgrades are quick and easy via the default Joomla upgrade area.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in JCB and import into another JCB.
+ This and much much more are all possible with this component builder!
# Get Access to Video Tutorials
> **You can purchase more demo content for Component Builder including access to training & help video tutorials:**
> **You can purchase more [demo content](http://vdm.bz/jcb-packages) for Component Builder including access to training & help video tutorials:**
+ Demo Component* see the build on [github](https://github.com/namibia/demo-joomla-3-component)
+ Sermon Distributor* see the build on [github](https://github.com/SermonDistributor/Joomla-3-Component)
+ Help View Integration*
+ Training & Help Videos* tutorials in the component included.
+ *Demo Component* see the build on [github](https://github.com/namibia/demo-joomla-3-component) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_demo.zip) _(free)_
+ *Advance Demo Component* get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_demoAdvanced.zip) _([buy key](http://vdm.bz/get-advance-demo-key))_
+ *Sermon Distributor* see the build on [github](https://github.com/SermonDistributor/Joomla-3-Component) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_sermondistributor.zip) _([buy key](http://vdm.bz/get-sermon-distributor-key))_
+ *Location Data* see the build on [github](https://github.com/vdm-io/Joomla-Location-Data) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_locationData.zip) _([buy key](http://vdm.bz/get-location-data-key))_
+ *Help View Integration*
+ *Training & Help Videos* tutorials in the component included.
[**GET ACCESS NOW!**](http://vdm.bz/component-builder)
@ -104,13 +107,13 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 11th February, 2017
+ *Version*: 2.3.2
+ *Last Build*: 4th May, 2017
+ *Version*: 2.4.5
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **91443**
+ *File count*: **592**
+ *Folder count*: **105**
+ *Line count*: **105986**
+ *File count*: **642**
+ *Folder count*: **115**
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -1,4 +1,4 @@
# Component Builder (2.3.2)
# Component Builder (2.4.5)
This is a [Joomla 3.x](http://www.joomla.org/) component.
@ -8,7 +8,7 @@ The Component Builder for [Joomla](http://www.joomla.org/) that is highly advanc
Whether you're a seasoned [Joomla](http://www.joomla.org/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.3.2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.4.5) with **ALL** its features and **ALL** concepts totally open-source and free!
Once installed upgrades are quick and easy via the default Joomla upgrade area.
@ -70,16 +70,19 @@ Once installed upgrades are quick and easy via the default Joomla upgrade area.
+ You can dynamically add internal help structures to all component.
+ There is no limitations on how big or how much you want to build (server limitation only).
+ This is a complete factory kind of component that functions like a deployment hub.
+ Export any component completely mapped in JCB and import into another JCB.
+ This and much much more are all possible with this component builder!
# Get Access to Video Tutorials
> **You can purchase more demo content for Component Builder including access to training & help video tutorials:**
> **You can purchase more [demo content](http://vdm.bz/jcb-packages) for Component Builder including access to training & help video tutorials:**
+ Demo Component* see the build on [github](https://github.com/namibia/demo-joomla-3-component)
+ Sermon Distributor* see the build on [github](https://github.com/SermonDistributor/Joomla-3-Component)
+ Help View Integration*
+ Training & Help Videos* tutorials in the component included.
+ *Demo Component* see the build on [github](https://github.com/namibia/demo-joomla-3-component) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_demo.zip) _(free)_
+ *Advance Demo Component* get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_demoAdvanced.zip) _([buy key](http://vdm.bz/get-advance-demo-key))_
+ *Sermon Distributor* see the build on [github](https://github.com/SermonDistributor/Joomla-3-Component) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_sermondistributor.zip) _([buy key](http://vdm.bz/get-sermon-distributor-key))_
+ *Location Data* see the build on [github](https://github.com/vdm-io/Joomla-Location-Data) or get the [JCB Package](https://github.com/vdm-io/JCB-Packages/raw/master/JCB_locationData.zip) _([buy key](http://vdm.bz/get-location-data-key))_
+ *Help View Integration*
+ *Training & Help Videos* tutorials in the component included.
[**GET ACCESS NOW!**](http://vdm.bz/component-builder)
@ -104,13 +107,13 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 11th February, 2017
+ *Version*: 2.3.2
+ *Last Build*: 4th May, 2017
+ *Version*: 2.4.5
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **91443**
+ *File count*: **592**
+ *Folder count*: **105**
+ *Line count*: **105986**
+ *File count*: **642**
+ *Folder count*: **115**
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@ -101,6 +101,41 @@
<action name="help_document.export" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EXPORT_DESC" />
<action name="help_document.import" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT_DESC" />
<action name="help_document.submenu" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU_DESC" />
<action name="joomla_component.export_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
<action name="joomla_component.import_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
<action name="joomla_component.access" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC" />
<action name="joomla_component.batch" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC" />
<action name="joomla_component.dashboard_add" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_ADD_DESC" />
<action name="joomla_component.dashboard_list" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_DASHBOARD_LIST_DESC" />
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_DESC" />
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
<action name="joomla_component.export" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EXPORT_DESC" />
<action name="joomla_component.import" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_IMPORT_DESC" />
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
<action name="language_translation.batch" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC" />
<action name="language_translation.create" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC" />
<action name="language_translation.dashboard_list" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DASHBOARD_LIST_DESC" />
<action name="language_translation.delete" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE_DESC" />
<action name="language_translation.edit" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_DESC" />
<action name="language_translation.edit.own" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC" />
<action name="language_translation.edit.state" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC" />
<action name="language_translation.version" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC" />
<action name="language_translation.export" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EXPORT_DESC" />
<action name="language_translation.import" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_IMPORT_DESC" />
<action name="language_translation.submenu" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_SUBMENU" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_SUBMENU_DESC" />
<action name="language.access" title="COM_COMPONENTBUILDER_LANGUAGES_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC" />
<action name="language.batch" title="COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE_DESC" />
<action name="language.create" title="COM_COMPONENTBUILDER_LANGUAGES_CREATE" description="COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC" />
<action name="language.delete" title="COM_COMPONENTBUILDER_LANGUAGES_DELETE" description="COM_COMPONENTBUILDER_LANGUAGES_DELETE_DESC" />
<action name="language.edit" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_DESC" />
<action name="language.edit.own" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC" />
<action name="language.edit.state" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC" />
<action name="language.version" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC" />
<action name="language.export" title="COM_COMPONENTBUILDER_LANGUAGES_EXPORT" description="COM_COMPONENTBUILDER_LANGUAGES_EXPORT_DESC" />
<action name="language.import" title="COM_COMPONENTBUILDER_LANGUAGES_IMPORT" description="COM_COMPONENTBUILDER_LANGUAGES_IMPORT_DESC" />
<action name="language.submenu" title="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU" description="COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC" />
<action name="layout.access" title="COM_COMPONENTBUILDER_LAYOUTS_ACCESS" description="COM_COMPONENTBUILDER_LAYOUTS_ACCESS_DESC" />
<action name="layout.batch" title="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE" description="COM_COMPONENTBUILDER_LAYOUTS_BATCH_USE_DESC" />
<action name="layout.dashboard_add" title="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD" description="COM_COMPONENTBUILDER_LAYOUTS_DASHBOARD_ADD_DESC" />
@ -134,6 +169,11 @@
<action name="template.import" title="COM_COMPONENTBUILDER_TEMPLATES_IMPORT" description="COM_COMPONENTBUILDER_TEMPLATES_IMPORT_DESC" />
<action name="template.submenu" title="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU" description="COM_COMPONENTBUILDER_TEMPLATES_SUBMENU_DESC" />
</section>
<section name="joomla_component">
<action name="joomla_component.edit.add_license" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_ADD_LICENSE_DESC" />
<action name="joomla_component.edit.license_type" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_LICENSE_TYPE_DESC" />
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
</section>
<section name="admin_view">
<action name="core.edit" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_DESC" />
<action name="core.edit.state" title="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE" description="COM_COMPONENTBUILDER_ADMIN_VIEWS_EDIT_STATE_DESC" />
@ -226,6 +266,24 @@
<action name="fieldtype.access" title="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS" description="COM_COMPONENTBUILDER_FIELDTYPES_ACCESS_DESC" />
<action name="fieldtype.version" title="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION" description="COM_COMPONENTBUILDER_FIELDTYPES_EDIT_VERSION_DESC" />
</section>
<section name="language_translation">
<action name="language_translation.edit" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_DESC" />
<action name="language_translation.edit.own" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_OWN_DESC" />
<action name="language_translation.edit.state" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_STATE_DESC" />
<action name="language_translation.create" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC" />
<action name="language_translation.delete" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_DELETE_DESC" />
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
<action name="language_translation.version" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_EDIT_VERSION_DESC" />
</section>
<section name="language">
<action name="language.edit" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_DESC" />
<action name="language.edit.own" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_OWN_DESC" />
<action name="language.edit.state" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_STATE_DESC" />
<action name="language.create" title="COM_COMPONENTBUILDER_LANGUAGES_CREATE" description="COM_COMPONENTBUILDER_LANGUAGES_CREATE_DESC" />
<action name="language.delete" title="COM_COMPONENTBUILDER_LANGUAGES_DELETE" description="COM_COMPONENTBUILDER_LANGUAGES_DELETE_DESC" />
<action name="language.access" title="COM_COMPONENTBUILDER_LANGUAGES_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC" />
<action name="language.version" title="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION" description="COM_COMPONENTBUILDER_LANGUAGES_EDIT_VERSION_DESC" />
</section>
<section name="help_document">
<action name="help_document.edit" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_DESC" />
<action name="help_document.edit.own" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_EDIT_OWN_DESC" />

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 95 of this MVC
@build 3rd February, 2017
@version @update number 110 of this MVC
@build 25th April, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 95 of this MVC
@build 3rd February, 2017
@version @update number 110 of this MVC
@build 25th April, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_views.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 11 of this MVC
@build 2nd February, 2017
@version @update number 48 of this MVC
@build 26th April, 2017
@created 1st February, 2017
@package Component Builder
@subpackage compiler.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 22 of this MVC
@build 3rd February, 2017
@build 1st March, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_view.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 22 of this MVC
@build 3rd February, 2017
@build 1st March, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_views.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 35 of this MVC
@build 10th February, 2017
@version @update number 82 of this MVC
@build 26th April, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 35 of this MVC
@build 10th February, 2017
@version @update number 82 of this MVC
@build 26th April, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_codes.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage dashboard.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 15th January, 2017
@version @update number 84 of this MVC
@build 4th May, 2017
@created 21st May, 2015
@package Component Builder
@subpackage dynamic_get.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 15th January, 2017
@version @update number 84 of this MVC
@build 4th May, 2017
@created 21st May, 2015
@package Component Builder
@subpackage dynamic_gets.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 6 of this MVC
@build 17th October, 2016
@build 18th October, 2016
@created 4th March, 2016
@package Component Builder
@subpackage help_document.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 6 of this MVC
@build 17th October, 2016
@build 18th October, 2016
@created 4th March, 2016
@package Component Builder
@subpackage help_documents.css

View File

@ -9,11 +9,11 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 3rd February, 2017
@version @update number 337 of this MVC
@build 26th April, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.css
@subpackage joomla_component.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html

View File

@ -9,11 +9,11 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 3rd February, 2017
@version @update number 337 of this MVC
@build 26th April, 2017
@created 6th May, 2015
@package Component Builder
@subpackage components.css
@subpackage joomla_components.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html

View File

@ -0,0 +1,27 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 3 of this MVC
@build 3rd April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
/* CSS Document */

View File

@ -0,0 +1,27 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 7th April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language_translation.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
/* CSS Document */

View File

@ -0,0 +1,27 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 7th April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language_translations.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
/* CSS Document */

View File

@ -0,0 +1,27 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 3 of this MVC
@build 3rd April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage languages.css
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
/* CSS Document */

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 66 of this MVC
@build 3rd February, 2017
@version @update number 67 of this MVC
@build 1st April, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layout.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 66 of this MVC
@build 3rd February, 2017
@version @update number 67 of this MVC
@build 1st April, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layouts.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 48 of this MVC
@build 3rd February, 2017
@version @update number 51 of this MVC
@build 6th March, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_view.css

View File

@ -9,8 +9,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 48 of this MVC
@build 3rd February, 2017
@version @update number 51 of this MVC
@build 6th March, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_views.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 40 of this MVC
@build 3rd February, 2017
@build 1st April, 2017
@created 26th May, 2015
@package Component Builder
@subpackage template.css

View File

@ -10,7 +10,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 40 of this MVC
@build 3rd February, 2017
@build 1st April, 2017
@created 26th May, 2015
@package Component Builder
@subpackage templates.css

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -146,13 +146,18 @@ abstract class ###Component###Helper
if (self::checkArray($where))
{
// prep main <-- why? well if $main='' is empty then $table can be categories or users
if (self::checkString($main))
{
$main = '_'.ltrim($main, '_');
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
$query->from($db->quoteName('#__'.$main.'_'.$table));
$query->from($db->quoteName('#_'.$main.'_'.$table));
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
$db->setQuery($query);
$db->execute();
@ -681,57 +686,86 @@ abstract class ###Component###Helper
return $string;
}
public static function safeString($string, $type = 'L', $spacer = '_')
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
{
// remove all numbers and replace with english text version (works well only up to a thousand)
if ($replaceNumbers === true)
{
// remove all numbers and replace with english text version (works well only up to millions)
$string = self::replaceNumbers($string);
}
// 0nly continue if we have a string
if (self::checkString($string))
{
// create file name without the extention that is safe
if ($type === 'filename')
{
// make sure VDM is not in the string
$string = str_replace('VDM', 'vDm', $string);
// Remove anything which isn't a word, whitespace, number
// or any of the following caracters -_()
// If you don't need to handle multi-byte characters
// you can use preg_replace rather than mb_ereg_replace
// Thanks @Łukasz Rysiak!
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
// http://stackoverflow.com/a/2021729/1429677
return preg_replace('/\s+/', ' ', $string);
}
// remove all other characters
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
$string = preg_replace("/[^A-Za-z ]/", '', $string);
// return a string with all first letter of each word uppercase(no undersocre)
if ($type == 'W')
{
return ucwords(strtolower($string));
}
elseif ($type == 'w')
{
return strtolower($string);
}
elseif ($type == 'Ww')
{
return ucfirst(strtolower($string));
}
elseif ($type == 'WW')
{
return strtoupper($string);
}
elseif ($type == 'U')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return all upper
return strtoupper($string);
}
elseif ($type == 'F')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return with first caracter to upper
return ucfirst(strtolower($string));
}
elseif ($type == 'L')
// select final adaptations
if ($type === 'L' || $type === 'strtolower')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// default is to return lower
return strtolower($string);
}
elseif ($type === 'W')
{
// return a string with all first letter of each word uppercase(no undersocre)
return ucwords(strtolower($string));
}
elseif ($type === 'w' || $type === 'word')
{
// return a string with all lowercase(no undersocre)
return strtolower($string);
}
elseif ($type === 'Ww' || $type === 'Word')
{
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
return ucfirst(strtolower($string));
}
elseif ($type === 'WW' || $type === 'WORD')
{
// return a string with all the uppercase(no undersocre)
return strtoupper($string);
}
elseif ($type === 'U' || $type === 'strtoupper')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return all upper
return strtoupper($string);
}
elseif ($type === 'F' || $type === 'ucfirst')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return with first caracter to upper
return ucfirst(strtolower($string));
}
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
{
// convert all words to first letter uppercase
$string = ucwords(strtolower($string));
// remove white space
$string = preg_replace('/\s+/', '', $string);
// now return first letter lowercase
return lcfirst($string);
}
// return string
return $string;
}

View File

@ -0,0 +1,35 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@package Component Builder
@subpackage componentbuilder.php
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
@my wife Roline van der Merwe <http://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* ###Component### Component Category Tree
*/
###CATEGORY_CLASS_TREES###

View File

@ -0,0 +1,50 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@package Component Builder
@subpackage componentbuilder.php
@author Llewellyn van der Merwe <https://www.vdm.io/joomla-component-builder>
@my wife Roline van der Merwe <http://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
###BOM###
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* ###Component### ###View### Component Category Tree
*/
class ###Component######Views###Categories extends JCategories
{
/**
* Class constructor
*
* @param array $options Array of options
*
*/
public function __construct($options = array())
{
$options['table'] = '#__###component###_###view###';
$options['extension'] = 'com_###component###.###views###';
parent::__construct($options);
}
}

View File

@ -320,13 +320,18 @@ abstract class ###Component###Helper
if (self::checkArray($where))
{
// prep main <-- why? well if $main='' is empty then $table can be categories or users
if (self::checkString($main))
{
$main = '_'.ltrim($main, '_');
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
$query->from($db->quoteName('#__'.$main.'_'.$table));
$query->from($db->quoteName('#_'.$main.'_'.$table));
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
$db->setQuery($query);
$db->execute();
@ -673,57 +678,86 @@ abstract class ###Component###Helper
return $string;
}
public static function safeString($string, $type = 'L', $spacer = '_')
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
{
// remove all numbers and replace with english text version (works well only up to a thousand)
if ($replaceNumbers === true)
{
// remove all numbers and replace with english text version (works well only up to millions)
$string = self::replaceNumbers($string);
}
// 0nly continue if we have a string
if (self::checkString($string))
{
// create file name without the extention that is safe
if ($type === 'filename')
{
// make sure VDM is not in the string
$string = str_replace('VDM', 'vDm', $string);
// Remove anything which isn't a word, whitespace, number
// or any of the following caracters -_()
// If you don't need to handle multi-byte characters
// you can use preg_replace rather than mb_ereg_replace
// Thanks @Łukasz Rysiak!
$string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string);
// http://stackoverflow.com/a/2021729/1429677
return preg_replace('/\s+/', ' ', $string);
}
// remove all other characters
$string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string);
$string = preg_replace("/[^A-Za-z ]/", '', $string);
// return a string with all first letter of each word uppercase(no undersocre)
if ($type == 'W')
{
return ucwords(strtolower($string));
}
elseif ($type == 'w')
{
return strtolower($string);
}
elseif ($type == 'Ww')
{
return ucfirst(strtolower($string));
}
elseif ($type == 'WW')
{
return strtoupper($string);
}
elseif ($type == 'U')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return all upper
return strtoupper($string);
}
elseif ($type == 'F')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return with first caracter to upper
return ucfirst(strtolower($string));
}
elseif ($type == 'L')
// select final adaptations
if ($type === 'L' || $type === 'strtolower')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// default is to return lower
return strtolower($string);
}
elseif ($type === 'W')
{
// return a string with all first letter of each word uppercase(no undersocre)
return ucwords(strtolower($string));
}
elseif ($type === 'w' || $type === 'word')
{
// return a string with all lowercase(no undersocre)
return strtolower($string);
}
elseif ($type === 'Ww' || $type === 'Word')
{
// return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre)
return ucfirst(strtolower($string));
}
elseif ($type === 'WW' || $type === 'WORD')
{
// return a string with all the uppercase(no undersocre)
return strtoupper($string);
}
elseif ($type === 'U' || $type === 'strtoupper')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return all upper
return strtoupper($string);
}
elseif ($type === 'F' || $type === 'ucfirst')
{
// replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string);
// return with first caracter to upper
return ucfirst(strtolower($string));
}
elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase')
{
// convert all words to first letter uppercase
$string = ucwords(strtolower($string));
// remove white space
$string = preg_replace('/\s+/', '', $string);
// now return first letter lowercase
return lcfirst($string);
}
// return string
return $string;
}

View File

@ -47,5 +47,5 @@ class ###Component###Controller###Views### extends JControllerAdmin
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER###
}###CONTROLLEREXIMPORTMETHOD### ###CUSTOM_ADMIN_DYNAMIC_BUTTONS_CONTROLLER### ###ADMIN_CUSTOM_BUTTONS_CONTROLLER_LIST###
}

View File

@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
*/
class ###Component###ModelImport extends JModelLegacy
{
// set uploading values
protected $use_streams = false;
protected $allow_unsafe = false;
protected $safeFileOptions = array();
/**
* @var object JTable object
*/
@ -75,10 +80,6 @@ class ###Component###ModelImport extends JModelLegacy
// Recall the 'Import from Directory' path.
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
$this->setState('import.directory', $path);
// set uploading values
$this->use_streams = false;
$this->allow_unsafe = false;
$this->safeFileOptions = array();
parent::populateState();
}
@ -285,16 +286,11 @@ class ###Component###ModelImport extends JModelLegacy
}
// check the extention
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
case 'xls':
case 'ods':
case 'csv':
break;
default:
if(!$this->checkExtension($p_dir))
{
// set error message
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
break;
}
$package['packagename'] = null;
@ -357,18 +353,12 @@ class ###Component###ModelImport extends JModelLegacy
$archivename = JPath::clean($archivename);
// check the extention
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
case 'xls':
case 'ods':
case 'csv':
break;
default:
if(!$this->checkExtension($archivename))
{
// Cleanup the import files
$this->remove($archivename);
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
break;
}
$config = JFactory::getConfig();
@ -384,6 +374,28 @@ class ###Component###ModelImport extends JModelLegacy
return $check;
}
/**
* Check the extension
*
* @param string $file Name of the uploaded file
*
* @return boolean True on success
*
*/
protected function checkExtension($file)
{
// check the extention
switch(strtolower(pathinfo($file, PATHINFO_EXTENSION)))
{
case 'xls':
case 'ods':
case 'csv':
return true;
break;
}
return false;
}
/**
* Clean up temporary uploaded spreadsheet
*

View File

@ -34,6 +34,11 @@ defined('_JEXEC') or die('Restricted access');
*/
class ###Component###Model###View### extends JModelLegacy
{
// set uploading values
protected $use_streams = false;
protected $allow_unsafe = false;
protected $safeFileOptions = array();
/**
* @var object JTable object
*/
@ -75,10 +80,6 @@ class ###Component###Model###View### extends JModelLegacy
// Recall the 'Import from Directory' path.
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
$this->setState('import.directory', $path);
// set uploading values
$this->use_streams = false;
$this->allow_unsafe = false;
$this->safeFileOptions = array();
parent::populateState();
}
###IMPORT_METHOD_CUSTOM###
@ -175,16 +176,11 @@ class ###Component###Model###View### extends JModelLegacy
}
// check the extention
switch(strtolower(pathinfo($p_dir, PATHINFO_EXTENSION))){
case 'xls':
case 'ods':
case 'csv':
break;
default:
if(!$this->checkExtension($p_dir))
{
// set error message
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
break;
}
$package['packagename'] = null;
@ -247,18 +243,12 @@ class ###Component###Model###View### extends JModelLegacy
$archivename = JPath::clean($archivename);
// check the extention
switch(strtolower(pathinfo($archivename, PATHINFO_EXTENSION))){
case 'xls':
case 'ods':
case 'csv':
break;
default:
if(!$this->checkExtension($archivename))
{
// Cleanup the import files
$this->remove($archivename);
$app->enqueueMessage(JText::_('COM_###COMPONENT###_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE'), 'warning');
return false;
break;
}
$config = JFactory::getConfig();
@ -273,6 +263,7 @@ class ###Component###Model###View### extends JModelLegacy
return $check;
}
###IMPORT_EXT_METHOD_CUSTOM###
/**
* Clean up temporary uploaded spreadsheet

View File

@ -47,7 +47,7 @@ class ###Component###Model###Views### extends JModelList
}
parent::__construct($config);
}
}###ADMIN_CUSTOM_BUTTONS_METHOD_LIST###
/**
* Method to auto-populate the model state.

View File

@ -52,7 +52,8 @@ class ###Component###ViewImport extends JViewLegacy
}
// Check for errors.
if (count($errors = $this->get('Errors'))){
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode('<br />', $errors));
return false;
}

View File

@ -132,7 +132,7 @@ class ###Component###View###Views### extends JViewLegacy
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS###
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST###
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{

View File

@ -60,8 +60,7 @@
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB/en-GB.com_###component###.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_###component###.sys.ini</language>
###SITE_LANGUAGES###
</languages>
<administration>
@ -86,8 +85,7 @@
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB/en-GB.com_###component###.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_###component###.sys.ini</language>
###ADMIN_LANGUAGES###
</languages>
</administration>###UPDATESERVER###

View File

@ -30,7 +30,6 @@ defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
$manifest = ###Component###Helper::manifest();
JHtml::_('bootstrap.loadCss');
?>
<img alt="<?php echo JText::_('COM_###COMPONENT###'); ?>" src="components/com_###component###/assets/images/component-300.###COMP_IMAGE_TYPE###">

View File

@ -1,6 +1,11 @@
###INSTALL###
--
-- Always insure this column is large enough for all the access control values.
-- Always insure this column rules is large enough for all the access control values.
--
ALTER TABLE `#__assets` CHANGE `rules` `rules` MEDIUMTEXT NOT NULL COMMENT 'JSON encoded access control.';
--
-- Always insure this column name is large enough for long component and view names.
--
ALTER TABLE `#__assets` CHANGE `name` `name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The unique name for the asset.';

View File

@ -157,24 +157,19 @@
"rename": "Helper_site",
"type": "file"
},
"Helper_category.php": {
"naam":"Helper_category.php",
"path": "c0mp0n3nt/site/helpers",
"rename": "new",
"newName": "category.php",
"type": "file"
},
"script.php": {
"naam":"script.php",
"path": "c0mp0n3nt/",
"rename": false,
"type": "file"
},
"en-GB.com_admin.ini": {
"naam":"en-GB.com_admin.ini",
"path": "c0mp0n3nt/admin/language/en-GB",
"rename": "admin",
"type": "file"
},
"en-GB.com_admin.sys.ini": {
"naam":"en-GB.com_admin.sys.ini",
"path": "c0mp0n3nt/admin/language/en-GB",
"rename": "admin",
"type": "file"
},
"install.mysql.utf8.sql": {
"naam":"install.mysql.utf8.sql",
"path": "c0mp0n3nt/admin/sql",
@ -212,18 +207,6 @@
"rename": false,
"type": "file"
},
"en-GB.com_site.ini": {
"naam":"en-GB.com_site.ini",
"path": "c0mp0n3nt/site/language/en-GB",
"rename": "site",
"type": "file"
},
"en-GB.com_site.sys.ini": {
"naam":"en-GB.com_site.sys.ini",
"path": "c0mp0n3nt/site/language/en-GB",
"rename": "site",
"type": "file"
},
"headercheck.php": {
"naam":"headercheck.php",
"path": "c0mp0n3nt/site/helpers",
@ -677,6 +660,11 @@
"rename": "new",
"newName": "submitbutton.js",
"type": "custom_form"
},
"Helper_category_view.php": {
"path": "c0mp0n3nt/site/helpers",
"rename": "Helper_category_view",
"type": "category"
}
},
"custom_admin": {

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php
@ -46,6 +46,9 @@ $document->addScript('components/com_componentbuilder/assets/js/admin.js');
JLoader::register('ComponentbuilderHelper', dirname(__FILE__) . '/helpers/componentbuilder.php');
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
// Triger the Global Admin Event
ComponentbuilderHelper::globalEvent($document);
// import joomla controller library
jimport('joomla.application.component.controller');

View File

@ -61,6 +61,19 @@
<option value="0">
COM_COMPONENTBUILDER_CONFIG_NO</option>
</field>
<!-- Percentagelanguageadd Field. Type: Number. (joomla) -->
<field
type="number"
name="percentagelanguageadd"
label="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_LABEL"
default="50"
description="COM_COMPONENTBUILDER_CONFIG_PERCENTAGELANGUAGEADD_DESCRIPTION"
class="text_area"
required="true"
min="10"
max="100"
step="10"
/>
<!-- Spacer_hr_a Field. Type: Spacer. A None Database Field. (joomla) -->
<field type="spacer" name="spacer_hr_a" hr="true" class="spacer_hr_a" />
<field name="autorTitle"
@ -223,6 +236,116 @@
hint="COM_COMPONENTBUILDER_CONFIG_GIT_FOLDER_PATH_HINT"
/>
</fieldset>
<fieldset
name="company_custom_config"
label="COM_COMPONENTBUILDER_CONFIG_COMPANY">
<!-- Export_company Field. Type: Text. (joomla) -->
<field
type="text"
name="export_company"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_LABEL"
size="40"
maxlength="150"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="STRING"
message="Error! Please add company name here."
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_COMPANY_HINT"
/>
<!-- Export_owner Field. Type: Text. (joomla) -->
<field
type="text"
name="export_owner"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_LABEL"
size="10"
maxlength="120"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="true"
filter="HTML"
message="Error! Please add owner name here."
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_OWNER_HINT"
/>
<!-- Export_email Field. Type: Text. (joomla) -->
<field
type="text"
name="export_email"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_LABEL"
size="40"
maxlength="150"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_DESCRIPTION"
class="text_area"
required="true"
filter="STRING"
validate="email"
message="Error! Please email address here."
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_EMAIL_HINT"
/>
<!-- Export_website Field. Type: Url. (joomla) -->
<field
type="url"
name="export_website"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_LABEL"
size="60"
maxlength="150"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_DESCRIPTION"
class="text_area"
required="true"
filter="url"
validated="url"
message="Error! Please add website here."
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_WEBSITE_HINT"
/>
<!-- Export_license Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="export_license"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_LABEL"
rows="7"
cols="10"
default="GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_DESCRIPTION"
class="text_area span12"
filter="HTML"
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_LICENSE_HINT"
required="true"
/>
<!-- Export_copyright Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="export_copyright"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_LABEL"
rows="7"
cols="10"
default="Copyright (C) 2015. All Rights Reserved"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_DESCRIPTION"
class="text_area span12"
filter="HTML"
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_COPYRIGHT_HINT"
required="true"
/>
<!-- Export_buy_link Field. Type: Url. (joomla) -->
<field
type="url"
name="export_buy_link"
label="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_LABEL"
size="60"
maxlength="150"
description="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_DESCRIPTION"
class="text_area"
required="false"
filter="url"
validated="url"
message="Error! Please add link here."
hint="COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_HINT"
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage controller.php
@ -88,7 +88,7 @@ class ComponentbuilderController extends JControllerLegacy
if (ComponentbuilderHelper::checkString($view))
{
$views = array(
'component' => 'components',
'joomla_component' => 'joomla_components',
'admin_view' => 'admin_views',
'custom_admin_view' => 'custom_admin_views',
'site_view' => 'site_views',
@ -99,6 +99,8 @@ class ComponentbuilderController extends JControllerLegacy
'snippet' => 'snippets',
'field' => 'fields',
'fieldtype' => 'fieldtypes',
'language_translation' => 'language_translations',
'language' => 'languages',
'help_document' => 'help_documents'
);
// check if this is a list view

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 95 of this MVC
@build 3rd February, 2017
@version @update number 110 of this MVC
@build 25th April, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_view.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 95 of this MVC
@build 3rd February, 2017
@version @update number 110 of this MVC
@build 25th April, 2017
@created 30th April, 2015
@package Component Builder
@subpackage admin_views.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage ajax.json.php
@ -44,6 +44,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
// load the tasks
$this->registerTask('isNew', 'ajax');
$this->registerTask('isRead', 'ajax');
$this->registerTask('getComponentDetails', 'ajax');
$this->registerTask('tableColumns', 'ajax');
$this->registerTask('fieldSelectOptions', 'ajax');
$this->registerTask('getImportScripts', 'ajax');
@ -54,7 +55,11 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
$this->registerTask('dynamicFormDetails', 'ajax');
$this->registerTask('dbTableColumns', 'ajax');
$this->registerTask('viewTableColumns', 'ajax');
$this->registerTask('checkFunctionName', 'ajax');
$this->registerTask('usedin', 'ajax');
$this->registerTask('fieldOptions', 'ajax');
$this->registerTask('getBuildTable', 'ajax');
$this->registerTask('getButton', 'ajax');
}
public function ajax()
@ -145,6 +150,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
case 'getComponentDetails':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idValue = $jinput->get('id', NULL, 'INT');
if($idValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getComponentDetails($idValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'tableColumns':
try
{
@ -530,6 +573,85 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
case 'checkFunctionName':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$functioNameValue = $jinput->get('functioName', NULL, 'STRING');
$idValue = $jinput->get('id', NULL, 'INT');
if($functioNameValue && $idValue && $user->id != 0)
{
$result = $this->getModel('ajax')->checkFunctionName($functioNameValue, $idValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'usedin':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$functioNameValue = $jinput->get('functioName', NULL, 'WORD');
$idValue = $jinput->get('id', NULL, 'INT');
$targetValue = $jinput->get('target', NULL, 'WORD');
if($functioNameValue && $idValue && $targetValue && $user->id != 0)
{
$result = $this->getModel('ajax')->usedin($functioNameValue, $idValue, $targetValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'fieldOptions':
try
{
@ -568,6 +690,83 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
}
}
break;
case 'getBuildTable':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idNameValue = $jinput->get('idName', NULL, 'CMD');
$objectValue = $jinput->get('object', NULL, 'STRING');
if($idNameValue && $objectValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getBuildTable($idNameValue, $objectValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getButton':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$typeValue = $jinput->get('type', NULL, 'WORD');
if($typeValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getButton($typeValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
}
}
else

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 11 of this MVC
@build 2nd February, 2017
@version @update number 48 of this MVC
@build 26th April, 2017
@created 1st February, 2017
@package Component Builder
@subpackage compiler.php
@ -71,10 +71,12 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$version = $jinput->post->get('version', 0, 'INT');
$addBackup = $jinput->post->get('backup', 0, 'INT');
$addGit = $jinput->post->get('git', 0, 'INT');
$addPlaceholders = $jinput->post->get('placeholders', 2, 'INT');
$debugLinenr = $jinput->post->get('debuglinenr', 2, 'INT');
// include component compiler
require_once JPATH_ADMINISTRATOR.'/components/com_componentbuilder/helpers/compiler.php';
$model = $this->getModel('compiler');
if ($model->builder($version,$componentId,$addBackup,$addGit))
if ($model->builder($version,$componentId,$addBackup,$addGit,$addPlaceholders,$debugLinenr))
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
@ -91,61 +93,37 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
if (empty($redirect_url) && $componentId > 0)
{
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
// setup the unrealistic numbers
$counter = $model->getCount();
$folders = $counter['folders'] * 5;
$files = $counter['files'] * 5;
$lines = $counter['lines'] * 10;
$seconds = $folders + $files + $lines;
$totalHours = round($seconds / 3600);
$totalDays = round($totalHours / 8);
// setup the more realistic numbers
$debugging = $seconds / 4;
$planning = $seconds / 7;
$mapping = $seconds / 10;
$office = $seconds / 6;
$seconds = $folders + $files + $lines + $debugging + $planning + $mapping + $office;
$actualTotalHours = round($seconds / 3600);
$actualTotalDays = round($actualTotalHours / 8);
$debuggingHours = round($debugging / 3600);
$planningHours = round($planning / 3600);
$mappingHours = round($mapping / 3600);
$officeHours = round($office / 3600);
// the actual time spent
$actualHoursSpent = $actualTotalHours - $totalHours;
$actualDaysSpent = $actualTotalDays - $totalDays;
// calculate the projects actual time frame of completion
$projectWeekTime = round($actualTotalDays / 5,1);
$projectMonthTime = round($actualTotalDays / 24,1);
if (($pos = strpos($counter['filePath'], "/tmp/")) !== FALSE)
if (($pos = strpos($model->compiler->filepath, "/tmp/")) !== FALSE)
{
$url = JURI::root() . substr($counter['filePath'], $pos + 1);
$url = JURI::root() . substr($model->compiler->filepath, $pos + 1);
}
// Message of successful build
$message = '<h1>The ('.$counter['filename'].') Was Successfully Compiled!</h1>';
$message = '<h1>The ('.$model->compiler->componentFolderName.') Was Successfully Compiled!</h1>';
$message .= '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installExtention\')">';
$message .= 'Install '.$counter['filename'].' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
$message .= 'Install '.$model->compiler->componentFolderName.' on this <span class="icon-joomla icon-white"></span>Joomla website.</button></p>';
$message .= '<h2>Total time saved</h2>';
$message .= '<ul>';
$message .= '<li>Total folders created: <b>'.$counter['folders'].'</b></li>';
$message .= '<li>Total files created: <b>'.$counter['files'].'</b></li>';
$message .= '<li>Total lines written: <b>'.$counter['lines'].'</b></li>';
$message .= '<li>Total folders created: <b>'.$model->compiler->folderCount.'</b></li>';
$message .= '<li>Total files created: <b>'.$model->compiler->fileCount.'</b></li>';
$message .= '<li>Total lines written: <b>'.$model->compiler->lineCount.'</b></li>';
$message .= '<li>A4 Book of: <b>'.$model->compiler->pageCount.' pages</b></li>';
$message .= '</ul>';
$message .= '<p><b>'.$totalHours.' Hours</b> or <b>'.$totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
$message .= '<p><b>'.$model->compiler->totalHours.' Hours</b> or <b>'.$model->compiler->totalDays.' Eight Hour Days</b> <em>(actual time you saved)</em><br />';
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, never making one mistake or taking any coffee break.)</small><br />';
$message .= '<b>'.$actualHoursSpent.' Hours</b> or <b>'.$actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
$message .= '<small>(with the following break down: <b>debugging @'.$debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$mappingHours.'hours</b> = codingtime / 10; <b>office @'.$officeHours.'hours</b> = codingtime / 6;)</small></p>';
$message .= '<p><b>'.$actualTotalHours.' Hours</b> or <b>'.$actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
$message .= '<b>'.$model->compiler->actualHoursSpent.' Hours</b> or <b>'.$model->compiler->actualDaysSpent.' Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
$message .= '<small>(with the following break down: <b>debugging @'.$model->compiler->debuggingHours.'hours</b> = codingtime / 4; <b>planning @'.$model->compiler->planningHours.'hours</b> = codingtime / 7; <b>mapping @'.$model->compiler->mappingHours.'hours</b> = codingtime / 10; <b>office @'.$model->compiler->officeHours.'hours</b> = codingtime / 6;)</small></p>';
$message .= '<p><b>'.$model->compiler->actualTotalHours.' Hours</b> or <b>'.$model->compiler->actualTotalDays.' Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
$message .= '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
$message .= '<p>Project duration: <b>'.$projectWeekTime. ' weeks</b> or <b>'.$projectMonthTime.' months</b></p>';
$message .= '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>'.$model->compiler->projectMonthTime.' months</b></p>';
$message .= '<h2>Path to Zip File</h2>';
$message .= '<p><b>Path:</b> <code>'.$counter['filePath'].'</code><br />';
$message .= '<p><b>Path:</b> <code>'.$model->compiler->filepath.'</code><br />';
$message .= '<b>URL:</b> <code>'.$url.'</code><br /><br />';
$message .= '<small>Hey! you can also download the file right now!</small><br /><a class="btn btn-success" href="'.$url.'" ><span class="icon-download icon-white"></span>Download</a></p>';
$message .= '<p><small><b>Remember!</b> This file is in your tmp folder and therefore publicly accessible untill you click [Clear tmp]!</small> </p>';
$message .= '<p><small>Compilation took <b>'.$model->compiler->secondsCompiled.'</b> seconds to complete.</small> </p>';
// set redirect
$this->setRedirect($redirect_url,$message,'message');
$app->setUserState('com_componentbuilder.extension_name', $counter['filename']);
$app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName);
}
else
{

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage componentbuilder.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 22 of this MVC
@build 3rd February, 2017
@build 1st March, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_view.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 22 of this MVC
@build 3rd February, 2017
@build 1st March, 2017
@created 13th August, 2015
@package Component Builder
@subpackage custom_admin_views.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 35 of this MVC
@build 10th February, 2017
@version @update number 82 of this MVC
@build 26th April, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_code.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 35 of this MVC
@build 10th February, 2017
@version @update number 82 of this MVC
@build 26th April, 2017
@created 11th October, 2016
@package Component Builder
@subpackage custom_codes.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 15th January, 2017
@version @update number 84 of this MVC
@build 4th May, 2017
@created 21st May, 2015
@package Component Builder
@subpackage dynamic_get.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 15th January, 2017
@version @update number 84 of this MVC
@build 4th May, 2017
@created 21st May, 2015
@package Component Builder
@subpackage dynamic_gets.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage help.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 6 of this MVC
@build 17th October, 2016
@build 18th October, 2016
@created 4th March, 2016
@package Component Builder
@subpackage help_document.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 6 of this MVC
@build 17th October, 2016
@build 18th October, 2016
@created 4th March, 2016
@package Component Builder
@subpackage help_documents.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage import.php

View File

@ -0,0 +1,67 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage import_joomla_components.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Componentbuilder Import_joomla_components Controller
*/
class ComponentbuilderControllerImport_joomla_components extends JControllerLegacy
{
/**
* Import an spreadsheet.
*
* @return void
*/
public function import()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('Import_joomla_components');
if ($model->import())
{
$cache = JFactory::getCache('mod_menu');
$cache->clean();
// TODO: Reset the users acl here as well to kill off any missing bits
}
$app = JFactory::getApplication();
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
if (empty($redirect_url))
{
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false);
}
else
{
// wipe out the user state when we're going to redirect
$app->setUserState('com_componentbuilder.redirect_url', '');
$app->setUserState('com_componentbuilder.message', '');
$app->setUserState('com_componentbuilder.extension_message', '');
}
$this->setRedirect($redirect_url);
}
}

View File

@ -10,11 +10,11 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 3rd February, 2017
@version @update number 337 of this MVC
@build 26th April, 2017
@created 6th May, 2015
@package Component Builder
@subpackage component.php
@subpackage joomla_component.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -30,9 +30,9 @@ defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controllerform');
/**
* Component Controller
* Joomla_component Controller
*/
class ComponentbuilderControllerComponent extends JControllerForm
class ComponentbuilderControllerJoomla_component extends JControllerForm
{
/**
* Current or most recently performed task.
@ -45,7 +45,7 @@ class ComponentbuilderControllerComponent extends JControllerForm
public function __construct($config = array())
{
$this->view_list = 'Components'; // safeguard for setting the return view listing to the main view.
$this->view_list = 'Joomla_components'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
@ -59,7 +59,14 @@ class ComponentbuilderControllerComponent extends JControllerForm
* @since 1.6
*/
protected function allowAdd($data = array())
{ // In the absense of better information, revert to the component permissions.
{
// Access check.
$access = JFactory::getUser()->authorise('joomla_component.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
// In the absense of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@ -84,10 +91,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('core.edit', 'com_componentbuilder.component.' . (int) $recordId);
$permission = $user->authorise('core.edit', 'com_componentbuilder.joomla_component.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('core.edit.own', 'com_componentbuilder.component.' . $recordId))
if ($user->authorise('core.edit.own', 'com_componentbuilder.joomla_component.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
@ -182,10 +189,10 @@ class ComponentbuilderControllerComponent extends JControllerForm
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Component', '', array());
$model = $this->getModel('Joomla_component', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components' . $this->getRedirectToListAppend(), false));
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}

View File

@ -0,0 +1,242 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 337 of this MVC
@build 26th April, 2017
@created 6th May, 2015
@package Component Builder
@subpackage joomla_components.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/**
* Joomla_components Controller
*/
class ComponentbuilderControllerJoomla_components extends JControllerAdmin
{
protected $text_prefix = 'COM_COMPONENTBUILDER_JOOMLA_COMPONENTS';
/**
* Proxy for getModel.
* @since 2.5
*/
public function getModel($name = 'Joomla_component', $prefix = 'ComponentbuilderModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Joomla_components');
// get the data to export
$data = $model->getExportData($pks);
if (ComponentbuilderHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
ComponentbuilderHelper::xls($data,'Joomla_components_'.$date->format('jS_F_Y'),'Joomla components exported ('.$date->format('jS F, Y').')','joomla components');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
{
// Get the import model
$model = $this->getModel('Joomla_components');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (ComponentbuilderHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('joomla_component_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'joomla_components');
$session->set('dataType_VDM_IMPORTINTO', 'joomla_component');
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_JOOMLA_COMPONENTS');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
public function smartImport()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
{
$session = JFactory::getSession();
$session->set('backto_VDM_IMPORT', 'joomla_components');
$session->set('dataType_VDM_IMPORTINTO', 'smart_package');
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import_joomla_components&target=smartPackage', false), $message);
return;
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
public function smartExport()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('joomla_component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
// check if there is any selections
if (!ComponentbuilderHelper::checkArray($pks))
{
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
// Get the model
$model = $this->getModel('Joomla_components');
// set auto loader
ComponentbuilderHelper::autoLoader('smart');
// get the data to export
if ($model->getSmartExport($pks))
{
// set the key string
if (componentbuilderHelper::checkString($model->key) && strlen($model->key) == 32)
{
$keyNotice = '<h1>' . JText::sprintf('COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE', $model->key) . '</h1>';
$keyNotice .= '<p>' . JText::_('COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEYBR_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY') . '</h1>';
// set the package owner info
if ((isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company'])) || (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner'])))
{
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
$ownerDetails .= '<ul>';
if (isset($model->info['getKeyFrom']['company']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['company']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $model->info['getKeyFrom']['company']) . '</li>';
}
// add value only if set
if (isset($model->info['getKeyFrom']['owner']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['owner']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $model->info['getKeyFrom']['owner']) . '</li>';
}
// add value only if set
if (isset($model->info['getKeyFrom']['website']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['website']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $model->info['getKeyFrom']['website']) . '</li>';
}
// add value only if set
if (isset($model->info['getKeyFrom']['email']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['email']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $model->info['getKeyFrom']['email']) . '</li>';
}
// add value only if set
if (isset($model->info['getKeyFrom']['license']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['license']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $model->info['getKeyFrom']['license']) . '</li>';
}
// add value only if set
if (isset($model->info['getKeyFrom']['copyright']) && componentbuilderHelper::checkString($model->info['getKeyFrom']['copyright']))
{
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $model->info['getKeyFrom']['copyright']) . '</li>';
}
$ownerDetails .= '</ul>';
}
else
{
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET') . '</h2>';
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE') . '</p>';
$ownerDetails .= '<h3>' . JText::_('COM_COMPONENTBUILDER_YOU_SHOULD_ADD_THE_CORRECT_OWNER_DETAILS') . '</h3>';
$ownerDetails .= '<p>' . JText::_('COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB') . '</p>';
}
}
else
{
$keyNotice = '<h1>' . JText::_('COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY') . '</h1>';
$ownerDetails = '<p>' . JText::_('COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB') . '</p>';
}
// Redirect to the list screen with success.
$message = array();
$message[] = '<h1>' . JText::_('COM_COMPONENTBUILDER_EXPORT_COMPLETED') . '</h1>';
$message[] = '<p>' . JText::sprintf('COM_COMPONENTBUILDER_PATH_TO_THE_ZIPPED_PACKAGE_IS_CODESCODE_BR_S_S', $model->zipPath, $keyNotice, $ownerDetails) . '</p>';
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), implode('', $message), 'Success');
return;
}
else
{
if (componentbuilderHelper::checkString($model->packagePath))
{
// clear all if not successful
ComponentbuilderHelper::removeFolder($model->packagePath);
}
if (componentbuilderHelper::checkString($model->zipPath))
{
// clear all if not successful
JFile::delete($model->zipPath);
}
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error');
return;
}
}

View File

@ -0,0 +1,326 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 3 of this MVC
@build 3rd April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/**
* Language Controller
*/
class ComponentbuilderControllerLanguage extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
public function __construct($config = array())
{
$this->view_list = 'Languages'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
// Access check.
$access = JFactory::getUser()->authorise('language.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('language.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = ($user->authorise('language.access', 'com_componentbuilder.language.' . (int) $recordId) && $user->authorise('language.access', 'com_componentbuilder'));
if (!$access)
{
return false;
}
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('language.edit', 'com_componentbuilder.language.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('language.edit.own', 'com_componentbuilder.language.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('language.edit.own', 'com_componentbuilder'))
{
return true;
}
}
}
return false;
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('language.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 12.2
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$tmpl = $this->input->get('tmpl');
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// Setup redirect info.
$append = '';
if ($refid)
{
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
}
elseif ($ref)
{
$append .= '&ref='.(string)$ref;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Language', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
$cancel = parent::cancel($key);
if ($cancel)
{
if ($this->refid)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
if ($this->refid && $saved)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref && $saved)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
return;
}
}

View File

@ -0,0 +1,326 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 7th April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language_translation.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controllerform');
/**
* Language_translation Controller
*/
class ComponentbuilderControllerLanguage_translation extends JControllerForm
{
/**
* Current or most recently performed task.
*
* @var string
* @since 12.2
* @note Replaces _task.
*/
protected $task;
public function __construct($config = array())
{
$this->view_list = 'Language_translations'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
// Access check.
$access = JFactory::getUser()->authorise('language_translation.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('language_translation.create', $this->option);
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
// get user object.
$user = JFactory::getUser();
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = ($user->authorise('language_translation.access', 'com_componentbuilder.language_translation.' . (int) $recordId) && $user->authorise('language_translation.access', 'com_componentbuilder'));
if (!$access)
{
return false;
}
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('language_translation.edit', 'com_componentbuilder.language_translation.' . (int) $recordId);
if (!$permission)
{
if ($user->authorise('language_translation.edit.own', 'com_componentbuilder.language_translation.' . $recordId))
{
// Now test the owner is the user.
$ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
if (empty($ownerId))
{
// Need to do a lookup from the model.
$record = $this->getModel()->getItem($recordId);
if (empty($record))
{
return false;
}
$ownerId = $record->created_by;
}
// If the owner matches 'me' then allow.
if ($ownerId == $user->id)
{
if ($user->authorise('language_translation.edit.own', 'com_componentbuilder'))
{
return true;
}
}
}
return false;
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('language_translation.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since 12.2
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$tmpl = $this->input->get('tmpl');
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// Setup redirect info.
$append = '';
if ($refid)
{
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
}
elseif ($ref)
{
$append .= '&ref='.(string)$ref;
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
}
if ($layout)
{
$append .= '&layout=' . $layout;
}
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
}
return $append;
}
/**
* Method to run batch operations.
*
* @param object $model The model.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Language_translation', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
/**
* Method to cancel an edit.
*
* @param string $key The name of the primary key of the URL variable.
*
* @return boolean True if access level checks pass, false otherwise.
*
* @since 12.2
*/
public function cancel($key = null)
{
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
$cancel = parent::cancel($key);
if ($cancel)
{
if ($this->refid)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
}
else
{
// Redirect to the items screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
)
);
}
return $cancel;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return boolean True if successful, false otherwise.
*
* @since 12.2
*/
public function save($key = null, $urlVar = null)
{
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
if ($this->refid && $saved)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
elseif ($this->ref && $saved)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . $redirect, false
)
);
}
return $saved;
}
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
return;
}
}

View File

@ -0,0 +1,111 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 39 of this MVC
@build 7th April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage language_translations.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controlleradmin library
jimport('joomla.application.component.controlleradmin');
/**
* Language_translations Controller
*/
class ComponentbuilderControllerLanguage_translations extends JControllerAdmin
{
protected $text_prefix = 'COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS';
/**
* Proxy for getModel.
* @since 2.5
*/
public function getModel($name = 'Language_translation', $prefix = 'ComponentbuilderModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
public function exportData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('language_translation.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
{
// Get the input
$input = JFactory::getApplication()->input;
$pks = $input->post->get('cid', array(), 'array');
// Sanitize the input
JArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Language_translations');
// get the data to export
$data = $model->getExportData($pks);
if (ComponentbuilderHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
ComponentbuilderHelper::xls($data,'Language_translations_'.$date->format('jS_F_Y'),'Language translations exported ('.$date->format('jS F, Y').')','language translations');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error');
return;
}
public function importData()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('language_translation.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
{
// Get the import model
$model = $this->getModel('Language_translations');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (ComponentbuilderHelper::checkObject($headers))
{
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('language_translation_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'language_translations');
$session->set('dataType_VDM_IMPORTINTO', 'language_translation');
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGE_TRANSLATIONS');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=language_translations', false), $message, 'error');
return;
}
}

View File

@ -10,11 +10,11 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 81 of this MVC
@build 3rd February, 2017
@created 6th May, 2015
@version @update number 3 of this MVC
@build 3rd April, 2017
@created 3rd April, 2017
@package Component Builder
@subpackage components.php
@subpackage languages.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -30,16 +30,16 @@ defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controlleradmin');
/**
* Components Controller
* Languages Controller
*/
class ComponentbuilderControllerComponents extends JControllerAdmin
class ComponentbuilderControllerLanguages extends JControllerAdmin
{
protected $text_prefix = 'COM_COMPONENTBUILDER_COMPONENTS';
protected $text_prefix = 'COM_COMPONENTBUILDER_LANGUAGES';
/**
* Proxy for getModel.
* @since 2.5
*/
public function getModel($name = 'Component', $prefix = 'ComponentbuilderModel', $config = array())
public function getModel($name = 'Language', $prefix = 'ComponentbuilderModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
@ -52,7 +52,7 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if export is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('component.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
if ($user->authorise('language.export', 'com_componentbuilder') && $user->authorise('core.export', 'com_componentbuilder'))
{
// Get the input
$input = JFactory::getApplication()->input;
@ -60,19 +60,19 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
// Sanitize the input
JArrayHelper::toInteger($pks);
// Get the model
$model = $this->getModel('Components');
$model = $this->getModel('Languages');
// get the data to export
$data = $model->getExportData($pks);
if (ComponentbuilderHelper::checkArray($data))
{
// now set the data to the spreadsheet
$date = JFactory::getDate();
ComponentbuilderHelper::xls($data,'Components_'.$date->format('jS_F_Y'),'Components exported ('.$date->format('jS F, Y').')','components');
ComponentbuilderHelper::xls($data,'Languages_'.$date->format('jS_F_Y'),'Languages exported ('.$date->format('jS F, Y').')','languages');
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_EXPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
return;
}
@ -83,10 +83,10 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if import is allowed for this user.
$user = JFactory::getUser();
if ($user->authorise('component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
if ($user->authorise('language.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
{
// Get the import model
$model = $this->getModel('Components');
$model = $this->getModel('Languages');
// get the headers to import
$headers = $model->getExImPortHeaders();
if (ComponentbuilderHelper::checkObject($headers))
@ -94,18 +94,18 @@ class ComponentbuilderControllerComponents extends JControllerAdmin
// Load headers to session.
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('component_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'components');
$session->set('dataType_VDM_IMPORTINTO', 'component');
$session->set('language_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'languages');
$session->set('dataType_VDM_IMPORTINTO', 'language');
// Redirect to import view.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_COMPONENTS');
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_SELECT_FILE_FOR_LANGUAGES');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=import', false), $message);
return;
}
}
// Redirect to the list screen with error.
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=components', false), $message, 'error');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
return;
}
}

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 66 of this MVC
@build 3rd February, 2017
@version @update number 67 of this MVC
@build 1st April, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layout.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 66 of this MVC
@build 3rd February, 2017
@version @update number 67 of this MVC
@build 1st April, 2017
@created 18th May, 2015
@package Component Builder
@subpackage layouts.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 48 of this MVC
@build 3rd February, 2017
@version @update number 51 of this MVC
@build 6th March, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_view.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 48 of this MVC
@build 3rd February, 2017
@version @update number 51 of this MVC
@build 6th March, 2017
@created 29th May, 2015
@package Component Builder
@subpackage site_views.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 40 of this MVC
@build 3rd February, 2017
@build 1st April, 2017
@created 26th May, 2015
@package Component Builder
@subpackage template.php

View File

@ -11,7 +11,7 @@
/-------------------------------------------------------------------------------------------------------------------------------/
@version @update number 40 of this MVC
@build 3rd February, 2017
@build 1st April, 2017
@created 26th May, 2015
@package Component Builder
@subpackage templates.php

View File

@ -464,4 +464,3 @@ class Dropbox
return function_exists('curl_version');
}
}

View File

@ -41,6 +41,15 @@ class Compiler extends Infusion
*/
private $tempPath;
/*
* The timer
*
* @var string
*/
private $time_start;
private $time_end;
public $secondsCompiled;
public $filepath = '';
// fixed pathes
protected $dynamicIntegration = false;
@ -53,7 +62,8 @@ class Compiler extends Infusion
*/
public function __construct($config = array ())
{
// $time_start = microtime(true);
// to check the compiler speed
$this->time_start = microtime(true);
// first we run the perent constructor
if (parent::__construct($config))
{
@ -77,7 +87,7 @@ class Compiler extends Infusion
$this->removeFolder($this->componentPath . '/site');
// clear form component xml
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
$componentXML = JFile::read($xmlPath);
$componentXML = file_get_contents($xmlPath);
$textToSite = ComponentbuilderHelper::getBetween($componentXML,'<files folder="site">','</files>');
$textToSiteLang = ComponentbuilderHelper::getBetween($componentXML,'<languages folder="site">','</languages>');
$componentXML = str_replace(array('<files folder="site">'.$textToSite."</files>", '<languages folder="site">'.$textToSiteLang."</languages>"), array('',''), $componentXML);
@ -88,46 +98,29 @@ class Compiler extends Infusion
{
return false;
}
// we can remove all undeeded data
$this->freeMemory();
// check if this component is install on the current website
if ($paths = $this->getLocalInstallPaths())
{
// start Automatic import of custom code
$userId = JFactory::getUser()->id;
$today = JFactory::getDate()->toSql();
// Get a db connection.
$db = JFactory::getDbo();
// get the custom code from installed files
$this->customCodeFactory($paths, $db, $userId, $today);
}
// now add the other custom code by placeholder
if (ComponentbuilderHelper::checkArray($this->addCustomCodeAt))
{
// load error messages incase code can not be added
$app = JFactory::getApplication();
$this->addCustomCodeViaPlaceholders($app);
}
// check if we have custom code to add
$this->getCustomCode();
// now insert into the new files
if (ComponentbuilderHelper::checkArray($this->customCode))
if ($this->getCustomCode())
{
// load error messages incase code can not be added
$app = JFactory::getApplication();
$this->addCustomCode($app);
$this->addCustomCode();
}
// set the lang data now
$this->setLangFileData();
// move the update server into place
$this->setUpdateServer();
// set the global counters
$this->setCountingStuff();
// build read me
$this->buildReadMe();
// zip the component
if (!$this->zipComponent())
{
// done
// done with error
return false;
}
// $time_end = microtime(true);
// $time = $time_end - $time_start;
// var_dump("Did Test in ($time seconds)");die;
// end the timer here
$this->time_end = microtime(true);
$this->secondsCompiled = $this->time_end - $this->time_start;
// completed the compilation
return true;
}
return false;
@ -143,7 +136,7 @@ class Compiler extends Infusion
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Compiler '.$nr.']';
}
@ -161,7 +154,7 @@ class Compiler extends Infusion
if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic']))
{
// get the bom file
$bom = JFile::read($this->bomPath);
$bom = file_get_contents($this->bomPath);
// first we do the static files
foreach ($this->newFiles['static'] as $static)
{
@ -173,22 +166,18 @@ class Compiler extends Infusion
{
$php = "<?php\n";
}
$string = JFile::read($static['path']);
$string = file_get_contents($static['path']);
if (strpos($string,'###BOM###') !== false)
{
list($wast,$code) = explode('###BOM###',$string);
$string = $php.$bom.$code;
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($static['path'], $answer);
// add to zip array
$this->writeFile($static['path'],$answer);
}
else
{
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($static['path'], $answer);
// add to zip array
$this->writeFile($static['path'],$answer);
}
@ -214,15 +203,13 @@ class Compiler extends Infusion
{
$php = "<?php\n";
}
$string = JFile::read($file['path']);
$string = file_get_contents($file['path']);
if (strpos($string,'###BOM###') !== false)
{
list($bin,$code) = explode('###BOM###',$string);
$string = $php.$bom.$code;
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($file['path'], $answer, $view);
// add to zip array
$this->writeFile($file['path'],$answer);
}
@ -230,8 +217,6 @@ class Compiler extends Infusion
{
$answer = $this->setPlaceholders($string, $this->fileContentStatic, 3);
$answer = $this->setPlaceholders($answer, $this->fileContentDynamic[$view], 3);
// add custom Code by placeholder if found
$this->getPlaceHolderKeys($file['path'], $answer, $view);
// add to zip array
$this->writeFile($file['path'],$answer);
}
@ -245,156 +230,11 @@ class Compiler extends Infusion
}
// free up some memory
unset($this->newFiles['dynamic']);
// do a final run to update the readme file
$two = 0;
foreach ($this->newFiles['static'] as $static)
{
if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path']))
{
$this->buildReadMe($static['path']);
$two++;
}
if ($two == 2)
{
break;
}
}
return true;
}
return false;
}
protected function getPlaceHolderKeys(&$file, &$content, &$view = '')
{
// check if line has custom code place holder
if (strpos($content, '[CUSTO'.'MCODE=') !== false)
{
if (!isset($this->addCustomCodeAt[$file]))
{
$this->addCustomCodeAt[$file] = array();
$this->addCustomCodeAt[$file]['ids'] = array();
$this->addCustomCodeAt[$file]['args'] = array();
$this->addCustomCodeAt[$file]['view'] = $view;
}
$found = ComponentbuilderHelper::getAllBetween($content, '[CUSTO'.'MCODE=', ']');
if (ComponentbuilderHelper::checkArray($found))
{
foreach ($found as $key)
{
// check if we have args
if (is_numeric($key))
{
$id = (int) $key;
}
elseif (strpos($key, '+') !== false)
{
$array = explode('+', $key);
// set ID
$id = (int) $array[0];
// load args for this ID
if (isset($array[1]))
{
if (!isset($this->addCustomCodeAt[$file]['args'][$id]))
{
$this->addCustomCodeAt[$file]['args'][$id] = array();
}
// only load if not already loaded
if (!isset($this->addCustomCodeAt[$file]['args'][$id][$key]))
{
if (strpos($array[1], ',') !== false)
{
$this->addCustomCodeAt[$file]['args'][$id][$key] = array_map('trim', explode(',', $array[1]));
}
elseif (ComponentbuilderHelper::checkString($array[1]))
{
$this->addCustomCodeAt[$file]['args'][$id][$key] = array();
$this->addCustomCodeAt[$file]['args'][$id][$key][] = trim($array[1]);
}
}
}
}
else
{
continue;
}
$this->addCustomCodeAt[$file]['ids'][$id] = $id;
}
}
}
}
protected function freeMemory()
{
// free up some memory
unset($this->newFiles['static']);
unset($this->customScriptBuilder);
unset($this->permissionCore);
unset($this->permissionDashboard);
unset($this->componentData->admin_views);
unset($this->componentData->site_views);
unset($this->componentData->custom_admin_views);
unset($this->componentData->config);
unset($this->joomlaVersionData);
// unset($this->langContent);
unset($this->dbKeys);
unset($this->permissionBuilder);
unset($this->layoutBuilder);
unset($this->historyBuilder);
unset($this->aliasBuilder);
unset($this->titleBuilder);
unset($this->customBuilderList);
unset($this->hiddenFieldsBuilder);
unset($this->intFieldsBuilder);
unset($this->dynamicfieldsBuilder);
unset($this->maintextBuilder);
unset($this->customFieldLinksBuilder);
unset($this->setScriptUserSwitch);
unset($this->categoryBuilder);
unset($this->catCodeBuilder);
unset($this->checkboxBuilder);
unset($this->jsonItemBuilder);
unset($this->base64Builder);
unset($this->basicEncryptionBuilder);
unset($this->advancedEncryptionBuilder);
unset($this->getItemsMethodListStringFixBuilder);
unset($this->getItemsMethodEximportStringFixBuilder);
unset($this->selectionTranslationFixBuilder);
unset($this->listBuilder);
unset($this->customBuilder);
unset($this->editBodyViewScriptBuilder);
unset($this->queryBuilder);
unset($this->sortBuilder);
unset($this->searchBuilder);
unset($this->filterBuilder);
unset($this->fieldsNames);
unset($this->siteFields);
unset($this->siteFieldData);
unset($this->customFieldScript);
unset($this->configFieldSets);
unset($this->jsonStringBuilder);
unset($this->importCustomScripts);
unset($this->eximportView);
unset($this->uninstallBuilder);
unset($this->listColnrBuilder);
unset($this->customFieldBuilder);
unset($this->permissionFields);
unset($this->getAsLookup);
unset($this->secondRunAdmin);
unset($this->uninstallScriptBuilder);
unset($this->buildCategories);
unset($this->iconBuilder);
unset($this->validationFixBuilder);
unset($this->targetRelationControl);
unset($this->targetControlsScriptChecker);
unset($this->accessBuilder);
unset($this->tabCounter);
unset($this->linkedAdminViews);
unset($this->uniquekeys);
unset($this->uniquecodes);
$this->unsetNow('_adminViewData');
$this->unsetNow('_fieldData');
}
/**
* move the local update server xml file to a remote ftp server
*
@ -457,7 +297,58 @@ class Compiler extends Infusion
$this->fileContentStatic['###VERSION###'] = $this->fileContentStatic['###VERSION###GLOBAL'];
}
private function buildReadMe($path)
// set all global numbers
protected function setCountingStuff()
{
// what is the size in terms of an A4 book
$this->pageCount = round($this->lineCount / 56);
// setup the unrealistic numbers
$this->folderSeconds = $this->folderCount * 5;
$this->fileSeconds = $this->fileCount * 5;
$this->lineSeconds = $this->lineCount * 10;
$this->seconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds;
$this->totalHours = round($this->seconds / 3600);
$this->totalDays = round($this->totalHours / 8);
// setup the more realistic numbers
$this->secondsDebugging = $this->seconds / 4;
$this->secondsPlanning = $this->seconds / 7;
$this->secondsMapping = $this->seconds / 10;
$this->secondsOffice = $this->seconds / 6;
$this->actualSeconds = $this->folderSeconds + $this->fileSeconds + $this->lineSeconds + $this->secondsDebugging + $this->secondsPlanning + $this->secondsMapping + $this->secondsOffice;
$this->actualTotalHours = round($this->actualSeconds / 3600);
$this->actualTotalDays = round($this->actualTotalHours / 8);
$this->debuggingHours = round($this->secondsDebugging / 3600);
$this->planningHours = round($this->secondsPlanning / 3600);
$this->mappingHours = round($this->secondsMapping / 3600);
$this->officeHours = round($this->secondsOffice / 3600);
// the actual time spent
$this->actualHoursSpent = $this->actualTotalHours - $this->totalHours;
$this->actualDaysSpent = $this->actualTotalDays - $this->totalDays;
// calculate the projects actual time frame of completion
$this->projectWeekTime = round($this->actualTotalDays / 5,1);
$this->projectMonthTime = round($this->actualTotalDays / 24,1);
}
private function buildReadMe()
{
// do a final run to update the readme file
$two = 0;
foreach ($this->newFiles['static'] as $static)
{
if (('README.md' === $static['name'] || 'README.txt' === $static['name']) && $this->componentData->addreadme && JFile::exists($static['path']))
{
$this->setReadMe($static['path']);
$two++;
}
if ($two == 2)
{
break;
}
}
unset($this->newFiles['static']);
}
private function setReadMe($path)
{
// set readme data if not set already
if (!isset($this->fileContentStatic['###LINE_COUNT###']) || $this->fileContentStatic['###LINE_COUNT###'] != $this->lineCount)
@ -465,7 +356,7 @@ class Compiler extends Infusion
$this->buildReadMeData();
}
// get the file
$string = JFile::read($path);
$string = file_get_contents($path);
// update the file
$answer = $this->setPlaceholders($string, $this->fileContentStatic);
// add to zip array
@ -474,55 +365,39 @@ class Compiler extends Infusion
private function buildReadMeData()
{
// setup the unrealistic numbers
$folders = $this->folderCount * 5;
$files = $this->fileCount * 5;
$lines = $this->lineCount * 10;
$seconds = $folders + $files + $lines;
$totalHours = round($seconds / 3600);
$totalDays = round($totalHours / 8);
// setup the more realistic numbers
$debugging = $seconds / 4;
$planning = $seconds / 7;
$mapping = $seconds / 10;
$office = $seconds / 6;
$seconds = $folders + $files + $lines + $debugging + $planning + $mapping + $office;
$actualTotalHours = round($seconds / 3600);
$actualTotalDays = round($actualTotalHours / 8);
$debuggingHours = round($debugging / 3600);
$planningHours = round($planning / 3600);
$mappingHours = round($mapping / 3600);
$officeHours = round($office / 3600);
// the actual time spent
$actualHoursSpent = $actualTotalHours - $totalHours;
$actualDaysSpent = $actualTotalDays - $totalDays;
// calculate the projects actual time frame of completion
$projectWeekTime = round($actualTotalDays / 5,1);
$projectMonthTime = round($actualTotalDays / 24,1);
// set some defaults
$this->fileContentStatic['###LINE_COUNT###'] = $this->lineCount;
$this->fileContentStatic['###FILE_COUNT###'] = $this->fileCount;
$this->fileContentStatic['###FOLDER_COUNT###'] = $this->folderCount;
$this->fileContentStatic['###folders###'] = $folders;
$this->fileContentStatic['###files###'] = $files;
$this->fileContentStatic['###lines###'] = $lines;
$this->fileContentStatic['###seconds###'] = $seconds;
$this->fileContentStatic['###totalHours###'] = $totalHours;
$this->fileContentStatic['###totalDays###'] = $totalDays;
$this->fileContentStatic['###debugging###'] = $debugging;
$this->fileContentStatic['###planning###'] = $planning;
$this->fileContentStatic['###mapping###'] = $mapping;
$this->fileContentStatic['###office###'] = $office;
$this->fileContentStatic['###actualTotalHours###'] = $actualTotalHours;
$this->fileContentStatic['###actualTotalDays###'] = $actualTotalDays;
$this->fileContentStatic['###debuggingHours###'] = $debuggingHours;
$this->fileContentStatic['###planningHours###'] = $planningHours;
$this->fileContentStatic['###mappingHours###'] = $mappingHours;
$this->fileContentStatic['###officeHours###'] = $officeHours;
$this->fileContentStatic['###actualHoursSpent###'] = $actualHoursSpent;
$this->fileContentStatic['###actualDaysSpent###'] = $actualDaysSpent;
$this->fileContentStatic['###projectWeekTime###'] = $projectWeekTime;
$this->fileContentStatic['###projectMonthTime###'] = $projectMonthTime;
$this->fileContentStatic['###PAGE_COUNT###'] = $this->pageCount;
$this->fileContentStatic['###folders###'] = $this->folderSeconds;
$this->fileContentStatic['###foldersSeconds###'] = $this->folderSeconds;
$this->fileContentStatic['###files###'] = $this->fileSeconds;
$this->fileContentStatic['###filesSeconds###'] = $this->fileSeconds;
$this->fileContentStatic['###lines###'] = $this->lineSeconds;
$this->fileContentStatic['###linesSeconds###'] = $this->lineSeconds;
$this->fileContentStatic['###seconds###'] = $this->actualSeconds;
$this->fileContentStatic['###actualSeconds###'] = $this->actualSeconds;
$this->fileContentStatic['###totalHours###'] = $this->totalHours;
$this->fileContentStatic['###totalDays###'] = $this->totalDays;
$this->fileContentStatic['###debugging###'] = $this->secondsDebugging;
$this->fileContentStatic['###secondsDebugging###'] = $this->secondsDebugging;
$this->fileContentStatic['###planning###'] = $this->secondsPlanning;
$this->fileContentStatic['###secondsPlanning###'] = $this->secondsPlanning;
$this->fileContentStatic['###mapping###'] = $this->secondsMapping;
$this->fileContentStatic['###secondsMapping###'] = $this->secondsMapping;
$this->fileContentStatic['###office###'] = $this->secondsOffice;
$this->fileContentStatic['###secondsOffice###'] = $this->secondsOffice;
$this->fileContentStatic['###actualTotalHours###'] = $this->actualTotalHours;
$this->fileContentStatic['###actualTotalDays###'] = $this->actualTotalDays;
$this->fileContentStatic['###debuggingHours###'] = $this->debuggingHours;
$this->fileContentStatic['###planningHours###'] = $this->planningHours;
$this->fileContentStatic['###mappingHours###'] = $this->mappingHours;
$this->fileContentStatic['###officeHours###'] = $this->officeHours;
$this->fileContentStatic['###actualHoursSpent###'] = $this->actualHoursSpent;
$this->fileContentStatic['###actualDaysSpent###'] = $this->actualDaysSpent;
$this->fileContentStatic['###projectWeekTime###'] = $this->projectWeekTime;
$this->fileContentStatic['###projectMonthTime###'] = $this->projectMonthTime;
}
private function zipComponent()
@ -539,39 +414,9 @@ class Compiler extends Infusion
}
// the name of the zip file to create
$this->filepath = $this->tempPath.'/'.$this->componentFolderName.'.zip';
// store the current joomla working directory
$joomla = getcwd();
// we are changing the working directory to the componet temp folder
chdir($this->componentPath);
// the full file path of the zip file
$this->filepath = JPath::clean($this->filepath);
// delete an existing zip file (or use an exclusion parameter in JFolder::files()
JFile::delete($this->filepath);
// get a list of files in the current directory tree
$files = JFolder::files('.', '', true, true);
$zipArray = array();
// setup the zip array
foreach ($files as $file)
{
$tmp = array();
$tmp['name'] = str_replace('./', '', $file);
$tmp['data'] = JFile::read($file);
$tmp['time'] = filemtime($file);
$zipArray[] = $tmp;
}
// change back to joomla working directory
chdir($joomla);
// get the zip adapter
$zip = JArchive::getAdapter('zip');
//create the zip file
if ($zip->create($this->filepath, $zipArray))
if (ComponentbuilderHelper::zip($this->componentPath, $this->filepath))
{
// now move to backup if zip was made and backup is requered
if ($this->backupPath && $this->dynamicIntegration)
@ -672,98 +517,10 @@ class Compiler extends Infusion
return false;
}
protected function addCustomCodeViaPlaceholders($app)
{
// reset all these
$this->clearFromPlaceHolders('view');
foreach ($this->addCustomCodeAt as $path => $item)
{
if (ComponentbuilderHelper::checkString($item['view']))
{
$this->placeholders['[[[view]]]'] = $item['view'];
}
elseif (isset($this->placeholders['[[[view]]]']))
{
unset($this->placeholders['[[[view]]]']);
}
if ($this->getCustomCode($item['ids']))
{
$code = array();
foreach($this->customCode as $dbitem)
{
$this->buildCustomCodeForPlaceholders($item, $dbitem, $code);
}
// now update the file
$string = JFile::read($path);
$answer = $this->setPlaceholders($string, $code);
$this->writeFile($path,$answer);
}
else
{
$app->enqueueMessage(JText::sprintf('Custom code could not be added to <b>%s</b> <br />Since there where no publish code returned from the database.', $path), 'warning');
}
}
}
protected function buildCustomCodeForPlaceholders(&$at, &$item, &$code)
{
// check if there is args for this code
if (isset($at['args'][$item['id']]) && ComponentbuilderHelper::checkArray($at['args'][$item['id']]))
{
// since we have args we cant update this code via editor (TODO)
$placeholder = $this->getPlaceHolder(3, null);
// we have args and so need to load each
foreach ($at['args'][$item['id']] as $key => $args)
{
$this->setThesePlaceHolders('arg', $args);
$code['[CUSTOM'.'CODE='.$key.']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end'];
}
}
else
{
// check what type of place holders we should load here (if view is being updated then we can't use inserted)
$placeholderType = 2;
if (strpos($item['code'], '[[[view]]]') !== false)
{
// since we have views we can't update this code via editor (TODO)
$placeholderType = 3;
}
// if now ars were found, clear it
$this->clearFromPlaceHolders('arg');
// load args for this code
$placeholder = $this->getPlaceHolder($placeholderType, $item['id']);
$code['[CUSTOM'.'CODE='.$item['id'].']'] = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($item['code'], $this->placeholders). $placeholder['end'];
}
}
protected function setThesePlaceHolders($key, $values)
{
// aways fist reset these
$this->clearFromPlaceHolders($key);
if (ComponentbuilderHelper::checkArray($values))
{
$number = 0;
foreach ($values as $value)
{
$this->placeholders['[[['.$key.$number.']]]'] = $value;
$number++;
}
}
}
protected function clearFromPlaceHolders($like)
{
foreach ($this->placeholders as $something => $value)
{
if (stripos($something, $like) !== false)
{
unset($this->placeholders[$something]);
}
}
}
protected function addCustomCode($app)
protected function addCustomCode()
{
// load error messages incase code can not be added
$app = JFactory::getApplication();
// reset all these
$this->clearFromPlaceHolders('view');
$this->clearFromPlaceHolders('arg');
@ -860,8 +617,8 @@ class Compiler extends Infusion
}
if ($found)
{
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'];
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
$data = $placeholder['start'] . PHP_EOL . $this->setPlaceholders($target['code'], $this->placeholders). $placeholder['end'] . PHP_EOL;
if ($target['type'] == 2)
{
// found it now add code from the next line
@ -870,7 +627,7 @@ class Compiler extends Infusion
elseif ($target['type'] == 1 && $foundEnd)
{
// found it now add code from the next line
$this->addDataToFile($file, $data . PHP_EOL, $bites, (int) array_sum($replace));
$this->addDataToFile($file, $data, $bites, (int) array_sum($replace));
}
else
{
@ -901,7 +658,7 @@ class Compiler extends Infusion
$code = explode(PHP_EOL, $target['code']);
$code = PHP_EOL."// " .implode(PHP_EOL."// ",$code). PHP_EOL;
// get place holders
$placeholder = $this->getPlaceHolder($target['type'], $target['id']);
$placeholder = $this->getPlaceHolder((int) $target['comment_type'].$target['type'], $target['id']);
// build the data
$data = $placeholder['start'] . $code . $placeholder['end']. PHP_EOL;
// get the bites before insertion

File diff suppressed because it is too large Load Diff

View File

@ -45,6 +45,13 @@ class Structure extends Get
*/
public $fileCount = 0;
/**
* The page counter
*
* @var int
*/
public $pageCount = 0;
/**
* The line counter
*
@ -52,6 +59,153 @@ class Structure extends Get
*/
public $lineCount = 0;
/**
* The seconds counter
*
* @var int
*/
public $seconds = 0;
/**
* The actual seconds counter
*
* @var int
*/
public $actualSeconds = 0;
/**
* The folder seconds counter
*
* @var int
*/
public $folderSeconds = 0;
/**
* The file seconds counter
*
* @var int
*/
public $fileSeconds = 0;
/**
* The line seconds counter
*
* @var int
*/
public $lineSeconds = 0;
/**
* The seconds debugging counter
*
* @var int
*/
public $secondsDebugging = 0;
/**
* The seconds planning counter
*
* @var int
*/
public $secondsPlanning = 0;
/**
* The seconds mapping counter
*
* @var int
*/
public $secondsMapping = 0;
/**
* The seconds office counter
*
* @var int
*/
public $secondsOffice = 0;
/**
* The total hours counter
*
* @var int
*/
public $totalHours = 0;
/**
* The debugging hours counter
*
* @var int
*/
public $debuggingHours = 0;
/**
* The planning hours counter
*
* @var int
*/
public $planningHours = 0;
/**
* The mapping hours counter
*
* @var int
*/
public $mappingHours = 0;
/**
* The office hours counter
*
* @var int
*/
public $officeHours = 0;
/**
* The actual Total Hours counter
*
* @var int
*/
public $actualTotalHours = 0;
/**
* The actual hours spent counter
*
* @var int
*/
public $actualHoursSpent = 0;
/**
* The actual days spent counter
*
* @var int
*/
public $actualDaysSpent = 0;
/**
* The total days counter
*
* @var int
*/
public $totalDays = 0;
/**
* The actual Total Days counter
*
* @var int
*/
public $actualTotalDays = 0;
/**
* The project week time counter
*
* @var int
*/
public $projectWeekTime = 0;
/**
* The project month time counter
*
* @var int
*/
public $projectMonthTime = 0;
/**
* The Joomla Version
*
@ -205,7 +359,7 @@ class Structure extends Get
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Structure '.$nr.']';
}
@ -566,17 +720,20 @@ class Structure extends Get
*
*/
public function getLastModifiedDate($view)
{
if (isset($view['settings']->modified) && ComponentbuilderHelper::checkString($view['settings']->modified))
{
// first set the main date
if (isset($view['settings']->modified)
&& ComponentbuilderHelper::checkString($view['settings']->modified)
&& '0000-00-00 00:00:00' !== $view['settings']->modified)
{
$date = strtotime($view['settings']->modified);
}
else
{
// first set the main date
// use todays date
$date = strtotime("now");
}
// search for the last modified date
if (isset($view['adminview']))
{
$id = $view['adminview'].'admin';
@ -587,7 +744,9 @@ class Structure extends Get
{
foreach ($view['settings']->fields as $field)
{
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']) && isset($field['settings']->modified))
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings'])
&& isset($field['settings']->modified) && ComponentbuilderHelper::checkString($field['settings']->modified)
&& '0000-00-00 00:00:00' !== $field['settings']->modified)
{
$anotherDate = strtotime($field['settings']->modified);
if ($anotherDate > $date)
@ -605,7 +764,9 @@ class Structure extends Get
// now check if value has been set
if (!isset($this->lastModifiedDate[$id]))
{
if (isset($view['settings']->main_get->modified))
if (isset($view['settings']->main_get->modified)
&& ComponentbuilderHelper::checkString($view['settings']->main_get->modified)
&& '0000-00-00 00:00:00' !== $view['settings']->main_get->modified)
{
$anotherDate = strtotime($view['settings']->main_get->modified);
if ($anotherDate > $date)
@ -621,7 +782,9 @@ class Structure extends Get
// now check if value has been set
if (!isset($this->lastModifiedDate[$id]))
{
if (isset($view['settings']->main_get->modified))
if (isset($view['settings']->main_get->modified)
&& ComponentbuilderHelper::checkString($view['settings']->main_get->modified)
&& '0000-00-00 00:00:00' !== $view['settings']->main_get->modified)
{
$anotherDate = strtotime($view['settings']->main_get->modified);
if ($anotherDate > $date)
@ -939,68 +1102,11 @@ class Structure extends Get
* @param string $dir The path to folder to remove
* @param boolean $git if there is a git folder in that must not be removed
*
* @return boolean True in all is removed
* @return boolean True if all is removed
*
*/
protected function removeFolder($dir, $git = false)
{
if (JFolder::exists($dir))
{
$it = new RecursiveDirectoryIterator($dir);
$it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($it as $file)
{
if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue;
if ($file->isDir())
{
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
JFolder::delete($file->getPathname());
}
else
{
if ($git && strpos($file->getPathname(), $dir.'/.git') !== false) continue;
JFile::delete($file->getPathname());
}
}
if (!$git && JFolder::delete($dir))
{
return true;
}
}
return false;
}
/**
* get the local installed path of this component
*
* @return array of paths on success
*
*/
public function getLocalInstallPaths()
{
// set the local paths to search
$localPaths = array();
// the admin path
$localPaths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'. $this->componentCodeName;
// only check for site path if the component has a site area!
if (!$this->removeSiteFolder)
{
$localPaths['site'] = JPATH_ROOT . '/components/com_'. $this->componentCodeName;
}
// TODO later to include the JS and CSS
// $localPaths['media'] = JPATH_ROOT . '/media/com_'. $this->fileContentStatic['###component###'];
// check if the local install is found
foreach ($localPaths as $key => $localPath)
{
if (!JFolder::exists($localPath))
{
unset($localPaths[$key]);
}
}
if (ComponentbuilderHelper::checkArray($localPaths))
{
return $localPaths;
}
return false;
return ComponentbuilderHelper::removeFolder($dir, $git);
}
}

View File

@ -313,6 +313,13 @@ class Fields extends Structure
*/
public $fieldsNames = array();
/**
* Set unique Names
*
* @var array
*/
public $uniqueNames = array();
/**
* Default Fields
*
@ -344,7 +351,7 @@ class Fields extends Structure
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Fields '.$nr.']';
}
@ -368,6 +375,19 @@ class Fields extends Structure
// setup the list view and single view name
$listViewName = ComponentbuilderHelper::safeString($view['settings']->name_list);
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
// set some place holder for this view
$this->placeholders['###view###'] = $viewName;
$this->placeholders['###VIEW###'] = strtoupper($viewName);
$this->placeholders['###View###'] = ucfirst($viewName);
$this->placeholders['[[[view]]]'] = $this->placeholders['###view###'];
$this->placeholders['[[[VIEW]]]'] = $this->placeholders['###VIEW###'];
$this->placeholders['[[[View]]]'] = $this->placeholders['###View###'];
$this->placeholders['###views###'] = $listViewName;
$this->placeholders['###VIEWS###'] = strtoupper($listViewName);
$this->placeholders['###Views###'] = ucfirst($listViewName);
$this->placeholders['[[[views]]]'] = $this->placeholders['###views###'];
$this->placeholders['[[[VIEWS]]]'] = $this->placeholders['###VIEWS###'];
$this->placeholders['[[[Views]]]'] = $this->placeholders['###Views###'];
// add metadata to the view
if ($view['metadata'])
{
@ -385,12 +405,12 @@ class Fields extends Structure
$readOnly = "\t\t\t" . 'readonly="true"' . PHP_EOL."\t\t\t" . 'disabled="true"';
}
// main lang prefix
$langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_single, 'U');
$langViews = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_list, 'U');
$langView = $this->langPrefix . '_' . $this->placeholders['###VIEW###'];
$langViews = $this->langPrefix . '_' . $this->placeholders['###VIEWS###'];
// set default lang
$this->langContent[$this->lang][$langView] = $view['settings']->name_single;
$this->langContent[$this->lang][$langViews] = $view['settings']->name_list;
// set the singel name
// set the single name
$viewSingleName = ComponentbuilderHelper::safeString($view['settings']->name_single, 'W');
// set global item strings
$this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED'] = "%s " . $view['settings']->name_list . " archived.";
@ -427,20 +447,21 @@ class Fields extends Structure
$this->langContent[$this->lang][$langView . '_VERSION_DESC'] = "A count of the number of times this " . $view['settings']->name_single . " has been revised.";
$this->langContent[$this->lang][$langView . '_SAVE_WARNING'] = "Alias already existed so a number was added at the end. You can re-edit the " . $view['settings']->name_single . " to customise the alias.";
// check if the same field is added multiple times
foreach ($view['settings']->fields as $field)
{
$name = ComponentbuilderHelper::safeString($field['settings']->name);
$this->setUniqueNameKeeper($field, $view['settings']->type, $name, $viewName);
}
// start adding dynamc fields
$dynamcfields = '';
// place holders
$placeholders = array(
'###component###' => $component,
'###view###' => $viewName,
'###views###' => $listViewName);
$spacerCounter = 'a';
// set the custom table key
$dbkey = 'g';
// TODO we should add the global and local view switch if field for front end
foreach ($view['settings']->fields as $field)
{
$dynamcfields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, true);
$dynamcfields .= $this->setDynamicField($field, $view, $view['settings']->type, $langView, $viewName, $listViewName, $spacerCounter, $this->placeholders, $dbkey, true);
}
// set the defautl fields
@ -633,6 +654,8 @@ class Fields extends Structure
$fieldSet[] = "\t\t</fieldset>";
$fieldSet[] = "\t</fields>";
}
// just to be safe, lets clear the view placeholders
$this->clearFromPlaceHolders('view');
// retunr the set
return implode(PHP_EOL, $fieldSet);
}
@ -934,12 +957,12 @@ class Fields extends Structure
if (strpos($fieldAttributes['fields'], ',') !== false)
{
// mulitpal fields
$fieldsSets = explode(',', $fieldAttributes['fields']);
$fieldsSets = (array) explode(',', $fieldAttributes['fields']);
}
else
elseif (is_numeric($fieldAttributes['fields']))
{
// single field
$fieldsSets[] = $fieldAttributes['fields'];
$fieldsSets[] = (int) $fieldAttributes['fields'];
}
// only continue if we have a field set
if (ComponentbuilderHelper::checkArray($fieldsSets))
@ -1219,7 +1242,7 @@ class Fields extends Structure
{
// quick check if this is a category linked to view page
$requeSt_id = ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"');
if (strpos($requeSt_id, '_request_id') !== false)
if (strpos($requeSt_id, '_request_id') !== false || strpos($requeSt_id, '_request_catid') !== false)
{
// keep it then, don't change
$xmlValue = $requeSt_id;
@ -1264,12 +1287,16 @@ class Fields extends Structure
// use field core name only if not found in xml
if (!ComponentbuilderHelper::checkString($xmlValue))
{
// make sure the XML name is uniqe, so we can add one field multiple times
$name = $this->uniqueName($name, $viewName);
$xmlValue = $name;
}
// set the name if found
else
{
$name = $xmlValue;
// make sure the XML name is uniqe, so we can add one field multiple times
$xmlValue = $this->uniqueName($xmlValue, $viewName);
$name = $this->setPlaceholders($xmlValue, $placeholders);
}
}
elseif ($property['name'] === 'extension' || $property['name'] === 'directory')
@ -1381,6 +1408,14 @@ class Fields extends Structure
// check if translatable
if (ComponentbuilderHelper::checkString($xmlValue) && $property['translatable'] == 1)
{
// update lable if field use multiple times
if ($property['name'] === 'label')
{
if (isset($fieldAttributes['name']) && isset($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]))
{
$xmlValue .= ' (' . ComponentbuilderHelper::safeString($this->uniqueNames[$viewName]['names'][$fieldAttributes['name']]) . ')';
}
}
// replace placeholders
$xmlValue = $this->setPlaceholders($xmlValue, $placeholders);
// insure custom lables dont get messed up
@ -1432,18 +1467,17 @@ class Fields extends Structure
$xmlValue = $property['example'];
}
}
$fieldAttributes[$property['name']] = $xmlValue;
// load to langBuilder down the line
if ($property['name'] === 'label')
{
$langLabel = $xmlValue;
if ($setCustom)
{
$fieldAttributes['custom']['label'] = $customLabel;
}
$langLabel = $xmlValue;
}
// now set the value
$fieldAttributes[$property['name']] = $xmlValue;
}
}
// do some nice twigs beyond the default
@ -1460,6 +1494,123 @@ class Fields extends Structure
return $fieldAttributes;
}
/**
* Keep track of the field names, to see if it used multiple times
*
* @param array $field The field data
* @param string $typeName The field type
* @param string $name The field name
* @param string $viewName The singel view name
*
* @return void
*
*/
protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName)
{
// setup a default field
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
{
foreach ($field['settings']->properties as $property)
{
// reset
$xmlValue = '';
if ($property['name'] === 'name')
{
// if category then name must be catid (only one per view)
if ($typeName === 'category')
{
// only one allowed
return;
}
// if tag is set then enable all tag options for this view (only one per view)
elseif ($typeName === 'tag')
{
// only one allowed
return;
}
// if the field is set as alias it must be called alias
elseif (isset($field['alias']) && $field['alias'])
{
// only one allowed
return;
}
elseif ($typeName === 'spacer')
{
// not needed here
return;
}
else
{
$xmlValue = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'name="', '"'));
}
// use field core name only if not found in xml
if (!ComponentbuilderHelper::checkString($xmlValue))
{
$xmlValue = $name;
}
// make sure the XML name is uniqe, so we can add one field multiple times
return $this->setUniqueNameCounter($xmlValue, $viewName);
}
}
}
}
/**
* Count how many times the same field is used per view
*
* @param string $name The name of the field
* @param string $view The name of the view
*
* @return void
*
*/
protected function setUniqueNameCounter($name, $view)
{
if (!isset($this->uniqueNames[$view]))
{
$this->uniqueNames[$view] = array();
$this->uniqueNames[$view]['counter'] = array();
$this->uniqueNames[$view]['names'] = array();
}
if (!isset($this->uniqueNames[$view]['counter'][$name]))
{
$this->uniqueNames[$view]['counter'][$name] = 1;
return;
}
// count how many times the field is used
$this->uniqueNames[$view]['counter'][$name]++;
return;
}
/**
* Naming each field with an unique name
*
* @param string $name The name of the field
* @param string $view The name of the view
*
* @return string the name
*
*/
protected function uniqueName($name, $view)
{
// only increment if the field name is used multiple times
if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1)
{
$counter = $this->uniqueNames[$view]['counter'][$name];
$uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter);
while (isset($this->uniqueNames[$view]['names'][$uniqueName]))
{
$counter--;
$uniqueName = ComponentbuilderHelper::safeString($name . '_' . $counter);
}
// set the new name
$this->uniqueNames[$view]['names'][$uniqueName] = $counter;
return $uniqueName;
}
return $name;
}
/**
* set Builders
@ -1639,7 +1790,7 @@ class Fields extends Structure
// set the custom builder
if (ComponentbuilderHelper::checkArray($custom) && $typeName != 'category' && $typeName != 'repeatable')
{
$this->customBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom);
$this->customBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'lang' => $listLangName, 'custom' => $custom, 'method' => $field['settings']->store);
// set the custom fields needed in content type data
if (!isset($this->customFieldLinksBuilder[$viewName]))
{

View File

@ -31,15 +31,7 @@ defined('_JEXEC') or die('Restricted access');
*/
class Interpretation extends Fields
{
/*
* The line numbers Switch
*
* @var boolean
*/
public $loadLineNr = false;
public $theContributors = '';
public $placeholders = array();
public $uninstallBuilder = array();
public $listColnrBuilder = array();
public $permissionBuilder = array();
@ -57,6 +49,9 @@ class Interpretation extends Fields
public $DashboardGetCustomData = array();
public $customAdminAdded = array();
protected $hasCatIdRequest = array();
protected $hasIdRequest = array();
/**
* Constructor
*/
@ -65,8 +60,6 @@ class Interpretation extends Fields
// first we run the perent constructor
if (parent::__construct($config))
{
// set if line numbers should be added to comments
$this->loadLineNr = ($this->componentData->debug_linenr) ? true:false;
return true;
}
return false;
@ -82,7 +75,7 @@ class Interpretation extends Fields
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Interpretation '.$nr.']';
}
@ -1083,15 +1076,27 @@ class Interpretation extends Fields
$xml .= PHP_EOL."\t\t\t".'<![CDATA['.$lang.'_DESC]]>';
$xml .= PHP_EOL."\t\t".'</message>';
$xml .= PHP_EOL."\t".'</layout>';
if (isset($this->hasIdRequest[$view['settings']->code]))
if (isset($this->hasIdRequest[$view['settings']->code]) || isset($this->hasCatIdRequest[$view['settings']->code]))
{
$requestField = str_replace($view['settings']->code.'_request_id', 'id', $this->hasIdRequest[$view['settings']->code]);
$xml .= PHP_EOL."\t".'<!--'.$this->setLine(__LINE__).' Add fields to the request variables for the layout. -->';
$xml .= PHP_EOL."\t".'<fields name="request">';
$xml .= PHP_EOL."\t\t".'<fieldset name="request"';
$xml .= PHP_EOL."\t\t\t".'addfieldpath="/administrator/components/com_'.$this->fileContentStatic['###component###'].'/models/fields">';
$xml .= PHP_EOL."\t\t\t".$requestField;
if (isset($this->hasIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasIdRequest[$view['settings']->code]))
{
foreach($this->hasIdRequest[$view['settings']->code] as $requestFieldXML)
{
$xml .= PHP_EOL."\t\t\t".$requestFieldXML;
}
}
if (isset($this->hasCatIdRequest[$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->hasCatIdRequest[$view['settings']->code]))
{
foreach($this->hasCatIdRequest[$view['settings']->code] as $requestFieldXML)
{
$xml .= PHP_EOL."\t\t\t".$requestFieldXML;
}
}
$xml .= PHP_EOL."\t\t".'</fieldset>';
$xml .= PHP_EOL."\t".'</fields>';
}
@ -1479,15 +1484,15 @@ class Interpretation extends Fields
break;
case 5:
// COM_COMPONENTBUILDER_DYNAMIC_GET_CATEGORIES
$string = "";
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic category filter is not ready.";
break;
case 6:
// COM_COMPONENTBUILDER_DYNAMIC_GET_TAGS
$string = "";
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic tags filter is not ready.";
break;
case 7:
// COM_COMPONENTBUILDER_DYNAMIC_GET_DATE
$string = "";
$string = PHP_EOL."\t\t".$tab."//".$this->setLine(__LINE__)." (TODO) The dynamic date filter is not ready.";
break;
case 8:
// COM_COMPONENTBUILDER_DYNAMIC_GET_FUNCTIONVAR
@ -1604,7 +1609,7 @@ class Interpretation extends Fields
$value = " ".$whe['value_key']."');";
}
elseif (strpos($whe['value_key'],'$this->') !== false)
elseif (strpos($whe['value_key'],'$') !== false)
{
if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN')
{
@ -1616,22 +1621,30 @@ class Interpretation extends Fields
}
}
elseif (strpos($whe['value_key'],'.') !== false)
{
if (strpos($whe['value_key'],"'") !== false)
{
$value = " ' . \$db->quote(".$whe['value_key']."));";
}
else
{
$value = " ".$whe['value_key']."');";
}
}
// only load if there is a value
if (ComponentbuilderHelper::checkString($value))
{
// set the string
if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN')
{
$tabe = '';
if ($as === 'a')
{
$tabe = $tab;
}
// set the string
if ($whe['operator'] === 'IN' || $whe['operator'] === 'NOT IN')
{
$string = "if (isset(" . $whe['value_key']. ") && ".$this->fileContentStatic['###Component###']."Helper::checkArray(" . $whe['value_key']. "))";
$string .= PHP_EOL."\t".$tabe."\t{";
$string .= PHP_EOL."\t".$tabe."\t\t\//".$this->setLine(__LINE__)." Get where ".$whe['table_key']." is " . $whe['value_key'];
$string .= PHP_EOL."\t".$tabe."\t\t\$query->where('".$whe['table_key']." ".$whe['operator'].$value;
$string .= PHP_EOL."\t".$tabe."\t}";
$string .= PHP_EOL."\t".$tabe."\telse";
@ -1642,7 +1655,8 @@ class Interpretation extends Fields
}
else
{
$string = "\$query->where('".$whe['table_key']." ".$whe['operator'].$value;
$string = "//".$this->setLine(__LINE__)." Get where ".$whe['table_key']." is " . $whe['value_key'];
$string .= PHP_EOL."\t".$tabe."\t\$query->where('".$whe['table_key']." ".$whe['operator'].$value;
}
// sort where
if ($as === 'a' || (isset($this->siteMainGet[$this->target][$code][$as]) && ComponentbuilderHelper::checkString($this->siteMainGet[$this->target][$code][$as])))
@ -2737,6 +2751,10 @@ class Interpretation extends Fields
}
public function setCustomButtons(&$view, $type = 1, $tab = '')
{
// ensure correct target is set
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
if (1 == $type || 2 == $type)
{
if (1 == $type)
{
@ -2746,12 +2764,21 @@ class Interpretation extends Fields
{
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
}
// ensure correct target is set
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER###
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER###'] = '';
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] = '';
}
elseif (3 == $type)
{
// set the names
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
$viewsName = ComponentbuilderHelper::safeString($view['settings']->name_list);
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER_LIST###
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] = '';
// set the custom buttons ###CUSTOM_BUTTONS_METHOD_LIST###
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] = '';
}
// if site add buttons to view
if ($this->target === 'site')
{
@ -2787,6 +2814,68 @@ class Interpretation extends Fields
}
// check if custom button should be added
if (isset($view['settings']->add_custom_button) && $view['settings']->add_custom_button == 1)
{
$buttons = array();
$functionNames = array();
if (isset($view['settings']->custom_buttons) && ComponentbuilderHelper::checkArray($view['settings']->custom_buttons))
{
foreach ($view['settings']->custom_buttons as $custom_button)
{
if ($custom_button['target'] != 2 || $this->target === 'site')
{
// Load to lang
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
// add cpanel button TODO does not work well on site with permissions
if ($custom_button['target'] == 2)
{
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))";
}
else
{
$buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))";
}
$buttons[] = "\t".$tab."\t{";
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
$buttons[] = "\t".$tab."\t}";
}
// load the list button
elseif (3 == $type && ($custom_button['target'] == 2 || $custom_button['target'] == 3))
{
// Load to lang
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
// add cpanel button TODO does not work well on site with permissions
$buttons[] = "\t".$tab."\tif (\$this->user->authorise('".$viewName.".".$keyCode."'))";
$buttons[] = "\t".$tab."\t{";
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
$buttons[] = "\t".$tab."\t}";
}
}
}
// load the model and controller
if (3 == $type)
{
// insure the controller and model strings are added
if (isset($view['settings']->php_controller_list) && ComponentbuilderHelper::checkString($view['settings']->php_controller_list) && $view['settings']->php_controller_list != '//')
{
// set the custom buttons ###CUSTOM_BUTTONS_CONTROLLER###
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_CONTROLLER_LIST###'] =
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_controller_list, $this->placeholders);
}
// load the model
if (isset($view['settings']->php_model_list) && ComponentbuilderHelper::checkString($view['settings']->php_model_list) && $view['settings']->php_model_list != '//')
{
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
$this->fileContentDynamic[$viewsName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD_LIST###'] =
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model_list, $this->placeholders);
}
}
else
{
// insure the controller and model strings are added
if (ComponentbuilderHelper::checkString($view['settings']->php_controller) && $view['settings']->php_controller != '//')
@ -2803,37 +2892,20 @@ class Interpretation extends Fields
###GET_FORM_CUSTOM###
}
}
// load the model
if (ComponentbuilderHelper::checkString($view['settings']->php_model) && $view['settings']->php_model != '//')
{
// set the custom buttons ###CUSTOM_BUTTONS_METHOD###
$this->fileContentDynamic[$viewName]['###'.$TARGET.'_CUSTOM_BUTTONS_METHOD###'] =
PHP_EOL.PHP_EOL.$this->setPlaceholders($view['settings']->php_model, $this->placeholders);
}
if (isset($view['settings']->custom_buttons) && ComponentbuilderHelper::checkArray($view['settings']->custom_buttons))
{
$buttons = array();
foreach ($view['settings']->custom_buttons as $custom_button)
{
if ($custom_button['target'] != 2 || $this->target === 'site')
{
// Load to lang
$keyLang = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($custom_button['name'],'U');
$keyCode = ComponentbuilderHelper::safeString($custom_button['name']);
$this->langContent[$this->lang][$keyLang] = trim($custom_button['name']);
// add cpanel button TODO does not work well on site with permissions
$buttons[] = "\t".$tab."\tif (\$this->canDo->get('".$viewName.".".$keyCode."'))";
$buttons[] = "\t".$tab."\t{";
$buttons[] = "\t".$tab."\t\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$buttons[] = "\t".$tab."\t\tJToolBarHelper::custom('".$viewName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
$buttons[] = "\t".$tab."\t}";
}
}
// return buttons if they were build
if (ComponentbuilderHelper::checkArray($buttons))
{
return PHP_EOL.implode(PHP_EOL,$buttons);
}
}
}
return '';
}
@ -3367,20 +3439,7 @@ class Interpretation extends Fields
public function writeFile($path, $data)
{
$fh = fopen($path, "w");
if (!is_resource($fh))
{
return false;
}
if (fwrite($fh, $data))
{
// close file.
fclose($fh);
return true;
}
// close file.
fclose($fh);
return false;
return ComponentbuilderHelper::writeFile($path, $data);
}
public function setMethodGetItem(&$view)
@ -3628,7 +3687,7 @@ class Interpretation extends Fields
$checkViews = (isset($this->catCodeBuilder[$view]['views']) && ComponentbuilderHelper::checkString($this->catCodeBuilder[$view]['views'])) ? $this->catCodeBuilder[$view]['views'] : $views;
if (ComponentbuilderHelper::checkArray($dbStuff[$view]) && array_key_exists($view, $this->catCodeBuilder) && ($checkViews == $views))
{
$dbStuff[$view.' catagory'] = $this->getCategoryContentType($view, $views, $component);
$dbStuff[$view.' category'] = $this->getCategoryContentType($view, $views, $component);
}
elseif(!isset($dbStuff[$view]) || !ComponentbuilderHelper::checkArray($dbStuff[$view]))
{
@ -4067,6 +4126,7 @@ class Interpretation extends Fields
public function routerParseSwitch(&$view, $viewArray = null, $aliasView = true, $idView = true)
{
$isCategory = '';
$viewTable = false;
if ($viewArray && ComponentbuilderHelper::checkArray($viewArray))
{
if (isset($viewArray['settings']->main_get->db_table_main) && $viewArray['settings']->main_get->db_table_main === 'categories')
@ -4078,29 +4138,25 @@ class Interpretation extends Fields
// $idView = false; // TODO we will keep an eye on this....
// $aliasView = false;
// }
// elseif (isset($viewArray['settings']->main_get->main_get) && ComponentbuilderHelper::checkArray($viewArray['settings']->main_get->main_get))
// {
// $aliasView = false;
// foreach ($viewArray['settings']->main_get->main_get as $get)
// {
// if ($get['as'] === 'a')
// {
// if (isset($get['selection']) && ComponentbuilderHelper::checkArray($get['selection'])
// && isset($get['selection']['select_gets'])
// && ComponentbuilderHelper::checkArray($get['selection']['select_gets']))
// {
// foreach ($get['selection']['select_gets'] as $checkAlias)
// {
// if ($checkAlias === "'a.alias'")
// {
// $aliasView = true;
// }
// }
// }
//
// }
// }
// }
elseif (isset($viewArray['settings']->main_get->main_get) && ComponentbuilderHelper::checkArray($viewArray['settings']->main_get->main_get))
{
foreach ($viewArray['settings']->main_get->main_get as $get)
{
if ($get['as'] === 'a')
{
if (isset($get['selection']) && ComponentbuilderHelper::checkArray($get['selection'])
&& isset($get['selection']['select_gets'])
&& ComponentbuilderHelper::checkArray($get['selection']['select_gets']))
{
if (isset($get['selection']['table']))
{
$viewTable = str_replace('#__'.$this->fileContentStatic['###component###'].'_', '', $get['selection']['table']);
}
}
}
}
}
}
// add if tags is added, also for all front item views
if ($aliasView)
@ -4116,7 +4172,15 @@ class Interpretation extends Fields
$routerSwitch[] = "\t\t\t\t}";
$routerSwitch[] = "\t\t\t\telseif (\$segments[\$count-1])";
$routerSwitch[] = "\t\t\t\t{";
// we need to get from the table of this views main get the alias so we need the table name
if ($viewTable)
{
$routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('".$viewTable."', \$segments[\$count-1], 'alias', 'id'".$isCategory.");";
}
else
{
$routerSwitch[] = "\t\t\t\t\t\$id = \$this->getVar('".$view."', \$segments[\$count-1], 'alias', 'id'".$isCategory.");";
}
$routerSwitch[] = "\t\t\t\t\tif(\$id)";
$routerSwitch[] = "\t\t\t\t\t{";
$routerSwitch[] = "\t\t\t\t\t\t\$vars['id'] = \$id;";
@ -4780,7 +4844,7 @@ class Interpretation extends Fields
{
$db .= PHP_EOL."\t`id` INT(11) NOT NULL AUTO_INCREMENT,";
}
$db .= PHP_EOL."\t`asset_id` INT(255) UNSIGNED NOT NULL DEFAULT '0',";
$db .= PHP_EOL."\t`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',";
ksort($fields);
foreach ($fields as $field => $data)
{
@ -4826,22 +4890,22 @@ class Interpretation extends Fields
// check if default field was over written
if (!isset($this->fieldsNames[$view]['params']))
{
$db .= PHP_EOL."\t`params` TEXT NOT NULL,";
$db .= PHP_EOL."\t`params` text NOT NULL DEFAULT '',";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['published']))
{
$db .= PHP_EOL."\t`published` TINYINT(1) NOT NULL DEFAULT '1',";
$db .= PHP_EOL."\t`published` TINYINT(3) NOT NULL DEFAULT 1,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['created_by']))
{
$db .= PHP_EOL."\t`created_by` INT(11) NOT NULL DEFAULT '0',";
$db .= PHP_EOL."\t`created_by` INT(10) unsigned NOT NULL DEFAULT 0,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['modified_by']))
{
$db .= PHP_EOL."\t`modified_by` INT(11) NOT NULL DEFAULT '0',";
$db .= PHP_EOL."\t`modified_by` INT(10) unsigned NOT NULL DEFAULT 0,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['created']))
@ -4856,7 +4920,7 @@ class Interpretation extends Fields
// check if default field was over written
if (!isset($this->fieldsNames[$view]['checked_out']))
{
$db .= PHP_EOL."\t`checked_out` INT(11) NOT NULL,";
$db .= PHP_EOL."\t`checked_out` int(11) unsigned NOT NULL DEFAULT 0,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['checked_out_time']))
@ -4866,22 +4930,22 @@ class Interpretation extends Fields
// check if default field was over written
if (!isset($this->fieldsNames[$view]['version']))
{
$db .= PHP_EOL."\t`version` INT(11) NOT NULL DEFAULT '1',";
$db .= PHP_EOL."\t`version` INT(10) unsigned NOT NULL DEFAULT 1,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['hits']))
{
$db .= PHP_EOL."\t`hits` INT(11) NOT NULL DEFAULT '0',";
$db .= PHP_EOL."\t`hits` INT(10) unsigned NOT NULL DEFAULT 0,";
}
// check if view has access
if (isset($this->accessBuilder[$view]) && ComponentbuilderHelper::checkString($this->accessBuilder[$view]))
{
$db .= PHP_EOL."\t`access` INT(11) DEFAULT NULL,";
$db .= PHP_EOL."\t`access` INT(10) unsigned NOT NULL DEFAULT 0,";
}
// check if default field was over written
if (!isset($this->fieldsNames[$view]['ordering']))
{
$db .= PHP_EOL."\t`ordering` INT(11) NOT NULL DEFAULT '0',";
$db .= PHP_EOL."\t`ordering` INT(11) NOT NULL DEFAULT 0,";
}
// check if metadata is added to this view
if (isset($this->metadataBuilder[$view]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$view]))
@ -5042,20 +5106,14 @@ class Interpretation extends Fields
if (isset($this->langContent['admin']) && ComponentbuilderHelper::checkArray($this->langContent['admin']))
{
ksort($this->langContent['admin']);
foreach ($this->langContent['admin'] as $key => $value)
{
if (strlen($key) > 0)
{
if (!isset($lang))
{
$lang = '';
// load to global languages
$this->languages['en-GB']['admin'] = $this->langContent['admin'];
// remove tmp array
unset($this->langContent['admin']);
return true;
}
$lang .= $key.'="'.$value.'"'.PHP_EOL;
}
}
return $lang;
}
return '';
return false;
}
public function setLangSite()
@ -5083,7 +5141,7 @@ class Interpretation extends Fields
// check if the both array is set
if (isset($this->langContent['both']) && ComponentbuilderHelper::checkArray($this->langContent['both']))
{
foreach ($this->langContent[$this->lang] as $keylang => $langval)
foreach ($this->langContent['both'] as $keylang => $langval)
{
$this->langContent['site'][$keylang] = $langval;
}
@ -5091,20 +5149,14 @@ class Interpretation extends Fields
if (isset($this->langContent['site']) && ComponentbuilderHelper::checkArray($this->langContent['site']))
{
ksort($this->langContent['site']);
foreach ($this->langContent['site'] as $key => $value)
{
if (strlen($key) > 0)
{
if (!isset($lang))
{
$lang = '';
// load to global languages
$this->languages['en-GB']['site'] = $this->langContent['site'];
// remove tmp array
unset($this->langContent['site']);
return true;
}
$lang .= $key.'="'.$value.'"'.PHP_EOL;
}
}
return $lang;
}
return '';
return false;
}
public function setLangSiteSys()
@ -5115,20 +5167,14 @@ class Interpretation extends Fields
if (isset($this->langContent['sitesys']) && ComponentbuilderHelper::checkArray($this->langContent['sitesys']))
{
ksort($this->langContent['sitesys']);
foreach ($this->langContent['sitesys'] as $key => $value)
{
if (strlen($key) > 0)
{
if (!isset($lang))
{
$lang = '';
// load to global languages
$this->languages['en-GB']['sitesys'] = $this->langContent['sitesys'];
// remove tmp array
unset($this->langContent['sitesys']);
return true;
}
$lang .= $key.'="'.$value.'"'.PHP_EOL;
}
}
return $lang;
}
return '';
return false;
}
public function setLangAdminSys()
@ -5136,20 +5182,14 @@ class Interpretation extends Fields
if (isset($this->langContent['adminsys']) && ComponentbuilderHelper::checkArray($this->langContent['adminsys']))
{
ksort($this->langContent['adminsys']);
foreach ($this->langContent['adminsys'] as $key => $value)
{
if (strlen($key) > 0)
{
if (!isset($lang))
{
$lang = '';
// load to global languages
$this->languages['en-GB']['adminsys'] = $this->langContent['adminsys'];
// remove tmp array
unset($this->langContent['adminsys']);
return true;
}
$lang .= $key.'="'.$value.'"'.PHP_EOL;
}
}
return $lang;
}
return '';
return false;
}
public function setCustomAdminViewListLink($view,$viewName_list)
@ -5703,8 +5743,7 @@ class Interpretation extends Fields
$linkedViewId = '';
if (ComponentbuilderHelper::checkArray($linkedTab))
{
$linkedViewId = array_search($tabNr,$linkedTab);
if ($linkedViewId)
if (($linkedViewId = array_search($tabNr, $linkedTab)) !== false)
{
// don't build
$buildLayout = false;
@ -5843,7 +5882,11 @@ class Interpretation extends Fields
$span = 'span'.$mainwidth;
}
// start building body
$body = '<div class="form-horizontal'.$span.'">';
$body = PHP_EOL.'<div class="form-horizontal">';
if (ComponentbuilderHelper::checkString($span))
{
$body .= PHP_EOL."\t".'<div class="'.$span.'">';
}
// now build the template
foreach ($bucket as $tabCodeName => $posions)
{
@ -6131,6 +6174,7 @@ class Interpretation extends Fields
$body .= PHP_EOL."\t\t".'<input type="hidden" name="task" value="'.$viewName_single.'.edit" />';
$body .= PHP_EOL."\t\t<?php echo JHtml::_('form.token'); ?>";
$body .= PHP_EOL."\t</div>";
$body .= PHP_EOL."\t</div>";
$body .= PHP_EOL."</div>";
// check if left has been set
if (strlen($leftside) > 0 )
@ -7334,6 +7378,8 @@ class Interpretation extends Fields
$target = array('admin' => 'import_'.$viewName_list);
$this->buildDynamique($target, 'customimport');
// load the custom script to the files
// ###IMPORT_EXT_METHOD_CUSTOM### <<<DYNAMIC>>>
$this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_EXT_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_ext', 'import_'.$viewName_list, PHP_EOL, null, true);
// ###IMPORT_DISPLAY_METHOD_CUSTOM### <<<DYNAMIC>>>
$this->fileContentDynamic['import_'.$viewName_list]['###IMPORT_DISPLAY_METHOD_CUSTOM###'] = $this->getCustomScriptBuilder('php_import_display', 'import_'.$viewName_list, PHP_EOL, null, true);
// ###IMPORT_SETDATE_METHOD_CUSTOM### <<<DYNAMIC>>>
@ -7520,7 +7566,8 @@ class Interpretation extends Fields
&& ComponentbuilderHelper::checkArray($this->customBuilderList[$viewName_list])
&& in_array($filter['code'],$this->customBuilderList[$viewName_list])
&& isset($filter['custom']['table'])
&& ComponentbuilderHelper::checkString($filter['custom']['table']))
&& ComponentbuilderHelper::checkString($filter['custom']['table'])
&& $filter['method'] == 0)
{
$query .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." From the ".ComponentbuilderHelper::safeString(ComponentbuilderHelper::safeString($filter['custom']['table'],'w'))." table.";
$query .= PHP_EOL."\t\t\$query->select(\$db->quoteName('".$filter['custom']['db'].".".$filter['custom']['text']."','".$filter['code']."_".$filter['custom']['text']."'));";
@ -9167,6 +9214,31 @@ class Interpretation extends Fields
$otherViews = $viewName_list;
$otherView = $viewName_single;
}
// load the category helper details in not already loaded
if (!isset($this->fileContentDynamic['category'.$otherViews]['###view###']))
{
// lets also set the category helper for this view
$target = array('site' => 'category'.$viewName_list);
$this->buildDynamique($target, 'category');
// insure the file gets updated
$this->fileContentDynamic['category'.$otherViews]['###view###'] = $otherView;
$this->fileContentDynamic['category'.$otherViews]['###View###'] = ucfirst($otherView);
$this->fileContentDynamic['category'.$otherViews]['###views###'] = $otherViews;
$this->fileContentDynamic['category'.$otherViews]['###Views###'] = ucfirst($otherViews);
// set script to global helper file
$includeHelper = array();
$includeHelper[] = "\n//".$this->setLine(__LINE__)."Insure this view category file is loaded.";
$includeHelper[] = "\$classname = '".$this->fileContentStatic['###component###'] . ucfirst($viewName_list) . "Categories';";
$includeHelper[] = "if (!class_exists(\$classname))";
$includeHelper[] = "{";
$includeHelper[] = "\t\$path = JPATH_SITE . '/components/com_".$this->fileContentStatic['###component###']."/helpers/category" . $viewName_list . ".php';";
$includeHelper[] = "\tif (is_file(\$path))";
$includeHelper[] = "\t{";
$includeHelper[] = "\t\tinclude_once \$path;";
$includeHelper[] = "\t}";
$includeHelper[] = "}";
$this->fileContentStatic['###CATEGORY_CLASS_TREES###'] .= implode("\n",$includeHelper);
}
// return category view string
if (isset($this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###']) && ComponentbuilderHelper::checkString($this->fileContentStatic['###ROUTER_CATEGORY_VIEWS###']))
{
@ -9543,7 +9615,7 @@ class Interpretation extends Fields
$allow[] = PHP_EOL."\t\t\t\$catid = 0;";
$allow[] = "\t\t\tif (isset(\$this->getItem(\$id)->catid))";
$allow[] = "\t\t\t{";
$allow[] = "\t\t\t\t//".$this->setLine(__LINE__)." set catagory id";
$allow[] = "\t\t\t\t//".$this->setLine(__LINE__)." set category id";
$allow[] = "\t\t\t\t\$catid = \$this->getItem(\$id)->catid;";
$allow[] = PHP_EOL."\t\t\t\t//".$this->setLine(__LINE__)." Existing record. Can only edit in selected categories.";
$allow[] = "\t\t\t\t\$form->setFieldAttribute('catid', 'action', 'core.edit');";
@ -10772,8 +10844,16 @@ class Interpretation extends Fields
{
// TODO we check if this works well.
$fix .= PHP_EOL."\t".$tab."\t\t\t//".$this->setLine(__LINE__)." convert ".$item['name'];
if (isset($item['custom']['table']))
{
$keyTableNAme = str_replace('#__'.$this->fileContentStatic['###component###'] .'_', '', $item['custom']['table']);
$fix .= PHP_EOL."\t".$tab."\t\t\t\$item->".$item['name']." = ".$Component."Helper::jsonToString(\$item->".$item['name'].", ', ', '".$keyTableNAme."');";
}
else
{
$fix .= PHP_EOL."\t".$tab."\t\t\t\$item->".$item['name']." = ".$Component."Helper::jsonToString(\$item->".$item['name'].", ', ', '".$item['name']."');";
}
}
else
{
if (!$export)
@ -11060,7 +11140,7 @@ class Interpretation extends Fields
{
$otherViews = $name_list;
// build lang
$langName = 'Catagory &nbsp;For<br />'.ComponentbuilderHelper::safeString($otherViews, 'W');
$langName = 'Category &nbsp;For<br />'.ComponentbuilderHelper::safeString($otherViews, 'W');
}
if(!in_array($otherViews,$catArray))
{
@ -11183,7 +11263,7 @@ class Interpretation extends Fields
$builder[$data['name']][$data['header']] = $this->setPlaceholders($data['html'], $this->placeholders);
}
// since we have custom tabs we must load the tab structure around the cpanel
$display[] = '<div id="j-main-container" class="span12">';
$display[] = '<div id="j-main-container">';
$display[] = "\t".'<div class="form-horizontal">';
$display[] = "\t<?php echo JHtml::_('bootstrap.startTabSet', 'cpanel_tab', array('active' => 'cpanel')); ?>";
$display[] = PHP_EOL."\t\t<?php echo JHtml::_('bootstrap.addTab', 'cpanel_tab', 'cpanel', JText::_('cPanel', true)); ?>";
@ -11761,7 +11841,7 @@ class Interpretation extends Fields
$this->configFieldSetsCustomField[$field['tabname']][] = $xmlField;
// set global params to db on install
$fieldName = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xmlField,'name="','"'));
$fieldDefault = ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($xmlField,'default="','"'));
$fieldDefault = ComponentbuilderHelper::getBetween($xmlField,'default="','"');
if (isset($field['custom_value']) && ComponentbuilderHelper::checkString($field['custom_value']))
{
// load the Global checkin defautls
@ -11817,25 +11897,43 @@ class Interpretation extends Fields
$tabCode = ComponentbuilderHelper::safeString($tab).'_custom_config';
$tabUpper = ComponentbuilderHelper::safeString($tab,'U');
$tabLower = ComponentbuilderHelper::safeString($tab);
// load the regust id setters for menu views
$viewRequest = 'name="'.$tabLower.'_request_id"';
// load the request id setters for menu views
$viewRequest = 'name="'.$tabLower.'_request_id';
foreach($tabFields as $et => $id_field)
{
if(strpos($id_field,$viewRequest) !== false)
{
// set the values needed to insure route is done correclty
$this->hasIdRequest[$tabLower] = $id_field;
$this->setRequestValues($tabLower, $id_field, $viewRequest, 'id', 'hasIdRequest');
unset($tabFields[$et]);
}
elseif (strpos($id_field,'_request_id"') !== false)
elseif (strpos($id_field,'_request_id') !== false)
{
// not loaded to a tab "view" name
$_viewRequest = ComponentbuilderHelper::getBetween($id_field,'name="','_request_id"');
// set the values needed to insure route is done correclty
$this->hasIdRequest[$_viewRequest] = $id_field;
$_viewRequest = ComponentbuilderHelper::getBetween($id_field,'name="','_request_id');
$searchIdKe = 'name="'.$_viewRequest.'_request_id';
$this->setRequestValues($_viewRequest, $id_field, $searchIdKe, 'id', 'hasIdRequest');
unset($tabFields[$et]);
}
}
// load the request catid setters for menu views
$viewRequestC = 'name="'.$tabLower.'_request_catid';
foreach($tabFields as $ci => $catid_field)
{
if(strpos($catid_field,$viewRequestC) !== false)
{
$this->setRequestValues($tabLower, $catid_field, $viewRequestC, 'catid', 'hasCatIdRequest');
unset($tabFields[$ci]);
}
elseif (strpos($catid_field,'_request_catid') !== false)
{
// not loaded to a tab "view" name
$_viewRequestC = ComponentbuilderHelper::getBetween($catid_field,'name="','_request_catid');
$searchCatidKe = 'name="'.$_viewRequestC.'_request_catid';
$this->setRequestValues($_viewRequestC, $catid_field, $searchCatidKe, 'catid', 'hasCatIdRequest');
unset($tabFields[$ci]);
}
}
// load the global menu setters for single fields
$menuSetter = $tabLower.'_menu';
$pageSettings = array();
@ -11867,6 +11965,29 @@ class Interpretation extends Fields
}
}
protected function setRequestValues($view, $field, $search, $target, $store)
{
$key = ComponentbuilderHelper::getBetween($field, $search, '"');
if (!ComponentbuilderHelper::checkString($key))
{
// is not having special var
$key = $target;
// update field
$field = str_replace($search . '"', 'name="'. $key . '"', $field);
}
else
{
// update field
$field = str_replace($search . $key . '"', 'name="'. $key . '"', $field);
}
if (!isset($this->{$store}[$view]))
{
$this->{$store}[$view] = array();
}
// set the values needed for view requests to be made
$this->{$store}[$view][$key] = $field;
}
public function setCustomControlConfigFieldsets($lang)
{
// add custom new global fields set
@ -13326,29 +13447,7 @@ function vdm_dkim() {
$this->componentGlobal[$sortKey] = "\t\t".'<action name="site.'.$siteCode.'.access" title="'.$siteTitle.'" description="'.$siteDesc.'" />';
}
// add the custom permissions to use the buttons of this view
/* if (ComponentbuilderHelper::checkArray($site_view['settings']->custom_buttons))
{
foreach ($site_view['settings']->custom_buttons as $custom_buttons)
{
$siteButtonName = $custom_buttons['name'];
$siteButtonCode = ComponentbuilderHelper::safeString($siteButtonName);
$siteButtonTitle = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($siteName.' '.$siteButtonName.' Button Access','U');
$siteButtonDesc = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($siteName.' '.$siteButtonName.' Button Access','U').'_DESC';
$sortButtonKey = ComponentbuilderHelper::safeString($siteButtonTitle);
$this->langContent['admin'][$siteButtonTitle] = $siteName.' '.$siteButtonName.' Button Access';
$this->langContent['admin'][$siteButtonDesc] = ' Allows the users in this group to access the '.ComponentbuilderHelper::safeString($siteButtonName,'w').' button.';
$this->componentGlobal[$sortButtonKey] = "\t\t".'<action name="'.$siteCode.'.'.$siteButtonCode.'" title="'.$siteButtonTitle.'" description="'.$siteButtonDesc.'" />';
}
}
// add menu controll view that has menus options
foreach ($menuControllers as $menuController)
{
// add menu controll view that has menus options
if ($site_view[$menuController])
{
// TODO for CUSTOM MENUS!!!
}
} */
$this->addCustomButtonPermissions($site_view['settings'], $siteName, $siteCode);
}
}
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))

View File

@ -34,6 +34,7 @@ class Infusion extends Interpretation
public $eximportView = array();
public $importCustomScripts = array();
public $langFiles = array();
public $removeSiteFolder = false;
/**
@ -60,7 +61,7 @@ class Infusion extends Interpretation
*/
private function setLine($nr)
{
if ($this->loadLineNr)
if ($this->debugLinenr)
{
return ' [Infusion '.$nr.']';
}
@ -79,13 +80,13 @@ class Infusion extends Interpretation
if (isset($this->componentData->admin_views) && ComponentbuilderHelper::checkArray($this->componentData->admin_views))
{
// ###COMPONENT###
$this->fileContentStatic['###COMPONENT###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
$this->fileContentStatic['###COMPONENT###'] = $this->placeholders['###COMPONENT###'];
// ###Component###
$this->fileContentStatic['###Component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code, 'F');
$this->fileContentStatic['###Component###'] = $this->placeholders['###Component###'];
// ###component###
$this->fileContentStatic['###component###'] = ComponentbuilderHelper::safeString($this->componentData->name_code);
$this->fileContentStatic['###component###'] = $this->placeholders['###component###'];
// ###COMPANYNAME###
$this->fileContentStatic['###COMPANYNAME###'] = trim(JFilterOutput::cleanText($this->componentData->companyname));
@ -132,19 +133,12 @@ class Infusion extends Interpretation
// ###ACCESS_SECTIONS###
$this->fileContentStatic['###ACCESS_SECTIONS###'] = $this->setAccessSections();
// set component place holders
$this->placeholders = array(
'###Component###' => $this->fileContentStatic['###Component###'],
'###component###' => $this->fileContentStatic['###component###'],
'###COMPONENT###' => $this->fileContentStatic['###COMPONENT###'],
'[[[Component]]]' => $this->fileContentStatic['###Component###'],
'[[[component]]]' => $this->fileContentStatic['###component###'],
'[[[COMPONENT]]]' => $this->fileContentStatic['###COMPONENT###']
);
// ###CONFIG_FIELDSETS###
$keepLang = $this->lang;
$this->lang = 'admin';
// start loading the category tree scripts
$this->fileContentStatic['###CATEGORY_CLASS_TREES###'] = '';
// run the field sets for first time
$this->setConfigFieldsets(1);
$this->lang = $keepLang;
@ -215,6 +209,9 @@ class Infusion extends Interpretation
// start dynamic build
foreach ($this->componentData->admin_views as $view)
{
// just to be safe, lets clear the view placeholders
$this->clearFromPlaceHolders('view');
// set the target
$this->target = 'admin';
$this->lang = 'admin';
// set main keys
@ -252,11 +249,11 @@ class Infusion extends Interpretation
// set some place holder for the views
$this->placeholders['###view###'] = $viewName_single;
$this->placeholders['###VIEW###'] = $viewName_u;
$this->placeholders['###View###'] = $viewName_f;
$this->placeholders['###VIEW###'] = $viewName_u;
$this->placeholders['[[[view]]]'] = $viewName_single;
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
$this->placeholders['[[[View]]]'] = $viewName_f;
$this->placeholders['[[[VIEW]]]'] = $viewName_u;
// set license per view if needed
$this->setLockLicensePer($viewName_single, $this->target);
@ -388,11 +385,11 @@ class Infusion extends Interpretation
// set some place holder for the views
$this->placeholders['###views###'] = $viewName_list;
$this->placeholders['###VIEWS###'] = $viewsName_u;
$this->placeholders['###Views###'] = $viewsName_f;
$this->placeholders['###VIEWS###'] = $viewsName_u;
$this->placeholders['[[[views]]]'] = $viewName_list;
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
$this->placeholders['[[[Views]]]'] = $viewsName_f;
$this->placeholders['[[[VIEWS]]]'] = $viewsName_u;
// set the export/import option
if ($view['port'])
@ -425,6 +422,8 @@ class Infusion extends Interpretation
// ###CHECKINCALL### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###CHECKINCALL###'] = '';
}
// ###ADMIN_CUSTOM_BUTTONS_LIST###
$this->fileContentDynamic[$viewName_list]['###ADMIN_CUSTOM_BUTTONS_LIST###'] = $this->setCustomButtons($view, 3, "\t");
// ###GET_ITEMS_METHOD_STRING_FIX### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_STRING_FIX###'] = $this->setGetItemsMethodStringFix($viewName_single,$this->fileContentStatic['###Component###']);
@ -1020,18 +1019,6 @@ class Infusion extends Interpretation
$this->removeSiteFolder = true;
}
// ###LANG_ADMIN###
$this->fileContentStatic['###LANG_ADMIN###'] = $this->setLangAdmin();
// ###LANG_ADMIN_SYS###
$this->fileContentStatic['###LANG_ADMIN_SYS###'] = $this->setLangAdminSys();
// ###LANG_SITE###
$this->fileContentStatic['###LANG_SITE###'] = $this->setLangSite();
// ###LANG_SITE_SYS###
$this->fileContentStatic['###LANG_SITE_SYS###'] = $this->setLangSiteSys();
// ###PREINSTALLSCRIPT###
$this->fileContentStatic['###PREINSTALLSCRIPT###'] = $this->getCustomScriptBuilder('php_preflight', 'install', PHP_EOL, null, true);
@ -1073,4 +1060,137 @@ class Infusion extends Interpretation
return false;
}
/**
* Build the lang values and insert to fiel
*
*
* @return boolean on success
*
*/
public function setLangFileData()
{
$values = array();
$mainLangLoader = array();
// check the admin lang is set
if ($this->setLangAdmin())
{
$values[] = array_values($this->languages['en-GB']['admin']);
$mainLangLoader['admin'] = count($this->languages['en-GB']['admin']);
}
// check the admin system lang is set
if ($this->setLangAdminSys())
{
$values[] = array_values($this->languages['en-GB']['adminsys']);
$mainLangLoader['adminsys'] = count($this->languages['en-GB']['adminsys']);
}
// check the site lang is set
if (!$this->removeSiteFolder && $this->setLangSite())
{
$values[] = array_values($this->languages['en-GB']['site']);
$mainLangLoader['site'] = count($this->languages['en-GB']['site']);
}
// check the site system lang is set
if (!$this->removeSiteFolder && $this->setLangSiteSys())
{
$values[] = array_values($this->languages['en-GB']['sitesys']);
$mainLangLoader['sitesys'] = count($this->languages['en-GB']['sitesys']);
}
$values = array_unique(ComponentbuilderHelper::mergeArrays($values));
// get the other lang strings if there is any
$this->multiLangString = $this->getMultiLangStrings($values);
// update insert the current lang in to DB
$this->setLangPlaceholders($values);
// remove old unused language strings
$this->purgeLanuageStrings($values);
// path to INI file
$getPAth = $this->templatePath . '/en-GB.com_admin.ini';
// now we insert the values into the files
if (ComponentbuilderHelper::checkArray($this->languages))
{
$langXML = array();
foreach ($this->languages as $tag => $areas)
{
foreach ($areas as $area => $languageStrings)
{
// force load if debug lines are added
if (!$this->debugLinenr)
{
// check if we sould install this translation
$dif = bcdiv(count($languageStrings), $mainLangLoader[$area]);
$percentage = bcmul($dif, 100);
if ($percentage < $this->percentageLanguageAdd)
{
// dont add
continue;
}
}
$p = 'admin';
$t = '';
if (strpos($area, 'site') !== false)
{
if ($this->removeSiteFolder)
{
continue;
}
$p = 'site';
}
if (strpos($area, 'sys') !== false)
{
$t = '.sys';
}
// build the path to to place the lang file
$path = $this->componentPath.'/'.$p.'/language/'.$tag;
if (!JFolder::exists($path))
{
JFolder::create($path);
// count the folder created
$this->folderCount++;
}
// build the file name
$fileName = $tag . '.com_' . $this->componentCodeName . $t . '.ini';
// move the file to its place
JFile::copy($getPAth, $path.'/'.$fileName);
// count the file created
$this->fileCount++;
// add content to it
$lang = '';
foreach ($languageStrings as $place => $string)
{
$lang .= $place.'="'.$string.'"'.PHP_EOL;
}
// add to language file
$this->writeFile($path.'/'.$fileName, $lang);
// set the line counter
$this->lineCount = $this->lineCount + substr_count($lang, PHP_EOL);
// build xml strings
if (!isset($langXML[$p]))
{
$langXML[$p] = array();
}
$langXML[$p][] = '<language tag="'.$tag.'">language/'.$tag.'/'.$fileName.'</language>';
}
}
// load the lang xml
if (ComponentbuilderHelper::checkArray($langXML))
{
$replace = array();
if (isset($langXML['admin']) && ComponentbuilderHelper::checkArray($langXML['admin']))
{
$replace['###ADMIN_LANGUAGES###'] = implode(PHP_EOL."\t\t\t", $langXML['admin']);
}
if (!$this->removeSiteFolder && isset($langXML['site']) && ComponentbuilderHelper::checkArray($langXML['site']))
{
$replace['###SITE_LANGUAGES###'] = implode(PHP_EOL."\t\t", $langXML['site']);
}
// build xml path
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
// get the content in xml
$componentXML = file_get_contents($xmlPath);
// update the xml content
$componentXML = $this->setPlaceholders($componentXML, $replace);
// store the values back to xml
$this->writeFile($xmlPath,$componentXML);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -69,12 +69,12 @@ class Mapping
* The datatypes and it linked field types (basic)
* (TODO) We may need to set this dynamicly
*/
protected $dataTypes = array( 'CHAR' => 'Text', 'VARCHAR' => 'Text',
'TEXT' => 'Textarea', 'MEDIUMTEXT' => 'Textarea',
'LONGTEXT' => 'Textarea', 'DATE' => 'Text', 'TIME' => 'Text',
'DATETIME' => 'Calendar', 'INT' => 'Text', 'TINYINT' => 'Text',
'BIGINT' => 'Text', 'FLOAT' => 'Text', 'DECIMAL' => 'Text',
'DOUBLE' => 'Text');
protected $dataTypes = array( 'VARCHAR' => 'Text', 'CHAR' => 'Text',
'MEDIUMTEXT' => 'Textarea', 'LONGTEXT' => 'Textarea',
'TEXT' => 'Textarea', 'DATETIME' => 'Calendar',
'DATE' => 'Text', 'TIME' => 'Text', 'TINYINT' => 'Text',
'BIGINT' => 'Text', 'INT' => 'Text', 'FLOAT' => 'Text',
'DECIMAL' => 'Text', 'DOUBLE' => 'Text');
/**
* The datasize identifiers

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage headercheck.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage batch_.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage indenter.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage js.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage minify.php

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,14 @@ COM_COMPONENTBUILDER_CONFIGURATION="Component Builder Configuration"
COM_COMPONENTBUILDER_MENU="&#187; Component Builder"
COM_COMPONENTBUILDER_MENU_ADMIN_VIEWS="Admin Views"
COM_COMPONENTBUILDER_MENU_COMPILER="Compiler"
COM_COMPONENTBUILDER_MENU_COMPONENTS="Components"
COM_COMPONENTBUILDER_MENU_CUSTOM_ADMIN_VIEWS="Custom Admin Views"
COM_COMPONENTBUILDER_MENU_CUSTOM_CODES="Custom Codes"
COM_COMPONENTBUILDER_MENU_DYNAMIC_GETS="Dynamic Gets"
COM_COMPONENTBUILDER_MENU_FIELDS="Fields"
COM_COMPONENTBUILDER_MENU_FIELDTYPES="Fieldtypes"
COM_COMPONENTBUILDER_MENU_HELP_DOCUMENTS="Help Documents"
COM_COMPONENTBUILDER_MENU_JOOMLA_COMPONENTS="Joomla Components"
COM_COMPONENTBUILDER_MENU_LANGUAGE_TRANSLATIONS="Language Translations"
COM_COMPONENTBUILDER_MENU_LAYOUTS="Layouts"
COM_COMPONENTBUILDER_MENU_SITE_VIEWS="Site Views"
COM_COMPONENTBUILDER_MENU_SNIPPETS="Snippets"

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage css_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_fullwidth.php
@ -31,7 +31,9 @@ $form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'php_controller',
'php_model'
'php_model',
'php_controller_list',
'php_model_list'
);
?>

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_buttons_left.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage custom_import_fullwidth.php
@ -37,7 +37,8 @@ $fields = $displayData->get('fields') ?: array(
'html_import_view',
'php_import',
'php_import_setdata',
'php_import_save'
'php_import_save',
'php_import_ext'
);
?>

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage fields_fullwidth.php
@ -28,7 +28,7 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
$items = $displayData->vxtfields;
$items = $displayData->vxxfields;
$user = JFactory::getUser();
$id = $displayData->item->id;
$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage javascript_fullwidth.php

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage linked_components_fullwidth.php
@ -28,40 +28,40 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
$items = $displayData->vxulinked_components;
$items = $displayData->vxylinked_components;
$user = JFactory::getUser();
$id = $displayData->item->id;
$edit = "index.php?option=com_componentbuilder&view=components&task=component.edit";
$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit";
?>
<div class="form-vertical">
<?php if (ComponentbuilderHelper::checkArray($items)): ?>
<table class="footable table data components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
<table class="footable table data joomla_components" data-show-toggle="true" data-toggle-column="first" data-sorting="true" data-paging="true" data-paging-size="20" data-filtering="true">
<thead>
<tr>
<th data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SYSTEM_NAME_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SYSTEM_NAME_LABEL'); ?>
</th>
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_NAME_CODE_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NAME_CODE_LABEL'); ?>
</th>
<th data-breakpoints="xs sm" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPONENT_VERSION_LABEL'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_SHORT_DESCRIPTION_LABEL'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_COMPANYNAME_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL'); ?>
</th>
<th data-breakpoints="xs sm md" data-type="html" data-sort-use="text">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_AUTHOR_LABEL'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL'); ?>
</th>
<th width="10" data-breakpoints="xs sm md">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_STATUS'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_STATUS'); ?>
</th>
<th width="5" data-type="number" data-breakpoints="xs sm md">
<?php echo JText::_('COM_COMPONENTBUILDER_COMPONENT_ID'); ?>
<?php echo JText::_('COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ID'); ?>
</th>
</tr>
</thead>
@ -70,14 +70,14 @@ $edit = "index.php?option=com_componentbuilder&view=components&task=component.ed
<?php
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0;
$userChkOut = JFactory::getUser($item->checked_out);
$canDo = ComponentbuilderHelper::getActions('component',$item,'components');
$canDo = ComponentbuilderHelper::getActions('joomla_component',$item,'joomla_components');
?>
<tr>
<td class="nowrap">
<?php if ($canDo->get('core.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>&ref=admin_view&refid=<?php echo $id; ?>"><?php echo $displayData->escape($item->system_name); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'components.', $canCheckin); ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'joomla_components.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<div class="name"><?php echo $displayData->escape($item->system_name); ?></div>

View File

@ -10,8 +10,8 @@
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.3.2
@build 11th February, 2017
@version 2.4.5
@build 4th May, 2017
@created 30th April, 2015
@package Component Builder
@subpackage mysql_fullwidth.php

Some files were not shown because too many files have changed in this diff Show More