| 1 |
<?php |
| 2 |
|
| 3 |
$container = new ResponsiveMenu\Routing\Container(); |
| 4 |
|
| 5 |
$container['current_version'] = function($c) { |
| 6 |
return '3.0.12'; |
| 7 |
}; |
| 8 |
|
| 9 |
$container['option_helpers'] = function($c) { |
| 10 |
include dirname(__FILE__) . '/option_helpers.php'; |
| 11 |
return $option_helpers; |
| 12 |
}; |
| 13 |
|
| 14 |
$container['default_options'] = function($c) { |
| 15 |
include dirname(__FILE__) . '/default_options.php'; |
| 16 |
return $default_options; |
| 17 |
}; |
| 18 |
|
| 19 |
$container['site_id'] = get_current_blog_id(); |
| 20 |
|
| 21 |
$container['database'] = function($c) { |
| 22 |
global $wpdb; |
| 23 |
return new ResponsiveMenu\Database\WpDatabase($wpdb); |
| 24 |
}; |
| 25 |
|
| 26 |
$container['translator'] = function($c) { |
| 27 |
return new ResponsiveMenu\Translation\Translator; |
| 28 |
}; |
| 29 |
|
| 30 |
$container['minifier'] = function($c) { |
| 31 |
return new ResponsiveMenu\Formatters\Minify; |
| 32 |
}; |
| 33 |
|
| 34 |
$container['js_mapper'] = function($c) { |
| 35 |
return new ResponsiveMenu\Mappers\JsMapper; |
| 36 |
}; |
| 37 |
|
| 38 |
$container['js_factory'] = function($c) { |
| 39 |
return new ResponsiveMenu\Factories\JsFactory( |
| 40 |
$c['js_mapper'], |
| 41 |
$c['minifier'] |
| 42 |
); |
| 43 |
}; |
| 44 |
|
| 45 |
$container['scss_compiler'] = function($c) { |
| 46 |
return new scssc_free; |
| 47 |
}; |
| 48 |
|
| 49 |
$container['css_base_mapper'] = function($c) { |
| 50 |
return new ResponsiveMenu\Mappers\ScssBaseMapper($c['scss_compiler']); |
| 51 |
}; |
| 52 |
|
| 53 |
$container['css_button_mapper'] = function($c) { |
| 54 |
return new ResponsiveMenu\Mappers\ScssButtonMapper($c['scss_compiler']); |
| 55 |
}; |
| 56 |
|
| 57 |
$container['css_menu_mapper'] = function($c) { |
| 58 |
return new ResponsiveMenu\Mappers\ScssMenuMapper($c['scss_compiler']); |
| 59 |
}; |
| 60 |
|
| 61 |
$container['css_factory'] = function($c) { |
| 62 |
return new ResponsiveMenu\Factories\CssFactory( |
| 63 |
$c['minifier'], |
| 64 |
$c['css_base_mapper'], |
| 65 |
$c['css_button_mapper'], |
| 66 |
$c['css_menu_mapper'] |
| 67 |
); |
| 68 |
}; |
| 69 |
|
| 70 |
$container['scripts_builder'] = function($c) { |
| 71 |
return new ResponsiveMenu\Filesystem\ScriptsBuilder( |
| 72 |
$c['css_factory'], |
| 73 |
$c['js_factory'], |
| 74 |
new ResponsiveMenu\Filesystem\FileCreator, |
| 75 |
new ResponsiveMenu\Filesystem\FolderCreator, |
| 76 |
$c['site_id'] |
| 77 |
); |
| 78 |
}; |
| 79 |
|
| 80 |
$container['option_factory'] = function($c) { |
| 81 |
return new ResponsiveMenu\Factories\OptionFactory( |
| 82 |
$c['default_options'], |
| 83 |
$c['option_helpers'] |
| 84 |
); |
| 85 |
}; |
| 86 |
|
| 87 |
$container['option_repository'] = function($c) { |
| 88 |
return new ResponsiveMenu\Repositories\OptionRepository( |
| 89 |
$c['database'], |
| 90 |
$c['option_factory'], |
| 91 |
$c['default_options'] |
| 92 |
); |
| 93 |
}; |
| 94 |
|
| 95 |
$container['option_service'] = function($c) { |
| 96 |
return new ResponsiveMenu\Services\OptionService( |
| 97 |
$c['option_repository'], |
| 98 |
$c['option_factory'], |
| 99 |
$c['translator'], |
| 100 |
$c['scripts_builder'] |
| 101 |
); |
| 102 |
}; |
| 103 |
|
| 104 |
$container['old_version'] = function($c) { |
| 105 |
return get_option('RMVer'); |
| 106 |
}; |
| 107 |
|
| 108 |
$container['old_options'] = function($c) { |
| 109 |
return get_option('RMOptions'); |
| 110 |
}; |
| 111 |
|
| 112 |
$container['migration'] = function($c) { |
| 113 |
return new ResponsiveMenu\Database\Migration( |
| 114 |
$c['database'], |
| 115 |
$c['option_service'], |
| 116 |
$c['default_options'], |
| 117 |
$c['current_version'], |
| 118 |
$c['old_version'], |
| 119 |
$c['old_options'] |
| 120 |
); |
| 121 |
}; |
| 122 |
|
| 123 |
$container['admin_view'] = function($c) { |
| 124 |
return new ResponsiveMenu\View\AdminView; |
| 125 |
}; |
| 126 |
|
| 127 |
$container['front_view'] = function($c) { |
| 128 |
return new ResponsiveMenu\View\FrontView( |
| 129 |
$c['js_factory'], |
| 130 |
$c['css_factory'] |
| 131 |
); |
| 132 |
}; |
| 133 |
|
| 134 |
$container['admin_controller'] = function($c) { |
| 135 |
return new ResponsiveMenu\Controllers\Admin( |
| 136 |
$c['option_service'], |
| 137 |
$c['admin_view'] |
| 138 |
); |
| 139 |
}; |
| 140 |
|
| 141 |
$container['component_factory'] = function($c) { |
| 142 |
return new ResponsiveMenu\ViewModels\Components\ComponentFactory; |
| 143 |
}; |
| 144 |
|
| 145 |
$container['button_component'] = function($c) { |
| 146 |
return new ResponsiveMenu\ViewModels\Components\Button\Button($c['translator']); |
| 147 |
}; |
| 148 |
|
| 149 |
$container['menu_view'] = function($c) { |
| 150 |
return new ResponsiveMenu\ViewModels\Menu($c['component_factory']); |
| 151 |
}; |
| 152 |
|
| 153 |
$container['button_view'] = function($c) { |
| 154 |
return new ResponsiveMenu\ViewModels\Button($c['button_component']); |
| 155 |
}; |
| 156 |
|
| 157 |
$container['front_controller'] = function($c) { |
| 158 |
return new ResponsiveMenu\Controllers\Front( |
| 159 |
$c['option_service'], |
| 160 |
$c['front_view'], |
| 161 |
$c['menu_view'], |
| 162 |
$c['button_view'] |
| 163 |
); |
| 164 |
}; |
| 165 |
|