[44] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * Copyright 2006, 2007, 2008, 2009 Eric D. Hough (http://ehough.com)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of TubePress (http://tubepress.org)
|
---|
| 6 | *
|
---|
| 7 | * TubePress is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * TubePress is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with TubePress. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | *
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | function_exists('tubepress_load_classes')
|
---|
| 23 | || require(dirname(__FILE__) . '/../../../tubepress_classloader.php');
|
---|
| 24 | tubepress_load_classes(array('org_tubepress_ioc_PhpCraftyIocService',
|
---|
| 25 | 'org_tubepress_ioc_IocService',
|
---|
| 26 | 'org_tubepress_player_Player',
|
---|
| 27 | 'org_tubepress_embedded_EmbeddedPlayerService',
|
---|
| 28 | 'org_tubepress_message_WordPressMessageService',
|
---|
| 29 | 'org_tubepress_shortcode_SimpleShortcodeService',
|
---|
| 30 | 'org_tubepress_options_reference_SimpleOptionsReference',
|
---|
| 31 | 'org_tubepress_gdata_inspection_SimpleFeedInspectionService',
|
---|
| 32 | 'org_tubepress_cache_SimpleCacheService',
|
---|
| 33 | 'org_tubepress_video_factory_SimpleVideoFactory',
|
---|
| 34 | 'org_tubepress_querystring_SimpleQueryStringService',
|
---|
| 35 | 'org_tubepress_player_impl_YouTubePlayer',
|
---|
| 36 | 'org_tubepress_player_impl_NormalPlayer',
|
---|
| 37 | 'org_tubepress_options_validation_SimpleInputValidationService',
|
---|
| 38 | 'org_tubepress_gdata_retrieval_HTTPRequest2',
|
---|
| 39 | 'org_tubepress_url_SimpleUrlBuilder',
|
---|
| 40 | 'org_tubepress_embedded_impl_YouTubeEmbeddedPlayerService',
|
---|
| 41 | 'org_tubepress_embedded_impl_JwFlvEmbeddedPlayerService',
|
---|
| 42 | 'org_tubepress_player_impl_ModalPlayer',
|
---|
| 43 | 'org_tubepress_options_storage_WordPressStorageManager',
|
---|
| 44 | 'org_tubepress_thumbnail_SimpleThumbnailService',
|
---|
| 45 | 'org_tubepress_options_manager_SimpleOptionsManager',
|
---|
| 46 | 'org_tubepress_pagination_DiggStylePaginationService',
|
---|
| 47 | 'org_tubepress_options_form_WidgetPrinter',
|
---|
| 48 | 'org_tubepress_options_form_FormHandler',
|
---|
| 49 | 'org_tubepress_options_form_CategoryPrinter',
|
---|
| 50 | 'org_tubepress_gallery_Gallery',
|
---|
| 51 | 'org_tubepress_gallery_WidgetGallery'));
|
---|
| 52 |
|
---|
| 53 | /**
|
---|
| 54 | * Dependency injector for TubePress in a WordPress environment
|
---|
| 55 | */
|
---|
| 56 | class org_tubepress_ioc_DefaultIocService extends org_tubepress_ioc_PhpCraftyIocService implements org_tubepress_ioc_IocService
|
---|
| 57 | {
|
---|
| 58 | function __construct()
|
---|
| 59 | {
|
---|
| 60 | /* these guys have no setters that we care about */
|
---|
| 61 | $this->def(org_tubepress_ioc_IocService::MESSAGE,
|
---|
| 62 | $this->impl('org_tubepress_message_WordPressMessageService'));
|
---|
| 63 | $this->def(org_tubepress_ioc_IocService::SHORTCODE,
|
---|
| 64 | $this->impl('org_tubepress_shortcode_SimpleShortcodeService'));
|
---|
| 65 | $this->def(org_tubepress_ioc_IocService::REFERENCE,
|
---|
| 66 | $this->impl('org_tubepress_options_reference_SimpleOptionsReference'));
|
---|
| 67 | $this->def(org_tubepress_ioc_IocService::FEED_INSP,
|
---|
| 68 | $this->impl('org_tubepress_gdata_inspection_SimpleFeedInspectionService'));
|
---|
| 69 | $this->def(org_tubepress_ioc_IocService::CACHE,
|
---|
| 70 | $this->impl('org_tubepress_cache_SimpleCacheService'));
|
---|
| 71 | $this->def(org_tubepress_ioc_IocService::VID_FACT,
|
---|
| 72 | $this->impl('org_tubepress_video_factory_SimpleVideoFactory'));
|
---|
| 73 | $this->def(org_tubepress_ioc_IocService::QUERY_STR,
|
---|
| 74 | $this->impl('org_tubepress_querystring_SimpleQueryStringService'));
|
---|
| 75 | $this->def(org_tubepress_player_Player::YOUTUBE . "-player",
|
---|
| 76 | $this->impl('org_tubepress_player_impl_YouTubePlayer'));
|
---|
| 77 |
|
---|
| 78 | /* These guys have 1 setter */
|
---|
| 79 | $this->def(org_tubepress_ioc_IocService::VALIDATION,
|
---|
| 80 | $this->impl('org_tubepress_options_validation_SimpleInputValidationService',
|
---|
| 81 | array('messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE))
|
---|
| 82 | )
|
---|
| 83 | );
|
---|
| 84 | $this->def(org_tubepress_ioc_IocService::FEED_RET,
|
---|
| 85 | $this->impl('org_tubepress_gdata_retrieval_HTTPRequest2',
|
---|
| 86 | array( 'cacheService' => $this->ref(org_tubepress_ioc_IocService::CACHE))
|
---|
| 87 | )
|
---|
| 88 | );
|
---|
| 89 | $this->def(org_tubepress_ioc_IocService::URL_BUILDER,
|
---|
| 90 | $this->impl('org_tubepress_url_SimpleUrlBuilder',
|
---|
| 91 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 92 | )
|
---|
| 93 | );
|
---|
| 94 | $this->def(org_tubepress_embedded_EmbeddedPlayerService::YOUTUBE . '-embedded',
|
---|
| 95 | $this->impl('org_tubepress_embedded_impl_YouTubeEmbeddedPlayerService',
|
---|
| 96 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 97 | )
|
---|
| 98 | );
|
---|
| 99 | $this->def(org_tubepress_embedded_EmbeddedPlayerService::LONGTAIL . '-embedded',
|
---|
| 100 | $this->impl('org_tubepress_embedded_impl_JwFlvEmbeddedPlayerService',
|
---|
| 101 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 102 | )
|
---|
| 103 | );
|
---|
| 104 | $this->def(org_tubepress_player_Player::NORMAL . "-player",
|
---|
| 105 | $this->impl('org_tubepress_player_impl_NormalPlayer',
|
---|
| 106 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 107 | )
|
---|
| 108 | );
|
---|
| 109 | $this->def(org_tubepress_player_Player::POPUP . "-player",
|
---|
| 110 | $this->impl('org_tubepress_player_impl_ModalPlayer',
|
---|
| 111 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 112 | )
|
---|
| 113 | );
|
---|
| 114 | $this->def(org_tubepress_player_Player::SHADOWBOX . "-player",
|
---|
| 115 | $this->impl('org_tubepress_player_impl_ModalPlayer',
|
---|
| 116 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 117 | )
|
---|
| 118 | );
|
---|
| 119 | $this->def(org_tubepress_player_Player::JQMODAL . "-player",
|
---|
| 120 | $this->impl('org_tubepress_player_impl_ModalPlayer',
|
---|
| 121 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 122 | )
|
---|
| 123 | );
|
---|
| 124 | $this->def(org_tubepress_player_Player::COLORBOX . "-player",
|
---|
| 125 | $this->impl('org_tubepress_player_impl_ModalPlayer',
|
---|
| 126 | array('optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR))
|
---|
| 127 | )
|
---|
| 128 | );
|
---|
| 129 |
|
---|
| 130 | /* this guy has 2 setters */
|
---|
| 131 | $this->def(org_tubepress_ioc_IocService::STORAGE,
|
---|
| 132 | $this->impl('org_tubepress_options_storage_WordPressStorageManager',
|
---|
| 133 | array(
|
---|
| 134 | 'optionsReference' => $this->ref(org_tubepress_ioc_IocService::REFERENCE),
|
---|
| 135 | 'validationService' => $this->ref(org_tubepress_ioc_IocService::VALIDATION)
|
---|
| 136 | )
|
---|
| 137 | )
|
---|
| 138 | );
|
---|
| 139 | $this->def(org_tubepress_ioc_IocService::THUMB,
|
---|
| 140 | $this->impl('org_tubepress_thumbnail_SimpleThumbnailService',
|
---|
| 141 | array(
|
---|
| 142 | 'optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR),
|
---|
| 143 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE)
|
---|
| 144 | )
|
---|
| 145 | )
|
---|
| 146 | );
|
---|
| 147 |
|
---|
| 148 | /* these guys have 3 setters */
|
---|
| 149 | $this->def(org_tubepress_ioc_IocService::OPTIONS_MGR,
|
---|
| 150 | $this->impl('org_tubepress_options_manager_SimpleOptionsManager',
|
---|
| 151 | array(
|
---|
| 152 | 'validationService' => $this->ref(org_tubepress_ioc_IocService::VALIDATION),
|
---|
| 153 | 'optionsReference' => $this->ref(org_tubepress_ioc_IocService::REFERENCE),
|
---|
| 154 | 'storageManager' => $this->ref(org_tubepress_ioc_IocService::STORAGE)
|
---|
| 155 | )
|
---|
| 156 | )
|
---|
| 157 | );
|
---|
| 158 | $this->def(org_tubepress_ioc_IocService::PAGINATION,
|
---|
| 159 | $this->impl('org_tubepress_pagination_DiggStylePaginationService',
|
---|
| 160 | array(
|
---|
| 161 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 162 | 'queryStringService' => $this->ref(org_tubepress_ioc_IocService::QUERY_STR),
|
---|
| 163 | 'optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR)
|
---|
| 164 | )
|
---|
| 165 | )
|
---|
| 166 | );
|
---|
| 167 | $this->def(org_tubepress_ioc_IocService::W_PRINTER,
|
---|
| 168 | $this->impl('org_tubepress_options_form_WidgetPrinter',
|
---|
| 169 | array(
|
---|
| 170 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 171 | 'optionsReference' => $this->ref(org_tubepress_ioc_IocService::REFERENCE),
|
---|
| 172 | 'storageManager' => $this->ref(org_tubepress_ioc_IocService::STORAGE),
|
---|
| 173 | )
|
---|
| 174 | )
|
---|
| 175 | );
|
---|
| 176 |
|
---|
| 177 | /* 4 setters, gyea */
|
---|
| 178 | $this->def(org_tubepress_ioc_IocService::FORM_HNDLER,
|
---|
| 179 | $this->impl('org_tubepress_options_form_FormHandler',
|
---|
| 180 | array(
|
---|
| 181 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 182 | 'optionsReference' => $this->ref(org_tubepress_ioc_IocService::REFERENCE),
|
---|
| 183 | 'storageManager' => $this->ref(org_tubepress_ioc_IocService::STORAGE),
|
---|
| 184 | 'categoryPrinter' => $this->ref(org_tubepress_ioc_IocService::CAT_PRINTER)
|
---|
| 185 | )
|
---|
| 186 | )
|
---|
| 187 | );
|
---|
| 188 | $this->def(org_tubepress_ioc_IocService::CAT_PRINTER,
|
---|
| 189 | $this->impl('org_tubepress_options_form_CategoryPrinter',
|
---|
| 190 | array(
|
---|
| 191 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 192 | 'optionsReference' => $this->ref(org_tubepress_ioc_IocService::REFERENCE),
|
---|
| 193 | 'storageManager' => $this->ref(org_tubepress_ioc_IocService::STORAGE),
|
---|
| 194 | 'widgetPrinter' => $this->ref(org_tubepress_ioc_IocService::W_PRINTER)
|
---|
| 195 | )
|
---|
| 196 | )
|
---|
| 197 | );
|
---|
| 198 |
|
---|
| 199 | /* the big guy */
|
---|
| 200 | $this->def(org_tubepress_ioc_IocService::GALLERY,
|
---|
| 201 | $this->impl('org_tubepress_gallery_Gallery',
|
---|
| 202 | array(
|
---|
| 203 | 'feedInspectionService' => $this->ref(org_tubepress_ioc_IocService::FEED_INSP),
|
---|
| 204 | 'feedRetrievalService' => $this->ref(org_tubepress_ioc_IocService::FEED_RET),
|
---|
| 205 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 206 | 'optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR),
|
---|
| 207 | 'paginationService' => $this->ref(org_tubepress_ioc_IocService::PAGINATION),
|
---|
| 208 | 'queryStringService' => $this->ref(org_tubepress_ioc_IocService::QUERY_STR),
|
---|
| 209 | 'thumbnailService' => $this->ref(org_tubepress_ioc_IocService::THUMB),
|
---|
| 210 | 'urlBuilderService' => $this->ref(org_tubepress_ioc_IocService::URL_BUILDER),
|
---|
| 211 | 'videoFactory' => $this->ref(org_tubepress_ioc_IocService::VID_FACT),
|
---|
| 212 | )
|
---|
| 213 | )
|
---|
| 214 | );
|
---|
| 215 | /* the other big guy */
|
---|
| 216 | $this->def(org_tubepress_ioc_IocService::WIDGET_GALL,
|
---|
| 217 | $this->impl('org_tubepress_gallery_WidgetGallery',
|
---|
| 218 | array(
|
---|
| 219 | 'feedInspectionService' => $this->ref(org_tubepress_ioc_IocService::FEED_INSP),
|
---|
| 220 | 'feedRetrievalService' => $this->ref(org_tubepress_ioc_IocService::FEED_RET),
|
---|
| 221 | 'messageService' => $this->ref(org_tubepress_ioc_IocService::MESSAGE),
|
---|
| 222 | 'optionsManager' => $this->ref(org_tubepress_ioc_IocService::OPTIONS_MGR),
|
---|
| 223 | 'paginationService' => $this->ref(org_tubepress_ioc_IocService::PAGINATION),
|
---|
| 224 | 'queryStringService' => $this->ref(org_tubepress_ioc_IocService::QUERY_STR),
|
---|
| 225 | 'thumbnailService' => $this->ref(org_tubepress_ioc_IocService::THUMB),
|
---|
| 226 | 'urlBuilderService' => $this->ref(org_tubepress_ioc_IocService::URL_BUILDER),
|
---|
| 227 | 'videoFactory' => $this->ref(org_tubepress_ioc_IocService::VID_FACT),
|
---|
| 228 | )
|
---|
| 229 | )
|
---|
| 230 | );
|
---|
| 231 | }
|
---|
| 232 | }
|
---|