public static function byUrl($url) { $sql = "\n\t\t\t\tSELECT id\n\t\t\t\tFROM shortcodes\n\t\t\t\tWHERE url = '{$url}'\n\t\t\t"; $value = db()->getValue($sql); $code = new ShortCode($value); if (!$code->isHydrated()) { $code->set('url', $url); $code->save(); } return $code; }
public static function init() { if (!self::$instance) { self::$instance = new self(); } else { throw new Exception("Already initalized."); } }
public function __construct() { PluginInstall::init(); // if (is_admin()) { Admin::init(); //add_filter('admin_footer_text', array($this, 'sagenda_custom_admin_footer')); //} else { ShortCode::init(); //} }
/** * Singleton. */ protected function init() { $install = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_install', Install::get_called_class()); $uninstall = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_uninstall', Uninstall::get_called_class()); $update = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_update', Update::get_called_class()); $admin = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_admin', Admin::get_called_class()); $shortcode = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_shortcode', ShortCode::get_called_class()); $view = apply_filters(VA_SOCIALBUZZ_PREFIX . 'module_view', View::get_called_class()); $install::get_instance(); $uninstall::get_instance(); $update::get_instance(); $admin::get_instance(); $shortcode::get_instance(); $view::get_instance(); add_image_size(VA_SOCIALBUZZ_PREFIX . 'thumbnail', '980', '9999', false); // Recommend you don't use this short code registering your own post data. add_shortcode('socialbuzz', array(&$this, 'add_shortcode')); if (!is_admin()) { add_action('wp_enqueue_scripts', array(&$this, 'wp_enqueue_scripts'), 15); add_filter('the_content', array(&$this, 'the_content')); } }
public function shortcode() { $code = ShortCode::byCode($this->args('code')); die($code->get('url')); }
<?php /** * Youtube for Fansoro CMS * Based on https://togetherjs.com/#tryitout-section. * * @author Moncho Varela * * @version 1.0.0 * * @license MIT */ Action::add('theme_footer', function () { echo '<script type="text/javascript" src="' . Url::getBase() . '/plugins/channel/assets/channel-dist.js"></script>'; }); ShortCode::add('Channel', function ($attr) { extract($attr); //{Channel name="nakome" limit="50"} $name = isset($name) ? $name : Config::get('plugins.channel.username'); $limit = isset($limit) ? $limit : 1; $quality = isset($quality) ? $quality : 'false'; $quantity = isset($quantity) ? $quantity : 8; // template factory $template = Template::factory(PLUGINS_PATH . '/' . Config::get('plugins.channel.name') . '/templates/'); $template->setOptions(['strip' => false]); return $template->fetch('gallery.tpl', ['name' => $name, 'limit' => $limit, 'quality' => $quality, 'quantity' => $quantity, 'apikey' => Config::get('plugins.channel.apikey')]); });
function content_566c28c879b0a4_06598792($_smarty_tpl) { ?> <html> <head> <?php echo Html::charset("utf-8"); ?> <title><?php echo Config::get('app.title'); ?> | Welcom</title> <?php ob_start(); echo Config::get('app.base_url'); $_tmp1 = ob_get_clean(); echo Html::favicon($_tmp1 . "public/favicon.ico"); ?> <?php echo Libs::css("public/assets/css/bootstrap-3.3.1.min.css", false); ?> <?php echo Libs::css("public/assets/css/bootstrap-theme-3.3.1.min.css", false); ?> <?php echo Libs::css("app/modules/welcom/Resources/public/css/hello.css", false); ?> <?php echo Libs::js("public/assets/js/jquery-1.11.3.min.js", false); ?> <?php echo Libs::js("app/modules/welcom/Resources/public/js/hello.js", false); ?> </head> <body> <img src="<?php echo Config::get('app.base_url'); ?> public/assets/images/ArFramework_logo.png" class="img" id="hello_logo" style="display:none"> <div id="welcom" style="display:none"> <div class="text"> <?php ob_start(); echo Config::get('app.owner'); $_tmp2 = ob_get_clean(); echo Lang::__("WELCOM", $_tmp2); ?> </div> <?php echo ShortCode::add_shortcode("[module id=13 name=welcom view=shortcode.listing backend=1]"); ?> </div> <?php if (isset($_SESSION['ArFramework_pnl_fst_username']) && $_SESSION['ArFramework_pnl_fst_username'] == Config::get('panel.username')) { ?> <div class="bottom_panel" id="bottom_panel" style="display:none"> <a id="fst_panel" href="<?php echo Config::get('panel.route'); ?> " target="_blank"><div class="btn hello_button" id="login"><?php echo Config::get('app.project'); ?> Panel</div></a> </div> <?php } ?> <?php echo '<script'; ?> type="text/javascript"> var Timer3 = setInterval(function(){ fade3() }, 400); var Timer1 = setInterval(function(){ fade1() }, 500); var Timer2 = setInterval(function(){ fade2() }, 1000); function fade1 () { $( "#welcom" ).fadeTo( "slow", 1 ); clearInterval(Timer1); } function fade2 () { $( "#bottom_panel" ).fadeTo( "slow", 1 ); clearInterval(Timer2); } function fade3 () { $( "#hello_logo" ).fadeTo( "slow", 1 ); clearInterval(Timer3); } <?php echo '</script'; ?> > <?php echo '<script'; ?> > $(document).ready(function (){ $("body").removeClass('installBody'); }); <?php echo '</script'; ?> > </body> </html><?php }
/** * * @param array $users * @param array $message -> $message['title'] and $message['content'] * @return boolean true if send email correctly */ public function sendNewsLitter($users = array(), $message = array()) { if (count($users) && count($message)) { $error = false; //$users = implode(',', $users); foreach ($users as $user) { $userInfo = $this->getAllSubscribers("WHERE u_id={$user}")[0]; $userE = $userInfo->u_email; $userN = $userInfo->u_name; $message['content'] = ShortCode::convert($message['content'], $userN, $userE); if (!mail($userE, $message['title'], $message['content'], self::HEAD)) { $error = true; } } if (!$error) { return true; } } return false; }
<?php /** * Morfy Githubser Plugin. * * (c) Moncho Varela / Nakome <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ // add javascript file Action::add('theme_footer', function () { echo '<script type="text/javascript" src="' . Url::getBase() . '/plugins/githubser/githubser.js"></script>'; }); // add Shortcode {Githubser name="nakome"} ShortCode::add('Githubser', function ($a) { extract($a); $name = $name ? $name : ''; return '<section> <script type="text/javascript">var githubUsername = "******";</script> <div id="githubUser"></div> </section>'; });
<?php /** * TogetherJS for Fansoro CMS * Based on https://togetherjs.com/#tryitout-section. * * @author Moncho Varela * * @version 1.0.0 * * @license MIT */ Action::add('theme_footer', 'script'); ShortCode::add('TogetherJS', 'short'); /** * Description: add javascript link on footer. */ function script() { echo '<script type="text/javascript"> var tg = document.querySelector("#start-togetherjs"); TogetherJSConfig_on = { ready: function () { // configuration var t = TogetherJS._defaultConfiguration; t.getUserName = "******"; t.getUserAvatar = "' . Config::get('plugins.togetherjs.getUserAvatar') . '"; t.sitename = "' . Config::get('plugins.togetherjs.sitename') . '"; t.enableAnalytics = "' . Config::get('plugins.togetherjs.enableAnalytics') . '"; t.analyticsCode = "' . Config::get('plugins.togetherjs.analyticsCode') . '";