}); // 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();
return $picture; }); $dic['Srcset__Thumbnail'] = $dic->factory(function ($id, $alt, array $sizes, array $attrs = array()) use($dic) { if (empty($id)) { throw new \Exception("Srcset: Empty ID"); } $srcset = $dic->get('_Srcset'); $srcset->set_upload($id, $alt, $sizes, $attrs, array('crop')); return $srcset; }); $dic['Srcset__Post_Thumbnail'] = $dic->factory(function ($post_id, array $sizes, array $attrs = array()) use($dic) { $id = get_post_thumbnail_id($post_id); $alt = get_the_title($post_id); $srcset = $dic->get('_Srcset'); $srcset->set_upload($id, $alt, $sizes, $attrs, array('crop')); return $srcset; }); /** Media */ /* --------------------------------------------------------------- */ $dic['Imagefilter'] = $dic->factory(function (array $size_names, array $filters, $use_original = false) { return new Image\Imagefilter($size_names, $filters, $use_original); }); // ========================================================================= // 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('theme', $plugin); $plugin->init(); $plugin->register_style('admin-bar-bottom.css', $plugin->get_asset_url('assets-dist/css/admin-bar-bottom.css'), array('admin-bar')); $plugin->register_script('picturefill.js', $plugin->get_asset_url('bower_components/picturefill/dist/picturefill.min.js'));