function mwidget_share($site_id) { if ($site_id && strlen($site_id) > 0) { ?> <script type="text/javascript"> //<![CDATA[ ( function() { var shr = document.createElement( 'script' ); shr.setAttribute( 'data-cfasync', 'false' ); shr.src = '//dsms0mj1bbhn4.cloudfront.net/assets/pub/shareaholic.js'; shr.type = 'text/javascript'; shr.async = 'true'; shr.onload = shr.onreadystatechange = function() { var rs = this.readyState; if ( rs && rs != 'complete' && rs != 'loaded' ) return; var site_id = '<?php MPut::_js($site_id); ?> '; try { Shareaholic.init( site_id ); } catch ( e ) {} }; var s = document.getElementsByTagName( 'script' )[0]; s.parentNode.insertBefore( shr, s ); } )(); //]]> </script> <div class="share"> <h4 style="position: absolute; margin-top: 4px;">Condividi su:</h4> <div class='shareaholic-canvas' data-app='share_buttons' data-app-id='593701'></div> </div> <?php } }
function mwidget_intro() { global $content; if (!is_object($content)) { return null; } $img = $content->get_media(true); if (!is_object($img)) { $img = $content->get_media(); } if (is_array($img)) { reset($img); $img = current($img); } if (!is_object($img)) { $img = new stdClass(); $img->url = mapi_install_url() . 'media/default_content.jpg'; } ?> <div class="introimage" style="background-image: url( '<?php MPut::_link($img->url); ?> ' );"> </div> <?php }
function mwidget_content($id) { $content = MObject::get('content', $id); $title_addon = $content->get_meta('title-addon'); if ($content) { ?> <h2 class="featurette-heading"><?php MPut::_html($content->get_title()); ?> <?php if ($title_addon) { ?> <br /> <span class="text-muted"><?php ' ' . MPut::_html($title_addon->get_value()); ?> </span> <?php } ?> </h2> <p class="lead"><?php MPut::_text($content->get_text()); ?> </p> <?php } }
private static function get_browser() { $browser = null; if (!empty($_SERVER['HTTP_USER_AGENT'])) { $browser = $_SERVER['HTTP_USER_AGENT']; } self::$visitor['browser'] = MPut::text($browser); }
function mwidget_dropdownmenu($menu_item) { $menu_item = strtolower($menu_item); switch ($menu_item) { case "associarsi": $menu_id = 5; break; case "chi siamo": $menu_id = 6; break; case "eventi": $menu_id = 7; break; case "attivita'": $menu_id = 8; break; default: $menu_id = null; break; } $menu = MObject::get('menu', $menu_id); if ($menu) { $pages = $menu->get_pages(); ?> <ul style="margin:0;"> <?php if (sizeof($pages) > 0) { foreach ($pages as $page) { ?> <div style="position: relative; margin:6px; text-align:left;"> <li style="white-space:nowrap;"> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> " style="margin: 6px 0; font-size: 13px;"> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> </li> </div> <?php } } ?> </ul> <?php } }
function mwidget_dividedmenu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); if (sizeof($pages) > 0) { foreach ($pages as $page) { ?> <div<?php echo $class . $id; ?> style="position: relative;"> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> <div style="display:none;background-color:#000;min-width:100%;position:absolute; left: 0px; top: 20px;text-align: center;z-index: 9999;" > <?php M_Template::widget('dropdownmenu', $page->get_title()); ?> </div> </div> <div class="visible-xs col-xs-3"></div> <div class="visible-xs col-xs-6"> <?php M_Template::widget('dropdownmenu', $page->get_title()); ?> </div> <div class="visible-xs col-xs-3"></div> <?php } } } }
function mwidget_bottommenu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); $size = sizeof($pages); if ($size > 0) { $i = 0; foreach ($pages as $page) { $i++; ?> <a href="<?php MPut::_link($page->get_url()); ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php //MPut::_html( $page->get_title() ); ?> <?php __($page->get_title()); ?> </a> <?php if ($i != $size) { echo ' | '; } ?> <?php } } } }
function mwidget_map($zoom = 9, $cat_id = null) { global $content; global $coords; if (MValidate::coord($coords['lat']) && MValidate::coord($coords['lng'])) { ?> <div id="mmap" style="width: 100%; height: 100%;"></div> <script> var mmap = new MMap(); mmap.set_lat( <?php MPut::_numeric($coords['lat']); ?> ); mmap.set_lng( <?php MPut::_numeric($coords['lng']); ?> ); mmap.set_zoom( <?php MPut::_numeric($zoom); ?> ); mmap.create_map( 'mmap' ); <?php if ($content) { ?> mmap.create_marker(); <?php } ?> mmap.address_search(); var mmap_control = new MMapControl( mmap ); <?php if ($cat_id) { echo 'mmap_control.auto_on( ' . intval($cat_id) . ' );'; } ?> </script> <div id="mmap_modal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content">
function mwidget_content_market($id) { $content = MObject::get('content', $id); if ($content) { $img = mapi_get_default_media($content->get_id(), 'failover'); ?> <?php if (isset($img['url'])) { ?> <img class="img-circle" src="<?php MPut::_link($img['url']); ?> " alt="<?php MPut::_html_attr($img['title']); ?> " style="width: 140px; height: 140px;"> <?php } else { ?> <img class="img-circle" data-src="holder.js/140x140" alt="Generic placeholder image"> <?php } ?> <a href="index.php?module=content&object=<?php MPut::_id($content->get_id()); ?> " title="<?php MPut::_html_attr($content->get_title()); ?> "> <h2><?php MPut::_html($content->get_title()); ?> </h2> </a> <p><?php echo mapi_short_description($content->get_text(), 5); ?> </p> <?php } }
static function add_category($id) { $contents = array(); $category = MObject::get('category', $id); if ($category && sizeof($category->get_contents()) > 0) { $i = 0; foreach ($category->get_contents() as $content) { $title = ''; $title .= '<a href="index.php?module=content&object=' . MPut::id($content->get_id()) . '">' . MPut::html($content->get_title()) . '</a>'; $title .= '<br />'; $title .= '<small>(' . MPut::text($content->get_address()) . ')</small>'; $contents[$i] = array('title' => $title, 'text' => substr(strip_tags($content->get_text()), 0, 100) . ' ... <br /><br /><a href="index.php?module=content&object=' . intval($content->get_id()) . '"><small>read more >></small></a>', 'lat' => $content->get_lat(), 'lng' => $content->get_lng(), 'category' => $category->get_name()); if ('event' == $content->get_type()) { $contents[$i]['start'] = $content->get_start(); $contents[$i]['end'] = $content->get_end(); } $i++; } } return $contents; }
function mwidget_box($image, $title, $desc, $link) { ?> <div class="enterleave col-sm-4 col-xs-12" style="cursor: pointer; margin: 16px 0;" <?php if (!empty($link)) { echo 'onclick="window.open(\'' . MPut::link($link) . '\', \'_blank\');"'; } ?> > <img src="<?php if (!empty($image)) { MPut::_link($image); } ?> " /> <div class="img-caption"> <div class="row"> <div class="col-md-12" style="color: #fff;"> <h2 class="img-caption-text"><?php if (!empty($title)) { MPut::_html($title); } ?> </h2> <div class="hidden-sm img-caption-text"><?php if (!empty($desc)) { MPut::_html($desc); } ?> </div> </div> </div> </div> </div> <?php }
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-9"> <br /> <div class="input-group"> <span class="input-group-addon">Title</span> <input type="text" name="page_title" class="form-control" id="page_title" value="<?php MPut::_html_attr($data->title); ?> " /> </div> <br /> <div class="input-group"> <span class="input-group-addon">URL</span> <input type="text" name="page_url" class="form-control" id="page_url" value="<?php MPut::_html_attr($data->url); ?> " /> </div> <ul class="nav nav-pills"> <li><a href="#" data-toggle="modal" data-target="#content-chooser"><span class="glyphicon glyphicon-list"></span> Add content</a></li> <li><a href="#" data-toggle="modal" data-target="#category-chooser"><span class="glyphicon glyphicon-list-alt"></span> Add category</a></li> <li><a href="#" data-toggle="modal" data-target="#module-chooser"><span class="glyphicon glyphicon-hdd"></span> Add module</a></li> </ul> </div> <div class="col-xs-12 col-sm-12 col-md-4 col-lg-3"> <br /> <div class="panel panel-default">
<div class="fallback"><input name="content_image" type="file" multiple /></div> </div> <script type="text/javascript"> new MContent().add_media( <?php MPut::_numeric($data->id); ?> ); </script> </div> </div> </div> </div> </div> </div> <div class="btn-group" style="position: absolute;"> <button type="button" class="btn btn-default" onclick="location.href='index.php?module=mcontent&task=content_delete&object=<?php MPut::_numeric($data->id); ?> ';">Delete</button> <button type="submit" class="btn btn-primary" name="content_save">Save</button> </div> </div> </div> </form>
static function label($title) { echo '<label>' . MPut::html($title) . '</label>'; }
public function meta() { if (is_array($this->page_meta) && sizeof($this->page_meta) > 0) { foreach ($this->page_meta as $key => $value) { echo '<meta name="' . MPut::html_attr($key) . '" content="' . MPut::html_attr($value) . '" />' . "\n\t"; } } }
</div> <div class="panel panel-default"> <div class="panel-heading">Coords</div> <div class="panel-body"> <div class="form-group"> <label>Latitude</label> <input type="text" name="content_lat" class="form-control input-sm" id="content_lat" value="<?php MPut::_html_attr($coords['lat']); ?> " /> </div> <div class="form-group"> <label>Longitude</label> <input type="text" name="content_lng" class="form-control input-sm" id="content_lng" value="<?php MPut::_html_attr($coords['lng']); ?> " /> </div> </div> </div> <div class="btn-group"> <button type="submit" id="btn_add" class="btn btn-primary" name="content_add" onclick="new MContent().type_select();">Add</button> </div> </div> </div> </div> </div>
<?php } ?> <select name="page_menu" class="form-control input-sm" id="page_menu"> <?php if (sizeof($menus) > 0) { ?> <?php foreach ($menus as $menu) { ?> <option value="<?php MPut::_id($menu->id); ?> "><?php MPut::_html($menu->title); ?> </option> <?php } ?> <?php } ?> </select> <br /> <button type="button" class="btn btn-sm" onclick="new MPage().add_menu();">Add</button> </div> </div>
function mwidget_menu($menu_id, $class = null, $id = null) { $menu = MObject::get('menu', $menu_id); if ($class) { $class = ' class="' . MPut::html_attr($class) . '"'; } else { $class = ''; } if ($id) { $id = ' id="' . MPut::html_attr($id) . '"'; } else { $id = ''; } if ($menu) { $pages = $menu->get_pages(); if (sizeof($pages) > 0) { $ContentEnabled = NULL; ?> <ul<?php echo $class; echo $id; ?> > <?php foreach ($pages as $page) { ?> <?php $TheLink = $page->get_url(); $ContentID = substr(strrchr($TheLink, '='), 1); if ($ContentID > 0) { $content = MObject::get('content', intval($ContentID)); if (is_object($content)) { $ContentEnabled = $content->is_enabled(); } else { $content = MObject::get('category', intval($ContentID)); $ContentEnabled = $content->is_enabled(); } } else { $ContentEnabled = 1; } if (strrpos($TheLink, '/', 8)) { $TheLinkRoot = substr($TheLink, 0, strrpos($TheLink, '/', 8)); } else { $TheLinkRoot = $TheLink; } $TheServerRoot = str_replace("/manager", "", rtrim(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']), '/\\')); $TheRealLink = str_replace($TheLinkRoot, $TheServerRoot, $TheLink); ?> <?php if ($page->is_enabled() == 1 && $ContentEnabled == 1) { ?> <?php if ($page->page_on_blank() == TRUE) { $TargetString = '_blank'; } else { $TargetString = '_self'; } ?> <li> <a href="<?php echo $TheRealLink; //MPut::_link( $page->get_url() ); ?> " target="<?php echo $TargetString; ?> " title="<?php MPut::_html_attr($page->get_title()); ?> "> <?php MPut::_html($page->get_title()); ?> </a> </li> <?php } ?> <?php } ?> </ul> <?php } } }
static function content_location($content) { ?> <div class="content-location"> <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span itemprop="streetAddress"><?php MPut::_text($content->get_address()); ?> </span> </div> <span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates"> <meta itemprop="latitude" content="<?php MPut::_numeric($content->get_lat()); ?> " /> <meta itemprop="longitude" content="<?php MPut::_numeric($content->get_lng()); ?> " /> </span> </div> <?php }
echo date_format(new DateTime($record['end_time']), 'Y-m-d H:i:s'); ?> " /> <?php } ?> </small> <p style="margin-top: 12px;"> <?php if (isset($record['description'])) { ?> <?php MPut::_html($record['description']); ?> <input type="hidden" name="content_text" value="<?php MPut::_html_attr($record['description']); ?> " /> <?php } ?> </p> </footer> </blockquote> <input type="hidden" name="mapi_csrf" id="mapi_csrf" value="" /> </form> </li> <?php } ?> <?php
function mwidget_slider($slider_id) { $sid = intval($slider_id); if ($sid) { $contents = array(); $category = MObject::get('category', $sid); if ($category && $category->get_id()) { $contents = $category->get_contents(); } $filtered_contents = array(); $language = new M_Language(); $lang = $language->getLanguage(); //var_dump($contents);die(); if (sizeof($contents) > 0) { foreach ($contents as $content) { if ($lang == $content->get_language()) { $filtered_contents[] = $content; } } $filtered = false; if (sizeof($filtered_contents) > 0) { $contents = $filtered_contents; $filtered = true; } ?> <div id="carousel-captions" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <?php $k = 0; foreach ($contents as $content) { ?> <li data-target="#carousel-captions" data-slide-to="<?php echo $k; ?> " class="<?php if (0 == $k) { echo "active"; } ?> "></li> <?php $k++; } ?> </ol> <div class="carousel-inner"> <?php $i = 0; foreach ($contents as $content) { if ($filtered && 3 == $i) { break; } $slide = $content->get_media(true); if (!is_object($slide)) { $slide = $content->get_media(); } if (is_array($slide)) { reset($slide); $slide = current($slide); } if (!is_object($slide)) { $slide = new stdClass(); $slide->url = mapi_install_url() . 'media/default_slider.jpg'; } ?> <div class="item<?php if (0 == $i) { echo ' active'; } ?> " style="cursor: pointer;" onclick="location.href='index.php?module=content&object=<?php echo intval($content->get_id()); ?> '"> <img class="carousel-image" src="<?php MPut::_link($slide->url); ?> " style="width: 100%;"> <div class="carousel-caption"> <h3 class="hidden-xs hidden-sm"><?php MPut::_html($content->get_title()); ?> </h3> <h4 class="hidden-md hidden-lg"><?php MPut::_html($content->get_title()); ?> </h4> <p class="hidden-xs hidden-sm"><?php echo mapi_short_description($content->get_text(), 1); ?> </p> </div> <?php $hashtag = $content->get_meta('slide-hashtag'); if ($hashtag->get_value()) { ?> <a class="carousel-red-label"> #<?php MPut::_html($hashtag->get_value()); ?> </a> <?php } ?> </div> <?php $i++; } ?> </div> <a class="left carousel-control" href="#carousel-captions" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control" href="#carousel-captions" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> <?php } } }
<div class="modal-body"> <p class="text-info">Choose module:</p> <label>Module</label> <select name="module_name" class="form-control input-sm"> <?php if (sizeof($modules) > 0) { ?> <?php foreach ($modules as $module) { ?> <option value="<?php MPut::_html_attr($module->name); ?> "><?php MPut::_html($module->title); ?> </option> <?php } ?> <?php } ?> </select> <br /> <label>Task</label> <input type="text" name="module_task" class="form-control input-sm" />
<li><a href="index.php?module=muser&task=user_list">Users list <span class="glyphicon glyphicon-user"></span></a></li> <li><a href="index.php?module=muser&task=user_add">Add new user <span class="glyphicon glyphicon-plus"></span></a></li> <li class="divider"></li> <li><a href="index.php?module=preferences">Preferences <span class="glyphicon glyphicon-cog"></span></a></li> <li class="divider"></li> <?php } ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php MPut::_html(MAuth::user()); ?> <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <a href="index.php?module=profile"> Profile <span class="glyphicon glyphicon-user"></span> </a> </li> <li> <a href="javascript:void(0)" onclick="$( '#logout-form' ).submit();"> <form action="index.php?module=login" method="post" id="logout-form"> <input type="hidden" name="do-logout" value="1" /> Logout <span class="glyphicon glyphicon-off"></span> </form> </a>
</div> </div> <?php //var_dump($contents); die(); if (sizeof($contents) > 0) { foreach ($contents as $content) { $text_wrap = wordwrap(strip_tags($content->get_text()), 800, "%|%"); $text_array = explode('%|%', $text_wrap); ?> <div class="row main-header"> <div class="row content-title"> <div class="col-md-12"> <h3><?php MPut::_html($content->get_title()); ?> </h3> </div> </div> <div class="row content-text"> <div class="col-md-12"> <p><?php echo $text_array[0]; ?> ... </p> </div> </div> <div class="row content-text"> <div class="col-md-12"> <a href="index.php?module=content&object=<?php
MPut::_html($this->page_title); ?> </title> <?php $this->meta(); ?> <?php $this->output_assets('css'); ?> <link href='http://fonts.googleapis.com/css?family=Courgette&subset=latin,latin-ext' rel='stylesheet' type='text/css'> <link href="<?php MPut::_link($this->get_dir()); ?> /css/style.css" rel="stylesheet"> <link href="<?php MPut::_link($this->get_dir()); ?> /css/responsive.css" rel="stylesheet"> <?php $this->output_assets('js'); ?> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head>
function mwidget_breadcrumbs() { ?> <ol class="breadcrumb"> <li><a href="index.php">Home</a></li> <?php if ('category' == $_GET['module']) { //category oldal if (!empty($_GET['object']) || !is_numeric($_GET['object'])) { $category = new M_Category(intval($_GET['object'])); ?> <li><a href="index.php?module=category&object=<?php MPut::_html($category->get_id()); ?> "><?php MPut::_html($category->get_title()); ?> </a></li> <?php } } else { if ('content' == $_GET['module']) { //content oldal if (!empty($_GET['object']) || !is_numeric($_GET['object'])) { $content = MObject::get('content', intval($_GET['object'])); if ($content && $content->get_id()) { $categories = ORM::for_table('categories')->where_like('contents', '%{' . intval($_GET['object']) . '}%')->find_many(); ?> <li> <?php $i = 1; foreach ($categories as $cat) { ?> <a href="index.php?module=category&object=<?php MPut::_html($cat->id); ?> "><?php MPut::_html($cat->title); ?> </a> <?php if ($i < sizeof($categories)) { echo ", "; } $i++; } ?> </li> <li><a href="index.php?module=content&object=<?php MPut::_html($content->get_id()); ?> "><?php MPut::_html($content->get_title()); ?> </a></li> <?php } } } } ?> </ol> <?php }
<h4>Installed modules</h4> <?php MHTML::list_group($data['installed'], 'title', array('Disable' => 'new MModule().disable( \'*[id]\' );', 'Enable' => 'new MModule().enable( \'*[id]\' );')); ?> <?php } ?> <?php if (sizeof($forinstalls) > 0) { ?> <h4>Awaiting for install</h4> <?php MHTML::list_group($forinstalls, 'title', array('Install' => 'new MModule().install( \'*[name]\' );')); ?> <?php } ?> <input type="hidden" name="mapi_csrf" id="mapi_csrf" value="<?php MPut::_html_attr(mapi_csrf_value()); ?> " /> </form>
static function put_action($title, $js, $object = null) { if ($object && !is_object($object)) { return null; } if ($object) { $js = MHTML::action($js, $object); } echo '<button type="button" class="btn btn-xs" onclick=' . MPut::js($js) . ' style="float: right;">' . MPut::html($title) . '</button>'; }
<ul class="list-group"> <li class="list-group-item"> <h4 class="list-group-item-heading">Facebook events</h4> <p class="list-group-item-text"> <form id="import_facebook_form" method="post"> <input type="hidden" name="import_begin" value="1" /> <input type="hidden" name="import_what" value="facebook" /> <?php if (empty($appid) || empty($secret)) { ?> <a href="javascript:void(0)"><span style="text-decoration: line-through;">Import</span></a> <small>(Please set facebook appid and secret in <a href="index.php?module=preferences">preferences</a>)</small> <?php } elseif ($facebook_instance->getUser()) { ?> <a href="javascript:void(0)" onclick="$( '#import_facebook_form' ).submit();">Import</a> <?php } else { ?> <a href="javascript:void(0)"><span style="text-decoration: line-through;">Import</span></a> <small>(Please login to Your <a href="<?php MPut::_link($facebook_login_link); ?> ">facebook account</a> first)</small> <?php } ?> </fomr> </p> </li> </ul>
static function show($type = 'all', $element = 'div') { if (!$element || !in_array($element, self::$available_elements)) { $element = 'div'; } if (!self::any() > 0) { return null; } echo '<div class="m-messaging">'; switch ($type) { case 'all': if (self::any_errors() > 0) { foreach (self::$errors as $error) { echo '<' . $element . ' class="alert alert-danger">' . MPut::html($error) . '</' . $element . '>'; } } if (self::any_warnings() > 0) { foreach (self::$warnings as $warning) { echo '<' . $element . ' class="alert alert-warning">' . MPut::html($warning) . '</' . $element . '>'; } } if (self::any_success() > 0) { foreach (self::$success as $succ) { echo '<' . $element . ' class="alert alert-success">' . MPut::html($succ) . '</' . $element . '>'; } } self::clear_from_session(); break; case 'errors': if (self::any_errors() > 0) { foreach (self::$errors as $error) { echo '<' . $element . ' class="alert alert-danger">' . MPut::html($error) . '</' . $element . '>'; } } self::clear_from_session('errors'); break; case 'warnings': if (self::any_warnings() > 0) { foreach (self::$warnings as $warning) { echo '<' . $element . ' class="alert alert-warning">' . MPut::html($warning) . '</' . $element . '>'; } } self::clear_from_session('warnings'); break; case 'success': if (self::any_success() > 0) { foreach (self::$success as $succ) { echo '<' . $element . ' class="alert alert-success">' . MPut::html($succ) . '</' . $element . '>'; } } self::clear_from_session('success'); break; } echo '</div>'; }