}); // Last.fm // ----------------------------------------------------------------- $dic['Last_FM'] = $dic->factory(function () { $lf_api = LASTFM_API_KEY; $lf_api_s = LASTFM_API_S; $lastfm = new \Dandelionmood\LastFm\LastFm($lf_api, $lf_api_s); return $lastfm; }); // Twitter | Import // ----------------------------------------------------------------- $dic['Twitter_To_WP'] = $dic->factory(function ($id, $type, array $args, $post_handler_name = null) use($dic) { $wp_meta = \Cibulka::Plugin('base')->get('_WP_Meta'); $wp_meta_tax = \Cibulka::Plugin('base')->get('_WP_Meta_Tax'); $wp_cron = \Cibulka::Plugin('base')->get('_WP_Cron'); $wp_option = \Cibulka::Plugin('base')->get("_WP_Option"); if (empty($post_handler_name)) { $post_handler_name = __NAMESPACE__ . "\\ToWP\\Post"; } $post = new $post_handler_name($wp_meta, $wp_meta_tax); $twitter_getter = $dic->get("Twitter_" . ucfirst($type), $args); $import = new ToWP\Import($id, $twitter_getter, $wp_cron, $wp_option, $post); return $import; }); // ========================================================================= // Plugin // ========================================================================= $base = \Cibulka\Plugin\Base\Plugin::make(); $plugin = Plugin::make(__FILE__, '0.0.1', $dic, $base->get('Asset_Register'), $base->raw('URL')); \Cibulka\Plugin\Base\dic\app::add('Social', $plugin); $plugin->init();
\Cibulka::Plugin('theme')->enqueue_script('picturefill.js'); }); // ----------------------------------------------------------------- // CALLS // ----------------------------------------------------------------- $dic['Theme_Config'] = function () { $url = \Cibulka::Plugin('base')->URL('asset_url', 'assets-dev/theme.json'); return json_decode(file_get_contents($url), true); }; /** Localization & Language helpers */ /* --------------------------------------------------------------- */ $dic['_Inflect'] = function () { return new \Inflection(); }; $dic['Inflect'] = $dic->factory(function ($word, $num = null) use($dic) { $inflection = $dic->get('_Inflect'); $inflected = $inflection->inflect($word); if (!empty($num)) { return $inflected[$num]; } else { return $inflected; } }); $dic['Implode_And'] = $dic->factory(function ($words, $last_sep = ' and ', $inflect = false) use($dic) { if (empty($words)) { return null; } if (!empty($inflect)) { array_walk($words, function (&$v, $k) use($dic, $inflect) { $v = $dic->get('Inflect', $v, $inflect); });