├── .gitignore ├── .gitmodules ├── README.md ├── build.xml ├── composer.json ├── docs └── img │ ├── magento-mep-menu.jpg │ ├── magento-mep-profil-attribute-settings.jpg │ ├── magento-mep-profil-attribute.jpg │ ├── magento-mep-profil-datenformat.jpg │ ├── magento-mep-profil-export-preview.jpg │ ├── magento-mep-profil-filter.jpg │ ├── magento-mep-profil-general.jpg │ ├── magento-mep-profil-twig-template.jpg │ └── magento-mep-profile.jpg ├── modman └── src ├── app ├── code │ └── community │ │ └── Flagbit │ │ └── MEP │ │ ├── Block │ │ ├── Adminhtml │ │ │ ├── Attribute │ │ │ │ ├── View.php │ │ │ │ └── View │ │ │ │ │ ├── Edit.php │ │ │ │ │ ├── Edit │ │ │ │ │ ├── Form.php │ │ │ │ │ └── Options.php │ │ │ │ │ └── Grid.php │ │ │ ├── Category │ │ │ │ ├── Dynamic.php │ │ │ │ └── Mapping.php │ │ │ ├── Export │ │ │ │ ├── Edit.php │ │ │ │ ├── Edit │ │ │ │ │ └── Form.php │ │ │ │ └── Filter.php │ │ │ ├── Google │ │ │ │ ├── View.php │ │ │ │ └── View │ │ │ │ │ └── Edit │ │ │ │ │ └── Form.php │ │ │ ├── Profile │ │ │ │ ├── Popup.php │ │ │ │ ├── View.php │ │ │ │ └── View │ │ │ │ │ ├── Edit.php │ │ │ │ │ ├── Edit │ │ │ │ │ ├── Form.php │ │ │ │ │ ├── Tab │ │ │ │ │ │ ├── Fields.php │ │ │ │ │ │ ├── Format.php │ │ │ │ │ │ ├── General.php │ │ │ │ │ │ └── Template.php │ │ │ │ │ └── Tabs.php │ │ │ │ │ ├── Grid.php │ │ │ │ │ ├── Grid │ │ │ │ │ └── Cron │ │ │ │ │ │ └── Renderer.php │ │ │ │ │ ├── Mapping.php │ │ │ │ │ ├── Mapping │ │ │ │ │ └── Grid.php │ │ │ │ │ ├── New.php │ │ │ │ │ └── New │ │ │ │ │ ├── Form.php │ │ │ │ │ ├── Tab │ │ │ │ │ └── General.php │ │ │ │ │ └── Tabs.php │ │ │ └── Shipping │ │ │ │ ├── Popup.php │ │ │ │ ├── View.php │ │ │ │ └── View │ │ │ │ ├── Edit.php │ │ │ │ ├── Edit │ │ │ │ ├── Form.php │ │ │ │ ├── Tab │ │ │ │ │ ├── Fields.php │ │ │ │ │ └── General.php │ │ │ │ └── Tabs.php │ │ │ │ ├── Grid.php │ │ │ │ ├── Mapping.php │ │ │ │ └── Mapping │ │ │ │ └── Grid.php │ │ └── Conditions.php │ │ ├── Helper │ │ ├── Categories.php │ │ ├── Data.php │ │ ├── Encoding.php │ │ ├── Log.php │ │ ├── QtyFilter.php │ │ ├── Shipping.php │ │ ├── Storelang.php │ │ └── Table.php │ │ ├── Model │ │ ├── Attribute │ │ │ ├── Mapping.php │ │ │ └── Mapping │ │ │ │ └── Option.php │ │ ├── Cron.php │ │ ├── Cron │ │ │ └── Execute.php │ │ ├── Data.php │ │ ├── Export.php │ │ ├── Export │ │ │ ├── Adapter │ │ │ │ └── Twig.php │ │ │ └── Entity │ │ │ │ └── Product.php │ │ ├── GoogleMapping.php │ │ ├── GoogleMapping │ │ │ └── Import.php │ │ ├── GoogleStorelang.php │ │ ├── GoogleTaxonomies.php │ │ ├── Mapping.php │ │ ├── Mysql4 │ │ │ ├── Attribute │ │ │ │ ├── Mapping.php │ │ │ │ └── Mapping │ │ │ │ │ ├── Collection.php │ │ │ │ │ ├── Option.php │ │ │ │ │ └── Option │ │ │ │ │ └── Collection.php │ │ │ ├── Cron.php │ │ │ ├── Cron │ │ │ │ └── Collection.php │ │ │ ├── GoogleMapping.php │ │ │ ├── GoogleMapping │ │ │ │ └── Collection.php │ │ │ ├── GoogleStorelang.php │ │ │ ├── GoogleStorelang │ │ │ │ └── Collection.php │ │ │ ├── GoogleTaxonomies.php │ │ │ ├── GoogleTaxonomies │ │ │ │ └── Collection.php │ │ │ ├── Mapping.php │ │ │ ├── Mapping │ │ │ │ └── Collection.php │ │ │ ├── Profile.php │ │ │ ├── Profile │ │ │ │ └── Collection.php │ │ │ ├── Rule.php │ │ │ ├── Shipping.php │ │ │ └── Shipping │ │ │ │ ├── Attribute.php │ │ │ │ ├── Attribute │ │ │ │ └── Collection.php │ │ │ │ └── Collection.php │ │ ├── Observer.php │ │ ├── Profile.php │ │ ├── Resource │ │ │ └── Setup.php │ │ ├── Rule.php │ │ ├── Rule │ │ │ └── Condition │ │ │ │ ├── Combine.php │ │ │ │ └── Product.php │ │ ├── Shipping.php │ │ ├── Shipping │ │ │ └── Attribute.php │ │ ├── Thread.php │ │ └── Twig │ │ │ ├── Loader.php │ │ │ ├── Observer │ │ │ ├── NumberFormatArray.php │ │ │ ├── SortArray.php │ │ │ └── UnserializeString.php │ │ │ └── Sandbox │ │ │ └── Policy.php │ │ ├── controllers │ │ └── Adminhtml │ │ │ ├── AttributeController.php │ │ │ ├── DynamicController.php │ │ │ ├── GoogleController.php │ │ │ ├── MepController.php │ │ │ ├── Profile │ │ │ └── AttributeController.php │ │ │ ├── ProfileController.php │ │ │ ├── Shipping │ │ │ └── AttributeController.php │ │ │ └── ShippingController.php │ │ ├── etc │ │ ├── adminhtml.xml │ │ ├── config.xml │ │ └── jstranslator.xml │ │ └── sql │ │ └── mep_setup │ │ ├── mysql4-install-0.1.0.php │ │ ├── mysql4-install-0.4.0.php │ │ ├── mysql4-upgrade-0.1.0-0.1.1.php │ │ ├── mysql4-upgrade-0.1.1-0.1.2.php │ │ ├── mysql4-upgrade-0.1.2-0.1.3.php │ │ ├── mysql4-upgrade-0.1.3-0.1.4.php │ │ ├── mysql4-upgrade-0.1.4-0.1.5.php │ │ ├── mysql4-upgrade-0.1.5-0.1.6.php │ │ ├── mysql4-upgrade-0.1.6-0.1.7.php │ │ ├── mysql4-upgrade-0.1.7-0.1.8.php │ │ ├── mysql4-upgrade-0.1.8-0.1.9.php │ │ ├── mysql4-upgrade-0.1.9-0.2.0.php │ │ ├── mysql4-upgrade-0.2.0-0.2.1.php │ │ ├── mysql4-upgrade-0.2.1-0.2.2.php │ │ ├── mysql4-upgrade-0.2.2-0.2.3.php │ │ ├── mysql4-upgrade-0.2.3-0.2.4.php │ │ ├── mysql4-upgrade-0.2.4-0.2.5.php │ │ ├── mysql4-upgrade-0.2.5-0.2.6.php │ │ ├── mysql4-upgrade-0.2.6-0.2.7.php │ │ ├── mysql4-upgrade-0.2.7-0.3.0.php │ │ ├── mysql4-upgrade-0.3.0-0.4.0.php │ │ ├── mysql4-upgrade-0.4.0-0.5.0.php │ │ ├── mysql4-upgrade-0.5.0-0.6.0.php │ │ ├── mysql4-upgrade-0.6.0-0.7.0.php │ │ ├── mysql4-upgrade-0.7.0-0.8.0.php │ │ ├── mysql4-upgrade-0.8.0-0.8.1.php │ │ ├── mysql4-upgrade-0.8.1-0.8.2.php │ │ ├── mysql4-upgrade-0.8.2-0.8.3.php │ │ ├── mysql4-upgrade-0.8.3-0.9.0.php │ │ ├── mysql4-upgrade-0.9.0-0.9.1.php │ │ ├── mysql4-upgrade-0.9.1-0.9.2.php │ │ ├── mysql4-upgrade-0.9.19-0.9.20.php │ │ ├── mysql4-upgrade-0.9.19.1-0.9.22.php │ │ ├── mysql4-upgrade-0.9.2-0.9.7.php │ │ ├── mysql4-upgrade-0.9.7-0.9.19.1.php │ │ └── mysql4-upgrade-0.9.7-0.9.19.php ├── design │ └── adminhtml │ │ └── default │ │ └── default │ │ ├── layout │ │ └── mep.xml │ │ └── template │ │ └── mep │ │ ├── attribute │ │ └── mapping │ │ │ ├── categories.phtml │ │ │ └── options.phtml │ │ ├── fieldset.phtml │ │ ├── form │ │ ├── after.phtml │ │ ├── before.phtml │ │ └── profil │ │ │ └── view │ │ │ └── aftergridmapping.phtml │ │ ├── google │ │ └── categorieslist.phtml │ │ ├── mapping.phtml │ │ ├── menu.phtml │ │ ├── popup.phtml │ │ └── shipping │ │ └── popup.phtml ├── etc │ └── modules │ │ └── Flagbit_MEP.xml └── locale │ └── de_DE │ └── Flagbit_MEP.csv ├── js ├── mep │ ├── google_categories_import.js │ └── google_mapping.js └── tablekit │ └── tablekit.js ├── lib └── Twig │ ├── Autoloader.php │ ├── Compiler.php │ ├── CompilerInterface.php │ ├── Environment.php │ ├── Error.php │ ├── Error │ ├── Loader.php │ ├── Runtime.php │ └── Syntax.php │ ├── ExistsLoaderInterface.php │ ├── ExpressionParser.php │ ├── Extension.php │ ├── Extension │ ├── Core.php │ ├── Debug.php │ ├── Escaper.php │ ├── Optimizer.php │ ├── Sandbox.php │ ├── Staging.php │ └── StringLoader.php │ ├── ExtensionInterface.php │ ├── Filter.php │ ├── Filter │ ├── Function.php │ ├── Method.php │ └── Node.php │ ├── FilterCallableInterface.php │ ├── FilterInterface.php │ ├── Function.php │ ├── Function │ ├── Function.php │ ├── Method.php │ └── Node.php │ ├── FunctionCallableInterface.php │ ├── FunctionInterface.php │ ├── Lexer.php │ ├── LexerInterface.php │ ├── Loader │ ├── Array.php │ ├── Chain.php │ ├── Filesystem.php │ └── String.php │ ├── LoaderInterface.php │ ├── Markup.php │ ├── Node.php │ ├── Node │ ├── AutoEscape.php │ ├── Block.php │ ├── BlockReference.php │ ├── Body.php │ ├── Do.php │ ├── Embed.php │ ├── Expression.php │ ├── Expression │ │ ├── Array.php │ │ ├── AssignName.php │ │ ├── Binary.php │ │ ├── Binary │ │ │ ├── Add.php │ │ │ ├── And.php │ │ │ ├── BitwiseAnd.php │ │ │ ├── BitwiseOr.php │ │ │ ├── BitwiseXor.php │ │ │ ├── Concat.php │ │ │ ├── Div.php │ │ │ ├── EndsWith.php │ │ │ ├── Equal.php │ │ │ ├── FloorDiv.php │ │ │ ├── Greater.php │ │ │ ├── GreaterEqual.php │ │ │ ├── In.php │ │ │ ├── Less.php │ │ │ ├── LessEqual.php │ │ │ ├── Matches.php │ │ │ ├── Mod.php │ │ │ ├── Mul.php │ │ │ ├── NotEqual.php │ │ │ ├── NotIn.php │ │ │ ├── Or.php │ │ │ ├── Power.php │ │ │ ├── Range.php │ │ │ ├── StartsWith.php │ │ │ └── Sub.php │ │ ├── BlockReference.php │ │ ├── Call.php │ │ ├── Conditional.php │ │ ├── Constant.php │ │ ├── ExtensionReference.php │ │ ├── Filter.php │ │ ├── Filter │ │ │ └── Default.php │ │ ├── Function.php │ │ ├── GetAttr.php │ │ ├── MethodCall.php │ │ ├── Name.php │ │ ├── Parent.php │ │ ├── TempName.php │ │ ├── Test.php │ │ ├── Test │ │ │ ├── Constant.php │ │ │ ├── Defined.php │ │ │ ├── Divisibleby.php │ │ │ ├── Even.php │ │ │ ├── Null.php │ │ │ ├── Odd.php │ │ │ └── Sameas.php │ │ ├── Unary.php │ │ └── Unary │ │ │ ├── Neg.php │ │ │ ├── Not.php │ │ │ └── Pos.php │ ├── Flush.php │ ├── For.php │ ├── ForLoop.php │ ├── If.php │ ├── Import.php │ ├── Include.php │ ├── Macro.php │ ├── Module.php │ ├── Print.php │ ├── Sandbox.php │ ├── SandboxedModule.php │ ├── SandboxedPrint.php │ ├── Set.php │ ├── SetTemp.php │ ├── Spaceless.php │ └── Text.php │ ├── NodeInterface.php │ ├── NodeOutputInterface.php │ ├── NodeTraverser.php │ ├── NodeVisitor │ ├── Escaper.php │ ├── Optimizer.php │ ├── SafeAnalysis.php │ └── Sandbox.php │ ├── NodeVisitorInterface.php │ ├── Parser.php │ ├── ParserInterface.php │ ├── Sandbox │ ├── SecurityError.php │ ├── SecurityPolicy.php │ └── SecurityPolicyInterface.php │ ├── SimpleFilter.php │ ├── SimpleFunction.php │ ├── SimpleTest.php │ ├── Template.php │ ├── TemplateInterface.php │ ├── Test.php │ ├── Test │ ├── Function.php │ ├── IntegrationTestCase.php │ ├── Method.php │ ├── Node.php │ └── NodeTestCase.php │ ├── TestCallableInterface.php │ ├── TestInterface.php │ ├── Token.php │ ├── TokenParser.php │ ├── TokenParser │ ├── AutoEscape.php │ ├── Block.php │ ├── Do.php │ ├── Embed.php │ ├── Extends.php │ ├── Filter.php │ ├── Flush.php │ ├── For.php │ ├── From.php │ ├── If.php │ ├── Import.php │ ├── Include.php │ ├── Macro.php │ ├── Sandbox.php │ ├── Set.php │ ├── Spaceless.php │ └── Use.php │ ├── TokenParserBroker.php │ ├── TokenParserBrokerInterface.php │ ├── TokenParserInterface.php │ └── TokenStream.php ├── mep-cron.php ├── shell ├── mep.php └── updateGoogleCategories.php └── skin └── adminhtml └── default └── default ├── chosen ├── chosen-sprite.png ├── chosen.css ├── chosen.jquery.js ├── chosen.jquery.min.js ├── chosen.proto.js └── chosen.proto.min.js ├── highlighttextarea ├── jquery.highlighttextarea.min.css └── jquery.highlighttextarea.min.js ├── images ├── down.gif ├── down_right.png ├── mep-logo-icon.png └── up.gif ├── jquery.min.js ├── jqueryui ├── images │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ ├── ui-bg_flat_10_000000_40x100.png │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ ├── ui-bg_glass_65_ffffff_1x400.png │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ ├── ui-bg_highlight-soft_75_ffe45c_1x100.png │ ├── ui-icons_222222_256x240.png │ ├── ui-icons_228ef1_256x240.png │ ├── ui-icons_ef8c08_256x240.png │ ├── ui-icons_ffd27a_256x240.png │ └── ui-icons_ffffff_256x240.png ├── jquery-ui.min.css ├── jquery-ui.min.js ├── jquery-ui.structure.min.css └── jquery-ui.theme.min.css ├── mep.css ├── mep.js └── tablekit.css /.gitignore: -------------------------------------------------------------------------------- 1 | dev.cache.properties 2 | live.cache.properties 3 | devonline.cache.properties 4 | .DS_Store 5 | *.cache.properties 6 | *~ 7 | *.swp 8 | build.properties 9 | build.default.properties 10 | build.xml 11 | .buildpath 12 | .project 13 | .settings 14 | .settings/**/* 15 | .externalToolBuilders 16 | .externalToolBuilders/**/* 17 | /.IGNOREME 18 | /cache.properties 19 | .idea/* 20 | .vagrant/* 21 | *.pdf 22 | docs/*.log 23 | docs/*.aux 24 | docs/*.toc 25 | docs/*.out 26 | docs/*.lot 27 | docs/*.lof 28 | docs/*.bak 29 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".vagrant"] 2 | path = .vagrant 3 | url = git@github.com:Flagbit/Magento-Vagrant.git 4 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flagbit/mep", 3 | "license": "GPL-2.0-or-later", 4 | "type": "magento-module", 5 | "description": "Flagbit MEP - Provides different profiles to export product data into csv or xml format", 6 | "keywords": [ 7 | "magento", 8 | "export", 9 | "csv", 10 | "xml", 11 | "upload" 12 | ], 13 | "authors":[ 14 | { 15 | "name":"Joerg Weller", 16 | "email":"weller@flagbit.de", 17 | "homepage":"http://www.flagbit.de/", 18 | "role": "Developer" 19 | } 20 | ], 21 | "require": { 22 | "magento-hackathon/magento-composer-installer": "*" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/img/magento-mep-menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-menu.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-attribute-settings.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-attribute-settings.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-attribute.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-attribute.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-datenformat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-datenformat.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-export-preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-export-preview.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-filter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-filter.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-general.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-general.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profil-twig-template.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profil-twig-template.jpg -------------------------------------------------------------------------------- /docs/img/magento-mep-profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/docs/img/magento-mep-profile.jpg -------------------------------------------------------------------------------- /modman: -------------------------------------------------------------------------------- 1 | src/app/code/community/Flagbit/MEP app/code/community/Flagbit/MEP 2 | src/app/design/adminhtml/default/default/layout/mep.xml app/design/adminhtml/default/default/layout/mep.xml 3 | src/app/design/adminhtml/default/default/template/mep app/design/adminhtml/default/default/template/mep 4 | src/app/etc/modules/* app/etc/modules 5 | src/js/tablekit/tablekit.js js/tablekit/tablekit.js 6 | src/js/mep/* js/mep 7 | src/skin/adminhtml/default/default/jquery.min.js skin/adminhtml/default/default/jquery.min.js 8 | src/skin/adminhtml/default/default/jqueryui skin/adminhtml/default/default/jqueryui 9 | src/skin/adminhtml/default/default/mep.css skin/adminhtml/default/default 10 | src/skin/adminhtml/default/default/mep.js skin/adminhtml/default/default 11 | src/skin/adminhtml/default/default/tablekit.css skin/adminhtml/default/default 12 | src/skin/adminhtml/default/default/chosen skin/adminhtml/default/default/chosen 13 | src/skin/adminhtml/default/default/images/* skin/adminhtml/default/default/images 14 | src/skin/adminhtml/default/default/highlighttextarea skin/adminhtml/default/default/highlighttextarea 15 | src/shell/* shell 16 | src/lib/* lib 17 | src/mep-cron.php mep-cron.php -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Attribute/View.php: -------------------------------------------------------------------------------- 1 | _blockGroup = 'mep'; 14 | $this->_controller = 'adminhtml_attribute_view'; 15 | $this->_headerText = Mage::helper('mep')->__('Manage Attribute Mapping'); 16 | parent::__construct(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Attribute/View/Edit.php: -------------------------------------------------------------------------------- 1 | _objectId = 'id'; 14 | $this->_blockGroup = 'mep'; 15 | $this->_controller = 'adminhtml_attribute_view'; 16 | $this->_mode = 'edit'; 17 | 18 | $this->_updateButton('save', 'label', Mage::helper('mep')->__('Save')); 19 | $this->_updateButton('delete', 'label', Mage::helper('mep')->__('Delete')); 20 | 21 | $this->_addButton('save_and_continue', array( 22 | 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'), 23 | 'onclick' => 'saveAndContinueEdit()', 24 | 'class' => 'save', 25 | ), -100); 26 | 27 | $this->_formScripts[] = " 28 | function saveAndContinueEdit(){ 29 | editForm.submit($('edit_form').action+'back/edit/'); 30 | } 31 | "; 32 | } 33 | 34 | /** 35 | * getHeaderText 36 | * 37 | * Returns the headline for the edit form 38 | * 39 | * @see Mage_Adminhtml_Block_Widget_Container::getHeaderText() 40 | * 41 | * @return string Headline 42 | */ 43 | public function getHeaderText() 44 | { 45 | if (Mage::registry('mep_profile_data') && Mage::registry('mep_profile_data')->getId()) { 46 | return Mage::helper('mep')->__('Edit Attribute Mapping "%s"', $this->htmlEscape(Mage::registry('mep_profile_data')->getName())); 47 | } else { 48 | return Mage::helper('mep')->__('New Attribute Mapping'); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Export/Edit.php: -------------------------------------------------------------------------------- 1 | removeButton('back') 15 | ->removeButton('reset') 16 | ->removeButton('save'); 17 | } 18 | 19 | /** 20 | * Internal constructor 21 | * 22 | * @return void 23 | */ 24 | protected function _construct() 25 | { 26 | parent::_construct(); 27 | 28 | $this->_objectId = 'export_id'; 29 | $this->_blockGroup = 'mep'; 30 | $this->_controller = 'adminhtml_export'; 31 | } 32 | 33 | /** 34 | * Get header text 35 | * 36 | * @return string 37 | */ 38 | public function getHeaderText() 39 | { 40 | return Mage::helper('mep')->__('Export'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Export/Edit/Form.php: -------------------------------------------------------------------------------- 1 | 'edit_form', 15 | 'action' => $this->getUrl('*/*/getFilter'), 16 | 'method' => 'post' 17 | )); 18 | $fieldset = $form->addFieldset('base_fieldset', array('legend' => $helper->__('Export Settings'))); 19 | $fieldset->addField('entity', 'select', array( 20 | 'name' => 'entity', 21 | 'title' => $helper->__('Entity Type'), 22 | 'label' => $helper->__('Entity Type'), 23 | 'required' => false, 24 | 'onchange' => 'editForm.getFilter();', 25 | 'values' => Mage::getModel('importexport/source_export_entity')->toOptionArray() 26 | )); 27 | $fieldset->addField('file_format', 'select', array( 28 | 'name' => 'file_format', 29 | 'title' => $helper->__('Export File Format'), 30 | 'label' => $helper->__('Export File Format'), 31 | 'required' => false, 32 | 'values' => Mage::getModel('importexport/source_export_format')->toOptionArray() 33 | )); 34 | 35 | $form->setUseContainer(true); 36 | $this->setForm($form); 37 | 38 | return parent::_prepareForm(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Google/View.php: -------------------------------------------------------------------------------- 1 | _blockGroup = 'mep'; 13 | $this->_controller = 'adminhtml_google_view'; 14 | $this->_mode = 'edit'; 15 | $this->_headerText = Mage::helper('mep')->__('Manage Google Category Mapping'); 16 | parent::__construct(); 17 | } 18 | 19 | protected function _prepareLayout() 20 | { 21 | if ($this->_blockGroup && $this->_controller && $this->_mode) { 22 | $this->setChild('form', $this->getLayout()->createBlock($this->_blockGroup . '/' . $this->_controller . '_' . $this->_mode . '_form')); 23 | } 24 | return parent::_prepareLayout(); 25 | } 26 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View.php: -------------------------------------------------------------------------------- 1 | _blockGroup = 'mep'; 20 | $this->_controller = 'adminhtml_profile_view'; 21 | $this->_headerText = Mage::helper('mep')->__('Manage MEP Profiles'); 22 | parent::__construct(); 23 | } 24 | 25 | /** 26 | * Prepare html output 27 | * 28 | * @return string 29 | */ 30 | public function _toHtml() 31 | { 32 | return parent::_toHtml() . $this->getVersionHtml(); 33 | } 34 | 35 | /** 36 | * Returns HTML block that contains information about current version of the MEP module 37 | * 38 | * @return string HTML 39 | */ 40 | public function getVersionHtml() 41 | { 42 | $version = strval(Mage::getConfig()->getNode(self::CONFIG_KEY_MEP_VERSION)); 43 | 44 | return '
MEP Version ' . $version . '
'; 45 | } 46 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/Edit/Form.php: -------------------------------------------------------------------------------- 1 | 'edit_form', 16 | 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 17 | 'method' => 'post', 18 | 'enctype' => 'multipart/form-data', 19 | )); 20 | $form->setUseContainer(true); 21 | $this->setForm($form); 22 | 23 | return parent::_prepareForm(); 24 | } 25 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/Edit/Tab/Fields.php: -------------------------------------------------------------------------------- 1 | setForm($form); 17 | 18 | $fieldset = $form->addFieldset( 19 | 'mep_fieldmapping_form', 20 | array( 21 | 'legend' => Mage::helper('mep')->__('Field Mapping') 22 | ) 23 | ); 24 | 25 | $form->setValues(Mage::helper('mep')->getCurrentProfileData()); 26 | return parent::_prepareForm(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/Mapping.php: -------------------------------------------------------------------------------- 1 | setTemplate('mep/mapping.phtml'); 12 | } 13 | 14 | /** 15 | * Prepare button and grid 16 | * 17 | * @return Mage_Adminhtml_Block_Catalog_Product 18 | */ 19 | protected function _prepareLayout() 20 | { 21 | $this->setChild('grid', $this->getLayout()->createBlock('mep/adminhtml_profile_view_mapping_grid', 'mapping.grid')); 22 | return parent::_prepareLayout(); 23 | } 24 | 25 | /** 26 | * Render grid 27 | * 28 | * @return string 29 | */ 30 | public function getGridHtml() 31 | { 32 | return $this->getChildHtml('grid'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/New.php: -------------------------------------------------------------------------------- 1 | _objectId = 'id'; 14 | $this->_blockGroup = 'mep'; 15 | $this->_controller = 'adminhtml_profile_view'; 16 | $this->_mode = 'new'; 17 | 18 | $this->_updateButton('save', 'label', Mage::helper('mep')->__('Save')); 19 | $this->_updateButton('delete', 'label', Mage::helper('mep')->__('Delete')); 20 | 21 | $this->_addButton('save_and_continue', array( 22 | 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'), 23 | 'onclick' => 'saveAndContinueEdit()', 24 | 'class' => 'save', 25 | ), -100); 26 | 27 | $this->_formScripts[] = " 28 | function saveAndContinueEdit(){ 29 | editForm.submit($('edit_form').action+'back/edit/'); 30 | } 31 | "; 32 | } 33 | 34 | /** 35 | * getHeaderText 36 | * 37 | * Returns the headline for the edit form 38 | * 39 | * @see Mage_Adminhtml_Block_Widget_Container::getHeaderText() 40 | * 41 | * @return string Headline 42 | */ 43 | public function getHeaderText() 44 | { 45 | if (Mage::helper('mep')->getCurrentProfileData(true)) { 46 | return Mage::helper('mep')->__('Edit Profile "%s"', $this->htmlEscape(Mage::helper('mep')->getCurrentProfileData('name'))); 47 | } else { 48 | return Mage::helper('mep')->__('New Profile'); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/New/Form.php: -------------------------------------------------------------------------------- 1 | 'edit_form', 16 | 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 17 | 'method' => 'post', 18 | 'enctype' => 'multipart/form-data', 19 | )); 20 | $form->setUseContainer(true); 21 | $this->setForm($form); 22 | 23 | return parent::_prepareForm(); 24 | } 25 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Profile/View/New/Tabs.php: -------------------------------------------------------------------------------- 1 | setId('rule_tabs'); 14 | $this->setDestElementId('edit_form'); 15 | } 16 | 17 | /** 18 | * _beforeToHtml 19 | * 20 | * Adds the tabs 21 | * 22 | * @see Mage_Adminhtml_Block_Widget_Tabs::_beforeToHtml() 23 | * 24 | * @return Flagbit_MEP_Block_Adminhtml_Profile_View_Edit_Tabs Self. 25 | */ 26 | protected function _beforeToHtml() 27 | { 28 | $this->addTab('form_section', array( 29 | 'label' => Mage::helper('mep')->__('General Information'), 30 | 'title' => Mage::helper('mep')->__('General Information'), 31 | 'content' => $this->getLayout()->createBlock('mep/adminhtml_profile_view_new_tab_general')->toHtml(), 32 | )); 33 | return parent::_beforeToHtml(); 34 | } 35 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/Popup.php: -------------------------------------------------------------------------------- 1 | setChild('save_button', 25 | $this->getLayout()->createBlock('adminhtml/widget_button') 26 | ->setData(array( 27 | 'type' => 'submit', 28 | 'value' => 'Submit', 29 | 'class' => 'save', 30 | 'title' => 'Submit', 31 | 'label' => Mage::helper('catalog')->__('Save') 32 | )) 33 | ); 34 | 35 | return parent::_prepareLayout(); 36 | } 37 | 38 | public function getProfileId() 39 | { 40 | return $this->getRequest()->getParam('profile_id', null); 41 | } 42 | 43 | public function getMapping() 44 | { 45 | return Mage::getModel('mep/shipping_attribute')->load($this->getRequest()->getParam('id')); 46 | } 47 | 48 | /** 49 | * Return html code of the save button for popup window 50 | * 51 | * @return string 52 | */ 53 | public function getSaveButtonHtml() { 54 | return $this->getChildHtml('save_button'); 55 | } 56 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/View.php: -------------------------------------------------------------------------------- 1 | _blockGroup = 'mep'; 14 | $this->_controller = 'adminhtml_shipping_view'; 15 | $this->_headerText = Mage::helper('mep')->__('Manage Shipping Mapping'); 16 | parent::__construct(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/View/Edit/Form.php: -------------------------------------------------------------------------------- 1 | 'edit_form', 16 | 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 17 | 'method' => 'post', 18 | 'enctype' => 'multipart/form-data', 19 | )); 20 | $form->setUseContainer(true); 21 | $this->setForm($form); 22 | 23 | return parent::_prepareForm(); 24 | } 25 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/View/Edit/Tab/Fields.php: -------------------------------------------------------------------------------- 1 | setForm($form); 17 | 18 | $fieldset = $form->addFieldset( 19 | 'mep_fieldmapping_form', 20 | array( 21 | 'legend' => Mage::helper('mep')->__('Field Mapping') 22 | ) 23 | ); 24 | 25 | $form->setValues(Mage::helper('mep')->getCurrentProfileData()); 26 | return parent::_prepareForm(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/View/Edit/Tabs.php: -------------------------------------------------------------------------------- 1 | setId('rule_tabs'); 14 | $this->setDestElementId('edit_form'); 15 | } 16 | 17 | /** 18 | * _beforeToHtml 19 | * 20 | * Adds the tabs 21 | * 22 | * @see Mage_Adminhtml_Block_Widget_Tabs::_beforeToHtml() 23 | * 24 | * @return Flagbit_MEP_Block_Adminhtml_Profile_View_Edit_Tabs Self. 25 | */ 26 | protected function _beforeToHtml() 27 | { 28 | $this->addTab('form_section', array( 29 | 'label' => Mage::helper('mep')->__('General Information'), 30 | 'title' => Mage::helper('mep')->__('General Information'), 31 | 'content' => $this->getLayout()->createBlock('mep/adminhtml_shipping_view_edit_tab_general')->toHtml(), 32 | )); 33 | 34 | if($data = Mage::helper('mep')->getCurrentProfileData(true)){ 35 | $this->addTab('mapping', array( 36 | 'label' => Mage::helper('mep')->__('Shipping Mapping'), 37 | 'content' => $this->getLayout()->createBlock('mep/adminhtml_shipping_view_mapping')->toHtml(), 38 | )); 39 | } 40 | 41 | $this->setActiveTab($this->getRequest()->get('tab')); 42 | 43 | return parent::_beforeToHtml(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Block/Adminhtml/Shipping/View/Mapping.php: -------------------------------------------------------------------------------- 1 | setTemplate('mep/mapping.phtml'); 12 | } 13 | 14 | /** 15 | * Prepare button and grid 16 | * 17 | * @return Mage_Adminhtml_Block_Catalog_Product 18 | */ 19 | protected function _prepareLayout() 20 | { 21 | $this->setChild('grid', $this->getLayout()->createBlock('mep/adminhtml_shipping_view_mapping_grid', 'mapping.grid')); 22 | return parent::_prepareLayout(); 23 | } 24 | 25 | /** 26 | * Render grid 27 | * 28 | * @return string 29 | */ 30 | public function getGridHtml() 31 | { 32 | return $this->getChildHtml('grid'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Helper/Storelang.php: -------------------------------------------------------------------------------- 1 | getCollection() 8 | ->removeAllFieldsFromSelect() 9 | ->addFieldToSelect('locale'); 10 | 11 | $collection->getSelect()->group('main_table.locale'); 12 | 13 | return $collection; 14 | } 15 | 16 | public function getStoreLanguages() { 17 | $allLanguages = Mage::app()->getLocale()->getOptionLocales(); 18 | 19 | $result = []; 20 | foreach($allLanguages as $lang) { 21 | $result[] = $lang['value']; 22 | } 23 | 24 | return $result; 25 | } 26 | 27 | public function getLanguagesForForm() { 28 | $result = [ 29 | [ 30 | 'label' => '', 31 | 'value' => '', 32 | ] 33 | ]; 34 | foreach($this->getLanguages() as $lang) { 35 | $result[] = [ 36 | 'label' => $lang->getData('locale'), 37 | 'value' => $lang->getData('locale'), 38 | ]; 39 | } 40 | 41 | return $result; 42 | } 43 | 44 | public function getLanguageForStoreId($storeId) { 45 | $lang = Mage::getModel('mep/googleStorelang')->load($storeId); 46 | if($lang) { 47 | return $lang->getData('language'); 48 | } else { 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Attribute/Mapping/Option.php: -------------------------------------------------------------------------------- 1 | _init('mep/attribute_mapping_option'); 11 | } 12 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Cron.php: -------------------------------------------------------------------------------- 1 | _init('mep/cron'); 7 | } 8 | 9 | /** 10 | * Checks the observer's cron expression against time 11 | * 12 | * Supports $this->setCronExpr('* 0-5,10-59/5 2-10,15-25 january-june/2 mon-fri') 13 | * 14 | * @param Varien_Event $event 15 | * @return boolean 16 | */ 17 | public function trySchedule($time) 18 | { 19 | $e = $this->getCronExprArr(); 20 | if (!$e || !$time) { 21 | return false; 22 | } 23 | if (!is_numeric($time)) { 24 | $time = strtotime($time); 25 | } 26 | 27 | $d = getdate(Mage::getSingleton('core/date')->timestamp($time)); 28 | 29 | $match = $this->matchCronExpression($e[0], $d['minutes']) 30 | && $this->matchCronExpression($e[1], $d['hours']) 31 | && $this->matchCronExpression($e[2], $d['mday']) 32 | && $this->matchCronExpression($e[3], $d['mon']) 33 | && $this->matchCronExpression($e[4], $d['wday']); 34 | 35 | if ($match) { 36 | $this->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', time())); 37 | $this->setScheduledAt(strftime('%Y-%m-%d %H:%M:00', $time)); 38 | } 39 | return $match; 40 | } 41 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/GoogleMapping.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleMapping'); 7 | } 8 | 9 | public function loadByCategoryAndStore($categoryId, $storeId){ 10 | $collection = $this->getCollection() 11 | ->addFieldToFilter('category_id', $categoryId) 12 | ->addFieldToFilter('store_id', $storeId); 13 | $mapping = $collection->getFirstItem(); 14 | return $mapping; 15 | } 16 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/GoogleStorelang.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleStorelang'); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/GoogleTaxonomies.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleTaxonomies'); 7 | } 8 | 9 | public function getTaxonomiesForParent($parentId, $language = null) 10 | { 11 | if(is_null($language)){ 12 | return $this->getCollection()->addFieldToFilter('parent_id', $parentId); 13 | } else { 14 | return $this->getCollection() 15 | ->addFieldToFilter('parent_id', $parentId) 16 | ->addFieldToFilter('locale', $language) 17 | ; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Attribute/Mapping/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/attribute_mapping'); 13 | } 14 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Attribute/Mapping/Option.php: -------------------------------------------------------------------------------- 1 | _init('mep/attribute_mapping_option', 'id'); 14 | } 15 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Attribute/Mapping/Option/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/attribute_mapping_option'); 13 | } 14 | 15 | public function setStoreFilter($storeId) 16 | { 17 | $this->addFieldToFilter('store_id', $storeId); 18 | return $this; 19 | } 20 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Cron.php: -------------------------------------------------------------------------------- 1 | _init('mep/cron', 'cron_id'); 12 | } 13 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Cron/Collection.php: -------------------------------------------------------------------------------- 1 | 7 | array( 8 | 'map.scheduled' => 'UNIX_TIMESTAMP(scheduled_at)' 9 | ), 10 | ); 11 | 12 | /** 13 | * Constructor 14 | * 15 | */ 16 | protected function _construct() 17 | { 18 | $this->_init('mep/cron'); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleMapping.php: -------------------------------------------------------------------------------- 1 | _init('mep/google_mapping', 'mapping_id'); 12 | } 13 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleMapping/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleMapping'); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleStorelang.php: -------------------------------------------------------------------------------- 1 | _init('mep/google_storelang', 'store_id'); 12 | $this->_isPkAutoIncrement = false; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleStorelang/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleStorelang'); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleTaxonomies.php: -------------------------------------------------------------------------------- 1 | _init('mep/google_taxonomies', 'taxonomy_id'); 12 | } 13 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/GoogleTaxonomies/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/googleTaxonomies'); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Mapping.php: -------------------------------------------------------------------------------- 1 | array('to_field', 'profile_id'), 'title' => 'Attribute Code') 8 | ); 9 | 10 | 11 | /** 12 | * Constructor 13 | * 14 | */ 15 | protected function _construct() 16 | { 17 | 18 | $this->_init('mep/mapping', 'id'); 19 | } 20 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Mapping/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/mapping'); 13 | } 14 | 15 | /** 16 | * add Attribute Settings 17 | * 18 | * @return Flagbit_MEP_Model_Mysql4_Mapping_Collection 19 | */ 20 | public function addAttributeSettings() 21 | { 22 | $entityTypeId = Mage::getSingleton('eav/config')->getEntityType('catalog_product')->getId(); 23 | 24 | $this->getSelect()->joinLeft( 25 | array('set_table' => $this->getTable('eav/attribute')), 26 | $this->getResource()->getReadConnection()->quoteInto('main_table.attribute_code = set_table.attribute_code' . 27 | ' AND set_table.entity_type_id = ?', $entityTypeId), 28 | array('backend_type', 'frontend_input') 29 | ); 30 | return $this; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Profile/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/profile'); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Shipping.php: -------------------------------------------------------------------------------- 1 | _init('mep/shipping', 'id'); 13 | } 14 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Shipping/Attribute.php: -------------------------------------------------------------------------------- 1 | array('attribute_code', 'profile_id'), 'title' => 'Attribute Code') 8 | ); 9 | 10 | /** 11 | * Constructor 12 | * 13 | */ 14 | protected function _construct() 15 | { 16 | $this->_init('mep/shipping_attribute', 'id'); 17 | } 18 | 19 | /** 20 | * Check for unique values existence 21 | * 22 | * @param Mage_Core_Model_Abstract $object 23 | * @return Mage_Core_Model_Resource_Db_Abstract 24 | * @throws Mage_Core_Exception 25 | */ 26 | protected function _checkUnique(Mage_Core_Model_Abstract $object) 27 | { 28 | $data = new Varien_Object($this->_prepareDataForSave($object)); 29 | $select = $this->_getWriteAdapter()->select() 30 | ->from($this->getTable('eav/attribute')) 31 | ->where('attribute_code' . '=?', trim($data->getData('attribute_code'))); 32 | 33 | $select2 = $this->_getWriteAdapter()->select() 34 | ->from($this->getTable('mep/attribute_mapping')) 35 | ->where('attribute_code' . '=?', trim($data->getData('attribute_code'))); 36 | 37 | if ($this->_getWriteAdapter()->fetchRow($select) || $this->_getWriteAdapter()->fetchRow($select2)) { 38 | Mage::throwException(Mage::helper('core')->__('There is already a Magento Attribute with the Code "%s".', $data->getData('attribute_code'))); 39 | } 40 | 41 | return parent::_checkUnique($object); 42 | } 43 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Shipping/Attribute/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/shipping_attribute'); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Mysql4/Shipping/Collection.php: -------------------------------------------------------------------------------- 1 | _init('mep/shipping'); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Resource/Setup.php: -------------------------------------------------------------------------------- 1 | setType('mep/rule_condition_combine'); 14 | } 15 | 16 | 17 | public function getNewChildSelectOptions() 18 | { 19 | $productCondition = Mage::getModel('mep/rule_condition_product'); 20 | $productAttributes = $productCondition->loadAttributeOptions()->getAttributeOption(); 21 | $attributes = array(); 22 | foreach ($productAttributes as $code=>$label) { 23 | $attributes[] = array('value'=>'mep/rule_condition_product|'.$code, 'label'=>$label); 24 | } 25 | return $attributes; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Shipping.php: -------------------------------------------------------------------------------- 1 | _init('mep/shipping'); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Shipping/Attribute.php: -------------------------------------------------------------------------------- 1 | _init('mep/shipping_attribute'); 11 | } 12 | 13 | /** 14 | * Processing object before save data 15 | * 16 | * @return Mage_Core_Model_Abstract 17 | */ 18 | protected function _beforeSave() 19 | { 20 | //validate attribute_code 21 | $validatorAttrCode = new Zend_Validate_Regex(array('pattern' => '/^[a-z][a-z_0-9]{1,254}$/')); 22 | if (!$validatorAttrCode->isValid($this->getAttributeCode())) { 23 | Mage::throwException(Mage::helper('mep')->__('Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.')); 24 | } 25 | return parent::_beforeSave(); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Twig/Observer/NumberFormatArray.php: -------------------------------------------------------------------------------- 1 | getTwig(); 14 | $policy = $observer->getPolicy(); 15 | $this->_adapter = $observer->getAdapter(); 16 | $policy->setAllowedFilter('number_format_array'); 17 | $filter = new Twig_SimpleFilter('number_format_array', array($this, 'numberFormatArray')); 18 | $twig->addFilter($filter); 19 | } 20 | 21 | /** 22 | * Get a string of values separate by a delimiter to format given the formats parameters 23 | * 24 | * @param float $numbers 25 | * @param int $decimals 26 | * @param string $dec_point 27 | * @param string $thousands_sep 28 | * @return string 29 | */ 30 | public function numberFormatArray($numbers , $decimals = 0 , $dec_point = '.' , $thousands_sep = ',') { 31 | $delimiter = $this->_adapter->getConfigurableDelimiter(); 32 | $numbersArray = explode($delimiter, $numbers); 33 | if (is_array($numbersArray)) { 34 | foreach ($numbersArray as &$number) { 35 | $number = floatval($number); 36 | $number = number_format($number, $decimals, $dec_point, $thousands_sep); 37 | } 38 | $numbers = implode($delimiter, $numbersArray); 39 | } 40 | return $numbers; 41 | } 42 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Twig/Observer/SortArray.php: -------------------------------------------------------------------------------- 1 | getTwig(); 14 | $policy = $observer->getPolicy(); 15 | $this->_adapter = $observer->getAdapter(); 16 | $policy->setAllowedFilter('sort_array'); 17 | $filter = new Twig_SimpleFilter('sort_array', array($this, 'sortArray')); 18 | $twig->addFilter($filter); 19 | } 20 | 21 | /** 22 | * Get a string of values separate by a delimiter to sort given the parameter order 23 | * 24 | * @param string $values 25 | * @param string $order 26 | * @return string 27 | */ 28 | public function sortArray($values, $order, $limit = 0) { 29 | $delimiter = $this->_adapter->getConfigurableDelimiter(); 30 | $valuesArray = explode($delimiter, $values); 31 | if (is_array($valuesArray)) { 32 | if ($order == 'asc') { 33 | sort($valuesArray); 34 | } 35 | elseif ($order == 'desc') { 36 | rsort($valuesArray); 37 | } 38 | if ($limit > 0) { 39 | $valuesArray = array_slice($valuesArray, 0, $limit); 40 | } 41 | $values = implode($delimiter, $valuesArray); 42 | } 43 | return $values; 44 | } 45 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Twig/Observer/UnserializeString.php: -------------------------------------------------------------------------------- 1 | getTwig(); 14 | $policy = $observer->getPolicy(); 15 | $this->_adapter = $observer->getAdapter(); 16 | $policy->setAllowedFilter('unserialize_string'); 17 | $filter = new Twig_SimpleFilter('unserialize_string', array($this, 'unserializeString')); 18 | $twig->addFilter($filter); 19 | } 20 | 21 | /** 22 | * Get a string of values separate by a delimiter to format given the formats parameters 23 | * 24 | * @param float $numbers 25 | */ 26 | public function unserializeString($string) { 27 | $result = null; 28 | try { 29 | $result = unserialize($string); 30 | 31 | } catch(Exception $e) { 32 | $result = false; 33 | } 34 | return $result; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/Model/Twig/Sandbox/Policy.php: -------------------------------------------------------------------------------- 1 | allowedTags = array('spaceless', 'if', 'set', 'block', 'do', 'filter', 'for'); 9 | $this->allowedFilters = array('date', 'date_modify', 'format', 'replace', 'number_format', 'url_encode', 'json_encode', 'convert_encoding', 'title', 'capitalize', 'nl2br', 'upper', 'lower', 'striptags', 'join', 'split', 'reverse', 'abs', 'length', 'sort', 'default', 'keys', 'escape', 'raw', 'merge', 'slice', 'trim', 'last', 'first'); 10 | $this->allowedMethods = array(); 11 | $this->allowedProperties = array(); 12 | $this->allowedFunctions = array('range', 'cycle', 'constant', 'random', 'block', 'date'); 13 | } 14 | 15 | public function addAllowedTag($tag) 16 | { 17 | $this->allowedTags[] = $tag; 18 | return $this; 19 | } 20 | 21 | public function setAllowedFilter($filter) 22 | { 23 | $this->allowedFilters[] = $filter; 24 | return $this; 25 | } 26 | 27 | public function addAllowedFunction($function) 28 | { 29 | $this->allowedFunctions[] = $function; 30 | return $this; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/etc/adminhtml.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MEP 8 | 100 9 | 10 | 11 | Export Profiles 12 | adminhtml/profile/index 13 | 14 | 15 | Shipping Mapping 16 | adminhtml/shipping/index 17 | 18 | 19 | Attribute Mapping 20 | adminhtml/attribute/index 21 | 22 | 23 | Google Mapping 24 | adminhtml/google/index 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/etc/jstranslator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Attribute Settings 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-install-0.1.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.0 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | DROP TABLE IF EXISTS {$this->getTable('mep_profile')}; 28 | CREATE TABLE IF NOT EXISTS {$this->getTable('mep_profile')} ( 29 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT, 30 | `name` varchar(255) NOT NULL, 31 | `status` ENUM( '0', '1' ) NOT NULL , 32 | `config` TEXT, 33 | `created_at` datetime NOT NULL default '0000-00-00 00:00:00', 34 | `updated_at` datetime NOT NULL default '0000-00-00 00:00:00', 35 | 36 | PRIMARY KEY (`id`) 37 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 38 | "); 39 | 40 | $installer->endSetup(); 41 | 42 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.0-0.1.1.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.0 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | DROP TABLE IF EXISTS {$this->getTable('mep_profile_attribute')}; 28 | CREATE TABLE IF NOT EXISTS {$this->getTable('mep_profile_attribute')} ( 29 | `id` int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, 30 | `attribute_id` int unsigned NOT NULL, 31 | `to_field` TEXT NOT NULL, 32 | `format` TEXT NOT NULL 33 | 34 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; 35 | "); 36 | 37 | $installer->endSetup(); 38 | 39 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.1-0.1.2.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.2 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile_attribute')} 28 | ADD `profile_id` int(10) unsigned NOT NULL AFTER `id`, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.2-0.1.3.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile_attribute')} 28 | CHANGE `attribute_id` `attribute_code` varchar(255) COLLATE 'utf8_general_ci' NOT NULL AFTER `profile_id`, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.3-0.1.4.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `conditions_serialized` mediumtext COLLATE 'utf8_general_ci' NOT NULL, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.4-0.1.5.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile_attribute')} 28 | ADD `position` int NOT NULL, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.5-0.1.6.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `dataformat` int NOT NULL, 29 | ADD `originalrow` int NOT NULL, 30 | ADD `export` int NOT NULL, 31 | ADD `delimiter` TEXT NOT NULL, 32 | ADD `enclose` TEXT NOT NULL, 33 | 34 | COMMENT=''; 35 | "); 36 | $installer->endSetup(); 37 | 38 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.6-0.1.7.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `filename` varchar(255), 29 | ADD `filepath` varchar(255); 30 | "); 31 | 32 | $installer->run(" 33 | ALTER TABLE {$this->getTable('mep_profile')} 34 | DROP `config` 35 | "); 36 | 37 | $installer->endSetup(); 38 | 39 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.7-0.1.8.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `category_delimiter` varchar(15) default '/' 29 | "); 30 | 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.8-0.1.9.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | CHANGE `enclose` enclose varchar(15); 29 | "); 30 | 31 | $installer->run(" 32 | ALTER TABLE {$this->getTable('mep_profile')} 33 | CHANGE `delimiter` delimiter varchar(15); 34 | "); 35 | 36 | $installer->endSetup(); 37 | 38 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.1.9-0.2.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.0 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `profile_locale` varchar(15) default NULL 29 | "); 30 | 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.0-0.2.1.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `twig_content_template` TEXT NOT NULL, 29 | ADD `twig_header_template` TEXT NOT NULL, 30 | ADD `twig_footer_template` TEXT NOT NULL, 31 | COMMENT=''; 32 | "); 33 | $installer->endSetup(); 34 | 35 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.1-0.2.2.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.1.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `use_twig_templates` int NOT NULL, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.2-0.2.3.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `store_id` int NOT NULL, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.4-0.2.5.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.5 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | $installer->run(" 26 | ALTER TABLE {$this->getTable('mep_shipping_attribute')} 27 | ADD `profile_id` int(10) unsigned NOT NULL AFTER `id`, 28 | COMMENT=''; 29 | "); 30 | $installer->endSetup(); 31 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.5-0.2.6.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.6 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE {$this->getTable('mep_profile')} 28 | ADD `shipping_id` int(10) unsigned NOT NULL AFTER `name`, 29 | COMMENT=''; 30 | "); 31 | $installer->endSetup(); 32 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.2.7-0.3.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | 28 | ALTER TABLE `{$this->getTable('mep/profile')}` ENGINE=`InnoDB`; 29 | ALTER TABLE `{$this->getTable('mep/mapping')}` ENGINE=`InnoDB`; 30 | ALTER TABLE `{$this->getTable('mep/shipping')}` ENGINE=`InnoDB`; 31 | ALTER TABLE `{$this->getTable('mep/shipping_attribute')}` ENGINE=`InnoDB`; 32 | 33 | ALTER TABLE `{$this->getTable('mep/mapping')}` ADD FOREIGN KEY (`profile_id`) REFERENCES `{$this->getTable('mep/profile')}` (`id`) ON UPDATE CASCADE ON DELETE CASCADE; 34 | ALTER TABLE `{$this->getTable('mep/shipping_attribute')}` ADD FOREIGN KEY (`profile_id`) REFERENCES `{$this->getTable('mep/shipping')}` (`id`) ON UPDATE CASCADE ON DELETE CASCADE; 35 | "); 36 | $installer->endSetup(); 37 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.3.0-0.4.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | 28 | ALTER TABLE `{$this->getTable('mep/attribute_mapping')}` ADD COLUMN `category_type` enum('single', 'complete') DEFAULT 'single' AFTER `name`; 29 | 30 | "); 31 | $installer->endSetup(); 32 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.4.0-0.5.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | 28 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `configurable_value_delimiter` varchar(15) DEFAULT '|' AFTER `category_delimiter`; 29 | 30 | "); 31 | $installer->endSetup(); 32 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.5.0-0.6.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | 28 | ALTER TABLE `{$this->getTable('mep/mapping')}` ADD COLUMN `inheritance` BOOLEAN DEFAULT FALSE; 29 | ALTER TABLE `{$this->getTable('mep/mapping')}` ADD COLUMN `inheritance_type` VARCHAR (100) DEFAULT ''; 30 | 31 | "); 32 | $installer->endSetup(); 33 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.6.0-0.7.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | 28 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `settings` text; 29 | 30 | "); 31 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.7.0-0.8.0.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `activate_ftp` text; 28 | "); 29 | $installer->run(" 30 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `ftp_host_port` text; 31 | "); 32 | $installer->run(" 33 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `ftp_user` text; 34 | "); 35 | $installer->run(" 36 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `ftp_password` text; 37 | "); 38 | 39 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.8.0-0.8.1.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `ftp_path` text; 28 | "); 29 | 30 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.8.1-0.8.2.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/mapping')}` ADD COLUMN `options` text; 28 | "); 29 | 30 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.8.2-0.8.3.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | CREATE TABLE IF NOT EXISTS `mep_cron` ( 28 | `cron_id` INT NOT NULL AUTO_INCREMENT, 29 | `profile_id` INT NOT NULL, 30 | `ignore_profile_status` TINYINT NULL, 31 | `status` VARCHAR(45) NOT NULL, 32 | `created_at` DATETIME NOT NULL, 33 | `scheduled_at` DATETIME NOT NULL, 34 | `finished_at` DATETIME NULL, 35 | `logs` TEXT NULL, 36 | PRIMARY KEY (`cron_id`)); 37 | "); 38 | 39 | $installer->run( 40 | "ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `cron_activated` int;" 41 | ); 42 | 43 | $installer->run( 44 | "ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `cron_expression` text;" 45 | ); 46 | 47 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.8.3-0.9.0.php: -------------------------------------------------------------------------------- 1 | startSetup(); 5 | 6 | $installer->run(" 7 | CREATE TABLE IF NOT EXISTS {$this->getTable('mep/google_mapping')} ( 8 | `mapping_id` int(10) NOT NULL AUTO_INCREMENT, 9 | `category_id` int(10) NOT NULL, 10 | `google_mapping_ids` TEXT NOT NULL, 11 | PRIMARY KEY (`mapping_id`), 12 | UNIQUE (`category_id`) 13 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 14 | "); 15 | $installer->endSetup(); 16 | 17 | ?> -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.0-0.9.1.php: -------------------------------------------------------------------------------- 1 | startSetup(); 5 | 6 | $installer->run(" 7 | CREATE TABLE IF NOT EXISTS {$this->getTable('mep/google_taxonomies')} ( 8 | `taxonomy_id` int(10) NOT NULL AUTO_INCREMENT, 9 | `parent_id` int(10) NOT NULL, 10 | `name` VARCHAR(255) NOT NULL, 11 | `slug` VARCHAR(255) NOT NULL, 12 | `locale` VARCHAR(10) NOT NULL, 13 | PRIMARY KEY (`taxonomy_id`), 14 | UNIQUE (`slug`) 15 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 16 | "); 17 | 18 | $installer->run( 19 | "ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `use_single_process` int DEFAULT 0;" 20 | ); 21 | 22 | $installer->endSetup(); 23 | 24 | ?> 25 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.1-0.9.2.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `product_count` int(10) unsigned NULL; 28 | "); 29 | 30 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.19-0.9.20.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | CREATE TABLE `mep_google_store_language` ( 28 | `store_id` int(11) NOT NULL, 29 | `language` char(8) NOT NULL, 30 | PRIMARY KEY (`store_id`) 31 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 32 | "); 33 | 34 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.2-0.9.7.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/profile')}` ADD COLUMN `media_gallery_delimiter` varchar(15) DEFAULT ';' AFTER `category_delimiter`; 28 | "); 29 | 30 | $installer->endSetup(); 31 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.7-0.9.19.1.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` ADD COLUMN `store_id` int; 28 | "); 29 | 30 | $installer->run(" 31 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` drop index category_id; 32 | "); 33 | 34 | $installer->run(" 35 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` add unique `category_store_unq_idx` (category_id, store_id); 36 | "); 37 | 38 | $installer->run(" 39 | CREATE TABLE `mep_google_store_language` ( 40 | `store_id` int(11) NOT NULL, 41 | `language` char(8) NOT NULL, 42 | PRIMARY KEY (`store_id`) 43 | );"); 44 | 45 | $installer->endSetup(); 46 | -------------------------------------------------------------------------------- /src/app/code/community/Flagbit/MEP/sql/mep_setup/mysql4-upgrade-0.9.7-0.9.19.php: -------------------------------------------------------------------------------- 1 | 18 | * @copyright 2012 Flagbit GmbH & Co. KG (http://www.flagbit.de). All rights served. 19 | * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) 20 | * @version 0.1.0 21 | * @since 0.2.3 22 | */ 23 | $installer = $this; 24 | $installer->startSetup(); 25 | 26 | $installer->run(" 27 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` ADD COLUMN `store_id` int; 28 | "); 29 | 30 | $installer->run(" 31 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` drop index category_id; 32 | "); 33 | 34 | $installer->run(" 35 | ALTER TABLE `{$this->getTable('mep/google_mapping')}` add unique `category_store_unq_idx` (category_id, store_id); 36 | "); 37 | 38 | $installer->endSetup(); -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/mep/attribute/mapping/categories.phtml: -------------------------------------------------------------------------------- 1 |
2 |
3 |

__('Translate Attribute Options') ?>

4 |
5 |
6 |
7 | 8 | 9 | getStores() as $_store): ?> 10 | 11 | 12 | 13 | getCategories() as $_category): ?> 14 | 15 | getStores() as $_store): ?> 16 | 17 | getId()]) ? $_category[$_store->getId()] : '';?> 18 | 25 | 26 | 27 | 28 |
getName() ?>
19 | getId()):?> 20 | 21 | 22 | 23 | 24 |
29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/mep/fieldset.phtml: -------------------------------------------------------------------------------- 1 | getElement() ?> 2 |
3 |
4 |

getLegend() ?>

5 |
6 |
serialize(array('class')) ?>> 7 | getComment()): ?> 8 |

escapeHtml($_element->getComment()) ?>

9 | 10 | getChildrenHtml() ?> 11 |
12 |
13 | -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/mep/google/categorieslist.phtml: -------------------------------------------------------------------------------- 1 | getCategoriesTreeHtml(); 3 | ?> -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/mep/mapping.phtml: -------------------------------------------------------------------------------- 1 |
2 | getGridHtml() ?> 3 |
4 | -------------------------------------------------------------------------------- /src/app/design/adminhtml/default/default/template/mep/menu.phtml: -------------------------------------------------------------------------------- 1 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /src/app/etc/modules/Flagbit_MEP.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | community 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/app/locale/de_DE/Flagbit_MEP.csv: -------------------------------------------------------------------------------- 1 | "Attribute Settings", "Attribut-Einstellungen" 2 | "Select Some Attributes", "Wählen Sie ein Attribut" 3 | "To Field", "Spaltentitel" 4 | "Inheritance", "Vererbung" 5 | "In Database", "Attribut auswählen" 6 | -------------------------------------------------------------------------------- /src/js/mep/google_categories_import.js: -------------------------------------------------------------------------------- 1 | function startGoogleCategoriesImport(url) 2 | { 3 | new Ajax.Request(url, { 4 | method: 'get', 5 | parameters: { 6 | evalJS: true 7 | }, 8 | onSuccess: function(transport) { 9 | window.location.reload(); 10 | }, 11 | onFailure: function(transport) { 12 | window.location.reload(); 13 | } 14 | }); 15 | } -------------------------------------------------------------------------------- /src/lib/Twig/Autoloader.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Autoloader 18 | { 19 | /** 20 | * Registers Twig_Autoloader as an SPL autoloader. 21 | * 22 | * @param Boolean $prepend Whether to prepend the autoloader or not. 23 | */ 24 | public static function register($prepend = false) 25 | { 26 | if (version_compare(phpversion(), '5.3.0', '>=')) { 27 | spl_autoload_register(array(new self, 'autoload'), true, $prepend); 28 | } else { 29 | spl_autoload_register(array(new self, 'autoload')); 30 | } 31 | } 32 | 33 | /** 34 | * Handles autoloading of classes. 35 | * 36 | * @param string $class A class name. 37 | */ 38 | public static function autoload($class) 39 | { 40 | if (0 !== strpos($class, 'Twig')) { 41 | return; 42 | } 43 | 44 | if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { 45 | require $file; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/lib/Twig/CompilerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_CompilerInterface 19 | { 20 | /** 21 | * Compiles a node. 22 | * 23 | * @param Twig_NodeInterface $node The node to compile 24 | * 25 | * @return Twig_CompilerInterface The current compiler instance 26 | */ 27 | public function compile(Twig_NodeInterface $node); 28 | 29 | /** 30 | * Gets the current PHP code after compilation. 31 | * 32 | * @return string The PHP code 33 | */ 34 | public function getSource(); 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/Twig/Error/Loader.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | class Twig_Error_Loader extends Twig_Error 26 | { 27 | public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) 28 | { 29 | parent::__construct($message, false, false, $previous); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/Twig/Error/Runtime.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Runtime extends Twig_Error 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /src/lib/Twig/Error/Syntax.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Syntax extends Twig_Error 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /src/lib/Twig/ExistsLoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_ExistsLoaderInterface 19 | { 20 | /** 21 | * Check if we have the source code of a template, given its name. 22 | * 23 | * @param string $name The name of the template to check if we can load 24 | * 25 | * @return boolean If the template source code is handled by this loader or not 26 | */ 27 | public function exists($name); 28 | } 29 | -------------------------------------------------------------------------------- /src/lib/Twig/Extension/Optimizer.php: -------------------------------------------------------------------------------- 1 | optimizers = $optimizers; 18 | } 19 | 20 | /** 21 | * {@inheritdoc} 22 | */ 23 | public function getNodeVisitors() 24 | { 25 | return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); 26 | } 27 | 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getName() 32 | { 33 | return 'optimizer'; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/Twig/Extension/StringLoader.php: -------------------------------------------------------------------------------- 1 | true)), 20 | ); 21 | } 22 | 23 | /** 24 | * {@inheritdoc} 25 | */ 26 | public function getName() 27 | { 28 | return 'string_loader'; 29 | } 30 | } 31 | 32 | /** 33 | * Loads a template from a string. 34 | * 35 | *
36 |  * {{ include(template_from_string("Hello {{ name }}")) }}
37 |  * 
38 | * 39 | * @param Twig_Environment $env A Twig_Environment instance 40 | * @param string $template A template as a string 41 | * 42 | * @return Twig_Template A Twig_Template instance 43 | */ 44 | function twig_template_from_string(Twig_Environment $env, $template) 45 | { 46 | $name = sprintf('__string_template__%s', hash('sha256', uniqid(mt_rand(), true), false)); 47 | 48 | $loader = new Twig_Loader_Chain(array( 49 | new Twig_Loader_Array(array($name => $template)), 50 | $current = $env->getLoader(), 51 | )); 52 | 53 | $env->setLoader($loader); 54 | try { 55 | $template = $env->loadTemplate($name); 56 | } catch (Exception $e) { 57 | $env->setLoader($current); 58 | 59 | throw $e; 60 | } 61 | $env->setLoader($current); 62 | 63 | return $template; 64 | } 65 | -------------------------------------------------------------------------------- /src/lib/Twig/Filter/Function.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Function extends Twig_Filter 21 | { 22 | protected $function; 23 | 24 | public function __construct($function, array $options = array()) 25 | { 26 | $options['callable'] = $function; 27 | 28 | parent::__construct($options); 29 | 30 | $this->function = $function; 31 | } 32 | 33 | public function compile() 34 | { 35 | return $this->function; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/Twig/Filter/Method.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Method extends Twig_Filter 21 | { 22 | protected $extension; 23 | protected $method; 24 | 25 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 26 | { 27 | $options['callable'] = array($extension, $method); 28 | 29 | parent::__construct($options); 30 | 31 | $this->extension = $extension; 32 | $this->method = $method; 33 | } 34 | 35 | public function compile() 36 | { 37 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/Filter/Node.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Filter_Node extends Twig_Filter 21 | { 22 | protected $class; 23 | 24 | public function __construct($class, array $options = array()) 25 | { 26 | parent::__construct($options); 27 | 28 | $this->class = $class; 29 | } 30 | 31 | public function getClass() 32 | { 33 | return $this->class; 34 | } 35 | 36 | public function compile() 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/FilterCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FilterCallableInterface 21 | { 22 | public function getCallable(); 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/Twig/FilterInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FilterInterface 21 | { 22 | /** 23 | * Compiles a filter. 24 | * 25 | * @return string The PHP code for the filter 26 | */ 27 | public function compile(); 28 | 29 | public function needsEnvironment(); 30 | 31 | public function needsContext(); 32 | 33 | public function getSafe(Twig_Node $filterArgs); 34 | 35 | public function getPreservesSafety(); 36 | 37 | public function getPreEscape(); 38 | 39 | public function setArguments($arguments); 40 | 41 | public function getArguments(); 42 | } 43 | -------------------------------------------------------------------------------- /src/lib/Twig/Function/Function.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Function_Function extends Twig_Function 22 | { 23 | protected $function; 24 | 25 | public function __construct($function, array $options = array()) 26 | { 27 | $options['callable'] = $function; 28 | 29 | parent::__construct($options); 30 | 31 | $this->function = $function; 32 | } 33 | 34 | public function compile() 35 | { 36 | return $this->function; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/lib/Twig/Function/Method.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Function_Method extends Twig_Function 22 | { 23 | protected $extension; 24 | protected $method; 25 | 26 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 27 | { 28 | $options['callable'] = array($extension, $method); 29 | 30 | parent::__construct($options); 31 | 32 | $this->extension = $extension; 33 | $this->method = $method; 34 | } 35 | 36 | public function compile() 37 | { 38 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/lib/Twig/Function/Node.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | class Twig_Function_Node extends Twig_Function 21 | { 22 | protected $class; 23 | 24 | public function __construct($class, array $options = array()) 25 | { 26 | parent::__construct($options); 27 | 28 | $this->class = $class; 29 | } 30 | 31 | public function getClass() 32 | { 33 | return $this->class; 34 | } 35 | 36 | public function compile() 37 | { 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/FunctionCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * @deprecated since 1.12 (to be removed in 2.0) 19 | */ 20 | interface Twig_FunctionCallableInterface 21 | { 22 | public function getCallable(); 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/Twig/FunctionInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_FunctionInterface 22 | { 23 | /** 24 | * Compiles a function. 25 | * 26 | * @return string The PHP code for the function 27 | */ 28 | public function compile(); 29 | 30 | public function needsEnvironment(); 31 | 32 | public function needsContext(); 33 | 34 | public function getSafe(Twig_Node $filterArgs); 35 | 36 | public function setArguments($arguments); 37 | 38 | public function getArguments(); 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/LexerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_LexerInterface 19 | { 20 | /** 21 | * Tokenizes a source code. 22 | * 23 | * @param string $code The source code 24 | * @param string $filename A unique identifier for the source code 25 | * 26 | * @return Twig_TokenStream A token stream instance 27 | * 28 | * @throws Twig_Error_Syntax When the code is syntactically wrong 29 | */ 30 | public function tokenize($code, $filename = null); 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/Twig/Loader/String.php: -------------------------------------------------------------------------------- 1 | 25 | */ 26 | class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface 27 | { 28 | /** 29 | * {@inheritdoc} 30 | */ 31 | public function getSource($name) 32 | { 33 | return $name; 34 | } 35 | 36 | /** 37 | * {@inheritdoc} 38 | */ 39 | public function exists($name) 40 | { 41 | return true; 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function getCacheKey($name) 48 | { 49 | return $name; 50 | } 51 | 52 | /** 53 | * {@inheritdoc} 54 | */ 55 | public function isFresh($name, $time) 56 | { 57 | return true; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/lib/Twig/LoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_LoaderInterface 18 | { 19 | /** 20 | * Gets the source code of a template, given its name. 21 | * 22 | * @param string $name The name of the template to load 23 | * 24 | * @return string The template source code 25 | * 26 | * @throws Twig_Error_Loader When $name is not found 27 | */ 28 | public function getSource($name); 29 | 30 | /** 31 | * Gets the cache key to use for the cache for a given template name. 32 | * 33 | * @param string $name The name of the template to load 34 | * 35 | * @return string The cache key 36 | * 37 | * @throws Twig_Error_Loader When $name is not found 38 | */ 39 | public function getCacheKey($name); 40 | 41 | /** 42 | * Returns true if the template is still fresh. 43 | * 44 | * @param string $name The template name 45 | * @param timestamp $time The last modification time of the cached template 46 | * 47 | * @return Boolean true if the template is fresh, false otherwise 48 | * 49 | * @throws Twig_Error_Loader When $name is not found 50 | */ 51 | public function isFresh($name, $time); 52 | } 53 | -------------------------------------------------------------------------------- /src/lib/Twig/Markup.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Markup implements Countable 18 | { 19 | protected $content; 20 | protected $charset; 21 | 22 | public function __construct($content, $charset) 23 | { 24 | $this->content = (string) $content; 25 | $this->charset = $charset; 26 | } 27 | 28 | public function __toString() 29 | { 30 | return $this->content; 31 | } 32 | 33 | public function count() 34 | { 35 | return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/AutoEscape.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Twig_Node_AutoEscape extends Twig_Node 24 | { 25 | public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape') 26 | { 27 | parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); 28 | } 29 | 30 | /** 31 | * Compiles the node to PHP. 32 | * 33 | * @param Twig_Compiler A Twig_Compiler instance 34 | */ 35 | public function compile(Twig_Compiler $compiler) 36 | { 37 | $compiler->subcompile($this->getNode('body')); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Block.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Block extends Twig_Node 19 | { 20 | public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") 35 | ->indent() 36 | ; 37 | 38 | $compiler 39 | ->subcompile($this->getNode('body')) 40 | ->outdent() 41 | ->write("}\n\n") 42 | ; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/BlockReference.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct($name, $lineno, $tag = null) 21 | { 22 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) 35 | ; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Body.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Body extends Twig_Node 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Do.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Do extends Twig_Node 18 | { 19 | public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('expr' => $expr), array(), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler 32 | ->addDebugInfo($this) 33 | ->write('') 34 | ->subcompile($this->getNode('expr')) 35 | ->raw(";\n") 36 | ; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Embed.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Embed extends Twig_Node_Include 18 | { 19 | // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) 20 | public function __construct($filename, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) 21 | { 22 | parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); 23 | 24 | $this->setAttribute('filename', $filename); 25 | $this->setAttribute('index', $index); 26 | } 27 | 28 | protected function addGetTemplate(Twig_Compiler $compiler) 29 | { 30 | $compiler 31 | ->write("\$this->env->loadTemplate(") 32 | ->string($this->getAttribute('filename')) 33 | ->raw(', ') 34 | ->string($this->getAttribute('index')) 35 | ->raw(")") 36 | ; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | abstract class Twig_Node_Expression extends Twig_Node 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/AssignName.php: -------------------------------------------------------------------------------- 1 | raw('$context[') 24 | ->string($this->getAttribute('name')) 25 | ->raw(']') 26 | ; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary.php: -------------------------------------------------------------------------------- 1 | $left, 'right' => $right), array(), $lineno); 17 | } 18 | 19 | /** 20 | * Compiles the node to PHP. 21 | * 22 | * @param Twig_Compiler A Twig_Compiler instance 23 | */ 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->raw('(') 28 | ->subcompile($this->getNode('left')) 29 | ->raw(' ') 30 | ; 31 | $this->operator($compiler); 32 | $compiler 33 | ->raw(' ') 34 | ->subcompile($this->getNode('right')) 35 | ->raw(')') 36 | ; 37 | } 38 | 39 | abstract public function operator(Twig_Compiler $compiler); 40 | } 41 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Add.php: -------------------------------------------------------------------------------- 1 | raw('+'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/And.php: -------------------------------------------------------------------------------- 1 | raw('&&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/BitwiseAnd.php: -------------------------------------------------------------------------------- 1 | raw('&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/BitwiseOr.php: -------------------------------------------------------------------------------- 1 | raw('|'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/BitwiseXor.php: -------------------------------------------------------------------------------- 1 | raw('^'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Concat.php: -------------------------------------------------------------------------------- 1 | raw('.'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Div.php: -------------------------------------------------------------------------------- 1 | raw('/'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/EndsWith.php: -------------------------------------------------------------------------------- 1 | raw('(0 === substr_compare(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw(', -strlen(') 21 | ->subcompile($this->getNode('right')) 22 | ->raw(')))') 23 | ; 24 | } 25 | 26 | public function operator(Twig_Compiler $compiler) 27 | { 28 | return $compiler->raw(''); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Equal.php: -------------------------------------------------------------------------------- 1 | raw('=='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/FloorDiv.php: -------------------------------------------------------------------------------- 1 | raw('intval(floor('); 21 | parent::compile($compiler); 22 | $compiler->raw('))'); 23 | } 24 | 25 | public function operator(Twig_Compiler $compiler) 26 | { 27 | return $compiler->raw('/'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Greater.php: -------------------------------------------------------------------------------- 1 | raw('>'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/GreaterEqual.php: -------------------------------------------------------------------------------- 1 | raw('>='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/In.php: -------------------------------------------------------------------------------- 1 | raw('twig_in_filter(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('in'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Less.php: -------------------------------------------------------------------------------- 1 | raw('<'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/LessEqual.php: -------------------------------------------------------------------------------- 1 | raw('<='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Matches.php: -------------------------------------------------------------------------------- 1 | raw('preg_match(') 17 | ->subcompile($this->getNode('right')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('left')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw(''); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Mod.php: -------------------------------------------------------------------------------- 1 | raw('%'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Mul.php: -------------------------------------------------------------------------------- 1 | raw('*'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/NotEqual.php: -------------------------------------------------------------------------------- 1 | raw('!='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/NotIn.php: -------------------------------------------------------------------------------- 1 | raw('!twig_in_filter(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('not in'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Or.php: -------------------------------------------------------------------------------- 1 | raw('||'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Power.php: -------------------------------------------------------------------------------- 1 | raw('pow(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('**'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Range.php: -------------------------------------------------------------------------------- 1 | raw('range(') 22 | ->subcompile($this->getNode('left')) 23 | ->raw(', ') 24 | ->subcompile($this->getNode('right')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | public function operator(Twig_Compiler $compiler) 30 | { 31 | return $compiler->raw('..'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/StartsWith.php: -------------------------------------------------------------------------------- 1 | raw('(0 === strpos(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw('))') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw(''); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Binary/Sub.php: -------------------------------------------------------------------------------- 1 | raw('-'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/BlockReference.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Expression_BlockReference extends Twig_Node_Expression 19 | { 20 | public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | if ($this->getAttribute('as_string')) { 33 | $compiler->raw('(string) '); 34 | } 35 | 36 | if ($this->getAttribute('output')) { 37 | $compiler 38 | ->addDebugInfo($this) 39 | ->write("\$this->displayBlock(") 40 | ->subcompile($this->getNode('name')) 41 | ->raw(", \$context, \$blocks);\n") 42 | ; 43 | } else { 44 | $compiler 45 | ->raw("\$this->renderBlock(") 46 | ->subcompile($this->getNode('name')) 47 | ->raw(", \$context, \$blocks)") 48 | ; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Conditional.php: -------------------------------------------------------------------------------- 1 | $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('((') 23 | ->subcompile($this->getNode('expr1')) 24 | ->raw(') ? (') 25 | ->subcompile($this->getNode('expr2')) 26 | ->raw(') : (') 27 | ->subcompile($this->getNode('expr3')) 28 | ->raw('))') 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Constant.php: -------------------------------------------------------------------------------- 1 | $value), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler->repr($this->getAttribute('value')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/ExtensionReference.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression 18 | { 19 | public function __construct($name, $lineno, $tag = null) 20 | { 21 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Filter.php: -------------------------------------------------------------------------------- 1 | $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $name = $this->getNode('filter')->getAttribute('value'); 22 | $filter = $compiler->getEnvironment()->getFilter($name); 23 | 24 | $this->setAttribute('name', $name); 25 | $this->setAttribute('type', 'filter'); 26 | $this->setAttribute('thing', $filter); 27 | $this->setAttribute('needs_environment', $filter->needsEnvironment()); 28 | $this->setAttribute('needs_context', $filter->needsContext()); 29 | $this->setAttribute('arguments', $filter->getArguments()); 30 | if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { 31 | $this->setAttribute('callable', $filter->getCallable()); 32 | } 33 | 34 | $this->compileCallable($compiler); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Filter/Default.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var.foo|default('foo item on var is not defined') }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter 22 | { 23 | public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) 24 | { 25 | $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine()); 26 | 27 | if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { 28 | $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine()); 29 | $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine()); 30 | 31 | $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine()); 32 | } else { 33 | $node = $default; 34 | } 35 | 36 | parent::__construct($node, $filterName, $arguments, $lineno, $tag); 37 | } 38 | 39 | public function compile(Twig_Compiler $compiler) 40 | { 41 | $compiler->subcompile($this->getNode('node')); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Function.php: -------------------------------------------------------------------------------- 1 | $arguments), array('name' => $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $name = $this->getAttribute('name'); 21 | $function = $compiler->getEnvironment()->getFunction($name); 22 | 23 | $this->setAttribute('name', $name); 24 | $this->setAttribute('type', 'function'); 25 | $this->setAttribute('thing', $function); 26 | $this->setAttribute('needs_environment', $function->needsEnvironment()); 27 | $this->setAttribute('needs_context', $function->needsContext()); 28 | $this->setAttribute('arguments', $function->getArguments()); 29 | if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) { 30 | $this->setAttribute('callable', $function->getCallable()); 31 | } 32 | 33 | $this->compileCallable($compiler); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/MethodCall.php: -------------------------------------------------------------------------------- 1 | $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); 16 | 17 | if ($node instanceof Twig_Node_Expression_Name) { 18 | $node->setAttribute('always_defined', true); 19 | } 20 | } 21 | 22 | public function compile(Twig_Compiler $compiler) 23 | { 24 | $compiler 25 | ->subcompile($this->getNode('node')) 26 | ->raw('->') 27 | ->raw($this->getAttribute('method')) 28 | ->raw('(') 29 | ; 30 | $first = true; 31 | foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { 32 | if (!$first) { 33 | $compiler->raw(', '); 34 | } 35 | $first = false; 36 | 37 | $compiler->subcompile($pair['value']); 38 | } 39 | $compiler->raw(')'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Parent.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Expression_Parent extends Twig_Node_Expression 19 | { 20 | public function __construct($name, $lineno, $tag = null) 21 | { 22 | parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | if ($this->getAttribute('output')) { 33 | $compiler 34 | ->addDebugInfo($this) 35 | ->write("\$this->displayParentBlock(") 36 | ->string($this->getAttribute('name')) 37 | ->raw(", \$context, \$blocks);\n") 38 | ; 39 | } else { 40 | $compiler 41 | ->raw("\$this->renderParentBlock(") 42 | ->string($this->getAttribute('name')) 43 | ->raw(", \$context, \$blocks)") 44 | ; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/TempName.php: -------------------------------------------------------------------------------- 1 | $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $compiler 21 | ->raw('$_') 22 | ->raw($this->getAttribute('name')) 23 | ->raw('_') 24 | ; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test.php: -------------------------------------------------------------------------------- 1 | $node, 'arguments' => $arguments), array('name' => $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $name = $this->getAttribute('name'); 21 | $test = $compiler->getEnvironment()->getTest($name); 22 | 23 | $this->setAttribute('name', $name); 24 | $this->setAttribute('type', 'test'); 25 | $this->setAttribute('thing', $test); 26 | if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) { 27 | $this->setAttribute('callable', $test->getCallable()); 28 | } 29 | 30 | $this->compileCallable($compiler); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Constant.php: -------------------------------------------------------------------------------- 1 | 16 | * {% if post.status is constant('Post::PUBLISHED') %} 17 | * the status attribute is exactly the same as Post::PUBLISHED 18 | * {% endif %} 19 | * 20 | * 21 | * @author Fabien Potencier 22 | */ 23 | class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test 24 | { 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->raw('(') 29 | ->subcompile($this->getNode('node')) 30 | ->raw(' === constant(') 31 | ; 32 | 33 | if ($this->getNode('arguments')->hasNode(1)) { 34 | $compiler 35 | ->raw('get_class(') 36 | ->subcompile($this->getNode('arguments')->getNode(1)) 37 | ->raw(')."::".') 38 | ; 39 | } 40 | 41 | $compiler 42 | ->subcompile($this->getNode('arguments')->getNode(0)) 43 | ->raw('))') 44 | ; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Divisibleby.php: -------------------------------------------------------------------------------- 1 | 16 | * {% if loop.index is divisibleby(3) %} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(0 == ') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % ') 29 | ->subcompile($this->getNode('arguments')->getNode(0)) 30 | ->raw(')') 31 | ; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Even.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is even }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % 2 == 0') 29 | ->raw(')') 30 | ; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Null.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is none }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(null === ') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(')') 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Odd.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is odd }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % 2 == 1') 29 | ->raw(')') 30 | ; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Test/Sameas.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test 18 | { 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('(') 23 | ->subcompile($this->getNode('node')) 24 | ->raw(' === ') 25 | ->subcompile($this->getNode('arguments')->getNode(0)) 26 | ->raw(')') 27 | ; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Unary.php: -------------------------------------------------------------------------------- 1 | $node), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler->raw('('); 22 | $this->operator($compiler); 23 | $compiler 24 | ->subcompile($this->getNode('node')) 25 | ->raw(')') 26 | ; 27 | } 28 | 29 | abstract public function operator(Twig_Compiler $compiler); 30 | } 31 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Unary/Neg.php: -------------------------------------------------------------------------------- 1 | raw('-'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Unary/Not.php: -------------------------------------------------------------------------------- 1 | raw('!'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Expression/Unary/Pos.php: -------------------------------------------------------------------------------- 1 | raw('+'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Flush.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Flush extends Twig_Node 18 | { 19 | public function __construct($lineno, $tag) 20 | { 21 | parent::__construct(array(), array(), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler 32 | ->addDebugInfo($this) 33 | ->write("flush();\n") 34 | ; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Import.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Import extends Twig_Node 18 | { 19 | public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler 32 | ->addDebugInfo($this) 33 | ->write('') 34 | ->subcompile($this->getNode('var')) 35 | ->raw(' = ') 36 | ; 37 | 38 | if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { 39 | $compiler->raw("\$this"); 40 | } else { 41 | $compiler 42 | ->raw('$this->env->loadTemplate(') 43 | ->subcompile($this->getNode('expr')) 44 | ->raw(")") 45 | ; 46 | } 47 | 48 | $compiler->raw(";\n"); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Print.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('expr' => $expr), array(), $lineno, $tag); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write('echo ') 35 | ->subcompile($this->getNode('expr')) 36 | ->raw(";\n") 37 | ; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Sandbox.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Sandbox extends Twig_Node 18 | { 19 | public function __construct(Twig_NodeInterface $body, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('body' => $body), array(), $lineno, $tag); 22 | } 23 | 24 | /** 25 | * Compiles the node to PHP. 26 | * 27 | * @param Twig_Compiler A Twig_Compiler instance 28 | */ 29 | public function compile(Twig_Compiler $compiler) 30 | { 31 | $compiler 32 | ->addDebugInfo($this) 33 | ->write("\$sandbox = \$this->env->getExtension('sandbox');\n") 34 | ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") 35 | ->indent() 36 | ->write("\$sandbox->enableSandbox();\n") 37 | ->outdent() 38 | ->write("}\n") 39 | ->subcompile($this->getNode('body')) 40 | ->write("if (!\$alreadySandboxed) {\n") 41 | ->indent() 42 | ->write("\$sandbox->disableSandbox();\n") 43 | ->outdent() 44 | ->write("}\n") 45 | ; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/SetTemp.php: -------------------------------------------------------------------------------- 1 | $name), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $name = $this->getAttribute('name'); 22 | $compiler 23 | ->addDebugInfo($this) 24 | ->write('if (isset($context[') 25 | ->string($name) 26 | ->raw('])) { $_') 27 | ->raw($name) 28 | ->raw('_ = $context[') 29 | ->repr($name) 30 | ->raw(']; } else { $_') 31 | ->raw($name) 32 | ->raw("_ = null; }\n") 33 | ; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Spaceless.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class Twig_Node_Spaceless extends Twig_Node 20 | { 21 | public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless') 22 | { 23 | parent::__construct(array('body' => $body), array(), $lineno, $tag); 24 | } 25 | 26 | /** 27 | * Compiles the node to PHP. 28 | * 29 | * @param Twig_Compiler A Twig_Compiler instance 30 | */ 31 | public function compile(Twig_Compiler $compiler) 32 | { 33 | $compiler 34 | ->addDebugInfo($this) 35 | ->write("ob_start();\n") 36 | ->subcompile($this->getNode('body')) 37 | ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") 38 | ; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/lib/Twig/Node/Text.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct($data, $lineno) 21 | { 22 | parent::__construct(array(), array('data' => $data), $lineno); 23 | } 24 | 25 | /** 26 | * Compiles the node to PHP. 27 | * 28 | * @param Twig_Compiler A Twig_Compiler instance 29 | */ 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler 33 | ->addDebugInfo($this) 34 | ->write('echo ') 35 | ->string($this->getAttribute('data')) 36 | ->raw(";\n") 37 | ; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/lib/Twig/NodeInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_NodeInterface extends Countable, IteratorAggregate 19 | { 20 | /** 21 | * Compiles the node to PHP. 22 | * 23 | * @param Twig_Compiler A Twig_Compiler instance 24 | */ 25 | public function compile(Twig_Compiler $compiler); 26 | 27 | public function getLine(); 28 | 29 | public function getNodeTag(); 30 | } 31 | -------------------------------------------------------------------------------- /src/lib/Twig/NodeOutputInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_NodeOutputInterface 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/Twig/NodeVisitorInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_NodeVisitorInterface 18 | { 19 | /** 20 | * Called before child nodes are visited. 21 | * 22 | * @param Twig_NodeInterface $node The node to visit 23 | * @param Twig_Environment $env The Twig environment instance 24 | * 25 | * @return Twig_NodeInterface The modified node 26 | */ 27 | public function enterNode(Twig_NodeInterface $node, Twig_Environment $env); 28 | 29 | /** 30 | * Called after child nodes are visited. 31 | * 32 | * @param Twig_NodeInterface $node The node to visit 33 | * @param Twig_Environment $env The Twig environment instance 34 | * 35 | * @return Twig_NodeInterface|false The modified node or false if the node must be removed 36 | */ 37 | public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env); 38 | 39 | /** 40 | * Returns the priority for this visitor. 41 | * 42 | * Priority should be between -10 and 10 (0 is the default). 43 | * 44 | * @return integer The priority level 45 | */ 46 | public function getPriority(); 47 | } 48 | -------------------------------------------------------------------------------- /src/lib/Twig/ParserInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_ParserInterface 19 | { 20 | /** 21 | * Converts a token stream to a node tree. 22 | * 23 | * @param Twig_TokenStream $stream A token stream instance 24 | * 25 | * @return Twig_Node_Module A node tree 26 | * 27 | * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong 28 | */ 29 | public function parse(Twig_TokenStream $stream); 30 | } 31 | -------------------------------------------------------------------------------- /src/lib/Twig/Sandbox/SecurityError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityError extends Twig_Error 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/Twig/Sandbox/SecurityPolicyInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_Sandbox_SecurityPolicyInterface 18 | { 19 | public function checkSecurity($tags, $filters, $functions); 20 | 21 | public function checkMethodAllowed($obj, $method); 22 | 23 | public function checkPropertyAllowed($obj, $method); 24 | } 25 | -------------------------------------------------------------------------------- /src/lib/Twig/SimpleTest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_SimpleTest 18 | { 19 | protected $name; 20 | protected $callable; 21 | protected $options; 22 | 23 | public function __construct($name, $callable, array $options = array()) 24 | { 25 | $this->name = $name; 26 | $this->callable = $callable; 27 | $this->options = array_merge(array( 28 | 'node_class' => 'Twig_Node_Expression_Test', 29 | ), $options); 30 | } 31 | 32 | public function getName() 33 | { 34 | return $this->name; 35 | } 36 | 37 | public function getCallable() 38 | { 39 | return $this->callable; 40 | } 41 | 42 | public function getNodeClass() 43 | { 44 | return $this->options['node_class']; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/lib/Twig/TemplateInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_TemplateInterface 19 | { 20 | const ANY_CALL = 'any'; 21 | const ARRAY_CALL = 'array'; 22 | const METHOD_CALL = 'method'; 23 | 24 | /** 25 | * Renders the template with the given context and returns it as string. 26 | * 27 | * @param array $context An array of parameters to pass to the template 28 | * 29 | * @return string The rendered template 30 | */ 31 | public function render(array $context); 32 | 33 | /** 34 | * Displays the template with the given context. 35 | * 36 | * @param array $context An array of parameters to pass to the template 37 | * @param array $blocks An array of blocks to pass to the template 38 | */ 39 | public function display(array $context, array $blocks = array()); 40 | 41 | /** 42 | * Returns the bound environment for this template. 43 | * 44 | * @return Twig_Environment The current environment 45 | */ 46 | public function getEnvironment(); 47 | } 48 | -------------------------------------------------------------------------------- /src/lib/Twig/Test.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface 19 | { 20 | protected $options; 21 | protected $arguments = array(); 22 | 23 | public function __construct(array $options = array()) 24 | { 25 | $this->options = array_merge(array( 26 | 'callable' => null, 27 | ), $options); 28 | } 29 | 30 | public function getCallable() 31 | { 32 | return $this->options['callable']; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/lib/Twig/Test/Function.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Function extends Twig_Test 19 | { 20 | protected $function; 21 | 22 | public function __construct($function, array $options = array()) 23 | { 24 | $options['callable'] = $function; 25 | 26 | parent::__construct($options); 27 | 28 | $this->function = $function; 29 | } 30 | 31 | public function compile() 32 | { 33 | return $this->function; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/lib/Twig/Test/Method.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Method extends Twig_Test 19 | { 20 | protected $extension; 21 | protected $method; 22 | 23 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 24 | { 25 | $options['callable'] = array($extension, $method); 26 | 27 | parent::__construct($options); 28 | 29 | $this->extension = $extension; 30 | $this->method = $method; 31 | } 32 | 33 | public function compile() 34 | { 35 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/Twig/Test/Node.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | class Twig_Test_Node extends Twig_Test 19 | { 20 | protected $class; 21 | 22 | public function __construct($class, array $options = array()) 23 | { 24 | parent::__construct($options); 25 | 26 | $this->class = $class; 27 | } 28 | 29 | public function getClass() 30 | { 31 | return $this->class; 32 | } 33 | 34 | public function compile() 35 | { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/Twig/TestCallableInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_TestCallableInterface 19 | { 20 | public function getCallable(); 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/Twig/TestInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * @deprecated since 1.12 (to be removed in 2.0) 17 | */ 18 | interface Twig_TestInterface 19 | { 20 | /** 21 | * Compiles a test. 22 | * 23 | * @return string The PHP code for the test 24 | */ 25 | public function compile(); 26 | } 27 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | abstract class Twig_TokenParser implements Twig_TokenParserInterface 18 | { 19 | /** 20 | * @var Twig_Parser 21 | */ 22 | protected $parser; 23 | 24 | /** 25 | * Sets the parser associated with this token parser 26 | * 27 | * @param $parser A Twig_Parser instance 28 | */ 29 | public function setParser(Twig_Parser $parser) 30 | { 31 | $this->parser = $parser; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser/Do.php: -------------------------------------------------------------------------------- 1 | parser->getExpressionParser()->parseExpression(); 27 | 28 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 29 | 30 | return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); 31 | } 32 | 33 | /** 34 | * Gets the tag name associated with this token parser. 35 | * 36 | * @return string The tag name 37 | */ 38 | public function getTag() 39 | { 40 | return 'do'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser/Extends.php: -------------------------------------------------------------------------------- 1 | 17 | * {% extends "base.html" %} 18 | * 19 | */ 20 | class Twig_TokenParser_Extends extends Twig_TokenParser 21 | { 22 | /** 23 | * Parses a token and returns a node. 24 | * 25 | * @param Twig_Token $token A Twig_Token instance 26 | * 27 | * @return Twig_NodeInterface A Twig_NodeInterface instance 28 | */ 29 | public function parse(Twig_Token $token) 30 | { 31 | if (!$this->parser->isMainScope()) { 32 | throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine(), $this->parser->getFilename()); 33 | } 34 | 35 | if (null !== $this->parser->getParent()) { 36 | throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine(), $this->parser->getFilename()); 37 | } 38 | $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); 39 | 40 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 41 | } 42 | 43 | /** 44 | * Gets the tag name associated with this token parser. 45 | * 46 | * @return string The tag name 47 | */ 48 | public function getTag() 49 | { 50 | return 'extends'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser/Flush.php: -------------------------------------------------------------------------------- 1 | parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 29 | 30 | return new Twig_Node_Flush($token->getLine(), $this->getTag()); 31 | } 32 | 33 | /** 34 | * Gets the tag name associated with this token parser. 35 | * 36 | * @return string The tag name 37 | */ 38 | public function getTag() 39 | { 40 | return 'flush'; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser/Import.php: -------------------------------------------------------------------------------- 1 | 16 | * {% import 'forms.html' as forms %} 17 | * 18 | */ 19 | class Twig_TokenParser_Import extends Twig_TokenParser 20 | { 21 | /** 22 | * Parses a token and returns a node. 23 | * 24 | * @param Twig_Token $token A Twig_Token instance 25 | * 26 | * @return Twig_NodeInterface A Twig_NodeInterface instance 27 | */ 28 | public function parse(Twig_Token $token) 29 | { 30 | $macro = $this->parser->getExpressionParser()->parseExpression(); 31 | $this->parser->getStream()->expect('as'); 32 | $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); 33 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 34 | 35 | $this->parser->addImportedSymbol('template', $var->getAttribute('name')); 36 | 37 | return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); 38 | } 39 | 40 | /** 41 | * Gets the tag name associated with this token parser. 42 | * 43 | * @return string The tag name 44 | */ 45 | public function getTag() 46 | { 47 | return 'import'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParser/Spaceless.php: -------------------------------------------------------------------------------- 1 | 16 | * {% spaceless %} 17 | *
18 | * foo 19 | *
20 | * {% endspaceless %} 21 | * 22 | * {# output will be
foo
#} 23 | * 24 | */ 25 | class Twig_TokenParser_Spaceless extends Twig_TokenParser 26 | { 27 | /** 28 | * Parses a token and returns a node. 29 | * 30 | * @param Twig_Token $token A Twig_Token instance 31 | * 32 | * @return Twig_NodeInterface A Twig_NodeInterface instance 33 | */ 34 | public function parse(Twig_Token $token) 35 | { 36 | $lineno = $token->getLine(); 37 | 38 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 39 | $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); 40 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 41 | 42 | return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); 43 | } 44 | 45 | public function decideSpacelessEnd(Twig_Token $token) 46 | { 47 | return $token->test('endspaceless'); 48 | } 49 | 50 | /** 51 | * Gets the tag name associated with this token parser. 52 | * 53 | * @return string The tag name 54 | */ 55 | public function getTag() 56 | { 57 | return 'spaceless'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParserBrokerInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_TokenParserBrokerInterface 22 | { 23 | /** 24 | * Gets a TokenParser suitable for a tag. 25 | * 26 | * @param string $tag A tag name 27 | * 28 | * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found 29 | */ 30 | public function getTokenParser($tag); 31 | 32 | /** 33 | * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of. 34 | * 35 | * @param Twig_ParserInterface $parser A Twig_ParserInterface interface 36 | */ 37 | public function setParser(Twig_ParserInterface $parser); 38 | 39 | /** 40 | * Gets the Twig_ParserInterface. 41 | * 42 | * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null 43 | */ 44 | public function getParser(); 45 | } 46 | -------------------------------------------------------------------------------- /src/lib/Twig/TokenParserInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_TokenParserInterface 18 | { 19 | /** 20 | * Sets the parser associated with this token parser 21 | * 22 | * @param $parser A Twig_Parser instance 23 | */ 24 | public function setParser(Twig_Parser $parser); 25 | 26 | /** 27 | * Parses a token and returns a node. 28 | * 29 | * @param Twig_Token $token A Twig_Token instance 30 | * 31 | * @return Twig_NodeInterface A Twig_NodeInterface instance 32 | * 33 | * @throws Twig_Error_Syntax 34 | */ 35 | public function parse(Twig_Token $token); 36 | 37 | /** 38 | * Gets the tag name associated with this token parser. 39 | * 40 | * @return string The tag name 41 | */ 42 | public function getTag(); 43 | } 44 | -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/chosen/chosen-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/chosen/chosen-sprite.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/highlighttextarea/jquery.highlighttextarea.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery highlightTextarea 3.1.0 3 | * Copyright 2014 Damien "Mistic" Sorel (http://www.strangeplanet.fr) 4 | * Licensed under MIT (http://opensource.org/licenses/MIT) 5 | */ 6 | .highlightTextarea{position:relative;overflow:hidden}.highlightTextarea .container{position:absolute;margin:0;overflow:hidden}.highlightTextarea .highlighter{position:relative;border:none;padding:0;margin:0;color:transparent;cursor:text;overflow:hidden;white-space:pre-wrap;word-wrap:break-word}.highlightTextarea.debug .highlighter{color:red;border:1px solid red;margin:-1px}.highlightTextarea mark{line-height:inherit;color:transparent;margin:0;padding:0}.highlightTextarea input,.highlightTextarea textarea{position:absolute;left:0;top:0;resize:none;white-space:pre-wrap;word-wrap:break-word}.highlightTextarea .ui-wrapper{margin:0!important}.highlightTextarea .ui-resizable-se{bottom:15px;right:0} -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/images/down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/images/down.gif -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/images/down_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/images/down_right.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/images/mep-logo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/images/mep-logo-icon.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/images/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/images/up.gif -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flagbit/Magento-MEP/95e47d9242c9dee245cc5bf9e1caf2e56017c8b8/src/skin/adminhtml/default/default/jqueryui/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /src/skin/adminhtml/default/default/tablekit.css: -------------------------------------------------------------------------------- 1 | #preview-table { 2 | border-collapse: collapse; 3 | table-layout: fixed; 4 | } 5 | 6 | #preview-table td, #preview-table th { 7 | padding: 0.5em; 8 | border: 1px solid #CCC; 9 | /*white-space: nowrap; 10 | overflow: hidden;*/ 11 | } 12 | 13 | /*th { 14 | white-space: pre; 15 | }*/ 16 | 17 | #preview-table thead, #preview-table tfoot { 18 | background-color: #DDD; 19 | } 20 | 21 | #preview-table tr.rowodd { 22 | background-color: #FFF; 23 | } 24 | 25 | #preview-table tr.roweven { 26 | background-color: #F2F2F2; 27 | } 28 | 29 | #preview-table .sortcol { 30 | cursor: pointer; 31 | padding-right: 20px; 32 | background-repeat: no-repeat; 33 | background-position: right center; 34 | } 35 | #preview-table .sortasc { 36 | background-color: #DDFFAC; 37 | background-image: url(images/up.gif); 38 | } 39 | #preview-table desc { 40 | background-color: #B9DDFF; 41 | background-image: url(images/down.gif); 42 | } 43 | #preview-table .nosort { 44 | cursor: default; 45 | } 46 | 47 | #preview-table .urg1, #preview-table .urg2, #preview-table .urg3, #preview-table .urg4, #preview-table .urg5 { 48 | padding: 3px; 49 | text-align: center; 50 | border: 1px solid #333; 51 | width: 3em; 52 | } 53 | 54 | #preview-table .urg1 { 55 | background-color: #FFFACD; 56 | } 57 | #preview-table .urg2 { 58 | background-color: #FFD700; 59 | } 60 | #preview-table .urg3 { 61 | background-color: #FFA500; 62 | } 63 | #preview-table .urg4 { 64 | background-color: #E13E00; 65 | } 66 | #preview-table .urg5 { 67 | background-color: Red; 68 | } 69 | 70 | #preview-table th.resize-handle-active { 71 | cursor: e-resize; 72 | } 73 | 74 | #preview-table div.resize-handle { 75 | cursor: e-resize; 76 | width: 2px; 77 | border-right: 1px dashed #1E90FF; 78 | position:absolute; 79 | top:0; 80 | left:0; 81 | } --------------------------------------------------------------------------------