*/ namespace Cibulka\Plugin\Social; if (!defined('ABSPATH')) { die; } // ========================================================================= // DIC // ========================================================================= $dic = new \Cibulka\Plugin\Base\Dic\DIC(); // Twitter // ----------------------------------------------------------------- $dic['Twitter'] = $dic->factory(function (array $args) use($dic) { $config = new \Cibulka\Plugin\Base\Config\Config(); $oauth = new \Abraham\TwitterOAuth\TwitterOAuth(CIB_TWITTER_CONSUMER, CIB_TWITTER_CONSUMER_S, CIB_TWITTER_ACCESS, CIB_TWITTER_ACCESS_S); $oauth->ssl_verifypeer = true; $twitter = new Get\Twitter($oauth, $args); return $twitter; }); // 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');
add_filter('the_content', function ($content) { return preg_replace('/<p>\\s*(<a .*>)?\\s*(<img .* \\/>)\\s*(<\\/a>)?\\s*<\\/p>/iU', '\\1\\2\\3', $content); }); }; /** Maintenance & Block access */ /* --------------------------------------------------------------- */ $dic['init_soon__brute'] = function ($admin_email = false, $login_url = false) use($dic) { $admin_email = $admin_email ?: get_option('admin_email'); $login_url = $login_url ?: wp_login_url(); $obj = new Soon\Brute($admin_email, $login_url); $obj->init(); }; /** Responsive images */ /* --------------------------------------------------------------- */ $dic['init_responsive_images'] = $dic->factory(function (array $mq) { \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');